MuGen
Multitrait genetics
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MVnorm Class Referenceabstract

The abstract base class for location parameter rows. More...

#include <MuGen.h>

Inheritance diagram for MVnorm:
[legend]

Public Member Functions

 MVnorm (const MVnorm &)
 Copy constructor. More...
 
MVnormoperator= (const MVnorm &)
 Assignement operator. More...
 
virtual ~MVnorm ()
 Virtual destructor. More...
 
virtual void update (const Grp &, const SigmaI &, const gsl_rng *)=0
 Gaussian likelihood. More...
 
virtual void update (const Grp &, const Qgrp &, const SigmaI &, const gsl_rng *)=0
 Sudent- \(t\) likelihood. More...
 
virtual void update (const Grp &, const SigmaI &, const SigmaI &, const gsl_rng *)=0
 Gaussian likelihood, Gaussian prior. More...
 
virtual void update (const Grp &, const SigmaI &, const double &, const SigmaI &, const gsl_rng *)=0
 Gaussian likelihood, Student- \(t\) prior. More...
 
virtual void update (const Grp &, const Qgrp &, const SigmaI &, const SigmaI &, const gsl_rng *)=0
 Student- \(t\) likelihood, Gaussian prior. More...
 
virtual void update (const Grp &, const Qgrp &, const SigmaI &, const double &, const SigmaI &, const gsl_rng *)=0
 Student- \(t\) likelihood, Student- \(t\) prior. More...
 
virtual void update (const Grp &, const SigmaI &, const Grp &, const SigmaI &, const gsl_rng *)=0
 Gaussian likelihood, Gaussian prior. More...
 
virtual void update (const Grp &, const SigmaI &, const Grp &, const double &, const SigmaI &, const gsl_rng *)=0
 Gaussian likelihood, Student- \(t\) prior. More...
 
virtual void update (const Grp &, const Qgrp &, const SigmaI &, const Grp &, const SigmaI &, const gsl_rng *)=0
 Student- \(t\) likelihood, Gaussian prior. More...
 
virtual void update (const Grp &, const Qgrp &, const SigmaI &, const Grp &, const double &, const SigmaI &, const gsl_rng *)=0
 Student- \(t\) likelihood, Student- \(t\) prior. More...
 
virtual double mhl (const MVnorm *x, const SigmaI &SigI)
 Mahalanobis distance to a vector. More...
 
virtual double mhl (const MVnorm *x, const SigmaI &SigI) const
 Mahalanobis distance to a vector. More...
 
virtual double mhl (const gsl_vector *x, const SigmaI &SigI)
 Mahalanobis distance to a vector. More...
 
virtual double mhl (const gsl_vector *x, const SigmaI &SigI) const
 Mahalanobis distance to a vector. More...
 
virtual double mhl (const SigmaI &SigI)
 Mahalanobis distance to zero. More...
 
virtual double mhl (const SigmaI &SigI) const
 Mahalanobis distance to zero. More...
 
double density (const gsl_vector *theta, const SigmaI &SigI)
 Multivariate Gaussian density. More...
 
double density (const gsl_vector *theta, const SigmaI &SigI) const
 Multivariate Gaussian density. More...
 
double density (const MVnorm *theta, const SigmaI &SigI)
 Multivariate Gaussian density. More...
 
double density (const MVnorm *theta, const SigmaI &SigI) const
 Multivariate Gaussian density. More...
 
void save (const string &fileNam, const char *how="a")
 Save function. More...
 
void save (FILE *fileStr)
 Save function. More...
 
double operator[] (const size_t i) const
 Subscript operator. More...
 
void valSet (const size_t i, const double x)
 Setting an element to a value. More...
 
const gsl_vector * getVec () const
 Access the location vector. More...
 
size_t len () const
 Length of the location vector. More...
 
virtual size_t nMissP () const
 Number of missing values. More...
 
virtual const vector< size_t > getMisPhen () const
 Indexes of missing values. More...
 
virtual const vector< size_t > * down () const
 Points to the corresponding data. More...
 
virtual const size_t * up () const
 Points to the prior. More...
 
virtual double scalePar () const
 Scale parameter. More...
 

