Libra C functions
[Libra C API, programming CPUs and GPUs.]


Enumerations

enum  gDataType { GINT32 = 3, GFLOAT32 = 4, GFLOAT64 = 8 }
enum  gBackend
enum  gRenderMode { GDISPLAY2D = (1 << 1), GHEIGHTFIELD2D = (1 << 3), GSTATS = (1 << 4) }

Functions

LIBRA_API int libra_Init (int argc, char **argv)
 Initializes Libra API.
LIBRA_API void libra_Shutdown ()
 Shutdown Libra API and release Libra internal resources.
LIBRA_API void libra_SetDefaultDataType (gDataType dataType)
 Set default Libra API data type.
LIBRA_API gDataType libra_GetDefaultDataType ()
 Get default Libra API data type.
LIBRA_API void libra_SetCurrentBackend (enum gBackend backend)
 Set Libra API current compute backend.
LIBRA_API enum gBackend libra_GetCurrentBackend ()
 Get Libra API current compute backend.
LIBRA_API void libra_SetDefaultIndexing (int indexing)
 Set default Libra API indexing mode.
LIBRA_API int libra_GetDefaultIndexing ()
 Get default Libra API indexing mode.
LIBRA_API void libra_Flush ()
 flush all Libra API commands for processing.
LIBRA_API void libra_Finish ()
 finish processing of all Libra API commands.
LIBRA_API gVarHandle libra_Create (gVarHandle *dst, int rowCount, int columnCount, int type)
 creates an MxN array.
LIBRA_API gVarHandle libra_ComplexCreate (gVarHandle *dst, int rowCount, int columnCount, int type)
 creates an MxN array of complex valued elements.
LIBRA_API gVarHandle libra_Sparse_f (gVarHandle *dst, float *values, int *rows, int *columns, int nz, int type)
 creates a sparse matrix, with input in Coordinate format.
LIBRA_API gVarHandle libra_Sparse_d (gVarHandle *dst, double *values, int *rows, int *columns, int nz, int type)
 creates a sparse matrix, with input in Coordinate format.
LIBRA_API gVarHandle libra_SparseBlockDiagonal_f (gVarHandle *dst, float *values, int *rows, int *columns, int nz, int blockCount, int type)
 creates a sparse matrix, with input in Coordinate format.
LIBRA_API gVarHandle libra_SparseBlockDiagonal_d (gVarHandle *dst, double *values, int *rows, int *columns, int nz, int blockCount, int type)
 creates a sparse matrix, with input in Coordinate format.
LIBRA_API gVarHandle libra_SparseCSC_f (gVarHandle *dst, float *values, int *rows, int *colIndex, int nz, int type)
 creates a sparse matrix, with input in Compressed Sparse Column (CSC) format.
LIBRA_API gVarHandle libra_SparseCSC_d (gVarHandle *dst, double *values, int *rows, int *colIndex, int nz, int type)
 creates a sparse matrix, with input in Compressed Sparse Column (CSC) format.
LIBRA_API gVarHandle libra_SparseCSR_f (gVarHandle *dst, float *values, int *columns, int *rowIndex, int nz, int type)
 creates a sparse matrix, with input in Compressed Sparse Row (CSR) format.
LIBRA_API gVarHandle libra_SparseCSR_d (gVarHandle *dst, double *values, int *columns, int *rowIndex, int nz, int type)
 creates a sparse matrix, with input in Compressed Sparse Row (CSR) format.
LIBRA_API gVarHandle libra_SparseBanded_f (gVarHandle *dst, int rowCount, int columnCount, float **values, int *positions, int bandCount, int type)
 creates a sparse matrix, with input in Coordinate (Coord) format.
LIBRA_API gVarHandle libra_SparseBanded_d (gVarHandle *dst, int rowCount, int columnCount, double **values, int *positions, int bandCount, int type)
 creates a sparse matrix, with input in Coordinate (Coord) format.
LIBRA_API gVarHandle libra_SparseBanded2_f (gVarHandle *dst, int rowCount, int columnCount, float *values, int *positions, int bandCount, int type)
 creates a sparse matrix, with input in Coordinate (Coord) format.
LIBRA_API gVarHandle libra_SparseBanded2_d (gVarHandle *dst, int rowCount, int columnCount, double *values, int *positions, int bandCount, int type)
 creates a sparse matrix, with input in Coordinate (Coord) format.
LIBRA_API gVarHandle libra_ComplexSparse_f (gVarHandle *dst, float *values, int *rows, int *columns, int nz, int type)
 creates a sparse matrix, with input in Coordinate format.
LIBRA_API gVarHandle libra_ComplexSparse_d (gVarHandle *dst, double *values, int *rows, int *columns, int nz, int type)
 creates a sparse matrix, with input in Coordinate format.
LIBRA_API gVarHandle libra_ComplexSparseBlockDiagonal_f (gVarHandle *dst, float *values, int *rows, int *columns, int nz, int blockCount, int type)
 creates a block diagonal sparse matrix, with input in Coordinate format.
LIBRA_API gVarHandle libra_ComplexSparseBlockDiagonal_d (gVarHandle *dst, double *values, int *rows, int *columns, int nz, int blockCount, int type)
 creates a block diagonal sparse matrix, with input in Coordinate format.
LIBRA_API gVarHandle libra_ComplexSparseCSC_f (gVarHandle *dst, float *values, int *rows, int *colIndex, int nz, int type)
 creates a sparse matrix, with input in Compressed Sparse Column (CSC) format.
LIBRA_API gVarHandle libra_ComplexSparseCSC_d (gVarHandle *dst, double *values, int *rows, int *colIndex, int nz, int type)
 creates a sparse matrix, with input in Compressed Sparse Column (CSC) format.
LIBRA_API gVarHandle libra_ComplexSparseCSR_f (gVarHandle *dst, float *values, int *columns, int *rowIndex, int nz, int type)
 creates a sparse matrix, with input in Compressed Sparse Row (CSR) format.
LIBRA_API gVarHandle libra_ComplexSparseCSR_d (gVarHandle *dst, double *values, int *columns, int *rowIndex, int nz, int type)
 creates a sparse matrix, with input in Compressed Sparse Row (CSR) format.
LIBRA_API gVarHandle libra_ComplexSparseBanded_f (gVarHandle *dst, int rowCount, int columnCount, float **values, int *positions, int bandCount, int type)
 creates a sparse matrix, with input in Coordinate (Coord) format.
LIBRA_API gVarHandle libra_ComplexSparseBanded_d (gVarHandle *dst, int rowCount, int columnCount, double **values, int *positions, int bandCount, int type)
 creates a sparse matrix, with input in Coordinate (Coord) format.
LIBRA_API double libra_GetTime ()
 used for performance measuring Libra API.
LIBRA_API void libra_GetRenderBufferBytes8888 (int *renderBufferBytes)
 gets the byte elements of the renderbuffer object RGBA_8888 format and writes them into a sequential byte array
LIBRA_API void libra_SetRenderMatrix (float *matrix4x4)
 when Libra is in debug or SDK mode, displays a variable graphically, transformed by the supplied 4x4 transform matrix.
LIBRA_API void libra_Render (gVarHandle var, gRenderMode mode, int varRowStride)
 when Libra is in debug or SDK mode, displays a variable graphically.
LIBRA_API void libra_RenderText (const char *string, unsigned int pixelPosX, unsigned int pixelPosY, unsigned int colorRGBA)
 when Libra is in debug or SDK mode, displays a text string graphically.
LIBRA_API gVarHandle libra_Eye (gVarHandle *dst, int rowCount, int columnCount, int type)
 creates an identity matrix.
LIBRA_API gVarHandle libra_ComplexEye (gVarHandle *dst, int rowCount, int columnCount, int type)
 creates an identity matrix.
LIBRA_API gVarHandle libra_Ones (gVarHandle *dst, int rowCount, int columnCount, int type)
 creates a matrix whose elements are all 1.
LIBRA_API gVarHandle libra_ComplexOnes (gVarHandle *dst, int rowCount, int columnCount, int type)
 creates a matrix whose elements are all 1.
LIBRA_API gVarHandle libra_Zeros (gVarHandle *dst, int rowCount, int columnCount, int type)
 creates a matrix whose elements are all 0.
LIBRA_API gVarHandle libra_ComplexZeros (gVarHandle *dst, int rowCount, int columnCount, int type)
 creates a matrix whose elements are all 0.
LIBRA_API gVarHandle libra_Indexmap (gVarHandle *dst, int rowCount, int columnCount, float rowCoeff, float colCoeff, float offs, int type)
 creates an object where the element values are a linear function of their row, column index.
LIBRA_API gVarHandle libra_Step (gVarHandle *dst, float from, float to, float stride, int type)
 creates a vector which elements are in a sequence
LIBRA_API gVarHandle libra_Rand (gVarHandle *dst, int rowCount, int columnCount, int type, float scale)
 creates a matrix filled with random values.
LIBRA_API void libra_Release (gVarHandle *handle)
 releases a gVarHandle.
LIBRA_API gVarHandle libra_Assign (gVarHandle *dst, gVarHandle var)
 assigns a Libra object to another object.
LIBRA_API gVarHandle libra_Subarray (gVarHandle *dst, gVarHandle rows, gVarHandle columns, gVarHandle array)
 returns a subarray of a Libra object to another object.
LIBRA_API gHandle libra_malloc (const unsigned int byteCount)
 allocates count bytes of memory from computer main memory.
LIBRA_API void libra_free (const gHandle memory)
 free the memory allocated using libra_malloc.
LIBRA_API void libra_SetIntData (gVarHandle handle, const int *mem, unsigned int byteOffset, unsigned int byteCount, gHandle callFunc, gHandle userData)
 sets the elements of an object from an integer array
LIBRA_API void libra_SetFloatData (gVarHandle handle, const float *mem, unsigned int byteOffset, unsigned int byteCount, gHandle callFunc, gHandle userData)
 sets the elements of an object from an float array
LIBRA_API void libra_SetDoubleData (gVarHandle handle, const double *mem, unsigned int byteOffset, unsigned int byteCount, gHandle callFunc, gHandle userData)
 sets the elements of an object from an double array
LIBRA_API void libra_GetIntData (gVarHandle handle, int *mem, unsigned int byteOffset, unsigned int byteCount, gHandle callFunc, gHandle userData)
 gets the elements of an object and writes them into an int array
LIBRA_API void libra_GetFloatData (gVarHandle handle, float *mem, unsigned int byteOffset, unsigned int byteCount, gHandle callFunc, gHandle userData)
 gets the elements of an object and writes them into an float array
LIBRA_API void libra_GetDoubleData (gVarHandle handle, double *mem, unsigned int byteOffset, unsigned int byteCount, gHandle callFunc, gHandle userData)
 gets the elements of an object and writes them into an double array
LIBRA_API int libra_GetRowCount (gVarHandle handle)
 get the number of rows from an object.
LIBRA_API int libra_GetColumnCount (gVarHandle handle)
 get the number of columns from an object.
LIBRA_API int libra_GetElementCount (gVarHandle handle)
 get the number of elements from an object.
LIBRA_API int libra_GetDimensionCount (gVarHandle handle)
 get the number of dimensions from an object.
LIBRA_API int libra_GetType (gVarHandle handle)
 get the gDataType of an object.
LIBRA_API int libra_IsComplex (gVarHandle *dst, gVarHandle handle)
 return 1 if the queried object is a complex object othwerwise 0.
LIBRA_API int libra_IsSparse (gVarHandle *dst, gVarHandle handle)
 return 1 if the queried object is a sparse data object othwerwise 0.
LIBRA_API int libra_IsReal (gVarHandle *dst, gVarHandle handle)
 return 1 if the queried object is a real object othwerwise 0.
LIBRA_API void libra_SetPrintFunc (void(*func)(const char *msg))
 set print function.
LIBRA_API void libra_PrintVar (gVarHandle handle)
 print the elements of an object.
LIBRA_API void libra_PrintText (const char *text)
 print the text string to output. Default output is stdout and debug window if available.
LIBRA_API void libra_PrintFloat (float f)
 print f.
LIBRA_API void libra_PrintDouble (double d)
 print d.
LIBRA_API void libra_PrintInt (int i)
 print i.
LIBRA_API gVarHandle libra_Matmul (gVarHandle *dst, gVarHandle gVH1, gVarHandle gVH2)
 perform matrix multiply.
LIBRA_API gVarHandle libra_JacobiIter (gVarHandle *dst, gVarHandle gVH1, gVarHandle gVH2, gVarHandle gVH3)
 perform one jacobi iteration.
LIBRA_API gVarHandle libra_JacobiSolve (gVarHandle *dst, gVarHandle gVH1, gVarHandle gVH2)
 return the the solution of a linear equation system.
LIBRA_API gVarHandle libra_Mul (gVarHandle *dst, gVarHandle gVH1, gVarHandle gVH2)
 perform multiply, element by element.
LIBRA_API gVarHandle libra_Muldv (gVarHandle *dst, double d, gVarHandle var)
 perform multiply, element by element.
LIBRA_API gVarHandle libra_Mulvd (gVarHandle *dst, gVarHandle var, double d)
 perform multiply, element by element.
LIBRA_API gVarHandle libra_Mulfv (gVarHandle *dst, float f, gVarHandle var)
 perform multiply, element by element.
LIBRA_API gVarHandle libra_Mulvf (gVarHandle *dst, gVarHandle var, float f)
 perform multiply, element by element.
LIBRA_API gVarHandle libra_Div (gVarHandle *dst, gVarHandle gVH1, gVarHandle gVH2)
 perform division, element by element.
LIBRA_API gVarHandle libra_Divdv (gVarHandle *dst, double d, gVarHandle gVH2)
 perform division, element by element.
LIBRA_API gVarHandle libra_Divfv (gVarHandle *dst, float f, gVarHandle gVH2)
 perform division, element by element.
LIBRA_API gVarHandle libra_Divvd (gVarHandle *dst, gVarHandle gVH1, double d)
 perform division, element by element.
LIBRA_API gVarHandle libra_Divvf (gVarHandle *dst, gVarHandle gVH1, float f)
 perform division, element by element.
LIBRA_API gVarHandle libra_Mldivide (gVarHandle *dst, gVarHandle gVH1, gVarHandle gVH2)
 perform left division.
LIBRA_API gVarHandle libra_Pow (gVarHandle *dst, gVarHandle gVH1, gVarHandle gVH2)
 performs the power function, raising base left operand to the power of right operand, element by element.
LIBRA_API gVarHandle libra_Mod (gVarHandle *dst, gVarHandle gVH1, gVarHandle gVH2)
 perform modulo operation, element by element.
LIBRA_API gVarHandle libra_Add (gVarHandle *dst, gVarHandle gVH1, gVarHandle gVH2)
 perform addition, element by element.
LIBRA_API gVarHandle libra_Sub (gVarHandle *dst, gVarHandle gVH1, gVarHandle gVH2)
 perform subtraction, element by element.
LIBRA_API gVarHandle libra_Dot (gVarHandle *dst, gVarHandle gVH1, gVarHandle gVH2)
 perform the inner (dot) product.
LIBRA_API gVarHandle libra_Neg (gVarHandle *dst, gVarHandle var)
 performs negation.
LIBRA_API gVarHandle libra_Max (gVarHandle *dst, gVarHandle var)
 performs max of the elements of an object.
LIBRA_API gVarHandle libra_Maxvv (gVarHandle *dst, gVarHandle gVH1, gVarHandle gVH2)
 perform max, element by element.
LIBRA_API gVarHandle libra_Min (gVarHandle *dst, gVarHandle var)
 performs min of the elements of an object.
LIBRA_API gVarHandle libra_Minvv (gVarHandle *dst, gVarHandle gVH1, gVarHandle gVH2)
 perform min, element by element.
LIBRA_API gVarHandle libra_ImageFilter (gVarHandle *dst, gVarHandle var1, gVarHandle var2, const char *options)
 return the linear filtering of image var1 and filter var2.
LIBRA_API gVarHandle libra_Sin (gVarHandle *dst, gVarHandle var)
 performs sine, element by element.
LIBRA_API gVarHandle libra_Cos (gVarHandle *dst, gVarHandle var)
 performs cosine, element by element.
LIBRA_API gVarHandle libra_Tan (gVarHandle *dst, gVarHandle var)
 performs tangent, element by element.
LIBRA_API gVarHandle libra_ArcSin (gVarHandle *dst, gVarHandle var)
 performs arcsine (inverse of sine), element by element.
LIBRA_API gVarHandle libra_ArcCos (gVarHandle *dst, gVarHandle var)
 performs arccosine (inverse of cosine), element by element.
LIBRA_API gVarHandle libra_ArcTan (gVarHandle *dst, gVarHandle var)
 performs arctangent (inverse of tangent), element by element.
LIBRA_API gVarHandle libra_Log (gVarHandle *dst, gVarHandle var)
 performs the natural logarithm, element by element.
LIBRA_API gVarHandle libra_Log2 (gVarHandle *dst, gVarHandle var)
 performs the logarithm of base 2, element by element.
LIBRA_API gVarHandle libra_Log10 (gVarHandle *dst, gVarHandle var)
 performs the logarithm of base 10, element by element.
LIBRA_API gVarHandle libra_Exp (gVarHandle *dst, gVarHandle var)
 performs the exponential function of base e, element by element.
LIBRA_API gVarHandle libra_Exp2 (gVarHandle *dst, gVarHandle var)
 performs the exponential function of base 2, element by element.
LIBRA_API gVarHandle libra_Exp10 (gVarHandle *dst, gVarHandle var)
 performs the exponential function of base 10, element by element.
LIBRA_API gVarHandle libra_Sqrt (gVarHandle *dst, gVarHandle var)
 computes the squared root, element by element.
LIBRA_API gVarHandle libra_InvSqrt (gVarHandle *dst, gVarHandle var)
 computes 1.0 divided by the squared root, element by element.
LIBRA_API gVarHandle libra_Ceil (gVarHandle *dst, gVarHandle var)
 the input is rounded upwards to nearest integer, element by element.
LIBRA_API gVarHandle libra_Floor (gVarHandle *dst, gVarHandle var)
 the input is rounded downwards (truncated) to the nearest integer, element by element.
LIBRA_API gVarHandle libra_Round (gVarHandle *dst, gVarHandle var)
 the input is rounded to the nearest integer, element by element.
LIBRA_API gVarHandle libra_Abs (gVarHandle *dst, gVarHandle var)
 computes the absolute value, element by element.
LIBRA_API gVarHandle libra_Sign (gVarHandle *dst, gVarHandle var)
 performs the sign (sgn) function, element by element.
LIBRA_API gVarHandle libra_Sum (gVarHandle *dst, gVarHandle var)
 computes the sum of all elements in an object.
LIBRA_API gVarHandle libra_Transpose (gVarHandle *dst, gVarHandle var)
 computes the transpose of an object.
LIBRA_API gVarHandle libra_Conj (gVarHandle *dst, gVarHandle var)
 computes the conj of an object.
LIBRA_API gVarHandle libra_Cast (gVarHandle *dst, gVarHandle var, gDataType dataType)
 casts an object into a new object with the specified gDataType.
LIBRA_API gVarHandle libra_Usolve (gVarHandle *dst, gVarHandle gVH1, gVarHandle gVH2)
 return the the solution of a upper triangular equation system.
LIBRA_API gVarHandle libra_Lsolve (gVarHandle *dst, gVarHandle gVH1, gVarHandle gVH2)
 return the the solution of a lower triangular equation system.
LIBRA_API gVarHandle libra_CGsolve (gVarHandle *dst, gVarHandle gVH1, gVarHandle gVH2)
 return the the solution of a linear equation system.
LIBRA_API gVarHandle libra_Sort (gVarHandle *dst, gVarHandle var)
 return a sorted gVar.
LIBRA_API gVarHandle libra_FFT (gVarHandle *dst, gVarHandle var)
 return the 1D fourier transform of a gVar.
LIBRA_API gVarHandle libra_IFFT (gVarHandle *dst, gVarHandle var)
 return the inverse 1D fourier transform of a gVar.
LIBRA_API gVarHandle libra_FFTShift (gVarHandle *dst, gVarHandle var)
 swaps "half-spaces" of var along each dimension.
LIBRA_API gVarHandle libra_IFFTShift (gVarHandle *dst, gVarHandle var)
 inverse swaps "half-spaces" of var along each dimension.
LIBRA_API gVarHandle libra_Real (gVarHandle *dst, gVarHandle var)
 return Real part of a gVar.
LIBRA_API gVarHandle libra_Imag (gVarHandle *dst, gVarHandle var)
 return Imag part of a gVar.
LIBRA_API gVarHandle libra_ComplexCreateVar (gVarHandle *dst, gVarHandle gVH1, gVarHandle gVH2)
 return a Complex var from two Real var.
LIBRA_API gVarHandle libra_Diag (gVarHandle *dst, gVarHandle var)
 extracts the diagonal of an object
LIBRA_API gVarHandle libra_Diag_K (gVarHandle *dst, gVarHandle var, int k)
 creates an object (typically a matrix) with the specified diagonal at position k.
LIBRA_API gVarHandle libra_CmpEq (gVarHandle *dst, gVarHandle gVH1, gVarHandle gVH2)
 compares two objects, element by element
LIBRA_API gVarHandle libra_CmpGt (gVarHandle *dst, gVarHandle gVH1, gVarHandle gVH2)
 compares two objects, element by element
LIBRA_API gVarHandle libra_CmpGeq (gVarHandle *dst, gVarHandle gVH1, gVarHandle gVH2)
 compares two objects, element by element
LIBRA_API gVarHandle libra_CmpLt (gVarHandle *dst, gVarHandle gVH1, gVarHandle gVH2)
 compares two objects, element by element
LIBRA_API gVarHandle libra_CmpLeq (gVarHandle *dst, gVarHandle gVH1, gVarHandle gVH2)
 compares two objects, element by element
LIBRA_API gVarHandle libra_Compare_NotEqual (gVarHandle *dst, gVarHandle gVH1, gVarHandle gVH2)
 compares two objects, element by element
LIBRA_API gVarHandle libra_Not (gVarHandle *dst, gVarHandle var)
 perform the logical not operation of an object, element by element
LIBRA_API gVarHandle libra_And (gVarHandle *dst, gVarHandle gVH1, gVarHandle gVH2)
 perform the logical and operation of two objects, element by element
LIBRA_API gVarHandle libra_Anddv (gVarHandle *dst, double d, gVarHandle var)
 perform the logical and operation of two objects, element by element
LIBRA_API gVarHandle libra_Andvd (gVarHandle *dst, gVarHandle var, double d)
 perform the logical and operation of two objects, element by element
LIBRA_API gVarHandle libra_Andfv (gVarHandle *dst, float f, gVarHandle var)
 perform the logical and operation of two objects, element by element
LIBRA_API gVarHandle libra_Andvf (gVarHandle *dst, gVarHandle var, float f)
 perform the logical and operation of two objects, element by element
LIBRA_API gVarHandle libra_Or (gVarHandle *dst, gVarHandle gVH1, gVarHandle gVH2)
 perform the logical or operation of two objects, element by element
LIBRA_API gVarHandle libra_Ordv (gVarHandle *dst, double d, gVarHandle var)
 perform the logical and operation of two objects, element by element
LIBRA_API gVarHandle libra_Orvd (gVarHandle *dst, gVarHandle var, double d)
 perform the logical and operation of two objects, element by element
