Skip to content
Snippets Groups Projects
Select Git revision
  • a39a0b3b67b126a55a7d853dea9533fa70d13f05
  • master default protected
  • nlf-fixes
  • DSMH
  • OneStep2
  • SMC
  • online-filter-as-a-sampler
  • nonlinear-filter-fixes
  • SMCsamplers
  • smc-sampler
  • 4.5
  • dynamic-striated
  • occbin
  • exo_steady_state
  • filter_initial_state
  • declare_vars_in_model_block
  • exceptions
  • rmExtraExo
  • julia
  • error_msg_undeclared_model_vars
  • static_aux_vars
  • 4.5.6
  • 4.5.5
  • 4.5.4
  • 4.5.3
  • 4.5.2
  • 4.5.1
  • 4.5.0
  • 4.4.3
  • 4.4.2
  • 4.4.1
  • 4.4.0
  • 4.4-beta1
  • 4.3.3
  • 4.3.2
  • 4.3.1
  • 4.3.0
  • 4.2.5
  • 4.2.4
  • 4.2.3
  • 4.2.2
41 results

dsample.m

Blame
  • Forked from Dynare / dynare
    Source project has a limited visibility.
    atom_assignings.h 4.97 KiB
    // Copyright (C) 2006, Ondra Kamenik
    
    // $Id: atom_assignings.h 149 2007-04-30 02:11:46Z okamenik $
    
    #ifndef OGP_ATOM_ASSIGNINGS_H
    #define OGP_ATOM_ASSIGNINGS_H
    
    #include "static_atoms.h"
    #include "formula_parser.h"
    #include "atom_substitutions.h"
    
    #include <vector>
    #include <map>
    
    namespace ogp {
    
    	class AtomAsgnEvaluator;
    
    	/** This class represents atom assignments used in parameters
    	 * settings and initval initialization. It maintains atoms of the
    	 * all expressions on the right hand side, the parsed formulas of
    	 * the right hand sides, and the information about the left hand
    	 * sides. See documentation to the order member below. */
    	class AtomAssignings {
    		friend class AtomAsgnEvaluator;
    	protected:
    		typedef std::map<const char*, int, ltstr> Tvarintmap;
    		/** All atoms which should be sufficient for formulas at the
    		 * right hand sides. The atoms should be filled with names
    		 * (preregistered). This is a responsibility of the caller. */
    		StaticAtoms& atoms;
    		/** The formulas of right hand sides. */
    		FormulaParser expr;
    		/** Name storage of the names from left hand sides. */
    		NameStorage left_names;
    		/** Information on left hand sides. This maps a name to the
    		 * index of its assigned expression in expr. More than one
    		 * name may reference to the same expression. */
    		Tvarintmap lname2expr;
    		/** Information on left hand sides. If order[i] >= 0, then it
    		 * says that i-th expression in expr is assigned to atom with
    		 * order[i] tree index. */
    		std::vector<int> order;
    	public:
    		/** Construct the object using the provided static atoms. */
    		AtomAssignings(StaticAtoms& a) : atoms(a), expr(atoms)
    			{}
    		/** Make a copy with provided reference to (posibly different)
    		 * static atoms. */
    		AtomAssignings(const AtomAssignings& aa, StaticAtoms& a);
    		virtual ~AtomAssignings()
    			{}
    		/** Parse the assignments from the given string. */
    		void parse(int length, const char* stream);
    		/** Process a syntax error from bison. */
    		void error(const char* mes);
    		/** Add an assignment of the given name to the given
    		 * double. Can be called by a user, anytime. */
    		void add_assignment_to_double(const char* name, double val);
    		/** Add an assignment. Called from assign.y. */
    		void add_assignment(int asgn_off, const char* str, int name_len,
    							int right_off, int right_len);
    		/** This applies old2new map (possibly from atom
    		 * substitutions) to this object. It registers new variables
    		 * in the atoms, and adds the expressions to expr, and left
    		 * names to lname2expr. The information about dynamical part
    		 * of substitutions is ignored, since we are now in the static
    		 * world. */
    		void apply_subst(const AtomSubstitutions::Toldnamemap& mm);
    		/** Debug print. */