MBO
 All Data Structures Files Functions Variables Typedefs Enumerations Modules Pages
MboTensorOp.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_TENSOR_OP_H
36 #define MBO_TENSOR_OP_H
37 
38 #include <MboExport.h>
39 #include <MboProdSpace.h>
40 #include <MboElemOp.h>
41 #include <MboErrors.h>
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 struct MboAmplitude;
48 struct MboTensorOp_t;
50 typedef struct MboTensorOp_t *MboTensorOp;
51 
61 MBO_EXPORT void mboTensorOpNull(MboProdSpace h, MboTensorOp *top);
62 
72 MBO_EXPORT void mboTensorOpIdentity(MboProdSpace h, MboTensorOp *top);
73 
79 MBO_EXPORT void mboTensorOpDestroy(MboTensorOp *top);
80 
95 MBO_EXPORT void mboTensorOpAddTo(MboElemOp elemop, int i, MboTensorOp top);
96 
105 MBO_EXPORT MboProdSpace mboTensorOpGetSpace(MboTensorOp op);
106 
111 MBO_EXPORT void mboTensorOpAddScaledTo(struct MboAmplitude *alpha,
112  MboElemOp elemop, int i, MboTensorOp top);
113 
114 
121 MBO_EXPORT MboTensorOp mboTensorOpCopy(MboTensorOp a);
122 
127 MBO_EXPORT void mboTensorOpMul(MboTensorOp a, MboTensorOp b, MboTensorOp *c);
128 
133 MBO_EXPORT void mboTensorOpPlus(MboTensorOp a, MboTensorOp *b);
134 
140 MBO_EXPORT void mboTensorOpScale(struct MboAmplitude *alpha, MboTensorOp *a);
141 
147 MBO_EXPORT MBO_STATUS mboTensorOpKron(int n, MboTensorOp *ops, MboTensorOp *c);
148 
149 
159 MBO_EXPORT int mboTensorOpCheck(MboTensorOp op);
160 
161 #ifdef __cplusplus
162 }
163 #endif
164 
165 #endif
MBO_EXPORT void mboTensorOpMul(MboTensorOp a, MboTensorOp b, MboTensorOp *c)
Multiply two operators and add result to third (*c) += a * b.
MBO_EXPORT MBO_STATUS mboTensorOpKron(int n, MboTensorOp *ops, MboTensorOp *c)
Tensor product of two operators.
MBO_EXPORT void mboTensorOpDestroy(MboTensorOp *top)
Destroy a tensor operator object.
struct MboProdSpace_t * MboProdSpace
Type for describing tensor product spaces.
Definition: MboProdSpace.h:46
MBO_EXPORT int mboTensorOpCheck(MboTensorOp op)
Check integrity of tensor operator.
MBO_EXPORT MboProdSpace mboTensorOpGetSpace(MboTensorOp op)
Get the space on which the operator is defined This method returns a non-owning pointer to the space ...
MBO_EXPORT void mboTensorOpNull(MboProdSpace h, MboTensorOp *top)
Create a tensor operator corresponding to the Null operator.
MBO_EXPORT void mboTensorOpPlus(MboTensorOp a, MboTensorOp *b)
Add a tensor operator to another operator (*b) += a.
Error codes used by the MBO library.
MBO_EXPORT MboTensorOp mboTensorOpCopy(MboTensorOp a)
Create a deep copy of a tensor operator.
MBO_EXPORT void mboTensorOpScale(struct MboAmplitude *alpha, MboTensorOp *a)
Scale operator.
Minimal complex numbers.
Definition: MboAmplitude.h:37
struct MboElemOp_t * MboElemOp
Type for representing elementary operators.
Definition: MboElemOp.h:56
MBO_EXPORT void mboTensorOpAddTo(MboElemOp elemop, int i, MboTensorOp top)
Add an embedding to a tensor operator.
MBO_STATUS
Error codes used by the MBO library.
Definition: MboErrors.h:33
Definition of elementary operators.
The MboProdSpace API.
MBO_EXPORT void mboTensorOpAddScaledTo(struct MboAmplitude *alpha, MboElemOp elemop, int i, MboTensorOp top)
Adds scaled version of embedded operator to tensor operator.
struct MboTensorOp_t * MboTensorOp
Definition: MboTensorOp.h:50
MBO_EXPORT void mboTensorOpIdentity(MboProdSpace h, MboTensorOp *top)
Create a tensor operator corresponding to the Identity operator.