LIBRA_API gVarHandle libra_Orfv (gVarHandle *dst, float f, gVarHandle var)
 perform the logical and operation of two objects, element by element
LIBRA_API gVarHandle libra_Orvf (gVarHandle *dst, gVarHandle var, float f)
 perform the logical and operation of two objects, element by element
LIBRA_API gVarHandle libra_Xor (gVarHandle *dst, gVarHandle gVH1, gVarHandle gVH2)
 perform the logical xor operation of two objects, element by element
LIBRA_API gVarHandle libra_Xordv (gVarHandle *dst, double d, gVarHandle var)
 perform the logical and operation of two objects, element by element
LIBRA_API gVarHandle libra_Xorvd (gVarHandle *dst, gVarHandle var, double d)
 perform the logical and operation of two objects, element by element
LIBRA_API gVarHandle libra_Xorfv (gVarHandle *dst, float f, gVarHandle var)
 perform the logical and operation of two objects, element by element
LIBRA_API gVarHandle libra_Xorvf (gVarHandle *dst, gVarHandle var, float f)
 perform the logical and operation of two objects, element by element
LIBRA_API gVarHandle libra_Cond (gVarHandle *dst, gVarHandle gVH1, gVarHandle gVH2, gVarHandle gVH3)
 condition operand ? left operand : right operand.

conditionally selects elements from two operators, element by element.
LIBRA_API gVarHandle libra_GatherVector (gVarHandle *dst, gVarHandle gVH1, gVarHandle gVH2)
 gathers selected elements from a vector.
LIBRA_API gVarHandle libra_GatherMatrix (gVarHandle *dst, gVarHandle gVH1, gVarHandle gVH2, gVarHandle gVH3)
 gathers selected elements from a (sparse) matrix.
LIBRA_API void libra_ScatterVector (gVarHandle gVH1, gVarHandle gVH2, gVarHandle gVH3)
 scatters elements into selected positions of a vector.
LIBRA_API void libra_ScatterMatrix (gVarHandle gVH1, gVarHandle gVH2, gVarHandle gVH3, gVarHandle gVH4)
 scatters elements into selected positions of a matrix.
LIBRA_API void libra_ScatterMatrixiif (int i, int j, float value, gVarHandle var)
 scatters element into selected position i,j of a matrix, vector or scalar.
LIBRA_API void libra_ScatterMatrixiiff (int i, int j, float re, float im, gVarHandle var)
 scatters element into selected position i,j of a matrix, vector or scalar.
LIBRA_API void libra_ScatterVectorif (int i, float value, gVarHandle var)
 scatters element into selected position i of a vector.
LIBRA_API void libra_ScatterVectoriff (int i, float re, float im, gVarHandle var)
 scatters element into selected position i of a vector.
LIBRA_API void libra_ScatterMatrixiid (int i, int j, double value, gVarHandle var)
 scatters element into selected position i,j of a matrix, vector or scalar.
LIBRA_API void libra_ScatterMatrixiidd (int i, int j, double re, double im, gVarHandle var)
 scatters element into selected position i,j of a matrix, vector or scalar.
LIBRA_API void libra_ScatterVectorid (int i, double value, gVarHandle var)
 scatters element into selected position i of a vector.
LIBRA_API void libra_ScatterVectoridd (int i, double re, double im, gVarHandle var)
 scatters element into selected position i of a vector.
LIBRA_API void libra_ImageRead (gVarHandle *var, const char *, int type)
 creates a var matrix from an image file.
LIBRA_API const char * libra_GetVersion ()
 obtain version information.
LIBRA_API const char * libra_GetLastErrorMessage ()
 obtain error information.
LIBRA_API void libra_ClearLastErrorMessage ()
 reset the error information string.

Enumeration Type Documentation

enum gBackend

Libra backend types

enum gDataType

Libra data types

Enumerator:
GINT32  32-bit Integer
GFLOAT32  32-bit Floating point
GFLOAT64  64-bit Floating point

enum gRenderMode

Libra DisplayVarMode types

Enumerator:
GDISPLAY2D  Display as 2D data
GHEIGHTFIELD2D  Display 2D data as a heightfield
GSTATS  Display render stats


Function Documentation

gVarHandle libra_Abs ( gVarHandle *  dst,
gVarHandle  var 
)

computes the absolute value, element by element.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or scalars.

gVarHandle libra_Add ( gVarHandle *  dst,
gVarHandle  gVH1,
gVarHandle  gVH2 
)

perform addition, element by element.

Parameters:
dst adress of destination handle.
gVH1 handle to the left operand.
gVH2 handle to the right operand.
Returns:
the handle of the resulting object.
gVH1 and gVH2 can both represent either matrices, vectors or scalars. however their dimensions must match for the operation at hand.

gVarHandle libra_And ( gVarHandle *  dst,
gVarHandle  gVH1,
gVarHandle  gVH2 
)

perform the logical and operation of two objects, element by element

Parameters:
dst adress of destination handle.
gVH1 handle to the left operand.
gVH2 handle to the right operand.
Returns:
the handle of the resulting object.
gVH1 and gVH2 can both represent either matrices, vectors or scalars. The input must be of gDataType GBOOL. The result element is always gDataType GBOOL.

gVarHandle libra_Anddv ( gVarHandle *  dst,
double  d,
gVarHandle  var 
)

perform the logical and operation of two objects, element by element

Parameters:
dst adress of destination handle.
d the left (scalar) operand.
var handle to the right operand.
Returns:
the handle of the resulting object.
var can represent either a matrix, vector or scalar.

gVarHandle libra_Andfv ( gVarHandle *  dst,
float  f,
gVarHandle  var 
)

perform the logical and operation of two objects, element by element

Parameters:
dst adress of destination handle.
f the left (scalar) operand.
var handle to the right operand.
Returns:
the handle of the resulting object.
var can represent either a matrix, vector or scalar.

gVarHandle libra_Andvd ( gVarHandle *  dst,
gVarHandle  var,
double  d 
)

perform the logical and operation of two objects, element by element

Parameters:
dst adress of destination handle.
var handle to the left operand.
d the right (scalar) operand.
Returns:
the handle of the resulting object.
var can represent either a matrix, vector or scalar.

gVarHandle libra_Andvf ( gVarHandle *  dst,
gVarHandle  var,
float  f 
)

perform the logical and operation of two objects, element by element

Parameters:
dst adress of destination handle.
var handle to the left operand.
f the right (scalar) operand.
Returns:
the handle of the resulting object.
var can represent either a matrix, vector or scalar.

gVarHandle libra_ArcCos ( gVarHandle *  dst,
gVarHandle  var 
)

performs arccosine (inverse of cosine), element by element.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or scalars.

gVarHandle libra_ArcSin ( gVarHandle *  dst,
gVarHandle  var 
)

performs arcsine (inverse of sine), element by element.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or scalars.

gVarHandle libra_ArcTan ( gVarHandle *  dst,
gVarHandle  var 
)

performs arctangent (inverse of tangent), element by element.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or scalars.

gVarHandle libra_Assign ( gVarHandle *  dst,
gVarHandle  var 
)

assigns a Libra object to another object.

Parameters:
dst the handle of the destination object to be assigned.
var the handle of the source object to assign.
Returns:
a handle to the assigned object.
This function can be used on any type of Libra API object, such as matrices, sparse matrices, vectors, scalars... etc.

gVarHandle libra_Cast ( gVarHandle *  dst,
gVarHandle  var,
gDataType  dataType 
)

casts an object into a new object with the specified gDataType.

Parameters:
dst adress of destination handle.
var handle to the operand.
dataType the desired gDataType of the new object.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or scalars.

gVarHandle libra_Ceil ( gVarHandle *  dst,
gVarHandle  var 
)

the input is rounded upwards to nearest integer, element by element.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or scalars.

gVarHandle libra_CGsolve ( gVarHandle *  dst,
gVarHandle  gVH1,
gVarHandle  gVH2 
)

return the the solution of a linear equation system.

Parameters:
dst adress of destination handle.
gVH1 handle to the matrix operand.
gVH2 handle to the vector operand.
Returns:
the handle of the resulting object.
gVH1 can represents a matrix. gVH2 a right hand side vector.

void libra_ClearLastErrorMessage (  ) 

reset the error information string.

All Libra functions and operations sets a string with information about what goes wrong, for example if you try to add a vector and a matrix this string will tell you that the operand dimensions did not match. A call to this function resets this string.

gVarHandle libra_CmpEq ( gVarHandle *  dst,
gVarHandle  gVH1,
gVarHandle  gVH2 
)

compares two objects, element by element

Parameters:
dst adress of destination handle.
gVH1 handle to the left operand.
gVH2 handle to the right operand.
Returns:
the handle of the resulting object.
gVH1 and gVH2 can both represent either matrices, vectors or scalars. Suffixed (vd,vf,fd,fv) versions of this function exists for using a float or double as one operand. The result element is always gDataType GBOOL.

gVarHandle libra_CmpGeq ( gVarHandle *  dst,
gVarHandle  gVH1,
gVarHandle  gVH2 
)

compares two objects, element by element

Parameters:
dst adress of destination handle.
gVH1 handle to the left operand.
gVH2 handle to the right operand.
Returns:
the handle of the resulting object.
gVH1 and gVH2 can both represent either matrices, vectors or scalars. Suffixed (vd,vf,fd,fv) versions of this function exists for using a float or double as one operand. The result element is always gDataType GBOOL.

gVarHandle libra_CmpGt ( gVarHandle *  dst,
gVarHandle  gVH1,
gVarHandle  gVH2 
)

compares two objects, element by element

Parameters:
dst adress of destination handle.
gVH1 handle to the left operand.
gVH2 handle to the right operand.
Returns:
the handle of the resulting object.
gVH1 and gVH2 can both represent either matrices, vectors or scalars. Suffixed (vd,vf,fd,fv) versions of this function exists for using a float or double as one operand. The result element is always gDataType GBOOL.

gVarHandle gVarHandle libra_CmpLeq ( gVarHandle *  dst,
gVarHandle  gVH1,
gVarHandle  gVH2 
)

compares two objects, element by element

Parameters:
dst adress of destination handle.
gVH1 handle to the left operand.
gVH2 handle to the right operand.
Returns:
the handle of the resulting object.
gVH1 and gVH2 can both represent either matrices, vectors or scalars. Suffixed (vd,vf,fd,fv) versions of this function exists for using a float or double as one operand. The result element is always gDataType GBOOL.

gVarHandle libra_CmpLt ( gVarHandle *  dst,
gVarHandle  gVH1,
gVarHandle  gVH2 
)

compares two objects, element by element

Parameters:
dst adress of destination handle.
gVH1 handle to the left operand.
gVH2 handle to the right operand.
Returns:
the handle of the resulting object.
gVH1 and gVH2 can both represent either matrices, vectors or scalars. Suffixed (vd,vf,fd,fv) versions of this function exists for using a float or double as one operand. The result element is always gDataType GBOOL.

gVarHandle libra_Compare_NotEqual ( gVarHandle *  dst,
gVarHandle  gVH1,
gVarHandle  gVH2 
)

compares two objects, element by element

Parameters:
dst adress of destination handle.
gVH1 handle to the left operand.
gVH2 handle to the right operand.
Returns:
the handle of the resulting object.
gVH1 and gVH2 can both represent either matrices, vectors or scalars. Suffixed (vd,vf,fd,fv) versions of this function exists for using a float or double as one operand. The result element is always gDataType GBOOL.

gVarHandle libra_ComplexCreate ( gVarHandle *  dst,
int  rowCount,
int  columnCount,
int  type 
)

creates an MxN array of complex valued elements.

Parameters:
dst adress of destination handle.
rowCount number of rows to be created.
columnCount number of columns to be created.
type specifies the data type for the elements.
Returns:
a handle to the created array.
This function is used to create uninitialized complex scalars, vectors and dense matrices.

gVarHandle libra_ComplexCreateVar ( gVarHandle *  dst,
gVarHandle  gVH1,
gVarHandle  gVH2 
)

return a Complex var from two Real var.

Parameters:
dst adress of destination handle.
gVH1 handle to the first var.
gVH2 handle to the second var.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or scalars.

gVarHandle libra_ComplexEye ( gVarHandle *  dst,
int  rowCount,
int  columnCount,
int  type 
)

creates an identity matrix.

Parameters:
dst adress of destination handle.
rowCount the number of rows to be created.
columnCount the number of columns to be created.
type the gDataType to be used for representation of elements.
Returns:
a handle to the created matrix.
Eye creates a complex matrix of size rowCount x columnCount, with all elements set to 0, except when i = j (main diagonal) which values are set to 1.

Depending on rowCount and columnCount, the returned gVarHandle can also represent a vector or a scalar.

gVarHandle libra_ComplexOnes ( gVarHandle *  dst,
int  rowCount,
int  columnCount,
int  type 
)

creates a matrix whose elements are all 1.

Parameters:
dst adress of destination handle.
rowCount the number of rows to be created.
columnCount the number of columns to be created.
type the gDataType to be used for representation of elements.
Returns:
a handle to the created matrix.
All elements are set to the value of 1.

Depending on rowCount and columnCount, the returned gVarHandle can also represent a vector or a scalar.

gVarHandle libra_ComplexSparse_d ( gVarHandle *  dst,
double *  values,
int *  rows,
int *  columns,
int  nz,
int  type 
)

creates a sparse matrix, with input in Coordinate format.

Parameters:
dst adress of destination handle.
values A array that contains the non-zero entries of A.
rows Element i of the integer array rows contains the number of the row in A that contained the value in values(i).
columns Element i of the integer array columns contains the number of the column in A that contained the value in values(i).
nz the number of non zero elements in A.
type the gDataType to be used for representation of elements.
Returns:
a handle to the created sparse matrix.
Note that the same input will produce different results depending on what default Libra API indexing mode is set.

gVarHandle libra_ComplexSparse_f ( gVarHandle *  dst,
float *  values,
int *  rows,
int *  columns,
int  nz,
int  type 
)

creates a sparse matrix, with input in Coordinate format.

Parameters:
dst adress of destination handle.
values A array that contains the non-zero entries of A.
rows Element i of the integer array rows contains the number of the row in A that contained the value in values(i).
columns Element i of the integer array columns contains the number of the column in A that contained the value in values(i).
nz the number of non zero elements in A.
type the gDataType to be used for representation of elements.
Returns:
a handle to the created sparse matrix.
Note that the same input will produce different results depending on what default Libra API indexing mode is set.

gVarHandle gVarHandle libra_ComplexSparseBanded_d ( gVarHandle *  dst,
int  rowCount,
int  columnCount,
double **  values,
int *  positions,
int  bandCount,
int  type 
)

creates a sparse matrix, with input in Coordinate (Coord) format.

Parameters:
dst adress of destination handle.
rowCount number of rows
columnCount number of colums
values A array that contains pointers to the values of the band vectors
positions an array that contains each bands offset from the main diagonal
bandCount the number of bands
type the gDataType to be used for representation of elements.
Returns:
a handle to the created sparse matrix.
Note that the same input will produce different results depending on what default Libra API indexing mode is set.

gVarHandle gVarHandle libra_ComplexSparseBanded_f ( gVarHandle *  dst,
int  rowCount,
int  columnCount,
float **  values,
int *  positions,
int  bandCount,
int  type 
)

creates a sparse matrix, with input in Coordinate (Coord) format.

Parameters:
dst adress of destination handle.
rowCount number of rows
columnCount number of colums
values A array that contains pointers to the values of the band vectors
positions an array that contains each bands offset from the main diagonal
bandCount the number of bands
type the gDataType to be used for representation of elements.
Returns:
a handle to the created sparse matrix.
Note that the same input will produce different results depending on what default Libra API indexing mode is set.

gVarHandle libra_ComplexSparseBlockDiagonal_d ( gVarHandle *  dst,
double *  values,
int *  rows,
int *  columns,
int  nz,
int  blockCount,
int  type 
)

creates a block diagonal sparse matrix, with input in Coordinate format.

Parameters:
dst adress of destination handle.
values A array that contains the non-zero entries of A.
rows Element i of the integer array rows contains the number of the row in A that contained the value in values(i).
columns Element i of the integer array columns contains the number of the column in A that contained the value in values(i).
nz the number of non zero elements in A.
blockCount the number of submatrices in A.
type the gDataType to be used for representation of elements.
Returns:
a handle to the created sparse matrix.
Note that the same input will produce different results depending on what default Libra API indexing mode is set.

gVarHandle libra_ComplexSparseBlockDiagonal_f ( gVarHandle *  dst,
float *  values,
int *  rows,
int *  columns,
int  nz,
int  blockCount,
int  type 
)

creates a block diagonal sparse matrix, with input in Coordinate format.

Parameters:
dst adress of destination handle.
values A array that contains the non-zero entries of A.
rows Element i of the integer array rows contains the number of the row in A that contained the value in values(i).
columns Element i of the integer array columns contains the number of the column in A that contained the value in values(i).
nz the number of non zero elements in A.
blockCount the number of submatrices in A.
type the gDataType to be used for representation of elements.
Returns:
a handle to the created sparse matrix.
Note that the same input will produce different results depending on what default Libra API indexing mode is set.

gVarHandle libra_ComplexSparseCSC_d ( gVarHandle *  dst,
double *  values,
int *  rows,
int *  colIndex,
int  nz,
int  type 
)

creates a sparse matrix, with input in Compressed Sparse Column (CSC) format.

Parameters:
dst adress of destination handle.
values A array that contains the non-zero entries of A.
rows Element i of the integer array rows contains the number of the row in A that contained the value in values(i).
colIndex Element j of the integer array colIndex gives the index into the values array that contains the first non-zero element in a column j of A.
nz the number of non zero elements in A.
type the gDataType to be used for representation of elements.
Returns:
a handle to the created sparse matrix.
Note that the same input will produce different results depending on what default Libra API indexing mode is set.

gVarHandle libra_ComplexSparseCSC_f ( gVarHandle *  dst,
float *  values,
int *  rows,
int *  colIndex,
int  nz,
int  type 
)

creates a sparse matrix, with input in Compressed Sparse Column (CSC) format.

Parameters:
dst adress of destination handle.
values A array that contains the non-zero entries of A.
rows Element i of the integer array rows contains the number of the row in A that contained the value in values(i).
colIndex Element j of the integer array colIndex gives the index into the values array that contains the first non-zero element in a column j of A.
nz the number of non zero elements in A.
type the gDataType to be used for representation of elements.
Returns:
a handle to the created sparse matrix.
Note that the same input will produce different results depending on what default Libra API indexing mode is set.

gVarHandle libra_ComplexSparseCSR_d ( gVarHandle *  dst,
double *  values,
int *  columns,
int *  rowIndex,
int  nz,
int  type 
)

creates a sparse matrix, with input in Compressed Sparse Row (CSR) format.

Parameters:
dst adress of destination handle.
values A array that contains the non-zero entries of A.
columns Element i of the integer array columns contains the number of the column in A that contained the value in values(i).
rowIndex Element j of the integer array rowIndex gives the index into the values array that contains the first non-zero element in a row j of A.
nz the number of non zero elements in A.
type the gDataType to be used for representation of elements.
Returns:
a handle to the created sparse matrix.
Note that the same input will produce different results depending on what default Libra API indexing mode is set.

gVarHandle libra_ComplexSparseCSR_f ( gVarHandle *  dst,
float *  values,
int *  columns,
int *  rowIndex,
int  nz,
int  type 
)

creates a sparse matrix, with input in Compressed Sparse Row (CSR) format.

Parameters:
dst adress of destination handle.
values A array that contains the non-zero entries of A.
columns Element i of the integer array columns contains the number of the column in A that contained the value in values(i).
rowIndex Element j of the integer array rowIndex gives the index into the values array that contains the first non-zero element in a row j of A.
nz the number of non zero elements in A.
type the gDataType to be used for representation of elements.
Returns:
a handle to the created sparse matrix.
Note that the same input will produce different results depending on what default Libra API indexing mode is set.

gVarHandle libra_ComplexZeros ( gVarHandle *  dst,
int  rowCount,
int  columnCount,
int  type 
)

creates a matrix whose elements are all 0.

Parameters:
dst adress of destination handle.
rowCount the number of rows to be created.
columnCount the number of columns to be created.
type the gDataType to be used for representation of elements.
Returns:
a handle to the created matrix.
All elements are set to the value of 0.

Depending on rowCount and columnCount, the returned gVarHandle can also represent a vector or a scalar.

gVarHandle libra_Cond ( gVarHandle *  dst,
gVarHandle  gVH1,
gVarHandle  gVH2,
gVarHandle  gVH3 
)

condition operand ? left operand : right operand.

conditionally selects elements from two operators, element by element.

Parameters:
dst adress of destination handle.
gVH1 handle to the condition operand.
gVH2 handle to the left operand.
gVH3 handle to the right operand.
Returns:
the handle of the resulting object.
gVH1 must be of gDataType GBOOL. gVH2 and gVH3 can both represent either matrices, vectors or scalars.

gVarHandle libra_Conj ( gVarHandle *  dst,
gVarHandle  var 
)

computes the conj of an object.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or scalars.

gVarHandle libra_Cos ( gVarHandle *  dst,
gVarHandle  var 
)

performs cosine, element by element.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or scalars.

gVarHandle libra_Create ( gVarHandle *  dst,
int  rowCount,
int  columnCount,
int  type 
)

creates an MxN array.

Parameters:
dst adress of destination handle.
rowCount number of rows to be created.
columnCount number of columns to be created.
type specifies the data type for the elements.
Returns:
a handle to the created array.
This function is used to create uninitialized scalars, vectors and dense matrices.

gVarHandle gVarHandle libra_Diag ( gVarHandle *  dst,
gVarHandle  var 
)

extracts the diagonal of an object

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either a matrix or a sparse matrix.

gVarHandle libra_Diag_K ( gVarHandle *  dst,
gVarHandle  var,
int  k 
)

creates an object (typically a matrix) with the specified diagonal at position k.

Parameters:
dst adress of destination handle.
var handle to the operand, i.e. a vector with the desired diagonal elements.
k the diagonal position
Returns:
the handle of the resulting object.
var can represent either a vector or a scalar.

gVarHandle libra_Div ( gVarHandle *  dst,
gVarHandle  gVH1,
gVarHandle  gVH2 
)

perform division, element by element.

Parameters:
dst adress of destination handle.
gVH1 handle to the left operand.
gVH2 handle to the right operand.
Returns:
the handle of the resulting object.
gVH1 and gVH2 can both represent either matrices, vectors or scalars. however their dimensions must match for the operation at hand.

gVarHandle libra_Divdv ( gVarHandle *  dst,
double  d,
gVarHandle  gVH2 
)

perform division, element by element.

Parameters:
dst adress of destination handle.
d the left operand.
gVH2 handle to the right operand.
Returns:
the handle of the resulting object.
gVH2 can represent either a matrix, vector or scalar.

gVarHandle libra_Divfv ( gVarHandle *  dst,
float  f,
gVarHandle  gVH2 
)

perform division, element by element.

Parameters:
dst adress of destination handle.
f the left operand.
gVH2 handle to the right operand.
Returns:
the handle of the resulting object.
gVH2 can represent either a matrix, vector or scalar.

gVarHandle libra_Divvd ( gVarHandle *  dst,
gVarHandle  gVH1,
double  d 
)

perform division, element by element.

