48 #include "EST_rw_status.h" 
   49 #include "EST_TVector.h" 
   50 #include "instantiate/EST_TMatrixI.h" 
   53 #ifndef TMATRIX_BOUNDS_CHECKING 
   54 #    define TMATRIX_BOUNDS_CHECKING 0 
   57 #if TMATRIX_BOUNDS_CHECKING 
   58 #define A_CHECK a_check 
   60 #define A_CHECK a_no_check 
   68 #if defined(__GNUC__) && 0 
   69 #    define mx_move_pointer(P, TY, STEP, N) \ 
   71          ((void *) (((char (*) [sizeof(TY)*STEP])P) + N) ) \ 
   73 #    define fast_a_m_gcc(R,C) \ 
   74     ( * mx_move_pointer(mx_move_pointer(p_memory,T,p_column_step,C),T,p_row_step,R)) 
   75 #    define fast_a_m_x(R,C) (fast_a_m_gcc(R,C)) 
   77 #    define fast_a_m_x(R,C) (fast_a_m(R,C)) 
  101   INLINE 
unsigned int mcell_pos(
int r, 
int c,
 
  102                    int rs, 
int cs)
 const 
  103     { 
return (rs==1?r:(r*rs)) + (cs==1?c:(c*cs));}
 
  106   INLINE 
unsigned int mcell_pos(
int r, 
int c)
 const 
  109       return mcell_pos(r, c, 
 
  110                this->p_row_step, this->p_column_step);
 
  113   INLINE 
unsigned int mcell_pos_1(
int r, 
int c)
 const 
  121   INLINE 
const T &fast_a_m(
int r, 
int c)
 const  
  122     { 
return this->p_memory[mcell_pos(r,c)]; }
 
  123   INLINE T &fast_a_m(
int r, 
int c) 
 
  124     { 
return this->p_memory[mcell_pos(r,c)]; }
 
  126   INLINE 
const T &fast_a_1(
int r, 
int c)
 const  
  127     { 
return this->p_memory[mcell_pos_1(r,c)]; }
 
  128   INLINE T &fast_a_1(
int r, 
int c) 
 
  129     { 
return this->p_memory[mcell_pos_1(r,c)]; }
 
  133   void set_values(
const T *data, 
 
  134           int r_step, 
int c_step,
 
  135           int start_r, 
int num_r,
 
  136           int start_c, 
int num_c
 
  138   void get_values(T *data, 
 
  139           int r_step, 
int c_step,
 
  140           int start_r, 
int num_r,
 
  141           int start_c, 
int num_c
 
  150   void just_resize(
int new_rows, 
int new_cols, T** old_vals);
 
  167           T *memory, 
int offset=0, 
int free_when_destroyed=0);
 
  184   INLINE 
const T &a_no_check(
int row, 
int col)
 const  
  185     { 
return fast_a_m_x(row,col); }
 
  187   INLINE T &a_no_check(
int row, 
int col) 
 
  188     { 
return fast_a_m_x(row,col); }
 
  190   INLINE 
const T &a_no_check_1(
int row, 
int col)
 const { 
return fast_a_1(row,col); }
 
  191   INLINE T &a_no_check_1(
int row, 
int col) { 
return fast_a_1(row,col); }
 
  194   const T &a_check(
int row, 
int col) 
const;
 
  196   T &a_check(
int row, 
int col);
 
  198   const T &a(
int row, 
int col)
 const { 
return A_CHECK(row,col); }
 
  199   T &a(
int row, 
int col) { 
return A_CHECK(row,col); }
 
  202   const T &operator () (
int row, 
int col)
 const { 
return a(row,col); }
 
  204   T &operator () (
int row, 
int col) { 
return a(row,col); }
 
  208   bool have_rows_before(
int n) 
const;
 
  209   bool have_columns_before(
int n) 
const;
 
  216     void resize(
int rows, 
int cols, 
int set=1); 
 
  219   void fill(
const T &v);
 
  220   void fill() { fill(*this->def_val); }
 
  240   void column(
EST_TVector<T> &cv, 
int c, 
int start_r=0, 
int len=-1);
 
  243           int r=0, 
int numr=EST_ALL, 
 
  244           int c=0, 
int numc=EST_ALL);
 
  254     void copy_row(
int r, T *buf, 
int offset=0, 
int num=-1) 
const;
 
  260     void copy_row(
int r, 
EST_TVector<T> &t, 
int offset=0, 
int num=-1) 
const;
 
  265     void copy_column(
int c, T *buf, 
int offset=0, 
int num=-1) 
const;
 
  271     void copy_column(
int c,  
EST_TVector<T> &t, 
int offset=0, 
int num=-1)
const;
 
  275     void set_row(
int n, 
const T *buf, 
int offset=0, 
int num=-1);
 
  277     void set_row(
int n, 
const EST_TVector<T> &t, 
int offset=0, 
int num=-1)
 
  278       { set_row(n, t.
memory(), offset, num); }
 
  282                  int offset=0, 
int num=-1); 
 
  287     void set_column(
int n, 
const T *buf, 
int offset=0, 
int num=-1);
 
  289     void set_column(
int n, 
const EST_TVector<T> &t, 
int offset=0, 
int num=-1)
 
  290       { set_column(n, t.
memory(), offset, num); }
 
  292     void set_column(
int c, 
 
  294                     int offset=0, 
int num=-1); 
 
  298   void set_memory(T *buffer, 
int offset, 
int rows, 
int columns, 
 
  299           int free_when_destroyed=0);
 
  308   EST_read_status  load(
const class EST_String &filename);
 
  310   EST_write_status save(
const class EST_String &filename) 
const;
 
  313   friend ostream& operator << (ostream &st,const EST_TMatrix<T> &a)
 
  315         for (i = 0; i < a.num_rows(); ++i) {
 
  316             for (j = 0; j < a.num_columns(); ++j) 
 
  317                 st << a.a_no_check(i, j) << 
" "; st << endl;