gtsam
3rdparty
Eigen
test
resize.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) 2009 Keir Mierle <mierle@gmail.com>
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 "
main.h
"
11
12
template
<DenseIndex rows, DenseIndex cols>
13
void
resizeLikeTest
()
14
{
15
MatrixXf
A
(
rows
,
cols
);
16
MatrixXf
B
;
17
Matrix<double, rows, cols>
C
;
18
B
.resizeLike(
A
);
19
C
.
resizeLike
(
B
);
// Shouldn't crash.
20
VERIFY
(
B
.rows() ==
rows
&&
B
.cols() ==
cols
);
21
22
VectorXf
x
(
rows
);
23
RowVectorXf
y
;
24
y
.resizeLike(
x
);
25
VERIFY
(
y
.rows() == 1 &&
y
.cols() ==
rows
);
26
27
y
.resize(
cols
);
28
x
.resizeLike(
y
);
29
VERIFY
(
x
.rows() ==
cols
&&
x
.cols() == 1);
30
}
31
32
void
resizeLikeTest12
() { resizeLikeTest<1,2>(); }
33
void
resizeLikeTest1020
() { resizeLikeTest<10,20>(); }
34
void
resizeLikeTest31
() { resizeLikeTest<3,1>(); }
35
36
EIGEN_DECLARE_TEST
(
resize
)
37
{
38
CALL_SUBTEST
(
resizeLikeTest12
() );
39
CALL_SUBTEST
(
resizeLikeTest1020
() );
40
CALL_SUBTEST
(
resizeLikeTest31
() );
41
}
B
Matrix< SCALARB, Dynamic, Dynamic, opt_B > B
Definition:
bench_gemm.cpp:49
resize
v resize(3)
x
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
Definition:
gnuplot_common_settings.hh:12
rows
int rows
Definition:
Tutorial_commainit_02.cpp:1
A
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
Definition:
bench_gemm.cpp:48
resizeLikeTest
void resizeLikeTest()
Definition:
resize.cpp:13
EIGEN_DECLARE_TEST
EIGEN_DECLARE_TEST(resize)
Definition:
resize.cpp:36
Eigen::PlainObjectBase::resizeLike
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resizeLike(const EigenBase< OtherDerived > &_other)
Definition:
PlainObjectBase.h:354
resizeLikeTest12
void resizeLikeTest12()
Definition:
resize.cpp:32
y
Scalar * y
Definition:
level1_cplx_impl.h:124
C
Matrix< Scalar, Dynamic, Dynamic > C
Definition:
bench_gemm.cpp:50
resizeLikeTest31
void resizeLikeTest31()
Definition:
resize.cpp:34
main.h
Eigen::Matrix
The matrix class, also used for vectors and row-vectors.
Definition:
3rdparty/Eigen/Eigen/src/Core/Matrix.h:178
cols
int cols
Definition:
Tutorial_commainit_02.cpp:1
resizeLikeTest1020
void resizeLikeTest1020()
Definition:
resize.cpp:33
CALL_SUBTEST
#define CALL_SUBTEST(FUNC)
Definition:
main.h:399
VERIFY
#define VERIFY(a)
Definition:
main.h:380
gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:04:00