MBO
|
Typedefs | |
typedef struct MboVec_t * | MboVec |
Data type for representing vectors. | |
Functions | |
MBO_EXPORT MBO_STATUS | mboVecCreate (MboGlobInd dim, MboVec *v) |
Create MboVec of dimension dim. | |
MBO_EXPORT MBO_STATUS | mboVecDestroy (MboVec *v) |
Release all resources of a MboVec. | |
MBO_EXPORT MBO_STATUS | mboVecUnitVector (MboGlobInd n, MboVec v) |
Fill vector with nth unit vector Sets the nth entry in the vector to 1 and all other entries to zero. More... | |
MBO_EXPORT MboGlobInd | mboVecDim (MboVec v) |
Get dimension of vector. | |
MBO_EXPORT MBO_STATUS | mboVecGetViewRW (MboVec v, struct MboAmplitude **array) |
Obtain a read-write view of the vector data. More... | |
MBO_EXPORT MBO_STATUS | mboVecGetViewR (MboVec v, struct MboAmplitude **array) |
Obtain a read-only view of vector data. More... | |
MBO_EXPORT MBO_STATUS | mboVecReleaseView (MboVec v, struct MboAmplitude **array) |
Release a view of the vector data. | |
MBO_EXPORT MBO_STATUS | mboVecAXPY (struct MboAmplitude *a, MboVec x, MboVec y) |
y <- a * x + y | |
MBO_EXPORT MBO_STATUS | mboVecDot (MboVec x, MboVec y, struct MboAmplitude *result) |
computes the dot product of two vectors More... | |
MBO_EXPORT MBO_STATUS | mboVecSwap (MboVec x, MboVec y) |
swap contents of two vectors. More... | |
MBO_EXPORT MBO_STATUS | mboVecSet (struct MboAmplitude *a, MboVec x) |
set vector to a constant | |
MBO_EXPORT MBO_STATUS | mboVecSetRandom (MboVec x) |
Fill a vector with random numbers. | |
MBO_EXPORT MBO_STATUS | mboVecKron (int n, MboLocInd *dims, struct MboAmplitude **vecs, MboVec x) |
Add outer product of vectors. More... | |
MBO_EXPORT MBO_STATUS | mboVecMap (int n, MboLocInd *dims, void f(int, MboLocInd *, MboLocInd *, void *, struct MboAmplitude *), void *ctx, MboVec x) |
Apply a function to every entry in a vector. More... | |
MBO_EXPORT MBO_STATUS | mboVecDuplicate (MboVec x, MboVec *y) |
Duplicate a vector. More... | |
MBO_EXPORT int | mboVecCheck (MboVec v) |
Check integrity of MboVec. More... | |
MBO_EXPORT int mboVecCheck | ( | MboVec | v | ) |
Check integrity of MboVec.
v | The vector to be checked. |
MBO_EXPORT MBO_STATUS mboVecDot | ( | MboVec | x, |
MboVec | y, | ||
struct MboAmplitude * | result | ||
) |
computes the dot product of two vectors
x | vector on left hand side in dot product ("Bra") |
y | vector on right hand size in dot product ("Ket") |
result | the dot product |
MBO_EXPORT MBO_STATUS mboVecDuplicate | ( | MboVec | x, |
MboVec * | y | ||
) |
Duplicate a vector.
Generates a copy of x. The new vector must be destroyed with mboVecDestroy.
x | Vector to copy |
y | Upon exit contains the duplicate vector. |
MBO_EXPORT MBO_STATUS mboVecGetViewR | ( | MboVec | v, |
struct MboAmplitude ** | array | ||
) |
Obtain a read-only view of vector data.
The view has to be released using mboVecReleaseView before the vector can be used again. Any modifications to the array lead to undefined behaviour. To obtain a modifiable array use mboVecGetViewRW.
MBO_EXPORT MBO_STATUS mboVecGetViewRW | ( | MboVec | v, |
struct MboAmplitude ** | array | ||
) |
Obtain a read-write view of the vector data.
MBO_EXPORT MBO_STATUS mboVecKron | ( | int | n, |
MboLocInd * | dims, | ||
struct MboAmplitude ** | vecs, | ||
MboVec | x | ||
) |
Add outer product of vectors.
n | Number of arrays. n can be obtained from an MboProdSpace object by means of mboProdSpaceSize. |
dims | Length of each array. This array has to be at least of length n. dims can be obtained from an MboProdSpace object by means of mboProdSpaceGetDims. |
vecs | Array of arrays of vectors the outer product of which is taken. Has to contain at least n arrays and vecs[i] has to be at least of length dims[i]. |
x | The vector to which the result of the outer product is to be added. |
MBO_EXPORT MBO_STATUS mboVecMap | ( | int | n, |
MboLocInd * | dims, | ||
void | fint, MboLocInd *, MboLocInd *, void *, struct MboAmplitude *, | ||
void * | ctx, | ||
MboVec | x | ||
) |
Apply a function to every entry in a vector.
n | Number of dimensions. |
dims | Dimensions of underlying product space. |
f | Function to apply to entries. As the first two arguments n and dims are passed to f. The next integer array is the set of indices for a given invocation of f. The last argument is a function defined context. The context is never accessed by mboVecMap. |
ctx | Context for function application. The context is never accessed by mboVecMap. |
x | The vector to which the function is applied. |
MBO_EXPORT MBO_STATUS mboVecSwap | ( | MboVec | x, |
MboVec | y | ||
) |
swap contents of two vectors.
The dimensions of the two vectors must match.
x | First vector to swap. |
y | Second vector to swap. |
MBO_EXPORT MBO_STATUS mboVecUnitVector | ( | MboGlobInd | n, |
MboVec | v | ||
) |
Fill vector with nth unit vector Sets the nth entry in the vector to 1 and all other entries to zero.
n | Dimension in vector to set to 1. |
v | The vector to be filled by the unit vector. v must have been previously created with mboVecCreate. |