This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/packages/CLPBN/clpbn/bp/Factor.h
2011-07-22 21:33:30 +01:00

49 lines
1.4 KiB
C++
Executable File

#ifndef BP_FACTOR_H
#define BP_FACTOR_H
#include <vector>
#include "Distribution.h"
#include "CptEntry.h"
using namespace std;
class FgVarNode;
class Distribution;
class Factor
{
public:
Factor (void) { }
Factor (const Factor&);
Factor (FgVarNode*);
Factor (CFgVarSet);
Factor (FgVarNode*, const ParamSet&);
Factor (FgVarSet&, Distribution*);
Factor (CFgVarSet, CParamSet);
void setParameters (CParamSet);
void copyFactor (const Factor& f);
void multiplyByFactor (const Factor& f, const vector<CptEntry>* = 0);
void insertVariable (FgVarNode* index);
void removeVariable (const FgVarNode* var);
const vector<CptEntry>& getCptEntries (void) const;
string getLabel (void) const;
void printFactor (void);
CFgVarSet getFgVarNodes (void) const { return vars_; }
CParamSet getParameters (void) const { return dist_->params; }
Distribution* getDistribution (void) const { return dist_; }
unsigned getIndex (void) const { return index_; }
void setIndex (unsigned index) { index_ = index; }
void freeDistribution (void) { delete dist_; dist_ = 0;}
int getIndexOf (const FgVarNode*) const;
private:
FgVarSet vars_;
Distribution* dist_;
unsigned index_;
};
#endif //BP_FACTOR_H