MuGen
Multitrait genetics
Functions
Arithmetic operators

Functions

MuGrp operator+ (const Grp &m1, const Grp &m2)
 Addition operator. More...
 
MuGrp operator+ (const MuGrp &m1, const Grp &m2)
 Addition operator. More...
 
MuGrp operator+ (const Grp &m1, const MuGrp &m2)
 Addition operator. More...
 
MuGrp operator- (const Grp &m1, const Grp &m2)
 Subtraction operator. More...
 
MuGrp operator- (const MuGrp &m1, const Grp &m2)
 Subtraction operator. More...
 
MuGrp operator- (const Grp &m1, const MuGrp &m2)
 Subtraction operator. More...
 

Detailed Description

Arithmetic operators for Grp type location parameters. The matrices addressed by the fMat() member functions are added. These are essential to build Gibbs samplers with multiple parameters at the same level of hierarchy, such as variable-intercept regressions [gelman07] . However, care must be taken because only certain combinations of objects are compatible. These are

  1. fMat() matrices have the same number of rows. In this case, they are simply added or subtracted as is.
  2. One of the matrices is a single-row matrix. In this case, the row is added to each row of the bigger matrix (or subtracted in the appropriate direction). The resulting MuGrp object will have the same size value matrix as the bigger fMat().
  3. The RanIndex to the lower level of the Grp (or MuGrp) object with the smaller fMat() points to the same number of rows as in the fMat() of the larger object. In this case, the RanIndex is used to relate the rows of the larger matrix to those of the smaller matrix, the rows of the smaller matrix are re-used as necessary. The resulting MuGrp object has a value matrix of the same size as the larger fMat().
  4. None of the above apply, but the RanIndex to the lower level of each object points to the same number of rows. In this case, a MuGrp object with a value matrix with that number of rows is created, and the addition/subtraction is performed with rows corresponing to the same lower level of the RanIndex.

In all other cases, an error is issued and execution is aborted. The number of traits (columns) has to always be the same. Addition is commutative, subtraction is anti-commutative.

Function Documentation

◆ operator+() [1/3]

MuGrp operator+ ( const Grp m1,
const Grp m2 
)

Addition operator.

Parameters
[in]Grp&first summand
[in]Grp&second summand
Returns
MuGrp object that is the sum of the two input objects

◆ operator+() [2/3]

MuGrp operator+ ( const Grp m1,
const MuGrp m2 
)

Addition operator.

Parameters
[in]Grp&first summand
[in]MuGrp&second summand
Returns
MuGrp object that is the sum of the two input objects

◆ operator+() [3/3]

MuGrp operator+ ( const MuGrp m1,
const Grp m2 
)

Addition operator.

Parameters
[in]MuGrp&first summand
[in]Grp&second summand
Returns
MuGrp object that is the sum of the two input objects

◆ operator-() [1/3]

MuGrp operator- ( const Grp m1,
const Grp m2 
)

Subtraction operator.

Parameters
[in]Grp&minuend
[in]Grp&subtrahend
Returns
MuGrp object that is the difference between the two input objects

◆ operator-() [2/3]

MuGrp operator- ( const Grp m1,
const MuGrp m2 
)

Subtraction operator.

Parameters
[in]Grp&minuend
[in]MuGrp&subtrahend
Returns
MuGrp object that is the difference between the two input objects

◆ operator-() [3/3]

MuGrp operator- ( const MuGrp m1,
const Grp m2 
)

Subtraction operator.

Parameters
[in]MuGrp&minuend
[in]Grp&subtrahend
Returns
MuGrp object that is the difference between the two input objects