Skip to content

Commit

Permalink
[EigenTypes.h add output operator
Browse files Browse the repository at this point in the history
  • Loading branch information
k-okada committed Feb 24, 2015
1 parent 5f2dc8c commit 678b702
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions hrplib/hrpUtil/EigenTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,27 @@ namespace hrp{
typedef Eigen::Quaternion<double> dquaternion;
};

#include <iostream>
inline std::ostream& operator<<(std::ostream& out, hrp::dmatrix &a) {
const int c = a.rows();
const int n = a.cols();

for(int i = 0; i < c; i++){
out << " :";
for(int j = 0; j < n; j++){
out << " " << std::setw(7) << std::setiosflags(std::ios::fixed) << std::setprecision(4) << (a)(i,j);
}
out << std::endl;
}
}

inline std::ostream& operator<<(std::ostream& out, hrp::dvector &a) {
const int n = a.size();

for(int i = 0; i < n; i++){
out << std::setw(7) << std::setiosflags(std::ios::fixed) << std::setprecision(4) << a(i) << " ";
}
out << std::endl;
}

#endif

0 comments on commit 678b702

Please sign in to comment.