-
Notifications
You must be signed in to change notification settings - Fork 0
/
cliqChainSPNumSparseFista.hpp
37 lines (28 loc) · 1.99 KB
/
cliqChainSPNumSparseFista.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef CLIQCHAINSPNUMSPARSEFISTA_HPP
#define CLIQCHAINSPNUMSPARSE_HPP
#include "clique.hpp"
#include "subProblem.hpp"
#include <string>
#include <map>
int performSPFwdNumSparse(uint_fast8_t, const std::vector<std::pair<int, clique*> > &, const std::map<int,int> &, const std::vector<int> &, const Eigen::VectorXd &, const std::vector<std::vector<double> > &, const std::vector<double> &, const std::vector<int> &, const double, const std::vector<std::vector<double> > &, double &, std::vector<double> &, std::vector<std::vector<double> > &);
int performSPBwdNumSparse(uint_fast8_t, const std::vector<std::pair<int, clique*> > &, const std::map<int,int> &, const std::vector<int> &, const Eigen::VectorXd &, const std::vector<double> &, const std::vector<int> &, const double, std::vector<std::vector<double> > &, std::vector<std::vector<double> > &);
int cliqChainSPNumSparseFista(const subProblem &subProb, const std::vector<double> &uEnergy, const std::vector<int> &uOffset, const double tau, double &energy, std::vector<double> &nodeMarg, std::vector<std::vector<double> > &cliqMarg)
{
std::vector<std::pair<int, clique*> > cliqChain = subProb.getChain();
std::map<int,int> subProbNodeMap = subProb.getNodeMap();
std::vector<int> subProbNodeOffset = subProb.getNodeOffset();
Eigen::VectorXd subProbMomentum = subProb.getMomentum();
uint_fast8_t horVerFlag = subProb.getHorVerFlag();
std::vector<std::vector<double> > expoMaxBwdVec(cliqChain.size() - 1);
std::vector<std::vector<double> > bwdMargVec(cliqChain.size() - 1);
if (cliqChain.size() > 1) {
performSPBwdNumSparse(horVerFlag, cliqChain, subProbNodeMap, subProbNodeOffset, subProbMomentum, uEnergy, uOffset, tau, bwdMargVec, expoMaxBwdVec);
performSPFwdNumSparse(horVerFlag, cliqChain, subProbNodeMap, subProbNodeOffset, subProbMomentum, bwdMargVec, uEnergy, uOffset, tau, expoMaxBwdVec, energy, nodeMarg, cliqMarg);
}
else {
std::cout<<"CHAIN HAS MORE THAN ONE CLIQUE."<<std::endl;
return -1;
}
return 0;
}
#endif // CLIQCHAINSPNUMSPARSEFISTA_HPP