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: help_functions.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>help_functions.h</h1><a href="help__functions_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 HELP_FUNCTIONS_H</span> |
---|
67 | <a name="l00030"></a>00030 <span class="preprocessor"></span><span class="preprocessor">#define HELP_FUNCTIONS_H</span> |
---|
68 | <a name="l00031"></a>00031 <span class="preprocessor"></span> |
---|
69 | <a name="l00032"></a>00032 <span class="preprocessor">#ifndef _MSC_VER</span> |
---|
70 | <a name="l00033"></a>00033 <span class="preprocessor"></span><span class="preprocessor"># include <itpp/config.h></span> |
---|
71 | <a name="l00034"></a>00034 <span class="preprocessor">#else</span> |
---|
72 | <a name="l00035"></a>00035 <span class="preprocessor"></span><span class="preprocessor"># include <itpp/config_msvc.h></span> |
---|
73 | <a name="l00036"></a>00036 <span class="preprocessor">#endif</span> |
---|
74 | <a name="l00037"></a>00037 <span class="preprocessor"></span> |
---|
75 | <a name="l00038"></a>00038 <span class="preprocessor">#include <<a class="code" href="mat_8h.html" title="Matrix Class Definitions.">itpp/base/mat.h</a>></span> |
---|
76 | <a name="l00039"></a>00039 |
---|
77 | <a name="l00040"></a>00040 |
---|
78 | <a name="l00041"></a>00041 <span class="keyword">namespace </span>itpp |
---|
79 | <a name="l00042"></a>00042 { |
---|
80 | <a name="l00043"></a>00043 |
---|
81 | <a name="l00046"></a>00046 |
---|
82 | <a name="l00048"></a>00048 <span class="keyword">template</span><<span class="keyword">typename</span> T> |
---|
83 | <a name="l00049"></a><a class="code" href="group__miscfunc.html#g58a447d33ada8fe87fefb2b169198c9a">00049</a> <span class="keyword">inline</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(T(*f)(T), <span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a>& v) |
---|
84 | <a name="l00050"></a>00050 { |
---|
85 | <a name="l00051"></a>00051 <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> out(v.<a class="code" href="classitpp_1_1Vec.html#44478ea086eda22a180102e77e352325" title="The size of the vector.">length</a>()); |
---|
86 | <a name="l00052"></a>00052 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < v.<a class="code" href="classitpp_1_1Vec.html#44478ea086eda22a180102e77e352325" title="The size of the vector.">length</a>(); i++) { |
---|
87 | <a name="l00053"></a>00053 out(i) = f(v(i)); |
---|
88 | <a name="l00054"></a>00054 } |
---|
89 | <a name="l00055"></a>00055 <span class="keywordflow">return</span> out; |
---|
90 | <a name="l00056"></a>00056 } |
---|
91 | <a name="l00057"></a>00057 |
---|
92 | <a name="l00059"></a>00059 <span class="keyword">template</span><<span class="keyword">typename</span> T> |
---|
93 | <a name="l00060"></a><a class="code" href="group__miscfunc.html#ga9eb89a8012d1e00a54d4f615916eae6">00060</a> <span class="keyword">inline</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(T(*f)(<span class="keyword">const</span> T&), <span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a>& v) |
---|
94 | <a name="l00061"></a>00061 { |
---|
95 | <a name="l00062"></a>00062 <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> out(v.<a class="code" href="classitpp_1_1Vec.html#44478ea086eda22a180102e77e352325" title="The size of the vector.">length</a>()); |
---|
96 | <a name="l00063"></a>00063 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < v.<a class="code" href="classitpp_1_1Vec.html#44478ea086eda22a180102e77e352325" title="The size of the vector.">length</a>(); i++) { |
---|
97 | <a name="l00064"></a>00064 out(i) = f(v(i)); |
---|
98 | <a name="l00065"></a>00065 } |
---|
99 | <a name="l00066"></a>00066 <span class="keywordflow">return</span> out; |
---|
100 | <a name="l00067"></a>00067 } |
---|
101 | <a name="l00068"></a>00068 |
---|
102 | <a name="l00070"></a>00070 <span class="keyword">template</span><<span class="keyword">typename</span> T> |
---|
103 | <a name="l00071"></a><a class="code" href="group__miscfunc.html#g89be90316a2d1eb70467713ce5b70a80">00071</a> <span class="keyword">inline</span> <a class="code" href="classitpp_1_1Mat.html">Mat<T></a> <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(T(*f)(T), <span class="keyword">const</span> <a class="code" href="classitpp_1_1Mat.html">Mat<T></a>& m) |
---|
104 | <a name="l00072"></a>00072 { |
---|
105 | <a name="l00073"></a>00073 <a class="code" href="classitpp_1_1Mat.html">Mat<T></a> out(m.<a class="code" href="classitpp_1_1Mat.html#f3028609c01e08fb07c5bf0bcd4c4e03" title="The number of rows.">rows</a>(), m.<a class="code" href="classitpp_1_1Mat.html#49680ef454d1d75b737e3ce157f1ac7b" title="The number of columns.">cols</a>()); |
---|
106 | <a name="l00074"></a>00074 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < m.<a class="code" href="classitpp_1_1Mat.html#f3028609c01e08fb07c5bf0bcd4c4e03" title="The number of rows.">rows</a>(); i++) { |
---|
107 | <a name="l00075"></a>00075 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j < m.<a class="code" href="classitpp_1_1Mat.html#49680ef454d1d75b737e3ce157f1ac7b" title="The number of columns.">cols</a>(); j++) { |
---|
108 | <a name="l00076"></a>00076 out(i, j) = f(m(i, j)); |
---|
109 | <a name="l00077"></a>00077 } |
---|
110 | <a name="l00078"></a>00078 } |
---|
111 | <a name="l00079"></a>00079 <span class="keywordflow">return</span> out; |
---|
112 | <a name="l00080"></a>00080 } |
---|
113 | <a name="l00081"></a>00081 |
---|
114 | <a name="l00083"></a>00083 <span class="keyword">template</span><<span class="keyword">typename</span> T> |
---|
115 | <a name="l00084"></a><a class="code" href="group__miscfunc.html#gd0905bcc809adb6ced4ead9fe981d730">00084</a> <span class="keyword">inline</span> <a class="code" href="classitpp_1_1Mat.html">Mat<T></a> <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(T(*f)(<span class="keyword">const</span> T&), <span class="keyword">const</span> <a class="code" href="classitpp_1_1Mat.html">Mat<T></a>& m) |
---|
116 | <a name="l00085"></a>00085 { |
---|
117 | <a name="l00086"></a>00086 <a class="code" href="classitpp_1_1Mat.html">Mat<T></a> out(m.<a class="code" href="classitpp_1_1Mat.html#f3028609c01e08fb07c5bf0bcd4c4e03" title="The number of rows.">rows</a>(), m.<a class="code" href="classitpp_1_1Mat.html#49680ef454d1d75b737e3ce157f1ac7b" title="The number of columns.">cols</a>()); |
---|
118 | <a name="l00087"></a>00087 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < m.<a class="code" href="classitpp_1_1Mat.html#f3028609c01e08fb07c5bf0bcd4c4e03" title="The number of rows.">rows</a>(); i++) { |
---|
119 | <a name="l00088"></a>00088 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j < m.<a class="code" href="classitpp_1_1Mat.html#49680ef454d1d75b737e3ce157f1ac7b" title="The number of columns.">cols</a>(); j++) { |
---|
120 | <a name="l00089"></a>00089 out(i, j) = f(m(i, j)); |
---|
121 | <a name="l00090"></a>00090 } |
---|
122 | <a name="l00091"></a>00091 } |
---|
123 | <a name="l00092"></a>00092 <span class="keywordflow">return</span> out; |
---|
124 | <a name="l00093"></a>00093 } |
---|
125 | <a name="l00094"></a>00094 |
---|
126 | <a name="l00095"></a>00095 |
---|
127 | <a name="l00097"></a>00097 <span class="keyword">template</span><<span class="keyword">typename</span> T> |
---|
128 | <a name="l00098"></a><a class="code" href="group__miscfunc.html#ga69eca3d017adf0fa43bf2088b19fa03">00098</a> <span class="keyword">inline</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(T(*f)(T, T), <span class="keyword">const</span> T& x, <span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a>& v) |
---|
129 | <a name="l00099"></a>00099 { |
---|
130 | <a name="l00100"></a>00100 <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> out(v.<a class="code" href="classitpp_1_1Vec.html#44478ea086eda22a180102e77e352325" title="The size of the vector.">length</a>()); |
---|
131 | <a name="l00101"></a>00101 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < v.<a class="code" href="classitpp_1_1Vec.html#44478ea086eda22a180102e77e352325" title="The size of the vector.">length</a>(); i++) { |
---|
132 | <a name="l00102"></a>00102 out(i) = f(x, v(i)); |
---|
133 | <a name="l00103"></a>00103 } |
---|
134 | <a name="l00104"></a>00104 <span class="keywordflow">return</span> out; |
---|
135 | <a name="l00105"></a>00105 } |
---|
136 | <a name="l00106"></a>00106 |
---|
137 | <a name="l00109"></a>00109 <span class="keyword">template</span><<span class="keyword">typename</span> T> |
---|
138 | <a name="l00110"></a><a class="code" href="group__miscfunc.html#ge4acba669fcc2003c3ea470dd31975d0">00110</a> <span class="keyword">inline</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(T(*f)(<span class="keyword">const</span> T&, <span class="keyword">const</span> T&), <span class="keyword">const</span> T& x, |
---|
139 | <a name="l00111"></a>00111 <span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a>& v) |
---|
140 | <a name="l00112"></a>00112 { |
---|
141 | <a name="l00113"></a>00113 <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> out(v.<a class="code" href="classitpp_1_1Vec.html#44478ea086eda22a180102e77e352325" title="The size of the vector.">length</a>()); |
---|
142 | <a name="l00114"></a>00114 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < v.<a class="code" href="classitpp_1_1Vec.html#44478ea086eda22a180102e77e352325" title="The size of the vector.">length</a>(); i++) { |
---|
143 | <a name="l00115"></a>00115 out(i) = f(x, v(i)); |
---|
144 | <a name="l00116"></a>00116 } |
---|
145 | <a name="l00117"></a>00117 <span class="keywordflow">return</span> out; |
---|
146 | <a name="l00118"></a>00118 } |
---|
147 | <a name="l00119"></a>00119 |
---|
148 | <a name="l00121"></a>00121 <span class="keyword">template</span><<span class="keyword">typename</span> T> |
---|
149 | <a name="l00122"></a><a class="code" href="group__miscfunc.html#g7f70a8f2c85e954ac0a0ba244121caae">00122</a> <span class="keyword">inline</span> <a class="code" href="classitpp_1_1Mat.html">Mat<T></a> <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(T(*f)(T, T), <span class="keyword">const</span> T& x, <span class="keyword">const</span> <a class="code" href="classitpp_1_1Mat.html">Mat<T></a>& m) |
---|
150 | <a name="l00123"></a>00123 { |
---|
151 | <a name="l00124"></a>00124 <a class="code" href="classitpp_1_1Mat.html">Mat<T></a> out(m.<a class="code" href="classitpp_1_1Mat.html#f3028609c01e08fb07c5bf0bcd4c4e03" title="The number of rows.">rows</a>(), m.<a class="code" href="classitpp_1_1Mat.html#49680ef454d1d75b737e3ce157f1ac7b" title="The number of columns.">cols</a>()); |
---|
152 | <a name="l00125"></a>00125 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < m.<a class="code" href="classitpp_1_1Mat.html#f3028609c01e08fb07c5bf0bcd4c4e03" title="The number of rows.">rows</a>(); i++) { |
---|
153 | <a name="l00126"></a>00126 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j < m.<a class="code" href="classitpp_1_1Mat.html#49680ef454d1d75b737e3ce157f1ac7b" title="The number of columns.">cols</a>(); j++) { |
---|
154 | <a name="l00127"></a>00127 out(i, j) = f(x, m(i, j)); |
---|
155 | <a name="l00128"></a>00128 } |
---|
156 | <a name="l00129"></a>00129 } |
---|
157 | <a name="l00130"></a>00130 <span class="keywordflow">return</span> out; |
---|
158 | <a name="l00131"></a>00131 } |
---|
159 | <a name="l00132"></a>00132 |
---|
160 | <a name="l00135"></a>00135 <span class="keyword">template</span><<span class="keyword">typename</span> T> |
---|
161 | <a name="l00136"></a><a class="code" href="group__miscfunc.html#gb0902d075b48cf14479a95c9cbe3e3a1">00136</a> <span class="keyword">inline</span> <a class="code" href="classitpp_1_1Mat.html">Mat<T></a> <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(T(*f)(<span class="keyword">const</span> T&, <span class="keyword">const</span> T&), <span class="keyword">const</span> T& x, |
---|
162 | <a name="l00137"></a>00137 <span class="keyword">const</span> <a class="code" href="classitpp_1_1Mat.html">Mat<T></a>& m) |
---|
163 | <a name="l00138"></a>00138 { |
---|
164 | <a name="l00139"></a>00139 <a class="code" href="classitpp_1_1Mat.html">Mat<T></a> out(m.<a class="code" href="classitpp_1_1Mat.html#f3028609c01e08fb07c5bf0bcd4c4e03" title="The number of rows.">rows</a>(), m.<a class="code" href="classitpp_1_1Mat.html#49680ef454d1d75b737e3ce157f1ac7b" title="The number of columns.">cols</a>()); |
---|
165 | <a name="l00140"></a>00140 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < m.<a class="code" href="classitpp_1_1Mat.html#f3028609c01e08fb07c5bf0bcd4c4e03" title="The number of rows.">rows</a>(); i++) { |
---|
166 | <a name="l00141"></a>00141 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j < m.<a class="code" href="classitpp_1_1Mat.html#49680ef454d1d75b737e3ce157f1ac7b" title="The number of columns.">cols</a>(); j++) { |
---|
167 | <a name="l00142"></a>00142 out(i, j) = f(x, m(i, j)); |
---|
168 | <a name="l00143"></a>00143 } |
---|
169 | <a name="l00144"></a>00144 } |
---|
170 | <a name="l00145"></a>00145 <span class="keywordflow">return</span> out; |
---|
171 | <a name="l00146"></a>00146 } |
---|
172 | <a name="l00147"></a>00147 |
---|
173 | <a name="l00149"></a>00149 <span class="keyword">template</span><<span class="keyword">typename</span> T> |
---|
174 | <a name="l00150"></a><a class="code" href="group__miscfunc.html#g3a44f3a8b77ab7a0a95fd184f83c3b03">00150</a> <span class="keyword">inline</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(T(*f)(T, T), <span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a>& v, <span class="keyword">const</span> T& x) |
---|
175 | <a name="l00151"></a>00151 { |
---|
176 | <a name="l00152"></a>00152 <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> out(v.<a class="code" href="classitpp_1_1Vec.html#44478ea086eda22a180102e77e352325" title="The size of the vector.">length</a>()); |
---|
177 | <a name="l00153"></a>00153 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < v.<a class="code" href="classitpp_1_1Vec.html#44478ea086eda22a180102e77e352325" title="The size of the vector.">length</a>(); i++) { |
---|
178 | <a name="l00154"></a>00154 out(i) = f(v(i), x); |
---|
179 | <a name="l00155"></a>00155 } |
---|
180 | <a name="l00156"></a>00156 <span class="keywordflow">return</span> out; |
---|
181 | <a name="l00157"></a>00157 } |
---|
182 | <a name="l00158"></a>00158 |
---|
183 | <a name="l00161"></a>00161 <span class="keyword">template</span><<span class="keyword">typename</span> T> |
---|
184 | <a name="l00162"></a><a class="code" href="group__miscfunc.html#gd3ae83d37895d852ffc76adbc835e579">00162</a> <span class="keyword">inline</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(T(*f)(<span class="keyword">const</span> T&, <span class="keyword">const</span> T&), <span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<T></a>& v, |
---|
185 | <a name="l00163"></a>00163 <span class="keyword">const</span> T& x) |
---|
186 | <a name="l00164"></a>00164 { |
---|
187 | <a name="l00165"></a>00165 <a class="code" href="classitpp_1_1Vec.html">Vec<T></a> out(v.<a class="code" href="classitpp_1_1Vec.html#44478ea086eda22a180102e77e352325" title="The size of the vector.">length</a>()); |
---|
188 | <a name="l00166"></a>00166 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < v.<a class="code" href="classitpp_1_1Vec.html#44478ea086eda22a180102e77e352325" title="The size of the vector.">length</a>(); i++) { |
---|
189 | <a name="l00167"></a>00167 out(i) = f(v(i), x); |
---|
190 | <a name="l00168"></a>00168 } |
---|
191 | <a name="l00169"></a>00169 <span class="keywordflow">return</span> out; |
---|
192 | <a name="l00170"></a>00170 } |
---|
193 | <a name="l00171"></a>00171 |
---|
194 | <a name="l00173"></a>00173 <span class="keyword">template</span><<span class="keyword">typename</span> T> |
---|
195 | <a name="l00174"></a><a class="code" href="group__miscfunc.html#g8acc00e249ef538afa81051306b3cb3a">00174</a> <span class="keyword">inline</span> <a class="code" href="classitpp_1_1Mat.html">Mat<T></a> <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(T(*f)(T, T), <span class="keyword">const</span> <a class="code" href="classitpp_1_1Mat.html">Mat<T></a>& m, <span class="keyword">const</span> T& x) |
---|
196 | <a name="l00175"></a>00175 { |
---|
197 | <a name="l00176"></a>00176 <a class="code" href="classitpp_1_1Mat.html">Mat<T></a> out(m.<a class="code" href="classitpp_1_1Mat.html#f3028609c01e08fb07c5bf0bcd4c4e03" title="The number of rows.">rows</a>(), m.<a class="code" href="classitpp_1_1Mat.html#49680ef454d1d75b737e3ce157f1ac7b" title="The number of columns.">cols</a>()); |
---|
198 | <a name="l00177"></a>00177 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < m.<a class="code" href="classitpp_1_1Mat.html#f3028609c01e08fb07c5bf0bcd4c4e03" title="The number of rows.">rows</a>(); i++) { |
---|
199 | <a name="l00178"></a>00178 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j < m.<a class="code" href="classitpp_1_1Mat.html#49680ef454d1d75b737e3ce157f1ac7b" title="The number of columns.">cols</a>(); j++) { |
---|
200 | <a name="l00179"></a>00179 out(i, j) = f(m(i, j), x); |
---|
201 | <a name="l00180"></a>00180 } |
---|
202 | <a name="l00181"></a>00181 } |
---|
203 | <a name="l00182"></a>00182 <span class="keywordflow">return</span> out; |
---|
204 | <a name="l00183"></a>00183 } |
---|
205 | <a name="l00184"></a>00184 |
---|
206 | <a name="l00187"></a>00187 <span class="keyword">template</span><<span class="keyword">typename</span> T> |
---|
207 | <a name="l00188"></a><a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016">00188</a> <span class="keyword">inline</span> <a class="code" href="classitpp_1_1Mat.html">Mat<T></a> <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(T(*f)(<span class="keyword">const</span> T&, <span class="keyword">const</span> T&), <span class="keyword">const</span> <a class="code" href="classitpp_1_1Mat.html">Mat<T></a>& m, |
---|
208 | <a name="l00189"></a>00189 <span class="keyword">const</span> T& x) |
---|
209 | <a name="l00190"></a>00190 { |
---|
210 | <a name="l00191"></a>00191 <a class="code" href="classitpp_1_1Mat.html">Mat<T></a> out(m.<a class="code" href="classitpp_1_1Mat.html#f3028609c01e08fb07c5bf0bcd4c4e03" title="The number of rows.">rows</a>(), m.<a class="code" href="classitpp_1_1Mat.html#49680ef454d1d75b737e3ce157f1ac7b" title="The number of columns.">cols</a>()); |
---|
211 | <a name="l00192"></a>00192 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < m.<a class="code" href="classitpp_1_1Mat.html#f3028609c01e08fb07c5bf0bcd4c4e03" title="The number of rows.">rows</a>(); i++) { |
---|
212 | <a name="l00193"></a>00193 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j < m.<a class="code" href="classitpp_1_1Mat.html#49680ef454d1d75b737e3ce157f1ac7b" title="The number of columns.">cols</a>(); j++) { |
---|
213 | <a name="l00194"></a>00194 out(i, j) = f(m(i, j), x); |
---|
214 | <a name="l00195"></a>00195 } |
---|
215 | <a name="l00196"></a>00196 } |
---|
216 | <a name="l00197"></a>00197 <span class="keywordflow">return</span> out; |
---|
217 | <a name="l00198"></a>00198 } |
---|
218 | <a name="l00199"></a>00199 |
---|
219 | <a name="l00201"></a>00201 |
---|
220 | <a name="l00203"></a>00203 |
---|
221 | <a name="l00204"></a>00204 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
222 | <a name="l00205"></a>00205 <span class="comment">// Instantiations</span> |
---|
223 | <a name="l00206"></a>00206 <span class="comment">// ----------------------------------------------------------------------</span> |
---|
224 | <a name="l00207"></a>00207 |
---|
225 | <a name="l00208"></a>00208 <span class="preprocessor">#ifdef HAVE_EXTERN_TEMPLATE</span> |
---|
226 | <a name="l00209"></a>00209 <span class="preprocessor"></span> |
---|
227 | <a name="l00210"></a>00210 <span class="keyword">extern</span> <span class="keyword">template</span> vec <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(<span class="keywordtype">double</span>(*f)(<span class="keywordtype">double</span>), <span class="keyword">const</span> vec &v); |
---|
228 | <a name="l00211"></a>00211 <span class="keyword">extern</span> <span class="keyword">template</span> cvec <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(std::complex<double> (*f)(<span class="keyword">const</span> std::complex<double> &), |
---|
229 | <a name="l00212"></a>00212 <span class="keyword">const</span> cvec &v); |
---|
230 | <a name="l00213"></a>00213 <span class="keyword">extern</span> <span class="keyword">template</span> svec <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(<span class="keywordtype">short</span>(*f)(<span class="keywordtype">short</span>), <span class="keyword">const</span> svec &v); |
---|
231 | <a name="l00214"></a>00214 <span class="keyword">extern</span> <span class="keyword">template</span> ivec <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(<span class="keywordtype">int</span> (*f)(<span class="keywordtype">int</span>), <span class="keyword">const</span> ivec &v); |
---|
232 | <a name="l00215"></a>00215 <span class="keyword">extern</span> <span class="keyword">template</span> bvec <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(bin(*f)(bin), <span class="keyword">const</span> bvec &v); |
---|
233 | <a name="l00216"></a>00216 |
---|
234 | <a name="l00217"></a>00217 <span class="keyword">extern</span> <span class="keyword">template</span> mat <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(<span class="keywordtype">double</span>(*f)(<span class="keywordtype">double</span>), <span class="keyword">const</span> mat &m); |
---|
235 | <a name="l00218"></a>00218 <span class="keyword">extern</span> <span class="keyword">template</span> cmat <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(std::complex<double> (*f)(<span class="keyword">const</span> std::complex<double> &), |
---|
236 | <a name="l00219"></a>00219 <span class="keyword">const</span> cmat &m); |
---|
237 | <a name="l00220"></a>00220 <span class="keyword">extern</span> <span class="keyword">template</span> smat <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(<span class="keywordtype">short</span>(*f)(<span class="keywordtype">short</span>), <span class="keyword">const</span> smat &m); |
---|
238 | <a name="l00221"></a>00221 <span class="keyword">extern</span> <span class="keyword">template</span> imat <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(<span class="keywordtype">int</span> (*f)(<span class="keywordtype">int</span>), <span class="keyword">const</span> imat &m); |
---|
239 | <a name="l00222"></a>00222 <span class="keyword">extern</span> <span class="keyword">template</span> <a class="code" href="mat_8h.html#f90acd1af41bf2d1d8a4bb23662fff69" title="bin matrix">bmat</a> <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(bin(*f)(bin), <span class="keyword">const</span> <a class="code" href="mat_8h.html#f90acd1af41bf2d1d8a4bb23662fff69" title="bin matrix">bmat</a> &m); |
---|
240 | <a name="l00223"></a>00223 |
---|
241 | <a name="l00224"></a>00224 <span class="keyword">extern</span> <span class="keyword">template</span> vec <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(<span class="keywordtype">double</span>(*f)(<span class="keywordtype">double</span>, <span class="keywordtype">double</span>), <span class="keyword">const</span> <span class="keywordtype">double</span>& x, <span class="keyword">const</span> vec &v); |
---|
242 | <a name="l00225"></a>00225 <span class="keyword">extern</span> <span class="keyword">template</span> cvec <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(std::complex<double> (*f)(<span class="keyword">const</span> std::complex<double> &, |
---|
243 | <a name="l00226"></a>00226 <span class="keyword">const</span> std::complex<double> &), |
---|
244 | <a name="l00227"></a>00227 <span class="keyword">const</span> std::complex<double>& x, <span class="keyword">const</span> cvec &v); |
---|
245 | <a name="l00228"></a>00228 <span class="keyword">extern</span> <span class="keyword">template</span> svec <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(<span class="keywordtype">short</span>(*f)(<span class="keywordtype">short</span>, <span class="keywordtype">short</span>), <span class="keyword">const</span> <span class="keywordtype">short</span>& x, <span class="keyword">const</span> svec &v); |
---|
246 | <a name="l00229"></a>00229 <span class="keyword">extern</span> <span class="keyword">template</span> ivec <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(<span class="keywordtype">int</span> (*f)(<span class="keywordtype">int</span>, <span class="keywordtype">int</span>), <span class="keyword">const</span> <span class="keywordtype">int</span>& x, <span class="keyword">const</span> ivec &v); |
---|
247 | <a name="l00230"></a>00230 <span class="keyword">extern</span> <span class="keyword">template</span> bvec <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(bin(*f)(bin, bin), <span class="keyword">const</span> bin& x, <span class="keyword">const</span> bvec &v); |
---|
248 | <a name="l00231"></a>00231 |
---|
249 | <a name="l00232"></a>00232 <span class="keyword">extern</span> <span class="keyword">template</span> mat <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(<span class="keywordtype">double</span>(*f)(<span class="keywordtype">double</span>, <span class="keywordtype">double</span>), <span class="keyword">const</span> <span class="keywordtype">double</span>& x, <span class="keyword">const</span> mat &m); |
---|
250 | <a name="l00233"></a>00233 <span class="keyword">extern</span> <span class="keyword">template</span> cmat <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(std::complex<double> (*f)(<span class="keyword">const</span> std::complex<double> &, |
---|
251 | <a name="l00234"></a>00234 <span class="keyword">const</span> std::complex<double> &), |
---|
252 | <a name="l00235"></a>00235 <span class="keyword">const</span> std::complex<double>& x, <span class="keyword">const</span> cmat &m); |
---|
253 | <a name="l00236"></a>00236 <span class="keyword">extern</span> <span class="keyword">template</span> smat <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(<span class="keywordtype">short</span>(*f)(<span class="keywordtype">short</span>, <span class="keywordtype">short</span>), <span class="keyword">const</span> <span class="keywordtype">short</span>& x, <span class="keyword">const</span> smat &m); |
---|
254 | <a name="l00237"></a>00237 <span class="keyword">extern</span> <span class="keyword">template</span> imat <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(<span class="keywordtype">int</span> (*f)(<span class="keywordtype">int</span>, <span class="keywordtype">int</span>), <span class="keyword">const</span> <span class="keywordtype">int</span>& x, <span class="keyword">const</span> imat &m); |
---|
255 | <a name="l00238"></a>00238 <span class="keyword">extern</span> <span class="keyword">template</span> <a class="code" href="mat_8h.html#f90acd1af41bf2d1d8a4bb23662fff69" title="bin matrix">bmat</a> <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(bin(*f)(bin, bin), <span class="keyword">const</span> bin& x, <span class="keyword">const</span> <a class="code" href="mat_8h.html#f90acd1af41bf2d1d8a4bb23662fff69" title="bin matrix">bmat</a> &m); |
---|
256 | <a name="l00239"></a>00239 |
---|
257 | <a name="l00240"></a>00240 <span class="keyword">extern</span> <span class="keyword">template</span> vec <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(<span class="keywordtype">double</span>(*f)(<span class="keywordtype">double</span>, <span class="keywordtype">double</span>), <span class="keyword">const</span> vec &v, <span class="keyword">const</span> <span class="keywordtype">double</span>& x); |
---|
258 | <a name="l00241"></a>00241 <span class="keyword">extern</span> <span class="keyword">template</span> cvec <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(std::complex<double> (*f)(<span class="keyword">const</span> std::complex<double> &, |
---|
259 | <a name="l00242"></a>00242 <span class="keyword">const</span> std::complex<double> &), |
---|
260 | <a name="l00243"></a>00243 <span class="keyword">const</span> cvec &v, <span class="keyword">const</span> std::complex<double>& x); |
---|
261 | <a name="l00244"></a>00244 <span class="keyword">extern</span> <span class="keyword">template</span> svec <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(<span class="keywordtype">short</span>(*f)(<span class="keywordtype">short</span>, <span class="keywordtype">short</span>), <span class="keyword">const</span> svec &v, <span class="keyword">const</span> <span class="keywordtype">short</span>& x); |
---|
262 | <a name="l00245"></a>00245 <span class="keyword">extern</span> <span class="keyword">template</span> ivec <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(<span class="keywordtype">int</span> (*f)(<span class="keywordtype">int</span>, <span class="keywordtype">int</span>), <span class="keyword">const</span> ivec &v, <span class="keyword">const</span> <span class="keywordtype">int</span>& x); |
---|
263 | <a name="l00246"></a>00246 <span class="keyword">extern</span> <span class="keyword">template</span> bvec <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(bin(*f)(bin, bin), <span class="keyword">const</span> bvec &v, <span class="keyword">const</span> bin& x); |
---|
264 | <a name="l00247"></a>00247 |
---|
265 | <a name="l00248"></a>00248 <span class="keyword">extern</span> <span class="keyword">template</span> mat <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(<span class="keywordtype">double</span>(*f)(<span class="keywordtype">double</span>, <span class="keywordtype">double</span>), <span class="keyword">const</span> mat &m, <span class="keyword">const</span> <span class="keywordtype">double</span>& x); |
---|
266 | <a name="l00249"></a>00249 <span class="keyword">extern</span> <span class="keyword">template</span> cmat <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(std::complex<double> (*f)(<span class="keyword">const</span> std::complex<double> &, |
---|
267 | <a name="l00250"></a>00250 <span class="keyword">const</span> std::complex<double> &), |
---|
268 | <a name="l00251"></a>00251 <span class="keyword">const</span> cmat &m, <span class="keyword">const</span> std::complex<double>& x); |
---|
269 | <a name="l00252"></a>00252 <span class="keyword">extern</span> <span class="keyword">template</span> smat <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(<span class="keywordtype">short</span>(*f)(<span class="keywordtype">short</span>, <span class="keywordtype">short</span>), <span class="keyword">const</span> smat &m, <span class="keyword">const</span> <span class="keywordtype">short</span>& x); |
---|
270 | <a name="l00253"></a>00253 <span class="keyword">extern</span> <span class="keyword">template</span> imat <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(<span class="keywordtype">int</span> (*f)(<span class="keywordtype">int</span>, <span class="keywordtype">int</span>), <span class="keyword">const</span> imat &m, <span class="keyword">const</span> <span class="keywordtype">int</span>& x); |
---|
271 | <a name="l00254"></a>00254 <span class="keyword">extern</span> <span class="keyword">template</span> <a class="code" href="mat_8h.html#f90acd1af41bf2d1d8a4bb23662fff69" title="bin matrix">bmat</a> <a class="code" href="group__miscfunc.html#g9f52faa1a3427abc14ecac23b837e016" title="Help function to call for a function: Mat&lt;T&gt; function(const Mat&lt;T&gt;&amp;...">apply_function</a>(bin(*f)(bin, bin), <span class="keyword">const</span> <a class="code" href="mat_8h.html#f90acd1af41bf2d1d8a4bb23662fff69" title="bin matrix">bmat</a> &m, <span class="keyword">const</span> bin& x); |
---|
272 | <a name="l00255"></a>00255 |
---|
273 | <a name="l00256"></a>00256 <span class="preprocessor">#endif // HAVE_EXTERN_TEMPLATE</span> |
---|
274 | <a name="l00257"></a>00257 <span class="preprocessor"></span> |
---|
275 | <a name="l00259"></a>00259 |
---|
276 | <a name="l00260"></a>00260 } <span class="comment">// namespace itpp</span> |
---|
277 | <a name="l00261"></a>00261 |
---|
278 | <a name="l00262"></a>00262 <span class="preprocessor">#endif // #ifndef HELP_FUNCTIONS_H</span> |
---|
279 | <a name="l00263"></a>00263 <span class="preprocessor"></span> |
---|
280 | </pre></div></div> |
---|
281 | <hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 2 10:02:11 2009 for mixpp by |
---|
282 | <a href="http://www.doxygen.org/index.html"> |
---|
283 | <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address> |
---|
284 | </body> |
---|
285 | </html> |
---|