SharedMeatAxe  1.0
Tensor Products

Detailed Description

These function are used for calculations with tensor products.

Data Structures

struct  TkData_t
 Tensor condensation state. More...
 

Functions

int MatrixToVector (const Matrix_t *mat, Matrix_t *vecs, int n)
 Convert matrix to vector. More...
 
Matrix_tMatTensor (const Matrix_t *m1, const Matrix_t *m2)
 Tensor Product. More...
 
Matrix_tTensorMap (Matrix_t *vec, const Matrix_t *a, const Matrix_t *b)
 Map Under Tensor Product. More...
 
int TK_ReadInfo (TkData_t *tki, const char *name)
 Read a .tki file. More...
 
int TK_WriteInfo (TkData_t *tki, const char *name)
 Write a .tki file. More...
 
Matrix_tVectorToMatrix (Matrix_t *vecs, int n, int noc)
 Convert vector to matrix. More...
 

Function Documentation

int MatrixToVector ( const Matrix_t mat,
Matrix_t vecs,
int  n 
)

Convert matrix to vector.

This function converts a matrix into a row vector by concatenating the rows of the matrix. If mat is a r by c matrix, the resulting vector has rc entries. Instead of allocating a new buffer for the result, MatToVec() expects a pointer to a matrix, vecs, and puts the vector into the n-th row of this matrix. Of course, vecs must be over the smae field as mat, have rc columns and at least n+1 rows.

See also
VectorToMatrix
Parameters
matMatrix to convert.
vecsDestination of the vector.
nRow number where the vector is stored.
Returns
0 on success, -1 on error.
Matrix_t* MatTensor ( const Matrix_t m1,
const Matrix_t m2 
)

Tensor Product.

This function calculates the (Kronecker) tensor product m1⊗m2. Both matrices must be over the same field.

Parameters
m1Pointer to the first matrix.
m2Pointer to the second matrix.
Returns
The tensor product of m1 and m2, or 0 on error.
Matrix_t* TensorMap ( Matrix_t vec,
const Matrix_t a,
const Matrix_t b 
)

Map Under Tensor Product.

This function applies the tensor product of two matrices to one or more vectors. The same calculation could be done with MatMul() and MatTensor(), but this function is usually faster and uses less memory, because it does not calculate the full tensor product of a⊗b.

See also
VectorToMatrix() MatrixToVector()
Parameters
vecVectors to map.
aLeft matrix.
bRight matrix.
Returns
Image of vec under a⊗b, or 0 on error.
int TK_ReadInfo ( TkData_t tki,
const char *  name 
)

Read a .tki file.

This function reads the contents of a .tki file and puts the data into a TkData_t structure.

Parameters
tkiPointer to a TkData_t structure where the data is stored.
nameFile name without ".tki" extension (which is appended automatically).
Returns
0 on success, -1 on error.
int TK_WriteInfo ( TkData_t tki,
const char *  name 
)

Write a .tki file.

This function writes the contents of a TkData_t structure into a file.

Parameters
tkiPointer to a TkData_t structure.
nameFile name without ".tki" extension (which is appended automatically).
Returns
0 o success, -1 on error.
Matrix_t* VectorToMatrix ( Matrix_t vecs,
int  n,
int  noc 
)

Convert vector to matrix.

This function converts a vector with m=rc entries into a r by c matrix by filling the matrix from top to bottom and left to right with the entries of the vector. The vector is taken as the n-th row of vecs. A new matrix is allocated and returned. noc is the number of columns of the result, which must be a divisor of the number of columns of vecs.

See also
MatrixToVector
Parameters
vecsList of vectors.
nNumber of the vector to convert.
nocDesired number of columns.
Returns
0 on success, -1 on error.

SharedMeatAxe 1.0 documentation, generated on Sat Dec 30 2017 12:13:21