BELFEM 0.9.4
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
fn_AR_dot.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
12#ifndef BELFEM_FN_AR_DOT_HPP
13#define BELFEM_FN_AR_DOT_HPP
14
15#include "assert.hpp"
16#include "cl_AR_Vector.hpp"
17#include "cl_AR_Matrix.hpp"
18
19namespace belfem
20{
21//------------------------------------------------------------------------------
22
23 template< typename T >
24 auto
25 dot( const Vector< T > & aA, const Vector< T > & aB )
26 -> decltype( arma::dot( aA.vector_data() , aB.vector_data() ) )
27 {
28 BELFEM_ASSERT( aA.length() == aB.length(),
29 "dot(): vectors must have the same length ( %lu vs %lu )",
30 ( unsigned long ) aA.length(), ( unsigned long ) aB.length() );
31 return arma::dot( aA.vector_data() , aB.vector_data() );
32 }
33
34// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
35
36
37 template< typename ET >
38 auto
39 dot( const ET & aA, const ET & aB )
40 -> decltype( arma::dot( aA , aB ) )
41 {
42 return arma::dot( aA , aB );
43 }
44
45// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
46
47 template< typename T, typename ET >
48 auto
49 dot( const Vector< T > & aA, const ET & aB )
50 ->decltype( arma::dot( aA.vector_data(), aB) )
51 {
52 return arma::dot( aA.vector_data(), aB );
53 }
54
55// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
56
57 template< typename ET, typename T >
58 auto
59 dot( const ET & aA, const Vector< T > & aB )
60 ->decltype( arma::dot( aA, aB.vector_data() ) )
61 {
62 return arma::dot( aA, aB.vector_data() );
63 }
64
65//------------------------------------------------------------------------------
66}
67#endif //BELFEM_FN_AR_DOT_HPP
#define BELFEM_ASSERT(aCheck,...)
Definition assert.hpp:244
Column vector.
Definition cl_BZ_Vector.hpp:42
auto dot(const Vector< T > &aA, const Vector< T > &aB) -> decltype(arma::dot(aA.vector_data(), aB.vector_data()))
Scalar product of two vectors.
Definition fn_AR_dot.hpp:25
USER GUIDES:
Definition cl_Capacitor.cpp:16