Skip to content
Permalink
Browse files

v1.1.6

  • Loading branch information...
lindadib committed Apr 28, 2015
1 parent b2d8247 commit f0e3ffc8da2a4468fd6ecc55127232cc4d1d02f5
Showing with 26 additions and 5 deletions.
  1. +20 −1 ModelCPP.cpp
  2. +6 −4 ModelCPP.hpp
@@ -8,6 +8,7 @@
#include "ModelCPP.hpp"

Model_CPP::Model_CPP(const uint aNRComb) {
notInvertible = false;
nrComb = aNRComb;
}

@@ -41,6 +42,14 @@ void Model_CPP::condLikeFunction(double *condLike, const double *gi, const doubl


double Model_CPP::executeCond(struct node* n, double *vec) {

if(notInvertible) {
uint assign;
for(assign=0;assign<nrComb;assign++){
vec[assign]= -std::numeric_limits<double>::infinity();
}
return -std::numeric_limits<double>::infinity();
}
if (n != NULL) {
if((n->left == NULL) && (n->right == NULL))// is leaf
{
@@ -77,7 +86,17 @@ void Model_CPP::setQ(double **Qm) {
EigenSolver<MatrixXd > es(Q, true);
D = es.eigenvalues().real().eval();
V = es.eigenvectors().real().eval();
invV = V.inverse().eval();
//invV = V.inverse().eval();

Eigen::FullPivLU<MatrixXd> lu(V);
if(!lu.isInvertible()){
notInvertible = true;
//cout << "not inversible" << endl;
} else {
notInvertible = false;
invV = lu.inverse();
}

/*cout << "Q : " << endl << Q; cout << endl;
cout << "D : " << endl << D; cout << endl;
cout << "V : " << endl << V; cout << endl;
@@ -10,10 +10,11 @@

#include "tree.h"

#include <limits>
#include <iostream>
#include <Core>
#include <Dense>
#include <Eigenvalues>
#include "Eigen/Core"
#include "Eigen/Dense"
#include "Eigen/Eigenvalues"

#include "wrapperCPP.h"

@@ -29,8 +30,9 @@ class Model_CPP : public model_cpp {

double executeCond(struct node* n, double *vec);
void setQ(double **Qm);
void matInverse(double **Qm,double **QmInverse);
void matInverse(double **Qm,double **QmInverse);
private:
bool notInvertible;
unsigned int nrComb;

VectorXd D;

0 comments on commit f0e3ffc

Please sign in to comment.
You can’t perform that action at this time.