[353] | 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"> |
---|
| 3 | <title>mixpp: log_exp.h Source File</title> |
---|
| 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.8 --> |
---|
| 8 | <script type="text/javascript"> |
---|
| 9 | <!-- |
---|
| 10 | function changeDisplayState (e){ |
---|
| 11 | var num=this.id.replace(/[^[0-9]/g,''); |
---|
| 12 | var button=this.firstChild; |
---|
| 13 | var sectionDiv=document.getElementById('dynsection'+num); |
---|
| 14 | if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){ |
---|
| 15 | sectionDiv.style.display='block'; |
---|
| 16 | button.src='open.gif'; |
---|
| 17 | }else{ |
---|
| 18 | sectionDiv.style.display='none'; |
---|
| 19 | button.src='closed.gif'; |
---|
| 20 | } |
---|
| 21 | } |
---|
| 22 | function initDynSections(){ |
---|
| 23 | var divs=document.getElementsByTagName('div'); |
---|
| 24 | var sectionCounter=1; |
---|
| 25 | for(var i=0;i<divs.length-1;i++){ |
---|
| 26 | if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){ |
---|
| 27 | var header=divs[i]; |
---|
| 28 | var section=divs[i+1]; |
---|
| 29 | var button=header.firstChild; |
---|
| 30 | if (button!='IMG'){ |
---|
| 31 | divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild); |
---|
| 32 | button=document.createElement('img'); |
---|
| 33 | divs[i].insertBefore(button,divs[i].firstChild); |
---|
| 34 | } |
---|
| 35 | header.style.cursor='pointer'; |
---|
| 36 | header.onclick=changeDisplayState; |
---|
| 37 | header.id='dynheader'+sectionCounter; |
---|
| 38 | button.src='closed.gif'; |
---|
| 39 | section.id='dynsection'+sectionCounter; |
---|
| 40 | section.style.display='none'; |
---|
| 41 | section.style.marginLeft='14px'; |
---|
| 42 | sectionCounter++; |
---|
| 43 | } |
---|
| 44 | } |
---|
| 45 | } |
---|
| 46 | window.onload = initDynSections; |
---|
| 47 | --> |
---|
| 48 | </script> |
---|
| 49 | <div class="navigation" id="top"> |
---|
| 50 | <div class="tabs"> |
---|
| 51 | <ul> |
---|
| 52 | <li><a href="main.html"><span>Main Page</span></a></li> |
---|
| 53 | <li><a href="pages.html"><span>Related Pages</span></a></li> |
---|
| 54 | <li><a href="modules.html"><span>Modules</span></a></li> |
---|
| 55 | <li><a href="annotated.html"><span>Classes</span></a></li> |
---|
| 56 | <li class="current"><a href="files.html"><span>Files</span></a></li> |
---|
| 57 | </ul> |
---|
| 58 | </div> |
---|
| 59 | <div class="tabs"> |
---|
| 60 | <ul> |
---|
| 61 | <li><a href="files.html"><span>File List</span></a></li> |
---|
| 62 | <li><a href="globals.html"><span>File Members</span></a></li> |
---|
| 63 | </ul> |
---|
| 64 | </div> |
---|
| 65 | <h1>log_exp.h</h1><a href="log__exp_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 |
---|
| 66 | <a name="l00029"></a>00029 <span class="preprocessor">#ifndef LOG_EXP_H</span> |
---|
| 67 | <a name="l00030"></a>00030 <span class="preprocessor"></span><span class="preprocessor">#define LOG_EXP_H</span> |
---|
| 68 | <a name="l00031"></a>00031 <span class="preprocessor"></span> |
---|
| 69 | <a name="l00032"></a>00032 <span class="preprocessor">#include <<a class="code" href="itcompat_8h.html" title="IT++ compatibility types and functions.">itpp/base/itcompat.h</a>></span> |
---|
| 70 | <a name="l00033"></a>00033 <span class="preprocessor">#include <<a class="code" href="help__functions_8h.html" title="Help functions to make functions with vec and mat as arguments.">itpp/base/help_functions.h</a>></span> |
---|
| 71 | <a name="l00034"></a>00034 |
---|
| 72 | <a name="l00035"></a>00035 |
---|
| 73 | <a name="l00036"></a>00036 <span class="keyword">namespace </span>itpp |
---|
| 74 | <a name="l00037"></a>00037 { |
---|
| 75 | <a name="l00038"></a>00038 |
---|
| 76 | <a name="l00041"></a>00041 |
---|
| 77 | <a name="l00042"></a>00042 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 78 | <a name="l00043"></a>00043 <span class="comment">// scalar functions</span> |
---|
| 79 | <a name="l00044"></a>00044 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 80 | <a name="l00045"></a>00045 |
---|
| 81 | <a name="l00047"></a><a class="code" href="group__logexpfunc.html#g5275297e979272e5102fa31f0fc782b4">00047</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="group__logexpfunc.html#g913e6b2c337604c5ca8991c020a5ab80" title="log-b of x ">logb</a>(<span class="keywordtype">double</span> b, <span class="keywordtype">double</span> x) |
---|
| 82 | <a name="l00048"></a>00048 { |
---|
| 83 | <a name="l00049"></a>00049 <span class="keywordflow">return</span> (<a class="code" href="group__logexpfunc.html#g320dc9f6d27a6cfe4e149633fd1ea566" title="The natural logarithm of the elements.">std::log</a>(x) / <a class="code" href="group__logexpfunc.html#g320dc9f6d27a6cfe4e149633fd1ea566" title="The natural logarithm of the elements.">std::log</a>(b)); |
---|
| 84 | <a name="l00050"></a>00050 } |
---|
| 85 | <a name="l00051"></a>00051 |
---|
| 86 | <a name="l00053"></a><a class="code" href="group__logexpfunc.html#g44da7c49dc0f990f661404a47e2bf9be">00053</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group__logexpfunc.html#g44da7c49dc0f990f661404a47e2bf9be" title="Calculate two to the power of x (2^x); x is integer.">pow2i</a>(<span class="keywordtype">int</span> x) { <span class="keywordflow">return</span> ((x < 0) ? 0 : (1 << x)); } |
---|
| 87 | <a name="l00055"></a><a class="code" href="group__logexpfunc.html#g84ee8bfb44de3c26fdcb756ecb21d9e9">00055</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="group__logexpfunc.html#g0035dfbd1fcffdb28cadacba42ad8996" title="Calculates two to the power of x (2^x).">pow2</a>(<span class="keywordtype">double</span> x) { <span class="keywordflow">return</span> <a class="code" href="group__logexpfunc.html#g40f48a75172e7f8bc8e58ed54262a04d" title="Calculates x to the power of y (x^y).">pow</a>(2.0, x); } |
---|
| 88 | <a name="l00056"></a>00056 |
---|
| 89 | <a name="l00058"></a><a class="code" href="group__logexpfunc.html#gc5653517728e4837a91131655b4a18da">00058</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="group__logexpfunc.html#g4f390e0a4e938e7d9b98613ad66bdf1c" title="Calculates ten to the power of x (10^x).">pow10</a>(<span class="keywordtype">double</span> x) { <span class="keywordflow">return</span> <a class="code" href="group__logexpfunc.html#g40f48a75172e7f8bc8e58ed54262a04d" title="Calculates x to the power of y (x^y).">pow</a>(10.0, x); } |
---|
| 90 | <a name="l00059"></a>00059 |
---|
| 91 | <a name="l00061"></a><a class="code" href="group__logexpfunc.html#g5c448e69f3678181e108e1caead5c28b">00061</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="group__logexpfunc.html#g03bd0214373c9505ef89b8886746e189" title="Calculates 10*log10(x).">dB</a>(<span class="keywordtype">double</span> x) { <span class="keywordflow">return</span> 10.0 * <a class="code" href="group__logexpfunc.html#gd24b6c9440eaf8851f2a3173df42a19e" title="log-10 of the elements">log10</a>(x); } |
---|
| 92 | <a name="l00063"></a><a class="code" href="group__logexpfunc.html#g9a4a3d1188d2ec6a6815c237bd3ab2cc">00063</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="group__logexpfunc.html#g5b4a5173187ffcd178523d63253bb312" title="Calculates the inverse of dB, 10^(x/10).">inv_dB</a>(<span class="keywordtype">double</span> x) { <span class="keywordflow">return</span> <a class="code" href="group__logexpfunc.html#g40f48a75172e7f8bc8e58ed54262a04d" title="Calculates x to the power of y (x^y).">pow</a>(10.0, 0.1 * x); } |
---|
| 93 | <a name="l00064"></a>00064 |
---|
| 94 | <a name="l00066"></a><a class="code" href="group__logexpfunc.html#g70cf103d3f9443eb852db037115cd709">00066</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group__logexpfunc.html#gdf1b40ed813a44d3ae68bbbae84b45c6" title="Calculate the number of bits needed to represent each inteager in a vector.">int2bits</a>(<span class="keywordtype">int</span> n) |
---|
| 95 | <a name="l00067"></a>00067 { |
---|
| 96 | <a name="l00068"></a>00068 <a class="code" href="group__errorhandlingfunc.html#gd5c34b291e5018534fd2344486e2b5a1" title="Abort if t is not true.">it_assert</a>(n >= 0, <span class="stringliteral">"int2bits(): Improper argument value"</span>); |
---|
| 97 | <a name="l00069"></a>00069 |
---|
| 98 | <a name="l00070"></a>00070 <span class="keywordflow">if</span> (n == 0) |
---|
| 99 | <a name="l00071"></a>00071 <span class="keywordflow">return</span> 1; |
---|
| 100 | <a name="l00072"></a>00072 |
---|
| 101 | <a name="l00073"></a>00073 <span class="keywordtype">int</span> b = 0; |
---|
| 102 | <a name="l00074"></a>00074 <span class="keywordflow">while</span> (n) { |
---|
| 103 | <a name="l00075"></a>00075 n >>= 1; |
---|
| 104 | <a name="l00076"></a>00076 ++b; |
---|
| 105 | <a name="l00077"></a>00077 } |
---|
| 106 | <a name="l00078"></a>00078 <span class="keywordflow">return</span> b; |
---|
| 107 | <a name="l00079"></a>00079 } |
---|
| 108 | <a name="l00080"></a>00080 |
---|
| 109 | <a name="l00082"></a><a class="code" href="group__logexpfunc.html#gef5f3fac5ff2afee6458ea7901323c61">00082</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group__logexpfunc.html#g4a774bd5418520f574eddf730333dada" title="Calculate the number of bits needed to represent a numer of levels saved in a vector...">levels2bits</a>(<span class="keywordtype">int</span> n) |
---|
| 110 | <a name="l00083"></a>00083 { |
---|
| 111 | <a name="l00084"></a>00084 <a class="code" href="group__errorhandlingfunc.html#gd5c34b291e5018534fd2344486e2b5a1" title="Abort if t is not true.">it_assert</a>(n > 0, <span class="stringliteral">"levels2bits(): Improper argument value"</span>); |
---|
| 112 | <a name="l00085"></a>00085 <span class="keywordflow">return</span> <a class="code" href="group__logexpfunc.html#gdf1b40ed813a44d3ae68bbbae84b45c6" title="Calculate the number of bits needed to represent each inteager in a vector.">int2bits</a>(--n); |
---|
| 113 | <a name="l00086"></a>00086 } |
---|
| 114 | <a name="l00087"></a>00087 |
---|
| 115 | <a name="l00089"></a><a class="code" href="group__logexpfunc.html#g88c6cb15374a05289feecb35fdcd20f3">00089</a> <span class="keyword">const</span> <span class="keywordtype">double</span> <a class="code" href="group__logexpfunc.html#g88c6cb15374a05289feecb35fdcd20f3" title="Constant definition to speed up trunc_log() and trunc_exp().">log_double_max</a> = <a class="code" href="group__logexpfunc.html#g320dc9f6d27a6cfe4e149633fd1ea566" title="The natural logarithm of the elements.">std::log</a>(<a class="code" href="group__protocol.html#g3e4e78a5230c444344a135c661163ef2" title="ADD DOCUMENTATION HERE.">std::numeric_limits<double>::max</a>()); |
---|
| 116 | <a name="l00091"></a><a class="code" href="group__logexpfunc.html#g7df3364a77d620d852c447b91dab2c77">00091</a> <span class="keyword">const</span> <span class="keywordtype">double</span> <a class="code" href="group__logexpfunc.html#g7df3364a77d620d852c447b91dab2c77" title="Constant definition to speed up trunc_log(), trunc_exp() and log_add().">log_double_min</a> = <a class="code" href="group__logexpfunc.html#g320dc9f6d27a6cfe4e149633fd1ea566" title="The natural logarithm of the elements.">std::log</a>(<a class="code" href="group__protocol.html#g27dde5be5aac902c0de838b4b872cd2f" title="ADD DOCUMENTATION HERE.">std::numeric_limits<double>::min</a>()); |
---|
| 117 | <a name="l00092"></a>00092 |
---|
| 118 | <a name="l00105"></a><a class="code" href="group__logexpfunc.html#g02907e0ed7d04cde3a43e2a9d00c24c0">00105</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="group__logexpfunc.html#g02907e0ed7d04cde3a43e2a9d00c24c0" title="Truncated natural logarithm function.">trunc_log</a>(<span class="keywordtype">double</span> x) |
---|
| 119 | <a name="l00106"></a>00106 { |
---|
| 120 | <a name="l00107"></a>00107 <span class="keywordflow">if</span> (std::numeric_limits<double>::is_iec559) { |
---|
| 121 | <a name="l00108"></a>00108 <span class="keywordflow">if</span> (x == std::numeric_limits<double>::infinity()) |
---|
| 122 | <a name="l00109"></a>00109 <span class="keywordflow">return</span> <a class="code" href="group__logexpfunc.html#g88c6cb15374a05289feecb35fdcd20f3" title="Constant definition to speed up trunc_log() and trunc_exp().">log_double_max</a>; |
---|
| 123 | <a name="l00110"></a>00110 <span class="keywordflow">if</span> (x <= 0) |
---|
| 124 | <a name="l00111"></a>00111 <span class="keywordflow">return</span> <a class="code" href="group__logexpfunc.html#g7df3364a77d620d852c447b91dab2c77" title="Constant definition to speed up trunc_log(), trunc_exp() and log_add().">log_double_min</a>; |
---|
| 125 | <a name="l00112"></a>00112 } |
---|
| 126 | <a name="l00113"></a>00113 <span class="keywordflow">return</span> <a class="code" href="group__logexpfunc.html#g320dc9f6d27a6cfe4e149633fd1ea566" title="The natural logarithm of the elements.">std::log</a>(x); |
---|
| 127 | <a name="l00114"></a>00114 } |
---|
| 128 | <a name="l00115"></a>00115 |
---|
| 129 | <a name="l00127"></a><a class="code" href="group__logexpfunc.html#ga62c8362aeeb68ba0fc65c99267bd1fd">00127</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="group__logexpfunc.html#ga62c8362aeeb68ba0fc65c99267bd1fd" title="Truncated exponential function.">trunc_exp</a>(<span class="keywordtype">double</span> x) |
---|
| 130 | <a name="l00128"></a>00128 { |
---|
| 131 | <a name="l00129"></a>00129 <span class="keywordflow">if</span> (std::numeric_limits<double>::is_iec559 |
---|
| 132 | <a name="l00130"></a>00130 && (x >= <a class="code" href="group__logexpfunc.html#g88c6cb15374a05289feecb35fdcd20f3" title="Constant definition to speed up trunc_log() and trunc_exp().">log_double_max</a>)) |
---|
| 133 | <a name="l00131"></a>00131 <span class="keywordflow">return</span> <a class="code" href="group__protocol.html#g3e4e78a5230c444344a135c661163ef2" title="ADD DOCUMENTATION HERE.">std::numeric_limits<double>::max</a>(); |
---|
| 134 | <a name="l00132"></a>00132 <span class="keywordflow">return</span> <a class="code" href="group__logexpfunc.html#g7a3da29d4e6a8c814237453086793335" title="Exp of the elements of a complex matrix m.">std::exp</a>(x); |
---|
| 135 | <a name="l00133"></a>00133 } |
---|
| 136 | <a name="l00134"></a>00134 |
---|
| 137 | <a name="l00135"></a>00135 |
---|
| 138 | <a name="l00137"></a><a class="code" href="group__logexpfunc.html#g1b295e7695ab2a3290bfadb26a149304">00137</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="group__logexpfunc.html#g1b295e7695ab2a3290bfadb26a149304" title="Safe substitute for log(exp(log_a) + exp(log_b)).">log_add</a>(<span class="keywordtype">double</span> log_a, <span class="keywordtype">double</span> log_b) |
---|
| 139 | <a name="l00138"></a>00138 { |
---|
| 140 | <a name="l00139"></a>00139 <span class="keywordflow">if</span> (log_a < log_b) { |
---|
| 141 | <a name="l00140"></a>00140 <span class="keywordtype">double</span> tmp = log_a; |
---|
| 142 | <a name="l00141"></a>00141 log_a = log_b; |
---|
| 143 | <a name="l00142"></a>00142 log_b = tmp; |
---|
| 144 | <a name="l00143"></a>00143 } |
---|
| 145 | <a name="l00144"></a>00144 <span class="keywordtype">double</span> negdelta = log_b - log_a; |
---|
| 146 | <a name="l00145"></a>00145 <span class="keywordflow">if</span> ((negdelta < <a class="code" href="group__logexpfunc.html#g7df3364a77d620d852c447b91dab2c77" title="Constant definition to speed up trunc_log(), trunc_exp() and log_add().">log_double_min</a>) || std::isnan(negdelta)) |
---|
| 147 | <a name="l00146"></a>00146 <span class="keywordflow">return</span> log_a; |
---|
| 148 | <a name="l00147"></a>00147 <span class="keywordflow">else</span> |
---|
| 149 | <a name="l00148"></a>00148 <span class="keywordflow">return</span> (log_a + log1p(<a class="code" href="group__logexpfunc.html#g7a3da29d4e6a8c814237453086793335" title="Exp of the elements of a complex matrix m.">std::exp</a>(negdelta))); |
---|
| 150 | <a name="l00149"></a>00149 } |
---|
| 151 | <a name="l00150"></a>00150 |
---|
| 152 | <a name="l00151"></a>00151 |
---|
| 153 | <a name="l00152"></a>00152 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 154 | <a name="l00153"></a>00153 <span class="comment">// functions on vectors and matrices</span> |
---|
| 155 | <a name="l00154"></a>00154 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
| 156 | <a name="l00155"></a>00155 |
---|
| 157 | <a name="l00157"></a><a class="code" href="group__logexpfunc.html#gc1495ce5d82dc54376a5550ccc76df7a">00157</a> <span class="keyword">inline</span> vec <a class="code" href="group__logexpfunc.html#g7a3da29d4e6a8c814237453086793335" title="Exp of the elements of a complex matrix m.">exp</a>(<span class="keyword">const</span> vec &x) |
---|
| 158 | <a name="l00158"></a>00158 { |
---|
| 159 | <a name="l00159"></a>00159 <span class="keywordflow">return</span> apply_function<double>(<a class="code" href="group__logexpfunc.html#g7a3da29d4e6a8c814237453086793335" title="Exp of the elements of a complex matrix m.">std::exp</a>, x); |
---|
| 160 | <a name="l00160"></a>00160 } |
---|
| 161 | <a name="l00162"></a><a class="code" href="group__logexpfunc.html#gd4f099ec6f7ad0489d088d815247829c">00162</a> <span class="keyword">inline</span> cvec <a class="code" href="group__logexpfunc.html#g7a3da29d4e6a8c814237453086793335" title="Exp of the elements of a complex matrix m.">exp</a>(<span class="keyword">const</span> cvec &x) |
---|
| 162 | <a name="l00163"></a>00163 { |
---|
| 163 | <a name="l00164"></a>00164 <span class="keywordflow">return</span> apply_function<std::complex<double> >(<a class="code" href="group__logexpfunc.html#g7a3da29d4e6a8c814237453086793335" title="Exp of the elements of a complex matrix m.">std::exp</a>, x); |
---|
| 164 | <a name="l00165"></a>00165 } |
---|
| 165 | <a name="l00167"></a><a class="code" href="group__logexpfunc.html#g42899b4c00b0b5e703ac8dfe04b18ac1">00167</a> <span class="keyword">inline</span> mat <a class="code" href="group__logexpfunc.html#g7a3da29d4e6a8c814237453086793335" title="Exp of the elements of a complex matrix m.">exp</a>(<span class="keyword">const</span> mat &m) |
---|
| 166 | <a name="l00168"></a>00168 { |
---|
| 167 | <a name="l00169"></a>00169 <span class="keywordflow">return</span> apply_function<double>(<a class="code" href="group__logexpfunc.html#g7a3da29d4e6a8c814237453086793335" title="Exp of the elements of a complex matrix m.">std::exp</a>, m); |
---|
| 168 | <a name="l00170"></a>00170 } |
---|
| 169 | <a name="l00172"></a><a class="code" href="group__logexpfunc.html#g7a3da29d4e6a8c814237453086793335">00172</a> <span class="keyword">inline</span> cmat <a class="code" href="group__logexpfunc.html#g7a3da29d4e6a8c814237453086793335" title="Exp of the elements of a complex matrix m.">exp</a>(<span class="keyword">const</span> cmat &m) |
---|
| 170 | <a name="l00173"></a>00173 { |
---|
| 171 | <a name="l00174"></a>00174 <span class="keywordflow">return</span> apply_function<std::complex<double> >(<a class="code" href="group__logexpfunc.html#g7a3da29d4e6a8c814237453086793335" title="Exp of the elements of a complex matrix m.">std::exp</a>, m); |
---|
| 172 | <a name="l00175"></a>00175 } |
---|
| 173 | <a name="l00176"></a>00176 |
---|
| 174 | <a name="l00178"></a><a class="code" href="group__logexpfunc.html#g0c42d158b1f623f9b72c1ccde7e2fd09">00178</a> <span class="keyword">inline</span> vec <a class="code" href="group__logexpfunc.html#g40f48a75172e7f8bc8e58ed54262a04d" title="Calculates x to the power of y (x^y).">pow</a>(<span class="keyword">const</span> <span class="keywordtype">double</span> x, <span class="keyword">const</span> vec &y) |
---|
| 175 | <a name="l00179"></a>00179 { |
---|
| 176 | <a name="l00180"></a>00180 <span class="keywordflow">return</span> apply_function<double>(<a class="code" href="group__logexpfunc.html#g40f48a75172e7f8bc8e58ed54262a04d" title="Calculates x to the power of y (x^y).">std::pow</a>, x, y); |
---|
| 177 | <a name="l00181"></a>00181 } |
---|
| 178 | <a name="l00183"></a><a class="code" href="group__logexpfunc.html#g0c153229b93549e8a6449327a92c934f">00183</a> <span class="keyword">inline</span> mat <a class="code" href="group__logexpfunc.html#g40f48a75172e7f8bc8e58ed54262a04d" title="Calculates x to the power of y (x^y).">pow</a>(<span class="keyword">const</span> <span class="keywordtype">double</span> x, <span class="keyword">const</span> mat &y) |
---|
| 179 | <a name="l00184"></a>00184 { |
---|
| 180 | <a name="l00185"></a>00185 <span class="keywordflow">return</span> apply_function<double>(<a class="code" href="group__logexpfunc.html#g40f48a75172e7f8bc8e58ed54262a04d" title="Calculates x to the power of y (x^y).">std::pow</a>, x, y); |
---|
| 181 | <a name="l00186"></a>00186 } |
---|
| 182 | <a name="l00188"></a><a class="code" href="group__logexpfunc.html#g9bd8947c2d1056f05812670491668241">00188</a> <span class="keyword">inline</span> vec <a class="code" href="group__logexpfunc.html#g40f48a75172e7f8bc8e58ed54262a04d" title="Calculates x to the power of y (x^y).">pow</a>(<span class="keyword">const</span> vec &x, <span class="keyword">const</span> <span class="keywordtype">double</span> y) |
---|
| 183 | <a name="l00189"></a>00189 { |
---|
| 184 | <a name="l00190"></a>00190 <span class="keywordflow">return</span> apply_function<double>(<a class="code" href="group__logexpfunc.html#g40f48a75172e7f8bc8e58ed54262a04d" title="Calculates x to the power of y (x^y).">std::pow</a>, x, y); |
---|
| 185 | <a name="l00191"></a>00191 } |
---|
| 186 | <a name="l00193"></a><a class="code" href="group__logexpfunc.html#g40f48a75172e7f8bc8e58ed54262a04d">00193</a> <span class="keyword">inline</span> mat <a class="code" href="group__logexpfunc.html#g40f48a75172e7f8bc8e58ed54262a04d" title="Calculates x to the power of y (x^y).">pow</a>(<span class="keyword">const</span> mat &x, <span class="keyword">const</span> <span class="keywordtype">double</span> y) |
---|
| 187 | <a name="l00194"></a>00194 { |
---|
| 188 | <a name="l00195"></a>00195 <span class="keywordflow">return</span> apply_function<double>(<a class="code" href="group__logexpfunc.html#g40f48a75172e7f8bc8e58ed54262a04d" title="Calculates x to the power of y (x^y).">std::pow</a>, x, y); |
---|
| 189 | <a name="l00196"></a>00196 } |
---|
| 190 | <a name="l00197"></a>00197 |
---|
| 191 | <a name="l00199"></a><a class="code" href="group__logexpfunc.html#g054afa4559b8fa4e85e557273bdde7ac">00199</a> <span class="keyword">inline</span> vec <a class="code" href="group__logexpfunc.html#g0035dfbd1fcffdb28cadacba42ad8996" title="Calculates two to the power of x (2^x).">pow2</a>(<span class="keyword">const</span> vec &x) |
---|
| 192 | <a name="l00200"></a>00200 { |
---|
| 193 | <a name="l00201"></a>00201 <span class="keywordflow">return</span> apply_function<double>(<a class="code" href="group__logexpfunc.html#g0035dfbd1fcffdb28cadacba42ad8996" title="Calculates two to the power of x (2^x).">pow2</a>, x); |
---|
| 194 | <a name="l00202"></a>00202 } |
---|
| 195 | <a name="l00204"></a><a class="code" href="group__logexpfunc.html#g0035dfbd1fcffdb28cadacba42ad8996">00204</a> <span class="keyword">inline</span> mat <a class="code" href="group__logexpfunc.html#g0035dfbd1fcffdb28cadacba42ad8996" title="Calculates two to the power of x (2^x).">pow2</a>(<span class="keyword">const</span> mat &x) |
---|
| 196 | <a name="l00205"></a>00205 { |
---|
| 197 | <a name="l00206"></a>00206 <span class="keywordflow">return</span> apply_function<double>(<a class="code" href="group__logexpfunc.html#g0035dfbd1fcffdb28cadacba42ad8996" title="Calculates two to the power of x (2^x).">pow2</a>, x); |
---|
| 198 | <a name="l00207"></a>00207 } |
---|
| 199 | <a name="l00208"></a>00208 |
---|
| 200 | <a name="l00210"></a><a class="code" href="group__logexpfunc.html#ge702eea92311fe090faebc2ec9501854">00210</a> <span class="keyword">inline</span> vec <a class="code" href="group__logexpfunc.html#g4f390e0a4e938e7d9b98613ad66bdf1c" title="Calculates ten to the power of x (10^x).">pow10</a>(<span class="keyword">const</span> vec &x) |
---|
| 201 | <a name="l00211"></a>00211 { |
---|
| 202 | <a name="l00212"></a>00212 <span class="keywordflow">return</span> apply_function<double>(<a class="code" href="group__logexpfunc.html#g4f390e0a4e938e7d9b98613ad66bdf1c" title="Calculates ten to the power of x (10^x).">pow10</a>, x); |
---|
| 203 | <a name="l00213"></a>00213 } |
---|
| 204 | <a name="l00215"></a><a class="code" href="group__logexpfunc.html#g4f390e0a4e938e7d9b98613ad66bdf1c">00215</a> <span class="keyword">inline</span> mat <a class="code" href="group__logexpfunc.html#g4f390e0a4e938e7d9b98613ad66bdf1c" title="Calculates ten to the power of x (10^x).">pow10</a>(<span class="keyword">const</span> mat &x) |
---|
| 205 | <a name="l00216"></a>00216 { |
---|
| 206 | <a name="l00217"></a>00217 <span class="keywordflow">return</span> apply_function<double>(<a class="code" href="group__logexpfunc.html#g4f390e0a4e938e7d9b98613ad66bdf1c" title="Calculates ten to the power of x (10^x).">pow10</a>, x); |
---|
| 207 | <a name="l00218"></a>00218 } |
---|
| 208 | <a name="l00219"></a>00219 |
---|
| 209 | <a name="l00221"></a><a class="code" href="group__logexpfunc.html#g60e39caa21db1b5f9f6006cf7508fbcb">00221</a> <span class="keyword">inline</span> vec <a class="code" href="group__logexpfunc.html#g320dc9f6d27a6cfe4e149633fd1ea566" title="The natural logarithm of the elements.">log</a>(<span class="keyword">const</span> vec &x) |
---|
| 210 | <a name="l00222"></a>00222 { |
---|
| 211 | <a name="l00223"></a>00223 <span class="keywordflow">return</span> apply_function<double>(<a class="code" href="group__logexpfunc.html#g320dc9f6d27a6cfe4e149633fd1ea566" title="The natural logarithm of the elements.">std::log</a>, x); |
---|
| 212 | <a name="l00224"></a>00224 } |
---|
| 213 | <a name="l00226"></a><a class="code" href="group__logexpfunc.html#g83350f223110246183d90254a7933c75">00226</a> <span class="keyword">inline</span> mat <a class="code" href="group__logexpfunc.html#g320dc9f6d27a6cfe4e149633fd1ea566" title="The natural logarithm of the elements.">log</a>(<span class="keyword">const</span> mat &x) |
---|
| 214 | <a name="l00227"></a>00227 { |
---|
| 215 | <a name="l00228"></a>00228 <span class="keywordflow">return</span> apply_function<double>(<a class="code" href="group__logexpfunc.html#g320dc9f6d27a6cfe4e149633fd1ea566" title="The natural logarithm of the elements.">std::log</a>, x); |
---|
| 216 | <a name="l00229"></a>00229 } |
---|
| 217 | <a name="l00231"></a><a class="code" href="group__logexpfunc.html#gc4c7043d21d91e79409c75a732b14c3a">00231</a> <span class="keyword">inline</span> cvec <a class="code" href="group__logexpfunc.html#g320dc9f6d27a6cfe4e149633fd1ea566" title="The natural logarithm of the elements.">log</a>(<span class="keyword">const</span> cvec &x) |
---|
| 218 | <a name="l00232"></a>00232 { |
---|
| 219 | <a name="l00233"></a>00233 <span class="keywordflow">return</span> apply_function<std::complex<double> >(<a class="code" href="group__logexpfunc.html#g320dc9f6d27a6cfe4e149633fd1ea566" title="The natural logarithm of the elements.">std::log</a>, x); |
---|
| 220 | <a name="l00234"></a>00234 } |
---|
| 221 | <a name="l00236"></a><a class="code" href="group__logexpfunc.html#g320dc9f6d27a6cfe4e149633fd1ea566">00236</a> <span class="keyword">inline</span> cmat <a class="code" href="group__logexpfunc.html#g320dc9f6d27a6cfe4e149633fd1ea566" title="The natural logarithm of the elements.">log</a>(<span class="keyword">const</span> cmat &x) |
---|
| 222 | <a name="l00237"></a>00237 { |
---|
| 223 | <a name="l00238"></a>00238 <span class="keywordflow">return</span> apply_function<std::complex<double> >(<a class="code" href="group__logexpfunc.html#g320dc9f6d27a6cfe4e149633fd1ea566" title="The natural logarithm of the elements.">std::log</a>, x); |
---|
| 224 | <a name="l00239"></a>00239 } |
---|
| 225 | <a name="l00240"></a>00240 |
---|
| 226 | <a name="l00242"></a><a class="code" href="group__logexpfunc.html#gbaf1eabe626389b5a4aca26b6ef0d86f">00242</a> <span class="keyword">inline</span> vec <a class="code" href="group__logexpfunc.html#gd50278d885a02a1448976186bb4ad5cd" title="log-2 of the elements">log2</a>(<span class="keyword">const</span> vec &x) |
---|
| 227 | <a name="l00243"></a>00243 { |
---|
| 228 | <a name="l00244"></a>00244 <span class="keywordflow">return</span> apply_function<double>(<a class="code" href="group__logexpfunc.html#gd50278d885a02a1448976186bb4ad5cd" title="log-2 of the elements">::log2</a>, x); |
---|
| 229 | <a name="l00245"></a>00245 } |
---|
| 230 | <a name="l00247"></a><a class="code" href="group__logexpfunc.html#gd50278d885a02a1448976186bb4ad5cd">00247</a> <span class="keyword">inline</span> mat <a class="code" href="group__logexpfunc.html#gd50278d885a02a1448976186bb4ad5cd" title="log-2 of the elements">log2</a>(<span class="keyword">const</span> mat &x) |
---|
| 231 | <a name="l00248"></a>00248 { |
---|
| 232 | <a name="l00249"></a>00249 <span class="keywordflow">return</span> apply_function<double>(<a class="code" href="group__logexpfunc.html#gd50278d885a02a1448976186bb4ad5cd" title="log-2 of the elements">::log2</a>, x); |
---|
| 233 | <a name="l00250"></a>00250 } |
---|
| 234 | <a name="l00251"></a>00251 |
---|
| 235 | <a name="l00253"></a><a class="code" href="group__logexpfunc.html#gfc3c7f9e5088c92dff4b569bed1634a8">00253</a> <span class="keyword">inline</span> vec <a class="code" href="group__logexpfunc.html#gd24b6c9440eaf8851f2a3173df42a19e" title="log-10 of the elements">log10</a>(<span class="keyword">const</span> vec &x) |
---|
| 236 | <a name="l00254"></a>00254 { |
---|
| 237 | <a name="l00255"></a>00255 <span class="keywordflow">return</span> apply_function<double>(<a class="code" href="group__logexpfunc.html#gd24b6c9440eaf8851f2a3173df42a19e" title="log-10 of the elements">std::log10</a>, x); |
---|
| 238 | <a name="l00256"></a>00256 } |
---|
| 239 | <a name="l00258"></a><a class="code" href="group__logexpfunc.html#gd24b6c9440eaf8851f2a3173df42a19e">00258</a> <span class="keyword">inline</span> mat <a class="code" href="group__logexpfunc.html#gd24b6c9440eaf8851f2a3173df42a19e" title="log-10 of the elements">log10</a>(<span class="keyword">const</span> mat &x) |
---|
| 240 | <a name="l00259"></a>00259 { |
---|
| 241 | <a name="l00260"></a>00260 <span class="keywordflow">return</span> apply_function<double>(<a class="code" href="group__logexpfunc.html#gd24b6c9440eaf8851f2a3173df42a19e" title="log-10 of the elements">std::log10</a>, x); |
---|
| 242 | <a name="l00261"></a>00261 } |
---|
| 243 | <a name="l00262"></a>00262 |
---|
| 244 | <a name="l00264"></a><a class="code" href="group__logexpfunc.html#gd0b12b1902cf38b354520884ac18429e">00264</a> <span class="keyword">inline</span> vec <a class="code" href="group__logexpfunc.html#g913e6b2c337604c5ca8991c020a5ab80" title="log-b of x ">logb</a>(<span class="keywordtype">double</span> b, <span class="keyword">const</span> vec &x) |
---|
| 245 | <a name="l00265"></a>00265 { |
---|
| 246 | <a name="l00266"></a>00266 <span class="keywordflow">return</span> apply_function<double>(<a class="code" href="group__logexpfunc.html#g913e6b2c337604c5ca8991c020a5ab80" title="log-b of x ">itpp::logb</a>, b, x); |
---|
| 247 | <a name="l00267"></a>00267 } |
---|
| 248 | <a name="l00269"></a><a class="code" href="group__logexpfunc.html#g913e6b2c337604c5ca8991c020a5ab80">00269</a> <span class="keyword">inline</span> mat <a class="code" href="group__logexpfunc.html#g913e6b2c337604c5ca8991c020a5ab80" title="log-b of x ">logb</a>(<span class="keywordtype">double</span> b, <span class="keyword">const</span> mat &x) |
---|
| 249 | <a name="l00270"></a>00270 { |
---|
| 250 | <a name="l00271"></a>00271 <span class="keywordflow">return</span> apply_function<double>(<a class="code" href="group__logexpfunc.html#g913e6b2c337604c5ca8991c020a5ab80" title="log-b of x ">itpp::logb</a>, b, x); |
---|
| 251 | <a name="l00272"></a>00272 } |
---|
| 252 | <a name="l00273"></a>00273 |
---|
| 253 | <a name="l00275"></a><a class="code" href="group__logexpfunc.html#gf6a9b19ce9cb64c65199b3148b1b0469">00275</a> <span class="keyword">inline</span> vec <a class="code" href="group__logexpfunc.html#g03bd0214373c9505ef89b8886746e189" title="Calculates 10*log10(x).">dB</a>(<span class="keyword">const</span> vec &x) |
---|
| 254 | <a name="l00276"></a>00276 { |
---|
| 255 | <a name="l00277"></a>00277 <span class="keywordflow">return</span> apply_function<double>(<a class="code" href="group__logexpfunc.html#g03bd0214373c9505ef89b8886746e189" title="Calculates 10*log10(x).">dB</a>, x); |
---|
| 256 | <a name="l00278"></a>00278 } |
---|
| 257 | <a name="l00280"></a><a class="code" href="group__logexpfunc.html#g03bd0214373c9505ef89b8886746e189">00280</a> <span class="keyword">inline</span> mat <a class="code" href="group__logexpfunc.html#g03bd0214373c9505ef89b8886746e189" title="Calculates 10*log10(x).">dB</a>(<span class="keyword">const</span> mat &x) |
---|
| 258 | <a name="l00281"></a>00281 { |
---|
| 259 | <a name="l00282"></a>00282 <span class="keywordflow">return</span> apply_function<double>(<a class="code" href="group__logexpfunc.html#g03bd0214373c9505ef89b8886746e189" title="Calculates 10*log10(x).">dB</a>, x); |
---|
| 260 | <a name="l00283"></a>00283 } |
---|
| 261 | <a name="l00284"></a>00284 |
---|
| 262 | <a name="l00286"></a><a class="code" href="group__logexpfunc.html#g250b6ec368bc12844492285a7bb6ed94">00286</a> <span class="keyword">inline</span> vec <a class="code" href="group__logexpfunc.html#g5b4a5173187ffcd178523d63253bb312" title="Calculates the inverse of dB, 10^(x/10).">inv_dB</a>(<span class="keyword">const</span> vec &x) |
---|
| 263 | <a name="l00287"></a>00287 { |
---|
| 264 | <a name="l00288"></a>00288 <span class="keywordflow">return</span> apply_function<double>(<a class="code" href="group__logexpfunc.html#g5b4a5173187ffcd178523d63253bb312" title="Calculates the inverse of dB, 10^(x/10).">inv_dB</a>, x); |
---|
| 265 | <a name="l00289"></a>00289 } |
---|
| 266 | <a name="l00291"></a><a class="code" href="group__logexpfunc.html#g5b4a5173187ffcd178523d63253bb312">00291</a> <span class="keyword">inline</span> mat <a class="code" href="group__logexpfunc.html#g5b4a5173187ffcd178523d63253bb312" title="Calculates the inverse of dB, 10^(x/10).">inv_dB</a>(<span class="keyword">const</span> mat &x) |
---|
| 267 | <a name="l00292"></a>00292 { |
---|
| 268 | <a name="l00293"></a>00293 <span class="keywordflow">return</span> apply_function<double>(<a class="code" href="group__logexpfunc.html#g5b4a5173187ffcd178523d63253bb312" title="Calculates the inverse of dB, 10^(x/10).">inv_dB</a>, x); |
---|
| 269 | <a name="l00294"></a>00294 } |
---|
| 270 | <a name="l00295"></a>00295 |
---|
| 271 | <a name="l00297"></a><a class="code" href="group__logexpfunc.html#gdf1b40ed813a44d3ae68bbbae84b45c6">00297</a> <span class="keyword">inline</span> ivec <a class="code" href="group__logexpfunc.html#gdf1b40ed813a44d3ae68bbbae84b45c6" title="Calculate the number of bits needed to represent each inteager in a vector.">int2bits</a>(<span class="keyword">const</span> ivec& v) |
---|
| 272 | <a name="l00298"></a>00298 { |
---|
| 273 | <a name="l00299"></a>00299 <span class="keywordflow">return</span> apply_function<int>(<a class="code" href="group__logexpfunc.html#gdf1b40ed813a44d3ae68bbbae84b45c6" title="Calculate the number of bits needed to represent each inteager in a vector.">int2bits</a>, v); |
---|
| 274 | <a name="l00300"></a>00300 } |
---|
| 275 | <a name="l00301"></a>00301 |
---|
| 276 | <a name="l00303"></a><a class="code" href="group__logexpfunc.html#g4a774bd5418520f574eddf730333dada">00303</a> <span class="keyword">inline</span> ivec <a class="code" href="group__logexpfunc.html#g4a774bd5418520f574eddf730333dada" title="Calculate the number of bits needed to represent a numer of levels saved in a vector...">levels2bits</a>(<span class="keyword">const</span> ivec& v) |
---|
| 277 | <a name="l00304"></a>00304 { |
---|
| 278 | <a name="l00305"></a>00305 <span class="keywordflow">return</span> apply_function<int>(<a class="code" href="group__logexpfunc.html#g4a774bd5418520f574eddf730333dada" title="Calculate the number of bits needed to represent a numer of levels saved in a vector...">levels2bits</a>, v); |
---|
| 279 | <a name="l00306"></a>00306 } |
---|
| 280 | <a name="l00307"></a>00307 |
---|
| 281 | <a name="l00309"></a>00309 |
---|
| 282 | <a name="l00310"></a>00310 } <span class="comment">// namespace itpp</span> |
---|
| 283 | <a name="l00311"></a>00311 |
---|
| 284 | <a name="l00312"></a>00312 <span class="preprocessor">#endif // #ifndef LOG_EXP_H</span> |
---|
| 285 | <a name="l00313"></a>00313 <span class="preprocessor"></span> |
---|
| 286 | <a name="l00314"></a>00314 |
---|
| 287 | <a name="l00315"></a>00315 |
---|
| 288 | <a name="l00316"></a>00316 |
---|
| 289 | </pre></div></div> |
---|
| 290 | <hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 2 10:02:12 2009 for mixpp by |
---|
| 291 | <a href="http://www.doxygen.org/index.html"> |
---|
| 292 | <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address> |
---|
| 293 | </body> |
---|
| 294 | </html> |
---|