#include /* Implements an arbitrary sized matrix class. */ class matrix { public: matrix(const int row, const int col); ~matrix(); long double det(); long double set(int row, int col, long double val); void print(); void equals(matrix *source); void inverse(void); long double value(int row, int col); void times_row(long double *row_mat, long double *results); private: long double *values; int row, col; }; /* Constructor: Initializes number of rows and cols in the matrix and sets all elements to zero. */ matrix::matrix(const int num_rows, const int num_cols) { values = new long double[num_rows*num_cols]; row = num_rows; col = num_cols; for (int i=0; ivalues+i); } /* Takes the inverse of a matrix using Gauss-Jordan elimination. */ void matrix::inverse() { matrix old(row,col),temp(row, col),temp_old(row,col); long double subval,divval; // Create temp = unity matrix for (int i=0;i