MBO
|
Typedefs | |
typedef struct MboNumOp_t * | MboNumOp |
Data type for numerical operators. More... | |
Functions | |
MBO_EXPORT MBO_STATUS | mboNumOpCompile (MboTensorOp op, MboNumOp *numOp) |
Build a numerical operator from a tensor operator. More... | |
MBO_EXPORT void | mboNumOpDestroy (MboNumOp *op) |
Deallocate all resources associated with a MboNumOp. More... | |
MBO_EXPORT MboProdSpace | mboNumOpGetSpace (MboNumOp op) |
Returns a (non-owning) pointer to the space of an operator. More... | |
MBO_EXPORT MBO_STATUS | mboNumOpMatVec (struct MboAmplitude alpha, MboNumOp a, struct MboAmplitude *x, struct MboAmplitude beta, struct MboAmplitude *y) |
MBO_EXPORT double | mboNumOpFlops (MboNumOp a) |
Returns an estimate for the number of floating point operations in a MatVec. More... | |
MBO_EXPORT void | mboNumOpDenseMatrix (MboNumOp a, struct MboAmplitude *mat) |
Dense matrix representation of operator. More... | |
MBO_EXPORT void | mboNumOpRowOffsets (MboNumOp op, MboGlobInd rmin, MboGlobInd rmax, MboGlobInd *i) |
Compute row offsets of sparse matrix. More... | |
MBO_EXPORT MBO_STATUS | mboNumOpSparseMatrix (MboNumOp op, MboGlobInd rmin, MboGlobInd rmax, MboGlobInd *i, MboGlobInd *j, struct MboAmplitude *a) |
Create a sparse matrix representation for a numerical operator. More... | |
MBO_EXPORT void | mboNumOpDiagonal (MboNumOp op, MboGlobInd rmin, MboGlobInd rmax, struct MboAmplitude *diag) |
Get diagonal entries from a numerical operator. More... | |
MBO_EXPORT void | mboNumOpDeleteDiagonal (MboNumOp op) |
Erase the diagonal from an operator. More... | |
typedef struct MboNumOp_t* MboNumOp |
Data type for numerical operators.
MboNumOp objects can be created from MboTensorOps using mboNumOpCompile
MBO_EXPORT MBO_STATUS mboNumOpCompile | ( | MboTensorOp | op, |
MboNumOp * | numOp | ||
) |
Build a numerical operator from a tensor operator.
op | Operator to compile. |
numOp | On exit this pointer contains the compiled operator. The generated MboNumOp has to be destroyed with mboNumOpDestroy. |
MBO_EXPORT void mboNumOpDeleteDiagonal | ( | MboNumOp | op | ) |
Erase the diagonal from an operator.
op | Operator from which to delete the diagonal. |
MBO_EXPORT void mboNumOpDenseMatrix | ( | MboNumOp | a, |
struct MboAmplitude * | mat | ||
) |
Dense matrix representation of operator.
This function fills the array mat with the dense matrix representation of the tensor operator. The matrix is written in row major order
a | The tensor operator. |
mat | User allocated array for the dense matrix. Has to be at least of length dim * dim, where dim is the dimension of the Hilbert space of the operator. |
MBO_EXPORT void mboNumOpDestroy | ( | MboNumOp * | op | ) |
Deallocate all resources associated with a MboNumOp.
MBO_EXPORT void mboNumOpDiagonal | ( | MboNumOp | op, |
MboGlobInd | rmin, | ||
MboGlobInd | rmax, | ||
struct MboAmplitude * | diag | ||
) |
Get diagonal entries from a numerical operator.
op | The operator. |
rmin | First row for which to get the diagonal. |
rmax | Last row for which to get the diagonal. |
diag | The diagonal. Has to point to memory for at least rmax - rmin entries. |
MBO_EXPORT double mboNumOpFlops | ( | MboNumOp | a | ) |
Returns an estimate for the number of floating point operations in a MatVec.
A complex multiply-add is counted as 8 floating point operations.
a | The numerical operator for which the flops are to be computed. |
MBO_EXPORT MboProdSpace mboNumOpGetSpace | ( | MboNumOp | op | ) |
Returns a (non-owning) pointer to the space of an operator.
op | The operator. |
MBO_EXPORT MBO_STATUS mboNumOpMatVec | ( | struct MboAmplitude | alpha, |
MboNumOp | a, | ||
struct MboAmplitude * | x, | ||
struct MboAmplitude | beta, | ||
struct MboAmplitude * | y | ||
) |
y <- alpha * a * x + beta * y
MBO_EXPORT void mboNumOpRowOffsets | ( | MboNumOp | op, |
MboGlobInd | rmin, | ||
MboGlobInd | rmax, | ||
MboGlobInd * | i | ||
) |
Compute row offsets of sparse matrix.
This method computes the row offsets of the sparse matrix representing the tensor operator. This corresponds to the i array in aij or Yale sparse matrix format. We have i[0] = 0, i[1] = nnz[rmin], i[2] = nnz[rmin] + nnz[rmin + 1], etc. In particular, i[rmax - rmin] contains the total number of non-zeros in the row range [rmin, rmax). Note that this method, like mboNumOpSparseMatrix, counts duplicate entries separately. The i array is suitable for input to mboNumOpSparseMatrix.
op | The tensor. |
rmin | Start of row range for which to compute the offsets. |
rmax | End of row range for which to compute the offsets. |
i | On exit this array contains the row offsets. The offset of the first row in the range is set to 0. Thus, in order to obtain the global offsets one has to add the global offset of the first row to all offsets in i. |
MBO_EXPORT MBO_STATUS mboNumOpSparseMatrix | ( | MboNumOp | op, |
MboGlobInd | rmin, | ||
MboGlobInd | rmax, | ||
MboGlobInd * | i, | ||
MboGlobInd * | j, | ||
struct MboAmplitude * | a | ||
) |
Create a sparse matrix representation for a numerical operator.
After a call to mboNumOpRowOffsets and mboNumOpSparseMatrix the arrays i, j, and a contain the compressed sparse row representation of the matrix for the rows [rmin, rmax).
op | Create sparse matrix for this operator. |
rmin | Start of row range for which to compute the sparse matrix. |
rmax | End of row range. |
i | Offsets array computed by mboNumOpRowOffsets. |
j | Column indices of nonzero entries. |
a | Non-zero entries. |