BELFEM 0.9.4
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
fn_norm.hpp
Go to the documentation of this file.
1/*
2 * BELFEM -- The Berkeley Lab Finite Element Framework
3 * Copyright (c) 2026, The Regents of the University of California,
4 * through Lawrence Berkeley National Laboratory (subject to receipt of any required
5 * approvals from the U.S. Dept. of Energy). All rights reserved.
6 *
7 * Developers: Christian Messe, Gregory Giard
8 *
9 * See the top-level LICENSE file for the complete license and disclaimer.
10 */
11
17
25
26#ifndef BELFEM_FN_NORM_HPP
27#define BELFEM_FN_NORM_HPP
28
29#include "cl_Vector.hpp"
30
31namespace belfem
32{
33//------------------------------------------------------------------------------
34
35// The expression overload takes a non-const reference on purpose: an rvalue backend expression
36// then binds to the backend's own norm through argument-dependent lookup, while a const reference
37// here would make the two equally good matches and the call ambiguous.
38#ifdef BELFEM_ARMADILLO
39 template< typename ET >
40 auto
41 norm( ET & aA )
42 ->decltype( arma::norm( aA, 2 ) )
43 {
44 return arma::norm( aA, 2 );
45 }
46#elif BELFEM_BLAZE
47 template< typename ET >
48 auto
49 norm( ET & aA )
50 ->decltype( blaze::norm( aA ) )
51 {
52 return blaze::norm( aA );
53 }
54#endif
55// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
56
57 template< typename T >
58 auto
59 norm( const Vector< T > & aA )
60 -> decltype( norm( aA.vector_data() ) )
61 {
62 return norm( aA.vector_data() );
63 }
64
65//------------------------------------------------------------------------------
66
67}
68#endif //BELFEM_FN_NORM_HPP
Column vector.
Definition cl_BZ_Vector.hpp:42
auto norm(const Vector< T > &aA) -> decltype(norm(aA.vector_data()))
Euclidean (L2) norm of a vector.
Definition fn_norm.hpp:59
USER GUIDES:
Definition cl_Capacitor.cpp:16