Mercurial > octave-nkf
comparison src/DLD-FUNCTIONS/fftw.cc @ 10154:40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 20 Jan 2010 17:33:41 -0500 |
parents | 0ce82753dd72 |
children | 89f4d7e294cc |
comparison
equal
deleted
inserted
replaced
10153:2c28f9d0360f | 10154:40dfc0c99116 |
---|---|
125 if (args(0).is_string ()) | 125 if (args(0).is_string ()) |
126 { | 126 { |
127 std::string arg0 = args(0).string_value (); | 127 std::string arg0 = args(0).string_value (); |
128 | 128 |
129 if (!error_state) | 129 if (!error_state) |
130 { | 130 { |
131 // Use STL function to convert to lower case | 131 // Use STL function to convert to lower case |
132 std::transform (arg0.begin (), arg0.end (), arg0.begin (), tolower); | 132 std::transform (arg0.begin (), arg0.end (), arg0.begin (), tolower); |
133 | 133 |
134 if (nargin == 2) | 134 if (nargin == 2) |
135 { | 135 { |
136 std::string arg1 = args(1).string_value (); | 136 std::string arg1 = args(1).string_value (); |
137 if (!error_state) | 137 if (!error_state) |
138 { | 138 { |
139 if (arg0 == "planner") | 139 if (arg0 == "planner") |
140 { | 140 { |
141 std::transform (arg1.begin (), arg1.end (), | 141 std::transform (arg1.begin (), arg1.end (), |
142 arg1.begin (), tolower); | 142 arg1.begin (), tolower); |
143 octave_fftw_planner::FftwMethod meth | 143 octave_fftw_planner::FftwMethod meth |
144 = octave_fftw_planner::UNKNOWN; | 144 = octave_fftw_planner::UNKNOWN; |
145 octave_float_fftw_planner::FftwMethod methf | 145 octave_float_fftw_planner::FftwMethod methf |
146 = octave_float_fftw_planner::UNKNOWN; | 146 = octave_float_fftw_planner::UNKNOWN; |
147 | 147 |
148 if (arg1 == "estimate") | 148 if (arg1 == "estimate") |
149 { | 149 { |
150 meth = octave_fftw_planner::ESTIMATE; | 150 meth = octave_fftw_planner::ESTIMATE; |
151 methf = octave_float_fftw_planner::ESTIMATE; | 151 methf = octave_float_fftw_planner::ESTIMATE; |
152 } | 152 } |
153 else if (arg1 == "measure") | 153 else if (arg1 == "measure") |
154 { | 154 { |
155 meth = octave_fftw_planner::MEASURE; | 155 meth = octave_fftw_planner::MEASURE; |
156 methf = octave_float_fftw_planner::MEASURE; | 156 methf = octave_float_fftw_planner::MEASURE; |
157 } | 157 } |
158 else if (arg1 == "patient") | 158 else if (arg1 == "patient") |
159 { | 159 { |
160 meth = octave_fftw_planner::PATIENT; | 160 meth = octave_fftw_planner::PATIENT; |
161 methf = octave_float_fftw_planner::PATIENT; | 161 methf = octave_float_fftw_planner::PATIENT; |
162 } | 162 } |
163 else if (arg1 == "exhaustive") | 163 else if (arg1 == "exhaustive") |
164 { | 164 { |
165 meth = octave_fftw_planner::EXHAUSTIVE; | 165 meth = octave_fftw_planner::EXHAUSTIVE; |
166 methf = octave_float_fftw_planner::EXHAUSTIVE; | 166 methf = octave_float_fftw_planner::EXHAUSTIVE; |
167 } | 167 } |
168 else if (arg1 == "hybrid") | 168 else if (arg1 == "hybrid") |
169 { | 169 { |
170 meth = octave_fftw_planner::HYBRID; | 170 meth = octave_fftw_planner::HYBRID; |
171 methf = octave_float_fftw_planner::HYBRID; | 171 methf = octave_float_fftw_planner::HYBRID; |
172 } | 172 } |
173 else | 173 else |
174 error ("unrecognized planner method"); | 174 error ("unrecognized planner method"); |
175 | 175 |
176 if (!error_state) | 176 if (!error_state) |
177 { | 177 { |
178 meth = octave_fftw_planner::method (meth); | 178 meth = octave_fftw_planner::method (meth); |
179 octave_float_fftw_planner::method (methf); | 179 octave_float_fftw_planner::method (methf); |
180 | 180 |
181 if (meth == octave_fftw_planner::MEASURE) | 181 if (meth == octave_fftw_planner::MEASURE) |
182 retval = octave_value ("measure"); | 182 retval = octave_value ("measure"); |
183 else if (meth == octave_fftw_planner::PATIENT) | 183 else if (meth == octave_fftw_planner::PATIENT) |
184 retval = octave_value ("patient"); | 184 retval = octave_value ("patient"); |
185 else if (meth == octave_fftw_planner::EXHAUSTIVE) | 185 else if (meth == octave_fftw_planner::EXHAUSTIVE) |
186 retval = octave_value ("exhaustive"); | 186 retval = octave_value ("exhaustive"); |
187 else if (meth == octave_fftw_planner::HYBRID) | 187 else if (meth == octave_fftw_planner::HYBRID) |
188 retval = octave_value ("hybrid"); | 188 retval = octave_value ("hybrid"); |
189 else | 189 else |
190 retval = octave_value ("estimate"); | 190 retval = octave_value ("estimate"); |
191 } | 191 } |
192 } | 192 } |
193 else if (arg0 == "dwisdom") | 193 else if (arg0 == "dwisdom") |
194 { | 194 { |
195 char *str = fftw_export_wisdom_to_string (); | 195 char *str = fftw_export_wisdom_to_string (); |
196 | 196 |
197 if (arg1.length() < 1) | 197 if (arg1.length() < 1) |
198 fftw_forget_wisdom (); | 198 fftw_forget_wisdom (); |
199 else if (! fftw_import_wisdom_from_string (arg1.c_str())) | 199 else if (! fftw_import_wisdom_from_string (arg1.c_str())) |
200 error ("could not import supplied wisdom"); | 200 error ("could not import supplied wisdom"); |
201 | 201 |
202 if (!error_state) | 202 if (!error_state) |
203 retval = octave_value (std::string (str)); | 203 retval = octave_value (std::string (str)); |
204 | 204 |
205 free (str); | 205 free (str); |
206 } | 206 } |
207 else if (arg0 == "swisdom") | 207 else if (arg0 == "swisdom") |
208 { | 208 { |
209 char *str = fftwf_export_wisdom_to_string (); | 209 char *str = fftwf_export_wisdom_to_string (); |
210 | 210 |
211 if (arg1.length() < 1) | 211 if (arg1.length() < 1) |
212 fftwf_forget_wisdom (); | 212 fftwf_forget_wisdom (); |
213 else if (! fftwf_import_wisdom_from_string (arg1.c_str())) | 213 else if (! fftwf_import_wisdom_from_string (arg1.c_str())) |
214 error ("could not import supplied wisdom"); | 214 error ("could not import supplied wisdom"); |
215 | 215 |
216 if (!error_state) | 216 if (!error_state) |
217 retval = octave_value (std::string (str)); | 217 retval = octave_value (std::string (str)); |
218 | 218 |
219 free (str); | 219 free (str); |
220 } | 220 } |
221 else | 221 else |
222 error ("unrecognized argument"); | 222 error ("unrecognized argument"); |
223 } | 223 } |
224 } | 224 } |
225 else | 225 else |
226 { | 226 { |
227 if (arg0 == "planner") | 227 if (arg0 == "planner") |
228 { | 228 { |
229 octave_fftw_planner::FftwMethod meth = | 229 octave_fftw_planner::FftwMethod meth = |
230 octave_fftw_planner::method (); | 230 octave_fftw_planner::method (); |
231 | 231 |
232 if (meth == octave_fftw_planner::MEASURE) | 232 if (meth == octave_fftw_planner::MEASURE) |
233 retval = octave_value ("measure"); | 233 retval = octave_value ("measure"); |
234 else if (meth == octave_fftw_planner::PATIENT) | 234 else if (meth == octave_fftw_planner::PATIENT) |
235 retval = octave_value ("patient"); | 235 retval = octave_value ("patient"); |
236 else if (meth == octave_fftw_planner::EXHAUSTIVE) | 236 else if (meth == octave_fftw_planner::EXHAUSTIVE) |
237 retval = octave_value ("exhaustive"); | 237 retval = octave_value ("exhaustive"); |
238 else if (meth == octave_fftw_planner::HYBRID) | 238 else if (meth == octave_fftw_planner::HYBRID) |
239 retval = octave_value ("hybrid"); | 239 retval = octave_value ("hybrid"); |
240 else | 240 else |
241 retval = octave_value ("estimate"); | 241 retval = octave_value ("estimate"); |
242 } | 242 } |
243 else if (arg0 == "dwisdom") | 243 else if (arg0 == "dwisdom") |
244 { | 244 { |
245 char *str = fftw_export_wisdom_to_string (); | 245 char *str = fftw_export_wisdom_to_string (); |
246 retval = octave_value (std::string (str)); | 246 retval = octave_value (std::string (str)); |
247 free (str); | 247 free (str); |
248 } | 248 } |
249 else if (arg0 == "swisdom") | 249 else if (arg0 == "swisdom") |
250 { | 250 { |
251 char *str = fftwf_export_wisdom_to_string (); | 251 char *str = fftwf_export_wisdom_to_string (); |
252 retval = octave_value (std::string (str)); | 252 retval = octave_value (std::string (str)); |
253 free (str); | 253 free (str); |
254 } | 254 } |
255 else | 255 else |
256 error ("unrecognized argument"); | 256 error ("unrecognized argument"); |
257 } | 257 } |
258 } | 258 } |
259 } | 259 } |
260 #else | 260 #else |
261 | 261 |
262 warning ("fftw: this copy of Octave was not configured to use the FFTW3 planner"); | 262 warning ("fftw: this copy of Octave was not configured to use the FFTW3 planner"); |
263 | 263 |