rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Functions
rexlib::ops Namespace Reference

The declarations of the operations: their operands, parameters and rules. More...

Classes

class  abs_operation
 Compute the absolute value of each element of the input array. More...
 
class  acos_operation
 Compute the arc cosine of each element. More...
 
class  acosh_operation
 Compute the inverse hyperbolic cosine of each element. More...
 
class  add_operation
 Add the elements of two input arrays into an output array. More...
 
class  all_operation
 Test whether every element along the reduced axes is true. More...
 
class  amax_operation
 Take the largest element along the reduced axes. More...
 
class  amin_operation
 Take the smallest element along the reduced axes. More...
 
class  angle_operation
 Compute the argument of each element of the input array. More...
 
class  any_operation
 Test whether any element along the reduced axes is true. More...
 
class  arange_operation
 Write the arithmetic progression start + i * step. More...
 
class  argmax_operation
 Locate the largest element along the reduced axes. More...
 
class  argmin_operation
 Locate the smallest element along the reduced axes. More...
 
class  asin_operation
 Compute the arc sine of each element. More...
 
class  asinh_operation
 Compute the inverse hyperbolic sine of each element. More...
 
class  atan2_operation
 Compute the arc tangent of two arrays, by quadrant. More...
 
class  atan_operation
 Compute the arc tangent of each element. More...
 
class  atanh_operation
 Compute the inverse hyperbolic tangent of each element. More...
 
struct  axes_of
 Accessor reading the axes an operation acts along. More...
 
class  axis_selection
 The axes an operation acts along. More...
 
class  bitwise_and_operation
 Compute the bitwise conjunction of two arrays. More...
 
class  bitwise_not_operation
 Invert the bits of each element of the input array. More...
 
class  bitwise_or_operation
 Compute the bitwise disjunction of two arrays. More...
 
class  bitwise_xor_operation
 Compute the bitwise exclusive disjunction of two arrays. More...
 
class  cbrt_operation
 Compute the cube root of each element of the input array. More...
 
class  ceil_operation
 Round each element of the input array upwards. More...
 
class  clip_operation
 Confine the elements of an array to an interval. More...
 
class  conjugate_operation
 Conjugate each element of the input array. More...
 
class  copy_operation
 Copy elements from an input array to an output array. More...
 
class  copysign_operation
 Take the magnitude of one array and the sign of another. More...
 
class  cos_operation
 Compute the cosine of each element. More...
 
class  cosh_operation
 Compute the hyperbolic cosine of each element. More...
 
class  count_nonzero_operation
 Count the non zero elements along the reduced axes. More...
 
struct  count_of
 Accessor reading the number of values an operation produces. More...
 
class  cross_operation
 Take the cross product of two arrays along one axis. More...
 
class  degrees_operation
 Convert each element of the input array to degrees. More...
 
class  divide_operation
 Divide the elements of two input arrays into an output array. More...
 
class  divmod_operation
 Divide two arrays, producing the quotient and remainder. More...
 
class  equal_operation
 Test whether the elements of one array are equal to those of another. More...
 
class  exp2_operation
 Raise two to the power of each element of the input array. More...
 
class  exp_operation
 Raise e to the power of each element of the input array. More...
 
class  expm1_operation
 Compute the exponential of each element, minus one. More...
 
struct  extent_of
 Accessor reading the extent an operation fixes. More...
 
class  fft_operation
 Transform an array to the frequency domain. More...
 
class  fftshift_operation
 Move the zero frequency of a spectrum to its centre. More...
 
class  fill_operation
 Fill an array with a constant value. More...
 
class  floor_divide_operation
 Divide two input arrays, rounding the quotient downwards. More...
 
class  floor_operation
 Round each element of the input array downwards. More...
 
class  fold_in_key_operation
 Derive keys from keys and values. More...
 
class  greater_equal_operation
 Test whether the elements of one array are greater than or equal to those of another. More...
 
class  greater_operation
 Test whether the elements of one array are greater than those of another. More...
 
struct  half_spectrum_extent_transform
 Transform mapping the extent of a real signal onto the extent of its half spectrum. More...
 
class  hypot_operation
 Compute the hypotenuse of two arrays. More...
 
class  ifft_operation
 Transform an array back from the frequency domain. More...
 
class  ifftshift_operation
 Move the zero frequency of a spectrum back to its origin. More...
 
class  irfft_operation
 Transform a half spectrum back into a real array. More...
 
class  is_finite_operation
 Test whether each element is neither infinite nor not a number. More...
 
