28 | | //! Array of boundaries (2D vectors: [begining,end]) for each dimension |
29 | | Array<vec> ranges; |
30 | | //! Number of support points in each dimension |
31 | | ivec gridsizes; |
32 | | //! dimension |
33 | | int dim; |
34 | | //! Number of data points |
35 | | int Npoints; |
36 | | //! active vector for first_vec and next_vec |
37 | | vec actvec; |
38 | | //! indices of active vector |
39 | | vec actvec_ind; |
40 | | //! length of steps in each dimension |
41 | | vec steps; |
| 28 | //! Array of boundaries (2D vectors: [begining,end]) for each dimension |
| 29 | Array<vec> ranges; |
| 30 | //! Number of support points in each dimension |
| 31 | ivec gridsizes; |
| 32 | //! dimension |
| 33 | int dim; |
| 34 | //! Number of data points |
| 35 | int Npoints; |
| 36 | //! active vector for first_vec and next_vec |
| 37 | vec actvec; |
| 38 | //! indices of active vector |
| 39 | vec actvec_ind; |
| 40 | //! length of steps in each dimension |
| 41 | vec steps; |
96 | | //! Default constructor |
97 | | discrete_support() : Spoints ( 0 ), idx ( 0 ) {} |
98 | | //! Access function |
99 | | int points() const { |
100 | | return Spoints.length(); |
101 | | } |
102 | | //! set the first vector to corner and store result in actvec |
103 | | const vec& first_vec() { |
104 | | bdm_assert_debug ( Spoints.length() > 0, "Empty support" ); |
105 | | idx = 0; |
106 | | return Spoints ( idx ); |
107 | | } |
108 | | //! set next vector after calling first_vec() |
109 | | const vec& next_vec() { |
110 | | bdm_assert_debug ( Spoints.length() > idx - 1, "Out of support points" ); |
111 | | return Spoints ( ++idx ); |
112 | | } |
| 96 | //! Default constructor |
| 97 | discrete_support() : Spoints ( 0 ), idx ( 0 ) {} |
| 98 | //! Access function |
| 99 | int points() const { |
| 100 | return Spoints.length(); |
| 101 | } |
| 102 | //! set the first vector to corner and store result in actvec |
| 103 | const vec& first_vec() { |
| 104 | bdm_assert_debug ( Spoints.length() > 0, "Empty support" ); |
| 105 | idx = 0; |
| 106 | return Spoints ( idx ); |
| 107 | } |
| 108 | //! set next vector after calling first_vec() |
| 109 | const vec& next_vec() { |
| 110 | bdm_assert_debug ( Spoints.length() > idx - 1, "Out of support points" ); |
| 111 | return Spoints ( ++idx ); |
| 112 | } |
114 | | /*! |
115 | | \code |
116 | | class = "discrete_support"; |
117 | | points = ( [1,2..], [2,2..], ...); // list of points |
118 | | === OR === |
119 | | epdf = {class="epdf_offspring",...}; // epdf rfom which to sample |
120 | | npoints = 100; // number of samples |
121 | | \endcode |
122 | | */ |
123 | | void from_setting ( const Setting &set ); |
| 114 | /*! |
| 115 | \code |
| 116 | class = "discrete_support"; |
| 117 | points = ( [1,2..], [2,2..], ...); // list of points |
| 118 | === OR === |
| 119 | epdf = {class="epdf_offspring",...}; // epdf rfom which to sample |
| 120 | npoints = 100; // number of samples |
| 121 | \endcode |
| 122 | */ |
| 123 | void from_setting ( const Setting &set ); |
140 | | //! constructor function |
141 | | void set_support ( rectangular_support &sup0 ) { |
142 | | sup = sup0; |
143 | | values = zeros ( sup.points() ); |
144 | | } |
145 | | //! constructor function fills values by calling function \c f , double f(vec&), given by a pointer |
146 | | void set_values ( double ( *evalptr ) ( const vec& ) ); |
| 140 | //! constructor function |
| 141 | void set_support ( rectangular_support &sup0 ) { |
| 142 | sup = sup0; |
| 143 | values = zeros ( sup.points() ); |
| 144 | } |
| 145 | //! constructor function fills values by calling function \c f , double f(vec&), given by a pointer |
| 146 | void set_values ( double ( *evalptr ) ( const vec& ) ); |