aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/triangular.cpp
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-09-01 17:31:21 +0000
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-09-01 17:31:21 +0000
commit46fe7a3d9ec14ea56a879c48ba7f15e78342c8cb (patch)
treec708710574525c93c9732d23e7e935863434b9ac /test/triangular.cpp
parent49ff9b204c8ddd448fe214fdaf8622c4fe97c795 (diff)
if EIGEN_NICE_RANDOM is defined, the random functions will return numbers with
few bits left of the comma and for floating-point types will never return zero. This replaces the custom functions in test/main.h, so one does not anymore need to think about that when writing tests.
Diffstat (limited to 'test/triangular.cpp')
-rw-r--r--test/triangular.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/triangular.cpp b/test/triangular.cpp
index 388d78e1e..22a19f974 100644
--- a/test/triangular.cpp
+++ b/test/triangular.cpp
@@ -35,8 +35,8 @@ template<typename MatrixType> void triangular(const MatrixType& m)
int rows = m.rows();
int cols = m.cols();
- MatrixType m1 = test_random_matrix<MatrixType>(rows, cols),
- m2 = test_random_matrix<MatrixType>(rows, cols),
+ MatrixType m1 = MatrixType::Random(rows, cols),
+ m2 = MatrixType::Random(rows, cols),
m3(rows, cols),
m4(rows, cols),
r1(rows, cols),
@@ -47,8 +47,8 @@ template<typename MatrixType> void triangular(const MatrixType& m)
::Identity(rows, rows),
square = Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime>
::Random(rows, rows);
- VectorType v1 = test_random_matrix<VectorType>(rows),
- v2 = test_random_matrix<VectorType>(rows),
+ VectorType v1 = VectorType::Random(rows),
+ v2 = VectorType::Random(rows),
vzero = VectorType::Zero(rows);
MatrixType m1up = m1.template part<Eigen::Upper>();
@@ -81,9 +81,9 @@ template<typename MatrixType> void triangular(const MatrixType& m)
m1.template part<Eigen::Lower>() = (m2.transpose() * m2).lazy();
VERIFY_IS_APPROX(m3.template part<Eigen::Lower>(), m1);
- m1 = test_random_matrix<MatrixType>(rows, cols);
+ m1 = MatrixType::Random(rows, cols);
for (int i=0; i<rows; ++i)
- while (ei_abs2(m1(i,i))<1e-3) m1(i,i) = test_random<Scalar>();
+ while (ei_abs2(m1(i,i))<1e-3) m1(i,i) = ei_random<Scalar>();
Transpose<MatrixType> trm4(m4);
// test back and forward subsitution