class  is_inf_operation
 Test whether each element is infinite. More...
 
class  is_nan_operation
 Test whether each element is not a number. More...
 
struct  keep_dimensions_of
 Accessor reading whether an operation keeps the axes it removes with an extent of one. More...
 
class  left_shift_operation
 Shift the bits of an array leftwards. More...
 
class  less_equal_operation
 Test whether the elements of one array are less than or equal to those of another. More...
 
class  less_operation
 Test whether the elements of one array are less than those of another. More...
 
class  linspace_operation
 Write evenly spaced samples of the segment from start to stop. More...
 
class  log10_operation
 Compute the base ten logarithm of each element. More...
 
class  log1p_operation
 Compute the natural logarithm of one plus each element. More...
 
class  log2_operation
 Compute the base two logarithm of each element. More...
 
class  log_operation
 Compute the natural logarithm of each element. More...
 
class  logical_and_operation
 Compute the conjunction of two arrays. More...
 
class  logical_not_operation
 Compute the negation of an array. More...
 
class  logical_or_operation
 Compute the disjunction of two arrays. More...
 
class  logical_xor_operation
 Compute the exclusive disjunction of two arrays. More...
 
class  matmul_operation
 Multiply two arrays as stacks of matrices. More...
 
class  matvec_operation
 Multiply a stack of matrices by a stack of vectors. More...
 
class  maximum_operation
 Take the larger of each pair of elements. More...
 
class  mean_operation
 Average the elements along the reduced axes. More...
 
class  minimum_operation
 Take the smaller of each pair of elements. More...
 
class  modulo_operation
 Compute the division remainder of two input arrays. More...
 
class  multiply_operation
 Multiply the elements of two input arrays into an output array. More...
 
class  negate_operation
 Negate each element of the input array into the output array. More...
 
class  not_equal_operation
 Test whether the elements of one array are different from those of another. More...
 
struct  ops_component
 Component tag for the generic operation catalog. More...
 
class  power_operation
 Raise the elements of an array to the power of another. More...
 
class  product_operation
 Multiply the elements along the reduced axes. More...
 
class  radians_operation
 Convert each element of the input array to radians. More...
 
class  reciprocal_operation
 Divide one by each element of the input array. More...
 
class  reduction_axes
 The axes a reduction acts along, and whether its result keeps them with an extent of one. More...
 
class  restored_signal_axes
 The axes an inverse real transform acts along, and the extent of the last of them. More...
 
class  rfft_operation
 Transform a real array to the frequency domain. More...
 
class  right_shift_operation
 Shift the bits of an array rightwards. More...
 
class  round_operation
 Round each element of the input array to the nearest. More...
 
class  sequence_length
 The number of values a sequence holds. More...
 
class  sign_bit_operation
 Test whether the sign bit of each element is set. More...
 
class  sign_operation
 Extract the sign of each element of the input array. More...
 
class  sin_operation
 Compute the sine of each element. More...
 
class  sincos_operation
 Compute the sine and cosine of each element at once. More...
 
class  sinh_operation
 Compute the hyperbolic sine of each element. More...
 
class  split_key_operation
 Derive a sequence of keys from every key. More...
 
class  sqrt_operation
 Compute the square root of each element of the input array. More...
 
class  square_operation
 Multiply each element of the input array by itself. More...
 
class  subtract_operation
 Subtract the elements of two input arrays into an output array. More...
 
class  sum_operation
 Add the elements of the input array along the reduced axes. More...
 
class  tan_operation
 Compute the tangent of each element. More...
 
class  tanh_operation
 Compute the hyperbolic tangent of each element. More...
 
class  trunc_operation
 Round each element of the input array towards zero. More...
 
class  vecdot_operation
 Contract two arrays along one axis, broadcasting the rest. More...
 
class  vecmat_operation
 Multiply a stack of conjugated vectors by a stack of matrices. More...
 
class  where_operation
 Select between two arrays according to a condition. More...
 

Typedefs

using axis_list = std::vector< std::size_t >
 The axes an operation acts along.
 
template<std::size_t E>
using axis_half_spectrum_of = extent_slot< E, half_spectrum_extent_transform >
 Axis holding the half spectrum of an extent variable.
 
using nullary_elementwise_shape_rule = operand_shape_rule< type_list<>, type_list< core_dimensions<> >, type_list<>, trailing_core, output_batch::broadcast_target >
 Operation without operands to read that writes into the outputs it is handed, whatever their shape.
 
using unary_elementwise_shape_rule = operand_shape_rule< type_list<>, type_list< core_dimensions<> >, type_list< core_dimensions<> >, trailing_core, output_batch::broadcast_target >
 Operation of one operand applied to every element.
 
using binary_elementwise_shape_rule = operand_shape_rule< type_list<>, type_list< core_dimensions<> >, type_list< core_dimensions<>, core_dimensions<> >, trailing_core, output_batch::broadcast_target >
 Operation of two operands applied to every pair of elements their shapes broadcast to.
 
using ternary_elementwise_shape_rule = operand_shape_rule< type_list<>, type_list< core_dimensions<> >, type_list< core_dimensions<>, core_dimensions<>, core_dimensions<> >, trailing_core, output_batch::broadcast_target >
 Operation of three operands applied to every triple of elements their shapes broadcast to.
 
using unary_pair_elementwise_shape_rule = operand_shape_rule< type_list<>, type_list< core_dimensions<>, core_dimensions<> >, type_list< core_dimensions<> >, trailing_core, output_batch::broadcast_target >
 Operation of one operand applied to every element, producing two results of each.
 
using binary_pair_elementwise_shape_rule = operand_shape_rule< type_list<>, type_list< core_dimensions<>, core_dimensions<> >, type_list< core_dimensions<>, core_dimensions<> >, trailing_core, output_batch::broadcast_target >
 Operation of two operands applied to every pair of elements, producing two results of each.
 
using reduction_shape_rule = operand_shape_rule< type_list<>, type_list< core_dimensions<> >, type_list< core_dimensions< axis_run<> > >, named_core< axes_of, keep_dimensions_of > >
 Reduction along the axes the operation names.
 
using extremum_reduction_shape_rule = operand_shape_rule< type_list<>, type_list< core_dimensions<> >, type_list< core_dimensions< axis_run< positive_extent_domain > > >, named_core< axes_of, keep_dimensions_of > >
 Reduction selecting one element along the axes the operation names.
 
using vector_dot_shape_rule = operand_shape_rule< type_list< extent_from_inputs<> >, type_list< core_dimensions<> >, type_list< core_dimensions< axis_same_as< 0 > >, core_dimensions< axis_same_as< 0 > > >, named_core< axes_of, keep_dimensions_of > >
 Dot product of two stacks of vectors along the axis the operation names.
 
using cross_product_shape_rule = operand_shape_rule< type_list< extent_fixed< 3 > >, type_list< core_dimensions< axis_same_as< 0 > > >, type_list< core_dimensions< axis_same_as< 0 > >, core_dimensions< axis_same_as< 0 > > >, named_core< axes_of > >
 Cross product of two stacks of three component vectors along the axis the operation names.
 
using fourier_transform_shape_rule = operand_shape_rule< type_list<>, type_list< core_dimensions< axis_run<> > >, type_list< core_dimensions< axis_run< positive_extent_domain > > >, named_core< axes_of > >
 Transform along the axes the operation names, each of which must hold a sample.
 
using axiswise_shape_rule = operand_shape_rule< type_list<>, type_list< core_dimensions< axis_run<> > >, type_list< core_dimensions< axis_run<> > >, named_core< axes_of > >
 Operation along the axes the operation names that keeps their extents.
 
using keyed_axiswise_shape_rule = operand_shape_rule< type_list<>, type_list< core_dimensions< axis_run<> > >, type_list< core_dimensions< axis_run<> >, core_dimensions<> >, named_core< axes_of > >
 Operation along the axes the operation names that keeps their extents, reading a second input without core axes.
 
using real_fourier_transform_shape_rule = operand_shape_rule< type_list< extent_from_inputs< positive_extent_domain > >, type_list< core_dimensions< axis_run<>, axis_half_spectrum_of< 0 > > >, type_list< core_dimensions< axis_run< positive_extent_domain >, axis_same_as< 0 > > >, named_core< axes_of > >
 Transform of a real signal along the axes the operation names.
 
using inverse_real_fourier_transform_shape_rule = operand_shape_rule< type_list< extent_from_operation< extent_of, positive_extent_domain > >, type_list< core_dimensions< axis_run<>, axis_same_as< 0 > > >, type_list< core_dimensions< axis_run< positive_extent_domain >, axis_half_spectrum_of< 0 > > >, named_core< axes_of > >
 Inverse of real_fourier_transform_shape_rule.
 
using matrix_multiply_shape_rule = operand_shape_rule< type_list< extent_from_inputs<>, extent_from_inputs<>, extent_from_inputs<> >, type_list< core_dimensions< axis_same_as< 0 >, axis_same_as< 2 > > >, type_list< core_dimensions< axis_same_as< 0 >, axis_same_as< 1 > >, core_dimensions< axis_same_as< 1 >, axis_same_as< 2 > > > >
 Product of two stacks of matrices.
 
using matrix_vector_shape_rule = operand_shape_rule< type_list< extent_from_inputs<>, extent_from_inputs<> >, type_list< core_dimensions< axis_same_as< 0 > > >, type_list< core_dimensions< axis_same_as< 0 >, axis_same_as< 1 > >, core_dimensions< axis_same_as< 1 > > > >
 Product of a stack of matrices and a stack of vectors.
 
using vector_matrix_shape_rule = operand_shape_rule< type_list< extent_from_inputs<>, extent_from_inputs<> >, type_list< core_dimensions< axis_same_as< 1 > > >, type_list< core_dimensions< axis_same_as< 0 > >, core_dimensions< axis_same_as< 0 >, axis_same_as< 1 > > > >
 Product of a stack of vectors and a stack of matrices.
 
using sequence_shape_rule = operand_shape_rule< type_list< extent_from_operation< count_of > >, type_list< core_dimensions< axis_same_as< 0 > > >, type_list<> >
 Sequence of as many values as the operation names.
 
using elementwise_sequence_shape_rule = operand_shape_rule< type_list< extent_from_operation< count_of > >, type_list< core_dimensions< axis_same_as< 0 > > >, type_list< core_dimensions<> > >
 Sequence of as many values as the operation names for every element of the input.
 
template<typename Domain = any_type_domain>
using unary_homogeneous_rule = operand_type_rule< type_list< pivot_from_input< 0, Domain > >, type_list< slot_same_as< 0 > >, type_list< slot_same_as< 0 > > >
 Unary operation whose operands share one element type.
 
template<typename Domain = any_type_domain>
using binary_homogeneous_rule = operand_type_rule< type_list< pivot_from_input< 0, Domain > >, type_list< slot_same_as< 0 > >, type_list< slot_same_as< 0 >, slot_same_as< 0 > > >
 Binary operation whose operands share one element type.
 
template<typename Domain = any_type_domain>
using ternary_homogeneous_rule = operand_type_rule< type_list< pivot_from_input< 0, Domain > >, type_list< slot_same_as< 0 > >, type_list< slot_same_as< 0 >, slot_same_as< 0 >, slot_same_as< 0 > > >
 Ternary operation whose operands share one element type.
 
template<typename Domain = arithmetic_type_domain>
using unary_real_of_rule = operand_type_rule< type_list< pivot_from_input< 0, Domain > >, type_list< slot_real_of< 0 > >, type_list< slot_same_as< 0 > > >
 Unary operation producing the real counterpart of its input.
 
template<typename Domain = inexact_type_domain>
using unary_complex_of_rule = operand_type_rule< type_list< pivot_from_input< 0, Domain > >, type_list< slot_complex_of< 0 > >, type_list< slot_same_as< 0 > > >
 Unary operation producing the complex counterpart of its input.
 
template<typename Domain = arithmetic_type_domain>
using unary_inexact_of_rule = operand_type_rule< type_list< pivot_from_input< 0, Domain > >, type_list< slot_inexact_of< 0 > >, type_list< slot_same_as< 0 > > >
 Unary operation producing the inexact counterpart of its input.
 
template<numerical_type Type, typename Domain = any_type_domain>
using unary_fixed_output_rule = operand_type_rule< type_list< pivot_from_input< 0, Domain > >, type_list< slot_fixed< Type > >, type_list< slot_same_as< 0 > > >
 Unary operation whose output has a fixed element type.
 
template<typename Domain = any_type_domain>
using unary_predicate_rule = unary_fixed_output_rule< numerical_type::boolean, Domain >
 Unary operation producing a boolean output.
 
template<typename Domain = any_type_domain>
using binary_predicate_rule = operand_type_rule< type_list< pivot_from_input< 0, Domain > >, type_list< slot_fixed< numerical_type::boolean > >, type_list< slot_same_as< 0 >, slot_same_as< 0 > > >
 Binary comparison producing a boolean output.
 
template<typename Domain = inexact_type_domain>
using unary_homogeneous_pair_rule = operand_type_rule< type_list< pivot_from_input< 0, Domain > >, type_list< slot_same_as< 0 >, slot_same_as< 0 > >, type_list< slot_same_as< 0 > > >
 Unary operation producing two outputs of the operand type.
 
template<typename Domain = real_arithmetic_type_domain>
using binary_homogeneous_pair_rule = operand_type_rule< type_list< pivot_from_input< 0, Domain > >, type_list< slot_same_as< 0 >, slot_same_as< 0 > >, type_list< slot_same_as< 0 >, slot_same_as< 0 > > >
 Binary operation producing two outputs of the operand type.
 
template<typename Domain = arithmetic_type_domain>
using masked_unary_homogeneous_rule = operand_type_rule< type_list< pivot_from_input< 0, Domain > >, type_list< slot_same_as< 0 > >, type_list< slot_same_as< 0 >, slot_fixed< numerical_type::boolean > > >
 Unary operation taking a boolean mask alongside its operand.
 
template<typename Domain = arithmetic_type_domain>
using masked_binary_homogeneous_rule = operand_type_rule< type_list< pivot_from_input< 0, Domain > >, type_list< slot_same_as< 0 > >, type_list< slot_same_as< 0 >, slot_same_as< 0 >, slot_fixed< numerical_type::boolean > > >
 Binary operation taking a boolean mask alongside its operands.
 
template<typename Domain = floating_point_type_domain, numerical_type Key = numerical_type::uint64>
using keyed_unary_homogeneous_rule = operand_type_rule< type_list< pivot_from_input< 0, Domain > >, type_list< slot_same_as< 0 > >, type_list< slot_same_as< 0 >, slot_fixed< Key > > >
 Unary operation taking a key of a fixed element type alongside its operand.
 
template<typename Domain = any_type_domain>
using selection_rule = operand_type_rule< type_list< pivot_from_input< 1, Domain > >, type_list< slot_same_as< 0 > >, type_list< slot_fixed< numerical_type::boolean >, slot_same_as< 0 >, slot_same_as< 0 > > >
 Selection between two operands driven by a boolean condition.
 
template<typename FirstDomain = floating_point_type_domain, typename SecondDomain = signed_integer_type_domain>
using binary_heterogeneous_rule = operand_type_rule< type_list< pivot_from_input< 0, FirstDomain >, pivot_from_input< 1, SecondDomain > >, type_list< slot_same_as< 0 > >, type_list< slot_same_as< 0 >, slot_same_as< 1 > > >
 Binary operation whose operands have unrelated element types.
 
template<typename Domain = any_type_domain>
using nullary_free_rule = operand_type_rule< type_list< pivot_from_output< 0, Domain > >, type_list< slot_same_as< 0 > >, type_list<> >
 Nullary operation whose output element type is free.
 
template<typename OutputDomain = any_type_domain, typename InputDomain = any_type_domain>
using converting_rule = operand_type_rule< type_list< pivot_from_output< 0, OutputDomain, 1 >, pivot_from_input< 0, InputDomain > >, type_list< slot_same_as< 0 > >, type_list< slot_same_as< 1 > > >
 Unary operation whose output element type is independent.
 

Enumerations

enum class  fourier_normalization { backward , ortho , forward }
 Which of a transform pair carries the scaling. More...
 
enum class  fourier_direction { forward , inverse }
 Which way round a transform goes. More...
 

Functions

 REXLIB_DECLARE_OPERATION_TRAITS (fill, ops_component, REXLIB_OPERANDS("destination"), REXLIB_OPERANDS(), nullary_elementwise_shape_rule, nullary_free_rule<>)
 
 REXLIB_DECLARE_PARAMETRIC_OPERATION_TRAITS (arange, ops_component, REXLIB_OPERANDS("result"), REXLIB_OPERANDS(), sequence_shape_rule, sequence_length, nullary_free_rule< real_arithmetic_type_domain >)
 
 REXLIB_DECLARE_PARAMETRIC_OPERATION_TRAITS (linspace, ops_component, REXLIB_OPERANDS("result"), REXLIB_OPERANDS(), sequence_shape_rule, sequence_length, nullary_free_rule< inexact_type_domain >)
 
 REXLIB_DECLARE_PARAMETRIC_OPERATION_TRAITS (fft, ops_component, REXLIB_OPERANDS("spectrum"), REXLIB_OPERANDS("signal"), fourier_transform_shape_rule, axis_selection, unary_complex_of_rule< inexact_type_domain >)
 
const char * to_string (fourier_normalization normalization) noexcept
 
