Sparse Matrix Operations in Java

Posted By: Achchuthan Yogarajah - 11:56 AM

Share

& Comment

In the subfield of numerical analysis, a sparse matrix is a matrix populated primarily with zeros (Stoer & Bulirsch 2002, p. 619) 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).


What my program do ?

 Include methods to store a sparse matrix, display a matrix, perform operations such asOR, AND on two sparse matrices and store the results and print .
Matrix 1
100
010
100
(1,1), (2,1), (3,1) //input
Matrix 2
100
011
001

(1,1), (2,2), (2,3), (3,3)//input
Matrix 1
AND
Matrix 2
100
010
000










Java version of SparseMatrixOperations.java 


Output of this program :

run:
Enter the Matrix Row ,Coloum size : 
Like row,coloum 
3,3
------- Get Matrix A,B-------
Stop entering type End command 
------- Get Matrix A--------- 
Enter Address Like Row,Coloum 
0,0
1,1
2,2
End
------- Get Matrix B--------- 
Enter Address Like Row,Coloum 
0,0
1,2
1,1
2,1
End
+++++++ Select Perform operations +++++++
Such as
1. OR
2. AND  
Type the number ..... 
2
===== Print Matrix A ======
1 0 0
0 1 0
0 0 1
===== Print Matrix B ======
1 0 0
0 1 1
0 1 0
===== Output Matrix B ======
1 0 0
0 1 0
0 0 0
BUILD SUCCESSFUL (total time: 52 seconds)

About Achchuthan Yogarajah

I’m passionate about Web Development and Programming and I go to extreme efforts to meet my passion. I’m a believer of learning the fundamentals first. I try to understand everything little bit more than the average.

0 comments :

Post a Comment

Thank you for vising Java90.blogspot.com

Copyright © 2016 Java Examples ACHCHUTHAN.ORG. Designed by Templateism .