-
Notifications
You must be signed in to change notification settings - Fork 0
/
cliqSPSparseGradEnergy.hpp
executable file
·37 lines (23 loc) · 1.31 KB
/
cliqSPSparseGradEnergy.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 CLIQSPSPARSEGRADENERGY_HPP
#define CLIQSPSPARSEGRADENERGY_HPP
#include "subProblem.hpp"
#include "myUtils.hpp"
#include <string>
int performSPFwdSparse(const subProblem *, const std::vector<int> &, const std::vector<double> &, const double, const std::vector<double> &, const std::vector<double> &, double &, std::vector<double> &);
int performSPBwdSparse(const subProblem *, const std::vector<int> &, const std::vector<double> &, const double, std::vector<double> &, std::vector<double> &);
int cliqSPSparseGradEnergy(const subProblem *subProb, const std::vector<double> &subProbDualVar, const double tau, double &energy, std::vector<double> &nodeMarg)
{
std::vector<int> subProbNodeOffset = subProb->getNodeOffset();
std::vector<double> expoMaxBwd;
std::vector<double> bwdMargVec;
double debugTime = myUtils::getTime();
performSPBwdSparse(subProb, subProbNodeOffset, subProbDualVar, tau, bwdMargVec, expoMaxBwd);
//std::cout<<"Backward pass took "<<myUtils::getTime()-debugTime<<std::endl;
debugTime = myUtils::getTime();
performSPFwdSparse(subProb, subProbNodeOffset, subProbDualVar, tau, bwdMargVec, expoMaxBwd, energy, nodeMarg);
//std::cout<<"Forward pass took "<<myUtils::getTime()-debugTime<<std::endl;
//delete [] expoMaxBwd;
//delete [] bwdMargVec;
return 0;
}
#endif //CLIQSPSPARSEGRADENERGY_HPP