|
Nemo
2.4.0b
Simulate forward-in-time genetic evolution in a spatially explicit, individual-based stochastic simulator
|
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 |
A class to handle matrix in params, coerces matrix into a vector of same total size.
|
inline |
|
inline |
|
inline |
|
inline |
Assigns a value to all element of the matrix.
Referenced by LCE_Patch_Extinction::set_matrix_param(), LCE_Selection_base::set_param_rate_of_change(), LCE_Selection_base::set_std_rate_of_change(), TTNeutralGenesSH::setAlleleTables(), LCE_Disperse_base::setBasicLatticeMatrix(), TProtoQuanti::setDominanceParameters(), TTNeutralGenesSH::setFstMatrix(), LCE_Disperse_base::setIndentityDispMatrix(), TProtoQuanti::setMutationCorrelation(), TProtoQuanti::setMutationModel_no_pleio(), TTNeutralGenesSH::setNeiGeneticDistance(), LCE_Selection_base::setSelectionMatrix(), and LCE_Disperse_base::setSteppingStone1DMatrix().
|
inline |
|
inline |
Copy a matrix.
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().
|
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.
References _cols, _rows, _val, and error().
Referenced by TProtoQuanti::setDominanceParameters(), TProtoQuanti::setEpistasisParameters(), TProtoQuanti::setMutationCorrelation(), TProtoQuanti::setMutationSigmaFromQuantiMutationVariance_no_pleio(), and TProtoBDMI::setParameters().
|
inline |
|
inline |
Accessor to the whole array.
|
inline |
Accessor to element at row i and column j.
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().
|
inline |
|
inline |
Gives access to a column of the matrix.
| col | index of col to view |
| n | size of the storing array passed, must be equal to no. of rows |
| array | array where the column values will be stored |
References error().
|
inline |
Gives the number of columns.
Referenced by LCE_Resize::buildNewPatchArrayNoBackup(), LCE_Resize::buildNewPatchArrayWithBackup(), LCE_Disperse_base::checkBackwardDispersalMatrix(), LCE_Disperse_base::checkForwardDispersalMatrix(), LCE_Resize::execute(), TTNeutralGenesSH::getCoa(), TTNeutralGenesSH::getFst_ij(), TTNeutralGenesSH::getNeiGeneticDistance(), LCE_Resize::removeDesignatedPatch(), LCE_Patch_Extinction::set_matrix_param(), LCE_Selection_base::set_sel_model(), TProtoDeletMutations_bitstring::setEffectsFromInput(), TTProtoWithMap::setGeneticMapParameters(), TProtoQuanti::setMutationModel_var_pleio(), TTProtoWithMap::setNumLociPerChromosome(), LCE_Breed_Disperse::setParameters(), LCE_Resize::setParameters(), LCE_Init_BDMI::setPatchFreq(), LCE_Selection_base::setSelectionMatrix(), setSpatialMatrix(), LCE_Init_BDMI::setSpatialPattern(), LCE_Resize::updateParameters(), and LCE_Resize::updatePatchCapacities().
|
inline |
Gives the number of rows.
Referenced by LCE_Disperse_base::checkBackwardDispersalMatrix(), LCE_Disperse_base::checkForwardDispersalMatrix(), TTDispersal::init_sequence(), LCE_Patch_Extinction::set_matrix_param(), TProtoDeletMutations_bitstring::setEffectsFromInput(), TTProtoWithMap::setGeneticMapParameters(), TProtoQuanti::setMutationModel_var_pleio(), TTProtoWithMap::setNumLociPerChromosome(), LCE_Init_BDMI::setPatchFreq(), LCE_Selection_base::setSelectionMatrix(), setSpatialMatrix(), and LCE_Init_BDMI::setSpatialPattern().
|
inline |
Gives access to a row of the matrix.
| row | index of row to view |
| n | size of the storing array passed, must be equal to no. of columns |
| array | array where the row values will be stored |
References error().
Referenced by LCE_QuantiInit::execute(), LCE_Init_BDMI::execute(), and LCE_NtrlInit::execute().
|
inline |
Referenced by FileHandler::set_OccMatrix().
|
inline |
Returns the number of elements in the matrix.
Referenced by LCE_PhenotypeExpression::check_g_index_matrix(), 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(), TTQuantiSH::setDataTables(), TProtoQuanti::setEpistasisParameters(), TTNeutralGenesSH::setFstMatrix(), TTNeutralGenesSH::setNeiGeneticDistance(), LCE_PhenotypeExpression::setParameters(), and Metapop::setPatchCapacities().
|
inline |
Adds a value to all elements in a matrix.
|
inline |
|
inline |
|
inline |
Referenced by LCE_QuantiModifier::execute(), LCE_Breed_Quanti::execute(), LCE_Breed_base::NonWrightFisherPopulation(), LCE_PhenotypeExpression::set_g_value_matrix(), 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(), TProtoQuanti::setHeritabilityParams(), TProtoQuanti::setInitialValuesParams(), TProtoQuanti::setMutationCorrelation(), TProtoQuanti::setMutationModel_no_pleio(), TProtoQuanti::setMutationModel_var_pleio(), TProtoQuanti::setMutationSigmaFromQuantiMutationVariance(), TProtoQuanti::setMutationSigmaFromQuantiMutationVariance_no_pleio(), LCE_StatServiceNotifier::setOccurence(), TProtoBDMI::setParameters(), LCE_Init_BDMI::setParameters(), LCE_Breed_Wolbachia::setParameters(), and LCE_Selection_base::setSelectionMatrix().
|
inline |
Referenced by LCE_Selection_base::changeLocalOptima(), TTNOhtaStats::FHwrite(), TTQOhtaStats::FHwrite(), TProtoQuanti::get_trait_mutation_variance(), LCE_PhenotypeExpression::set_g_value_matrix(), 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_no_pleio(), TProtoQuanti::setContinuousMutationModel_var_pleio(), TProtoQuanti::setDiallelicMutationModel(), TProtoQuanti::setDominanceParameters(), TProtoQuanti::setEpistasisParameters(), LCE_Breed_base::setFecundity(), TProtoQuanti::setHeritabilityParams(), TProtoQuanti::setInitialValuesParams(), TProtoQuanti::setMutationCorrelation(), TProtoQuanti::setMutationModel_no_pleio(), TProtoQuanti::setMutationModel_var_pleio(), TProtoQuanti::setMutationSigmaFromQuantiMutationVariance(), TProtoQuanti::setMutationSigmaFromQuantiMutationVariance_no_pleio(), LCE_StatServiceNotifier::setOccurence(), LCE_QuantiModifier::setParameters(), TProtoBDMI::setParameters(), LCE_Init_BDMI::setParameters(), and LCE_Breed_Wolbachia::setParameters().
|
inline |
Adds a value to an element of the matrix.
References error().
Referenced by LCE_Selection_base::changeLocalOptima(), LCE_PhenotypeExpression::execute(), TTNeutralGenesSH::setAlleleTables(), and LCE_Disperse_base::setLatticeAbsorbingMatrix().
|
inline |
|
inline |
Re-allocate the existing matrix with assigned rows and cols dimensions and all elements to 0.
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().
|
inline |
Reset the existing matrix to the new dimensions and copies the array, which has to be of the same total length.
|
inline |
Reset the existing matrix to the new dimensions and copies the value to all elements.
|
inline |
Sum all elements in a row.
Referenced by LCE_Disperse_base::setLatticeReflectingMatrix(), and TProtoQuanti::setMutationModel_no_pleio().
|
inline |
Sets element at row i and column j to value val.
References error().
Referenced by LCE_Breed_Disperse::exponentialGrowth(), Param::parse_matrix(), LCE_Selection_base::set_param_rate_of_change(), LCE_Selection_base::set_std_rate_of_change(), LCE_Disperse_base::setBasicLatticeMatrix(), TProtoQuanti::setContinuousMutationModel_full_pleio(), TProtoQuanti::setContinuousMutationModel_var_pleio(), TProtoQuanti::setDiallelicMutationModel(), LCE_Breed_base::setFecundity(), TTNeutralGenesSH::setFstMatrix(), TProtoBDMI::setGenoFitnessValue(), LCE_Disperse_base::setIndentityDispMatrix(), LCE_Disperse_base::setIsland_MigrantPool_Matrix(), LCE_Disperse_base::setIsland_PropagulePool_Matrix(), LCE_Disperse_base::setLatticeAbsorbingMatrix(), LCE_Disperse_base::setLatticeReflectingMatrix(), LCE_Disperse_base::setLatticeTorrusMatrix(), TProtoQuanti::setMutationSigmaFromQuantiMutationVariance_no_pleio(), TTNeutralGenesSH::setNeiGeneticDistance(), TProtoBDMI::setParameters(), Metapop::setPatchCapacities(), LCE_Init_BDMI::setPatchFreq(), LCE_Selection_base::setSelectionMatrix(), setSpatialMatrix(), LCE_Init_BDMI::setSpatialPattern(), LCE_Disperse_base::setSteppingStone1DMatrix(), ParamsParser::sym_matrix(), and transpose().
|
inline |
|
inline |
Sets element at column i to values stored in vector vec.
|
inline |
Sets all elements at row i to value val.
References error().
Referenced by TProtoQuanti::setMutationSigmaFromQuantiMutationVariance().
|
inline |
Sets elements at row i to values stored in vector vec.
|
inline |
|
inline |
Writes the matrix into a string in Nemo's matrix input format.
Referenced by LCE_Selection_base::set_std_rate_of_change(), and ParamsParser::sym_matrix().
|
inline |
Transpose the matrix, swaps columns for rows.
Referenced by LCE_Disperse_base::setLatticeReflectingMatrix(), and LCE_Disperse_base::setSteppingStone1DMatrix().
|
private |
Referenced by copy(), and copy_recycle().
|
private |
|
private |
Referenced by copy(), and copy_recycle().
|
private |
Referenced by copy(), and copy_recycle().
1.9.1 -- Nemo is hosted on