10 TestCase (
"tarch::la::tests::VectorTest") {
128 int result =
sum(vector);
131 result =
norm1(vector);
142 std::ostringstream stream;
144 std::string vector3string ( stream.str() );
218 vector = vector + vector;
225 vector = vector - vector;
232 int dotresult =
dot(vector, vector);
235 dotresult = vector * vector;
242 crossresult =
cross(
a, b);
256 vec0 = {2.0, 2.0, 3.0};
263 vec0 = {2.0, 3.0, 4.0};
270 const double tolerance = 1e-14;
273 vec0(2) = vec1(2) + 0.99 * tolerance;
280 vec0(2) = vec1(2) + 10.0 * tolerance;
287 vec0 = {1.0, 2.0, 3.0};
288 vec0 += 10.0 * tolerance;
295 vec0 = {1.0, 2.0, 3.0};
296 vec0 -= 0.99 * tolerance;
299 vec0 = {1.0, 1.0, 4.0};
301 vec0 = {2.0, 0.0, 0.0};
303 vec0 = {1.0, 2.0 + 10.0 * tolerance, 2.0};
307 vec0 = {1.0, 2.0, 3.0 + 0.99 * tolerance};
308 vec1 = {1.0, 2.0, 3.0};
316 slice(longVector,vector,3);
#define validateEqualsWithParams1(actualValue, validValue, param0)
#define validate(booleanExpr)
#define testMethod(name)
Run a test method and check for errors.
#define validateWithParams2(booleanExpr, param0, param1)
#define validateWithParams3(booleanExpr, param0, param1, param2)
#define validateEquals(actualValue, validValue)
void testConstruction()
Tests constructors.
void testVectorScalarOperations()
Tests methods from VectorScalarOperations.h.
virtual void run()
This routine is triggered by the TestCaseCollection.
void testVectorOperations()
Tests methods from VectorOperations.h.
void testWrappedVector()
Tests wrapping a raw array with (static) vector semantics.
void testVectorCompare()
Tests methods from VectorCompare.h.
void testAssignment()
Tests methods from VectorAssign.h and operator= from Vector types.
void testVectorVectorCompare()
void testVectorVectorOperations()
Tests methods from VectorVectorOperations.h.
const float const float const float struct part *restrict struct part *restrict const float a
Scalar dot(const Vector< Size, Scalar > &lhs, const Vector< Size, Scalar > &rhs)
Performs the dot (=inner) product of two vectors.
Scalar sum(const Matrix< Rows, Cols, Scalar > &matrix)
Computes the sum of all entries of the matrix.
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.
int indexMin(const Vector< Size, Scalar > &vector)
Returns the index of the element with minimal value (NOT absolute value).
int indexMax(const Vector< Size, Scalar > &vector)
Returns the index of the element with maximal value (NOT absolute value).
Vector< SizeLhs, Scalar > slice(const Vector< SizeRhs, Scalar > &vector, int fromIndex, int stride=1)
Returns subpart of the vector.
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 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.
Scalar norm1(const Vector< Size, Scalar > &vector)
Computes the 1-norm of the vector, i.e.
bool oneGreaterEquals(const Vector< Size, Scalar > &lhs, const Scalar &cmp, const Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)
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).
std::string toString(MemoryLocation value)