Show
Ignore:
Timestamp:
10/12/09 13:49:39 (15 years ago)
Author:
mido
Message:

\doc directory cleaned a bit

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/doc/html/discrete_8h_source.html

    r641 r651  
    1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    2 <html xmlns="http://www.w3.org/1999/xhtml"> 
    3 <head> 
    4 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> 
     1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
     2<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> 
    53<title>mixpp: discrete.h Source File</title> 
    6 <link href="tabs.css" rel="stylesheet" type="text/css"/> 
    7 <link href="doxygen.css" rel="stylesheet" type="text/css"/> 
    8 </head> 
    9 <body> 
    10 <!-- Generated by Doxygen 1.6.1 --> 
     4<link href="tabs.css" rel="stylesheet" type="text/css"> 
     5<link href="doxygen.css" rel="stylesheet" type="text/css"> 
     6</head><body> 
     7<!-- Generated by Doxygen 1.5.9 --> 
    118<script type="text/javascript"> 
    129<!-- 
     
    6966<a name="l00014"></a>00014 <span class="preprocessor"></span><span class="preprocessor">#define DISCR_H</span> 
    7067<a name="l00015"></a>00015 <span class="preprocessor"></span> 
    71 <a name="l00016"></a>00016  
    72 <a name="l00017"></a>00017 <span class="preprocessor">#include &quot;../shared_ptr.h&quot;</span> 
    73 <a name="l00018"></a>00018 <span class="preprocessor">#include &quot;../base/bdmbase.h&quot;</span> 
    74 <a name="l00019"></a>00019 <span class="preprocessor">#include &quot;../math/chmat.h&quot;</span> 
    75 <a name="l00020"></a>00020  
    76 <a name="l00021"></a>00021 <span class="keyword">namespace </span>bdm 
    77 <a name="l00022"></a>00022 { 
    78 <a name="l00023"></a>00023  
    79 <a name="l00027"></a><a class="code" href="classbdm_1_1rectangular__support.html">00027</a>         <span class="keyword">class </span><a class="code" href="classbdm_1_1rectangular__support.html">rectangular_support</a>: <span class="keyword">public</span> <a class="code" href="classbdm_1_1root.html" title="Root class of BDM objects.">root</a> { 
    80 <a name="l00028"></a>00028                 <span class="keyword">protected</span>: 
    81 <a name="l00030"></a><a class="code" href="classbdm_1_1rectangular__support.html#ab63e1190a8a22031d110624a8fc64b14">00030</a>                         Array&lt;vec&gt; <a class="code" href="classbdm_1_1rectangular__support.html#ab63e1190a8a22031d110624a8fc64b14" title="Array of boundaries (2D vectors: [begining,end]) for each dimension.">ranges</a>; 
    82 <a name="l00032"></a><a class="code" href="classbdm_1_1rectangular__support.html#aefe08427f4bf66191e10b727b57e4b31">00032</a>                         ivec <a class="code" href="classbdm_1_1rectangular__support.html#aefe08427f4bf66191e10b727b57e4b31" title="Number of support points in each dimension.">gridsizes</a>; 
    83 <a name="l00034"></a><a class="code" href="classbdm_1_1rectangular__support.html#a442ae2e1881d6bcdccf0cabbef769e79">00034</a>                         <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1rectangular__support.html#a442ae2e1881d6bcdccf0cabbef769e79" title="dimension">dim</a>; 
    84 <a name="l00036"></a><a class="code" href="classbdm_1_1rectangular__support.html#a6e55e6243f3a3e451f8bed149d948319">00036</a>                         <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1rectangular__support.html#a6e55e6243f3a3e451f8bed149d948319" title="Number of data points.">Npoints</a>; 
    85 <a name="l00038"></a><a class="code" href="classbdm_1_1rectangular__support.html#ae1aa9a4e91c248a29e4e432f4b448197">00038</a>                         vec <a class="code" href="classbdm_1_1rectangular__support.html#ae1aa9a4e91c248a29e4e432f4b448197" title="active vector for first_vec and next_vec">actvec</a>; 
    86 <a name="l00040"></a><a class="code" href="classbdm_1_1rectangular__support.html#a744688479a1ab8cf9f80d6f3021d762b">00040</a>                         vec <a class="code" href="classbdm_1_1rectangular__support.html#a744688479a1ab8cf9f80d6f3021d762b" title="indeces of active vector">actvec_ind</a>; 
    87 <a name="l00042"></a><a class="code" href="classbdm_1_1rectangular__support.html#a967bfe2eb868409e3e0e6e41dcd63a6a">00042</a>                         vec <a class="code" href="classbdm_1_1rectangular__support.html#a967bfe2eb868409e3e0e6e41dcd63a6a" title="length of steps in each dimension">steps</a>; 
    88 <a name="l00043"></a>00043                 <span class="keyword">public</span>: 
    89 <a name="l00045"></a><a class="code" href="classbdm_1_1rectangular__support.html#a9929645efe5eff3a6b87da8b81e114c4">00045</a>                         <a class="code" href="classbdm_1_1rectangular__support.html#a9929645efe5eff3a6b87da8b81e114c4" title="default constructor">rectangular_support</a>() : <a class="code" href="classbdm_1_1rectangular__support.html#a442ae2e1881d6bcdccf0cabbef769e79" title="dimension">dim</a>(0), <a class="code" href="classbdm_1_1rectangular__support.html#a6e55e6243f3a3e451f8bed149d948319" title="Number of data points.">Npoints</a>(0) { 
    90 <a name="l00046"></a>00046                         } 
    91 <a name="l00047"></a>00047                          
    92 <a name="l00049"></a><a class="code" href="classbdm_1_1rectangular__support.html#aa18272405534f914ee3798f1c4034e51">00049</a>                         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1rectangular__support.html#aa18272405534f914ee3798f1c4034e51" title="set parameters">set_parameters</a>(<span class="keyword">const</span> Array&lt;vec&gt; &amp;ranges0, <span class="keyword">const</span> ivec &amp;gridsize0){ 
    93 <a name="l00050"></a>00050                                 <a class="code" href="classbdm_1_1rectangular__support.html#ab63e1190a8a22031d110624a8fc64b14" title="Array of boundaries (2D vectors: [begining,end]) for each dimension.">ranges</a>=ranges0; 
    94 <a name="l00051"></a>00051                                 <a class="code" href="classbdm_1_1rectangular__support.html#aefe08427f4bf66191e10b727b57e4b31" title="Number of support points in each dimension.">gridsizes</a>=gridsize0; 
    95 <a name="l00052"></a>00052                                 <a class="code" href="classbdm_1_1rectangular__support.html#adeaab6ec24371267da14de05963c5092" title="Internal functio to set temporaries correctly.">initialize</a>(); 
    96 <a name="l00053"></a>00053                         } 
    97 <a name="l00055"></a><a class="code" href="classbdm_1_1rectangular__support.html#adeaab6ec24371267da14de05963c5092">00055</a>                         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1rectangular__support.html#adeaab6ec24371267da14de05963c5092" title="Internal functio to set temporaries correctly.">initialize</a>() { 
    98 <a name="l00056"></a>00056                                 <a class="code" href="classbdm_1_1rectangular__support.html#a442ae2e1881d6bcdccf0cabbef769e79" title="dimension">dim</a> = <a class="code" href="classbdm_1_1rectangular__support.html#ab63e1190a8a22031d110624a8fc64b14" title="Array of boundaries (2D vectors: [begining,end]) for each dimension.">ranges</a>.length(); 
    99 <a name="l00057"></a>00057                                 <a class="code" href="bdmerror_8h.html#a7a3399d182b8e3065532596e76f84849" title="Throw std::runtime_exception if t is not true.">bdm_assert</a>(<a class="code" href="classbdm_1_1rectangular__support.html#aefe08427f4bf66191e10b727b57e4b31" title="Number of support points in each dimension.">gridsizes</a>.length() == <a class="code" href="classbdm_1_1rectangular__support.html#a442ae2e1881d6bcdccf0cabbef769e79" title="dimension">dim</a>, <span class="stringliteral">&quot;Incompatible dimensions of input&quot;</span>); 
    100 <a name="l00058"></a>00058                                 <a class="code" href="classbdm_1_1rectangular__support.html#a6e55e6243f3a3e451f8bed149d948319" title="Number of data points.">Npoints</a> = prod(<a class="code" href="classbdm_1_1rectangular__support.html#aefe08427f4bf66191e10b727b57e4b31" title="Number of support points in each dimension.">gridsizes</a>); 
    101 <a name="l00059"></a>00059                                 <a class="code" href="bdmerror_8h.html#a7a3399d182b8e3065532596e76f84849" title="Throw std::runtime_exception if t is not true.">bdm_assert</a>(Npoints &gt; 0, <span class="stringliteral">&quot;Wrong input parameters&quot;</span>); 
    102 <a name="l00060"></a>00060                                  
    103 <a name="l00061"></a>00061                                 <span class="comment">//precompute steps</span> 
    104 <a name="l00062"></a>00062                                 <a class="code" href="classbdm_1_1rectangular__support.html#a967bfe2eb868409e3e0e6e41dcd63a6a" title="length of steps in each dimension">steps</a>.set_size(<a class="code" href="classbdm_1_1rectangular__support.html#a442ae2e1881d6bcdccf0cabbef769e79" title="dimension">dim</a>); 
    105 <a name="l00063"></a>00063                                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> j = 0; j &lt; <a class="code" href="classbdm_1_1rectangular__support.html#a442ae2e1881d6bcdccf0cabbef769e79" title="dimension">dim</a>; j++ ) { 
    106 <a name="l00064"></a>00064                                         <a class="code" href="classbdm_1_1rectangular__support.html#a967bfe2eb868409e3e0e6e41dcd63a6a" title="length of steps in each dimension">steps</a> ( j ) = ( <a class="code" href="classbdm_1_1rectangular__support.html#ab63e1190a8a22031d110624a8fc64b14" title="Array of boundaries (2D vectors: [begining,end]) for each dimension.">ranges</a> ( j ) ( 1 ) - <a class="code" href="classbdm_1_1rectangular__support.html#ab63e1190a8a22031d110624a8fc64b14" title="Array of boundaries (2D vectors: [begining,end]) for each dimension.">ranges</a>(j)(0) ) / <a class="code" href="classbdm_1_1rectangular__support.html#aefe08427f4bf66191e10b727b57e4b31" title="Number of support points in each dimension.">gridsizes</a> ( j ); 
    107 <a name="l00065"></a>00065                                 } 
    108 <a name="l00066"></a>00066                                 <a class="code" href="classbdm_1_1rectangular__support.html#ae1aa9a4e91c248a29e4e432f4b448197" title="active vector for first_vec and next_vec">actvec</a>.set_size(dim); 
    109 <a name="l00067"></a>00067                                 <a class="code" href="classbdm_1_1rectangular__support.html#a744688479a1ab8cf9f80d6f3021d762b" title="indeces of active vector">actvec_ind</a>.set_size(dim); 
    110 <a name="l00068"></a>00068                         } 
    111 <a name="l00070"></a><a class="code" href="classbdm_1_1rectangular__support.html#a2fd69b881ff077e6d3da3e453d7dc418">00070</a>                         vec <a class="code" href="classbdm_1_1rectangular__support.html#a2fd69b881ff077e6d3da3e453d7dc418" title="return vector at position given by vector of indeces">get_vec</a>(<span class="keyword">const</span> ivec &amp;inds){ 
    112 <a name="l00071"></a>00071                                 vec v ( <a class="code" href="classbdm_1_1rectangular__support.html#a442ae2e1881d6bcdccf0cabbef769e79" title="dimension">dim</a> ); 
    113 <a name="l00072"></a>00072                                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> j = 0; j &lt; <a class="code" href="classbdm_1_1rectangular__support.html#a442ae2e1881d6bcdccf0cabbef769e79" title="dimension">dim</a>; j++ ) { 
    114 <a name="l00073"></a>00073                                         <a class="code" href="bdmerror_8h.html#a89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a>(inds(j) &lt; <a class="code" href="classbdm_1_1rectangular__support.html#aefe08427f4bf66191e10b727b57e4b31" title="Number of support points in each dimension.">gridsizes</a>(j), <span class="stringliteral">&quot;Index out of bounds&quot;</span>); 
    115 <a name="l00074"></a>00074                                         v ( j ) = <a class="code" href="classbdm_1_1rectangular__support.html#ab63e1190a8a22031d110624a8fc64b14" title="Array of boundaries (2D vectors: [begining,end]) for each dimension.">ranges</a>(j)(0) + (0.5+inds(j))*<a class="code" href="classbdm_1_1rectangular__support.html#a967bfe2eb868409e3e0e6e41dcd63a6a" title="length of steps in each dimension">steps</a>(j); 
    116 <a name="l00075"></a>00075                                 } 
    117 <a name="l00076"></a>00076                                 <span class="keywordflow">return</span> v; 
    118 <a name="l00077"></a>00077                         } 
    119 <a name="l00078"></a>00078  
    120 <a name="l00080"></a><a class="code" href="classbdm_1_1rectangular__support.html#a2ae8ed78cba8e14b5dcc570b51d7d3f0">00080</a>                         <span class="keywordtype">long</span> <a class="code" href="classbdm_1_1rectangular__support.html#a2ae8ed78cba8e14b5dcc570b51d7d3f0" title="convert dimension indeces into linear index, the indexing is in the same way as in...">linear_index</a> (<span class="keyword">const</span> ivec inds){ 
    121 <a name="l00081"></a>00081                                 <span class="keywordtype">long</span> ind=0; 
    122 <a name="l00082"></a>00082                                 <a class="code" href="bdmerror_8h.html#a89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a>(inds.length() == <a class="code" href="classbdm_1_1rectangular__support.html#a442ae2e1881d6bcdccf0cabbef769e79" title="dimension">dim</a>, <span class="stringliteral">&quot;Improper indices inds&quot;</span>); 
    123 <a name="l00083"></a>00083                                 <span class="keywordtype">int</span> dim_skips=1; <span class="comment">// skips in active dimension, in the first dimension, the skips are 1 index per value</span> 
    124 <a name="l00084"></a>00084                                                  
    125 <a name="l00085"></a>00085                                 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j=0; j&lt;<a class="code" href="classbdm_1_1rectangular__support.html#a442ae2e1881d6bcdccf0cabbef769e79" title="dimension">dim</a>; j++){  
    126 <a name="l00086"></a>00086                                         ind += dim_skips*(inds(j)); <span class="comment">// add shift in linear index caused by this dimension</span> 
    127 <a name="l00087"></a>00087                                         dim_skips*=<a class="code" href="classbdm_1_1rectangular__support.html#aefe08427f4bf66191e10b727b57e4b31" title="Number of support points in each dimension.">gridsizes</a>(j);  <span class="comment">// indeces in the next dimension are repeated with period gridsizes(j) times greater that in this dimesion</span> 
    128 <a name="l00088"></a>00088                                 } 
    129 <a name="l00089"></a>00089                                 <span class="keywordflow">return</span> ind; 
    130 <a name="l00090"></a>00090                         }  
    131 <a name="l00092"></a><a class="code" href="classbdm_1_1rectangular__support.html#a5e0baba7f6e7dc131e8c9131d37b4f94">00092</a>                         <span class="keyword">const</span> vec&amp; <a class="code" href="classbdm_1_1rectangular__support.html#a5e0baba7f6e7dc131e8c9131d37b4f94" title="set the first vector to corner and store result in actvec">first_vec</a>(){ 
    132 <a name="l00093"></a>00093                                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> j = 0; j &lt; <a class="code" href="classbdm_1_1rectangular__support.html#a442ae2e1881d6bcdccf0cabbef769e79" title="dimension">dim</a>; j++ ) { 
    133 <a name="l00094"></a>00094                                         <a class="code" href="classbdm_1_1rectangular__support.html#ae1aa9a4e91c248a29e4e432f4b448197" title="active vector for first_vec and next_vec">actvec</a> ( j ) = <a class="code" href="classbdm_1_1rectangular__support.html#ab63e1190a8a22031d110624a8fc64b14" title="Array of boundaries (2D vectors: [begining,end]) for each dimension.">ranges</a>(j)(0) + 0.5*<a class="code" href="classbdm_1_1rectangular__support.html#a967bfe2eb868409e3e0e6e41dcd63a6a" title="length of steps in each dimension">steps</a>(j); 
    134 <a name="l00095"></a>00095                                         <a class="code" href="classbdm_1_1rectangular__support.html#a744688479a1ab8cf9f80d6f3021d762b" title="indeces of active vector">actvec_ind</a>(j) = 0; 
    135 <a name="l00096"></a>00096                                 } 
    136 <a name="l00097"></a>00097                                 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1rectangular__support.html#ae1aa9a4e91c248a29e4e432f4b448197" title="active vector for first_vec and next_vec">actvec</a>; 
    137 <a name="l00098"></a>00098                         } 
    138 <a name="l00100"></a><a class="code" href="classbdm_1_1rectangular__support.html#aadc4f5bdfd1b6f863cdf7961964eb23f">00100</a>                         <span class="keyword">const</span> vec&amp; <a class="code" href="classbdm_1_1rectangular__support.html#aadc4f5bdfd1b6f863cdf7961964eb23f" title="Get next active vector, call ONLY after first_vector()!">next_vec</a>() { 
    139 <a name="l00101"></a>00101                                 <span class="comment">// go through all dimensions</span> 
    140 <a name="l00102"></a>00102                                 <span class="keywordtype">int</span> j=0; 
    141 <a name="l00103"></a>00103                                 <span class="keywordflow">while</span> (j&lt;<a class="code" href="classbdm_1_1rectangular__support.html#a442ae2e1881d6bcdccf0cabbef769e79" title="dimension">dim</a>) { 
    142 <a name="l00104"></a>00104                                         <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1rectangular__support.html#a744688479a1ab8cf9f80d6f3021d762b" title="indeces of active vector">actvec_ind</a> ( j ) == <a class="code" href="classbdm_1_1rectangular__support.html#aefe08427f4bf66191e10b727b57e4b31" title="Number of support points in each dimension.">gridsizes</a> ( j ) - 1 ) { <span class="comment">//j-th index is full</span> 
    143 <a name="l00105"></a>00105                                                 <a class="code" href="classbdm_1_1rectangular__support.html#a744688479a1ab8cf9f80d6f3021d762b" title="indeces of active vector">actvec_ind</a> ( j ) = 0; <span class="comment">//shift back</span> 
    144 <a name="l00106"></a>00106                                                 <a class="code" href="classbdm_1_1rectangular__support.html#ae1aa9a4e91c248a29e4e432f4b448197" title="active vector for first_vec and next_vec">actvec</a> ( j ) = <a class="code" href="classbdm_1_1rectangular__support.html#ab63e1190a8a22031d110624a8fc64b14" title="Array of boundaries (2D vectors: [begining,end]) for each dimension.">ranges</a> ( j ) ( 0 ) + 0.5*<a class="code" href="classbdm_1_1rectangular__support.html#a967bfe2eb868409e3e0e6e41dcd63a6a" title="length of steps in each dimension">steps</a>(j); 
    145 <a name="l00107"></a>00107                                                 j++; 
    146 <a name="l00108"></a>00108                                         } <span class="keywordflow">else</span> { 
    147 <a name="l00109"></a>00109                                                 <a class="code" href="classbdm_1_1rectangular__support.html#a744688479a1ab8cf9f80d6f3021d762b" title="indeces of active vector">actvec_ind</a> ( j ) ++; 
    148 <a name="l00110"></a>00110                                                 <a class="code" href="classbdm_1_1rectangular__support.html#ae1aa9a4e91c248a29e4e432f4b448197" title="active vector for first_vec and next_vec">actvec</a> ( j ) += <a class="code" href="classbdm_1_1rectangular__support.html#a967bfe2eb868409e3e0e6e41dcd63a6a" title="length of steps in each dimension">steps</a> ( j ); 
    149 <a name="l00111"></a>00111                                                 <span class="keywordflow">break</span>; 
    150 <a name="l00112"></a>00112                                         } 
    151 <a name="l00113"></a>00113                                 } 
    152 <a name="l00114"></a>00114                                 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1rectangular__support.html#ae1aa9a4e91c248a29e4e432f4b448197" title="active vector for first_vec and next_vec">actvec</a>; 
    153 <a name="l00115"></a>00115                         }  
    154 <a name="l00116"></a>00116                          
    155 <a name="l00117"></a>00117                         ivec nearest_point(<span class="keyword">const</span> vec &amp;val){ 
    156 <a name="l00118"></a>00118                                 ivec inds; 
    157 <a name="l00119"></a>00119                                 inds.set_size(<a class="code" href="classbdm_1_1rectangular__support.html#a442ae2e1881d6bcdccf0cabbef769e79" title="dimension">dim</a>); 
    158 <a name="l00120"></a>00120                                 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0; j&lt;<a class="code" href="classbdm_1_1rectangular__support.html#a442ae2e1881d6bcdccf0cabbef769e79" title="dimension">dim</a>; j++){ 
    159 <a name="l00121"></a>00121                                         <span class="keywordflow">if</span> (val(j)&lt;<a class="code" href="classbdm_1_1rectangular__support.html#ab63e1190a8a22031d110624a8fc64b14" title="Array of boundaries (2D vectors: [begining,end]) for each dimension.">ranges</a>(j)(0)) 
    160 <a name="l00122"></a>00122                                                 inds(j) = 0; 
    161 <a name="l00123"></a>00123                                         <span class="keywordflow">else</span> { 
    162 <a name="l00124"></a>00124                                                 <span class="keywordflow">if</span> (val(j)&gt;<a class="code" href="classbdm_1_1rectangular__support.html#ab63e1190a8a22031d110624a8fc64b14" title="Array of boundaries (2D vectors: [begining,end]) for each dimension.">ranges</a>(j)(1)) 
    163 <a name="l00125"></a>00125                                                         inds(j) = <a class="code" href="classbdm_1_1rectangular__support.html#aefe08427f4bf66191e10b727b57e4b31" title="Number of support points in each dimension.">gridsizes</a>(j)-1; 
    164 <a name="l00126"></a>00126                                                 <span class="keywordflow">else</span> { 
    165 <a name="l00127"></a>00127                                                         inds(j) = ::round(val(j) - <a class="code" href="classbdm_1_1rectangular__support.html#ab63e1190a8a22031d110624a8fc64b14" title="Array of boundaries (2D vectors: [begining,end]) for each dimension.">ranges</a>(j)(0)/ <a class="code" href="classbdm_1_1rectangular__support.html#a967bfe2eb868409e3e0e6e41dcd63a6a" title="length of steps in each dimension">steps</a>(j)); 
    166 <a name="l00128"></a>00128                                                 } 
    167 <a name="l00129"></a>00129                                         } 
    168 <a name="l00130"></a>00130                                 } 
    169 <a name="l00131"></a>00131                                 <span class="keywordflow">return</span> inds; 
    170 <a name="l00132"></a>00132                         } 
    171 <a name="l00133"></a>00133  
    172 <a name="l00135"></a><a class="code" href="classbdm_1_1rectangular__support.html#aa2cc3a7250b969675bc8f9034aa2a7d2">00135</a>                         <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1rectangular__support.html#aa2cc3a7250b969675bc8f9034aa2a7d2" title="Access function.">points</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1rectangular__support.html#a6e55e6243f3a3e451f8bed149d948319" title="Number of data points.">Npoints</a>;} 
    173 <a name="l00136"></a>00136                          
    174 <a name="l00138"></a><a class="code" href="classbdm_1_1rectangular__support.html#acfd542382bc959fce9c117b8df5f6e9f">00138</a>                         <span class="keyword">const</span> vec&amp; <a class="code" href="classbdm_1_1rectangular__support.html#acfd542382bc959fce9c117b8df5f6e9f" title="access function">_steps</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1rectangular__support.html#a967bfe2eb868409e3e0e6e41dcd63a6a" title="length of steps in each dimension">steps</a>;} 
    175 <a name="l00139"></a>00139                          
    176 <a name="l00140"></a><a class="code" href="classbdm_1_1rectangular__support.html#ac8d82bd237cdd4dc50d5fbcc285d80ee">00140</a>                         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1rectangular__support.html#ac8d82bd237cdd4dc50d5fbcc285d80ee" title="This method arrange instance properties according the data stored in the Setting...">from_setting</a> (<span class="keyword">const</span> Setting &amp;<span class="keyword">set</span>) { 
    177 <a name="l00141"></a>00141                                 <a class="code" href="classbdm_1_1UI.html#acd1667e6fec99ec64dabcb3ca2ff922d">UI::get</a> (<a class="code" href="classbdm_1_1rectangular__support.html#ab63e1190a8a22031d110624a8fc64b14" title="Array of boundaries (2D vectors: [begining,end]) for each dimension.">ranges</a> , <span class="keyword">set</span>, <span class="stringliteral">&quot;ranges&quot;</span>, UI::compulsory); 
    178 <a name="l00142"></a>00142                                 <a class="code" href="classbdm_1_1UI.html#acd1667e6fec99ec64dabcb3ca2ff922d">UI::get</a> (<a class="code" href="classbdm_1_1rectangular__support.html#aefe08427f4bf66191e10b727b57e4b31" title="Number of support points in each dimension.">gridsizes</a>, <span class="keyword">set</span>, <span class="stringliteral">&quot;gridsizes&quot;</span>, UI::compulsory); 
    179 <a name="l00143"></a>00143                                 <a class="code" href="classbdm_1_1rectangular__support.html#adeaab6ec24371267da14de05963c5092" title="Internal functio to set temporaries correctly.">initialize</a>(); 
    180 <a name="l00144"></a>00144                         } 
    181 <a name="l00145"></a>00145         }; 
    182 <a name="l00146"></a>00146         <a class="code" href="user__info_8h.html#a4f9de2f17e844047726487b99def99c6" title="Macro for registration of class into map of user-infos, registered class is scriptable...">UIREGISTER</a>(rectangular_support); 
    183 <a name="l00147"></a>00147          
    184 <a name="l00149"></a><a class="code" href="classbdm_1_1discrete__support.html">00149</a>         <span class="keyword">class </span><a class="code" href="classbdm_1_1discrete__support.html" title="Discrete support with stored support points.">discrete_support</a>: <span class="keyword">public</span> <a class="code" href="classbdm_1_1root.html" title="Root class of BDM objects.">root</a>{ 
    185 <a name="l00150"></a>00150                 <span class="keyword">protected</span>: 
    186 <a name="l00152"></a><a class="code" href="classbdm_1_1discrete__support.html#ac0cbdb61727406b52ca22332507a9a7c">00152</a>                         Array&lt;vec&gt; <a class="code" href="classbdm_1_1discrete__support.html#ac0cbdb61727406b52ca22332507a9a7c" title="storage of support points">Spoints</a>; 
    187 <a name="l00154"></a><a class="code" href="classbdm_1_1discrete__support.html#a505284848af521fea33e65368de4845e">00154</a>                         <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1discrete__support.html#a505284848af521fea33e65368de4845e" title="index in iterators">idx</a>; 
    188 <a name="l00155"></a>00155                 <span class="keyword">public</span>: 
    189 <a name="l00157"></a><a class="code" href="classbdm_1_1discrete__support.html#a58d652a1f149a7698f1fee9acd1a78b5">00157</a>                         <a class="code" href="classbdm_1_1discrete__support.html#a58d652a1f149a7698f1fee9acd1a78b5" title="Default constructor.">discrete_support</a>() : <a class="code" href="classbdm_1_1discrete__support.html#ac0cbdb61727406b52ca22332507a9a7c" title="storage of support points">Spoints</a>(0), <a class="code" href="classbdm_1_1discrete__support.html#a505284848af521fea33e65368de4845e" title="index in iterators">idx</a>(0){} 
    190 <a name="l00159"></a><a class="code" href="classbdm_1_1discrete__support.html#adc3d175266b65168ba3f3a5f568078a1">00159</a>                         <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1discrete__support.html#adc3d175266b65168ba3f3a5f568078a1" title="Access function.">points</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1discrete__support.html#ac0cbdb61727406b52ca22332507a9a7c" title="storage of support points">Spoints</a>.length();} 
    191 <a name="l00161"></a><a class="code" href="classbdm_1_1discrete__support.html#a26c803791b63916adf301a4a186f01ba">00161</a>                         <span class="keyword">const</span> vec&amp; <a class="code" href="classbdm_1_1discrete__support.html#a26c803791b63916adf301a4a186f01ba" title="set the first vector to corner and store result in actvec">first_vec</a>(){<a class="code" href="bdmerror_8h.html#a89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a>(<a class="code" href="classbdm_1_1discrete__support.html#ac0cbdb61727406b52ca22332507a9a7c" title="storage of support points">Spoints</a>.length()&gt;0,<span class="stringliteral">&quot;Empty support&quot;</span>);<a class="code" href="classbdm_1_1discrete__support.html#a505284848af521fea33e65368de4845e" title="index in iterators">idx</a>=0; <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1discrete__support.html#ac0cbdb61727406b52ca22332507a9a7c" title="storage of support points">Spoints</a>(idx);} 
    192 <a name="l00163"></a><a class="code" href="classbdm_1_1discrete__support.html#a368f10fd45443dee5296cc0febb240fb">00163</a>                         <span class="keyword">const</span> vec&amp; <a class="code" href="classbdm_1_1discrete__support.html#a368f10fd45443dee5296cc0febb240fb" title="set next vector after calling first_vec()">next_vec</a>(){<a class="code" href="bdmerror_8h.html#a89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a>(<a class="code" href="classbdm_1_1discrete__support.html#ac0cbdb61727406b52ca22332507a9a7c" title="storage of support points">Spoints</a>.length()&gt;<a class="code" href="classbdm_1_1discrete__support.html#a505284848af521fea33e65368de4845e" title="index in iterators">idx</a>-1,<span class="stringliteral">&quot;Out of support points&quot;</span>); <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1discrete__support.html#ac0cbdb61727406b52ca22332507a9a7c" title="storage of support points">Spoints</a>(++<a class="code" href="classbdm_1_1discrete__support.html#a505284848af521fea33e65368de4845e" title="index in iterators">idx</a>);} 
    193 <a name="l00164"></a>00164                          
    194 <a name="l00174"></a><a class="code" href="classbdm_1_1discrete__support.html#a0c405889b7b76f0852c1b2a222f07aab">00174</a>                         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1discrete__support.html#a0c405889b7b76f0852c1b2a222f07aab">from_setting</a> (<span class="keyword">const</span> Setting &amp;<span class="keyword">set</span>) { 
    195 <a name="l00175"></a>00175                                 <a class="code" href="classbdm_1_1UI.html#acd1667e6fec99ec64dabcb3ca2ff922d">UI::get</a> (<a class="code" href="classbdm_1_1discrete__support.html#ac0cbdb61727406b52ca22332507a9a7c" title="storage of support points">Spoints</a>, <span class="keyword">set</span>, <span class="stringliteral">&quot;points&quot;</span>, UI::compulsory); 
    196 <a name="l00176"></a>00176                                 <span class="keywordflow">if</span> (<a class="code" href="classbdm_1_1discrete__support.html#adc3d175266b65168ba3f3a5f568078a1" title="Access function.">points</a>()&lt;1){ 
    197 <a name="l00177"></a>00177                                         <span class="keywordtype">int</span> npoints; 
    198 <a name="l00178"></a>00178                                         <a class="code" href="classbdm_1_1shared__ptr.html">shared_ptr&lt;epdf&gt;</a> ep= UI::build&lt;epdf&gt;(<span class="keyword">set</span>, <span class="stringliteral">&quot;epdf&quot;</span>, UI::compulsory); 
    199 <a name="l00179"></a>00179                                         <span class="keywordflow">if</span> (!<a class="code" href="classbdm_1_1UI.html#acd1667e6fec99ec64dabcb3ca2ff922d">UI::get</a>(npoints,<span class="keyword">set</span>,<span class="stringliteral">&quot;npoints&quot;</span>,UI::optional)){npoints=100;} 
    200 <a name="l00180"></a>00180                                          
    201 <a name="l00181"></a>00181                                         <span class="comment">//sample</span> 
    202 <a name="l00182"></a>00182                                         <a class="code" href="classbdm_1_1discrete__support.html#ac0cbdb61727406b52ca22332507a9a7c" title="storage of support points">Spoints</a>.set_size(npoints); 
    203 <a name="l00183"></a>00183                                         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0; i&lt;<a class="code" href="classbdm_1_1discrete__support.html#adc3d175266b65168ba3f3a5f568078a1" title="Access function.">points</a>(); i++){<a class="code" href="classbdm_1_1discrete__support.html#ac0cbdb61727406b52ca22332507a9a7c" title="storage of support points">Spoints</a>(i)=ep-&gt;sample();} 
    204 <a name="l00184"></a>00184                                 } 
    205 <a name="l00185"></a>00185                         } 
    206 <a name="l00187"></a><a class="code" href="classbdm_1_1discrete__support.html#a1e9af8da7fa2ac2c03b3cec1d4407b1d">00187</a>                         Array&lt;vec&gt; &amp; <a class="code" href="classbdm_1_1discrete__support.html#a1e9af8da7fa2ac2c03b3cec1d4407b1d" title="access function">_Spoints</a>() {<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1discrete__support.html#ac0cbdb61727406b52ca22332507a9a7c" title="storage of support points">Spoints</a>;} 
    207 <a name="l00188"></a>00188         }; 
    208 <a name="l00189"></a>00189         <a class="code" href="user__info_8h.html#a4f9de2f17e844047726487b99def99c6" title="Macro for registration of class into map of user-infos, registered class is scriptable...">UIREGISTER</a>(discrete_support); 
    209 <a name="l00190"></a>00190          
    210 <a name="l00191"></a><a class="code" href="classbdm_1_1grid__fnc.html">00191</a>         <span class="keyword">class </span><a class="code" href="classbdm_1_1grid__fnc.html">grid_fnc</a>: <span class="keyword">public</span> <a class="code" href="classbdm_1_1fnc.html" title="Class representing function  of variable  represented by rv.">fnc</a>{ 
    211 <a name="l00192"></a>00192                 <span class="keyword">protected</span>: 
    212 <a name="l00193"></a>00193                         <a class="code" href="classbdm_1_1rectangular__support.html">rectangular_support</a> sup; 
    213 <a name="l00194"></a>00194                         vec values; 
    214 <a name="l00195"></a>00195                 <span class="keyword">public</span>: 
    215 <a name="l00197"></a><a class="code" href="classbdm_1_1grid__fnc.html#ab694d146aa19a9801628c105a29ac8bf">00197</a>                         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1grid__fnc.html#ab694d146aa19a9801628c105a29ac8bf" title="constructor function">set_support</a>(<a class="code" href="classbdm_1_1rectangular__support.html">rectangular_support</a> &amp;sup0){sup=sup0; values=zeros(sup.<a class="code" href="classbdm_1_1rectangular__support.html#aa2cc3a7250b969675bc8f9034aa2a7d2" title="Access function.">points</a>());} 
    216 <a name="l00199"></a><a class="code" href="classbdm_1_1grid__fnc.html#acd5fc88472c67e2ddafd3e3dfa5859c0">00199</a>                         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1grid__fnc.html#acd5fc88472c67e2ddafd3e3dfa5859c0" title="constructor function fills values by calling function f , double f(vec&amp;amp;), given...">set_values</a>(<span class="keywordtype">double</span> (*evalptr)(<span class="keyword">const</span> vec&amp;)){ 
    217 <a name="l00200"></a>00200                                 <span class="keywordflow">if</span> (sup.<a class="code" href="classbdm_1_1rectangular__support.html#aa2cc3a7250b969675bc8f9034aa2a7d2" title="Access function.">points</a>()&gt;0){ 
    218 <a name="l00201"></a>00201                                         values(0) = (*evalptr)(sup.<a class="code" href="classbdm_1_1rectangular__support.html#a5e0baba7f6e7dc131e8c9131d37b4f94" title="set the first vector to corner and store result in actvec">first_vec</a>()); 
    219 <a name="l00202"></a>00202                                         <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j=1; j&lt;sup.<a class="code" href="classbdm_1_1rectangular__support.html#aa2cc3a7250b969675bc8f9034aa2a7d2" title="Access function.">points</a>(); j++){  
    220 <a name="l00203"></a>00203                                                 values(j)=(*evalptr)(sup.<a class="code" href="classbdm_1_1rectangular__support.html#aadc4f5bdfd1b6f863cdf7961964eb23f" title="Get next active vector, call ONLY after first_vector()!">next_vec</a>()); 
    221 <a name="l00204"></a>00204                                         } 
    222 <a name="l00205"></a>00205                                 } 
    223 <a name="l00206"></a>00206                         }  
    224 <a name="l00208"></a><a class="code" href="classbdm_1_1grid__fnc.html#a8fb871dcc27b0ac4ba6d2eae3ea484ea">00208</a>                         <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1grid__fnc.html#a8fb871dcc27b0ac4ba6d2eae3ea484ea" title="get value nearest to the given point">nearest_val</a>(<span class="keyword">const</span> vec &amp;val){<span class="keywordflow">return</span> values( sup.<a class="code" href="classbdm_1_1rectangular__support.html#a2ae8ed78cba8e14b5dcc570b51d7d3f0" title="convert dimension indeces into linear index, the indexing is in the same way as in...">linear_index</a>(sup.nearest_point(val)));} 
    225 <a name="l00209"></a>00209                          
    226 <a name="l00210"></a><a class="code" href="classbdm_1_1grid__fnc.html#a8814bad6ae13a11f288e9ad06ef48ee5">00210</a>                         vec <a class="code" href="classbdm_1_1grid__fnc.html#a8814bad6ae13a11f288e9ad06ef48ee5" title="function evaluates numerical value of  at  cond ">eval</a>(<span class="keyword">const</span> vec &amp;val){<span class="keywordflow">return</span> vec_1(<a class="code" href="classbdm_1_1grid__fnc.html#a8fb871dcc27b0ac4ba6d2eae3ea484ea" title="get value nearest to the given point">nearest_val</a>(val));} 
    227 <a name="l00211"></a>00211         }; 
    228 <a name="l00212"></a>00212         <a class="code" href="user__info_8h.html#a4f9de2f17e844047726487b99def99c6" title="Macro for registration of class into map of user-infos, registered class is scriptable...">UIREGISTER</a>(grid_fnc); 
    229 <a name="l00213"></a>00213  
    230 <a name="l00217"></a><a class="code" href="classbdm_1_1egrid.html">00217</a>         <span class="keyword">class </span><a class="code" href="classbdm_1_1egrid.html">egrid</a>: <span class="keyword">public</span> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>{ 
    231 <a name="l00218"></a>00218                 <span class="keyword">protected</span>: 
    232 <a name="l00219"></a>00219                         <a class="code" href="classbdm_1_1rectangular__support.html">rectangular_support</a> sup; 
    233 <a name="l00220"></a>00220                         vec values; 
    234 <a name="l00221"></a>00221                 <span class="keyword">public</span>: 
    235 <a name="l00223"></a><a class="code" href="classbdm_1_1egrid.html#a3a9f0d4f725b189b08990c5997aa57ae">00223</a>                         <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1egrid.html#a3a9f0d4f725b189b08990c5997aa57ae" title="we assume that evallog is not called too often otherwise we should cache log(values)...">evallog</a>(<span class="keyword">const</span> vec &amp;val){<span class="keywordflow">return</span> log(values( sup.<a class="code" href="classbdm_1_1rectangular__support.html#a2ae8ed78cba8e14b5dcc570b51d7d3f0" title="convert dimension indeces into linear index, the indexing is in the same way as in...">linear_index</a>(sup.nearest_point(val))));} 
    236 <a name="l00224"></a>00224                          
    237 <a name="l00225"></a>00225         }; 
    238 <a name="l00226"></a>00226 } 
    239 <a name="l00227"></a>00227 <span class="preprocessor">#endif //DISCR_H</span> 
     68<a name="l00016"></a>00016 <span class="preprocessor">#include "../shared_ptr.h"</span> 
     69<a name="l00017"></a>00017 <span class="preprocessor">#include "../base/bdmbase.h"</span> 
     70<a name="l00018"></a>00018 <span class="preprocessor">#include "../math/chmat.h"</span> 
     71<a name="l00019"></a>00019  
     72<a name="l00020"></a>00020 <span class="keyword">namespace </span>bdm { 
     73<a name="l00021"></a>00021  
     74<a name="l00022"></a>00022 <span class="comment">// Abstract support - pokus, jen diskretni.. takze jmeno discrete support je lepci:)</span> 
     75<a name="l00023"></a>00023 <span class="comment">// ale jediny, co by umel, je first_vec a next_vec, hmm:(</span> 
     76<a name="l00024"></a>00024 <span class="comment">// class support : public root {</span> 
     77<a name="l00025"></a>00025  
     78<a name="l00029"></a><a class="code" href="classbdm_1_1rectangular__support.html">00029</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1rectangular__support.html">rectangular_support</a>: <span class="keyword">public</span> <a class="code" href="classbdm_1_1root.html" title="Root class of BDM objects.">root</a> { 
     79<a name="l00030"></a>00030 <span class="keyword">private</span>: 
     80<a name="l00032"></a>00032         <span class="keywordtype">void</span> initialize(); 
     81<a name="l00033"></a>00033 <span class="keyword">protected</span>: 
     82<a name="l00035"></a><a class="code" href="classbdm_1_1rectangular__support.html#b63e1190a8a22031d110624a8fc64b14">00035</a>         Array&lt;vec&gt; <a class="code" href="classbdm_1_1rectangular__support.html#b63e1190a8a22031d110624a8fc64b14" title="Array of boundaries (2D vectors: [begining,end]) for each dimension.">ranges</a>; 
     83<a name="l00037"></a><a class="code" href="classbdm_1_1rectangular__support.html#efe08427f4bf66191e10b727b57e4b31">00037</a>         ivec <a class="code" href="classbdm_1_1rectangular__support.html#efe08427f4bf66191e10b727b57e4b31" title="Number of support points in each dimension.">gridsizes</a>; 
     84<a name="l00039"></a><a class="code" href="classbdm_1_1rectangular__support.html#442ae2e1881d6bcdccf0cabbef769e79">00039</a>         <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1rectangular__support.html#442ae2e1881d6bcdccf0cabbef769e79" title="dimension">dim</a>; 
     85<a name="l00041"></a><a class="code" href="classbdm_1_1rectangular__support.html#6e55e6243f3a3e451f8bed149d948319">00041</a>         <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1rectangular__support.html#6e55e6243f3a3e451f8bed149d948319" title="Number of data points.">Npoints</a>; 
     86<a name="l00043"></a><a class="code" href="classbdm_1_1rectangular__support.html#e1aa9a4e91c248a29e4e432f4b448197">00043</a>         vec <a class="code" href="classbdm_1_1rectangular__support.html#e1aa9a4e91c248a29e4e432f4b448197" title="active vector for first_vec and next_vec">actvec</a>; 
     87<a name="l00045"></a><a class="code" href="classbdm_1_1rectangular__support.html#744688479a1ab8cf9f80d6f3021d762b">00045</a>         vec <a class="code" href="classbdm_1_1rectangular__support.html#744688479a1ab8cf9f80d6f3021d762b" title="indeces of active vector">actvec_ind</a>; 
     88<a name="l00047"></a><a class="code" href="classbdm_1_1rectangular__support.html#967bfe2eb868409e3e0e6e41dcd63a6a">00047</a>         vec <a class="code" href="classbdm_1_1rectangular__support.html#967bfe2eb868409e3e0e6e41dcd63a6a" title="length of steps in each dimension">steps</a>; 
     89<a name="l00048"></a>00048 <span class="keyword">public</span>: 
     90<a name="l00050"></a><a class="code" href="classbdm_1_1rectangular__support.html#9929645efe5eff3a6b87da8b81e114c4">00050</a>         <a class="code" href="classbdm_1_1rectangular__support.html#9929645efe5eff3a6b87da8b81e114c4" title="default constructor">rectangular_support</a>() : <a class="code" href="classbdm_1_1rectangular__support.html#442ae2e1881d6bcdccf0cabbef769e79" title="dimension">dim</a> ( 0 ), <a class="code" href="classbdm_1_1rectangular__support.html#6e55e6243f3a3e451f8bed149d948319" title="Number of data points.">Npoints</a> ( 0 ) { 
     91<a name="l00051"></a>00051         } 
     92<a name="l00052"></a>00052  
     93<a name="l00054"></a>00054         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1rectangular__support.html#a18272405534f914ee3798f1c4034e51" title="set parameters">set_parameters</a> ( <span class="keyword">const</span> Array&lt;vec&gt; &amp;ranges0, <span class="keyword">const</span> ivec &amp;gridsize0 ); 
     94<a name="l00055"></a>00055  
     95<a name="l00057"></a>00057         vec <a class="code" href="classbdm_1_1rectangular__support.html#2fd69b881ff077e6d3da3e453d7dc418" title="return vector at position given by vector of indeces">get_vec</a> ( <span class="keyword">const</span> ivec &amp;inds ); 
     96<a name="l00058"></a>00058  
     97<a name="l00060"></a>00060         <span class="keywordtype">long</span> <a class="code" href="classbdm_1_1rectangular__support.html#2ae8ed78cba8e14b5dcc570b51d7d3f0" title="convert dimension indeces into linear index, the indexing is in the same way as in...">linear_index</a> ( <span class="keyword">const</span> ivec inds ); 
     98<a name="l00061"></a>00061  
     99<a name="l00063"></a>00063         <span class="keyword">const</span> vec&amp; <a class="code" href="classbdm_1_1rectangular__support.html#6a1d6c127b468b772fd0a7206e2880a3" title="set the first vector to corner and store result in actvec">first_vec</a>(); 
     100<a name="l00064"></a>00064  
     101<a name="l00066"></a>00066         <span class="keyword">const</span> vec&amp; <a class="code" href="classbdm_1_1rectangular__support.html#80f33e406ba1799376537c39fdf7cc97" title="Get next active vector, call ONLY after first_vector()!">next_vec</a>(); 
     102<a name="l00067"></a>00067  
     103<a name="l00069"></a>00069         ivec <a class="code" href="classbdm_1_1rectangular__support.html#0ea90fd6ba65251683c04599b6d094b7">nearest_point</a> ( <span class="keyword">const</span> vec &amp;val ); 
     104<a name="l00070"></a>00070  
     105<a name="l00072"></a><a class="code" href="classbdm_1_1rectangular__support.html#a2cc3a7250b969675bc8f9034aa2a7d2">00072</a>         <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1rectangular__support.html#a2cc3a7250b969675bc8f9034aa2a7d2" title="Access function.">points</a>()<span class="keyword"> const </span>{ 
     106<a name="l00073"></a>00073                 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1rectangular__support.html#6e55e6243f3a3e451f8bed149d948319" title="Number of data points.">Npoints</a>; 
     107<a name="l00074"></a>00074         } 
     108<a name="l00075"></a>00075  
     109<a name="l00078"></a><a class="code" href="classbdm_1_1rectangular__support.html#cfd542382bc959fce9c117b8df5f6e9f">00078</a>         <span class="keyword">const</span> vec&amp; <a class="code" href="classbdm_1_1rectangular__support.html#cfd542382bc959fce9c117b8df5f6e9f">_steps</a>()<span class="keyword"> const </span>{ 
     110<a name="l00079"></a>00079                 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1rectangular__support.html#967bfe2eb868409e3e0e6e41dcd63a6a" title="length of steps in each dimension">steps</a>; 
     111<a name="l00080"></a>00080         } 
     112<a name="l00081"></a>00081  
     113<a name="l00082"></a>00082         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1rectangular__support.html#c8d82bd237cdd4dc50d5fbcc285d80ee" title="This method arrange instance properties according the data stored in the Setting...">from_setting</a> ( <span class="keyword">const</span> Setting &amp;<span class="keyword">set</span> ); 
     114<a name="l00083"></a>00083 }; 
     115<a name="l00084"></a>00084 <a class="code" href="user__info_8h.html#4f9de2f17e844047726487b99def99c6" title="Macro for registration of class into map of user-infos, registered class is scriptable...">UIREGISTER</a> ( rectangular_support ); 
     116<a name="l00085"></a>00085  
     117<a name="l00087"></a><a class="code" href="classbdm_1_1discrete__support.html">00087</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1discrete__support.html" title="Discrete support with stored support points.">discrete_support</a>: <span class="keyword">public</span> <a class="code" href="classbdm_1_1root.html" title="Root class of BDM objects.">root</a> { 
     118<a name="l00088"></a>00088 <span class="keyword">protected</span>: 
     119<a name="l00090"></a><a class="code" href="classbdm_1_1discrete__support.html#c0cbdb61727406b52ca22332507a9a7c">00090</a>         Array&lt;vec&gt; <a class="code" href="classbdm_1_1discrete__support.html#c0cbdb61727406b52ca22332507a9a7c" title="storage of support points">Spoints</a>; 
     120<a name="l00092"></a><a class="code" href="classbdm_1_1discrete__support.html#505284848af521fea33e65368de4845e">00092</a>         <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1discrete__support.html#505284848af521fea33e65368de4845e" title="index in iterators">idx</a>; 
     121<a name="l00093"></a>00093 <span class="keyword">public</span>: 
     122<a name="l00095"></a><a class="code" href="classbdm_1_1discrete__support.html#58d652a1f149a7698f1fee9acd1a78b5">00095</a>         <a class="code" href="classbdm_1_1discrete__support.html#58d652a1f149a7698f1fee9acd1a78b5" title="Default constructor.">discrete_support</a>() : <a class="code" href="classbdm_1_1discrete__support.html#c0cbdb61727406b52ca22332507a9a7c" title="storage of support points">Spoints</a> ( 0 ), <a class="code" href="classbdm_1_1discrete__support.html#505284848af521fea33e65368de4845e" title="index in iterators">idx</a> ( 0 ) {} 
     123<a name="l00097"></a><a class="code" href="classbdm_1_1discrete__support.html#dc3d175266b65168ba3f3a5f568078a1">00097</a>         <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1discrete__support.html#dc3d175266b65168ba3f3a5f568078a1" title="Access function.">points</a>()<span class="keyword"> const </span>{ 
     124<a name="l00098"></a>00098                 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1discrete__support.html#c0cbdb61727406b52ca22332507a9a7c" title="storage of support points">Spoints</a>.length(); 
     125<a name="l00099"></a>00099         } 
     126<a name="l00101"></a><a class="code" href="classbdm_1_1discrete__support.html#26c803791b63916adf301a4a186f01ba">00101</a>         <span class="keyword">const</span> vec&amp; <a class="code" href="classbdm_1_1discrete__support.html#26c803791b63916adf301a4a186f01ba" title="set the first vector to corner and store result in actvec">first_vec</a>() { 
     127<a name="l00102"></a>00102                 <a class="code" href="bdmerror_8h.html#89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> ( <a class="code" href="classbdm_1_1discrete__support.html#c0cbdb61727406b52ca22332507a9a7c" title="storage of support points">Spoints</a>.length() &gt; 0, <span class="stringliteral">"Empty support"</span> ); 
     128<a name="l00103"></a>00103                 <a class="code" href="classbdm_1_1discrete__support.html#505284848af521fea33e65368de4845e" title="index in iterators">idx</a> = 0; 
     129<a name="l00104"></a>00104                 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1discrete__support.html#c0cbdb61727406b52ca22332507a9a7c" title="storage of support points">Spoints</a> ( idx ); 
     130<a name="l00105"></a>00105         } 
     131<a name="l00107"></a><a class="code" href="classbdm_1_1discrete__support.html#368f10fd45443dee5296cc0febb240fb">00107</a>         <span class="keyword">const</span> vec&amp; <a class="code" href="classbdm_1_1discrete__support.html#368f10fd45443dee5296cc0febb240fb" title="set next vector after calling first_vec()">next_vec</a>() { 
     132<a name="l00108"></a>00108                 <a class="code" href="bdmerror_8h.html#89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> ( <a class="code" href="classbdm_1_1discrete__support.html#c0cbdb61727406b52ca22332507a9a7c" title="storage of support points">Spoints</a>.length() &gt; <a class="code" href="classbdm_1_1discrete__support.html#505284848af521fea33e65368de4845e" title="index in iterators">idx</a> - 1, <span class="stringliteral">"Out of support points"</span> ); 
     133<a name="l00109"></a>00109                 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1discrete__support.html#c0cbdb61727406b52ca22332507a9a7c" title="storage of support points">Spoints</a> ( ++<a class="code" href="classbdm_1_1discrete__support.html#505284848af521fea33e65368de4845e" title="index in iterators">idx</a> ); 
     134<a name="l00110"></a>00110         } 
     135<a name="l00111"></a>00111  
     136<a name="l00121"></a>00121         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1discrete__support.html#0c405889b7b76f0852c1b2a222f07aab">from_setting</a> ( <span class="keyword">const</span> Setting &amp;<span class="keyword">set</span> ); 
     137<a name="l00122"></a>00122  
     138<a name="l00124"></a><a class="code" href="classbdm_1_1discrete__support.html#1e9af8da7fa2ac2c03b3cec1d4407b1d">00124</a>         Array&lt;vec&gt; &amp; <a class="code" href="classbdm_1_1discrete__support.html#1e9af8da7fa2ac2c03b3cec1d4407b1d" title="access function">_Spoints</a>() { 
     139<a name="l00125"></a>00125                 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1discrete__support.html#c0cbdb61727406b52ca22332507a9a7c" title="storage of support points">Spoints</a>; 
     140<a name="l00126"></a>00126         } 
     141<a name="l00127"></a>00127 }; 
     142<a name="l00128"></a>00128 <a class="code" href="user__info_8h.html#4f9de2f17e844047726487b99def99c6" title="Macro for registration of class into map of user-infos, registered class is scriptable...">UIREGISTER</a> ( discrete_support ); 
     143<a name="l00129"></a>00129  
     144<a name="l00130"></a>00130 <span class="keyword">class </span>grid_fnc: <span class="keyword">public</span> fnc { 
     145<a name="l00131"></a>00131 <span class="keyword">protected</span>: 
     146<a name="l00132"></a>00132         rectangular_support sup; 
     147<a name="l00133"></a>00133         vec values; 
     148<a name="l00134"></a>00134 <span class="keyword">public</span>: 
     149<a name="l00136"></a>00136         <span class="keywordtype">void</span> set_support ( rectangular_support &amp;sup0 ) { 
     150<a name="l00137"></a>00137                 sup = sup0; 
     151<a name="l00138"></a>00138                 values = zeros ( sup.points() ); 
     152<a name="l00139"></a>00139         } 
     153<a name="l00141"></a>00141         <span class="keywordtype">void</span> set_values ( <span class="keywordtype">double</span> ( *evalptr ) ( <span class="keyword">const</span> vec&amp; ) ); 
     154<a name="l00142"></a>00142  
     155<a name="l00144"></a>00144         <span class="keywordtype">double</span> nearest_val ( <span class="keyword">const</span> vec &amp;val ) { 
     156<a name="l00145"></a>00145                 <span class="keywordflow">return</span> values ( sup.linear_index ( sup.nearest_point ( val ) ) ); 
     157<a name="l00146"></a>00146         } 
     158<a name="l00147"></a>00147  
     159<a name="l00148"></a>00148         vec eval ( <span class="keyword">const</span> vec &amp;val ) { 
     160<a name="l00149"></a>00149                 <span class="keywordflow">return</span> vec_1 ( nearest_val ( val ) ); 
     161<a name="l00150"></a>00150         } 
     162<a name="l00151"></a>00151 }; 
     163<a name="l00152"></a>00152 <a class="code" href="user__info_8h.html#4f9de2f17e844047726487b99def99c6" title="Macro for registration of class into map of user-infos, registered class is scriptable...">UIREGISTER</a> ( grid_fnc ); 
     164<a name="l00153"></a>00153  
     165<a name="l00157"></a><a class="code" href="classbdm_1_1egrid.html">00157</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1egrid.html">egrid</a>: <span class="keyword">public</span> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> { 
     166<a name="l00158"></a>00158 <span class="keyword">protected</span>: 
     167<a name="l00159"></a>00159         <a class="code" href="classbdm_1_1rectangular__support.html">rectangular_support</a> sup; 
     168<a name="l00160"></a>00160         vec values; 
     169<a name="l00161"></a>00161 <span class="keyword">public</span>: 
     170<a name="l00163"></a><a class="code" href="classbdm_1_1egrid.html#3a9f0d4f725b189b08990c5997aa57ae">00163</a>         <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1egrid.html#3a9f0d4f725b189b08990c5997aa57ae" title="we assume that evallog is not called too often otherwise we should cache log(values)...">evallog</a> ( <span class="keyword">const</span> vec &amp;val ) { 
     171<a name="l00164"></a>00164                 <span class="keywordflow">return</span> log ( values ( sup.<a class="code" href="classbdm_1_1rectangular__support.html#2ae8ed78cba8e14b5dcc570b51d7d3f0" title="convert dimension indeces into linear index, the indexing is in the same way as in...">linear_index</a> ( sup.<a class="code" href="classbdm_1_1rectangular__support.html#0ea90fd6ba65251683c04599b6d094b7">nearest_point</a> ( val ) ) ) ); 
     172<a name="l00165"></a>00165         } 
     173<a name="l00166"></a>00166  
     174<a name="l00167"></a>00167 }; 
     175<a name="l00168"></a>00168 } 
     176<a name="l00169"></a>00169 <span class="preprocessor">#endif //DISCR_H</span> 
    240177</pre></div></div> 
    241 <hr size="1"/><address style="text-align: right;"><small>Generated on Sun Sep 27 00:49:04 2009 for mixpp by&nbsp; 
     178<hr size="1"><address style="text-align: right;"><small>Generated on Wed Oct 7 17:34:43 2009 for mixpp by&nbsp; 
    242179<a href="http://www.doxygen.org/index.html"> 
    243 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address> 
     180<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address> 
    244181</body> 
    245182</html>