Operator_ostream

Functions

template<typename T1 >
std::ostream & operator<< (std::ostream &o, const Base< typename T1::elem_type, T1 > &X)
template<typename T1 >
std::ostream & operator<< (std::ostream &o, const BaseCube< typename T1::elem_type, T1 > &X)
template<typename T1 >
std::ostream & operator<< (std::ostream &o, const Op< T1, op_diagmat > &X)
 Print a diagonal matrix to the specified stream.
template<typename T1 >
std::ostream & operator<< (std::ostream &o, const field< T1 > &X)
 Print the contents of a field to the specified stream.
template<typename T1 >
std::ostream & operator<< (std::ostream &o, const subview_field< T1 > &X)
 Print the contents of a subfield to the specified stream.

Function Documentation

template<typename T1 >
std::ostream& operator<< ( std::ostream &  o,
const Base< typename T1::elem_type, T1 > &  X 
) [inline]

Definition at line 24 of file operator_ostream.hpp.

References arma_ostream::print().

00025   {
00026   arma_extra_debug_sigprint();
00027   
00028   const unwrap<T1> tmp(X.get_ref());
00029   
00030   arma_ostream::print(o, tmp.M, true);
00031   
00032   return o;
00033   }

template<typename T1 >
std::ostream& operator<< ( std::ostream &  o,
const BaseCube< typename T1::elem_type, T1 > &  X 
) [inline]

Definition at line 40 of file operator_ostream.hpp.

References arma_ostream::print().

00041   {
00042   arma_extra_debug_sigprint();
00043   
00044   const unwrap_cube<T1> tmp(X.get_ref());
00045   
00046   arma_ostream::print(o, tmp.M, true);
00047   
00048   return o;
00049   }

template<typename T1 >
std::ostream& operator<< ( std::ostream &  o,
const Op< T1, op_diagmat > &  X 
) [inline]

Print a diagonal matrix to the specified stream.

Definition at line 57 of file operator_ostream.hpp.

References Mat< eT >::at(), Mat< eT >::is_square(), Mat< eT >::is_vec(), max(), Mat< eT >::mem, arma_ostream::modify_stream(), Mat< eT >::n_cols, Mat< eT >::n_elem, and Mat< eT >::n_rows.

00058   {
00059   arma_extra_debug_sigprint();
00060   
00061   typedef typename T1::elem_type eT;
00062   
00063   const unwrap<T1> tmp(X.m);
00064   const Mat<eT>& m = tmp.M;
00065     
00066   arma_debug_check( ((m.is_vec() == false) && (m.is_square() == false)), "operator<<(): incompatible dimensions for diagmat operation" );
00067   
00068   const arma_ostream_state stream_state(o);
00069 
00070   const u32 cell_width = arma_ostream::modify_stream(o, m.mem, m.n_elem);
00071   
00072   const u32 local_n_rows = (std::max)(m.n_rows, m.n_cols);
00073   
00074   for(u32 row=0; row < local_n_rows; ++row)
00075     {
00076     for(u32 col=0; col < local_n_rows; ++col)
00077       {
00078       if(row != col)
00079         {
00080         o.width(cell_width);
00081         if(is_complex<eT>::value == false)
00082           {
00083           o << "0.0";
00084           }
00085         else
00086           {
00087           o << "(0.0,0.0)";
00088           }
00089         }
00090       else
00091         {
00092         const eT val = m.is_vec() ? m.mem[row] : m.at(row,row);
00093         
00094         o.width(cell_width);
00095         o << val;
00096         }
00097       }
00098       o << '\n';
00099     }
00100   
00101   o.flush();
00102 
00103   stream_state.restore(o);
00104 
00105   return o;
00106   }

template<typename T1 >
std::ostream& operator<< ( std::ostream &  o,
const field< T1 > &  X 
) [inline]

Print the contents of a field to the specified stream.

Definition at line 114 of file operator_ostream.hpp.

References arma_ostream::print().

00115   {
00116   arma_extra_debug_sigprint();
00117   
00118   arma_ostream::print(o, X);
00119   
00120   return o;
00121   }

template<typename T1 >
std::ostream& operator<< ( std::ostream &  o,
const subview_field< T1 > &  X 
) [inline]

Print the contents of a subfield to the specified stream.

Definition at line 129 of file operator_ostream.hpp.

References arma_ostream::print().

00130   {
00131   arma_extra_debug_sigprint();
00132   
00133   arma_ostream::print(o, X);
00134 
00135   return o;
00136   }