Peano
Loading...
Searching...
No Matches
VectorVectorOperations.h
Go to the documentation of this file.
1// This file is part of the Peano project. For conditions of distribution and
2// use, please see the copyright notice at www.peano-framework.org
3#pragma once
4
5#include "tarch/la/Vector.h"
6
7namespace tarch {
8 namespace la {
9
15 template <int Size, typename Scalar>
17
23 template <int Size, typename Scalar>
25
31 template <int Size, typename Scalar>
33
39 template <int Size, typename Scalar>
41
46 template <int Size, typename Scalar>
48
54 template <int Size, typename Scalar>
55 Scalar operator*(const Vector<Size, Scalar>& lhs, const Vector<Size, Scalar>& rhs);
56
62 template <int Size, typename Scalar>
63 Scalar dot(const Vector<Size, Scalar>& lhs, const Vector<Size, Scalar>& rhs);
64
70 template <int Size, typename Scalar>
71 Scalar innerDot(const Vector<Size, Scalar>& lhs, const Vector<Size, Scalar>& rhs);
72
76 template <typename Scalar>
78
85 template <int Size, typename Scalar>
86 bool equals(
87 const Vector<Size, Scalar>& lhs,
88 const Vector<Size, Scalar>& rhs,
89 const Scalar tolerance = NUMERICAL_ZERO_DIFFERENCE
90 );
91
101 template <int Size, typename Scalar>
103 const Vector<Size, Scalar>& lhs,
104 const Vector<Size, Scalar>& rhs,
105 const Scalar tolerance = NUMERICAL_ZERO_DIFFERENCE
106 );
107
115 template <int Size, typename Scalar>
117 const Vector<Size, Scalar>& lhs,
118 const Vector<Size, Scalar>& rhs,
119 const Scalar tolerance = NUMERICAL_ZERO_DIFFERENCE
120 );
121
126 template <int Size, typename Scalar>
128 const Vector<Size, Scalar>& lhs,
129 const Vector<Size, Scalar>& rhs,
130 const Scalar tolerance = NUMERICAL_ZERO_DIFFERENCE
131 );
132
140 template <int Size, typename Scalar>
142 const Vector<Size, Scalar>& lhs,
143 const Vector<Size, Scalar>& rhs,
144 const Scalar tolerance = NUMERICAL_ZERO_DIFFERENCE
145 );
146
151 template <int Size, typename Scalar>
153 const Vector<Size, Scalar>& lhs,
154 const Vector<Size, Scalar>& rhs,
155 const Scalar tolerance = NUMERICAL_ZERO_DIFFERENCE
156 );
157
158 template <int Size, typename Scalar>
160 const Vector<Size, Scalar>& lhs,
161 const Vector<Size, Scalar>& rhs,
162 const Scalar tolerance = NUMERICAL_ZERO_DIFFERENCE
163 );
164
165 template <int Size, typename Scalar>
167 const Vector<Size, Scalar>& lhs,
168 const Vector<Size, Scalar>& rhs,
169 const Scalar tolerance = NUMERICAL_ZERO_DIFFERENCE
170 );
171
172 template <int Size, typename Scalar>
174 const Vector<Size, Scalar>& lhs,
175 const Vector<Size, Scalar>& rhs,
176 const Scalar tolerance = NUMERICAL_ZERO_DIFFERENCE
177 );
178
179 template <int Size, typename Scalar>
181 const Vector<Size, Scalar>& lhs,
182 const Vector<Size, Scalar>& rhs,
183 const Scalar tolerance = NUMERICAL_ZERO_DIFFERENCE
184 );
185
189 template <int Size, typename Scalar>
191
195 template <int Size, typename Scalar>
197
204 template <int Size, typename Scalar>
206
213 template <int Size, typename Scalar>
215
220 template <int Size, typename Scalar>
222 const Vector<Size, Scalar>& lhs,
223 const Vector<Size, Scalar>& rhs,
224 const Scalar tolerance = NUMERICAL_ZERO_DIFFERENCE
225 );
226
227 template <int Size>
229
233 template <int Size>
235
236 template <int Size, typename Scalar>
238 const Vector<Size, Scalar>& lhs,
239 const Vector<Size, Scalar>& rhs,
240 const Scalar tolerance = NUMERICAL_ZERO_DIFFERENCE
241 );
242 } // namespace la
243} // namespace tarch
244
245#include "tarch/la/VectorVectorOperations.cpph"
Scalar dot(const Vector< Size, Scalar > &lhs, const Vector< Size, Scalar > &rhs)
Performs the dot (=inner) product of two vectors.
bool allGreaterEquals(const Vector< Size, Scalar > &lhs, const Scalar &cmp, const Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)
bool operator!=(const Vector< Size, Scalar > &lhs, const Vector< Size, Scalar > &rhs)
Bit-wise comparison of the components of two vectors for inequality.
bool allGreater(const Vector< Size, Scalar > &lhs, const Scalar &cmp, const Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)
Vector< 3, Scalar > cross(const Vector< 3, Scalar > &lhs, const Vector< 3, Scalar > &rhs)
Performs the cross product of two 3D vectors into result.
bool oneSmaller(const Vector< Size, Scalar > &lhs, const Scalar &cmp, const Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)
int countEqualEntries(const Vector< Size, int > &lhs, const Vector< Size, int > &rhs)
Run through both vectors and count how many entries are the same.
bool operator==(const Matrix< Rows, Cols, Scalar > &lhs, const Matrix< Rows, Cols, Scalar > &rhs)
Bitwise comparison of the components of two matrices on equality.
Matrix< Rows, Cols, Scalar > operator-(const Matrix< Rows, Cols, Scalar > &lhs, const Matrix< Rows, Cols, Scalar > &rhs)
Vector< Size, Scalar > & operator+=(Vector< Size, Scalar > &vector, const Scalar &scalar)
Adds every component of the vector to the scalar and assigns the result to the vector.
constexpr double NUMERICAL_ZERO_DIFFERENCE
Definition Scalar.h:17
Matrix< Rows, Cols, Scalar > operator+(const Matrix< Rows, Cols, Scalar > &lhs, const Matrix< Rows, Cols, Scalar > &rhs)
bool oneSmallerEquals(const Vector< Size, Scalar > &lhs, const Scalar &cmp, const Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)
double max(double a, double b, double c)
I need the maximum of three values all the time, to I decided to write a function for this.
bool firstGreater(const Vector< Size, Scalar > &lhs, const Vector< Size, Scalar > &rhs, const Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)
Compares sequentially every component pair of lVector and rVector, and stops as soon as one is greate...
bool allSmallerEquals(const Vector< Size, Scalar > &lhs, const Scalar &cmp, const Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)
bool allSmaller(const Vector< Size, Scalar > &lhs, const Scalar &cmp, const Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)
Matrix< Rows, Cols, Scalar > operator*(const Matrix< Rows, X, Scalar > &lhs, const Matrix< X, Cols, Scalar > &rhs)
bool equals(const Matrix< Rows, Cols, Scalar > &lhs, const Matrix< Rows, Cols, Scalar > &rhs, const Scalar &tolerance=NUMERICAL_ZERO_DIFFERENCE)
Compares to matrices on equality by means of a numerical accuracy.
std::pair< int, int > equalsReturnIndex(const Matrix< Rows, Cols, Scalar > &lhs, const Matrix< Rows, Cols, Scalar > &rhs, const Scalar &tolerance=NUMERICAL_ZERO_DIFFERENCE)
Return Index of element which is not equals.
bool oneGreaterEquals(const Vector< Size, Scalar > &lhs, const Scalar &cmp, const Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)
Matrix< Rows, Cols, Scalar > multiplyComponents(const Matrix< Rows, X, Scalar > &lhs, const Matrix< X, Cols, Scalar > &rhs)
Scalar innerDot(const Vector< Size, Scalar > &lhs, const Vector< Size, Scalar > &rhs)
Performs the dot (=inner) product of two vectors.
Vector< Size, Scalar > & operator-=(Vector< Size, Scalar > &vector, const Scalar &scalar)
Subtracts the scalar from every component of the vector and assigns the result to the vector.
bool oneGreater(const Vector< Size, Scalar > &lhs, const Scalar &cmp, const Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)
Scalar min(const Vector< Size, Scalar > &vector)
Returns the element with minimal value (NOT absolute value).
Have to include this header, as I need access to the SYCL_EXTERNAL keyword.
Definition accelerator.h:19
Simple vector class.
Definition Vector.h:159