g++ [flags ...] file ... -l /isip/tools/lib/$ISIP_BINARY/lib_math_matrix.a
#include <MatrixFloat.h>
MatrixFloat(long nrows = DEF_SIZE, long ncols = DEF_SIZE,
long type = DEF_TYPE);
MatrixFloat(const MatrixFloat& matrix);
quick start:
float data0[6] = {1.2, 2.5, 3.6, 4.8, 5.1, 6.7};
float data1[6] = {4.2, 6.1, 7.0, 2.5, 3.3, 9.5};
MatrixFloat val0;
MatrixFloat val1(3, 3, Integral::LOWER_TRIANGULAR);
val0.assign(data0, 2, 3)
val1.assign(data1, 3, 3);
description:
static const String CLASS_NAME = L"MatrixFloat";
static const long ERR = 24800;
static MemoryManager mgr_d;
static const String& name();
static boolean diagnose(Integral::DEBUG debug_level);
boolean debug(const unichar* message) const;
~MatrixFloat();
MatrixFloat(long nrows = DEF_SIZE, long ncols = DEF_SIZE, long type = DEF_TYPE);
MatrixFloat(const MatrixFloat& matrix);
these methods are inherited from the MMatrix template class
MatrixFloat& operator=(const MatrixFloat& matrix);
boolean read(Sof& sof, long tag, const String& name = CLASS_NAME);
boolean write(Sof& sof, long tag, const String& name = CLASS_NAME) const;
these methods are inherited from the MMatrix template class
static void* operator new(size_t size);
static void* operator new[](size_t size);
static void operator delete(void* ptr);
static void operator delete[](void* ptr);
static boolean setGrowSize(long grow_size);
MatrixFloat(long nrows, long ncols, const unichar* arg, long type = DEF_TYPE, const Char delim = DEF_DELIM);
MatrixFloat& operator=(float value);
// declare the operands: note that these matrices are of different types.
// the class will handle type conversion automatically.
//
MatrixFloat x;
x.assign(3, 3, L"1.0, 2.0, 3.0, 6.0, 5.0, 4.0, 7.0, 8.0, 9.0", Integral::FULL);
MatrixFloat y;
y.assign(3, 3, L"1.0, 1.0, 1.0", Integral::DIAGONAL);
MatrixFloat z;
z.setDimensions(3, 3);
z.setValue(1, 2, 27.0);
// declare an output matrix: not that we don't need to declare the size
// of this matrix.
//
MatrixFloat w;
// compute a matrix inverse in place: this destroys the input.
//
x.inverse();
// compute the product of the inverse of x and y, and add z
//
x.mult(y);
w.add(x, z);
// print the output
//
w.debug(L"the answer is");
The output that results from this example is:
[ 0.190476 0.52381 -0.333333 ]
w = [ -0.952381 -0.619048 27.6667 ]
[ 0.904762 0.238095 -0.333333 ]