github.com/gonum/lapack@v0.0.0-20181123203213-e4cdc5a0bff9/internal/testdata/dlasqtest/testdlasq2.f90 (about) 1 ! $CLASSHG/codes/lapack/random/randomsys1.f90 2 3 program randomsys1 4 implicit none 5 integer, parameter :: nmax=1000 6 real(kind=8), dimension(nmax) :: b, x 7 real(kind=8), dimension(nmax,nmax) :: a 8 real(kind=8) :: err 9 integer :: i, info, lda, ldb, nrhs, n,iter 10 integer, dimension(nmax) :: ipiv 11 12 real(kind=8), dimension(84) :: z 13 14 z(1:84) = (/2.3962280929192509D-01, & 15 6.4346010490580374D-01, & 16 5.4886677265274941D-01, & 17 1.8435046456575191D-01, & 18 4.2690013698472401D-01, & 19 6.2760930131666248D-01, & 20 8.7243363936287288D-02, & 21 5.3710399529030350D-01, & 22 8.4474604576675638D-01, & 23 4.0947669295022632D-01, & 24 2.0315141244999760D-01, & 25 8.2714283129979482D-01, & 26 9.6582843029739029D-01, & 27 3.7773539690481128D-01, & 28 6.4713340225873406D-01, & 29 6.7774351756798612D-01, & 30 4.4568905572928591D-01, & 31 1.7208265726837521D-01, & 32 3.5202074329011412D-01, & 33 3.2913965083413110D-01, & 34 7.4682622623737438D-01, & 35 2.7151044969605542D-01, & 36 5.6129178633962351D-01, & 37 1.3244294692867761D-01, & 38 7.9837660640147112D-01, & 39 2.0595995860196409D-01, & 40 2.6555102564257749D-02, & 41 1.9623902644848701D-01, & 42 7.8452468963715605D-03, & 43 8.2177375597112101D-01, & 44 9.4444982187044924D-01, & 45 4.6799576958310329D-01, & 46 1.1359180530395520D-01, & 47 1.6049482525711320D-01, & 48 8.4523811016138373D-01, & 49 8.5370708147160490D-01, & 50 3.0139325968162661D-01, & 51 2.5117154067021252D-01, & 52 2.0086476380364379D-01, & 53 2.6078975734443288D-01, & 54 2.5710509100784901D-01, & 55 6.2861740244633146D-01, & 56 4.7397018497236110D-01, & 57 8.6989475348440182D-01, & 58 6.4860795895959611D-01, & 59 8.8943219043019872D-01, & 60 7.9524758401855578D-01, & 61 8.8016617212154102D-01, & 62 2.1472721943810300D-01, & 63 9.5183566464760194D-01, & 64 7.1911522894148772D-01, & 65 1.1065249711733080D-01, & 66 9.5745872307341484D-01, & 67 6.4694742306793951D-01, & 68 5.8182607574435841D-01, & 69 1.2922028370755401D-02, & 70 2.7617229134380777D-01, & 71 8.0045359255855852D-01, & 72 3.2789738555900377D-01, & 73 5.7940374386642890D-01, & 74 2.3961554431041750D-02, & 75 6.6990484757537938D-01, & 76 1.8144929371280860D-01, & 77 2.8661849362222419D-01, & 78 6.5845572125062690D-01, & 79 5.8896512277754309D-01, & 80 6.3697665190607378D-02, & 81 1.3281935295985961D-01, & 82 7.4166314172628711D-01, & 83 5.0033182787066932D-01, & 84 3.1440772963953763D-02, & 85 9.9073931564031925D-01, & 86 3.4236965949145941D-03, & 87 6.9929220728508257D-01, & 88 7.5905196170645428D-01, & 89 2.5421825141163590D-01, & 90 3.3146571845550887D-01, & 91 5.7286596840196446D-01, & 92 9.9158547964144228D-01, & 93 4.8967497301052382D-01, & 94 5.6113697207961410D-01, & 95 6.0641422150435165D-01, & 96 8.5675901647669139D-02, & 97 2.5817319326781851D-01/) 98 n = 21 99 info = 0 100 101 open(unit = 2,STATUS='REPLACE', file = "gen2tests.txt") 102 open(unit = 4, STATUS='REPLACE', file = "gen4tests.txt") 103 open(unit = 3,STATUS='REPLACE', file = "gen3tests.txt") 104 open(unit = 5,STATUS='REPLACE', file = "gen5tests.txt") 105 106 write(2,*) "{" 107 write(2,'(9999(g0))',advance="no") "z: []float64{" 108 do i = 1, 4*n 109 write (2,'(99999(e24.16,a))',advance="no") z(i), "," 110 end do 111 write (2,*) "}," 112 write(2,*) "n: " ,n,"," 113 114 115 call dlasq2(n, z, info) 116 117 write(2,'(9999(g0))', advance="no") "zOut: []float64{" 118 do i = 1, 4*n 119 write (2,'(99999(e24.16,a))', advance="no") z(i), "," 120 end do 121 write (2,*) "}," 122 write(2,*) "info:", info, "," 123 write(2,*) "}," 124 125 print *, "Done fixed dlasq2" 126 127 close(5) 128 close(3) 129 close(4) 130 close(2) 131 132 ! For random tests 133 n = 21 134 135 open(unit = 2, STATUS='REPLACE', file = "gen2tests.txt") 136 open(unit = 4, STATUS='REPLACE', file = "gen4tests.txt") 137 open(unit = 3, STATUS='REPLACE', file = "gen3tests.txt") 138 open(unit = 5, STATUS='REPLACE', file = "gen5tests.txt") 139 140 do iter = 1, 2 141 142 call random_number(z(1:4*n)) 143 144 write(2,*) "{" 145 write(2,'(9999(g0))', advance="no") "z: []float64{" 146 do i = 1, 4*n 147 write (2,'(99999(e24.16,a))', advance="no") z(i), "," 148 end do 149 write (2,*) "}," 150 write(2,*) "n: " ,n,"," 151 152 call dlasq2(n, z, info) 153 154 write(2,'(9999(g0))', advance="no") "zOut: []float64{" 155 do i = 1, 4*n 156 write (2,'(99999(e24.16,a))', advance="no") z(i), "," 157 end do 158 write (2,*) "}," 159 write(2,*) "info:", info, "," 160 write(2,*) "}," 161 162 print *, "Done with dlasq2" 163 164 end do 165 166 close(5) 167 close(3) 168 close(4) 169 close(2) 170 171 end program randomsys1