BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
op_BZ_VectorElementwiseMultiplication.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_OP_BZ_VECTORELEMENTWISEMULTIPLICATION_HPP
13#define BELFEM_OP_BZ_VECTORELEMENTWISEMULTIPLICATION_HPP
14
15#include "assert.hpp"
16#include "blaze_config.hpp"
17#include <blaze/math/blas/gemv.h>
18
19#include "cl_BZ_Vector.hpp"
20
21namespace belfem
22{
23//------------------------------------------------------------------------------
24
25 template< typename T >
26 blaze::DynamicVector<T, blaze::columnVector>
28 const Vector<T> & aA,
29 const Vector<T> & aB )
30 {
31
32 BELFEM_ASSERT( aA.length() == aB.length(),
33 "Length of vectors does not match ( %lu and %lu )",
34 ( long unsigned int ) aA.length(),
35 ( long unsigned int ) aB.length() );
36
37 blaze::DynamicVector<T, blaze::columnVector> aC( aA.length() );
38
39 const size_t tN = aA.length();
40
41 for( size_t k=0; k<tN; ++k )
42 {
43 aC[ k ] = aA( k ) * aB( k );
44 }
45 return aC;
46 }
47
48//--------------------------------------------------------------------------------
49}
50
51#endif //BELFEM_FN_BZ_VECTORELEMENTWISEMULTIPLICATION_HPP
#define BELFEM_ASSERT(aCheck,...)
Definition assert.hpp:244
Column vector.
Definition cl_BZ_Vector.hpp:41
size_t length() const
get the length of the vector
Definition cl_AR_Vector.hpp:257
USER GUIDES:
Definition cl_Capacitor.cpp:16
auto operator%(const Vector< T > &aA, const Vector< T > &aB) -> decltype(aA.vector_data() % aB.vector_data())
Definition op_AR_VectorElementwiseMultiplication.hpp:22