OscarL

dgesvxx

May 29th, 2015
459
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program programa_x
  2.     implicit none
  3.     real*8, dimension(4,4) :: A,AF
  4.     real*8, dimension(4,1) :: B,X
  5.     real*8, dimension(1) :: FERR,BERR
  6.     real*8, dimension(4*4) :: WORK
  7.     real*8 :: RCOND,RPVGRW
  8.     real*8, dimension(1,2) :: ERR_BNDS_NORM,ERR_BNDS_COMP
  9.     integer,dimension(3) :: PARAMS
  10.     integer, dimension(4) :: R,C
  11.     integer, dimension(4) :: IPIV,IWORK
  12.     integer :: INFO
  13.  
  14.     integer :: i,j
  15.     real*8 :: lam
  16.     character*1 :: EQUED
  17.    
  18.     lam=1d-7
  19.     A(1,:)=[   29.0000000000000d0  ,  58.0000000000000d0 ,   87.0000000000000d0 ,   232.000000000000d0]
  20.     A(2,:)=[  0.000000000000000d0  ,  116.000000000000d0  ,  145.000000000000d0  ,  87.0000000000000d0]
  21.     A(3,:)=[   174.000000000000d0 , lam  ,  203.000000000000d0  , -145.000000000000d0]
  22.     A(4,:)=[  -87.0000000000000d0  ,  178.000000000000d0  ,  116.000000000000d0  ,  261.000000000000d0]
  23.  
  24.    
  25.     B(:,1)= [2291.00000000000d0,1682.00000000000d0,3*lam +348.000000003000d0,2767.00000000000d0]
  26.  
  27. !~  Only one of either dgesv, dgesvx, or dgesvxx must be executed, as they modify their inputs.
  28. !~  call dgesv(4, 1, A, 4, IPIV, B, 4, INFO)
  29. !~  print*,B(:,1)
  30. !~  
  31. !~  
  32. !~  call dgesvx ('E', 'N', 4, 1, A, 4, AF, 4, IPIV, EQUED, R,&
  33. !~   C, B, 4, X, 4, RCOND, FERR, BERR, WORK, IWORK, INFO)
  34. !~  print*,X(:,1)  
  35. !~  print*,RCOND
  36.    
  37.     PARAMS=[1.0d0,10.0d0,1.0d0]
  38.     call dgesvxx ('E', 'N', 4, 1, A, 4, AF, 4, IPIV, EQUED, &
  39.     R, C, B, 4, X, 4, RCOND, RPVGRW, BERR, 2, &
  40.     ERR_BNDS_NORM, ERR_BNDS_COMP, 3, PARAMS, WORK, IWORK, INFO)
  41.     print*,X(:,1)  
  42.     print*,RCOND
  43.    
  44.    
  45.     print*,INFO
  46.    
  47. end program
Advertisement
Add Comment
Please, Sign In to add comment