g++ [flags ...] file ... -l /isip/tools/lib/$ISIP_BINARY/lib_math_matrix.a
#include <MatrixDouble.h>
MatrixDouble(long nrows = DEF_SIZE, long ncols = DEF_SIZE,
long type = DEF_TYPE);
MatrixDouble(const MatrixDouble& matrix);
quick start:
double data0[6] = {1.2, 2.5, 3.6, 4.8, 5.1, 6.7};
double data1[6] = {4.2, 6.1, 7.0, 2.5, 3.3, 9.5};
MatrixDouble val0;
MatrixDouble val1(3, 3, Integral::LOWER_TRIANGLE);
val0.assign(2, 3, data0);
val1.assign(3, 3, data1, Integral::LOWER_TRIANGLE);
description:
static const String CLASS_NAME = L"MatrixDouble";
static const long ERR = 24900;
static MemoryManager mgr_d;
static const String& name();
static boolean diagnose(Integral::DEBUG debug_level);
boolean debug(const unichar* message) const;
~MatrixDouble();
MatrixDouble(ong nrows = DEF_SIZE, long ncols = DEF_SIZE, long type = DEF_TYPE);
MatrixDouble(const MatrixDouble& matrix);
these methods are inherited from the MMatrix template class
MatrixDouble& operator=(const MatrixDouble& 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);
MatrixDouble(long nrows, long ncols, const unichar* arg, long type = DEF_TYPE, const Char delim = DEF_DELIM);
MatrixDouble& operator=(double value);
// declare the operands: note that these matrices are of different types.
// the class will handle type conversion automatically.
//
MatrixDouble 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);
MatrixDouble y;
y.assign(3, 3, L"1.0, 1.0, 1.0", Integral::DIAGONAL);
MatrixDouble 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.
//
MatrixDouble 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.19047619047619024 0.52380952380952361 -0.33333333333333315 ]
w = [ -0.95238095238095188 -0.61904761904761874 27.666666666666668 ]
[ 0.90476190476190455 0.23809523809523797 -0.33333333333333315 ]