Matrix  0.1.0
Easy-to-use Scientific Computing library in/for C++
Matrix Class Reference

#include <matrix_basic.hpp>

Public Member Functions

std::vector< std::vector< double > > get ()
 Method to return the matrix in the form of vector. More...
 
std::vector< double > get_row (int)
 Method to return a row of the matrix in the form of a vector. More...
 
std::vector< double > get_col (int)
 Method to return a column of the matrix in the form of a vector. More...
 
int col_length ()
 Method to return the number of columns. More...
 
int row_length ()
 Method to return the number of rows. More...
 
void print ()
 Method to print a Matrix object. More...
 
void head ()
 Method to print first 5 rows of a Matrix object. More...
 
void tail ()
 Method to print last 5 rows of a Matrix object. More...
 
void view (int, int)
 Method to print a single cell (row, col) of a Matrix object. More...
 
void view (int, int, int, int)
 Method to print a range of rows and columns of a Matrix object. More...
 
Matrix slice (int, int, int, int)
 Method to slice a Matrix object The method will return a Matrix object whose dimensions will be (row_end-row_start, col_end-col_start) More...
 
Matrix T ()
 Method to return the Tranpose of a Matrix The method will return a Matrix object whose dimensions will be (col_length(), row_length()) More...
 
void to_double ()
 Method convert the elements of a Matrix from std::string to double. More...
 
void to_string ()
 Method convert the elements of a Matrix from double to std::string. More...
 
Matrix operator+ (Matrix)
 
Matrix operator+ (double)
 
Matrix operator- (Matrix)
 
Matrix operator- (double)
 
Matrix operator* (Matrix)
 
Matrix operator* (double)
 
Matrix operator/ (Matrix)
 
Matrix operator/ (double)
 
double & operator() (int, int)
 
Matrix operator- ()
 

Public Attributes

std::vector< std::vector< double > > double_mat
 
std::vector< std::vector< std::string > > str_mat
 
bool if_double = false
 

Member Function Documentation

◆ col_length()

int Matrix::col_length ( )

Method to return the number of columns.

◆ get()

std::vector< std::vector< double > > Matrix::get ( )

Method to return the matrix in the form of vector.

◆ get_col()

std::vector< double > Matrix::get_col ( int  col)

Method to return a column of the matrix in the form of a vector.

◆ get_row()

std::vector< double > Matrix::get_row ( int  row)

Method to return a row of the matrix in the form of a vector.

◆ head()

void Matrix::head ( )

Method to print first 5 rows of a Matrix object.

◆ operator()()

double & Matrix::operator() ( int  row,
int  col 
)

◆ operator*() [1/2]

Matrix Matrix::operator* ( double  val)

◆ operator*() [2/2]

Matrix Matrix::operator* ( Matrix  mat)

◆ operator+() [1/2]

Matrix Matrix::operator+ ( double  val)

◆ operator+() [2/2]

Matrix Matrix::operator+ ( Matrix  mat)

◆ operator-() [1/3]

Matrix Matrix::operator- ( )

◆ operator-() [2/3]

Matrix Matrix::operator- ( double  val)

◆ operator-() [3/3]

Matrix Matrix::operator- ( Matrix  mat)

◆ operator/() [1/2]

Matrix Matrix::operator/ ( double  val)

◆ operator/() [2/2]

Matrix Matrix::operator/ ( Matrix  mat)

◆ print()

void Matrix::print ( )

Method to print a Matrix object.

◆ row_length()

int Matrix::row_length ( )

Method to return the number of rows.

◆ slice()

Matrix Matrix::slice ( int  row_start,
int  row_end,
int  col_start,
int  col_end 
)

Method to slice a Matrix object The method will return a Matrix object whose dimensions will be (row_end-row_start, col_end-col_start)

◆ T()

Matrix Matrix::T ( )

Method to return the Tranpose of a Matrix The method will return a Matrix object whose dimensions will be (col_length(), row_length())

◆ tail()

void Matrix::tail ( )

Method to print last 5 rows of a Matrix object.

◆ to_double()

void Matrix::to_double ( )

Method convert the elements of a Matrix from std::string to double.

◆ to_string()

void Matrix::to_string ( )

Method convert the elements of a Matrix from double to std::string.

◆ view() [1/2]

void Matrix::view ( int  row,
int  col 
)

Method to print a single cell (row, col) of a Matrix object.

◆ view() [2/2]

void Matrix::view ( int  row_start,
int  row_end,
int  col_start,
int  col_end 
)

Method to print a range of rows and columns of a Matrix object.

Member Data Documentation

◆ double_mat

std::vector<std::vector<double> > Matrix::double_mat

◆ if_double

bool Matrix::if_double = false

◆ str_mat

std::vector<std::vector<std::string> > Matrix::str_mat