Welcoming you to this super exciting 🧵 where we will implement various matrix operations in JavaScript along with their Complexity Analysis (both Time and Space).
Here, number of rows is 3 and number of columns is also 3.
↓
3️⃣ Diagonal Matrix
A "Diagonal Matrix" is a square matrix which has only Zeroes (0s) as its non-diagonal elements (row index = column index).
Diagonal elements can be both Non-Zero and Zero.
Example:
[[5, 0, 0],
[0, 2, 0],
[0, 0, -3]]
↓
4️⃣ Upper Triangular Matrix
An "Upper Triangular Matrix" is a square matrix which has only Zeroes (0s) as elements "below" the diagonal elements.
Example:
[[5, 6, 7],
[0, 2, 3],
[0, 0, -3]]
↓
5️⃣ Lower Triangular Matrix
An "Lower Triangular Matrix" is a square matrix which has only Zeroes (0s) as elements "above" the diagonal elements.
Example:
[[5, 0, 0],
[1, 2, 0],
[4, 7, -3]]
↓
6️⃣ Identity/Unity Matrix
An "Identity Matrix" is a diagonal matrix with only 1s as its diagonal elements.
Example:
[[1, 0, 0],
[0, 1, 0],
[0, 0, 1]]
↓
7️⃣ Zero Matrix
A "Zero Matrix" has only Zeroes (0s) as all its elements.
Example:
[[0, 0, 0],
[0, 0, 0],
[0, 0, 0]]
↓
8️⃣ Transpose Matrix
A "Transpose Matrix" is formed by converting rows of a matrix into columns (and thus columns into rows).
Dimension of a transpose matrix is exactly opposite of the dimension of the original matrix.
↓
9️⃣ Scalar Multiplication
By doing "Scalar Multiplication", each element of the matrix is multiplied by a scalar value.
↓
1️⃣0️⃣ Matrix Addition
By "Matrix Addition", elements at a specific row and column from 2 matrices are added.
↓
1️⃣1️⃣ Matrix Subtraction
By "Matrix Subtraction", elements at a specific row and column from one matrix is subtracted from the another.
↓
1️⃣2️⃣ Matrix Multiplication
By "Matrix Multiplication", elements of a row from the first matrix is first multiplied with elements of a column from the second matrix and then summation is taken.
↓
1️⃣3️⃣ Orthogonal Matrix
A matrix is known as "Orthogonal" when multiplied with its transpose results into an Identity Matrix.
In other words, if transpose of a matrix is equivalent to its inverse, the matrix is orthogonal.
↓
OMISSIONS:
Inverse and, Determinant of a Matrix are omitted because of time constraints.
But, by now you must be familiar with matrix operations. Can you implement these 2 on your own? If you do, share that here in the reply.
We reached to the end of this 🧵. I hope you enjoyed implementing all these matrix operations in JavaScript.
If you haven't followed yet, do follow me for receiving such informative threads in future.
Share your feedbacks. Support me by giving a Like and RT.
See you soon,👋
• • •
Missing some Tweet in this thread? You can try to
force a refresh
⬩Know your final goal
⬩Set a target for spending daily 1 hour minimum.
⬩Research about Python ecosystem (libraries, frameworks, code editors).
P.S: This is my personal roadmap. I could spend 1 to 2 hours daily for learning and practicing. And it took me ~1 year to finish. It may differ from person to person.
➊ Start with a bang: Simple Data Types
Schedule: Month-1
Effort: 1 to 2 hours daily + Normal practice
❍ C/C++
❍ Java
❍ Python
❍ JavaScript
Or, any language of your choice
Stay in top 5% of programmers.
➊ Arrays
➀ Creating an Array
➁ Iterate through Array
➂ Get an Element
➃ Search an Element
➄ Insert Element(s)
➅ Delete Element(s)
➆ Filter an Array
➇ Fetch a Sub-Array
➈ Merging Arrays
➉ Reverse Array
➀➀ Rotate Array
➋ Linked Lists
➀ Creating a Linked List
➁ Iterate through Linked List
➂ Get an Element
➃ Find an Element
➤ Insert Element(s)
➄ At Start
➅ At End
➆ At Anywhere
➤ Delete Element(s)
➇ From Start
➈ From End
➉ From Anywhere
➀➀ IsEmpty
➀➁ Merging Linked Lists
➀➂ Reverse Linked List
➀➃ Check for Cycles
Implement these algorithms for linked lists, double linked lists, circular linked lists, etc.