56 #include "EST_TMatrix.h"
57 #include "EST_String.h"
64 static inline int max(
int a,
int b) {
return a>b?a:b; }
95 for(
int i=0; i<m.num_rows(); i++)
96 for(
int j=0; j<m.num_columns(); j++)
106 cout <<
"Initial Matrix\n";
119 cout <<
"Resized Matrix\n";
124 for(
int i0=0; i0<m.num_rows(); i0++)
125 for(
int j=0; j<m.num_columns(); j++)
126 m.a(i0,j) = i0+j/100.0;
129 cout <<
"Full Matrix\n";
147 float *buf =
new float[max(m.num_rows(),m.num_columns())];
153 for(
int j1=0; j1<m.num_columns(); j1++)
154 cout << buf[j1] <<
"\t";
160 for(
int i1=0; i1<m.num_rows(); i1++)
173 cout <<
"Updated Matrix (column 5 replaced with 100s from buffer)\n";
200 m.sub_matrix(rectangle,
205 cout <<
"Row 10 extracted as sub vector\n";
209 cout <<
"Column 3 extracted as sub vector\n";
213 cout <<
"Rectangle extracted as sub vector\n";
223 for(
int i2=0; i2<row.
n(); i2++)
227 for(
int i3=0; i3<column.
n(); i3++)
228 column[i3] = i3*i3*i3;
231 for(
int i4=0; i4<rectangle.
num_rows(); i4++)
233 rectangle.a(i4, j4) = -1;
245 rectangle.
row(rrow, 2);
247 rectangle.
column(rcolumn, 1);
251 for(
int i6=0; i6<rcolumn.
n(); i6++)
253 for(
int i5=0; i5<rrow.
n(); i5++)
258 cout <<
"Updated Matrix (row 10 becomes squares, column 3 becomes cubes, center becomes negative)\n";
275 #ifdef __NOT_REAL_CODE__
279 Declare_TMatrix(MyType)
281 #if defined(INSTANTIATE_TEMPLATES)
283 #include "../base_class/EST_TMatrix.cc"
285 Instantiate_TMatrix(MyType)