MuGen
Multitrait genetics
Public Member Functions | Protected Attributes | List of all members
SigmaIblk Class Reference

Block-diagonal inverse-covariance. More...

#include <MuGen.h>

Inheritance diagram for SigmaIblk:
[legend]
Collaboration diagram for SigmaIblk:
[legend]

Public Member Functions

 SigmaIblk ()
 Default constructor.
 
 SigmaIblk (const size_t &d, const double &invVar, const double &df, const string &blkIndFileNam)
 Deterministic diagonal matrix constructor. More...
 
 SigmaIblk (const size_t &d, const double &invVar, const double &df, const string &blkIndFileNam, const string &outFlNam)
 Deterministic diagonal matrix constructor with output file. More...
 
 SigmaIblk (const Grp &dat, const string &blkIndFileNam, const double &prDiag, const double &nu0)
 Location data-based constructor. More...
 
 SigmaIblk (const Grp &dat, const string &blkIndFileNam, const string &outFlNam, const double &prDiag, const double &nu0)
 Location data-based constructor with output file. More...
 
 ~SigmaIblk ()
 Destructor.
 
void update (const Grp &dat)
 Basic Gaussian update. More...
 
void update (const Grp &dat, const Grp &mu)
 Gaussian update with a mean. More...
 
- Public Member Functions inherited from SigmaI
 SigmaI ()
 Default constructor. More...
 
 SigmaI (const size_t &d, const double &invVar)
 Deterministic diagonal matrix constructor. More...
 
 SigmaI (const size_t &d, const double &invVar, const double &df)
 Deterministic diagonal matrix constructor. More...
 
 SigmaI (const size_t &d, const double &invVar, const double &df, const string &outFlNam)
 Deterministic diagonal matrix constructor with output file name. More...
 
 SigmaI (const gsl_matrix *mat)
 Deterministic matrix constructor. More...
 
 SigmaI (const gsl_matrix *S, const size_t &d, const size_t &df, const gsl_matrix *LamPr, const double &nu0)
 Constructor with a matrix prior. More...
 
 SigmaI (const gsl_matrix *S, const size_t &d, const size_t &df, const double &diagPr, const double &nu0)
 Constructor with a diagonal prior. More...
 
 SigmaI (const Grp &dat, const double &prDiag, const double &nu0)
 Location data-based constructor. More...
 
 SigmaI (const Grp &dat, const string &outFlNam, const double &prDiag, const double &nu0)
 Location data-based constructor with output file name. More...
 
 SigmaI (const SigmaI &)
 Copy constructor. More...
 
SigmaIoperator= (const SigmaI &)
 Assignment operator. More...
 
virtual ~SigmaI ()
 Destructor.
 
virtual void update (const Grp &dat, const Qgrp &q)
 Basic Student- \(t\) update. More...
 
virtual void update (const Grp &dat, const Grp &mu, const Qgrp &q)
 Student- \(t\) update with a mean. More...
 
virtual void save (const char *how="a")
 Save to a stored file name. More...
 
virtual void save (const string &fileNam, const char *how="a")
 Save to a given file name. More...
 
void save (const string &fileNam, const Apex &A, const char *how="a")
 Save adjusted matrix. More...
 
void save (FILE *fileStr)
 Save to file stream. More...
 
string getOutFile () const
 Access the output file. More...
 
const gsl_matrix * getMat () const
 Access to the inverse-covariance matrix. More...
 
void srDetUpdate ()
 Update square-root of the determinant.
 
double getSrDet () const
 Access the square-root of the determinant. More...
 

Protected Attributes

vector< size_t > _blkStart
 Block start indexes. More...
 
vector< gsl_matrix_view > _eachBlk
 Inverse-covariance matrix submatrices. More...
 
vector< gsl_matrix_view > _eachLS
 Prior matrix submatrices. More...
 
- Protected Attributes inherited from SigmaI
gsl_matrix * _mat
 Inverse-covariance matrix. More...
 
