Mercurial > octave-nkf
comparison src/DLD-FUNCTIONS/fft2.cc @ 11586:12df7854fa7c
strip trailing whitespace from source files
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 20 Jan 2011 17:24:59 -0500 |
parents | 01f703952eff |
children | b64b82721062 |
comparison
equal
deleted
inserted
replaced
11585:1473d0cf86d2 | 11586:12df7854fa7c |
---|---|
55 } | 55 } |
56 | 56 |
57 octave_value arg = args(0); | 57 octave_value arg = args(0); |
58 dim_vector dims = arg.dims (); | 58 dim_vector dims = arg.dims (); |
59 octave_idx_type n_rows = -1; | 59 octave_idx_type n_rows = -1; |
60 | 60 |
61 if (nargin > 1) | 61 if (nargin > 1) |
62 { | 62 { |
63 double dval = args(1).double_value (); | 63 double dval = args(1).double_value (); |
64 if (xisnan (dval)) | 64 if (xisnan (dval)) |
65 error ("%s: number of rows (N) cannot be NaN", fcn); | 65 error ("%s: number of rows (N) cannot be NaN", fcn); |
212 %% Comalco Research and Technology | 212 %% Comalco Research and Technology |
213 %% 02 May 2000 | 213 %% 02 May 2000 |
214 %!test | 214 %!test |
215 %! M=16; | 215 %! M=16; |
216 %! N=8; | 216 %! N=8; |
217 %! | 217 %! |
218 %! m=5; | 218 %! m=5; |
219 %! n=3; | 219 %! n=3; |
220 %! | 220 %! |
221 %! x = 2*pi*(0:1:M-1)/M; | 221 %! x = 2*pi*(0:1:M-1)/M; |
222 %! y = 2*pi*(0:1:N-1)/N; | 222 %! y = 2*pi*(0:1:N-1)/N; |
223 %! sx = cos(m*x); | 223 %! sx = cos(m*x); |
224 %! sy = sin(n*y); | 224 %! sy = sin(n*y); |
225 %! s=kron(sx',sy); | 225 %! s=kron(sx',sy); |
231 %% Comalco Research and Technology | 231 %% Comalco Research and Technology |
232 %% 02 May 2000 | 232 %% 02 May 2000 |
233 %!test | 233 %!test |
234 %! M=12; | 234 %! M=12; |
235 %! N=7; | 235 %! N=7; |
236 %! | 236 %! |
237 %! m=3; | 237 %! m=3; |
238 %! n=2; | 238 %! n=2; |
239 %! | 239 %! |
240 %! x = 2*pi*(0:1:M-1)/M; | 240 %! x = 2*pi*(0:1:M-1)/M; |
241 %! y = 2*pi*(0:1:N-1)/N; | 241 %! y = 2*pi*(0:1:N-1)/N; |
242 %! | 242 %! |
243 %! sx = cos(m*x); | 243 %! sx = cos(m*x); |
244 %! sy = cos(n*y); | 244 %! sy = cos(n*y); |
245 %! | 245 %! |
246 %! S = kron(fft(sx)',fft(sy)); | 246 %! S = kron(fft(sx)',fft(sy)); |
247 %! answer=kron(sx',sy); | 247 %! answer=kron(sx',sy); |
248 %! s = ifft2(S); | 248 %! s = ifft2(S); |
249 %! | 249 %! |
250 %! assert(s, answer, 30*eps); | 250 %! assert(s, answer, 30*eps); |
251 | 251 |
252 | 252 |
253 %% Author: David Billinghurst (David.Billinghurst@riotinto.com.au) | 253 %% Author: David Billinghurst (David.Billinghurst@riotinto.com.au) |
254 %% Comalco Research and Technology | 254 %% Comalco Research and Technology |
255 %% 02 May 2000 | 255 %% 02 May 2000 |
256 %!test | 256 %!test |
257 %! M=16; | 257 %! M=16; |
258 %! N=8; | 258 %! N=8; |
259 %! | 259 %! |
260 %! m=5; | 260 %! m=5; |
261 %! n=3; | 261 %! n=3; |
262 %! | 262 %! |
263 %! x = 2*pi*(0:1:M-1)/M; | 263 %! x = 2*pi*(0:1:M-1)/M; |
264 %! y = 2*pi*(0:1:N-1)/N; | 264 %! y = 2*pi*(0:1:N-1)/N; |
265 %! sx = single(cos(m*x)); | 265 %! sx = single(cos(m*x)); |
266 %! sy = single(sin(n*y)); | 266 %! sy = single(sin(n*y)); |
267 %! s=kron(sx',sy); | 267 %! s=kron(sx',sy); |
273 %% Comalco Research and Technology | 273 %% Comalco Research and Technology |
274 %% 02 May 2000 | 274 %% 02 May 2000 |
275 %!test | 275 %!test |
276 %! M=12; | 276 %! M=12; |
277 %! N=7; | 277 %! N=7; |
278 %! | 278 %! |
279 %! m=3; | 279 %! m=3; |
280 %! n=2; | 280 %! n=2; |
281 %! | 281 %! |
282 %! x = single(2*pi*(0:1:M-1)/M); | 282 %! x = single(2*pi*(0:1:M-1)/M); |
283 %! y = single(2*pi*(0:1:N-1)/N); | 283 %! y = single(2*pi*(0:1:N-1)/N); |
284 %! | 284 %! |
285 %! sx = cos(m*x); | 285 %! sx = cos(m*x); |
286 %! sy = cos(n*y); | 286 %! sy = cos(n*y); |
287 %! | 287 %! |
288 %! S = kron(fft(sx)',fft(sy)); | 288 %! S = kron(fft(sx)',fft(sy)); |
289 %! answer=kron(sx',sy); | 289 %! answer=kron(sx',sy); |
290 %! s = ifft2(S); | 290 %! s = ifft2(S); |
291 %! | 291 %! |
292 %! assert(s, answer, 30*eps('single')); | 292 %! assert(s, answer, 30*eps('single')); |
293 | 293 |
294 */ | 294 */ |