13 template<
typename MatrixType>
17 Scalar
zero =
static_cast<Scalar
>(0);
19 bool offDiagOK =
true;
20 for (
Index i = 0;
i < A.rows(); ++
i) {
22 offDiagOK = offDiagOK && (
A(
i,
j) ==
zero);
25 for (
Index i = 0;
i < A.rows(); ++
i) {
27 offDiagOK = offDiagOK && (
A(
i,
j) ==
zero);
31 bool diagOK = (A.diagonal().array() == 1).
all();
32 return offDiagOK && diagOK;
36 template<
typename VectorType>
56 std::cout <<
v(
i) <<
" != " << ref <<
" ; relative error: " <<
std::abs((
v(
i)-ref)/ref) <<
" ; required precision: " << prec <<
" ; range: " << low <<
"," << high <<
" ; i: " <<
i <<
"\n";
63 template<
typename VectorType>
71 Scalar high = internal::random<Scalar>(-500,500);
72 Scalar low = (size == 1 ? high : internal::random<Scalar>(-500,500));
76 if(internal::random<float>(0.
f,1.
f)<0.05f)
79 else if(size>2 && std::numeric_limits<RealScalar>::max_exponent10>0 && internal::random<float>(0.
f,1.
f)<0.1f)
82 const Scalar
step = ((size == 1) ? 1 : (high-low)/
RealScalar(size-1));
86 m.setLinSpaced(size,low,high);
107 n(
i) = size==1 ? low : low +
Scalar((
double(range_length+1)*
double(
i))/
double(size));
111 m = VectorType::LinSpaced(size,low,high);
135 row_vector.setLinSpaced(size,low,high);
136 col_vector.setLinSpaced(size,low,high);
142 size_changer.setLinSpaced(size,low,high);
147 scalar.setLinSpaced(1,low,high);
149 VERIFY_IS_APPROX( ScalarMatrix::LinSpaced(1,low,high), ScalarMatrix::Constant(high) );
153 m.tail(size-1).setLinSpaced(low, high);
159 Index n0 = VectorType::SizeAtCompileTime==
Dynamic ? 0 : VectorType::SizeAtCompileTime;
160 low = internal::random<Scalar>();
161 m = VectorType::LinSpaced(n0,low,low-
RealScalar(1));
164 if(VectorType::SizeAtCompileTime==
Dynamic)
170 m.setLinSpaced(n0,0,
Scalar(n0-1));
176 VERIFY_IS_APPROX(VectorType::LinSpaced(size,low,low),VectorType::Constant(size,low));
177 m.setLinSpaced(size,low,low);
184 if(VectorType::SizeAtCompileTime==
Dynamic)
187 for(
Index k=1; k<5; ++k)
190 for(
Index k=1; k<5; ++k)
199 for(
Index k=0; k<10; ++k)
201 Index i = internal::random<Index>(0,m.size()-1);
205 if(VectorType::SizeAtCompileTime==
Dynamic)
207 Index i = internal::random<Index>(0,2*m.size()-1);
208 m.setUnit(2*m.size(),
i);
215 template<
typename MatrixType>
226 s1 = internal::random<Scalar>();
230 A.setIdentity(rows, cols);
235 A = MatrixType::Constant(rows,cols,s1);
236 Index i = internal::random<Index>(0,rows-1);
237 Index j = internal::random<Index>(0,cols-1);
253 Array4d
x4 = Array4d::LinSpaced(0.0, 1.0);
254 Array3d
x3(Array4d::LinSpaced(0.0, 1.0).
head(3));
263 ArrayXi
a1(n),
a2(n);
264 a1.setLinSpaced(n, 0, n-1);
265 for(
int i=0;
i<
n; ++
i)
274 VERIFY(( internal::has_nullary_operator<internal::scalar_constant_op<double> >::
value ));
275 VERIFY(( !internal::has_unary_operator<internal::scalar_constant_op<double> >::
value ));
276 VERIFY(( !internal::has_binary_operator<internal::scalar_constant_op<double> >::
value ));
277 VERIFY(( internal::functor_has_linear_access<internal::scalar_constant_op<double> >::
ret ));
279 VERIFY(( !internal::has_nullary_operator<internal::scalar_identity_op<double> >::
value ));
280 VERIFY(( !internal::has_unary_operator<internal::scalar_identity_op<double> >::
value ));
281 VERIFY(( internal::has_binary_operator<internal::scalar_identity_op<double> >::
value ));
282 VERIFY(( !internal::functor_has_linear_access<internal::scalar_identity_op<double> >::
ret ));
284 VERIFY(( !internal::has_nullary_operator<internal::linspaced_op<float> >::
value ));
285 VERIFY(( internal::has_unary_operator<internal::linspaced_op<float> >::
value ));
286 VERIFY(( !internal::has_binary_operator<internal::linspaced_op<float> >::
value ));
287 VERIFY(( internal::functor_has_linear_access<internal::linspaced_op<float> >::
ret ));
293 MatrixXf
A = MatrixXf::Random(3,3);
299 VectorXi
V = VectorXi::Random(3);
303 VERIFY(( internal::has_nullary_operator<internal::scalar_constant_op<float> >::
value ));
304 VERIFY(( !internal::has_unary_operator<internal::scalar_constant_op<float> >::
value ));
305 VERIFY(( !internal::has_binary_operator<internal::scalar_constant_op<float> >::
value ));
306 VERIFY(( internal::functor_has_linear_access<internal::scalar_constant_op<float> >::
ret ));
308 VERIFY(( !internal::has_nullary_operator<internal::linspaced_op<int> >::
value ));
309 VERIFY(( internal::has_unary_operator<internal::linspaced_op<int> >::
value ));
310 VERIFY(( !internal::has_binary_operator<internal::linspaced_op<int> >::
value ));
311 VERIFY(( internal::functor_has_linear_access<internal::linspaced_op<int> >::
ret ));
def step(data, isam, result, truth, currPoseIndex)
#define CALL_SUBTEST_9(FUNC)
#define CALL_SUBTEST_6(FUNC)
#define CALL_SUBTEST_4(FUNC)
static const Eigen::internal::all_t all
#define CALL_SUBTEST_3(FUNC)
EIGEN_DONT_INLINE Scalar zero()
#define CALL_SUBTEST_7(FUNC)
Rot2 R(Rot2::fromAngle(0.1))
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
void check_extremity_accuracy(const VectorType &v, const typename VectorType::Scalar &low, const typename VectorType::Scalar &high)
#define CALL_SUBTEST_10(FUNC)
#define VERIFY_IS_APPROX(a, b)
#define VERIFY_IS_EQUAL(a, b)
bool equalsIdentity(const MatrixType &A)
#define CALL_SUBTEST_1(FUNC)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
void testMatrixType(const MatrixType &m)
Array< int, Dynamic, 1 > v
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
#define CALL_SUBTEST_8(FUNC)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
EIGEN_DECLARE_TEST(nullary)
NumTraits< Scalar >::Real RealScalar
Reference counting helper.
Pose3 x3(Rot3::Ypr(M_PI/4.0, 0.0, 0.0), l2)
void swap(GeographicLib::NearestNeighbor< dist_t, pos_t, distfun_t > &a, GeographicLib::NearestNeighbor< dist_t, pos_t, distfun_t > &b)
A matrix or vector expression mapping an existing expression.
#define CALL_SUBTEST_5(FUNC)
#define CALL_SUBTEST(FUNC)
void reverse(const MatrixType &m)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE FixedSegmentReturnType< internal::get_fixed_value< NType >::value >::Type head(NType n)
#define CALL_SUBTEST_2(FUNC)
void nullary_internal_logic()
Annotation indicating that a class derives from another given type.
Jet< T, N > pow(const Jet< T, N > &f, double g)
EIGEN_DEVICE_FUNC bool isApprox(const Scalar &x, const Scalar &y, const typename NumTraits< Scalar >::Real &precision=NumTraits< Scalar >::dummy_precision())
mxArray * scalar(mxClassID classid)
void testVectorType(const VectorType &base)