In the sub field of numerical analysis, a sparse matrix is a matrix populated primarily with zeros as elements of the table. By contrast, if a larger number of elements differ from zero, then it is common to refer to the matrix as a dense matrix. The fraction of zero elements (non-zero elements) in a matrix is called the sparsity (density). Include methods to store a sparse matrix, display a matrix, perform operations such as OR, AND on two sparse matrices and store the results and print .
Matrix 1
1 0 00 1 01 0 0
(1,1), (2,1), (3,1) //input
Matrix 2
1 0 00 1 10 0 1
(1,1), (2,2), (2,3), (3,3)//input
Matrix 1 AND Matrix 2
1 0 00 1 00 0 0
Sparse Matrix Operations
When you run the program, the output will be:
Enter the Matrix Size Row ,Column :Like Row,Column : 4,2Get Matrix A,BStop entering type End commandGet Matrix AEnter Address Like Row, Column0,01,12,2Entering address not inside the matrix !!!!1,3Entering address not inside the matrix !!!!0,4Entering address not inside the matrix !!!!EndGet Matrix BEnter Address Like Row,Column1,10,01,2Entering address not inside the matrix !!!!EndSelect Perform OperationsSuch as1. OR2. ANDType the Number1Print Matrix A1 00 10 00 0Print Matrix B1 00 10 00 0Output Matrix C1 00 10 00 0
إرسال تعليق
Thank you for vising