Parameters:
dst adress of destination handle.
gVH1 handle to the left operand.
d the right operand.
Returns:
the handle of the resulting object.
gVH1 can represent either a matrix, vector or scalar.

gVarHandle libra_Divvf ( gVarHandle *  dst,
gVarHandle  gVH1,
float  f 
)

perform division, element by element.

Parameters:
dst adress of destination handle.
gVH1 handle to the left operand.
f the right operand.
Returns:
the handle of the resulting object.
gVH1 can represent either a matrix, vector or scalar.

gVarHandle libra_Dot ( gVarHandle *  dst,
gVarHandle  gVH1,
gVarHandle  gVH2 
)

perform the inner (dot) product.

Parameters:
dst adress of destination handle.
gVH1 handle to the left operand.
gVH2 handle to the right operand.
Returns:
the handle of the resulting object.
gVH1 and gVH2 must both be vectors.

gVarHandle libra_Exp ( gVarHandle *  dst,
gVarHandle  var 
)

performs the exponential function of base e, element by element.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or scalars.

gVarHandle libra_Exp10 ( gVarHandle *  dst,
gVarHandle  var 
)

performs the exponential function of base 10, element by element.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or scalars.

gVarHandle libra_Exp2 ( gVarHandle *  dst,
gVarHandle  var 
)

performs the exponential function of base 2, element by element.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or scalars.

gVarHandle libra_Eye ( gVarHandle *  dst,
int  rowCount,
int  columnCount,
int  type 
)

creates an identity matrix.

Parameters:
dst adress of destination handle.
rowCount the number of rows to be created.
columnCount the number of columns to be created.
type the gDataType to be used for representation of elements.
Returns:
a handle to the created matrix.
Eye creates a matrix of size rowCount x columnCount, with all elements set to 0, except when i = j (main diagonal) which values are set to 1.

Depending on rowCount and columnCount, the returned gVarHandle can also represent a vector or a scalar.

gVarHandle libra_FFT ( gVarHandle *  dst,
gVarHandle  var 
)

return the 1D fourier transform of a gVar.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or sparse matrices.

gVarHandle libra_FFTShift ( gVarHandle *  dst,
gVarHandle  var 
)

swaps "half-spaces" of var along each dimension.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or sparse matrices.

void libra_Finish (  ) 

finish processing of all Libra API commands.

All Libra API commands are processed up to this point before returning control to application.

gVarHandle libra_Floor ( gVarHandle *  dst,
gVarHandle  var 
)

the input is rounded downwards (truncated) to the nearest integer, element by element.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or scalars.

void libra_Flush (  ) 

flush all Libra API commands for processing.

All Libra API commands are immediately sent to current backend for processing.

void libra_free ( const gHandle  memory  ) 

free the memory allocated using libra_malloc.

Parameters:
memory a pointer to memory
This function is to be used for freeing memory allocated using libra_malloc.

gVarHandle libra_GatherMatrix ( gVarHandle *  dst,
gVarHandle  gVH1,
gVarHandle  gVH2,
gVarHandle  gVH3 
)

gathers selected elements from a (sparse) matrix.

Parameters:
dst adress of destination handle.
gVH1 handle to row selector operand.
gVH2 handle to column selector operand.
gVH3 handle to the object from which to gather.
Returns:
the handle of the resulting object.
gVH3 can be either a dense or sparse matrix. If gVH1 and gVH2 is not of gDataType GINT32, necessary conversions will first be performed. gVH1 and gVH2 can both represent either matrices, vectors or scalars, but must be of the same dimension. The output will be of the same dimension as gVH1 and gVH2. Note that the same input will produce different results depending on what default Libra API indexing mode is set.

gVarHandle libra_GatherVector ( gVarHandle *  dst,
gVarHandle  gVH1,
gVarHandle  gVH2 
)

gathers selected elements from a vector.

Parameters:
dst adress of destination handle.
gVH1 handle to element selector operand.
gVH2 handle to the object from which to gather.
Returns:
the handle of the resulting object.
If gVH1 is not of gDataType GINT32, necessary conversions will first be performed. gVH1 acan represent either a matrix, vector or scalar. The output will be of the same dimension as gVH1. Note that the same input will produce different results depending on what default Libra API indexing mode is set.

int libra_GetColumnCount ( gVarHandle  handle  ) 

get the number of columns from an object.

Parameters:
handle the handle of the queried object.
Returns:
the number of rows the object contains.

gBackend libra_GetCurrentBackend (  ) 

Get Libra API current compute backend.

Returns:
the current compute backend used for computations.

gDataType libra_GetDefaultDataType (  ) 

Get default Libra API data type.

Returns:
the default data type used used when no type is explicitly selected by the user.

int libra_GetDefaultIndexing (  ) 

Get default Libra API indexing mode.

Returns:
the indexing mode used by Libra API.
The indexing mode typically affects how the input to operations such as gather and scatter are interpreted. The initial value is 1, following Matlab, Octave and Fortran standard.

void libra_GetDimensionCount ( gVarHandle  handle  ) 

get the number of dimensions from an object.

Parameters:
handle the handle of the queried object.
Returns:
the number of dimensions the object represents.

void libra_GetDoubleData ( gVarHandle  handle,
double *  mem,
unsigned int  byteOffset,
unsigned int  byteCount,
gHandle  callFunc,
gHandle  userData 
)

gets the elements of an object and writes them into an double array

Parameters:
handle the handle of the object which element data is to be fetched from.
mem adress of the memory to where to put the double precision data when available.
byteOffset a byte offset to the object's data. 0 offset is default.
byteCount a byte count defining amount of data in bytes to retrieve. 0 byte count means all object data.
callFunc user-supplied callback invoked as data is transferred.
userData user-supplied data passed back to callback.
Returns:
returns immediately if a callFunc is supplied otherwise blocks until data is available.
This function can be used on matrices, vectors and scalars. If handle represents a matrix, the array mem will be interpreted as column major data. Note that this function will perform the necessary conversion if the object was created as for example a GFLOAT32 data type object.

int libra_GetElementCount ( gVarHandle  handle  ) 

get the number of elements from an object.

Parameters:
handle the handle of the queried object.
Returns:
the number of elements the object contains.
A sparse object returns the number of non-zero elements whereas a dense object row * column count.

void libra_GetFloatData ( gVarHandle  handle,
float *  mem,
unsigned int  byteOffset,
unsigned int  byteCount,
gHandle  callFunc,
gHandle  userData 
)

gets the elements of an object and writes them into an float array

Parameters:
handle the handle of the object which element data is to be fetched from.
mem adress of the memory to where to put the float data when available.
byteOffset a byte offset to the object's data. 0 offset is default.
byteCount a byte count defining amount of data in bytes to retrieve. 0 byte count means all object data.
callFunc user-supplied callback invoked as data is transferred.
userData user-supplied data passed back to callback.
Returns:
returns immediately if a callFunc is supplied otherwise blocks until data is available.
This function can be used on matrices, vectors and scalars. If handle represents a matrix, the array mem will be interpreted as column major data. Note that this function will perform the necessary conversion if the object was created as for example a GINT32 data type object.

void libra_GetIntData ( gVarHandle  handle,
int *  mem,
unsigned int  byteOffset,
unsigned int  byteCount,
gHandle  callFunc,
gHandle  userData 
)

gets the elements of an object and writes them into an int array

Parameters:
handle the handle of the object which element data is to be fetched from.
mem adress of the memory to where to put the integer data when available.
byteOffset a byte offset to the object's data. 0 offset is default.
byteCount a byte count defining amount of data in bytes to retrieve. 0 byte count means all object data.
callFunc user-supplied callback invoked as data is transferred.
userData user-supplied data passed back to callback.
Returns:
returns immediately if a callFunc is supplied otherwise blocks until data is available.
This function can be used on matrices, vectors and scalars. If handle represents a matrix, the array mem will be interpreted as column major data. Note that this function will perform the necessary conversion if the object was created as for example a GFLOAT32 data type object.

const char * libra_GetLastErrorMessage (  ) 

obtain error information.

Returns:
a char string containing information about the last occured error.
All Libra functions and operations sets a string with information about what goes wrong, for example if you try to add a vector and a matrix this string will tell you that the operand dimensions did not match. The string will be available until a new error occurs, or is reset.

void libra_GetRenderBufferBytes8888 ( int *  renderBufferBytes  ) 

gets the byte elements of the renderbuffer object RGBA_8888 format and writes them into a sequential byte array

Parameters:
renderBufferBytes adress of the memory to where to put the byte data when available.
This function retrieves the renderbuffer object data as RGBA_8888 format copied into a sequential user supplied byte array.

int libra_GetRowCount ( gVarHandle  handle  ) 

get the number of rows from an object.

Parameters:
handle the handle of the queried object.
Returns:
the number of rows the object contains.

double libra_GetTime (  ) 

used for performance measuring Libra API.

Returns:
time in seconds.

int libra_GetType ( gVarHandle  handle  ) 

get the gDataType of an object.

Parameters:
handle the handle of the queried object.
Returns:
the gDataType the object uses to represent its elements.

const char * libra_GetVersion (  ) 

obtain version information.

Returns:
a char string containing information about which version of the Libra API is being used.

gVarHandle libra_IFFT ( gVarHandle *  dst,
gVarHandle  var 
)

return the inverse 1D fourier transform of a gVar.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or sparse matrices.

gVarHandle libra_IFFTShift ( gVarHandle *  dst,
gVarHandle  var 
)

inverse swaps "half-spaces" of var along each dimension.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or sparse matrices.

gVarHandle libra_Imag ( gVarHandle *  dst,
gVarHandle  var 
)

return Imag part of a gVar.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or scalars.

gVarHandle libra_ImageFilter ( gVarHandle *  dst,
gVarHandle  var1,
gVarHandle  var2,
const char *  options 
)

return the linear filtering of image var1 and filter var2.

Parameters:
dst adress of destination handle.
var1 handle to the image operand.
var2 handle to the filter operand.
options to control the details of filtering.
Returns:
the handle of the resulting object.
var1 and var2 can represent either matrices, vectors or sparse matrices.

void libra_ImageRead ( gVarHandle *  dst,
const char *  fileName,
int  type 
)

creates a var matrix from an image file.

Parameters:
dst adress of destination handle.
fileName the filename of the image to be loaded relative to your binary path.
type specifies the data type for the elements.
Returns:
a handle to the created array.
This function is used to create dense matrices from an image file.

gVarHandle libra_Indexmap ( gVarHandle *  dst,
int  rowCount,
int  columnCount,
float  rowCoeff,
float  colCoeff,
float  offs,
int  type 
)

creates an object where the element values are a linear function of their row, column index.

Parameters:
dst adress of destination handle.
rowCount the number of rows to be created.
columnCount the number of columns to be created.
rowCoeff row index multiplier coefficient
colCoeff column index multiplier coefficient
offs an offset coefficient
type the gDataType to be used for representation of elements.
Returns:
a handle to the created matrix.
element (i,j) is assigned the value of i * rowCoeff + j * colCoeff + offs. Note that the same input will produce different results depending on what default Libra API indexing mode is set. Depending on rowCount and columnCount, the returned gVarHandle can also represent vector or a scalar.

int libra_Init ( int  argc,
char **  argv 
)

Initializes Libra API.

Parameters:
argc The number of arguments passed to this function.
argv An array of pointers to the parameters.
Returns:
1 if Libra fails to initialize, 0 otherwise.
This function must be called before any other function from the Libra API, and handles initialisation of all the runtime systems and such.

Following command line parameters (argv) are valid: -b OPENCL_BACKEND, CUDA_BACKEND, OPENGL_BACKEND and CPU_BACKEND. -c ClientSDK, enables visual feedback for Libra SDK applications. -? HELP with cmdLine parameters.

