ulvis.paste.net

Paste Search Dynamic
Recent pastes
matrix.h
  1. /*--------------------------------------------------
  2. Header File: matrix.h
  3.  
  4. Purpose: Declarations of functions and variables of the class
  5.  
  6. Author: Youssef Hammad
  7. ----------------------------------------------------*/
  8.  
  9. #include <iostream>
  10.  
  11. using namespace std;
  12.  
  13. #ifndef MATRIX_H_INCLUDED
  14. #define MATRIX_H_INCLUDED
  15.  
  16. class Matrix
  17. {
  18. private:
  19.     int** mData; ///2D dynamic array to store the matrix
  20.     int mRow,mCol;
  21. public:
  22.     Matrix(int imRow=1,int imCol=1)
  23.     {
  24.         mRow = imRow;
  25.         mCol = imCol;
  26.  
  27.         mData = new int*[mRow];
  28.         for(int i = 0; i < mRow; i++)
  29.             mData[i] = new int[mCol];
  30.     }
  31.  
  32.     Matrix operator+(Matrix m); ///adds matrix m and the current matrix (if valid) "DONE"
  33.     Matrix operator-(Matrix m); ///subtracts matrix m from the current matrix (if valid) "DONE"
  34.     Matrix operator*(Matrix m); ///multiplies current matrix by matrix m (if valid) "DONE"
  35.     Matrix operator+(int scalar); ///adds scalar to every element in the current matrix "DONE"
  36.     Matrix operator-(int scalar); ///subtracts scalar from every element in the current matrix "DONE"
  37.     Matrix operator*(int scalar); ///multiplies every element in the current matrix by scalar "DONE"
  38.     Matrix operator+=(Matrix m); ///adds matrix m and the current matrix (if valid) and stores the result in the current matrix "DONE"
  39.     Matrix operator-=(Matrix m); ///subtracts matrix m from the current matrix (if valid) and stores the result in the current matrix "DONE"
  40.     Matrix operator+=(int scalar); ///adds scalar to every element in the current matrix and stores the result in the current matrix "DONE"
  41.     Matrix operator-=(int scalar); ///subtracts scalar from every element in the current matrix and store the result in the current matrix "DONE"
  42.     Matrix operator++(); ///increments every element in the current matrix by 1 "DONE"
  43.     Matrix operator--(); ///decrements every element in the current matrix by 1 "DONE"
  44.     Matrix operator++(int); ///increments every element by 1 (postfix) "DONE"
  45.     Matrix operator--(int); ///increments every element by 1 (postfix) "DONE"
  46.  
  47.     bool operator== (Matrix m); ///compares every element in matrix m to every element in the current matrix (return TRUE if identitcal) "Done"
  48.     bool operator!= (Matrix m); ///compares every element in matrix m to every element in the current matrix (return FALSE if identitcal) "Done"
  49.     bool isSymmetric (); ///returns true if the current matrix "Done"
  50.  
  51.  
  52.     friend ostream &operator<<(ostream &out,Matrix &m); "DONE"
  53.     friend istream &operator>>(istream &in,Matrix&m); "DONE"
  54.  
  55.  
  56.  
  57.  
  58.     friend void inp(Matrix m); ///done
  59.     friend void display(Matrix m); ///done
  60.  
  61.  
  62.  
  63.     void deleteMatrix(); ///done
  64.  
  65.     Matrix transpose(); ///done
  66.     bool isSquare(); ///done
  67.     bool isIdentity(); ///done
  68.  
  69. };
  70.  
  71.  
  72. #endif // MATRIX_H_INCLUDED
Parsed in 0.027 seconds