What All Should I Add in a Matrix Class ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 11

What All Should I Add in a Matrix Class ?

I was creating a Matrix Class for the past few days, But still want to know what all can I add in it, so that is gets better. BTW, it is valid for Real and Complex Numbers and Here's what it can do till date: /// Matrix Constructor - Initializes the Matrix and Sets Default elements to 0 /// Reads a Matrix /// Prints a Matrix /// Sets the Number of Rows /// Sets the Number of Columns /// Returns the Number of Rows of a Matrix /// Returns the Number of Columns of a Matrix /// Assigns a value to an element of a Matrix /// Returns an element of a Matrix located at rc and cc /// Sorts a Particular Row of a Matrix /// Sorts a Particular Column of a Matrix /// Returns a SubMatrix from a Matrix /// Flips a Matrix Along Row, Column or Diagonal /// Extracts the Row from a Matrix /// Extracts the Column from a Matrix /// Extracts the Diagonal from a Matrix /// Generates a Skew-Symmetric Matrix from Matrix A /// Generates a Symmetric Matrix from Matrix A /// Swaps two Rows or Columns in a Matrix /// Shifts a Row/Column to a New Position in a Matrix /// Multiplies a Row or Column by a constant /// Performs Elementary Transformations (Gauss-Jordan Method) on a Matrix - User /// Returns the Matrix as a Clockwise Spiral /// Resizes the Matrix, Restoring Old Values... /// Resizes the Matrix, Deleting Old Values... /// Returns the Sum of All Elements of the Matrix /// Fills a Value in the Entire Matrix /// Fills the Diagonal and the rest of the Matrix with different values /// Converts the Matrix to I ( Identity Matrix )

28th Apr 2017, 8:23 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
6 Answers
+ 5
Here I've done a bit research and in math stackExchange I've filtered an extensive Q/A results for you. Skim through them and you might find some good idea on how you can make your project better. https://math.stackexchange.com/search?q=matrix+operations
30th Apr 2017, 4:40 AM
Babak
Babak - avatar
+ 12
@Babak Sheykhan (PERS) Thanks a Lot!
30th Apr 2017, 7:02 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 11
Also : ///Operators - /// Checks if two Matrices are Equal /// Checks if two Matrices are Unequal /// Adds two Matrices /// Subtracts two Matrices /// Multiplies two Matrices /// Divides two Matrices - Multiplication by Inverse /// Assigns M2 with the values of M1 /// Returns Transpose of a Matrix /// Returns Sum of M1 and M2 in M1 /// Returns Difference of M1 and M2 in M1 /// Returns Product of M1 and M2 in M1 /// Returns Scalar Product of M1 with Constant in M1 /// Returns Quotient of M1 and M2 in M1 /// Returns Scalar Quotient of M1 with Constant in M1 /// Raises Matrix A to Power of an Integer /// Returns Kronecker Product of Two Matrices M1 and M2 /// Friend Functions /// Fills values using a Relation - Lambda Function or Functor /// Sorts the Entire Matrix in Ascending/Descending Order /// Returns A^-1 of Matrix A - One can also use ^ for Inverse /// Returns Adjoint of M1 /// Returns a Cofactor Matrix of Matrix a. /// Returns Determinant of M1 /// Returns Scalar Product of M1 with a Constant /// Overload of << Operator for cout & >> Operator for cin /// Saves Absolute Value Matrix of a Matrix A in A ///Specialized Template Functions for Particular Data Types /// Randomly fills an Integer Matrix According to a Range /// Converts Complex Matrix to Polar Form /// Converts Complex Matrix to Conjugate Matrix /// Returns Real or Imaginary Part Matrix /// Converts Complex Matrix to Identity Matrix /// Returns Conjugate Transpose Matrix of a Complex Matrix /// Interchanges Real and Imaginary Parts of a Complex Matrix
28th Apr 2017, 8:26 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 9
I wasn't able to understand those myself, so making a function will surely take time... 😅 BTW, Thanks for answering!
29th Apr 2017, 4:39 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 6
@Babak Sheykhan (PERS) Added Row Echelon form and Reduced Row Echelon Conversions... Trying to add LU-Decomposition...
4th May 2017, 2:35 PM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 5
reduced row echelon form operations must be the trickiest one that I have encountered, but I don't suggest you to implement that.
28th Apr 2017, 10:41 AM
Babak
Babak - avatar