gVarHandle libra_InvSqrt ( gVarHandle *  dst,
gVarHandle  var 
)

computes 1.0 divided by the squared root, element by element.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or scalars.

int libra_IsComplex ( gVarHandle *  dst,
gVarHandle  handle 
)

return 1 if the queried object is a complex object othwerwise 0.

Parameters:
dst adress of destination handle.
handle the handle of the queried object.
Returns:
dst the handle of the resulting object.

int libra_IsReal ( gVarHandle *  dst,
gVarHandle  handle 
)

return 1 if the queried object is a real object othwerwise 0.

Parameters:
dst adress of destination handle.
handle the handle of the queried object.
Returns:
the handle of the resulting object.

int libra_IsSparse ( gVarHandle *  dst,
gVarHandle  handle 
)

return 1 if the queried object is a sparse data object othwerwise 0.

Parameters:
dst adress of destination handle.
handle the handle of the queried object.
Returns:
dst the handle of the resulting object.

gVarHandle libra_JacobiIter ( gVarHandle *  dst,
gVarHandle  gVH1,
gVarHandle  gVH2,
gVarHandle  gVH3 
)

perform one jacobi iteration.

Parameters:
dst adress of destination handle.
gVH1 handle to the (sparse) matrix.
gVH2 handle to the vector(s).
gVH3 handle to the vector(s).
Returns:
the handle of the resulting object.
This function performs one jacobi iteration, returning a better estimate than x to the equation Ax = b. gVH1 must represent a sparse matrix, and gVH3 a vector. gVH2 can represent either a vector or a matrix. If gVH2 represents a matrix it is interpreted as multiple vectors x vectors.

gVarHandle libra_JacobiSolve ( gVarHandle *  dst,
gVarHandle  gVH1,
gVarHandle  gVH2 
)

return the the solution of a linear equation system.

Parameters:
dst adress of destination handle.
gVH1 handle to the matrix operand.
gVH2 handle to the vector operand.
Returns:
the handle of the resulting object.
gVH1 can represents a matrix. gVH2 a right hand side vector.

gVarHandle libra_Log ( gVarHandle *  dst,
gVarHandle  var 
)

performs the natural logarithm, element by element.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or scalars.

gVarHandle libra_Log10 ( gVarHandle *  dst,
gVarHandle  var 
)

performs the logarithm of base 10, element by element.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or scalars.

gVarHandle libra_Log2 ( gVarHandle *  dst,
gVarHandle  var 
)

performs the logarithm of base 2, element by element.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or scalars.

gVarHandle libra_Lsolve ( gVarHandle *  dst,
gVarHandle  gVH1,
gVarHandle  gVH2 
)

return the the solution of a lower triangular equation system.

Parameters:
dst adress of destination handle.
gVH1 handle to the matrix operand.
gVH2 handle to the vector operand.
Returns:
the handle of the resulting object.
gVH1 can represents a matrix. gVH2 a right hand side vector.

gHandle libra_malloc ( const unsigned int  byteCount  ) 

allocates count bytes of memory from computer main memory.

Parameters:
byteCount byte count.
Returns:
a pointer to allocated memory or 0 if failed.
This function can be used to allocate dedicated memory for faster data transfers between compute devices.

gVarHandle libra_Matmul ( gVarHandle *  dst,
gVarHandle  gVH1,
gVarHandle  gVH2 
)

perform matrix multiply.

Parameters:
dst adress of destination handle.
gVH1 handle to the left operand.
gVH2 handle to the right operand.
Returns:
the handle of the resulting object.
gVH1 and gVH2 can both represent either matrices or vectors (for scalars use libra_Mul instead), however their dimensions must match for the operation at hand.

gVarHandle libra_Max ( gVarHandle *  dst,
gVarHandle  var 
)

performs max of the elements of an object.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or scalars. The resulting object is a scalar.

gVarHandle libra_Maxvv ( gVarHandle *  dst,
gVarHandle  gVH1,
gVarHandle  gVH2 
)

perform max, element by element.

Parameters:
dst adress of destination handle.
gVH1 handle to the left operand.
gVH2 handle to the right operand.
Returns:
the handle of the resulting object.
gVH1 and gVH2 can both represent either matrices, vectors or scalars. however their dimensions must match for the operation at hand.

gVarHandle libra_Min ( gVarHandle *  dst,
gVarHandle  var 
)

performs min of the elements of an object.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or scalars. The resulting object is a scalar.

gVarHandle libra_Minvv ( gVarHandle *  dst,
gVarHandle  gVH1,
gVarHandle  gVH2 
)

perform min, element by element.

Parameters:
dst adress of destination handle.
gVH1 handle to the left operand.
gVH2 handle to the right operand.
Returns:
the handle of the resulting object.
gVH1 and gVH2 can both represent either matrices, vectors or scalars. however their dimensions must match for the operation at hand.

gVarHandle libra_Mldivide ( gVarHandle *  dst,
gVarHandle  gVH1,
gVarHandle  gVH2 
)

perform left division.

Parameters:
dst adress of destination handle.
gVH1 handle to the left operand.
gVH2 handle to the right operand.
Returns:
the handle of the resulting object.
gVH1 and gVH2 can both represent either matrices, vectors or scalars. however their dimensions must match for the operation at hand.

gVarHandle libra_Mod ( gVarHandle *  dst,
gVarHandle  gVH1,
gVarHandle  gVH2 
)

perform modulo operation, element by element.

Parameters:
dst adress of destination handle.
gVH1 handle to the left operand.
gVH2 handle to the right operand.
Returns:
the handle of the resulting object.
gVH1 and gVH2 can both represent either matrices, vectors or scalars. however their dimensions must match for the operation at hand.

gVarHandle libra_Mul ( gVarHandle *  dst,
gVarHandle  gVH1,
gVarHandle  gVH2 
)

perform multiply, element by element.

Parameters:
dst adress of destination handle.
gVH1 handle to the left operand.
gVH2 handle to the right operand.
Returns:
the handle of the resulting object.
gVH1 and gVH2 can both represent either matrices, vectors or scalars. however their dimensions must match for the operation at hand.

gVarHandle libra_Muldv ( gVarHandle *  dst,
double  d,
gVarHandle  var 
)

perform multiply, element by element.

Parameters:
dst adress of destination handle.
d the left (scalar) operand.
var handle to the right operand.
Returns:
the handle of the resulting object.
var can represent either a matrix, vector or scalar.

gVarHandle libra_Mulfv ( gVarHandle *  dst,
float  f,
gVarHandle  var 
)

perform multiply, element by element.

Parameters:
dst adress of destination handle.
f the left (scalar) operand.
var handle to the right operand.
Returns:
the handle of the resulting object.
var can represent either a matrix, vector or scalar.

gVarHandle libra_Mulvd ( gVarHandle *  dst,
gVarHandle  var,
double  d 
)

perform multiply, element by element.

Parameters:
dst adress of destination handle.
var handle to the left operand.
d the right (scalar) operand.
Returns:
the handle of the resulting object.
var can represent either a matrix, vector or scalar.

gVarHandle libra_Mulvf ( gVarHandle *  dst,
gVarHandle  var,
float  f 
)

perform multiply, element by element.

Parameters:
dst adress of destination handle.
var handle to the left operand.
f the right (scalar) operand.
Returns:
the handle of the resulting object.
var can represent either a matrix, vector or scalar.

gVarHandle libra_Neg ( gVarHandle *  dst,
gVarHandle  var 
)

performs negation.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or scalars.

gVarHandle libra_Not ( gVarHandle *  dst,
gVarHandle  var 
)

perform the logical not operation of an object, element by element

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either a matrix, vector or scalar. The input must be of gDataType GBOOL. The result element is always gDataType GBOOL.

gVarHandle libra_Ones ( gVarHandle *  dst,
int  rowCount,
int  columnCount,
int  type 
)

creates a matrix whose elements are all 1.

Parameters:
dst adress of destination handle.
rowCount the number of rows to be created.
columnCount the number of columns to be created.
type the gDataType to be used for representation of elements.
Returns:
a handle to the created matrix.
All elements are set to the value of 1.

Depending on rowCount and columnCount, the returned gVarHandle can also represent a vector or a scalar.

gVarHandle libra_Or ( gVarHandle *  dst,
gVarHandle  gVH1,
gVarHandle  gVH2 
)

perform the logical or operation of two objects, element by element

Parameters:
dst adress of destination handle.
gVH1 handle to the left operand.
gVH2 handle to the right operand.
Returns:
the handle of the resulting object.
gVH1 and gVH2 can both represent either matrices, vectors or scalars. The input must be of gDataType GBOOL. The result element is always gDataType GBOOL.

gVarHandle libra_Ordv ( gVarHandle *  dst,
double  d,
gVarHandle  var 
)

perform the logical and operation of two objects, element by element

Parameters:
dst adress of destination handle.
d the left (scalar) operand.
var handle to the right operand.
Returns:
the handle of the resulting object.
var can represent either a matrix, vector or scalar.

gVarHandle libra_Orfv ( gVarHandle *  dst,
float  f,
gVarHandle  var 
)

perform the logical and operation of two objects, element by element

Parameters:
dst adress of destination handle.
f the left (scalar) operand.
var handle to the right operand.
Returns:
the handle of the resulting object.
var can represent either a matrix, vector or scalar.

gVarHandle libra_Orvd ( gVarHandle *  dst,
gVarHandle  var,
double  d 
)

perform the logical and operation of two objects, element by element

Parameters:
dst adress of destination handle.
var handle to the left operand.
d the right (scalar) operand.
Returns:
the handle of the resulting object.
var can represent either a matrix, vector or scalar.

gVarHandle libra_Orvf ( gVarHandle *  dst,
gVarHandle  var,
float  f 
)

perform the logical and operation of two objects, element by element

Parameters:
dst adress of destination handle.
var handle to the left operand.
f the right (scalar) operand.
Returns:
the handle of the resulting object.
var can represent either a matrix, vector or scalar.

gVarHandle libra_Pow ( gVarHandle *  dst,
gVarHandle  gVH1,
gVarHandle  gVH2 
)

performs the power function, raising base left operand to the power of right operand, element by element.

Parameters:
dst adress of destination handle.
gVH1 handle to the left operand.
gVH2 handle to the right operand.
Returns:
the handle of the resulting object.
gVH1 and gVH2 can both represent either matrices, vectors or scalars.

void libra_PrintDouble ( double  d  ) 

print d.

Parameters:
d double value to print.
Value is printed to std::out. On Windows, also to Debugger Output Window.

void libra_PrintFloat ( float  f  ) 

print f.

Parameters:
f float value to print.
Value is printed to std::out. On Windows, also to Debugger Output Window.

int libra_PrintInt ( int  i  ) 

print i.

Parameters:
i int value to print.
Value is printed to std::out. On Windows, also to Debugger Output Window.

int libra_PrintText ( const char *  text  ) 

print the text string to output. Default output is stdout and debug window if available.

Parameters:
text the text string to be sent to output.
Elements are printed to std::out. On Windows, also to Debugger Output Window.

int libra_PrintVar ( gVarHandle  handle  ) 

print the elements of an object.

Parameters:
handle the handle of the object.
Elements are printed to std::out. On Windows, also to Debugger Output Window.

gVarHandle libra_Rand ( gVarHandle *  dst,
int  rowCount,
int  columnCount,
int  type,
float  scale 
)

creates a matrix filled with random values.

Parameters:
dst adress of destination handle.
rowCount the number of rows to be created.
columnCount the number of columns to be created.
type the gDataType to be used for representation of elements.
scale the scale value to be multipled with the generated numbers [0.0f, 1.0f]. Default scale value is 1.0f.
Returns:
a handle to the created matrix.
All elements are set using a pseudorandom generator.

Depending on rowCount and columnCount, the returned gVarHandle can also represent a vector or a scalar.

