KFR

Expressions and Vectors

input_expression

class input_expression

Base class of all input expressoins

output_expression

class output_expression

Base class of all output expressoins

is_input_expression

template<typename E>
using is_input_expression = std::is_base_of<input_expression, decay<E>>

Check if the type argument is an input expression

Source:

template <typename E>
using is_input_expression = std::is_base_of<input_expression, decay<E>>
using is_input_expression = std::is_base_of<input_expression, decay<E>>

Check if the type argument is an input expression

Source:

using is_input_expression = std::is_base_of<input_expression, decay<E>>

is_input_expressions

template<typename ...Es>
using is_input_expressions = or_t<std::is_base_of<input_expression, decay<Es>>...>

Check if the type arguments are an input expressions

Source:

template <typename... Es>
using is_input_expressions = or_t<std::is_base_of<input_expression, decay<Es>>...>
using is_input_expressions = or_t<std::is_base_of<input_expression, decay<Es>>...>

Check if the type arguments are an input expressions

Source:

using is_input_expressions = or_t<std::is_base_of<input_expression, decay<Es>>...>

is_output_expression

template<typename E>
using is_output_expression = std::is_base_of<output_expression, decay<E>>

Check if the type argument is an output expression

Source:

template <typename E>
using is_output_expression = std::is_base_of<output_expression, decay<E>>
using is_output_expression = std::is_base_of<output_expression, decay<E>>

Check if the type argument is an output expression

Source:

using is_output_expression = std::is_base_of<output_expression, decay<E>>

is_output_expressions

template<typename ...Es>
using is_output_expressions = or_t<std::is_base_of<output_expression, decay<Es>>...>

Check if the type arguments are an output expressions

Source:

template <typename... Es>
using is_output_expressions = or_t<std::is_base_of<output_expression, decay<Es>>...>
using is_output_expressions = or_t<std::is_base_of<output_expression, decay<Es>>...>

Check if the type arguments are an output expressions

Source:

using is_output_expressions = or_t<std::is_base_of<output_expression, decay<Es>>...>

is_numeric

template<typename T>
using is_numeric = is_number<deep_subtype<T>>

Check if the type argument is a number or a vector of numbers

Source:

template <typename T>
using is_numeric = is_number<deep_subtype<T>>
using is_numeric = is_number<deep_subtype<T>>

Check if the type argument is a number or a vector of numbers

Source:

using is_numeric = is_number<deep_subtype<T>>

is_numeric_args

template<typename ...Ts>
using is_numeric_args = and_t<is_numeric<Ts>...>

Check if the type arguments are a numbers or a vectors of numbers

Source:

template <typename... Ts>
using is_numeric_args = and_t<is_numeric<Ts>...>
using is_numeric_args = and_t<is_numeric<Ts>...>

Check if the type arguments are a numbers or a vectors of numbers

Source:

using is_numeric_args = and_t<is_numeric<Ts>...>

rebind

template<typename Fn, typename ...OldArgs, typename ...NewArgs>
internal::expression_function<Fn, NewArgs...> rebind(const internal::expression_function<Fn, OldArgs...> &e, NewArgs&&... args)

Construct a new expression using the same function as in e and new arguments

Parameters:
  • e – an expression
  • args – new arguments for the function

Source:

template <typename Fn, typename... OldArgs, typename... NewArgs>
CMT_INLINE internal::expression_function<Fn, NewArgs...> rebind(
    const internal::expression_function<Fn, OldArgs...>& e, NewArgs&&... args)

slice

template<typename E1>
internal::expression_slice<E1> slice(E1 &&e1, size_t start, size_t size = infinite_size)

Returns the subrange of the given expression

Source:

template <typename E1>
CMT_INLINE internal::expression_slice<E1> slice(E1&& e1, size_t start, size_t size = infinite_size)

truncate

template<typename E1>
internal::expression_slice<E1> truncate(E1 &&e1, size_t size)

Returns the expression truncated to the given size

Source:

template <typename E1>
CMT_INLINE internal::expression_slice<E1> truncate(E1&& e1, size_t size)

reverse

template<typename E1, KFR_ENABLE_IF(is_input_expression<E1>::value)>
internal::expression_reverse<E1> reverse(E1 &&e1)

Returns reversed expression

Source:

template <typename E1, KFR_ENABLE_IF(is_input_expression<E1>::value)>
CMT_INLINE internal::expression_reverse<E1> reverse(E1&& e1)

linspace

template<typename T1, typename T2, bool precise = false, typename TF = ftype<common_type<T1, T2>>>
internal::expression_linspace<TF, precise> linspace(T1 start, T2 stop, size_t size, bool endpoint = false, bool truncate = false)

Returns evenly spaced numbers over a specified interval.

Parameters:
  • start – The starting value of the sequence
  • stop – The end value of the sequence. if endpoint is false, the last value is excluded
  • size – Number of samples to generate
  • endpoint – If true, stop is the last sample. Otherwise, it is not included
  • truncate – If true, linspace returns exactly size elements, otherwise, returns infinite sequence

Source:

template <typename T1, typename T2, bool precise = false, typename TF = ftype<common_type<T1, T2>>>
CMT_INLINE internal::expression_linspace<TF, precise> linspace(T1 start, T2 stop, size_t size,
                                                               bool endpoint = false, bool truncate = false)

adjacent

template<typename Fn, typename E1>
internal::expression_adjacent<Fn, E1> adjacent(Fn &&fn, E1 &&e1)

Returns template expression that returns the result of calling \(fn(x_i, x_{i-1})\)

Source:

template <typename Fn, typename E1>
CMT_INLINE internal::expression_adjacent<Fn, E1> adjacent(Fn&& fn, E1&& e1)

padded

template<typename E, typename T = value_type_of<E>>
internal::expression_padded<E> padded(E &&e, const T &fill_value = T(0))

Returns infinite template expression that pads e with fill_value (default value = 0)

Source:

template <typename E, typename T = value_type_of<E>>
internal::expression_padded<E> padded(E&& e, const T& fill_value = T(0))

univector

template<typename T, size_t Size = tag_dynamic_vector>
class univector

Class that represent data in KFR. Many KFR functions can take this class as an argument.

Can inherit from std::vector, std::array or keep only reference to data and its size.

univector<float> is inherited from std::vector<float> univector<float, 10> is inherited from std::array<float, 10> univector<float, 0> contains only reference to data

To convert a plain pointer to univector, call make_univector:

double* buffer;
size_t size;
univector<double, 0> v = make_univector(buffer, size);
// or pass result vector directly to a function:
some_function(make_univector(buffer, size));

univector_base

template<typename T, typename Class>
class univector_base

Base class for all univector specializations.

univector<T, 0> slice(size_t start = 0, size_t size = max_size_t)

Returns subrange of the vector.

If start is greater or equal to this->size, returns empty univector If requested size is greater than this->size, returns only available elements

Source:

univector<T, 0> slice(size_t start = 0, size_t size = max_size_t)
univector<const T, 0> slice(size_t start = 0, size_t size = max_size_t) const

Returns subrange of the vector.

If start is greater or equal to this->size, returns empty univector If requested size is greater than this->size, returns only available elements

Source:

univector<const T, 0> slice(size_t start = 0, size_t size = max_size_t) const
univector<T, 0> truncate(size_t size = max_size_t)

Returns subrange of the vector starting from 0.

If requested size is greater than this->size, returns only available elements

Source:

univector<T, 0> truncate(size_t size = max_size_t)
univector<const T, 0> truncate(size_t size = max_size_t) const

Returns subrange of the vector starting from 0.

If requested size is greater than this->size, returns only available elements

Source:

univector<const T, 0> truncate(size_t size = max_size_t) const

univector

template<typename T, size_t Size>
class univector

Class that represent data in KFR. Many KFR functions can take this class as an argument.

Can inherit from std::vector, std::array or keep only reference to data and its size.

univector<float> is inherited from std::vector<float> univector<float, 10> is inherited from std::array<float, 10> univector<float, 0> contains only reference to data

To convert a plain pointer to univector, call make_univector:

double* buffer;
size_t size;
univector<double, 0> v = make_univector(buffer, size);
// or pass result vector directly to a function:
some_function(make_univector(buffer, size));

univector_ref

template<typename T>
using univector_ref = univector<T, tag_array_ref>

Alias for univector<T, tag_array_ref>;

Source:

template <typename T>
using univector_ref = univector<T, tag_array_ref>
using univector_ref = univector<T, tag_array_ref>

Alias for univector<T, tag_array_ref>;

Source:

using univector_ref = univector<T, tag_array_ref>

univector_dyn

template<typename T>
using univector_dyn = univector<T, tag_dynamic_vector>

Alias for univector<T, tag_dynamic_vector>;

Source:

template <typename T>
using univector_dyn = univector<T, tag_dynamic_vector>
using univector_dyn = univector<T, tag_dynamic_vector>

Alias for univector<T, tag_dynamic_vector>;

Source:

using univector_dyn = univector<T, tag_dynamic_vector>

make_univector

template<typename T>
univector_ref<T> make_univector(T *data, size_t size)

Creates univector from data and size

Source:

template <typename T>
CMT_INLINE univector_ref<T> make_univector(T* data, size_t size)
template<typename T>
univector_ref<const T> make_univector(const T *data, size_t size)

Creates univector from data and size

Source:

template <typename T>
CMT_INLINE univector_ref<const T> make_univector(const T* data, size_t size)

render

template<typename Expr, typename T = value_type_of<Expr>>
univector<T> render(Expr &&expr)

Converts an expression to univector

Source:

template <typename Expr, typename T = value_type_of<Expr>>
CMT_INLINE univector<T> render(Expr&& expr)
template<typename Expr, typename T = value_type_of<Expr>>
univector<T> render(Expr &&expr, size_t size)

Converts an expression to univector

Source:

template <typename Expr, typename T = value_type_of<Expr>>
CMT_INLINE univector<T> render(Expr&& expr, size_t size)

lockfree_ring_buffer

template<typename T>
class lockfree_ring_buffer

Single producer single consumer lock-free ring buffer