Nemo  2.4.0b
Simulate forward-in-time genetic evolution in a spatially explicit, individual-based stochastic simulator
TMatrix Class Reference

A class to handle matrix in params, coerces matrix into a vector of same total size. More...

#include <tmatrix.h>

+ Collaboration diagram for TMatrix:

Public Member Functions

 TMatrix ()
 
 TMatrix (const TMatrix &mat)
 copy constructor. More...
 
 TMatrix (unsigned int rows, unsigned int cols)
 Creates an array of doubles of size = rows*cols. More...
 
 ~TMatrix ()
 
void copy (const TMatrix &mat)
 Copy a matrix. More...
 
void copy_recycle (const TMatrix &mat)
 Copy elements of 'mat', recycling elements of 'mat' if its size is smaller than current matrix. More...
 
void set (unsigned int i, unsigned int j, double val)
 Sets element at row i and column j to value val. More...
 
void set_row (unsigned int i, double val)
 Sets all elements at row i to value val. More...
 
void set_row (unsigned int i, vector< double > vec)
 Sets elements at row i to values stored in vector vec. More...
 
void set_col (unsigned int i, double val)
 Sets element at column i to value val. More...
 
void set_col (unsigned int i, vector< double > vec)
 Sets element at column i to values stored in vector vec. More...
 
void assign (double val)
 Assigns a value to all element of the matrix. More...
 
void reset (unsigned int rows, unsigned int cols)
 Re-allocate the existing matrix with assigned rows and cols dimensions and all elements to 0. More...
 
void reset (unsigned int rows, unsigned int cols, double value)
 Reset the existing matrix to the new dimensions and copies the value to all elements. More...
 
void reset (unsigned int rows, unsigned int cols, const double *array)
 Reset the existing matrix to the new dimensions and copies the array, which has to be of the same total length. More...
 
void reset ()
 Reset members to zero state. More...
 
double get (unsigned int i, unsigned int j) const
 Accessor to element at row i and column j. More...
 
double * get () const
 Accessor to the whole array. More...
 
double * getValArray () const
 
unsigned int get_dims (unsigned int *dims) const
 Accessor to the matrix dimensions. More...
 
unsigned int getNbRows () const
 Gives the number of rows. More...
 
unsigned int nrows () const
 
unsigned int getNbCols () const
 Gives the number of columns. More...
 
unsigned int ncols () const
 
unsigned int length () const
 Returns the number of elements in the matrix. More...
 
void getColumnView (unsigned int col, unsigned int n, double *array)
 Gives access to a column of the matrix. More...
 
void getRowView (unsigned int row, unsigned int n, double *array)
 Gives access to a row of the matrix. More...
 
void plus (unsigned int i, unsigned int j, double value)
 Adds a value to an element of the matrix. More...
 
void matrix_increment (double value)
 Adds a value to all elements in a matrix. More...
 
void minus (unsigned int i, unsigned int j, double value)
 Substracts a value from an element of the matrix. More...
 
void multi (unsigned int i, unsigned int j, double value)
 Multiply an element of the matrix by a value. More...
 
void divide (unsigned int i, unsigned int j, double value)
 Divide an element of the matrix by a value. More...
 
void transpose ()
 Transpose the matrix, swaps columns for rows. More...
 
double colSum (unsigned int col)
 Sum all elements in a column. More...
 
double rowSum (unsigned int row)
 Sum all elements in a row. More...
 
void show_up ()
 
string to_string ()
 Writes the matrix into a string in Nemo's matrix input format. More...
 

Private Attributes

unsigned int _rows
 
unsigned int _cols
 
unsigned int _length
 
double * _val
 

Detailed Description

A class to handle matrix in params, coerces matrix into a vector of same total size.

Constructor & Destructor Documentation

◆ TMatrix() [1/3]

TMatrix::TMatrix ( )
inline
59 : _rows(0), _cols(0), _length(0), _val(0) { }
unsigned int _cols
Definition: tmatrix.h:53
unsigned int _rows
Definition: tmatrix.h:53
double * _val
Definition: tmatrix.h:55
unsigned int _length
Definition: tmatrix.h:53

◆ TMatrix() [2/3]

TMatrix::TMatrix ( const TMatrix mat)
inline

copy constructor.

62  : _rows(0), _cols(0), _length(0), _val(0)
63  {
64  copy(mat);
65  }
void copy(const TMatrix &mat)
Copy a matrix.
Definition: tmatrix.h:78

◆ TMatrix() [3/3]

TMatrix::TMatrix ( unsigned int  rows,
unsigned int  cols 
)
inline

Creates an array of doubles of size = rows*cols.

68  : _rows(0), _cols(0), _length(0), _val(0)
69  {
70  _length = rows*cols;
71  _val = new double [_length];
72  _rows = rows; _cols = cols;
73  }

◆ ~TMatrix()

TMatrix::~TMatrix ( )
inline
75 {if(_val != NULL) delete [] _val;}

Member Function Documentation

◆ assign()

◆ colSum()

double TMatrix::colSum ( unsigned int  col)
inline

Sum all elements in a column.

309  {
310  assert(col < _cols); //has to be [0, _cols-1]
311  double sum = 0;
312  for (unsigned int i = 0; i < _rows; ++i) {
313  sum += _val[i*_cols + col];
314  }
315  return sum;
316  }

Referenced by TProtoQuanti::get_trait_mutation_variance().

◆ copy()

void TMatrix::copy ( const TMatrix mat)
inline

Copy a matrix.

79  {
80  _rows = mat._rows;
81  _cols = mat._cols;
83  if(_val) delete [] _val;
84  _val = new double [_length];
85  memcpy(_val,mat._val,_length*sizeof(double));
86  }

References _cols, _rows, and _val.

Referenced by LCE_PhenotypeExpression::execute(), TTNOhtaStats::FHwrite(), TTQOhtaStats::FHwrite(), TProtoQuanti::setEpistasisParameters(), LCE_Breed_Wolbachia::setParameters(), Metapop::setPatchSizes(), and TProtoQuanti::TProtoQuanti().

◆ copy_recycle()

void TMatrix::copy_recycle ( const TMatrix mat)
inline

Copy elements of 'mat', recycling elements of 'mat' if its size is smaller than current matrix.

Will only copy as many elements as necessary given _rows and _cols of current matrix.

91  {
92  if(_rows == mat._rows && _cols == mat._cols)
93  copy(mat);
94  else if(_val == NULL || _length == 0)
95  error("TMatrix::copy_recycle::matrix must be allocated before call\n");
96  else {
97  for(unsigned int i = 0; i < _rows; ++i)
98  for(unsigned int j = 0; j < _cols; ++j)
99  set(i, j, mat._val[ (i%mat._rows)*mat._cols + (j%mat._cols) ]); //mat.get( i%nrow, j%ncol )); _val[i*_cols + j]
100  }
101  }
void set(unsigned int i, unsigned int j, double val)
Sets element at row i and column j to value val.
Definition: tmatrix.h:103
int error(const char *str,...)
Definition: output.cc:77

References _cols, _rows, _val, and error().

Referenced by TProtoQuanti::setDominanceParameters(), TProtoQuanti::setEpistasisParameters(), TProtoQuanti::setMutationCorrelation(), TProtoQuanti::setMutationSigmaFromQuantiMutationVariance_no_pleio(), and TProtoBDMI::setParameters().

◆ divide()

void TMatrix::divide ( unsigned int  i,
unsigned int  j,
double  value 
)
inline

Divide an element of the matrix by a value.

290  {
291  if( i*j < _length)
292  _val[i*_cols + j] /= value;
293  else
294  error("TMatrix::divide overflow!\n");
295  }

References error().

Referenced by TTNeutralGenesSH::setAlleleTables().

◆ get() [1/2]

double* TMatrix::get ( ) const
inline

Accessor to the whole array.

201 {return _val;}

◆ get() [2/2]

double TMatrix::get ( unsigned int  i,
unsigned int  j 
) const
inline

Accessor to element at row i and column j.

193  {
194  if( !((i+1)*(j+1) > _length) )
195  return _val[i*_cols + j];
196  else
197  fatal("TMatrix::get overflow!\n");
198  return 0;
199  }
void fatal(const char *str,...)
Definition: output.cc:96

References fatal().

Referenced by Metapop::buildPatchArray(), LCE_Selection_base::changeLocalOptima(), LCE_PhenotypeExpression::check_g_index_matrix(), LCE_Disperse_base::checkBackwardDispersalMatrix(), LCE_Disperse_base::checkForwardDispersalMatrix(), LCE_Patch_Extinction::do_remove(), LCE_Patch_Extinction::execute(), LCE_PhenotypeExpression::execute(), LCE_QuantiModifier::execute(), LCE_Breed_Disperse::exponentialGrowth(), TTNOhtaStats::FHwrite(), TTQFreqExtractor::FHwrite(), TTQOhtaStats::FHwrite(), TProtoQuanti::get_diallele_value(), TProtoQuanti::get_dominance(), LCE_PhenotypeExpression::get_env_cue_no_noise(), LCE_PhenotypeExpression::get_env_cue_noise(), TTQuanti_continuous_full_pleio_epistasis::get_epistatic_genotype(), TTQuanti_diallelic_full_pleio_epistasis::get_epistatic_genotype(), TTQuanti_continuous_no_pleio_epistasis::get_epistatic_genotype(), TTQuanti_diallelic_no_pleio_epistasis::get_epistatic_genotype(), LCE_Patch_Extinction::get_harvest_size(), TProtoQuanti::get_init_value(), TProtoQuanti::get_init_variance(), TProtoQuanti::get_trait_mutation_variance(), TTNeutralGenesSH::getCoa(), LCE_Breed_base::getFecundity(), LCE_Selection_base::getFitnessMultivariateGaussian(), LCE_Selection_base::getFitnessMultivariateGaussian_VE(), LCE_Selection_base::getFitnessUnivariateGaussian(), LCE_Selection_base::getFitnessUnivariateGaussian_VE(), LCE_Selection_base::getFitnessUnivariateQuadratic(), TTNeutralGenesSH::getFst_ij(), TProtoBDMI::getGenoFitnessDiplo(), TProtoBDMI::getGenoFitnessHaplo(), TTNeutralGenesSH::getGlobalAlleleFreq(), LCE_Breed_base::getMeanFecundity(), TProtoQuanti::getMutationEffectBivariateDiallelic(), TProtoQuanti::getMutationEffectBivariateGaussian(), TProtoQuanti::getMutationEffectBivariateGaussianLocSpec(), TProtoQuanti::getMutationEffectUnivariateDiallelic(), TProtoQuanti::getMutationEffectUnivariateGaussian(), TProtoQuanti::getMutationEffectUnivariateGaussianLocSpec(), TTNeutralGenesSH::getNeiGeneticDistance(), Metapop::getPatchCapacity(), TTQuantiSH::getVaNoDominance(), TTQuantiSH::getVaWithDominance(), TTDispersal::init_sequence(), LCE_Breed_Wolbachia::inoculate_wolbachia(), TProtoQuanti::mutate_diallelic_pleio(), TProtoQuanti::mutate_diallelic_var_pleio(), LCE_Breed_base::NonWrightFisherPopulation(), LCE_Breed_Quanti::NonWrightFisherPopulation(), LCE_Resize::removeDesignatedPatch(), TProtoQuanti::set_gsl_mutation_matrix_from_sigma(), FileHandler::set_OccMatrix(), LCE_Selection_base::set_param_rate_of_change(), LCE_PhenotypeExpression::set_phenot_g1_evol(), LCE_PhenotypeExpression::set_phenot_g1_g2_evol(), LCE_PhenotypeExpression::set_phenot_g2_evol(), LCE_PhenotypeExpression::set_phenot_no_evol(), LCE_Selection_base::set_sel_model(), LCE_Selection_base::set_std_rate_of_change(), LCE_Disperse_base::setBasicLatticeMatrix(), TProtoQuanti::setContinuousMutationModel_full_pleio(), TProtoQuanti::setContinuousMutationModel_var_pleio(), TTQuantiSH::setDataTables(), TProtoQuanti::setDiallelicMutationModel(), TProtoQuanti::setDominanceParameters(), TProtoDeletMutations_bitstring::setEffectsFromInput(), LCE_Breed_base::setFecundity(), TTNeutralGenesSH::setFst_li(), TTNeutralGenesSH::setFstatWeirCockerham(), TTNeutralGenesSH::setFstatWeirCockerham_MS(), TTNeutralGenesSH::setFstMatrix(), TTProtoWithMap::setGeneticMapParameters(), TProtoQuanti::setHeritabilityParams(), TTNeutralGenesSH::setHt(), TTNeutralGenesSH::setHt2(), LCE_Disperse_base::setLatticeAbsorbingMatrix(), LCE_Disperse_base::setLatticeReflectingMatrix(), LCE_Disperse_base::setLatticeTorrusMatrix(), TTNeutralGenesSH::setLociDivCounter(), TProtoQuanti::setMutationModel_no_pleio(), TProtoQuanti::setMutationModel_var_pleio(), TProtoQuanti::setMutationSigmaFromQuantiMutationVariance(), TProtoQuanti::setMutationSigmaFromQuantiMutationVariance_no_pleio(), TTProtoWithMap::setNumLociPerChromosome(), LCE_StatServiceNotifier::setOccurence(), LCE_Breed_Disperse::setParameters(), LCE_Resize::setParameters(), TProtoBDMI::setParameters(), Metapop::setPatchCapacities(), LCE_Init_BDMI::setPatchFreq(), LCE_Selection_base::setSelectionMatrix(), setSpatialMatrix(), LCE_Init_BDMI::setSpatialPattern(), TProtoQuanti::setTraitAndLocusTables_no_pleio(), TProtoBDMI::showGenoTable(), ParamsParser::sym_matrix(), transpose(), LCE_Resize::updatePatchCapacities(), Metapop::updatePatchState(), and TTNeutralGenesFH::write_varcompWC().

◆ get_dims()

unsigned int TMatrix::get_dims ( unsigned int *  dims) const
inline

Accessor to the matrix dimensions.

Parameters
dimsan array of at least 2 elements to store the row [0] and column [1] numbers. May be NULL.
Returns
the total size of the matrix
207  {
208  if(dims != NULL) { dims[0] = _rows; dims[1] = _cols; }
209  return _length;
210  }

◆ getColumnView()

void TMatrix::getColumnView ( unsigned int  col,
unsigned int  n,
double *  array 
)
inline

Gives access to a column of the matrix.

Parameters
colindex of col to view
nsize of the storing array passed, must be equal to no. of rows
arrayarray where the column values will be stored
225  {
226  if(col > _cols-1) {
227  error("TMatrix::getColumnView: not that many columns in matrix\n");
228  return;
229  }
230  if(n != _rows) {
231  error("TMatrix::getColumnView: array size not equal to number of rows in matrix\n");
232  return;
233  }
234  for(unsigned int i = 0; i < _rows; ++i)
235  array[i] = _val[i*_cols + col];
236  }

References error().

◆ getNbCols()

◆ getNbRows()

◆ getRowView()

void TMatrix::getRowView ( unsigned int  row,
unsigned int  n,
double *  array 
)
inline

Gives access to a row of the matrix.

Parameters
rowindex of row to view
nsize of the storing array passed, must be equal to no. of columns
arrayarray where the row values will be stored
243  {
244  if(row > _rows-1) {
245  error("TMatrix::getRowView: not that many rows in matrix\n");
246  return;
247  }
248  if(n != _cols) {
249  error("TMatrix::getRowView: array size not equal to number of columns in matrix\n");
250  return;
251  }
252  for(unsigned int i = 0, stride = row*_cols; i < _cols; ++i)
253  array[i] = _val[stride + i];
254  }

References error().

Referenced by LCE_QuantiInit::execute(), LCE_Init_BDMI::execute(), and LCE_NtrlInit::execute().

◆ getValArray()

double* TMatrix::getValArray ( ) const
inline
202 {return _val;}

Referenced by FileHandler::set_OccMatrix().

◆ length()

◆ matrix_increment()

void TMatrix::matrix_increment ( double  value)
inline

Adds a value to all elements in a matrix.

265  {
266  for(unsigned int i = 0; i < _rows; ++i){
267  for(unsigned int j = 0; j < _cols; ++j){
268  plus(i,j,value);
269  }
270  }
271  }
void plus(unsigned int i, unsigned int j, double value)
Adds a value to an element of the matrix.
Definition: tmatrix.h:256

◆ minus()

void TMatrix::minus ( unsigned int  i,
unsigned int  j,
double  value 
)
inline

Substracts a value from an element of the matrix.

274  {
275  if( i*j < _length)
276  _val[i*_cols + j] -= value;
277  else
278  error("TMatrix::minus overflow!\n");
279  }

References error().

Referenced by LCE_PhenotypeExpression::check_g_index_matrix().

◆ multi()

void TMatrix::multi ( unsigned int  i,
unsigned int  j,
double  value 
)
inline

Multiply an element of the matrix by a value.

282  {
283  if( i*j < _length)
284  _val[i*_cols + j] *= value;
285  else
286  error("TMatrix::multi overflow!\n");
287  }

References error().

Referenced by LCE_Selection_base::set_std_rate_of_change().

◆ ncols()

◆ nrows()

◆ plus()

void TMatrix::plus ( unsigned int  i,
unsigned int  j,
double  value 
)
inline

Adds a value to an element of the matrix.

257  {
258  if( i*j < _length)
259  _val[i*_cols + j] += value;
260  else
261  error("TMatrix::plus overflow!\n");
262  }

References error().

Referenced by LCE_Selection_base::changeLocalOptima(), LCE_PhenotypeExpression::execute(), TTNeutralGenesSH::setAlleleTables(), and LCE_Disperse_base::setLatticeAbsorbingMatrix().

◆ reset() [1/4]

void TMatrix::reset ( )
inline

Reset members to zero state.

184  {
185  _rows = 0;
186  _cols = 0;
187  _length = 0;
188  if(_val != NULL) delete [] _val;
189  _val = NULL;
190  }

◆ reset() [2/4]

void TMatrix::reset ( unsigned int  rows,
unsigned int  cols 
)
inline

Re-allocate the existing matrix with assigned rows and cols dimensions and all elements to 0.

161  {
162  _length = rows * cols;
163  if(_length == 0) error("TMatrix::attempt to reset a matrix with size = 0!\n");
164  if(_val != NULL) delete [] _val;
165  _val = new double [_length];
166  memset(_val, 0, _length*sizeof(double));
167  _rows = rows; _cols = cols;
168  }

References error().

Referenced by LCE_Disperse_base::allocateDispMatrix(), TTNeutralGenesSH::allocateTables(), Param::parse_matrix(), LCE_PhenotypeExpression::set_env_cue(), LCE_PhenotypeExpression::set_g_value_matrix(), TProtoQuanti::set_init_values(), LCE_Selection_base::set_local_optima(), LCE_Patch_Extinction::set_matrix_param(), FileHandler::set_OccMatrix(), LCE_Selection_base::set_param_rate_of_change(), LCE_Selection_base::set_std_rate_of_change(), TProtoQuanti::setContinuousMutationModel_full_pleio(), TProtoQuanti::setContinuousMutationModel_var_pleio(), TProtoQuanti::setDiallelicMutationModel(), TProtoQuanti::setDominanceParameters(), TProtoQuanti::setEpistasisParameters(), LCE_Breed_base::setFecundity(), TTNeutralGenesSH::setFstMatrix(), LCE_Disperse_base::setIndentityDispMatrix(), TProtoQuanti::setInitialValuesParams(), TProtoQuanti::setMutationCorrelation(), TProtoQuanti::setMutationModel_no_pleio(), TProtoQuanti::setMutationSigmaFromQuantiMutationVariance(), TProtoQuanti::setMutationSigmaFromQuantiMutationVariance_no_pleio(), TTNeutralGenesSH::setNeiGeneticDistance(), LCE_Breed_Disperse::setParameters(), LCE_PhenotypeExpression::setParameters(), LCE_QuantiModifier::setParameters(), TProtoBDMI::setParameters(), LCE_Init_BDMI::setParameters(), Metapop::setPatchCapacities(), LCE_Selection_base::setSelectionMatrix(), setSpatialMatrix(), and LCE_Resize::updateParameters().

◆ reset() [3/4]

void TMatrix::reset ( unsigned int  rows,
unsigned int  cols,
const double *  array 
)
inline

Reset the existing matrix to the new dimensions and copies the array, which has to be of the same total length.

177  {
178  reset(rows, cols);
179  memcpy(_val, array, _length * sizeof(double));
180  }
void reset()
Reset members to zero state.
Definition: tmatrix.h:183

◆ reset() [4/4]

void TMatrix::reset ( unsigned int  rows,
unsigned int  cols,
double  value 
)
inline

Reset the existing matrix to the new dimensions and copies the value to all elements.

171  {
172  reset(rows, cols);
173  assign(value);
174  }
void assign(double val)
Assigns a value to all element of the matrix.
Definition: tmatrix.h:155

◆ rowSum()

double TMatrix::rowSum ( unsigned int  row)
inline

Sum all elements in a row.

319  {
320  assert(row < _rows); // has to be [0, _rows-1]
321  double sum = 0;
322  for (unsigned int i = 0; i < _cols; ++i) {
323  sum += _val[row*_cols + i];
324  }
325  return sum;
326  }

Referenced by LCE_Disperse_base::setLatticeReflectingMatrix(), and TProtoQuanti::setMutationModel_no_pleio().

◆ set()

◆ set_col() [1/2]

void TMatrix::set_col ( unsigned int  i,
double  val 
)
inline

Sets element at column i to value val.

133  {
134  if( i < _cols)
135  for(unsigned int j = 0; j < _rows; ++j)
136  _val[j*_cols + i] = val;
137  else
138  error("TMatrix::set_col overflow, i > num cols!\n");
139  }

References error().

Referenced by TProtoQuanti::setDiallelicMutationModel().

