//=============================================================================== // // TestVect.c // // Developer: Henry Guennadi Levkin // //=============================================================================== #include #include "VectMatr.h" #define MATRIX_DIM 5 //------------------------------------------------------------------------------- int main(int nArg, char** ppArg) { SMatr mat1; SMatr mat2; SMatr mat3; SVect vec1, vec2; double arr[MATRIX_DIM*MATRIX_DIM] = { 1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 11., 12., 13., 14., 15., 16., 17., 18., 19., 20., 21., 22., 23., 24., 25.,}; double varr[MATRIX_DIM] = { 1., -2., 3., -4., 5.,}; double fNumb; printf("Matrix Algebra Library Tests:\n"); VectorConstruct(&vec1, MATRIX_DIM); VectorConstruct(&vec2, MATRIX_DIM); VectorFill(&vec1, varr); MatrixConstruct(&mat1, MATRIX_DIM); MatrixPrint(&mat1); MatrixConstructUnit(&mat2, MATRIX_DIM); MatrixPrint(&mat2); MatrixConstructAndFill(&mat3, MATRIX_DIM, arr); MatrixPrint(&mat3); MatrixAddMatrix(&mat2, &mat3, &mat1); MatrixPrint(&mat1); MatrixAddConstant(&mat2, &mat2, 1.234); MatrixPrint(&mat2); MatrixAddConstant(&mat2, &mat2, -1.234); MatrixPrint(&mat2); MatrixMultMatrix(&mat1, &mat3, &mat2); MatrixPrint(&mat2); MatrixMultVector(&mat1, &vec1, &vec2); VectorPrint(&vec2); //printf(".\n"); return 0; }