A matrix is a two-dimensional array. The matrix elements are arranged in a row and column format. A matrix with m rows and n columns is called an m × n matrix. Elements are individual entries in the matrix that are represented as “aij“, which means element a is in the ith row and jth column. The following section contains various Java programs on matrix operations, matrix diagonals, matrix types like sparse matrix, inverse matrix, invertible matrix, adjacency matrix, and square matrix.
Each example program includes a program description, Java code, and program output. All examples have been compiled and tested on Windows and Linux systems.
Here is the listing of Java programming examples on Matrix Operations:
- Java Programs on Matrix Operations
- Java Programs on Matrix Types
- Java Programs on Matrix Rows and Columns
- Java Programs on Matrix Diagonals
- More Matrix Programs
1. Java Programs on Matrix Operations
Program | Description |
---|---|
Matrix Multiplication in Java | Java Program to Multiply Two Matrices |
Multiplicability of Two Matrices in Java | Java Program to Check the Multiplicability of Two Matrices |
Matrix Basis & Dimension in Java | Java Program to Find Basis and Dimension of a Matrix |
Transpose Matrix in Java | Java Program to Find Transpose of a Matrix |
Determinant of a Matrix in Java | Java Program to Find the Determinant of a Matrix |
Matrix Linear Equations in Java | Java Program to Represent Linear Equations in Matrix Form |
advertisement
advertisement
2. Java Programs on Matrix Types
Program | Description |
---|---|
Inverse Matrix in Java | Java Program to Find Inverse of a Matrix Input: Enter the dimension of square matrix: 2 Enter the elements of matrix: 1 2 3 4 Output: Inverse Matrix -1.9999999999999998 1.0 1.4999999999999998 -0.49999999999999994 |
Invertible Matrix in Java | Java Program to Check if a Matrix is Invertible Input: Enter the order of the square matrix: 3 Enter the elements of the square matrix: 1 2 3 4 5 6 7 8 9 Output: Matrix is not Invertible, as the determinant is : 0.0 |
Sparse Matrix Size in Java | Java Program to Implement Sparse Matrix |
Sparse Matrix Program in Java | Java Program to Determine if a given Matrix is a Sparse Matrix |
Check if a Matrix is Sparse or Not in Java | Java Program to Check if a Matrix is a Sparse Matrix Input: Enter the dimensions of the matrix: 3 4 Enter the elements of the matrix: 1 0 0 0 0 1 0 0 0 0 1 1 Output: Given matrix is a sparse matrix |
Maximum Square Matrix with All 1’s in Java | Java Program to Find the Maximum Square Matrix with All 1’s Input: Enter the matrix: 0111 0111 0111 0101 Output: Maximum Sub-matrix is 111 111 111 |
3. Java Programs on Matrix Rows and Columns
Program | Description |
---|---|
Sum & Product of Matrix Elements in Java | Java Program to Find the Sum and Product of Elements in a Row/Column |
Interchange Rows & Columns of a Matrix in Java | Java Program to Interchange Any Two Rows and Columns in the Matrix |
Find Row with Maximum Number of 1s in Java | Java Program to Find the Row with Maximum Number of 1s |
Find Column with Maximum Number of 1s in Java | Java Program to Find the Column with Maximum Number of 1s |
4. Java Programs on Matrix Diagonals
Program | Description |
---|---|
Addition of Two Matrix in Java | Java Program to Add Two Matrices |
Interchanging Matrix Rows in Java | Java Program to Interchange Diagonals of Matrix |
Find Trace & Normal of a Matrix in Java | Java Program to Find the Trace and Normal of a Matrix |
Lower Triangular Matrix in Java | Java Program to Display Lower Triangular Matrix |
Upper Triangular Matrix in Java | Java Program to Display Upper Triangular Matrix |
5. More Matrix Programs
Program | Description |
---|---|
Find Frequency of Odd & Even Numbers in Matrix in Java | Java Program to Find the Frequency of Odd and Even Numbers in Matrix |
Message Encoding using Matrix in Java | Java Program to Perform Message Encoding Using Matrix Multiplication |
LU Decomposition in Java | Java Program to Perform LU Decomposition of Any Matrix |