Public Member Functions | Public Attributes | List of all members
gnsstk::LabeledMatrix Class Reference

Detailed Description

class LabeledMatrix. Pretty print a Matrix using the labels in a Namelist. For example, the following code produces the following output:

Matrix<double> Cneu; //....
Namelist PosLabNEU("bake-N","bake-E","bake-U");
LabeledMatrix LMcovNEU(PosLabNEU,Cneu);
LMcovNEU.scientific().setw(15).setprecision(3).symmetric();
LOG(INFO) << "\nFixed NEU covariance, " << "REF-to-REF, " << "final total";
LOG(INFO) << LMcovNEU;
Fixed NEU covariance, REF-to-REF, final total
bake-N bake-E bake-U
bake-N 2.824e-06
bake-E -4.396e-07 2.966e-06
bake-U 1.509e-06 2.502e-07 1.266e-05

Definition at line 162 of file Namelist.hpp.

#include <Namelist.hpp>

Public Member Functions

LabeledMatrixboth ()
 Print labels on both rows and columns. More...
 
LabeledMatrixclean (bool s=true)
 If true, print 0.0 as 0. More...
 
LabeledMatrixcols ()
 Print labels on columns only. More...
 
LabeledMatrixfixed ()
 Set the format to fixed. More...
 
 LabeledMatrix (const Namelist &nl, const Matrix< double > &m)
 
 LabeledMatrix (const Namelist &nr, const Namelist &nc, const Matrix< double > &m)
 
LabeledMatrixlinetag (const std::string &m)
 Print the given tag at the beginning of each line. More...
 
LabeledMatrixmessage (const std::string &m)
 Print the given message. More...
 
LabeledMatrixrows ()
 Print labels on rows only. More...
 
LabeledMatrixscientific ()
 Set the format to scientific. More...
 
LabeledMatrixsetprecision (int p)
 Set the precision to p digits. More...
 
LabeledMatrixsetw (int w)
 Set the width to w characters. More...
 
LabeledMatrixsymmetric (bool s=true)
 If true, the matrix is symmetrical, so print only the lower triangle. More...
 

Public Attributes

bool cln
 if true, print 0.0 as "0" More...
 
int form
 format: 1=fixed, 2=scientific More...
 
const Matrix< double > & M
 Matrix to print. More...
 
std::string msg
 label (name in Namelist) for each row More...
 
const NamelistNLcols
 Namelist of columns. More...
 
const NamelistNLrows
 Namelist of rows. More...
 
int prec
 precision of fixed, in digits More...
 
int rc
 label rows only (1) columns only (2) or both (0) More...
 
bool sym
 if true, print only lower triangle More...
 
std::string tag
 text at beginning of each line (row) More...
 
int wid
 width of fields, in characters More...
 

Constructor & Destructor Documentation

◆ LabeledMatrix() [1/2]

gnsstk::LabeledMatrix::LabeledMatrix ( const Namelist nl,
const Matrix< double > &  m 
)
inline

Constructor, defaults are width 12 prec 5 format fixed, not symmetric, label both rows and columns, same names on rows and columns

Definition at line 179 of file Namelist.hpp.

◆ LabeledMatrix() [2/2]

gnsstk::LabeledMatrix::LabeledMatrix ( const Namelist nr,
const Namelist nc,
const Matrix< double > &  m 
)
inline

Constructor, defaults are width 12 prec 5 format fixed, not symmetric, label both rows and columns, different names on rows and columns

Definition at line 187 of file Namelist.hpp.

Member Function Documentation

◆ both()

LabeledMatrix& gnsstk::LabeledMatrix::both ( )
inline

Print labels on both rows and columns.

Definition at line 237 of file Namelist.hpp.

◆ clean()

LabeledMatrix& gnsstk::LabeledMatrix::clean ( bool  s = true)
inline

If true, print 0.0 as 0.

Definition at line 230 of file Namelist.hpp.

◆ cols()

LabeledMatrix& gnsstk::LabeledMatrix::cols ( )
inline

Print labels on columns only.

Definition at line 251 of file Namelist.hpp.

◆ fixed()

LabeledMatrix& gnsstk::LabeledMatrix::fixed ( )
inline

Set the format to fixed.

Definition at line 209 of file Namelist.hpp.

◆ linetag()

LabeledMatrix& gnsstk::LabeledMatrix::linetag ( const std::string &  m)
inline

Print the given tag at the beginning of each line.

Definition at line 265 of file Namelist.hpp.

◆ message()

LabeledMatrix& gnsstk::LabeledMatrix::message ( const std::string &  m)
inline

Print the given message.

Definition at line 258 of file Namelist.hpp.

◆ rows()

LabeledMatrix& gnsstk::LabeledMatrix::rows ( )
inline

Print labels on rows only.

Definition at line 244 of file Namelist.hpp.

◆ scientific()

LabeledMatrix& gnsstk::LabeledMatrix::scientific ( )
inline

Set the format to scientific.

Definition at line 216 of file Namelist.hpp.

◆ setprecision()

LabeledMatrix& gnsstk::LabeledMatrix::setprecision ( int  p)
inline

Set the precision to p digits.

Definition at line 202 of file Namelist.hpp.

◆ setw()

LabeledMatrix& gnsstk::LabeledMatrix::setw ( int  w)
inline

Set the width to w characters.

Definition at line 195 of file Namelist.hpp.

◆ symmetric()

LabeledMatrix& gnsstk::LabeledMatrix::symmetric ( bool  s = true)
inline

If true, the matrix is symmetrical, so print only the lower triangle.

Definition at line 223 of file Namelist.hpp.

Member Data Documentation

◆ cln

bool gnsstk::LabeledMatrix::cln

if true, print 0.0 as "0"

Definition at line 170 of file Namelist.hpp.

◆ form

int gnsstk::LabeledMatrix::form

format: 1=fixed, 2=scientific

Definition at line 167 of file Namelist.hpp.

◆ M

const Matrix<double>& gnsstk::LabeledMatrix::M

Matrix to print.

Definition at line 175 of file Namelist.hpp.

◆ msg

std::string gnsstk::LabeledMatrix::msg

label (name in Namelist) for each row

Definition at line 171 of file Namelist.hpp.

◆ NLcols

const Namelist& gnsstk::LabeledMatrix::NLcols

Namelist of columns.

Definition at line 174 of file Namelist.hpp.

◆ NLrows

const Namelist& gnsstk::LabeledMatrix::NLrows

Namelist of rows.

Definition at line 173 of file Namelist.hpp.

◆ prec

int gnsstk::LabeledMatrix::prec

precision of fixed, in digits

Definition at line 166 of file Namelist.hpp.

◆ rc

int gnsstk::LabeledMatrix::rc

label rows only (1) columns only (2) or both (0)

Definition at line 168 of file Namelist.hpp.

◆ sym

bool gnsstk::LabeledMatrix::sym

if true, print only lower triangle

Definition at line 169 of file Namelist.hpp.

◆ tag

std::string gnsstk::LabeledMatrix::tag

text at beginning of each line (row)

Definition at line 172 of file Namelist.hpp.

◆ wid

int gnsstk::LabeledMatrix::wid

width of fields, in characters

Definition at line 165 of file Namelist.hpp.


The documentation for this class was generated from the following file:
gnsstk::LabeledMatrix::LabeledMatrix
LabeledMatrix(const Namelist &nl, const Matrix< double > &m)
Definition: Namelist.hpp:179
LOG
#define LOG(level)
define the macro that is used to write to the log stream
Definition: logstream.hpp:315
gnsstk::INFO
@ INFO
Definition: logstream.hpp:57


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:45