Class: FFTW3::Plan
- Inherits:
-
Object
- Object
- FFTW3::Plan
- Defined in:
- lib/fftw3/plan.rb
Instance Attribute Summary collapse
-
#precision ⇒ Object
readonly
Returns the value of attribute precision.
-
#ptr ⇒ Object
readonly
Returns the value of attribute ptr.
Class Method Summary collapse
- .dft(dims, input, output, direction:, flags: [:estimate], precision: :double) ⇒ Object
-
.dft_1d(n, input, output, direction:, flags: [:estimate], precision: :double) ⇒ Object
---- Basic Complex DFT ----.
- .dft_2d(n0, n1, input, output, direction:, flags: [:estimate], precision: :double) ⇒ Object
- .dft_3d(n0, n1, n2, input, output, direction:, flags: [:estimate], precision: :double) ⇒ Object
- .dft_c2r(dims, input, output, flags: [:estimate], precision: :double) ⇒ Object
-
.dft_c2r_1d(n, input, output, flags: [:estimate], precision: :double) ⇒ Object
---- Basic C2R ----.
- .dft_c2r_2d(n0, n1, input, output, flags: [:estimate], precision: :double) ⇒ Object
- .dft_c2r_3d(n0, n1, n2, input, output, flags: [:estimate], precision: :double) ⇒ Object
- .dft_r2c(dims, input, output, flags: [:estimate], precision: :double) ⇒ Object
-
.dft_r2c_1d(n, input, output, flags: [:estimate], precision: :double) ⇒ Object
---- Basic R2C ----.
- .dft_r2c_2d(n0, n1, input, output, flags: [:estimate], precision: :double) ⇒ Object
- .dft_r2c_3d(n0, n1, n2, input, output, flags: [:estimate], precision: :double) ⇒ Object
-
.guru64_dft(dims, howmany_dims, input, output, sign:, flags: [:estimate], precision: :double) ⇒ Object
---- Guru64 ----.
- .guru64_dft_c2r(dims, howmany_dims, input, output, flags: [:estimate], precision: :double) ⇒ Object
- .guru64_dft_r2c(dims, howmany_dims, input, output, flags: [:estimate], precision: :double) ⇒ Object
- .guru64_r2r(dims, howmany_dims, input, output, kinds:, flags: [:estimate], precision: :double) ⇒ Object
- .guru64_split_dft(dims, howmany_dims, ri, ii, ro, io, flags: [:estimate], precision: :double) ⇒ Object
- .guru64_split_dft_c2r(dims, howmany_dims, ri, ii, output, flags: [:estimate], precision: :double) ⇒ Object
- .guru64_split_dft_r2c(dims, howmany_dims, input, ro, io, flags: [:estimate], precision: :double) ⇒ Object
-
.guru_dft(dims, howmany_dims, input, output, sign:, flags: [:estimate], precision: :double) ⇒ Object
---- Guru ----.
- .guru_dft_c2r(dims, howmany_dims, input, output, flags: [:estimate], precision: :double) ⇒ Object
- .guru_dft_r2c(dims, howmany_dims, input, output, flags: [:estimate], precision: :double) ⇒ Object
- .guru_r2r(dims, howmany_dims, input, output, kinds:, flags: [:estimate], precision: :double) ⇒ Object
- .guru_split_dft(dims, howmany_dims, ri, ii, ro, io, flags: [:estimate], precision: :double) ⇒ Object
- .guru_split_dft_c2r(dims, howmany_dims, ri, ii, output, flags: [:estimate], precision: :double) ⇒ Object
- .guru_split_dft_r2c(dims, howmany_dims, input, ro, io, flags: [:estimate], precision: :double) ⇒ Object
-
.many_dft(rank:, n:, howmany:, input:, inembed:, istride:, idist:, output:, onembed:, ostride:, odist:, direction:, flags: [:estimate], precision: :double) ⇒ Object
---- Advanced (many) ----.
- .many_dft_c2r(rank:, n:, howmany:, input:, inembed:, istride:, idist:, output:, onembed:, ostride:, odist:, flags: [:estimate], precision: :double) ⇒ Object
- .many_dft_r2c(rank:, n:, howmany:, input:, inembed:, istride:, idist:, output:, onembed:, ostride:, odist:, flags: [:estimate], precision: :double) ⇒ Object
- .many_r2r(rank:, n:, howmany:, input:, inembed:, istride:, idist:, output:, onembed:, ostride:, odist:, kinds:, flags: [:estimate], precision: :double) ⇒ Object
- .r2r(dims, input, output, kinds:, flags: [:estimate], precision: :double) ⇒ Object
-
.r2r_1d(n, input, output, kind:, flags: [:estimate], precision: :double) ⇒ Object
---- Basic R2R ----.
- .r2r_2d(n0, n1, input, output, kind0:, kind1:, flags: [:estimate], precision: :double) ⇒ Object
- .r2r_3d(n0, n1, n2, input, output, kind0:, kind1:, kind2:, flags: [:estimate], precision: :double) ⇒ Object
- .release(ptr, destructor, destroyed_flag) ⇒ Object
Instance Method Summary collapse
- #cost ⇒ Object
- #destroy! ⇒ Object
- #estimate_cost ⇒ Object
- #execute ⇒ Object
- #execute_dft(input, output) ⇒ Object
- #execute_dft_c2r(input, output) ⇒ Object
- #execute_dft_r2c(input, output) ⇒ Object
- #execute_r2r(input, output) ⇒ Object
- #execute_split_dft(ri, ii, ro, io) ⇒ Object
- #execute_split_dft_c2r(ri, ii, output) ⇒ Object
- #execute_split_dft_r2c(input, ro, io) ⇒ Object
- #flops ⇒ Object
-
#initialize(ptr, precision:, input_buffer: nil, output_buffer: nil, **_metadata) ⇒ Plan
constructor
A new instance of Plan.
- #print(io = $stdout) ⇒ Object
- #to_s ⇒ Object (also: #description)
Constructor Details
#initialize(ptr, precision:, input_buffer: nil, output_buffer: nil, **_metadata) ⇒ Plan
Returns a new instance of Plan.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/fftw3/plan.rb', line 7 def initialize(ptr, precision:, input_buffer: nil, output_buffer: nil, **) raise FFTW3::Error::PlanError, "FFTW returned NULL plan" if ptr.null? @ptr = ptr @precision = precision @input_buffer = input_buffer @output_buffer = output_buffer @destroyed_flag = [false] destructor = ffi_module.method(:"#{prefix}destroy_plan") ObjectSpace.define_finalizer(self, self.class.release(ptr, destructor, @destroyed_flag)) end |
Instance Attribute Details
#precision ⇒ Object (readonly)
Returns the value of attribute precision.
5 6 7 |
# File 'lib/fftw3/plan.rb', line 5 def precision @precision end |
#ptr ⇒ Object (readonly)
Returns the value of attribute ptr.
5 6 7 |
# File 'lib/fftw3/plan.rb', line 5 def ptr @ptr end |
Class Method Details
.dft(dims, input, output, direction:, flags: [:estimate], precision: :double) ⇒ Object
117 118 119 120 121 122 123 124 125 |
# File 'lib/fftw3/plan.rb', line 117 def dft(dims, input, output, direction:, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) n_ptr = ::FFI::MemoryPointer.new(:int, dims.length) n_ptr.put_array_of_int(0, dims) ptr = ffi.send(:"#{pfx}plan_dft", dims.length, n_ptr, input.pointer, output.pointer, resolve_direction(direction), resolve_flags(flags)) new(ptr, precision: precision, input_buffer: input, output_buffer: output) end |
.dft_1d(n, input, output, direction:, flags: [:estimate], precision: :double) ⇒ Object
---- Basic Complex DFT ----
93 94 95 96 97 98 99 |
# File 'lib/fftw3/plan.rb', line 93 def dft_1d(n, input, output, direction:, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) ptr = ffi.send(:"#{pfx}plan_dft_1d", n, input.pointer, output.pointer, resolve_direction(direction), resolve_flags(flags)) new(ptr, precision: precision, input_buffer: input, output_buffer: output) end |
.dft_2d(n0, n1, input, output, direction:, flags: [:estimate], precision: :double) ⇒ Object
101 102 103 104 105 106 107 |
# File 'lib/fftw3/plan.rb', line 101 def dft_2d(n0, n1, input, output, direction:, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) ptr = ffi.send(:"#{pfx}plan_dft_2d", n0, n1, input.pointer, output.pointer, resolve_direction(direction), resolve_flags(flags)) new(ptr, precision: precision, input_buffer: input, output_buffer: output) end |
.dft_3d(n0, n1, n2, input, output, direction:, flags: [:estimate], precision: :double) ⇒ Object
109 110 111 112 113 114 115 |
# File 'lib/fftw3/plan.rb', line 109 def dft_3d(n0, n1, n2, input, output, direction:, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) ptr = ffi.send(:"#{pfx}plan_dft_3d", n0, n1, n2, input.pointer, output.pointer, resolve_direction(direction), resolve_flags(flags)) new(ptr, precision: precision, input_buffer: input, output_buffer: output) end |
.dft_c2r(dims, input, output, flags: [:estimate], precision: :double) ⇒ Object
181 182 183 184 185 186 187 188 189 |
# File 'lib/fftw3/plan.rb', line 181 def dft_c2r(dims, input, output, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) n_ptr = ::FFI::MemoryPointer.new(:int, dims.length) n_ptr.put_array_of_int(0, dims) ptr = ffi.send(:"#{pfx}plan_dft_c2r", dims.length, n_ptr, input.pointer, output.pointer, resolve_flags(flags)) new(ptr, precision: precision, input_buffer: input, output_buffer: output) end |
.dft_c2r_1d(n, input, output, flags: [:estimate], precision: :double) ⇒ Object
---- Basic C2R ----
160 161 162 163 164 165 |
# File 'lib/fftw3/plan.rb', line 160 def dft_c2r_1d(n, input, output, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) ptr = ffi.send(:"#{pfx}plan_dft_c2r_1d", n, input.pointer, output.pointer, resolve_flags(flags)) new(ptr, precision: precision, input_buffer: input, output_buffer: output) end |
.dft_c2r_2d(n0, n1, input, output, flags: [:estimate], precision: :double) ⇒ Object
167 168 169 170 171 172 |
# File 'lib/fftw3/plan.rb', line 167 def dft_c2r_2d(n0, n1, input, output, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) ptr = ffi.send(:"#{pfx}plan_dft_c2r_2d", n0, n1, input.pointer, output.pointer, resolve_flags(flags)) new(ptr, precision: precision, input_buffer: input, output_buffer: output) end |
.dft_c2r_3d(n0, n1, n2, input, output, flags: [:estimate], precision: :double) ⇒ Object
174 175 176 177 178 179 |
# File 'lib/fftw3/plan.rb', line 174 def dft_c2r_3d(n0, n1, n2, input, output, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) ptr = ffi.send(:"#{pfx}plan_dft_c2r_3d", n0, n1, n2, input.pointer, output.pointer, resolve_flags(flags)) new(ptr, precision: precision, input_buffer: input, output_buffer: output) end |
.dft_r2c(dims, input, output, flags: [:estimate], precision: :double) ⇒ Object
149 150 151 152 153 154 155 156 157 |
# File 'lib/fftw3/plan.rb', line 149 def dft_r2c(dims, input, output, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) n_ptr = ::FFI::MemoryPointer.new(:int, dims.length) n_ptr.put_array_of_int(0, dims) ptr = ffi.send(:"#{pfx}plan_dft_r2c", dims.length, n_ptr, input.pointer, output.pointer, resolve_flags(flags)) new(ptr, precision: precision, input_buffer: input, output_buffer: output) end |
.dft_r2c_1d(n, input, output, flags: [:estimate], precision: :double) ⇒ Object
---- Basic R2C ----
128 129 130 131 132 133 |
# File 'lib/fftw3/plan.rb', line 128 def dft_r2c_1d(n, input, output, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) ptr = ffi.send(:"#{pfx}plan_dft_r2c_1d", n, input.pointer, output.pointer, resolve_flags(flags)) new(ptr, precision: precision, input_buffer: input, output_buffer: output) end |
.dft_r2c_2d(n0, n1, input, output, flags: [:estimate], precision: :double) ⇒ Object
135 136 137 138 139 140 |
# File 'lib/fftw3/plan.rb', line 135 def dft_r2c_2d(n0, n1, input, output, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) ptr = ffi.send(:"#{pfx}plan_dft_r2c_2d", n0, n1, input.pointer, output.pointer, resolve_flags(flags)) new(ptr, precision: precision, input_buffer: input, output_buffer: output) end |
.dft_r2c_3d(n0, n1, n2, input, output, flags: [:estimate], precision: :double) ⇒ Object
142 143 144 145 146 147 |
# File 'lib/fftw3/plan.rb', line 142 def dft_r2c_3d(n0, n1, n2, input, output, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) ptr = ffi.send(:"#{pfx}plan_dft_r2c_3d", n0, n1, n2, input.pointer, output.pointer, resolve_flags(flags)) new(ptr, precision: precision, input_buffer: input, output_buffer: output) end |
.guru64_dft(dims, howmany_dims, input, output, sign:, flags: [:estimate], precision: :double) ⇒ Object
---- Guru64 ----
378 379 380 381 382 383 384 385 386 387 388 |
# File 'lib/fftw3/plan.rb', line 378 def guru64_dft(dims, howmany_dims, input, output, sign:, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) dims_ptr = IODim64.to_ffi(dims) howmany_ptr = IODim64.to_ffi(howmany_dims) ptr = ffi.send(:"#{pfx}plan_guru64_dft", dims.length, dims_ptr, howmany_dims.length, howmany_ptr, input.pointer, output.pointer, resolve_direction(sign), resolve_flags(flags)) new(ptr, precision: precision, input_buffer: input, output_buffer: output) end |
.guru64_dft_c2r(dims, howmany_dims, input, output, flags: [:estimate], precision: :double) ⇒ Object
426 427 428 429 430 431 432 433 434 435 436 |
# File 'lib/fftw3/plan.rb', line 426 def guru64_dft_c2r(dims, howmany_dims, input, output, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) dims_ptr = IODim64.to_ffi(dims) howmany_ptr = IODim64.to_ffi(howmany_dims) ptr = ffi.send(:"#{pfx}plan_guru64_dft_c2r", dims.length, dims_ptr, howmany_dims.length, howmany_ptr, input.pointer, output.pointer, resolve_flags(flags)) new(ptr, precision: precision, input_buffer: input, output_buffer: output) end |
.guru64_dft_r2c(dims, howmany_dims, input, output, flags: [:estimate], precision: :double) ⇒ Object
402 403 404 405 406 407 408 409 410 411 412 |
# File 'lib/fftw3/plan.rb', line 402 def guru64_dft_r2c(dims, howmany_dims, input, output, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) dims_ptr = IODim64.to_ffi(dims) howmany_ptr = IODim64.to_ffi(howmany_dims) ptr = ffi.send(:"#{pfx}plan_guru64_dft_r2c", dims.length, dims_ptr, howmany_dims.length, howmany_ptr, input.pointer, output.pointer, resolve_flags(flags)) new(ptr, precision: precision, input_buffer: input, output_buffer: output) end |
.guru64_r2r(dims, howmany_dims, input, output, kinds:, flags: [:estimate], precision: :double) ⇒ Object
450 451 452 453 454 455 456 457 458 459 460 461 462 |
# File 'lib/fftw3/plan.rb', line 450 def guru64_r2r(dims, howmany_dims, input, output, kinds:, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) dims_ptr = IODim64.to_ffi(dims) howmany_ptr = IODim64.to_ffi(howmany_dims) kind_ptr = ::FFI::MemoryPointer.new(:int, kinds.length) kind_ptr.put_array_of_int(0, kinds) ptr = ffi.send(:"#{pfx}plan_guru64_r2r", dims.length, dims_ptr, howmany_dims.length, howmany_ptr, input.pointer, output.pointer, kind_ptr, resolve_flags(flags)) new(ptr, precision: precision, input_buffer: input, output_buffer: output) end |
.guru64_split_dft(dims, howmany_dims, ri, ii, ro, io, flags: [:estimate], precision: :double) ⇒ Object
390 391 392 393 394 395 396 397 398 399 400 |
# File 'lib/fftw3/plan.rb', line 390 def guru64_split_dft(dims, howmany_dims, ri, ii, ro, io, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) dims_ptr = IODim64.to_ffi(dims) howmany_ptr = IODim64.to_ffi(howmany_dims) ptr = ffi.send(:"#{pfx}plan_guru64_split_dft", dims.length, dims_ptr, howmany_dims.length, howmany_ptr, ri.pointer, ii.pointer, ro.pointer, io.pointer, resolve_flags(flags)) new(ptr, precision: precision, input_buffer: [ri, ii], output_buffer: [ro, io]) end |
.guru64_split_dft_c2r(dims, howmany_dims, ri, ii, output, flags: [:estimate], precision: :double) ⇒ Object
438 439 440 441 442 443 444 445 446 447 448 |
# File 'lib/fftw3/plan.rb', line 438 def guru64_split_dft_c2r(dims, howmany_dims, ri, ii, output, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) dims_ptr = IODim64.to_ffi(dims) howmany_ptr = IODim64.to_ffi(howmany_dims) ptr = ffi.send(:"#{pfx}plan_guru64_split_dft_c2r", dims.length, dims_ptr, howmany_dims.length, howmany_ptr, ri.pointer, ii.pointer, output.pointer, resolve_flags(flags)) new(ptr, precision: precision, input_buffer: [ri, ii], output_buffer: output) end |
.guru64_split_dft_r2c(dims, howmany_dims, input, ro, io, flags: [:estimate], precision: :double) ⇒ Object
414 415 416 417 418 419 420 421 422 423 424 |
# File 'lib/fftw3/plan.rb', line 414 def guru64_split_dft_r2c(dims, howmany_dims, input, ro, io, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) dims_ptr = IODim64.to_ffi(dims) howmany_ptr = IODim64.to_ffi(howmany_dims) ptr = ffi.send(:"#{pfx}plan_guru64_split_dft_r2c", dims.length, dims_ptr, howmany_dims.length, howmany_ptr, input.pointer, ro.pointer, io.pointer, resolve_flags(flags)) new(ptr, precision: precision, input_buffer: input, output_buffer: [ro, io]) end |
.guru_dft(dims, howmany_dims, input, output, sign:, flags: [:estimate], precision: :double) ⇒ Object
---- Guru ----
291 292 293 294 295 296 297 298 299 300 301 |
# File 'lib/fftw3/plan.rb', line 291 def guru_dft(dims, howmany_dims, input, output, sign:, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) dims_ptr = IODim.to_ffi(dims) howmany_ptr = IODim.to_ffi(howmany_dims) ptr = ffi.send(:"#{pfx}plan_guru_dft", dims.length, dims_ptr, howmany_dims.length, howmany_ptr, input.pointer, output.pointer, resolve_direction(sign), resolve_flags(flags)) new(ptr, precision: precision, input_buffer: input, output_buffer: output) end |
.guru_dft_c2r(dims, howmany_dims, input, output, flags: [:estimate], precision: :double) ⇒ Object
339 340 341 342 343 344 345 346 347 348 349 |
# File 'lib/fftw3/plan.rb', line 339 def guru_dft_c2r(dims, howmany_dims, input, output, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) dims_ptr = IODim.to_ffi(dims) howmany_ptr = IODim.to_ffi(howmany_dims) ptr = ffi.send(:"#{pfx}plan_guru_dft_c2r", dims.length, dims_ptr, howmany_dims.length, howmany_ptr, input.pointer, output.pointer, resolve_flags(flags)) new(ptr, precision: precision, input_buffer: input, output_buffer: output) end |
.guru_dft_r2c(dims, howmany_dims, input, output, flags: [:estimate], precision: :double) ⇒ Object
315 316 317 318 319 320 321 322 323 324 325 |
# File 'lib/fftw3/plan.rb', line 315 def guru_dft_r2c(dims, howmany_dims, input, output, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) dims_ptr = IODim.to_ffi(dims) howmany_ptr = IODim.to_ffi(howmany_dims) ptr = ffi.send(:"#{pfx}plan_guru_dft_r2c", dims.length, dims_ptr, howmany_dims.length, howmany_ptr, input.pointer, output.pointer, resolve_flags(flags)) new(ptr, precision: precision, input_buffer: input, output_buffer: output) end |
.guru_r2r(dims, howmany_dims, input, output, kinds:, flags: [:estimate], precision: :double) ⇒ Object
363 364 365 366 367 368 369 370 371 372 373 374 375 |
# File 'lib/fftw3/plan.rb', line 363 def guru_r2r(dims, howmany_dims, input, output, kinds:, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) dims_ptr = IODim.to_ffi(dims) howmany_ptr = IODim.to_ffi(howmany_dims) kind_ptr = ::FFI::MemoryPointer.new(:int, kinds.length) kind_ptr.put_array_of_int(0, kinds) ptr = ffi.send(:"#{pfx}plan_guru_r2r", dims.length, dims_ptr, howmany_dims.length, howmany_ptr, input.pointer, output.pointer, kind_ptr, resolve_flags(flags)) new(ptr, precision: precision, input_buffer: input, output_buffer: output) end |
.guru_split_dft(dims, howmany_dims, ri, ii, ro, io, flags: [:estimate], precision: :double) ⇒ Object
303 304 305 306 307 308 309 310 311 312 313 |
# File 'lib/fftw3/plan.rb', line 303 def guru_split_dft(dims, howmany_dims, ri, ii, ro, io, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) dims_ptr = IODim.to_ffi(dims) howmany_ptr = IODim.to_ffi(howmany_dims) ptr = ffi.send(:"#{pfx}plan_guru_split_dft", dims.length, dims_ptr, howmany_dims.length, howmany_ptr, ri.pointer, ii.pointer, ro.pointer, io.pointer, resolve_flags(flags)) new(ptr, precision: precision, input_buffer: [ri, ii], output_buffer: [ro, io]) end |
.guru_split_dft_c2r(dims, howmany_dims, ri, ii, output, flags: [:estimate], precision: :double) ⇒ Object
351 352 353 354 355 356 357 358 359 360 361 |
# File 'lib/fftw3/plan.rb', line 351 def guru_split_dft_c2r(dims, howmany_dims, ri, ii, output, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) dims_ptr = IODim.to_ffi(dims) howmany_ptr = IODim.to_ffi(howmany_dims) ptr = ffi.send(:"#{pfx}plan_guru_split_dft_c2r", dims.length, dims_ptr, howmany_dims.length, howmany_ptr, ri.pointer, ii.pointer, output.pointer, resolve_flags(flags)) new(ptr, precision: precision, input_buffer: [ri, ii], output_buffer: output) end |
.guru_split_dft_r2c(dims, howmany_dims, input, ro, io, flags: [:estimate], precision: :double) ⇒ Object
327 328 329 330 331 332 333 334 335 336 337 |
# File 'lib/fftw3/plan.rb', line 327 def guru_split_dft_r2c(dims, howmany_dims, input, ro, io, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) dims_ptr = IODim.to_ffi(dims) howmany_ptr = IODim.to_ffi(howmany_dims) ptr = ffi.send(:"#{pfx}plan_guru_split_dft_r2c", dims.length, dims_ptr, howmany_dims.length, howmany_ptr, input.pointer, ro.pointer, io.pointer, resolve_flags(flags)) new(ptr, precision: precision, input_buffer: input, output_buffer: [ro, io]) end |
.many_dft(rank:, n:, howmany:, input:, inembed:, istride:, idist:, output:, onembed:, ostride:, odist:, direction:, flags: [:estimate], precision: :double) ⇒ Object
---- Advanced (many) ----
228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
# File 'lib/fftw3/plan.rb', line 228 def many_dft(rank:, n:, howmany:, input:, inembed:, istride:, idist:, output:, onembed:, ostride:, odist:, direction:, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) n_ptr = ::FFI::MemoryPointer.new(:int, n.length) n_ptr.put_array_of_int(0, n) = array_to_int_ptr() = array_to_int_ptr() ptr = ffi.send(:"#{pfx}plan_many_dft", rank, n_ptr, howmany, input.pointer, , istride, idist, output.pointer, , ostride, odist, resolve_direction(direction), resolve_flags(flags)) new(ptr, precision: precision, input_buffer: input, output_buffer: output) end |
.many_dft_c2r(rank:, n:, howmany:, input:, inembed:, istride:, idist:, output:, onembed:, ostride:, odist:, flags: [:estimate], precision: :double) ⇒ Object
258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
# File 'lib/fftw3/plan.rb', line 258 def many_dft_c2r(rank:, n:, howmany:, input:, inembed:, istride:, idist:, output:, onembed:, ostride:, odist:, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) n_ptr = ::FFI::MemoryPointer.new(:int, n.length) n_ptr.put_array_of_int(0, n) = array_to_int_ptr() = array_to_int_ptr() ptr = ffi.send(:"#{pfx}plan_many_dft_c2r", rank, n_ptr, howmany, input.pointer, , istride, idist, output.pointer, , ostride, odist, resolve_flags(flags)) new(ptr, precision: precision, input_buffer: input, output_buffer: output) end |
.many_dft_r2c(rank:, n:, howmany:, input:, inembed:, istride:, idist:, output:, onembed:, ostride:, odist:, flags: [:estimate], precision: :double) ⇒ Object
243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
# File 'lib/fftw3/plan.rb', line 243 def many_dft_r2c(rank:, n:, howmany:, input:, inembed:, istride:, idist:, output:, onembed:, ostride:, odist:, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) n_ptr = ::FFI::MemoryPointer.new(:int, n.length) n_ptr.put_array_of_int(0, n) = array_to_int_ptr() = array_to_int_ptr() ptr = ffi.send(:"#{pfx}plan_many_dft_r2c", rank, n_ptr, howmany, input.pointer, , istride, idist, output.pointer, , ostride, odist, resolve_flags(flags)) new(ptr, precision: precision, input_buffer: input, output_buffer: output) end |
.many_r2r(rank:, n:, howmany:, input:, inembed:, istride:, idist:, output:, onembed:, ostride:, odist:, kinds:, flags: [:estimate], precision: :double) ⇒ Object
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
# File 'lib/fftw3/plan.rb', line 273 def many_r2r(rank:, n:, howmany:, input:, inembed:, istride:, idist:, output:, onembed:, ostride:, odist:, kinds:, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) n_ptr = ::FFI::MemoryPointer.new(:int, n.length) n_ptr.put_array_of_int(0, n) = array_to_int_ptr() = array_to_int_ptr() kind_ptr = ::FFI::MemoryPointer.new(:int, kinds.length) kind_ptr.put_array_of_int(0, kinds) ptr = ffi.send(:"#{pfx}plan_many_r2r", rank, n_ptr, howmany, input.pointer, , istride, idist, output.pointer, , ostride, odist, kind_ptr, resolve_flags(flags)) new(ptr, precision: precision, input_buffer: input, output_buffer: output) end |
.r2r(dims, input, output, kinds:, flags: [:estimate], precision: :double) ⇒ Object
215 216 217 218 219 220 221 222 223 224 225 |
# File 'lib/fftw3/plan.rb', line 215 def r2r(dims, input, output, kinds:, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) n_ptr = ::FFI::MemoryPointer.new(:int, dims.length) n_ptr.put_array_of_int(0, dims) kind_ptr = ::FFI::MemoryPointer.new(:int, kinds.length) kind_ptr.put_array_of_int(0, kinds) ptr = ffi.send(:"#{pfx}plan_r2r", dims.length, n_ptr, input.pointer, output.pointer, kind_ptr, resolve_flags(flags)) new(ptr, precision: precision, input_buffer: input, output_buffer: output) end |
.r2r_1d(n, input, output, kind:, flags: [:estimate], precision: :double) ⇒ Object
---- Basic R2R ----
192 193 194 195 196 197 |
# File 'lib/fftw3/plan.rb', line 192 def r2r_1d(n, input, output, kind:, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) ptr = ffi.send(:"#{pfx}plan_r2r_1d", n, input.pointer, output.pointer, kind, resolve_flags(flags)) new(ptr, precision: precision, input_buffer: input, output_buffer: output) end |
.r2r_2d(n0, n1, input, output, kind0:, kind1:, flags: [:estimate], precision: :double) ⇒ Object
199 200 201 202 203 204 205 |
# File 'lib/fftw3/plan.rb', line 199 def r2r_2d(n0, n1, input, output, kind0:, kind1:, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) ptr = ffi.send(:"#{pfx}plan_r2r_2d", n0, n1, input.pointer, output.pointer, kind0, kind1, resolve_flags(flags)) new(ptr, precision: precision, input_buffer: input, output_buffer: output) end |
.r2r_3d(n0, n1, n2, input, output, kind0:, kind1:, kind2:, flags: [:estimate], precision: :double) ⇒ Object
207 208 209 210 211 212 213 |
# File 'lib/fftw3/plan.rb', line 207 def r2r_3d(n0, n1, n2, input, output, kind0:, kind1:, kind2:, flags: [:estimate], precision: :double) ffi = FFTW3::FFI.module_for(precision) pfx = FFTW3::FFI.prefix_for(precision) ptr = ffi.send(:"#{pfx}plan_r2r_3d", n0, n1, n2, input.pointer, output.pointer, kind0, kind1, kind2, resolve_flags(flags)) new(ptr, precision: precision, input_buffer: input, output_buffer: output) end |
.release(ptr, destructor, destroyed_flag) ⇒ Object
504 505 506 507 508 509 510 511 |
# File 'lib/fftw3/plan.rb', line 504 def self.release(ptr, destructor, destroyed_flag) proc { unless destroyed_flag[0] || ptr.null? destructor.call(ptr) destroyed_flag[0] = true end } end |
Instance Method Details
#cost ⇒ Object
76 77 78 |
# File 'lib/fftw3/plan.rb', line 76 def cost ffi_module.send(:"#{prefix}cost", @ptr) end |
#destroy! ⇒ Object
84 85 86 87 88 89 |
# File 'lib/fftw3/plan.rb', line 84 def destroy! return if @destroyed_flag[0] ffi_module.send(:"#{prefix}destroy_plan", @ptr) @destroyed_flag[0] = true end |
#estimate_cost ⇒ Object
80 81 82 |
# File 'lib/fftw3/plan.rb', line 80 def estimate_cost ffi_module.send(:"#{prefix}estimate_cost", @ptr) end |
#execute ⇒ Object
20 21 22 |
# File 'lib/fftw3/plan.rb', line 20 def execute ffi_module.send(:"#{prefix}execute", @ptr) end |
#execute_dft(input, output) ⇒ Object
24 25 26 |
# File 'lib/fftw3/plan.rb', line 24 def execute_dft(input, output) ffi_module.send(:"#{prefix}execute_dft", @ptr, input.pointer, output.pointer) end |
#execute_dft_c2r(input, output) ⇒ Object
32 33 34 |
# File 'lib/fftw3/plan.rb', line 32 def execute_dft_c2r(input, output) ffi_module.send(:"#{prefix}execute_dft_c2r", @ptr, input.pointer, output.pointer) end |
#execute_dft_r2c(input, output) ⇒ Object
28 29 30 |
# File 'lib/fftw3/plan.rb', line 28 def execute_dft_r2c(input, output) ffi_module.send(:"#{prefix}execute_dft_r2c", @ptr, input.pointer, output.pointer) end |
#execute_r2r(input, output) ⇒ Object
36 37 38 |
# File 'lib/fftw3/plan.rb', line 36 def execute_r2r(input, output) ffi_module.send(:"#{prefix}execute_r2r", @ptr, input.pointer, output.pointer) end |
#execute_split_dft(ri, ii, ro, io) ⇒ Object
40 41 42 |
# File 'lib/fftw3/plan.rb', line 40 def execute_split_dft(ri, ii, ro, io) ffi_module.send(:"#{prefix}execute_split_dft", @ptr, ri.pointer, ii.pointer, ro.pointer, io.pointer) end |
#execute_split_dft_c2r(ri, ii, output) ⇒ Object
48 49 50 |
# File 'lib/fftw3/plan.rb', line 48 def execute_split_dft_c2r(ri, ii, output) ffi_module.send(:"#{prefix}execute_split_dft_c2r", @ptr, ri.pointer, ii.pointer, output.pointer) end |
#execute_split_dft_r2c(input, ro, io) ⇒ Object
44 45 46 |
# File 'lib/fftw3/plan.rb', line 44 def execute_split_dft_r2c(input, ro, io) ffi_module.send(:"#{prefix}execute_split_dft_r2c", @ptr, input.pointer, ro.pointer, io.pointer) end |
#flops ⇒ Object
68 69 70 71 72 73 74 |
# File 'lib/fftw3/plan.rb', line 68 def flops add = ::FFI::MemoryPointer.new(:double) mul = ::FFI::MemoryPointer.new(:double) fma = ::FFI::MemoryPointer.new(:double) ffi_module.send(:"#{prefix}flops", @ptr, add, mul, fma) { add: add.read_double, mul: mul.read_double, fma: fma.read_double } end |
#print(io = $stdout) ⇒ Object
63 64 65 66 |
# File 'lib/fftw3/plan.rb', line 63 def print(io = $stdout) io.write(to_s) io end |
#to_s ⇒ Object Also known as: description
52 53 54 55 56 57 58 59 |
# File 'lib/fftw3/plan.rb', line 52 def to_s description_ptr = ffi_module.send(:"#{prefix}sprint_plan", @ptr) return "" if description_ptr.null? description = description_ptr.read_string ffi_module.send(:"#{prefix}free", description_ptr) description end |