aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/lscg.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2015-03-04 09:34:27 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2015-03-04 09:34:27 +0100
commit05274219a7c5fdf04bfda089dc3f9eb2923fcc7e (patch)
tree1f5faca59ebd457ccf1d4beb9dbbb69a448f9376 /test/lscg.cpp
parentf8390995127f9f73f2376c43f93eaa27bbad3675 (diff)
Add a CG-based solver for rectangular least-square problems (bug #975).
Diffstat (limited to 'test/lscg.cpp')
-rw-r--r--test/lscg.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/lscg.cpp b/test/lscg.cpp
new file mode 100644
index 000000000..599ed5619
--- /dev/null
+++ b/test/lscg.cpp
@@ -0,0 +1,29 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2011 Gael Guennebaud <g.gael@free.fr>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#include "sparse_solver.h"
+#include <Eigen/IterativeLinearSolvers>
+
+template<typename T> void test_lscg_T()
+{
+ LSCG<SparseMatrix<T> > lscg_colmajor_diag;
+ LSCG<SparseMatrix<T>, IdentityPreconditioner> lscg_colmajor_I;
+
+ CALL_SUBTEST( check_sparse_square_solving(lscg_colmajor_diag) );
+ CALL_SUBTEST( check_sparse_square_solving(lscg_colmajor_I) );
+
+ CALL_SUBTEST( check_sparse_leastsquare_solving(lscg_colmajor_diag) );
+ CALL_SUBTEST( check_sparse_leastsquare_solving(lscg_colmajor_I) );
+}
+
+void test_lscg()
+{
+ CALL_SUBTEST_1(test_lscg_T<double>());
+ CALL_SUBTEST_2(test_lscg_T<std::complex<double> >());
+}