-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f138aa1
commit 8b6f0b5
Showing
2 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
!***************************************************************************************** | ||
!> | ||
! Example in the readme. | ||
|
||
program example | ||
|
||
use iso_fortran_env | ||
use polyroots_module, wp => polyroots_module_rk | ||
|
||
implicit none | ||
|
||
integer,parameter :: degree = 5 !! polynomial degree | ||
real(wp),dimension(degree+1) :: p = [1,2,3,4,5,6] !! coefficients | ||
|
||
integer :: i !! counter | ||
integer :: istatus !! status code | ||
real(wp),dimension(degree) :: zr !! real components of roots | ||
real(wp),dimension(degree) :: zi !! imaginary components of roots | ||
|
||
call polyroots(degree, p, zr, zi, istatus) | ||
|
||
write(*,'(A,1x,I3)') 'istatus: ', istatus | ||
write(*, '(*(a22,1x))') 'real part', 'imaginary part' | ||
do i = 1, degree | ||
write(*,'(*(e22.15,1x))') zr(i), zi(i) | ||
end do | ||
|
||
end program example | ||
!***************************************************************************************** |