Window Functions
Window function wrappers from mechestim. These generate window
arrays used in signal processing (e.g., for windowed FFTs).
Cost Summary
| Operation | Cost Formula | Notes |
|---|---|---|
bartlett |
\(n\) | Linear taper |
hamming |
\(n\) | One cosine term |
hanning |
\(n\) | One cosine term |
blackman |
\(3n\) | Three cosine terms |
kaiser |
\(3n\) | Bessel function evaluation |
Examples
import mechestim as me
with me.BudgetContext(flop_budget=1_000_000) as budget:
win = me.hamming(256) # 256 FLOPs
win2 = me.kaiser(256) # 768 FLOPs (3 * 256)
print(f"Window cost: {budget.flops_used}") # 1024
API Reference
mechestim._window
Window function wrappers with FLOP counting.
bartlett_cost(n)
FLOP cost of Bartlett window generation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
int
|
Window length. |
required |
Returns:
| Type | Description |
|---|---|
int
|
Estimated FLOP count: n. |
Notes
One linear evaluation per sample.
Source code in src/mechestim/_window.py
blackman_cost(n)
FLOP cost of Blackman window generation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
int
|
Window length. |
required |
Returns:
| Type | Description |
|---|---|
int
|
Estimated FLOP count: 3n. |
Notes
Three cosine terms per sample.
Source code in src/mechestim/_window.py
hamming_cost(n)
FLOP cost of Hamming window generation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
int
|
Window length. |
required |
Returns:
| Type | Description |
|---|---|
int
|
Estimated FLOP count: 2n. |
Notes
One cosine evaluation plus one linear combination per sample.
Source code in src/mechestim/_window.py
hanning_cost(n)
FLOP cost of Hanning window generation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
int
|
Window length. |
required |
Returns:
| Type | Description |
|---|---|
int
|
Estimated FLOP count: 2n. |
Notes
One cosine evaluation plus one linear combination per sample.
Source code in src/mechestim/_window.py
kaiser_cost(n)
FLOP cost of Kaiser window generation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
int
|
Window length. |
required |
Returns:
| Type | Description |
|---|---|
int
|
Estimated FLOP count: 3n. |
Notes
Bessel function evaluation per sample.