|
<html><head><title>dlib C++ Library - cusolver_dlibapi.h</title></head><body bgcolor='white'><pre> |
|
<font color='#009900'>// Copyright (C) 2017 Davis E. King ([email protected]) |
|
</font><font color='#009900'>// License: Boost Software License See LICENSE.txt for the full license. |
|
</font><font color='#0000FF'>#ifndef</font> DLIB_DNN_CuSOLVER_H_ |
|
<font color='#0000FF'>#define</font> DLIB_DNN_CuSOLVER_H_ |
|
|
|
<font color='#0000FF'>#ifdef</font> DLIB_USE_CUDA |
|
|
|
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='tensor.h.html'>tensor.h</a>" |
|
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='cuda_errors.h.html'>cuda_errors.h</a>" |
|
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='cuda_data_ptr.h.html'>cuda_data_ptr.h</a>" |
|
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../noncopyable.h.html'>../noncopyable.h</a>" |
|
|
|
<font color='#0000FF'>namespace</font> dlib |
|
<b>{</b> |
|
<font color='#0000FF'>namespace</font> cuda |
|
<b>{</b> |
|
|
|
<font color='#009900'>// ----------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>class</font> <b><a name='inv'></a>inv</b> : noncopyable |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
WHAT THIS OBJECT REPRESENTS |
|
This is a functor for doing matrix inversion on the GPU. The only |
|
reason it's an object is to avoid the reallocation of some GPU memory |
|
blocks if you want to do a bunch of matrix inversions in a row. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>public</font>: |
|
|
|
<b><a name='inv'></a>inv</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> <font color='#0000FF'>default</font>; |
|
~<b><a name='inv'></a>inv</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='operator'></a>operator</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> tensor<font color='#5555FF'>&</font> m, |
|
resizable_tensor<font color='#5555FF'>&</font> out |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- m.size() == m.num_samples()*m.num_samples() |
|
(i.e. mat(m) must be a square matrix) |
|
ensures |
|
- out == inv(mat(m)); |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>int</u></font> <b><a name='get_last_status'></a>get_last_status</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns 0 if the last matrix inversion was successful and != 0 |
|
otherwise. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>private</font>: |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='sync_if_needed'></a>sync_if_needed</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; |
|
|
|
<font color='#0000FF'><u>bool</u></font> did_work_lately <font color='#5555FF'>=</font> <font color='#979000'>false</font>; |
|
resizable_tensor m; |
|
cuda_data_ptr<font color='#5555FF'><</font><font color='#0000FF'><u>float</u></font><font color='#5555FF'>></font> workspace; |
|
cuda_data_ptr<font color='#5555FF'><</font><font color='#0000FF'><u>int</u></font><font color='#5555FF'>></font> Ipiv; |
|
cuda_data_ptr<font color='#5555FF'><</font><font color='#0000FF'><u>int</u></font><font color='#5555FF'>></font> info; |
|
<b>}</b>; |
|
|
|
<font color='#009900'>// ------------------------------------------------------------------------------------ |
|
</font> |
|
<b>}</b> |
|
<b>}</b> |
|
|
|
<font color='#0000FF'>#endif</font> <font color='#009900'>// DLIB_USE_CUDA |
|
</font> |
|
<font color='#0000FF'>#endif</font> <font color='#009900'>// DLIB_DNN_CuSOLVER_H_ |
|
</font> |
|
|
|
|
|
|
|
</pre></body></html> |