Ocean
Loading...
Searching...
No Matches
TestMatrix.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#ifndef META_OCEAN_TEST_TESTMATH_TEST_MATRIX_H
9#define META_OCEAN_TEST_TESTMATH_TEST_MATRIX_H
10
12
13#include "ocean/math/Matrix.h"
14
15namespace Ocean
16{
17
18namespace Test
19{
20
21namespace TestMath
22{
23
24/**
25 * This class implements a matrix test.
26 * @ingroup testmath
27 */
28class OCEAN_TEST_MATH_EXPORT TestMatrix
29{
30 public:
31
32 /**
33 * Tests all matrix functions.
34 * @param testDuration The number of seconds for each test, with range (0, infinity)
35 * @return True, if succeeded
36 */
37 static bool test(const double testDuration);
38
39 /**
40 * Tests the element-based constructor.
41 * @param testDuration The number of seconds for each test, with range (0, infinity)
42 * @return True, if succeeded
43 */
44 static bool testElementConstructor(const double testDuration);
45
46 /**
47 * Tests the sub-matrix-based constructor.
48 * @param testDuration The number of seconds for each test, with range (0, infinity)
49 * @return True, if succeeded
50 */
51 static bool testSubMatrixConstructor(const double testDuration);
52
53 /**
54 * Tests the self square matrix function determining matrix * matrix.transposed().
55 * @param testDuration The number of seconds for each test, with range (0, infinity)
56 * @return True, if succeeded
57 */
58 static bool testSelfSquareMatrix(const double testDuration);
59
60 /**
61 * Tests the self transposed matrix function determining matrix.transposed() * matrix for an existing result matrix.
62 * @param testDuration The number of seconds for each test, with range (0, infinity)
63 * @return True, if succeeded
64 */
65 static bool testSelfTransposedSquareMatrixExistingResult(const double testDuration);
66
67 /**
68 * Tests the self transposed matrix function determining matrix.transposed() * matrix.
69 * @param testDuration The number of seconds for each test, with range (0, infinity)
70 * @return True, if succeeded
71 */
72 static bool testSelfTransposedSquareMatrix(const double testDuration);
73
74 /**
75 * Tests the self transposed matrix function determining (*this).transposed() * diag(weightDiagonal) * (*this).
76 * @param testDuration The number of seconds for each test, with range (0, infinity)
77 * @return True, if succeeded
78 */
79 static bool testWeightedSelfTransposedSquareMatrixExistingResult(const double testDuration);
80
81 /**
82 * Tests the invert function.
83 * @param testDuration The number of seconds for each test, with range (0, infinity)
84 * @return True, if succeeded
85 */
86 static bool testInvert(const double testDuration);
87
88 /**
89 * Tests the pseudo inverted matrix function.
90 * @param testDuration The number of seconds for each test, with range (0, infinity)
91 * @return True, if succeeded
92 */
93 static bool testPseudoInverted(const double testDuration);
94
95 /**
96 * Tests the rank function.
97 * @param testDuration The number of seconds for each test, with range (0, infinity)
98 * @return True, if succeeded
99 */
100 static bool testRank(const double testDuration);
101
102 /**
103 * Tests the non-negative matrix factorization
104 * @param testDuration The number of seconds for each test, with range (0, infinity)
105 * @param maxComponents The number of factorization compoments to test with, with range (1, infinity)
106 * @return True, if succeeded
107 */
108 static bool testNonNegativeMatrixFactorization(const double testDuration, const unsigned int maxComponents = 10u);
109
110 /**
111 * Tests the matrix multiplication of different matrix sizes.
112 * @param testDuration The number of seconds for each test, with range (0, infinity)
113 * @return True, if succeeded
114 */
115 static bool testMatrixMultiplication(const double testDuration);
116
117 private:
118
119 /**
120 * Validate matrix multiplication left * right = result
121 * @param left Left matrix of the matrix multiplication
122 * @param right Right matrix of the matrix multiplication
123 * @param result Result matrix of the matrix multiplication
124 * @return True, if succeeded
125 */
126 static bool validateMatrixMultiplication(const Matrix & left, const Matrix & right, const Matrix& result);
127};
128
129}
130
131}
132
133}
134
135#endif // META_OCEAN_TEST_TESTMATH_TEST_MATRIX_H
This class implements a matrix test.
Definition TestMatrix.h:29
static bool testInvert(const double testDuration)
Tests the invert function.
static bool testElementConstructor(const double testDuration)
Tests the element-based constructor.
static bool testPseudoInverted(const double testDuration)
Tests the pseudo inverted matrix function.
static bool validateMatrixMultiplication(const Matrix &left, const Matrix &right, const Matrix &result)
Validate matrix multiplication left * right = result.
static bool testMatrixMultiplication(const double testDuration)
Tests the matrix multiplication of different matrix sizes.
static bool testNonNegativeMatrixFactorization(const double testDuration, const unsigned int maxComponents=10u)
Tests the non-negative matrix factorization.
static bool testSelfTransposedSquareMatrixExistingResult(const double testDuration)
Tests the self transposed matrix function determining matrix.transposed() * matrix for an existing re...
static bool testSelfTransposedSquareMatrix(const double testDuration)
Tests the self transposed matrix function determining matrix.transposed() * matrix.
static bool testWeightedSelfTransposedSquareMatrixExistingResult(const double testDuration)
Tests the self transposed matrix function determining (*this).transposed() * diag(weightDiagonal) * (...
static bool testRank(const double testDuration)
Tests the rank function.
static bool test(const double testDuration)
Tests all matrix functions.
static bool testSubMatrixConstructor(const double testDuration)
Tests the sub-matrix-based constructor.
static bool testSelfSquareMatrix(const double testDuration)
Tests the self square matrix function determining matrix * matrix.transposed().
The namespace covering the entire Ocean framework.
Definition Accessor.h:15