/usr/include/JAGS/compiler/MixtureFactory.h is in jags 4.2.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | #ifndef MIXTURE_FACTORY_H_
#define MIXTURE_FACTORY_H_
#include <vector>
#include <map>
#include <cfloat>
#include <graph/MixtureNode.h>
namespace jags {
class NodeArray;
class Model;
/**
* A "mixture pair" uniquely indexes a mixture node. The first element
* is a vector of (discrete-valued) index nodes. The second element is
* a vector of parent nodes from which the mixture node copies its
* value.
*
* It is implicit in the mixture pair definition that the index nodes
* take a range of possible values. If these values are calculated and
* sorted, then ther there is a one-to-one correspondence between the
* sorted index values and the vector of parent nodes.
*
* The reason this vector of possible index values is not used is
* because it is not necessary to uniquely define a mixture node.
*/
typedef std::pair<std::vector<Node const*>, std::vector<Node const*> > MixPair;
/**
* @short Factory for MixtureNode objects
*
* The purpose of a MixtureFactory is to avoid unnecessary duplication
* of mixture nodes by having a container class and factory object
* that will create and/or lookup mixture nodes.
*/
class MixtureFactory
{
std::map<MixPair, MixtureNode*> _mix_node_map;
public:
/**
* Get a mixture node. The results are cached, so if a request is
* repeated, the same node will be returned.
*
* @param index Vector of discrete-valued Nodes that index the
* possible parameters
*
* @param parameters Vector of pairs. The first element of the pair
* shows a possible value of the index vector and the second element
* shows the corresponding parent from which the mixture node copies
* its value.
*
* @param graph Model to which newly allocated mixturenodes are added.
*
*/
MixtureNode *getMixtureNode(std::vector<Node const *> const &index,
MixMap const ¶meters, Model &model);
};
} /* namespace jags */
#endif /* MIXTURE_FACTORY_H_ */
|