Public Member Functions | Private Attributes | Friends | List of all members
Eigen::FloatMatrixFormatter< Derived > Class Template Reference

Formatter for Eigen matrix type. More...

#include <formatters.hpp>

Inheritance diagram for Eigen::FloatMatrixFormatter< Derived >:
Inheritance graph
[legend]

Public Member Functions

 FloatMatrixFormatter (const int &w=-1, const unsigned int &p=2)
 Default constructor. More...
 
FloatMatrixFormatter< Derived > & operator() (const Derived &matrix)
 Format a matrix with permanently stored precision/width. More...
 
FloatMatrixFormatter< Derived > & operator() (const Derived &matrix, const int &w, const unsigned int &p)
 Format a matrix with temporarily specified precision/width. More...
 
unsigned int precision ()
 Returns the current precision setting. More...
 
FloatMatrixFormatter< Derived > & precision (const unsigned int &p)
 Sets the precision format parameter. More...
 
int width ()
 Returns the current width setting. More...
 
FloatMatrixFormatter< Derived > & width (const int &w)
 Sets the width format parameter. More...
 
virtual ~FloatMatrixFormatter ()
 

Private Attributes

const Derived * _matrix
 
ecl::Format< typename Derived::Scalar > format
 
bool ready_to_format
 
bool tmp_formatting
 
unsigned int tmp_precision
 
int tmp_width
 

Friends

template<typename OutputStream , typename Derived_ >
OutputStream & operator<< (OutputStream &ostream, FloatMatrixFormatter< Derived_ > &formatter)
 Stream the formatter. More...
 

Detailed Description

template<typename Derived>
class Eigen::FloatMatrixFormatter< Derived >

Formatter for Eigen matrix type.

I want make it formatting any types of eigen

Template Parameters
Derived: MatrixBase's type which specify the matrix as vector, matrix with any storage type
Todo:
specialise the formatting; now it just support the float type only.

Definition at line 67 of file eigen/formatters.hpp.

Constructor & Destructor Documentation

◆ FloatMatrixFormatter()

template<typename Derived >
Eigen::FloatMatrixFormatter< Derived >::FloatMatrixFormatter ( const int &  w = -1,
const unsigned int &  p = 2 
)
inline

Default constructor.

Initialises the format tags for width, and precision.

Parameters
w: width (default - no width constraints)
p: the number of decimal places of precision (default - 4)

Definition at line 81 of file eigen/formatters.hpp.

◆ ~FloatMatrixFormatter()

template<typename Derived >
virtual Eigen::FloatMatrixFormatter< Derived >::~FloatMatrixFormatter ( )
inlinevirtual

Definition at line 89 of file eigen/formatters.hpp.

Member Function Documentation

◆ operator()() [1/2]

template<typename Derived >
FloatMatrixFormatter< Derived >& Eigen::FloatMatrixFormatter< Derived >::operator() ( const Derived &  matrix)
inline

Format a matrix with permanently stored precision/width.

This function directly formats the specified input value with the stored settings.

Vector2d v; v << 1.0, 2.0;
Format<Vector2d> format;
cout << format(v) << endl;
Parameters
matrix: the matrix to be formatted (gets temporarily stored as a pointer).
Returns
FloatMatrixFormatter& : this formatter readied for use with a stream.

Definition at line 148 of file eigen/formatters.hpp.

◆ operator()() [2/2]

template<typename Derived >
FloatMatrixFormatter< Derived >& Eigen::FloatMatrixFormatter< Derived >::operator() ( const Derived &  matrix,
const int &  w,
const unsigned int &  p 
)
inline

Format a matrix with temporarily specified precision/width.

This function directly formats the specified input value and temporary settings.

Vector2d v; v << 1.0, 2.0;
Format<Vector2d> format;
cout << format(v,3,-1) << endl; // precision of 3 and no width constraint
Parameters
matrix: the matrix to be formatted (gets temporarily stored as a pointer).
w: the width to use for inserted floats (-1 is no width constraint).
p: the number of decimal places of precision.
Returns
FloatMatrixFormatter& : this formatter readied for use with a stream.

Definition at line 170 of file eigen/formatters.hpp.

◆ precision() [1/2]

template<typename Derived >
unsigned int Eigen::FloatMatrixFormatter< Derived >::precision ( )
inline

Returns the current precision setting.

Returns
unsigned int : the precision value.

Definition at line 124 of file eigen/formatters.hpp.

◆ precision() [2/2]

template<typename Derived >
FloatMatrixFormatter<Derived>& Eigen::FloatMatrixFormatter< Derived >::precision ( const unsigned int &  p)
inline

Sets the precision format parameter.

Sets the precision format parameter.

Parameters
p: the number of decimal places of precision.
Returns
FloatMatrixFormatter& : this formatter readied for use with a stream.

Definition at line 102 of file eigen/formatters.hpp.

◆ width() [1/2]

template<typename Derived >
int Eigen::FloatMatrixFormatter< Derived >::width ( )
inline

Returns the current width setting.

Returns
int : the witdh value (-1 for no width constraint).

Definition at line 130 of file eigen/formatters.hpp.

◆ width() [2/2]

template<typename Derived >
FloatMatrixFormatter<Derived>& Eigen::FloatMatrixFormatter< Derived >::width ( const int &  w)
inline

Sets the width format parameter.

Sets the width format parameter.

Parameters
w: the width to use for inserted floats (-1 is no width constraint).
Returns
FloatMatrixFormatter& : this formatter readied for use with a stream.

Definition at line 115 of file eigen/formatters.hpp.

Friends And Related Function Documentation

◆ operator<<

template<typename Derived >
template<typename OutputStream , typename Derived_ >
OutputStream& operator<< ( OutputStream &  ostream,
FloatMatrixFormatter< Derived_ > &  formatter 
)
friend

Stream the formatter.

Insertion operator for sending the formatter to an output stream.

Parameters
ostream: the output stream.
formatter: the formatter to be inserted.
Template Parameters
OutputStream: the type of the output stream to be inserted into.
Derived: matrix type.
Returns
OutputStream : continue streaming with the updated output stream.
Exceptions
StandardException: throws if the formatter has un-specified _matrix [debug mode only]

Definition at line 203 of file eigen/formatters.hpp.

Member Data Documentation

◆ _matrix

template<typename Derived >
const Derived* Eigen::FloatMatrixFormatter< Derived >::_matrix
private

Definition at line 201 of file eigen/formatters.hpp.

◆ format

template<typename Derived >
ecl::Format<typename Derived::Scalar> Eigen::FloatMatrixFormatter< Derived >::format
private

Definition at line 196 of file eigen/formatters.hpp.

◆ ready_to_format

template<typename Derived >
bool Eigen::FloatMatrixFormatter< Derived >::ready_to_format
private

Definition at line 200 of file eigen/formatters.hpp.

◆ tmp_formatting

template<typename Derived >
bool Eigen::FloatMatrixFormatter< Derived >::tmp_formatting
private

Definition at line 199 of file eigen/formatters.hpp.

◆ tmp_precision

template<typename Derived >
unsigned int Eigen::FloatMatrixFormatter< Derived >::tmp_precision
private

Definition at line 198 of file eigen/formatters.hpp.

◆ tmp_width

template<typename Derived >
int Eigen::FloatMatrixFormatter< Derived >::tmp_width
private

Definition at line 197 of file eigen/formatters.hpp.


The documentation for this class was generated from the following file:
Eigen::FloatMatrixFormatter::format
ecl::Format< typename Derived::Scalar > format
Definition: eigen/formatters.hpp:196
Vector2d
Vector2< double > Vector2d


ecl_linear_algebra
Author(s): Daniel Stonier
autogenerated on Wed Mar 2 2022 00:16:29