a c++ program for carrying out matrix operations.
coded with c++ and compiled with g++. works on linux os, tested on ubuntu 16.04 LTS
Firstly you need to have g++ or gcc or g++-gcc compiler in your local machine
If you have it, you can skip this part if not please follow it even if you are windows or linux.
You can download and use both g++ or gcc compilers and use it from CMD like linux by insatalling :
for tutorials to setup cygwin or mingw in your local machine you can also follow the docs in thier website or follow this youtube tutorial :
sudo apt-get install g++
sudo apt-get update
sudo apt-get install g++ // or you can type gcc iif you want
To get the porject you can just get the winrar from "Clone or Download" Button at the top
Or you can clone it by terminal in linux but you must have it to install it follow the following commands :
sudo apt-get update
sudo apt-get install git
then you can clone it in your local machine by typing in terminal :
git clone https://github.com/AhmedSadek60/AsuMathLabG19
If you are a Windows User don't worry git provides tool called git bash you can download it from here :
Then type in the git bash command :
git clone https://github.com/AhmedSadek60/AsuMathLabG19
To Run the Program You can use Command Line(CMD) For Windows or Linux Users :
make
Previous Command Will Generate a Binary File or exe file in windows
You can run the executable file :
For Linux
./matrix
For Windows
matrix.exe
If you want to pass a file to the program :
For Linux :
./matrix [filename]
For Windows :
matrix.exe [filename]
creating a 2 x 3 matrix without displaying it:
a = [1 2 3; 4 5 6];
if you want to display it, leave out the semicolon:
b = [ 1 2 1; 1 4 4]
doing some operations:
c // Uninitialized Matrix
c = b[transpose]; // Make it Like That c = b' because of single qoute escape doesn't work here
c // displays c
d = a * b //error, invalid dimensions
d = c * a
e = c / a
f = 1 ./ a
g = [ 1 1 2; 1 1 1];
h = c / g //error, g is not invertible (not a square matrix)
g = [ 1 1 1 ; 1 1 1; 1 1 1];
h = [1 2 3; 4 5 6; 7 8 9]
i = h / g //error, g is not invertible (determinant of g is zero)
.or you can use an input file with operations stored in it:
./matrix example.m
B =
1.2 5.7 4.2 1.4
6.3 2.5 8.1 3.1
6.4 2.8 7.1 8.1
3.2 5.1 7.2 8.9
###################################################### C = 10.1 13 8.2 3.8
8.6 9 17 6.2
11.3 6.6 9.1 15.6
13 8.5 8.2 17.8
### supported operations
- add ( + )
- sub ( - )
- mult ( * )
- div ( / )
- elementWiseDiv ( ./ )
- elmentWisePow ( .^ )
- elmentWiseAdd ( .+ )
- elmentWiseSubtract ( .- )
- elmentWiseMultiply ( .* )
## debugging and enhancements
### Profiling
- For Profiling We Use The <a href="http://gnuwin32.sourceforge.net/packages/gprof.htm"><b>Gprof Profiler</b></a> <br />
- You Will Find profiling results for the Two Files [ example.m , bigexample.m ] :
```code
- profilingexamplefile.txt
- profilingbigexamplefile.txt
- profilingbigexample2file.txt
- profilingadvexamplefile.txt
- profilingtrickyexamplefile.txt
- profilingerrorexamplefile.txt
/*
[ Function Name ] : isInsideMatrix() [ Returned Type ] : int [ inherited Function from CMatrix Class ] : getName() - [ Inside File : CMatrix.cpp , Line : 167 ] [ Functionality ] : To Get the Index of Parameter Matrix inside the Matrix vector so we can get the index and use the matrix in this index anywhere else
*/
int isInsideMatrix(vector
}