<< split from sorting the matrix question.. >>
Code:class RationalComplexMatrix { short rows, columns; /*"rows" is the number of complex or rational numbers in ache row Therefor it is equal to number of cols in the matrix columns is the number of complex or rational numbers in ache col Therefor it is equal to number of the rows in the matrix */ char *MatrixName; //A pointer to unique name for the matrix, //that doesn't created by default //it's not transfered with the '=' operator //nor does it make any different //in then the '==' operator is called RationalComplex **matrix; //Pointer to array of pointers that points on arrays of //complex numbers that makes the matrix rows //This one is part of the *operator overloading; RationalComplex Vmulmatrix(RationalComplexMatrix leftmatrix , RationalComplexMatrix ob , int row, int col); //********************************************** // MATRIX RANKING PRIVATE FUNCTIONS // REMEMBER THAT ALMOST ALL THE FUNCTION // GET A POINTER TO ANOTHER // MATRIX OBJECT THIS IS FOR THE ABILITY TO // RANK THE POINTED MATRIX WITH OUR MATRIX //********************************************** /*this one gets line number and give true if the line has canonic pivot (like 0 1 0 ) else returns false*/ bool vAmIPivot(short CurrantRow, RationalComplexMatrix *MyParalalMatrix); /*this one takes all the rows with canonic pivots and nulls all the numbers below and above their leading number(pivot). IT MAKES ALL THE WORK ALOT FASTER BUT CURENTLY DISABLED*/ void PivotNullity(RationalComplexMatrix *MyParalalMatrix); //swapping two given rows void SwapMatrixRows(short RowA,short RowB, RationalComplexMatrix *Myparalelmatrix); //gets two cols and swap them void SwapMatrixCols(short ColA, short ColB); //dividing every number in the matrix in his leading number void vBreakDownRow(RationalComplexMatrix *MyParalalmatrix); //this one receive the current row //and use it to null the other lines void vCutDownRow(short CurrentRow,short CurrentCol, RationalComplexMatrix *MyParalalmatrix); /*sort the matrix lines by the number of zeros from the left, the more zeros you have, go lower*/ void vMoveZerosDown(RationalComplexMatrix *Myparalelmatrix); /*this nice one searches for copys of lines and delete them it take int value if it is negative regular job. but if get positive value it will be row index, if finds copy of the row, he will remove the row he got and not the copy he found*/ void RemoveEqual(short rowtodelete, RationalComplexMatrix *MyParalalmatrix); //works with RemoveEqual(int rowtodelete) function. void CheckDuplicate(short row, RationalComplexMatrix *MyParalalmatrix); //return 1 if the row in the index he got is all //zero equal numbers else returns 0 bool AmIAllZeros(short CurrentRow) const; //reversing the order of rows in matrix, //and then the order of cols void SwapMatrix(RationalComplexMatrix *MyParalalmatrix); /*Returns 1 if the matrix have at least 1 row that all her numbers equal to 0. Else it returns 0*/ bool DoIHaveAllZeroLine() const; public: //constructor default creat objects with 0 cols, 0 // rows and no memory allocation of pointers RationalComplexMatrix(); //Parameters Constructor to build //mxn matrix with memory allocation RationalComplexMatrix(int m_NumberOfRow, int n_NumberOfColumn); //copy constructor RationalComplexMatrix(const RationalComplexMatrix &ob); //destructor ~RationalComplexMatrix(); /*getting access to matrix A's organ like A(1,2) for input/output when 1 and 2 are coordinates*/ RationalComplex &operator()(int RowNumber, int ColumnNumber); friend std::ostream &operator <<(std::ostream &, RationalComplexMatrix &); friend std::istream &operator >>(std::istream &, RationalComplexMatrix &); bool operator==(const RationalComplexMatrix &ob) const; bool operator!=(RationalComplexMatrix &ob) const; RationalComplexMatrix &operator=(RationalComplexMatrix &ob) ; RationalComplexMatrix operator+(RationalComplexMatrix &ob) const; RationalComplexMatrix operator-(RationalComplexMatrix &ob) const; RationalComplexMatrix operator*(RationalComplexMatrix ob); //Sets unique name for the matrix or deletes one void vSetMatrixName(const char *name); /*return pointer to the matrix name and if it has no name returns "Anonimus_Matrix"*/ const char* vGetMatrixName() const; //returns the amount of numbers in column(number of rows) int vGetMatrixColumns() const; //returns the amount of numbers in row(number of columns) int vGetMatrixRows() const; //runs the input operator on the matrix //(JUST LIKE >> OPERATOR OVERLOADING) void vFillMatrix(); //get's reed of all the fractions in a matrix void MakeSimpler(); //************************************************ // THIS PUBLIC FUNCTIONS BELOW BELONG // TO THE RANKING MATRIX PROCESS // REMEMBER THAT ALMOST ALL THE FUNCTION // GET A POINTER TO ANOTHER // MATRIX OBJECT THIS IS FOR THE ABILITY TO // RANK THE POINTED MATRIX WITH OUR MATRIX //************************************************ //the current matrix becomes her own //singular matrix if her order is mxm. void TurnSingularMatrix(); //Current matrix becomes T base //matrix of her self A(j,i)=A(i,j)... void TurnTransposeMatrix(); /*this function operates the whole matrix ranking to canonic process according to another given matrix*/ void vArrangeMatrix(RationalComplexMatrix &MyParalalmatrix); //this function operates the whole //matrix ranking to canonic process void vArrangeMatrix(); /*swaps between the part of matrix above the main diagonal and the part below it*/ void SwapMatrixDir(); /*returns 1 if matrix is singular, 0 if not e.g 1 0 0 0 1 0 0 0 1 will return 1 */ bool IsSingular() const; //Current matrix A becomes A(^-1) matrix of her //self(her Inverse matrix) if inverse able void TurnInverseMatrix (); void RemoveCol(short ColNumber); void RemoveRow(short RowNumber); };
plz help me
i wanna correct the error



LinkBack URL
About LinkBacks