gVarHandle libra_Real ( gVarHandle *  dst,
gVarHandle  var 
)

return Real part of a gVar.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or scalars.

void libra_Release ( gVarHandle *  handle  ) 

releases a gVarHandle.

Parameters:
handle a pointer to the gVarHandle to be released.
gVarHandles returned by other Libra API function calls, such as "eye" for example must be released using this function when they are no longer in use.

void libra_Render ( gVarHandle  var,
gRenderMode  mode,
int  varRowStride 
)

when Libra is in debug or SDK mode, displays a variable graphically.

Parameters:
var handle to the object to be displayed.
mode determines how the object is displayed.
varRowStride The logical stride of an object. For example specifying vector rowCount when displayed as 2D data.
See libra_Init documentation for cmdLine settings to enable Debug or SDK mode.

void libra_RenderText ( const char *  string,
unsigned int  pixelPosX,
unsigned int  pixelPosY,
unsigned int  byteColorRGBA 
)

when Libra is in debug or SDK mode, displays a text string graphically.

Parameters:
string the text string to be displayed.
pixelPosX the x pixel position of the text string relative to upperleft corner of the window.
pixelPosY the y pixel position of the text string relative to upperleft corner of the window.
byteColorRGBA the byte component rgba color of the text string to be displayed.
See libra_Init documentation for cmdLine settings to enable Debug or SDK mode.

gVarHandle libra_Round ( gVarHandle *  dst,
gVarHandle  var 
)

the input is rounded to the nearest integer, element by element.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or scalars.

void libra_ScatterMatrix ( gVarHandle  gVH1,
gVarHandle  gVH2,
gVarHandle  gVH3,
gVarHandle  gVH4 
)

scatters elements into selected positions of a matrix.

Parameters:
gVH1 handle to element row selector operand.
gVH2 handle to element column selector operand.
gVH3 handle to values to be scattered operand.
gVH4 handle to the matrix which to scatter the values into.
If gVH1 and gVH2 is not of gDataType GINT32, necessary conversions will first be performed. gVH1, gVH2 and gVH3 can all represent either matrices, vectors or scalars, but must be of the same dimension. The output will be the same object as gVH4, i.e. this function changes gVH4 and does not create/return any new object. Note that the same input will produce different results depending on what default Libra API indexing mode is set.

void libra_ScatterMatrixiid ( int  i,
int  j,
double  value,
gVarHandle  var 
)

scatters element into selected position i,j of a matrix, vector or scalar.

Parameters:
i to element row selector operand.
j to element column selector operand.
value scatter value operand.
var handle to the matrix which to scatter the values into.
var can represent either a matrix, vector or scalar. The output will be the same object as var, i.e. this function changes var and does not create/return any new object. Note that the same input will produce different results depending on what default Libra API indexing mode is set.

void libra_ScatterMatrixiidd ( int  i,
int  j,
double  re,
double  im,
gVarHandle  var 
)

scatters element into selected position i,j of a matrix, vector or scalar.

Parameters:
i to element row selector operand.
j to element column selector operand.
re scatter re operand.
im scatter im operand.
var handle to the matrix which to scatter the values into.
var can represent either a matrix, vector or scalar. The output will be the same object as var, i.e. this function changes var and does not create/return any new object. Note that the same input will produce different results depending on what default Libra API indexing mode is set.

void libra_ScatterMatrixiif ( int  i,
int  j,
float  value,
gVarHandle  var 
)

scatters element into selected position i,j of a matrix, vector or scalar.

Parameters:
i to element row selector operand.
j to element column selector operand.
value scatter value operand.
var handle to the matrix which to scatter the values into.
var can represent either a matrix, vector or scalar. The output will be the same object as var, i.e. this function changes var and does not create/return any new object. Note that the same input will produce different results depending on what default Libra API indexing mode is set.

void libra_ScatterMatrixiiff ( int  i,
int  j,
float  re,
float  im,
gVarHandle  var 
)

scatters element into selected position i,j of a matrix, vector or scalar.

Parameters:
i to element row selector operand.
j to element column selector operand.
re scatter re operand.
im scatter im operand.
var handle to the matrix which to scatter the values into.
var can represent either a matrix, vector or scalar. The output will be the same object as var, i.e. this function changes var and does not create/return any new object. Note that the same input will produce different results depending on what default Libra API indexing mode is set.

void libra_ScatterVector ( gVarHandle  gVH1,
gVarHandle  gVH2,
gVarHandle  gVH3 
)

scatters elements into selected positions of a vector.

Parameters:
gVH1 handle to element selector operand.
gVH2 handle to values to be scattered operand.
gVH3 handle to the vector which to scatter the values into.
If gVH1 is not of gDataType GINT32, necessary conversions will first be performed. gVH1 and gVH2 can both represent either matrices, vectors or scalars, but must be of the same dimension. The output will be the same object as gVH3, i.e. this function changes gVH3 and does not create/return any new object. Note that the same input will produce different results depending on what default Libra API indexing mode is set.

void libra_ScatterVectorid ( int  i,
double  value,
gVarHandle  var 
)

scatters element into selected position i of a vector.

Parameters:
i to element row selector operand.
value scatter value operand.
var handle to the matrix which to scatter the values into.
var can represent either a vector or scalar. The output will be the same object as var, i.e. this function changes var and does not create/return any new object. Note that the same input will produce different results depending on what default Libra API indexing mode is set.

void libra_ScatterVectoridd ( int  i,
double  re,
double  im,
gVarHandle  var 
)

scatters element into selected position i of a vector.

Parameters:
i to element row selector operand.
re scatter re operand.
im scatter im operand.
var handle to the matrix which to scatter the values into.
var can represent either a vector or scalar. The output will be the same object as var, i.e. this function changes var and does not create/return any new object. Note that the same input will produce different results depending on what default Libra API indexing mode is set.

void libra_ScatterVectorif ( int  i,
float  value,
gVarHandle  var 
)

scatters element into selected position i of a vector.

Parameters:
i to element row selector operand.
value scatter value operand.
var handle to the matrix which to scatter the values into.
var can represent either a vector or scalar. The output will be the same object as var, i.e. this function changes var and does not create/return any new object. Note that the same input will produce different results depending on what default Libra API indexing mode is set.

void libra_ScatterVectoriff ( int  i,
float  re,
float  im,
gVarHandle  var 
)

scatters element into selected position i of a vector.

Parameters:
i to element row selector operand.
re scatter re operand.
im scatter im operand.
var handle to the matrix which to scatter the values into.
var can represent either a vector or scalar. The output will be the same object as var, i.e. this function changes var and does not create/return any new object. Note that the same input will produce different results depending on what default Libra API indexing mode is set.

void libra_SetCurrentBackend ( enum gBackend  backend  ) 

Set Libra API current compute backend.

Parameters:
backend the backend to be used for computations.

void libra_SetDefaultDataType ( gDataType  dataType  ) 

Set default Libra API data type.

Parameters:
dataType the data type to be used when no type is explicitly selected by the user.
The initial value is GFLOAT32.

void libra_SetDefaultIndexing ( int  indexing  ) 

Set default Libra API indexing mode.

Parameters:
indexing the indexing mode used by Libra API.
The indexing mode typically affects how the input to operations such as the sparse constructors, gather, scatter and indexmap are interpreted. The initial value is 1, following Matlab, Octave and Fortran standard.

void libra_SetDoubleData ( gVarHandle  handle,
const double *  mem,
unsigned int  byteOffset,
unsigned int  byteCount,
gHandle  callFunc,
gHandle  userData 
)

sets the elements of an object from an double array

Parameters:
handle the handle of the object which element data is to be set.
mem adress of the memory from where to fetch the double precision data.
byteOffset a byte offset to the object's data. 0 offset is default.
byteCount a byte count defining amount of data in bytes to send to object. 0 byte count means data equal to object size.
callFunc user-supplied callback invoked as data is transferred.
userData user-supplied data passed back to callback.
This function can be used on matrices, vectors and scalars. If handle represents a matrix, the array mem will be interpreted as column major data. Note that this function will not change the gDataType of the object, so if the object was created as for example a GFLOAT32 data type object this function will perform the necessary conversion.

void libra_SetFloatData ( gVarHandle  handle,
const float *  mem,
unsigned int  byteOffset,
unsigned int  byteCount,
gHandle  callFunc,
gHandle  userData 
)

sets the elements of an object from an float array

Parameters:
handle the handle of the object which element data is to be set.
mem adress of the memory from where to fetch the floating point data.
byteOffset a byte offset to the object's data. 0 offset is default.
byteCount a byte count defining amount of data in bytes to send to object. 0 byte count means data equal to object size.
callFunc user-supplied callback invoked as data is transferred.
userData user-supplied data passed back to callback.
This function can be used on matrices, vectors and scalars. If handle represents a matrix, the array mem will be interpreted as column major data. Note that this function will not change the gDataType of the object, so if the object was created as for example a GINT32 data type object this function will perform the necessary conversion.

void libra_SetIntData ( gVarHandle  handle,
const int *  mem,
unsigned int  byteOffset,
unsigned int  byteCount,
gHandle  callFunc,
gHandle  userData 
)

sets the elements of an object from an integer array

Parameters:
handle the handle of the object which element data is to be set.
mem adress of the memory from where to fetch the integer data.
byteOffset a byte offset to the object's data. 0 offset is default.
byteCount a byte count defining amount of data in bytes to send to object. 0 byte count means data equal to object size.
callFunc user-supplied callback invoked as data is transferred.
userData user-supplied data passed back to callback.
This function can be used on matrices, vectors and scalars. If handle represents a matrix, the array mem will be interpreted as column major data. Note that this function will not change the gDataType of the object, so if the object was created as for example a GFLOAT32 data type object this function will perform the necessary conversion.

int libra_SetPrintFunc ( void(*)(const char *msg)  func  ) 

set print function.

Parameters:
func the print function.
Sets a print function to override Libra printing to stdout.

void libra_SetRenderMatrix ( float *  matrix4x4  ) 

when Libra is in debug or SDK mode, displays a variable graphically, transformed by the supplied 4x4 transform matrix.

Parameters:
matrix4x4 16 floating point values representing the render transform matrix.
See libra_Init documentation for cmdLine settings to enable Debug or SDK mode.

void libra_Shutdown (  ) 

Shutdown Libra API and release Libra internal resources.

Called before exiting your sample application.

gVarHandle libra_Sign ( gVarHandle *  dst,
gVarHandle  var 
)

performs the sign (sgn) function, element by element.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or scalars.

gVarHandle libra_Sin ( gVarHandle *  dst,
gVarHandle  var 
)

performs sine, element by element.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or scalars.

gVarHandle libra_Sort ( gVarHandle *  dst,
gVarHandle  var 
)

return a sorted gVar.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors, scalars or sparse matrices.

gVarHandle libra_Sparse_d ( gVarHandle *  dst,
double *  values,
int *  rows,
int *  columns,
int  nz,
int  type 
)

creates a sparse matrix, with input in Coordinate format.

Parameters:
dst adress of destination handle.
values A array that contains the non-zero entries of A.
rows Element i of the integer array rows contains the number of the row in A that contained the value in values(i).
columns Element i of the integer array columns contains the number of the column in A that contained the value in values(i).
nz the number of non zero elements in A.
type the gDataType to be used for representation of elements.
Returns:
a handle to the created sparse matrix.
Note that the same input will produce different results depending on what default Libra API indexing mode is set.

gVarHandle libra_Sparse_f ( gVarHandle *  dst,
float *  values,
int *  rows,
int *  columns,
int  nz,
int  type 
)

creates a sparse matrix, with input in Coordinate format.