Protected Member Functions

 MVnorm ()
 Default constructor. More...
 
 MVnorm (const size_t &d)
 Dimension-only constructor. More...
 
 MVnorm (gsl_vector *mn)
 Dimension and vector value constructor. More...
 
 MVnorm (gsl_vector *mn, const gsl_vector *sd, const gsl_rng *r)
 Univariate Gaussian constructor. More...
 
 MVnorm (gsl_vector *mn, const gsl_matrix *Sig, const gsl_rng *r)
 Multivariate Gaussian constructor. More...
 
 MVnorm (gsl_matrix *mn, const size_t &iRw)
 Dimension and vector value constructor. More...
 
 MVnorm (gsl_matrix *mn, const size_t &iRw, const gsl_vector *sd, const gsl_rng *r)
 Univariate Gaussian constructor with a matrix. More...
 
 MVnorm (gsl_matrix *mn, const size_t &iRw, const gsl_matrix *Sig, const gsl_rng *r)
 Multivariate Gaussian constructor with a matrix. More...
 

Protected Attributes

gsl_vector_view _vec
 Data vector. More...
 
size_t _d
 Length of the data vector.
 

Detailed Description

The abstract base class for location parameter rows.

This is the generic location parameter class and cannot be envoked directly. All the constructors are protected.

Constructor & Destructor Documentation

◆ MVnorm() [1/9]

MVnorm::MVnorm ( )
inlineprotected

Default constructor.

This is a deterministic constructor that results in a pointer to nowhere and the dimension member set to zero.

◆ MVnorm() [2/9]

MVnorm::MVnorm ( const size_t &  d)
inlineprotected

Dimension-only constructor.

Sets the dimension to a value, but the vector_view is not assigned a target.

Parameters
[in]size_t&dimension value

◆ MVnorm() [3/9]

MVnorm::MVnorm ( gsl_vector *  mn)
protected

Dimension and vector value constructor.

A deterministic constructor that sets the _vec member to point to the provided gsl_vector and the dimension member to the size of the provided gsl_vector.

Parameters
[in]gsl_vector*target vector

◆ MVnorm() [4/9]

MVnorm::MVnorm ( gsl_vector *  mn,
const gsl_vector *  sd,
const gsl_rng *  r 
)
protected

Univariate Gaussian constructor.

Sets the _vec member to point to the provided gsl_vector and ads univariate Gaussian noise independtly to each element, modifying the target.

Parameters
[in,out]gsl_vector*vector of means
[in]gsl_vector*vector of standard deviations for the univariate Gaussian, has to be no shorter than the mean vector. If it is longer, the extra values are ignored.
[in]gsl_rng*pointer to a PNG

◆ MVnorm() [5/9]

MVnorm::MVnorm ( gsl_vector *  mn,
const gsl_matrix *  Sig,
const gsl_rng *  r 
)
protected

Multivariate Gaussian constructor.

Sets the _vec member to point to the provided gsl_vector and ads multivariate Gaussian noise, modifying the target.

Parameters
[in,out]gsl_vector*vector of means
[in]gsl_matrix*covariance matrix for the multivariate Gaussian, has to match the mean vector in dimensions and has to be symmetric positive-definite
[in]gsl_rng*pointer to a PNG

◆ MVnorm() [6/9]

MVnorm::MVnorm ( gsl_matrix *  mn,
const size_t &  iRw 
)
protected

Dimension and vector value constructor.

A deterministic constructor that sets the _vec member to point to a row (indicated by the row index) of the provided gsl_matrix and the dimension member to the number of columns in the provided gsl_matrix.

Parameters
[in]gsl_matrix*target matrix
[in]size_t&row index of the matrix

◆ MVnorm() [7/9]

MVnorm::MVnorm ( gsl_matrix *  mn,
const size_t &  iRw,
const gsl_vector *  sd,
const gsl_rng *  r 
)
protected

Univariate Gaussian constructor with a matrix.

Sets the _vec member to point to a row (indicated by the row index) of the provided gsl_matrix and ads univariate Gaussian noise independtly to each element, modifying the target.

Parameters
[in,out]gsl_matrix*target matrix
[in]size_t&row index of the target matrix
[in]gsl_vector*vector of standard deviations for the univariate Gaussian, has to be no shorter than a row of the mean matrix. If it is longer, the extra values are ignored.
[in]gsl_rng*pointer to a PNG

◆ MVnorm() [8/9]

MVnorm::MVnorm ( gsl_matrix *  mn,
const size_t &  iRw,
const gsl_matrix *  Sig,
const gsl_rng *  r 
)
protected

Multivariate Gaussian constructor with a matrix.

Sets the _vec member to point to a row (indicated by the row index) of the provided gsl_matrix and ads multivariate Gaussian noise, modifying the target.

