18 #ifndef __MATHMATRIX_H__ 19 #define __MATHMATRIX_H__ 21 #include "MathVector.h" 49 void SetLabel(
const char * name);
50 void SetPrecision(
int p)
81 int rows, cols, size, extraSize;
109 Matrix(
const char * name,
int n,
int m)
117 void Dimension(
int m,
int n);
118 void Dimension(
int m,
int n,
double value);
119 void GrowTo(
int m,
int n)
121 Dimension(m > rows ? m : rows, n > cols ? n : cols);
123 void GrowTo(
int m,
int n,
double value)
125 Dimension(m > rows ? m : rows, n > cols ? n : cols, value);
128 void SetLabel(
const char * name);
129 void SetColumnLabel(
int n,
const char * name)
131 extras[n].SetLabel(name);
133 const char * GetColumnLabel(
int n)
135 return extras[n].label;
137 void SetColWidth(
int n,
int w)
139 extras[n].SetWidth(w);
141 void SetColPrecision(
int n,
int p)
143 extras[n].SetPrecision(p);
145 void CopyLabels(
Matrix & m);
152 void Copy(
const Matrix & m);
153 void Transpose(
const Matrix & m);
154 void Add(
const Matrix & m);
155 void AddMultiple(
double k,
const Matrix & m);
156 void Product(
const Matrix & left,
const Matrix & right);
159 void Multiply(
double k);
163 void Reduce(
double tol = 0.0);
165 Vector & operator [](
int i)
171 const Vector & operator [](
int i)
const 177 void DeleteRow(
int r);
178 void DeleteColumn(
int c);
180 void SwapRows(
int r1,
int r2)
187 void SwapColumns(
int c1,
int c2);
189 void MultiplyRow(
int r1,
double k);
190 void AddRows(
int r1,
int r2);
191 void AddRows(
double k,
int r1,
int r2);
196 void Print(FILE * f,
int maxRows = -1,
int maxCols = -1);
197 void PrintUpper(FILE * f,
int maxRows = -1,
int maxCols = -1,
bool print_diag =
false);
198 void PrintLower(FILE * f,
int maxRows = -1,
int maxCols = -1,
bool print_diag =
false);
199 void SetupPrint(FILE *f,
int r,
int c,
int & column_zero,
int * precision,
int * width);
209 bool operator == (
const Matrix & rhs)
const;
210 bool operator != (
const Matrix & rhs)
const 212 return !(*
this == rhs);
215 Matrix & operator *= (
double rhs)
220 Matrix & operator /= (
double rhs)
227 void StackBottom(
const Matrix & m);
230 void StackLeft(
const Matrix & m);
241 double SafeMin()
const;
242 double SafeMax()
const;
243 double SafeMean()
const;
244 int SafeCount()
const;
249 return *(data[rows - 1]);