Commit 1d8a7271 authored by Max Lyon's avatar Max Lyon

fix output operator for vectors for old vs new gmm

parent 5323be52
Pipeline #7346 passed with stages
in 6 minutes and 55 seconds
Subproject commit 1f7ffdaa7e3a0181c4d03b18e13dae5b25bf4ad6
Subproject commit a84f9276520cd8bfb8b1c1925074322a1a917702
......@@ -30,6 +30,7 @@
#include <CoMISo/Solver/ConstrainedSolver.hh>
#include <CoMISo/Solver/MISolver.hh>
#include <CoMISo/Solver/GMM_Tools.hh>
#include <CoMISo/Utils/Tools.hh>
/// function to setup a random sparse row matrix of dimension _m x _n
/// for the simplicity of this example only integer valued entries are used
......@@ -87,6 +88,8 @@ void print_equations( const MatrixT& _B)
// Example main
int main(void)
{
using COMISO_GMM::operator<<;
// initialize random number generator
srand(12345);
......
......@@ -28,6 +28,7 @@
#include <CoMISo/Solver/ConstrainedSolver.hh>
#include <CoMISo/Solver/MISolver.hh>
#include <CoMISo/Solver/GMM_Tools.hh>
#include <CoMISo/Utils/Tools.hh>
/// function to setup a random sparse row matrix of dimension _m x _n
/// for the simplicity of this example only integer valued entries are used
......@@ -106,6 +107,8 @@ void print_equations( const MatrixT& _B)
// Example main
int main(void)
{
using COMISO_GMM::operator<<;
std::cout << "---------- 1) setup an (m x n) sparse row matrix B (i.e. the B in the system ((Bx)^T)Bx)" << std::endl;
int m = 9;
int n = 5+1;
......
......@@ -62,10 +62,11 @@ void print_equations( const MatrixT& _B)
}
}
// Example main
int main(void)
{
using namespace COMISO_GMM;
std::cout << "---------- 1) Setup a number of equations (i.e. the B matrix of a factored system of linear equations B^tB)..." << std::endl;
int n = 4;
gmm::row_matrix< gmm::wsvector< double > > B(n+1,n+1);
......
......@@ -68,6 +68,8 @@ void print_equations( const MatrixT& _B)
// Example main
int main(void)
{
using COMISO_GMM::operator<<;
std::cout << "---------- 1) Setup small (symmetric) test equation system Ax=b..." << std::endl;
int n = 4;
gmm::col_matrix< gmm::wsvector< double > > A(n,n);
......
......@@ -30,6 +30,7 @@
#include <CoMISo/Solver/ConstrainedSolver.hh>
#include <CoMISo/Solver/MISolver.hh>
#include <CoMISo/Solver/GMM_Tools.hh>
#include <CoMISo/Utils/Tools.hh>
/// function to initialize a simple system of linear equations
......@@ -68,6 +69,8 @@ void print_equations( const MatrixT& _B)
// Example main
int main(void)
{
using COMISO_GMM::operator<<;
std::cout << "---------- 1) Setup small (symmetric) test equation system Ax=b..." << std::endl;
int n = 4;
gmm::col_matrix< gmm::wsvector< double > > A(n,n);
......
......@@ -48,6 +48,8 @@ int main(void)
typedef Eigen::MatrixXd DenMatrix;
typedef Eigen::Triplet< double > Triplet;
using COMISO_GMM::operator<<;
int dimr(4+1);
int dimc(4+2);
......
......@@ -265,6 +265,15 @@ void gmm_to_cholmod( const MatrixT& _A,
bool _long_int = false);
#endif
// GMM used to put operator<< for std::vector<T> into namespace std which was used in the CoMISo examples
// Newer versions do not do that anymore.
// The functions below allows to still use operator<< both with the older and newer GMM by putting
// using COMISO_GMM::operator<<; at the start of the scope.
inline std::ostream& operator <<(std::ostream &o, const std::vector<double>& m) { gmm::write(o,m); return o; }
inline std::ostream& operator <<(std::ostream &o, const std::vector<size_t>& m) { gmm::write(o,m); return o; }
inline std::ostream& operator <<(std::ostream &o, const std::vector<int>& m) { gmm::write(o,m); return o; }
//=============================================================================
} // namespace COMISO_GMM
//=============================================================================
......
  • @lyon : is this ok and can we merge it? Does that fix Andreas Problem?

  • I'm afraid I committed this directly on master, so no merge is necessary.

    I think this will probably fix Andreas' problem, but I never asked him.

Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment