43#include "EST_TSimpleMatrix.h"
44#include "EST_TVector.h"
48#include "EST_cutils.h"
57 if (!a.p_sub_matrix && !this->p_sub_matrix)
58 memcpy((
void *)&this->a_no_check(0,0),
60 this->num_rows()*this->num_columns()*
sizeof(T)
64 for (
int i = 0; i < this->num_rows(); ++i)
73 if (this->
num_rows() != a.num_rows() || this->num_columns() != a.num_columns())
74 resize(a.num_rows(), a.num_columns(), 0);
101 if (!this->p_sub_matrix && new_cols == this->
num_columns() && new_rows != this->
num_rows())
103 int copy_r = Lof(this->
num_rows(), new_rows);
107 for (q=0; q<(copy_r*new_cols*
sizeof(T)); q++)
108 ((
char *)this->
p_memory)[q] = ((
char *)old_vals)[q];
112 if (new_rows > copy_r)
116 for (q=0; q<(new_rows-copy_r)*new_cols*
sizeof(T); q++)
117 ((
char *)(this->p_memory + copy_r*this->
p_row_step))[q] = 0;
121 for(j=0; j<new_cols; j++)
122 for(i=copy_r; i<new_rows; i++)
127 else if (!this->p_sub_matrix)
130 int old_column_step = this->p_column_step;
131 int copy_r = Lof(this->
num_rows(), new_rows);
137 old_row_step, old_column_step,
143 for(i=0; i<copy_r; i++)
144 for(j=copy_c; j<new_cols; j++)
147 if (new_rows > copy_r)
151 for (q=0; q<((new_rows-copy_r)*new_cols*
sizeof(T)); q++)
156 for(j=0; j<new_cols; j++)
157 for(i=copy_r; i<new_rows; i++)
168 if (old_vals && old_vals != this->
p_memory)
169 delete [] (old_vals-old_offset);
void set_values(const T *data, int r_step, int c_step, int start_r, int num_r, int start_c, int num_c)
Get and set values from array.
INLINE const T & a_no_check(int row, int col) const
const access with no bounds check, care recommend
int num_rows() const
return number of rows
void just_resize(int new_rows, int new_cols, T **old_vals)
resize the memory and reset the bounds, but don't set values.
unsigned int p_row_step
How to access the memory.
void resize(int rows, int cols, int set=1)
void resize(int rows, int cols, int set=1)
resize matrix
EST_TSimpleMatrix(void)
default constructor
void copy(const EST_TSimpleMatrix< T > &a)
copy one matrix into another
EST_TSimpleMatrix< T > & operator=(const EST_TSimpleMatrix< T > &s)
assignment operator
unsigned int p_offset
How to access the memory.
static const T * def_val
default value, used for filling matrix after resizing