Parameters
[in,out]gsl_matrix*target matrix
[in]size_t&row index of the target matrix
[in]gsl_matrix*covariance matrix for the multivariate Gaussian, has to be symmetric positive-definite, with diemsions equal to the number of columns in the target matrix
[in]gsl_rng*pointer to a PNG

◆ MVnorm() [9/9]

MVnorm::MVnorm ( const MVnorm mu)

Copy constructor.

Provided for completeness and has not been extensively tested. The constructor is deterministic, i.e. the values are copied exactly, with no stochastic perturbation.

Parameters
[in]MVnorm&object to be copied
Returns
object of class MVnorm.

◆ ~MVnorm()

virtual MVnorm::~MVnorm ( )
inlinevirtual

Virtual destructor.

The destructor has nothing to do since members of this class cannot be de-allocated.

Member Function Documentation

◆ down()

virtual const vector<size_t>* MVnorm::down ( ) const
inlinevirtual

Points to the corresponding data.

Access to the pointer to a vector that indexes the data used to update an instance of the class. Is non-zero only for classes which can be part of a hierarchical model.

Returns
Pointer to a vector of size_t.

Reimplemented in MVnormMu.

◆ getMisPhen()

virtual const vector<size_t> MVnorm::getMisPhen ( ) const
inlinevirtual

Indexes of missing values.

Accesses a vector with indexes of missing phenotypes.

Returns
Vector of size_t that contains indexes that correspond to missing values. For classes that do not allow missing values it is empty.

Reimplemented in MVnormMuMiss, and MVnormMu.

◆ getVec()

const gsl_vector* MVnorm::getVec ( ) const
inline

Access the location vector.

Provides access to the internal parameter vector.

Returns
GSL vector pointing to the corresponding location parameter.

◆ len()

size_t MVnorm::len ( ) const
inline

Length of the location vector.

Returns
Length of the parameter vector, of type size_t. Corresponds to the number of traits.

◆ nMissP()

virtual size_t MVnorm::nMissP ( ) const
inlinevirtual

Number of missing values.

Accesses the number of missing phenotype values. Non-zero only for classes that implement treatment of missing values.

Returns
Number of missing phenotypes, of type size_t.

Reimplemented in MVnormMuMiss, and MVnormMu.

◆ operator=()

MVnorm & MVnorm::operator= ( const MVnorm mu)

Assignement operator.

Provided for completeness and has not been extensively tested. The operator is deterministic, i.e. the values are copied exactly, with no stochastic perturbation.

Parameters
[in]MVnorm&object to be assigned
Returns
reference to an object of class MVnorm.

◆ operator[]()

double MVnorm::operator[] ( const size_t  i) const
inline

Subscript operator.

Overloaded subscript operator for the vector of location parameter values.

Parameters
[in]size_tindex value
Returns
value of the member vector corresponding to the index value, of type double.

◆ save() [1/2]

void MVnorm::save ( const string &  fileNam,
const char *  how = "a" 
)

Save function.

Saves the current value of the location parameter to a file, appending by default.

Parameters
[in]string&file name
[in]char*save mode, "a" for append by default. The allowable values are as for a standard C file stream

◆ save() [2/2]

void MVnorm::save ( FILE *  fileStr)

Save function.

Saves the current value of the location parameter to a file.

Parameters
[in]FILE*C file stream

◆ scalePar()

virtual double MVnorm::scalePar ( ) const
inlinevirtual

Scale parameter.

Access to a scale parameter member, defined only for some derived regression-type classes. If not defined, returns 1.0.

Returns
Scale paramter value of type double.

Reimplemented in MVnormBeta.

◆ up()

virtual const size_t* MVnorm::up ( ) const
inlinevirtual

Points to the prior.

Access to the pointer to the correspoding vector of priors. Is non-zero only for classes where a prior is implemented.

Returns
Pointer to size_t.

Reimplemented in MVnormBetaBlk, MVnormMuBlk, MVnormBeta, and MVnormMu.

◆ valSet()

void MVnorm::valSet ( const size_t  i,
const double  x 
)
inline

Setting an element to a value.

Sets the i-th element of the location vector to a value deterministically

Parameters
[in]size_tindex
[in]doublenew value of the element

Member Data Documentation

◆ _vec

gsl_vector_view MVnorm::_vec
protected

Data vector.

This is actually a pointer (implemented as a GSL vector_view) to a row in the corresponding matrix of location parameters.


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