Parameters:
dst adress of destination handle.
values A array that contains the non-zero entries of A.
rows Element i of the integer array rows contains the number of the row in A that contained the value in values(i).
columns Element i of the integer array columns contains the number of the column in A that contained the value in values(i).
nz the number of non zero elements in A.
type the gDataType to be used for representation of elements.
Returns:
a handle to the created sparse matrix.
Note that the same input will produce different results depending on what default Libra API indexing mode is set.

gVarHandle gVarHandle libra_SparseBanded2_d ( gVarHandle *  dst,
int  rowCount,
int  columnCount,
double *  values,
int *  positions,
int  bandCount,
int  type 
)

creates a sparse matrix, with input in Coordinate (Coord) format.

Parameters:
dst adress of destination handle.
rowCount number of rows
columnCount number of colums
values A array that contains the values of the band vectors
positions an array that contains each bands offset from the main diagonal
bandCount the number of bands
type the gDataType to be used for representation of elements.
Returns:
a handle to the created sparse matrix.
Note that the same input will produce different results depending on what default Libra API indexing mode is set.

gVarHandle gVarHandle libra_SparseBanded2_f ( gVarHandle *  dst,
int  rowCount,
int  columnCount,
float *  values,
int *  positions,
int  bandCount,
int  type 
)

creates a sparse matrix, with input in Coordinate (Coord) format.

Parameters:
dst adress of destination handle.
rowCount number of rows
columnCount number of colums
values A array that contains the values of the band vectors
positions an array that contains each bands offset from the main diagonal
bandCount the number of bands
type the gDataType to be used for representation of elements.
Returns:
a handle to the created sparse matrix.
Note that the same input will produce different results depending on what default Libra API indexing mode is set.

gVarHandle gVarHandle libra_SparseBanded_d ( gVarHandle *  dst,
int  rowCount,
int  columnCount,
double **  values,
int *  positions,
int  bandCount,
int  type 
)

creates a sparse matrix, with input in Coordinate (Coord) format.

Parameters:
dst adress of destination handle.
rowCount number of rows
columnCount number of colums
values A array that contains pointers to the values of the band vectors
positions an array that contains each bands offset from the main diagonal
bandCount the number of bands
type the gDataType to be used for representation of elements.
Returns:
a handle to the created sparse matrix.
Note that the same input will produce different results depending on what default Libra API indexing mode is set.

gVarHandle gVarHandle libra_SparseBanded_f ( gVarHandle *  dst,
int  rowCount,
int  columnCount,
float **  values,
int *  positions,
int  bandCount,
int  type 
)

creates a sparse matrix, with input in Coordinate (Coord) format.

Parameters:
dst adress of destination handle.
rowCount number of rows
columnCount number of colums
values A array that contains pointers to the values of the band vectors
positions an array that contains each bands offset from the main diagonal
bandCount the number of bands
type the gDataType to be used for representation of elements.
Returns:
a handle to the created sparse matrix.
Note that the same input will produce different results depending on what default Libra API indexing mode is set.

gVarHandle libra_SparseBlockDiagonal_d ( gVarHandle *  dst,
double *  values,
int *  rows,
int *  columns,
int  nz,
int  blockCount,
int  type 
)

creates a sparse matrix, with input in Coordinate format.

Parameters:
dst adress of destination handle.
values A array that contains the non-zero entries of A.
rows Element i of the integer array rows contains the number of the row in A that contained the value in values(i).
columns Element i of the integer array columns contains the number of the column in A that contained the value in values(i).
nz the number of non zero elements in A.
blockCount the number of submatrices in A.
type the gDataType to be used for representation of elements.
Returns:
a handle to the created sparse matrix.
Note that the same input will produce different results depending on what default Libra API indexing mode is set.

gVarHandle libra_SparseBlockDiagonal_f ( gVarHandle *  dst,
float *  values,
int *  rows,
int *  columns,
int  nz,
int  blockCount,
int  type 
)

creates a sparse matrix, with input in Coordinate format.

Parameters:
dst adress of destination handle.
values A array that contains the non-zero entries of A.
rows Element i of the integer array rows contains the number of the row in A that contained the value in values(i).
columns Element i of the integer array columns contains the number of the column in A that contained the value in values(i).
nz the number of non zero elements in A.
blockCount the number of submatrices in A.
type the gDataType to be used for representation of elements.
Returns:
a handle to the created sparse matrix.
Note that the same input will produce different results depending on what default Libra API indexing mode is set.

gVarHandle libra_SparseCSC_d ( gVarHandle *  dst,
double *  values,
int *  rows,
int *  colIndex,
int  nz,
int  type 
)

creates a sparse matrix, with input in Compressed Sparse Column (CSC) format.

Parameters:
dst adress of destination handle.
values A array that contains the non-zero entries of A.
rows Element i of the integer array rows contains the number of the row in A that contained the value in values(i).
colIndex Element j of the integer array colIndex gives the index into the values array that contains the first non-zero element in a column j of A.
nz the number of non zero elements in A.
type the gDataType to be used for representation of elements.
Returns:
a handle to the created sparse matrix.
Note that the same input will produce different results depending on what default Libra API indexing mode is set.

gVarHandle libra_SparseCSC_f ( gVarHandle *  dst,
float *  values,
int *  rows,
int *  colIndex,
int  nz,
int  type 
)

creates a sparse matrix, with input in Compressed Sparse Column (CSC) format.

Parameters:
dst adress of destination handle.
values A array that contains the non-zero entries of A.
rows Element i of the integer array rows contains the number of the row in A that contained the value in values(i).
colIndex Element j of the integer array colIndex gives the index into the values array that contains the first non-zero element in a column j of A.
nz the number of non zero elements in A.
type the gDataType to be used for representation of elements.
Returns:
a handle to the created sparse matrix.
Note that the same input will produce different results depending on what default Libra API indexing mode is set.

gVarHandle libra_SparseCSR_d ( gVarHandle *  dst,
double *  values,
int *  columns,
int *  rowIndex,
int  nz,
int  type 
)

creates a sparse matrix, with input in Compressed Sparse Row (CSR) format.

Parameters:
dst adress of destination handle.
values A array that contains the non-zero entries of A.
columns Element i of the integer array columns contains the number of the column in A that contained the value in values(i).
rowIndex Element j of the integer array rowIndex gives the index into the values array that contains the first non-zero element in a row j of A.
nz the number of non zero elements in A.
type the gDataType to be used for representation of elements.
Returns:
a handle to the created sparse matrix.
Note that the same input will produce different results depending on what default Libra API indexing mode is set.

gVarHandle libra_SparseCSR_f ( gVarHandle *  dst,
float *  values,
int *  columns,
int *  rowIndex,
int  nz,
int  type 
)

creates a sparse matrix, with input in Compressed Sparse Row (CSR) format.

Parameters:
dst adress of destination handle.
values A array that contains the non-zero entries of A.
columns Element i of the integer array columns contains the number of the column in A that contained the value in values(i).
rowIndex Element j of the integer array rowIndex gives the index into the values array that contains the first non-zero element in a row j of A.
nz the number of non zero elements in A.
type the gDataType to be used for representation of elements.
Returns:
a handle to the created sparse matrix.
Note that the same input will produce different results depending on what default Libra API indexing mode is set.

gVarHandle libra_Sqrt ( gVarHandle *  dst,
gVarHandle  var 
)

computes the squared root, element by element.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or scalars.

gVarHandle libra_Step ( gVarHandle *  dst,
float  from,
float  to,
float  stride,
int  type 
)

creates a vector which elements are in a sequence

Parameters:
dst adress of destination handle.
from the number which the sequence starts with.
to the number which the sequence ends with
stride the difference between any two elements in the sequence next to eachother
type the gDataType to be used for representation of elements.
Depending on rowCount and columnCount, the returned gVarHandle can also represent a scalar.

gVarHandle libra_Sub ( gVarHandle *  dst,
gVarHandle  gVH1,
gVarHandle  gVH2 
)

perform subtraction, element by element.

Parameters:
dst adress of destination handle.
gVH1 handle to the left operand.
gVH2 handle to the right operand.
Returns:
the handle of the resulting object.
gVH1 and gVH2 can both represent either matrices, vectors or scalars. however their dimensions must match for the operation at hand.

gVarHandle libra_Subarray ( gVarHandle *  dst,
gVarHandle  rows,
gVarHandle  columns,
gVarHandle  array 
)

returns a subarray of a Libra object to another object.

Parameters:
dst the handle of the destination object to be assigned.
array the handle of object representing the array.
rows the handle of object representing row span.
columns the handle of object representing column span.
Returns:
a handle to the subarray object.
This function can be used on any type of Libra API object, such as matrices, sparse matrices, vectors, scalars... etc.

gVarHandle libra_Sum ( gVarHandle *  dst,
gVarHandle  var 
)

computes the sum of all elements in an object.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or scalars.

gVarHandle libra_Tan ( gVarHandle *  dst,
gVarHandle  var 
)

performs tangent, element by element.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or scalars.

gVarHandle libra_Transpose ( gVarHandle *  dst,
gVarHandle  var 
)

computes the transpose of an object.

Parameters:
dst adress of destination handle.
var handle to the operand.
Returns:
the handle of the resulting object.
var can represent either matrices, vectors or scalars.

gVarHandle libra_Usolve ( gVarHandle *  dst,
gVarHandle  gVH1,
gVarHandle  gVH2 
)

return the the solution of a upper triangular equation system.

Parameters:
dst adress of destination handle.
gVH1 handle to the matrix operand.
gVH2 handle to the vector operand.
Returns:
the handle of the resulting object.
gVH1 can represents a matrix. gVH2 a right hand side vector.

gVarHandle libra_Xor ( gVarHandle *  dst,
gVarHandle  gVH1,
gVarHandle  gVH2 
)

perform the logical xor operation of two objects, element by element

Parameters:
dst adress of destination handle.
gVH1 handle to the left operand.
gVH2 handle to the right operand.
Returns:
the handle of the resulting object.
gVH1 and gVH2 can both represent either matrices, vectors or scalars. The input must be of gDataType GBOOL. The result element is always gDataType GBOOL.

gVarHandle libra_Xordv ( gVarHandle *  dst,
double  d,
gVarHandle  var 
)

perform the logical and operation of two objects, element by element

Parameters:
dst adress of destination handle.
d the left (scalar) operand.
var handle to the right operand.
Returns:
the handle of the resulting object.
var can represent either a matrix, vector or scalar.

gVarHandle libra_Xorfv ( gVarHandle *  dst,
float  f,
gVarHandle  var 
)

perform the logical and operation of two objects, element by element

Parameters:
dst adress of destination handle.
f the left (scalar) operand.
var handle to the right operand.
Returns:
the handle of the resulting object.
var can represent either a matrix, vector or scalar.

gVarHandle libra_Xorvd ( gVarHandle *  dst,
gVarHandle  var,
double  d 
)

perform the logical and operation of two objects, element by element

Parameters:
dst adress of destination handle.
var handle to the left operand.
d the right (scalar) operand.
Returns:
the handle of the resulting object.
var can represent either a matrix, vector or scalar.

gVarHandle libra_Xorvf ( gVarHandle *  dst,
gVarHandle  var,
float  f 
)

perform the logical and operation of two objects, element by element

Parameters:
dst adress of destination handle.
var handle to the left operand.
f the right (scalar) operand.
Returns:
the handle of the resulting object.
var can represent either a matrix, vector or scalar.

gVarHandle libra_Zeros ( gVarHandle *  dst,
int  rowCount,
int  columnCount,
int  type 
)

creates a matrix whose elements are all 0.

Parameters:
dst adress of destination handle.
rowCount the number of rows to be created.
columnCount the number of columns to be created.
type the gDataType to be used for representation of elements.
Returns:
a handle to the created matrix.
All elements are set to the value of 0.

Depending on rowCount and columnCount, the returned gVarHandle can also represent a vector or a scalar.


Generated on Mon Nov 14 11:40:39 2011 for Libra by  doxygen 1.5.2