-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CSR MATRIX + ARPACK #44
Comments
References See this Add more details |
References See this |
The work on this issue started on 2022-12-08. |
Progress made so far: Import modulesPROGRAM main
USE easifemBase
Implicit none Understanding the argumentsArguments to SAUPD
Arguments to IPARAM:
Declare variablesREAL( DFP ) :: maxEV
REAL( DFP ), ALLOCATABLE :: mat(:,:)
INTEGER( I4B ) :: ncv Getting the algebraic largest eigenvalue of a diagonal matrix. mat = zeros(100,100, 1.0_DFP)
call SetDiag(mat=mat, d=arange(1, SIZE(mat,1)), diagNo=0)
maxEV = SymLargestEigenVal(mat=mat)
CALL Display(maxEV, "maxEV=") Getting the absolute largest eigenvalue of a diagonal matrix. In this case we :::note Default value of call SetDiag(mat=mat, d=arange(1, SIZE(mat,1)), diagNo=0)
mat(SIZE(mat,1), SIZE(mat,2) ) = -1000
maxEV = SymLargestEigenVal(mat=mat, which="LM" )
CALL Display(maxEV, "max absolute EV=") :::caution When END PROGRAM main |
Eigenvalue of diffusion matrix with zero dirichlet boundary condition. Import modulesprogram main
use easifembase
implicit none Declare variables real( dfp ) :: maxev
real( dfp ), allocatable :: mat(:,:)
integer( i4b ) :: ncv
integer(I4B) :: nx, ny, n, ii
integer(I4B), allocatable :: dbcnptrs(:)
real(DFP) :: inv_dx2 nx = 10; ny=nx; n = nx*ny
inv_dx2 = 1.0 !REAL(nx-1, kind=DFP) * REAL(nx-1, kind=DFP) mat = zeros(n,n, 1.0_DFP)
call SetDiag(mat=mat, d=inv_dx2 * [4.0], diagNo=0)
call SetDiag(mat=mat, d=inv_dx2 * [-1.0], diagNo=1)
call SetDiag(mat=mat, d=inv_dx2 * [-1.0], diagNo=5)
call GetSym(mat=mat, from="U") call display( MdEncode(mat(1:5, 1:5)), "mat(1:5, 1:5) = " ) dbcnptrs = (arange(2, nx-1, 1) .APPEND. arange(n-nx+2, n-1, 1)) &
& .APPEND. &
& (arange(1, nx*ny, nx ) .APPEND. arange(nx, nx*(ny-1)+1, nx)) mat(:, dbcnptrs) = 0.0_DFP
mat(dbcnptrs, :) = 0.0_DFP
do concurrent(ii=1:size(dbcnptrs))
mat(dbcnptrs(ii), dbcnptrs(ii)) = 1.0_DFP
end do call display( MdEncode(mat(1:5, 1:5)), "mat(1:5, 1:5) = " ) maxEV = SymLargestEigenVal(mat=mat, which="LM")
call Display(maxEV, "maxEV=") results mat(1:5, 1:5) =
mat(1:5, 1:5) =
maxEV=7.48797 end program main |
This example shows the usage of In this example we will calculate many largest eigenvalues. Import modulesPROGRAM main
USE easifemBase
Implicit none Declare variablesREAL( DFP ), ALLOCATABLE :: maxEV(:), mat(:,:)
INTEGER( I4B ) :: ncv Getting the first five algebraic largest eigenvalue of a diagonal matrix. mat = zeros(100,100, 1.0_DFP)
call SetDiag(mat=mat, d=arange(1, SIZE(mat,1)), diagNo=0)
maxEV = SymLargestEigenVal(mat=mat, nev=5)
CALL Display(maxEV, "maxEV=") maxEV=
-------
96.000
97.000
98.000
99.000
100.000 Getting the first five absolute largest eigenvalue of a diagonal matrix. In this case we :::note Default value of call SetDiag(mat=mat, d=arange(1, SIZE(mat,1)), diagNo=0)
mat(SIZE(mat,1), SIZE(mat,2) ) = -1000
maxEV = SymLargestEigenVal(mat=mat, nev=5, which="LM" )
CALL Display(maxEV, "max absolute EV=") max absolute EV=
----------------
96.00
97.00
98.00
99.00
-1000.00 :::caution When END PROGRAM main |
Add support to find out the Eigenvectors and Eigenvalues of sparse matrix.
To this end use ARPACK library.
The library is here
https://www.caam.rice.edu/software/ARPACK/
About ARPACK:
ARPACK is a collection of Fortran77 subroutines designed to solve large scale eigenvalue problems.
You can download the software from here : https://www.caam.rice.edu/software/ARPACK/download.html
Regards
Vikas
The text was updated successfully, but these errors were encountered: