1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
//! FFT on complex inputs (CFFT)

use crate::cfft::*;
use num_complex::Complex32;

/// Perform an in-place 2-point CFFT.
///
/// # Example
///
/// ```
/// use microfft::{Complex32, complex::cfft_2};
///
/// let mut input = [Complex32::default(); 2];
/// let result = cfft_2(&mut input);
/// ```
///
/// # Panics
///
/// Panics if `input` has a length other than `2`.
#[inline]
pub fn cfft_2(input: &mut [Complex32]) -> &mut [Complex32] {
    assert_eq!(input.len(), 2);
    CFftN2::transform(input)
}

/// Perform an in-place 4-point CFFT.
///
/// # Example
///
/// ```
/// use microfft::{Complex32, complex::cfft_4};
///
/// let mut input = [Complex32::default(); 4];
/// let result = cfft_4(&mut input);
/// ```
///
/// # Panics
///
/// Panics if `input` has a length other than `4`.
#[inline]
pub fn cfft_4(input: &mut [Complex32]) -> &mut [Complex32] {
    assert_eq!(input.len(), 4);
    CFftN4::transform(input)
}

/// Perform an in-place 8-point CFFT.
///
/// # Example
///
/// ```
/// use microfft::{Complex32, complex::cfft_8};
///
/// let mut input = [Complex32::default(); 8];
/// let result = cfft_8(&mut input);
/// ```
///
/// # Panics
///
/// Panics if `input` has a length other than `8`.
#[inline]
pub fn cfft_8(input: &mut [Complex32]) -> &mut [Complex32] {
    assert_eq!(input.len(), 8);
    CFftN8::transform(input)
}

/// Perform an in-place 16-point CFFT.
///
/// # Example
///
/// ```
/// use microfft::{Complex32, complex::cfft_16};
///
/// let mut input = [Complex32::default(); 16];
/// let result = cfft_16(&mut input);
/// ```
///
/// # Panics
///
/// Panics if `input` has a length other than `16`.
#[inline]
pub fn cfft_16(input: &mut [Complex32]) -> &mut [Complex32] {
    assert_eq!(input.len(), 16);
    CFftN16::transform(input)
}

/// Perform an in-place 32-point CFFT.
///
/// # Example
///
/// ```
/// use microfft::{Complex32, complex::cfft_32};
///
/// let mut input = [Complex32::default(); 32];
/// let result = cfft_32(&mut input);
/// ```
///
/// # Panics
///
/// Panics if `input` has a length other than `32`.
#[inline]
pub fn cfft_32(input: &mut [Complex32]) -> &mut [Complex32] {
    assert_eq!(input.len(), 32);
    CFftN32::transform(input)
}

/// Perform an in-place 64-point CFFT.
///
/// # Example
///
/// ```
/// use microfft::{Complex32, complex::cfft_64};
///
/// let mut input = [Complex32::default(); 64];
/// let result = cfft_64(&mut input);
/// ```
///
/// # Panics
///
/// Panics if `input` has a length other than `64`.
#[inline]
pub fn cfft_64(input: &mut [Complex32]) -> &mut [Complex32] {
    assert_eq!(input.len(), 64);
    CFftN64::transform(input)
}

/// Perform an in-place 128-point CFFT.
///
/// # Example
///
/// ```
/// use microfft::{Complex32, complex::cfft_128};
///
/// let mut input = [Complex32::default(); 128];
/// let result = cfft_128(&mut input);
/// ```
///
/// # Panics
///
/// Panics if `input` has a length other than `128`.
#[inline]
pub fn cfft_128(input: &mut [Complex32]) -> &mut [Complex32] {
    assert_eq!(input.len(), 128);
    CFftN128::transform(input)
}

/// Perform an in-place 256-point CFFT.
///
/// # Example
///
/// ```
/// use microfft::{Complex32, complex::cfft_256};
///
/// let mut input = [Complex32::default(); 256];
/// let result = cfft_256(&mut input);
/// ```
///
/// # Panics
///
/// Panics if `input` has a length other than `256`.
#[inline]
pub fn cfft_256(input: &mut [Complex32]) -> &mut [Complex32] {
    assert_eq!(input.len(), 256);
    CFftN256::transform(input)
}

/// Perform an in-place 512-point CFFT.
///
/// # Example
///
/// ```
/// use microfft::{Complex32, complex::cfft_512};
///
/// let mut input = [Complex32::default(); 512];
/// let result = cfft_512(&mut input);
/// ```
///
/// # Panics
///
/// Panics if `input` has a length other than `512`.
#[inline]
pub fn cfft_512(input: &mut [Complex32]) -> &mut [Complex32] {
    assert_eq!(input.len(), 512);
    CFftN512::transform(input)
}

/// Perform an in-place 1024-point CFFT.
///
/// # Example
///
/// ```
/// use microfft::{Complex32, complex::cfft_1024};
///
/// let mut input = [Complex32::default(); 1024];
/// let result = cfft_1024(&mut input);
/// ```
///
/// # Panics
///
/// Panics if `input` has a length other than `1024`.
#[inline]
pub fn cfft_1024(input: &mut [Complex32]) -> &mut [Complex32] {
    assert_eq!(input.len(), 1024);
    CFftN1024::transform(input)
}