]> Dogcows Code - chaz/yoink/blob - src/moof/cml/matrix/matrix_print.h
bugfix: win32 packaging script temp directories
[chaz/yoink] / src / moof / cml / matrix / matrix_print.h
1 /* -*- C++ -*- ------------------------------------------------------------
2
3 Copyright (c) 2007 Jesse Anders and Demian Nave http://cmldev.net/
4
5 The Configurable Math Library (CML) is distributed under the terms of the
6 Boost Software License, v1.0 (see cml/LICENSE for details).
7
8 *-----------------------------------------------------------------------*/
9 /** @file
10 * @brief
11 */
12
13 #ifndef matrix_print_h
14 #define matrix_print_h
15
16 #include <iostream>
17
18 namespace cml {
19
20 /** Output a matrix to a std::ostream. */
21 template<typename E, class AT, typename BO, class L> inline std::ostream&
22 operator<<(std::ostream& os, const matrix<E,AT,BO,L>& m)
23 {
24 for(size_t i = 0; i < m.rows(); ++i) {
25 os << "[";
26 for(size_t j = 0; j < m.cols(); ++j) {
27 os << " " << m(i,j);
28 }
29 os << " ]";
30 if (i != m.rows()-1) {
31 os << std::endl;
32 }
33 }
34 return os;
35 }
36
37 /** Output a matrix expression to a std::ostream. */
38 template< class XprT > inline std::ostream&
39 operator<<(std::ostream& os, const et::MatrixXpr<XprT>& m)
40 {
41 for(size_t i = 0; i < m.rows(); ++i) {
42 os << "[";
43 for(size_t j = 0; j < m.cols(); ++j) {
44 os << " " << m(i,j);
45 }
46 os << " ]";
47 if (i != m.rows()-1) {
48 os << std::endl;
49 }
50 }
51 return os;
52 }
53
54 } // namespace cml
55
56 #endif
57
58 // -------------------------------------------------------------------------
59 // vim:ft=cpp
This page took 0.031533 seconds and 4 git commands to generate.