numerics 0.1.0
Loading...
Searching...
No Matches
reduce.hpp File Reference

Scalar reduction kernels (namespace num::kernel::reduce) More...

#include "core/types.hpp"
#include "core/vector.hpp"
#include "kernel/policy.hpp"

Go to the source code of this file.

Namespaces

namespace  num
 
namespace  num::kernel
 
namespace  num::kernel::reduce
 

Functions

real num::kernel::reduce::l1_norm (const Vector &x, seq_t) noexcept
 Sequential: calls raw::l1_norm (routes to cblas_dasum when BLAS available; otherwise auto-vectorizable seq loop).
 
real num::kernel::reduce::l1_norm (const Vector &x, par_t)
 Parallel: OMP reduction(+) over abs values; falls back to seq_t when NUMERICS_HAS_OMP is not defined.
 
real num::kernel::reduce::l1_norm (const Vector &x)
 Default policy.
 
real num::kernel::reduce::linf_norm (const Vector &x, seq_t) noexcept
 Sequential: calls raw::linf_norm (routes to cblas_idamax when BLAS available; otherwise plain max loop).
 
real num::kernel::reduce::linf_norm (const Vector &x, par_t)
 Parallel: OMP reduction(max) over abs values; falls back to seq_t when NUMERICS_HAS_OMP is not defined.
 
real num::kernel::reduce::linf_norm (const Vector &x)
 Default policy.
 
real num::kernel::reduce::sum (const Vector &x, seq_t) noexcept
 Sequential: auto-vectorizable summation loop (no BLAS equivalent).
 
real num::kernel::reduce::sum (const Vector &x, par_t)
 Parallel: OMP reduction(+) over x[i]; falls back to seq_t when NUMERICS_HAS_OMP is not defined.
 
real num::kernel::reduce::sum (const Vector &x)
 Default policy.
 

Detailed Description

Scalar reduction kernels (namespace num::kernel::reduce)

These operations collapse a Vector to a single scalar via a single memory pass. Unlike dot/norm (which live in num:: with full Backend dispatch), these are new reductions that have no existing parallel paths:

l1_norm(x) – sum |x[i]| (BLAS cblas_dasum via raw:: on seq_t path) linf_norm(x) – max |x[i]| (BLAS cblas_idamax via raw:: on seq_t path) sum(x) – sum x[i] (no BLAS equivalent; seq loop or OMP)

Each has seq_t / par_t overloads and a default that selects par_t when NUMERICS_HAS_OMP is defined at configure time.

Include kernel/kernel.hpp to get all kernel sub-modules together.

Definition in file reduce.hpp.