# nextn, nextnevn¶

## Purpose¶

Returns allowable matrix dimensions for computing FFT’s.

## Format¶

n = nextn(n0)
n = nextnevn(n0)
Parameters

n0 (scalar) – the length of a vector or the number of rows or columns in a matrix.

Returns

n (scalar) – the next allowable size for the given dimension for computing an FFT or RFFT. $$n > n0$$.

## Examples¶

n = nextn(456);


The code above will assign n to be equal to 480.

## Remarks¶

The Temperton FFT routines (see table below) can handle any matrix whose dimensions can be expressed as:

$2p \times 3q \times 5r \times 7s$

where p, q and r are nonnegative integers and s is equal to 0 or 1.

The one restriction is that the vector length or matrix column size must be even (p must be positive) when computing RFFT’s.

The fftn(), etc., functions will automatically pad matrices (with zeros) to the next allowable dimensions. The functions nextn() and nextnevn() are provided in case you want to check or fix matrix sizes yourself.

Use the following table to determine what to call for a given function and matrix:

FFT

Vector

Matrix

Matrix

Function

Length

Rows

Columns

fftn()

nextn()

nextn()

nextn()

rfftn()

nextnevn()

nextn()

nextnevn()

rfftnp()

nextnevn()

nextn()

nextnevn()

optim.src