Peano 4
Loading...
Searching...
No Matches
VectorSlice.cpph
Go to the documentation of this file.
1template<int SizeLhs, int SizeRhs, typename Scalar>
4
5 assertion5(fromIndex>=0,fromIndex, SizeLhs, SizeRhs, stride, ::toString(vector));
6 assertion5(fromIndex+(SizeLhs-1)*stride<SizeRhs,fromIndex, SizeLhs, SizeRhs, stride, ::toString(vector));
7
8 #ifdef CompilerICC
9 #pragma ivdep
10 #endif
11 for (int i=0; i<SizeLhs; i++) {
12 result(i) = vector(fromIndex+i*stride);
13 }
14
15 return result;
16}
17
18
19template<int SizeLhs, int SizeRhs, typename Scalar>
22 const tarch::la::Vector<SizeRhs,Scalar>& fromVector,
23 int fromIndexInToVector,
24 int strideInToVector
25) {
26 assertion6(fromIndexInToVector>=0, SizeLhs, SizeRhs, ::toString(toVector), ::toString(fromVector), fromIndexInToVector, strideInToVector);
27 assertion6(fromIndexInToVector+(SizeRhs-1)*strideInToVector<SizeLhs, SizeLhs, SizeRhs, ::toString(toVector), ::toString(fromVector), fromIndexInToVector, strideInToVector);
28
29 #ifdef CompilerICC
30 #pragma ivdep
31 #endif
32 for (int i=0; i<SizeRhs; i++) {
33 toVector(fromIndexInToVector+i*strideInToVector) = fromVector(i);
34 }
35}
36
37
38template<int SizeLhs, int SizeRhs, typename Scalar>
39tarch::la::Vector<SizeLhs,Scalar> tarch::la::expandOrSlice(const Vector<SizeRhs,Scalar>& vector) {
40 return slice<SizeLhs>(vector,0);
41}
42
43
44template<int SizeLhs, typename Scalar>
46 return Vector<SizeLhs,Scalar>(scalar);
47}
#define assertion6(expr, param0, param1, param2, param3, param4, param5)
#define assertion5(expr, param0, param1, param2, param3, param4)
std::string toString(Filter filter)
Definition convert.cpp:170
int i
Definition makeIC.py:51
Vector< SizeLhs, Scalar > expandOrSlice(const Vector< SizeRhs, Scalar > &vector)
Take a scalar or vector and map it onto a vector.
Vector< SizeLhs, Scalar > slice(const Vector< SizeRhs, Scalar > &vector, int fromIndex, int stride=1)
Returns subpart of the vector.
Simple vector class.
Definition Vector.h:134