matrix_square_root.cpp
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2011 Jitse Niesen <jitse@maths.leeds.ac.uk>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 
10 #include "matrix_functions.h"
11 
12 template<typename MatrixType>
14 {
15  MatrixType A;
17  MatrixType sqrtA = A.sqrt();
18  VERIFY_IS_APPROX(sqrtA * sqrtA, A);
19 }
20 
21 EIGEN_DECLARE_TEST(matrix_square_root)
22 {
23  for (int i = 0; i < g_repeat; i++) {
24  CALL_SUBTEST_1(testMatrixSqrt(Matrix3cf()));
25  CALL_SUBTEST_2(testMatrixSqrt(MatrixXcd(12,12)));
26  CALL_SUBTEST_3(testMatrixSqrt(Matrix4f()));
29  CALL_SUBTEST_5(testMatrixSqrt(Matrix<std::complex<float>,1,1>()));
30  }
31 }
Matrix3f m
#define CALL_SUBTEST_4(FUNC)
#define CALL_SUBTEST_3(FUNC)
MatrixXf MatrixType
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
Definition: bench_gemm.cpp:48
EIGEN_DECLARE_TEST(matrix_square_root)
#define VERIFY_IS_APPROX(a, b)
#define CALL_SUBTEST_1(FUNC)
static int g_repeat
Definition: main.h:169
void testMatrixSqrt(const MatrixType &m)
#define CALL_SUBTEST_5(FUNC)
#define CALL_SUBTEST_2(FUNC)
The matrix class, also used for vectors and row-vectors.


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:34:48