| fft | R Documentation |
The function fft mimics the function fft of the library 'stats' to compute on gpu.matrix-class objects: it "Computes the Discrete Fourier Transform (DFT) of an array with a fast algorithm, the 'Fast Fourier Transform' (FFT)."
The function mvfft mimics the function mvfft of the library 'stats' which: "takes a real or complex matrix as argument, and returns a similar shaped matrix, but with each column replaced by its discrete Fourier transform".
## S4 method for signature 'gpu.matrix.tensorflow'
fft(z)
## S4 method for signature 'gpu.matrix.torch'
fft(z)
## S4 method for signature 'gpu.matrix.torch,logical'
fft(z,inverse)
## S4 method for signature 'gpu.matrix.torch'
mvfft(z)
## S4 method for signature 'gpu.matrix.tensorflow'
mvfft(z)
## S4 method for signature 'gpu.matrix.torch,logical'
mvfft(z,inverse)
z |
a |
inverse |
the same as in the library 'stats': "if TRUE, the unnormalized inverse transform is computed (the inverse has a +in the exponent of |
The function fft mimics the function fft to operate on gpu.matrix-class objects of one dimension. If the input gpu.matrix z has tow dimensions the function will not work, as the method for two dimensions is not implemented yet for gpu.matrix-class objects. In this case the function will display the following error message: "FFT in gpu.matrix with 2 dimensions is not allowed yet".
The function mvfft mimics the function mvfft to operate on gpu.matrix-class objects. This function will apply the discrete Fourier transform to each column of the input z matrix.
Note that the inverse parameter only works for 'torch' for both fft and mvfft functions.
The functions fft and mvfft internally call the corresponding function of the library torch or tensorflow (depending on the type of input gpu.matrix-class).
If the input gpu.matrix-class object(s) are stored on the GPU, then the operations will be performed on the GPU. See gpu.matrix.
It returns a gpu.matrix-class object with the transformed values. To access the real and imaginary information use the function Re() for teh rea part and Im() for the imaginary part. Furthermore, the following code can be used:
output@gm$real for the real part and output@gm$imag for the imaginary part.
For more information see:
fft, torch_fft_ifft, and torch_fft_fft.
if(installTorch()){
x <- gpu.matrix(1:4,ncol = 1)
output_gpu <- fft(x)
output_matrix <- fft(z = as.matrix(x))
#check results:
Re(output_gpu)
Re(output_matrix)
Im(output_gpu)
Im(output_matrix)
x <- gpu.matrix(1:12,ncol = 3)
output_gpu <- mvfft(x)
output_matrix <- mvfft(as.matrix(x))
#check results:
Re(output_gpu)
Re(output_matrix)
Im(output_gpu)
Im(output_matrix)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.