◆ set_col() [2/2]

void TMatrix::set_col ( unsigned int  i,
vector< double >  vec 
)
inline

Sets element at column i to values stored in vector vec.

142  {
143 
144  if(vec.size() < _rows)
145  fatal("TMatrix::set_col copy from vector too small to fit\n");
146 
147  if( i < _cols)
148  for(unsigned int j = 0; j < _rows; ++j)
149  _val[j*_cols + i] = vec[j];
150  else
151  error("TMatrix::set_col overflow, i > num cols!\n");
152  }

References error(), and fatal().

◆ set_row() [1/2]

void TMatrix::set_row ( unsigned int  i,
double  val 
)
inline

Sets all elements at row i to value val.

111  {
112  if( i < _rows)
113  for(unsigned int j = 0, stride = i*_cols; j < _cols; ++j)
114  _val[stride + j] = val;
115  else
116  error("TMatrix::set_row overflow, i > num rows!\n");
117  }

References error().

Referenced by TProtoQuanti::setMutationSigmaFromQuantiMutationVariance().

◆ set_row() [2/2]

void TMatrix::set_row ( unsigned int  i,
vector< double >  vec 
)
inline

Sets elements at row i to values stored in vector vec.

120  {
121 
122  if(vec.size() < _cols)
123  fatal("TMatrix::set_row copy from vector too small to fit\n");
124 
125  if( i < _rows)
126  for(unsigned int j = 0, stride = i*_cols; j < _cols; ++j)
127  _val[stride + j] = vec[j];
128  else
129  error("TMatrix::set_row overflow, i > num rows!\n");
130  }

References error(), and fatal().

◆ show_up()

void TMatrix::show_up ( )
inline
329  {
330  message("TMatrix dimensions: \nrows = %i, columns = %i, length = %i\n",_rows,_cols, _length);
331  for(unsigned int i = 0; i < _rows; i++) {
332  for(unsigned int j = 0; j < _cols; j++)
333  message("%.3f ",_val[i*_cols + j]);
334  message("\n");
335  }
336  }
void message(const char *message,...)
Definition: output.cc:40

References message().

Referenced by TProtoQuanti::setContinuousMutationModel_full_pleio(), TProtoQuanti::setMutationSigmaFromQuantiMutationVariance(), TProtoQuanti::setMutationSigmaFromQuantiMutationVariance_no_pleio(), LCE_Disperse_base::setReducedDispMatrix(), and Metapop::show_up().

◆ to_string()

string TMatrix::to_string ( )
inline

Writes the matrix into a string in Nemo's matrix input format.

339  {
340  ostringstream OUT;
341 
342  OUT << "{";
343  for(unsigned int i = 0; i < _rows; i++) {
344  OUT<<"{";
345  for(unsigned int j = 0; j < _cols-1; j++) {
346  OUT<<_val[i*_cols + j]<<",";
347  }
348  OUT<<_val[i*_cols + _cols-1]<<"}";
349  }
350  OUT << "}";
351 
352  return OUT.str();
353  }

Referenced by LCE_Selection_base::set_std_rate_of_change(), and ParamsParser::sym_matrix().

◆ transpose()

void TMatrix::transpose ( )
inline

Transpose the matrix, swaps columns for rows.

298  {
299  TMatrix tmp(_cols, _rows);
300 
301  for(unsigned int i = 0; i < _rows; i++)
302  for(unsigned int j = 0; j < _cols; j++)
303  tmp.set(j, i, get(i, j));
304 
305  reset(_cols, _rows, tmp.get());
306  }
A class to handle matrix in params, coerces matrix into a vector of same total size.
Definition: tmatrix.h:50
double * get() const
Accessor to the whole array.
Definition: tmatrix.h:201

References get(), and set().

Referenced by LCE_Disperse_base::setLatticeReflectingMatrix(), and LCE_Disperse_base::setSteppingStone1DMatrix().

Member Data Documentation

◆ _cols

unsigned int TMatrix::_cols
private

Referenced by copy(), and copy_recycle().

◆ _length

unsigned int TMatrix::_length
private

◆ _rows

unsigned int TMatrix::_rows
private

Referenced by copy(), and copy_recycle().

◆ _val

double* TMatrix::_val
private

Referenced by copy(), and copy_recycle().


The documentation for this class was generated from the following file:

Generated for Nemo v2.4.0b by  doxygen 1.9.1 -- Nemo is hosted on  Download Nemo

Locations of visitors to this page
Catalogued on GSR