dht

Function dht 

Source
pub fn dht<S, D>(x: &ArrayBase<S, D>) -> FFTResult<Array1<f64>>
where S: Data<Elem = f64>, D: Dimension,
Expand description

Compute the Discrete Hartley Transform (DHT) of a real-valued sequence.

The Hartley transform is defined as: H[k] = sum_{n=0}^{N-1} x[n] * cas(2pik*n/N)

where cas(x) = cos(x) + sin(x) = sqrt(2) * cos(x - pi/4)

§Arguments

  • x - Input array (can be complex, but imaginary part is ignored)

§Returns

The Hartley transform of the input array.

§Example

use scirs2_core::ndarray::array;
use scirs2_fft::hartley::dht;

let x = array![1.0, 2.0, 3.0, 4.0];
let h = dht(&x).unwrap();
println!("Hartley transform: {:?}", h);