ug4
ug::MMTypeCode Class Reference

Type representation for MatrixMarket matrix exchange files. More...

#include <mm_type_code.h>

Public Types

enum  AlgebraicType { GENERAL = 1 , SYMMETRIC = 2 , SKEW = 3 , HERMITIAN = 4 }
 Algebraic type of the described matrix. More...
 
enum  ClassType { COORDINATE = 1 , ARRAY = 2 }
 Class type of the described matrix. More...
 
enum  NumericType { REAL = 1 , COMPLEX = 2 , INTEGER = 3 , PATTERN = 4 }
 Numeric type of the described matrix. More...
 

Public Member Functions

bool is_general () const
 Tells whether MMTypeCode is general. More...
 
bool is_real () const
 Tells whether MMTypeCode is real. More...
 
bool is_skew_symmetric () const
 Tells whether MMTypeCode is skew-symmetric. More...
 
bool is_sparse () const
 Tells whether MMTypeCode is sparse. More...
 
bool is_symmetric () const
 Tells whether MMTypeCode is symmetric. More...
 
 MMTypeCode ()
 Default constructor. More...
 
void set_algebraic_type (int type)
 Sets a new algebraic type from an enum value. More...
 
void set_algebraic_type (std::string type)
 Sets a new algebraic type from a string. More...
 
void set_class_type (int type)
 Sets a new class type from an enum value. More...
 
void set_class_type (std::string type)
 Sets a new class type from a string. More...
 
void set_numeric_type (int type)
 Sets a new numeric type from an enum value. More...
 
void set_numeric_type (std::string type)
 Sets a new numeric type from a string. More...
 
std::string to_string ()
 Pretty prints the three classes and their current value. More...
 

Static Public Attributes

static const int MM_LINE_LENGTH = 1025
 Maximum line length in characters as defined by the MatrixMarket specifications. More...
 

Private Attributes

int m_algebraic_type
 Holds a value of MMTypeCode::AlgebraicType (initialized with 0) More...
 
int m_class_type
 Holds a value of MMTypeCode::ClassType (initialized with 0) More...
 
int m_numeric_type
 Holds a value of MMTypeCode::NumericType (initialized with 0) More...
 

Detailed Description

Type representation for MatrixMarket matrix exchange files.

Member Enumeration Documentation

◆ AlgebraicType

Algebraic type of the described matrix.

Note
Hermitian matrices are not yet supported.
Enumerator
GENERAL 
SYMMETRIC 
SKEW 
HERMITIAN 

◆ ClassType

Class type of the described matrix.

Note
Only matrices in coordinate format are supported yet.
Enumerator
COORDINATE 
ARRAY 

◆ NumericType

Numeric type of the described matrix.

Note
Only real matrices are supported yet.
Enumerator
REAL 
COMPLEX 
INTEGER 
PATTERN 

Constructor & Destructor Documentation

◆ MMTypeCode()

ug::MMTypeCode::MMTypeCode ( )
inline

Default constructor.

Initializes all three types to 0, thus undefined.

Member Function Documentation

◆ is_general()

bool ug::MMTypeCode::is_general ( ) const
inline

Tells whether MMTypeCode is general.

Returns
true if AlgebraicType is general (i.e. 1), false otherwise.

References GENERAL, and m_algebraic_type.

Referenced by ug::MatrixIOMtx::write_banner().

◆ is_real()

bool ug::MMTypeCode::is_real ( ) const
inline

Tells whether MMTypeCode is real.

Returns
true if NumericType is real (i.e. 1), false otherwise.

References m_numeric_type, and REAL.

◆ is_skew_symmetric()

bool ug::MMTypeCode::is_skew_symmetric ( ) const
inline

Tells whether MMTypeCode is skew-symmetric.

Returns
true if AlgebraicType is skew-symmetric (i.e. 3), false otherwise.

References m_algebraic_type, and SKEW.

Referenced by ug::MatrixIOMtx::read_into(), and ug::MatrixIOMtx::write_banner().

◆ is_sparse()

bool ug::MMTypeCode::is_sparse ( ) const
inline

Tells whether MMTypeCode is sparse.

Returns
true if ClassType is sparse (i.e. 1), false otherwise.

References COORDINATE, and m_class_type.

Referenced by ug::MatrixIOMtx::is_sparse(), ug::MatrixIOMtx::query_matrix_characteristics(), and ug::MatrixIOMtx::read_into().

◆ is_symmetric()

bool ug::MMTypeCode::is_symmetric ( ) const
inline

Tells whether MMTypeCode is symmetric.

Returns
true if AlgebraicType is symmetric (i.e. 2), false otherwise.

References m_algebraic_type, and SYMMETRIC.

Referenced by ug::MatrixIOMtx::read_into(), and ug::MatrixIOMtx::write_banner().

◆ set_algebraic_type() [1/2]

void ug::MMTypeCode::set_algebraic_type ( int  type)
inline

Sets a new algebraic type from an enum value.

Parameters
[in]typeOne value of MMTypeCode::AlgebraicType
Exceptions
UGErrorif type is not a valid value

References GENERAL, HERMITIAN, m_algebraic_type, SKEW, SYMMETRIC, and UG_THROW.

Referenced by ug::MatrixIOMtx::determine_matrix_characteristics(), ug::MatrixIOMtx::query_matrix_type(), and set_algebraic_type().

◆ set_algebraic_type() [2/2]

void ug::MMTypeCode::set_algebraic_type ( std::string  type)
inline

Sets a new algebraic type from a string.

Parameters
[in]typea string either general, symmetric, skew-symmetric or hermitian
Exceptions
UGErrorif type is another string

References GENERAL, HERMITIAN, MM_GENERAL_STR, MM_HERMITIAN_STR, MM_SKEW_STR, MM_SYMMETRIC_STR, set_algebraic_type(), SKEW, SYMMETRIC, and UG_THROW.

◆ set_class_type() [1/2]

void ug::MMTypeCode::set_class_type ( int  type)
inline

Sets a new class type from an enum value.

Parameters
[in]typeOne value of MMTypeCode::ClassType
Exceptions
UGErrorif type is not a valid value

References ARRAY, COORDINATE, m_class_type, and UG_THROW.

Referenced by ug::MatrixIOMtx::determine_matrix_characteristics(), ug::MatrixIOMtx::query_matrix_type(), and set_class_type().

◆ set_class_type() [2/2]

void ug::MMTypeCode::set_class_type ( std::string  type)
inline

Sets a new class type from a string.

Parameters
[in]typea string either coordinate or array
Exceptions
UGErrorif type is another string

References ARRAY, COORDINATE, MM_ARRAY_STR, MM_COORDINATE_STR, MM_DENSE_STR, MM_SPARSE_STR, set_class_type(), and UG_THROW.

◆ set_numeric_type() [1/2]

void ug::MMTypeCode::set_numeric_type ( int  type)
inline

Sets a new numeric type from an enum value.

Parameters
[in]typeOne value of MMTypeCode::NumericType
Exceptions
UGErrorif type is not a valid value

References COMPLEX, INTEGER, m_numeric_type, PATTERN, REAL, and UG_THROW.

Referenced by ug::MatrixIOMtx::determine_matrix_characteristics(), ug::MatrixIOMtx::query_matrix_type(), and set_numeric_type().

◆ set_numeric_type() [2/2]

void ug::MMTypeCode::set_numeric_type ( std::string  type)
inline

Sets a new numeric type from a string.

Parameters
[in]typea string either real, complex, integer or pattern
Exceptions
UGErrorif type is another string

References COMPLEX, INTEGER, MM_COMPLEX_STR, MM_INTEGER_STR, MM_PATTERN_STR, MM_REAL_STR, PATTERN, REAL, set_numeric_type(), and UG_THROW.

◆ to_string()

std::string ug::MMTypeCode::to_string ( )
inline

Pretty prints the three classes and their current value.

MatrixMarket Type Codes: ClassType: {0,1,2} NumericType: {0,1,2,3,4} AlgebraicType: {0,1,2,3,4}

Returns
String
Todo:
Display corresponding strings instead of internal numeric codes.

References m_algebraic_type, m_class_type, and m_numeric_type.

Member Data Documentation

◆ m_algebraic_type

int ug::MMTypeCode::m_algebraic_type
private

Holds a value of MMTypeCode::AlgebraicType (initialized with 0)

Referenced by is_general(), is_skew_symmetric(), is_symmetric(), set_algebraic_type(), and to_string().

◆ m_class_type

int ug::MMTypeCode::m_class_type
private

Holds a value of MMTypeCode::ClassType (initialized with 0)

Referenced by is_sparse(), set_class_type(), and to_string().

◆ m_numeric_type

int ug::MMTypeCode::m_numeric_type
private

Holds a value of MMTypeCode::NumericType (initialized with 0)

Referenced by is_real(), set_numeric_type(), and to_string().

◆ MM_LINE_LENGTH

const int ug::MMTypeCode::MM_LINE_LENGTH = 1025
static

Maximum line length in characters as defined by the MatrixMarket specifications.


The documentation for this class was generated from the following file: