MBO
 All Data Structures Files Functions Variables Typedefs Enumerations Modules Pages
MboNumOp.h
Go to the documentation of this file.
1 /*
2 Copyright 2014 Dominic Meiser
3 
4 This file is part of mbo.
5 
6 mbo is free software: you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation, either version 3 of the License, or (at your
9 option) any later version.
10 
11 mbo is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
15 
16 You should have received a copy of the GNU General Public License along
17 with mbo. If not, see <http://www.gnu.org/licenses/>.
18 */
35 #ifndef MBO_NUM_OP_H
36 #define MBO_NUM_OP_H
37 
38 #include <MboExport.h>
39 #include <MboTensorOp.h>
40 #include <MboErrors.h>
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 struct MboNumOp_t;
54 typedef struct MboNumOp_t *MboNumOp;
55 
66 MBO_EXPORT MBO_STATUS mboNumOpCompile(MboTensorOp op, MboNumOp *numOp);
67 
73 MBO_EXPORT void mboNumOpDestroy(MboNumOp *op);
74 
83 MBO_EXPORT MboProdSpace mboNumOpGetSpace(MboNumOp op);
84 
88 MBO_EXPORT MBO_STATUS
89 mboNumOpMatVec(struct MboAmplitude alpha, MboNumOp a, struct MboAmplitude *x,
90  struct MboAmplitude beta, struct MboAmplitude *y);
91 
99 MBO_EXPORT double mboNumOpFlops(MboNumOp a);
100 
113 MBO_EXPORT void mboNumOpDenseMatrix(MboNumOp a, struct MboAmplitude *mat);
114 
136 MBO_EXPORT void mboNumOpRowOffsets(MboNumOp op, MboGlobInd rmin,
137  MboGlobInd rmax, MboGlobInd *i);
138 
157 MBO_EXPORT MBO_STATUS mboNumOpSparseMatrix(MboNumOp op, MboGlobInd rmin,
158  MboGlobInd rmax, MboGlobInd *i, MboGlobInd *j,
159  struct MboAmplitude *a);
160 
172 MBO_EXPORT void mboNumOpDiagonal(MboNumOp op, MboGlobInd rmin, MboGlobInd rmax,
173  struct MboAmplitude *diag);
174 
182 MBO_EXPORT void mboNumOpDeleteDiagonal(MboNumOp op);
183 
184 #ifdef __cplusplus
185 }
186 #endif
187 
188 #endif
MBO_EXPORT void mboNumOpDiagonal(MboNumOp op, MboGlobInd rmin, MboGlobInd rmax, struct MboAmplitude *diag)
Get diagonal entries from a numerical operator.
struct MboProdSpace_t * MboProdSpace
Type for describing tensor product spaces.
Definition: MboProdSpace.h:46
MBO_EXPORT MBO_STATUS mboNumOpMatVec(struct MboAmplitude alpha, MboNumOp a, struct MboAmplitude *x, struct MboAmplitude beta, struct MboAmplitude *y)
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.
Error codes used by the MBO library.
MBO_EXPORT MboProdSpace mboNumOpGetSpace(MboNumOp op)
Returns a (non-owning) pointer to the space of an operator.
Minimal complex numbers.
Definition: MboAmplitude.h:37
MBO_STATUS
Error codes used by the MBO library.
Definition: MboErrors.h:33
MBO_EXPORT void mboNumOpDeleteDiagonal(MboNumOp op)
Erase the diagonal from an operator.
MBO_EXPORT void mboNumOpRowOffsets(MboNumOp op, MboGlobInd rmin, MboGlobInd rmax, MboGlobInd *i)
Compute row offsets of sparse matrix.
The MboTensorOp API.
MBO_EXPORT double mboNumOpFlops(MboNumOp a)
Returns an estimate for the number of floating point operations in a MatVec.
long long MboGlobInd
Global indices.
Definition: MboIndices.h:34
MBO_EXPORT void mboNumOpDestroy(MboNumOp *op)
Deallocate all resources associated with a MboNumOp.
MBO_EXPORT void mboNumOpDenseMatrix(MboNumOp a, struct MboAmplitude *mat)
Dense matrix representation of operator.
MBO_EXPORT MBO_STATUS mboNumOpCompile(MboTensorOp op, MboNumOp *numOp)
Build a numerical operator from a tensor operator.
struct MboNumOp_t * MboNumOp
Data type for numerical operators.
Definition: MboNumOp.h:54
struct MboTensorOp_t * MboTensorOp
Definition: MboTensorOp.h:50