src/fisher.cpp
// Extracts the inverted covariance matrix for a given branch from the full covariance matrix.
Extracts the inverted covariance matrix for a given branch from the full covariance matrix.
Extracts the inverted covariance matrix for a given branch from the full covariance matrix .
void branch_inverted_covariance_matrix(Model &Mod, Array2 &Covfull, long b, Array2 &Covbri) {
  long i,j;
  ublas::matrix<double> CC(Mod.df, Mod.df);
  ublas::matrix<double> II(Mod.df, Mod.df);
  for(i=0; i < Mod.df; i++) {
    for(j=0; j< Mod.df; j++) {
      CC(i,j) = Covfull[Mod.df*b + i][Mod.df*b + j];
    }
  }
  bool res = matrix_inverse(CC, II);
  if (!res) {
    throw std::out_of_range( "Could not invert the Covariance matrix." );
  }
  Covbri.resize(Mod.df);
  for(i=0; i < Mod.df; i++) {
    Covbri[i].resize(Mod.df);
    for(j=0; j< Mod.df; j++) {
      Covbri[i][j] = II(i,j);
    }
  }
}
void branch_inverted_covariance_matrix ( Model & Mod , Array2 & Covfull , long b , Array2 & Covbri ) { long i , j ; ublas :: matrix < double > CC ( Mod . df , Mod . df ) ; ublas :: matrix < double > II ( Mod . df , Mod . df ) ; for ( i = 0 ; i < Mod . df ; i ++ ) { for ( j = 0 ; j < Mod . df ; j ++ ) { CC ( i , j ) = Covfull [ Mod . df * b + i ] [ Mod . df * b + j ] ; } } bool res = matrix_inverse ( CC , II ) ; if ( ! res ) { throw std :: out_of_range ( " " ) ; } Covbri . resize ( Mod . df ) ; for ( i = 0 ; i < Mod . df ; i ++ ) { Covbri [ i ] . resize ( Mod . df ) ; for ( j = 0 ; j < Mod . df ; j ++ ) { Covbri [ i ] [ j ] = II ( i , j ) ; } } }
Extracts the inverted covariance matrix for a given branch from the full covariance matrix.
Extracts the inverted covariance matrix for a given branch from the full covariance matrix .