std::ostream & operator<< (std::ostream &os, fourier_normalization normalization)
 
const char * to_string (fourier_direction direction) noexcept
 
std::ostream & operator<< (std::ostream &os, fourier_direction direction)
 
double get_fourier_scale (fourier_normalization normalization, fourier_direction direction, std::size_t sample_count) noexcept
 Get the factor a transform multiplies its result by.
 
 REXLIB_DECLARE_PARAMETRIC_OPERATION_TRAITS (ifft, ops_component, REXLIB_OPERANDS("signal"), REXLIB_OPERANDS("spectrum"), fourier_transform_shape_rule, axis_selection, unary_homogeneous_rule< complex_type_domain >)
 
 REXLIB_DECLARE_PARAMETRIC_OPERATION_TRAITS (irfft, ops_component, REXLIB_OPERANDS("signal"), REXLIB_OPERANDS("spectrum"), inverse_real_fourier_transform_shape_rule, restored_signal_axes, unary_real_of_rule< complex_type_domain >)
 
 REXLIB_DECLARE_PARAMETRIC_OPERATION_TRAITS (rfft, ops_component, REXLIB_OPERANDS("spectrum"), REXLIB_OPERANDS("signal"), real_fourier_transform_shape_rule, axis_selection, unary_complex_of_rule< floating_point_type_domain >)
 
 REXLIB_DECLARE_PARAMETRIC_OPERATION_TRAITS (split_key, ops_component, REXLIB_OPERANDS("result"), REXLIB_OPERANDS("key"), elementwise_sequence_shape_rule, sequence_length, unary_homogeneous_rule< single_type_domain< numerical_type::uint64 > >)
 

Detailed Description

The declarations of the operations: their operands, parameters and rules.

Typedef Documentation

◆ axis_half_spectrum_of

Axis holding the half spectrum of an extent variable.

Template Parameters
EIndex of the extent variable.

◆ axis_list

using rexlib::ops::axis_list = typedef std::vector<std::size_t>

The axes an operation acts along.

Explicit and non negative. An axis referred from the end is resolved by whoever holds the array, since resolving it needs the rank.

Enumeration Type Documentation

◆ fourier_direction

Which way round a transform goes.

Half of what a scale factor depends on, the other half being the convention. It is a property of the operation rather than a parameter of it: there is no transform that is forward or inverse depending on what it is told.

Enumerator
forward 

From the signal domain to the frequency domain.

inverse 

From the frequency domain back to the signal domain.

◆ fourier_normalization

Which of a transform pair carries the scaling.

A discrete Fourier transform followed by its inverse multiplies a signal by the number of samples, so one of the two has to divide it back out. Which one is a convention rather than a fact, and this is it.

The convention is named rather than the factor itself so that a transform and its inverse undo one another whenever they are given the same one. A caller that names a factor per transform instead is left to pair the two up correctly, and pairing them wrongly is silent.

There is deliberately no "none": it would be fourier_normalization::backward on a forward transform and fourier_normalization::forward on an inverse one, so it names no scaling that cannot already be asked for, and two spellings of one operation are two programs where there should be one.

Enumerator
backward 

The inverse transform divides by the number of samples.

The forward transform is left as it is computed. This is what NumPy, SciPy and the array API all do when no convention is named.

ortho 

Both transforms divide by the square root of the count.

The only convention under which the transform preserves the total energy of the signal, so that Parseval's identity holds without a factor, and the only one that is its own mirror image.

forward 

The forward transform divides by the number of samples.

The inverse is then left as it is computed. Makes the zero frequency of a forward transform the mean of the signal rather than its total.

Function Documentation

◆ get_fourier_scale()

double rexlib::ops::get_fourier_scale ( fourier_normalization  normalization,
fourier_direction  direction,
std::size_t  sample_count 
)
noexcept

Get the factor a transform multiplies its result by.

Exported because every backend needs it and none of them is given the convention itself: pocketfft and MKL take a factor, FFTW and cuFFT take nothing at all and have to apply one themselves. Deriving it here, once, is what keeps a transform meaning the same thing whichever of them runs it.

Parameters
normalizationWhich of the transform pair carries the scaling.
directionWhich way round this transform goes.
sample_countThe number of samples reaching each transformed value, which is the product of the signal extents along the transformed axes. The signal is the operand that is not a half spectrum, so a real transform and its inverse are both measured against the real operand rather than against the coefficients actually stored. A count of zero returns one, there being nothing to scale.
Returns
double The factor.