91 int old_offset = this->p_offset;
95 new_rows = this->num_rows();
97 new_cols = this->num_columns();
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);
105 this->just_resize(new_rows, new_cols, &old_vals);
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)
114 if (*this->def_val == 0)
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++)
123 this->a_no_check(i,j) = *this->def_val;
127 else if (!this->p_sub_matrix)
129 int old_row_step = this->p_row_step;
130 int old_column_step = this->p_column_step;
131 int copy_r = Lof(this->num_rows(), new_rows);
132 int copy_c = Lof(this->num_columns(), new_cols);
134 this->just_resize(new_rows, new_cols, &old_vals);
136 this->set_values(old_vals,
137 old_row_step, old_column_step,
143 for(i=0; i<copy_r; i++)
144 for(j=copy_c; j<new_cols; j++)
145 this->a_no_check(i,j) = *this->def_val;
147 if (new_rows > copy_r)
149 if (*this->def_val == 0)
151 for (q=0; q<((new_rows-copy_r)*new_cols*
sizeof(T)); q++)
152 ((
char *)(this->p_memory + copy_r*this->p_row_step))[q] = 0;
156 for(j=0; j<new_cols; j++)
157 for(i=copy_r; i<new_rows; i++)
158 this->a_no_check(i,j) = *this->def_val;
168 if (old_vals && old_vals != this->p_memory)
169 delete [] (old_vals-old_offset);