quick start:g++ [flags ...] file ... -l /isip/tools/lib/$ISIP_BINARY/lib_math_matrix.a #include <MatrixLong.h> MatrixLong(long nrows = DEF_SIZE, long ncols = DEF_SIZE, long type = DEF_TYPE); MatrixLong(const MatrixLong& matrix);
description:long data0[6] = {1, 2, 3, 4, 5, 6}; long data1[6] = {4, 6, 7, 2, 3, 9}; MatrixLong val0; MatrixLong val1(3, 3, Integral::LOWER_TRIANGLE); val0.assign(2, 3, data0); val1.assign(3, 3, data1);
static const String CLASS_NAME = L"MatrixLong";
static const long ERR = 24600;
static MemoryManager mgr_d;
static const String& name();
static boolean diagnose(Integral::DEBUG debug_level);
boolean debug(const unichar* message) const;
~MatrixLong();
MatrixLong(ong nrows = DEF_SIZE, long ncols = DEF_SIZE, long type = DEF_TYPE);
MatrixLong(const MatrixLong& matrix);
the copy assign method is inherited from the MMatrix template class
MatrixLong& operator=(const MatrixLong& arg_a);
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);
MatrixLong(long nrows, long ncols, const unichar* arg, long type = DEF_TYPE, const Char delim = DEF_DELIM);
MatrixLong& operator=(long value);
// declare the operands: note that these matrices are of different types. // the class will handle type conversion automatically. // MatrixLong x; x.assign(3, 3, L"1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0", Integral::FULL); MatrixLong y; y.assign(3, 3, L"3.0, 2.0, 1.0", Integral::DIAGONAL); MatrixLong z; z.setDimensions(3, 3); z.setValue(1, 2, 1.0); // declare an output matrix: not that we don't need to declare the size // of this matrix. // MatrixLong w; // compute a matrix transpose and put into a new matrix // MatrixLong x_t; x_t.transpose(x); // compute the product of y and x, and multiply the result with the transpose of x, then subtract z // y.mult(x) x_t.mult(y); w.sub(x_t, z); // print the output // w.debug(L"the answer is");The output that results from this example is:
[ 84 102 120 ] w = [ 102 126 149 ] [ 120 150 180 ]