// file: $isip/doc/examples/class/math/matrix/math_matrix_example_00/example.cc // version: $Id: example.cc 6107 2000-12-28 21:23:56Z hamaker $ // // isip include files // #include // main program starts here // this example demonstrates the simple addition of two matrices // int main () { // declare two matrices // MatrixDouble a; MatrixDouble b; // assign the matrices. the first two arguments are the number of // rows and columns of the matrix, respectively. next comes a stream // of values that are assigned in row-order to the matrix. // a.assign(3, 3, L"4.0, 3.0, 1.0, 7.0, 0.0, 4.0, 2.0, 8.0, 1.0"); b.assign(3, 3, L"3.0, 7.0, 34.0, 6.0, 1.0, 88.0, 6.0, 3.0, 5.0"); // compute the sum and store it in a new matrix. note that the // dimensions of 'c' will be set automatically. // MatrixDouble c; c.add(a, b); // output the result to the console output // a.debug(L"a"); b.debug(L"b"); c.debug(L"a + b = "); // exit gracefully // Integral::exit(); }