size_t _d
 Dimension of the matrix. More...
 
double _srDet
 Square root of the determinant. More...
 
gsl_matrix * _LamSc
 Prior inverse-covariance. More...
 
double _n0
 Prior degrees of freedom.
 
string _outFlNam
 Output file name.
 
gsl_rng * _r
 Pseudo-random number generator. More...
 

Detailed Description

Block-diagonal inverse-covariance.

Implements block-diagonal inverse-covariance, to go with MuBlk and BetaBlk classes. All covariances among blocks are set to exactly zero and are never modified. All sampling is done block by block.

Constructor & Destructor Documentation

◆ SigmaIblk() [1/4]

SigmaIblk::SigmaIblk ( const size_t &  d,
const double &  invVar,
const double &  df,
const string &  blkIndFileNam 
)

Deterministic diagonal matrix constructor.

Creates a diagonal matrix with the provided inverse-variance and degrees of freedom parameter.

Parameters
[in]size_t&number of rows and columns
[in]double&inverse variance
[in]double&degrees of freedom
[in]string&name of the file storing block indexes

◆ SigmaIblk() [2/4]

SigmaIblk::SigmaIblk ( const size_t &  d,
const double &  invVar,
const double &  df,
const string &  blkIndFileNam,
const string &  outFlNam 
)

Deterministic diagonal matrix constructor with output file.

Creates a diagonal matrix with the provided inverse-variance and degrees of freedom parameter.

Parameters
[in]size_t&number of rows and columns
[in]double&inverse variance
[in]double&degrees of freedom
[in]string&name of the file storing block indexes
[in]string&output file name

◆ SigmaIblk() [3/4]

SigmaIblk::SigmaIblk ( const Grp dat,
const string &  blkIndFileNam,
const double &  prDiag,
const double &  nu0 
)

Location data-based constructor.

Initializes the object with an inverse-covariance of the provided location data. The dimension of the object os equal to the number of columns in the data.

Parameters
[in]Grp&data
[in]string&name of the file storing block indexes
[in]double&prior inverse-variance
[in]double&prior degrees of freedom

◆ SigmaIblk() [4/4]

SigmaIblk::SigmaIblk ( const Grp dat,
const string &  blkIndFileNam,
const string &  outFlNam,
const double &  prDiag,
const double &  nu0 
)

Location data-based constructor with output file.

Initializes the object with an inverse-covariance of the provided location data. The dimension of the object os equal to the number of columns in the data.

Parameters
[in]Grp&data
[in]string&name of the file storing block indexes
[in]string&output file name
[in]double&prior inverse-variance
[in]double&prior degrees of freedom

Member Function Documentation

◆ update() [1/2]

void SigmaIblk::update ( const Grp dat)
virtual

Basic Gaussian update.

The data are assumed already centered, so the update is based on the simple cross-product of the data.

Parameters
[in]Grp&data

Reimplemented from SigmaI.

◆ update() [2/2]

void SigmaIblk::update ( const Grp dat,
const Grp mu 
)
virtual

Gaussian update with a mean.

The mean value is subtracted from the data according to the up-pointing RanIndex in the data object.

Parameters
[in]Grp&data
[in]Grp&mean

Reimplemented from SigmaI.

Member Data Documentation

◆ _blkStart

vector< size_t > SigmaIblk::_blkStart
protected

Block start indexes.

Vector of indexes that indicate the column that starts each block.

◆ _eachBlk

vector< gsl_matrix_view > SigmaIblk::_eachBlk
protected

Inverse-covariance matrix submatrices.

Vector of submatrices of the current sample of the inverse-covariance matrix (_mat). Is the same length as the number of blocks.

◆ _eachLS

vector< gsl_matrix_view > SigmaIblk::_eachLS
protected

Prior matrix submatrices.

Vector of submatrices of the prior inverse-covariance matrix (_LamSc). Is the same length as the number of blocks.


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