⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 message.h.svn-base

📁 Probabilistic graphical models in matlab.
💻 SVN-BASE
字号:
#include <vector>#include <functional>#include <RandomVariable.h>#ifndef NDEBUG#include <iostream>#endif//*************** Message Declaration *******************//class Message {	public:		// Constructors		Message ();	Message (const RandomVariable &, const RandomVariable &);	Message (const unsigned int, const RandomVariable &);		// Normal methods		void reduce();		void set_index(unsigned int);	unsigned int get_index() const;	void set_size(unsigned int);		double get_value(const unsigned int) const;	double get_value(const RandomVariable &) const;	void set_value(const RandomVariable & , double);		// Debug methods	#ifndef NDEBUG	void display();#endif		friend class ExtractFromMessage;	private:		unsigned int index;	std::vector <double> values;	};inline void Message::set_index(unsigned int a){	index = a;}inline unsigned int Message::get_index() const{	return index;}inline void Message::set_size(unsigned int a){	values.resize(a);}inline double Message::get_value(const unsigned int a) const{	return values[a];	}inline double Message::get_value(const RandomVariable & rv) const{	// For now we only use these messages with Discrete Random Variables	// But it could be more generic later		const DiscreteRandomVariable & drv = static_cast < const DiscreteRandomVariable & > (rv);		return values[drv.last_sampled_value];}inline void Message::set_value(const RandomVariable & rv, double a){	// For now we only use these messages with Discrete Random Variables	// But it could be more generic later		const DiscreteRandomVariable & drv = static_cast < const DiscreteRandomVariable & > (rv);		values[drv.last_sampled_value] = a;}//*************** End of Message Declaration *******************////*************** ExtractFromMessage Declaration *******************//class ExtractFromMessage : public std::unary_function <Message, double>{	public:			double operator ()  (const Message & x) const;		ExtractFromMessage( const unsigned int, const bool = false);		ExtractFromMessage(const RandomVariable &);	ExtractFromMessage(const RandomVariable &, const RandomVariable &);	ExtractFromMessage(const RandomVariable &, const unsigned int);	private : 			bool forbidden;	const unsigned int index_of_extraction;	const unsigned int forbidden_index;};//*************** End of ExtractFromMessage Declaration *******************//

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -