Matrix Library
A simple Matrix operation library to perform Matrix Multiplication and find the transpose of a Matrix.
example.cpp File Reference

A simple example code illustrating how to use the Library. More...

Functions

int main ()
 

Detailed Description

A simple example code illustrating how to use the Library.

Date
Jan 24, 2021
Author
Shiladitya Biswas

This is an example code illustrating how to use the matrix.h library.

Function Documentation

◆ main()

int main ( )
33  {
34 
35  // Define matrices of size 2x4 and 2x2 of type double
36  Matrix<double,2,2> A{{1,2},{3,4}};
37  Matrix<double,2,4> B{{1,2,4,5},{4,6,7,8}};
38 
39  // Print the Matrices A and B followed by Product A*B and transpose of A
40  cout<<A<<"\n \n"<<B<<"\n \n"<< A*B<<"\n\n"<<A.transpose()<<"\n\n";
41 
42  BigMatrix<float> MatObj; // Define float object for Big Matrix
43 
44  // Multiply two Matrices in .csv format and save the result in Ans.csv file.
45  MatObj.matmul("/path/to/A.csv","/path/to/B.csv","/path/to/Ans.csv");
46 
47  // Read Matrix A from A.csv, find its Transpose and save it in A_trans.csv
48  MatObj.Transpose("/path/to/A.csv", "/path/to/A_trans.csv");
49 
50  // In-place Transpose: Read Matrix A from A.csv, find its Transpose and overwrite A.csv
51  MatObj.Transpose("/path/to/A.csv");
52 
53  // print Matrix in file A.csv
54  MatObj.Mat_print("/path/to/matrix/to/print");
55 
56  return 0;
57 }
This is the Class for handling Large Matrices. It takes in large Matrices stored as comma-separated v...
Definition: matrix.h:330
void matmul(std::string file_1, std::string file_2, std::string path, bool print=false)
This is the BigMatrix multiplication Function that multiplies two matrices A and B stored in A...
Definition: matrix.h:731
void Mat_print(std::string path)
Function to print a Matrix from a .csv file.
Definition: matrix.h:650
Matrix< T, n, m > transpose()
Take an object of type Matrix and returns its Transpose.
Definition: matrix.h:161
This class is for matrices of smaller size. The user can define a Matrix A of size m x n of Datatype ...
Definition: matrix.h:42
void Transpose(std::string path, std::string str_path)
This is a function to find the Transpose of a BigMatrix and stores it in a csv file.
Definition: matrix.h:840