Skip to content

Matrix library containing basic matrix computations.

License

Notifications You must be signed in to change notification settings

boushrabettir/Matrix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Matrix V.1. Library

Integrating this into your Project

First, git clone this into any folder of your repository. Preferably, the root of your project.

git clone https://github.com/boushrabettir/Matrix.git

If you're using macOS, you can use this command to clone it into your project.

sudo git clone https://github.com/boushrabettir/Matrix.git

Examples

Similar to any matrix that can do matrix functions, you can do and apply the same logic here. In other words, what you can do on paper, you can do in this library, or even better. There exists several member functions that are easy to work with for V.1. of this library.

GETTING STARTED

  • Define the matrix.h file in your header. A main.cpp file already exists with this header in src/main.cpp
#include "matrix.h"
  • Create your new matrix
Matrix myMatrix;
  • Set your rows and columns
myMatrix.SetSize(3, 3);
  • Set your values. You will be prompted in the command line to input your values for each row/column element
myMatrix.GetValues();
  • Print your matrix
myMatrix.Print();

Now, you are free to do ANY matrix function for V.1.! Here is the current list of functions to use for your matrix.

  1. Scalar Multiplication
myMatrix.ScalarMultiplication(3);
  1. Multiply Matrix
Matrix mySecondMatrix;

// After doing SetSize() and GetValues() member functions...

myMatrix.MultiplyMatrix(mySecondMatrix);
  1. Arithmetic

The last argument is whether or not you want to subtract or add your matrices. true means you want to subtract, and false means you want to add.

myMatrix.Arithmetic(mySecondMatrix, true);
  1. Transpose
myMatrix.Transpose();
  1. REF/RREF

The last argument is type boolean. If you want your matrix to be REF (Reduced Row Form) input false, else if you want it to be in RREF (Reduced Row Echelon Form), input true

myMatrix.REF(true);
  1. Rank

Please note that this function will automatically put your matrix into RREF (Reduced Row Echelon Form), and return the rank.

myMatrix.Rank();
  1. Trace

Please note that this function returns the trace, so if you would like to verify the number or use this number in another operation, make sure to hold it into a variable.

auto trace = myMatrix.Trace();
std::cout << trace << std::endl;
  1. Exponentiation
myMatrix.Exponentiate(2);
  1. Inverse (strictly, 2x2 Matrices only)
myMatrix.Inverse();
  1. Dot Product
myMatrix.DotProduct(mySecondMatrix);
  1. Orthogonal Test
myMatrix.Orthogonal(mySecondMatrix, myThirdMatrix);

In upcoming V.2., there will exist more member functions to implement into your project!

Created with 💙 by Boushra

About

Matrix library containing basic matrix computations.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages