|
Cytnx v0.9.1
|
#include <LinOp.hpp>
Public Member Functions | |
| LinOp (const std::string &type, const cytnx_uint64 &nx, const int &dtype=Type.Double, const int &device=Device.cpu) | |
| Linear Operator class for iterative solvers. | |
| template<class T > | |
| void | set_elem (const cytnx_uint64 &i, const cytnx_uint64 &j, const T &elem, const bool check_exists=true) |
| Tensor::Tproxy | operator() (const cytnx_uint64 &i, const cytnx_uint64 &j) |
| void | set_device (const int &device) |
| void | set_dtype (const int &dtype) |
| int | device () const |
| int | dtype () const |
| cytnx_uint64 | nx () const |
| void | _print () |
| virtual Tensor | matvec (const Tensor &Tin) |
|
inline |
Linear Operator class for iterative solvers.
| type | the type of operator, currently it can only be "mv" (matvec) or "mv_elem" (matvec with pre-store element) |
| nx | the last dimension of operator, this should be the dimension of the input vector when "mv_elem" is used. |
| dtype | the Operator's dtype. Note that this should match the input/output Tensor's dtype. |
| device | the Operator's on device. |
The LinOp class is a class that defines a custom Linear operation acting on a Tensor or UniTensor. To use, inherit this class and override the matvec function. See the following examples for how to use them.
Total elem: 4 type : Double (Float64) cytnx device: CPU Shape : (4) [0.00000e+00 1.00000e+00 2.00000e+00 3.00000e+00 ] Total elem: 4 type : Double (Float64) cytnx device: CPU Shape : (4) [3.00000e+00 4.00000e+00 5.00000e+00 0.00000e+00 ]
| void cytnx::LinOp::_print | ( | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |