Page 1 of 1

zheevr hangs

PostPosted: Sat Dec 12, 2015 9:19 pm
by andreasnoackjensen
The following bug has been reported by Jim Garrison to the Julia issue tracker. The program below reproduces it in Fortran.

When all eigenvalues are requested zheevr hangs. The same problem causes no problems for the QR or DnC based solver. Furthermore, if zheevr is called with the range='V' option and the interval contains all eigenvalues, the subroutine will also return successfully.
Code: Select all
program test

    complex*16  :: a(300,300), z(300,300), work(64*300)
    real*8      :: w(300), rwork(24300), v1(149), v2(150)
    integer*8   :: m, isuppz(600), lwork, lrwork, iwork(10*300), liwork, info, i

    v1 = (/1.9283838265657773,1.6089826681522186,1.5819899008819331,0.8563894998692092,1.5176913132974472, &
           1.956447456286769,1.8614276526141293,1.9747750209965926,0.6841469298415483,1.576425750794785,   &
           1.2153315400335893,0.5621547072078665,1.374919843574784,1.5919262903601115,1.8075122649005215,  &
           1.1000401798351143,0.882006054250994,0.039860210506928784,1.0686746050255849,0.2954605785622957,&
           0.8320367109152467,1.7820799396761084,0.03825164053971042,0.6037983639554665,0.5133826898345935,&
           1.6197909643852744,1.4103259734661093,0.4443430085366735,0.7892543319556724,1.6182099141243116, &
           1.5208804658269277,0.08619297768901557,0.7824286877335411,0.015767797397542083,1.6595028352617986,&
           0.5632491348622448,1.2409576404853664,0.5497680743235462,0.25099070283334246,0.8153701625388425,&
           0.3705580721031665,1.7122630271704349,0.359343675577656,0.5473980611674589,1.674217152174541,&
           0.5945695978035435,0.45941328812385773,1.4239671940527017,0.40100775684937817,0.18085790609146768,&
           0.9502069069855836,0.5464598124008146,0.5157439388182605,0.879632829249716,1.8380065497973543,&
           1.407953071311673,0.01969567605312683,0.6233161608748632,0.026806985138841277,0.9099284249628288,&
           0.007966686810135126,1.7215490205849804,1.2720475464458398,0.47034111614204344,0.5581810019492668,&
           0.4301153372360109,0.5154214124766754,1.832785805664039,0.5802253366212855,1.4259297089157545,&
           1.6493765168250252,1.8500386120486212,1.2562937901196753,1.704501237737484,0.35848004666546496,&
           0.5665114730352059,0.8932728847386335,0.6883193917517105,0.9868818509234774,0.8277423596468636,&
           1.2314837616350953,0.6858043068593003,1.1227165929184841,1.1713445289619453,1.9320788449018114,&
           1.4541038771407306,1.639142156036279,0.8139422560458764,1.3042087360989036,0.3068044984673497,&
           1.8764768903842617,1.3344697153439466,0.22589409278300332,0.7075723480659444,1.8418928703133335,&
           1.817112195110921,1.4864064041971106,1.919154113899046,1.4736194221984742,0.3606482911608948,&
           0.5700827995604647,0.41021562363012354,0.9276185970925179,0.6701263706080605,1.183162143563961,&
           0.6359004582226633,0.5798916429466816,0.5057661858949283,1.958880265077076,0.7089166703816923,&
           1.1245386921313294,1.574700430614679,1.715445692496239,1.7310566773258245,1.1722807113622298,&
           0.3036459473951423,0.8151663065692909,0.2923620474082389,1.0735854041702946,1.37108032845987,&
           1.040126970757333,1.8717739019751916,1.4334330149090646,0.2775354961373009,0.32185208013093236,&
           1.5267506099826362,0.4945322529101701,1.365221318599537,0.7332445453781138,1.0800719244880859,&
           1.7656744862229585,0.28252018612578844,1.5534487811698576,0.35552054503012886,0.9067660315895965,&
           1.3146930668693195,0.6897240747690812,1.9838309609352636,1.0062985122780428,0.34100889649439203,&
           0.7216484681393931,0.1162498454985883,1.0324443787816828,1.9873599494842495,1.9992151801561935,&
           0.12267924499981042,0.9924316682761649,1.9436808548544868,1.8645664487327815/)
    v2 = (/0.4719216313867425,0.8110892381115882,0.8295482664856118,0.7137325091181328,1.805581670292173,&
            1.952538740443262,0.40646633244118924,1.2416346939659841,0.5646347856009752,0.3028339081228375,&
            1.2544441493078389,0.4499690101208844,0.927072288185931,0.2615148842317483,1.476963550685117,&
            0.20175462863673221,1.9553948742173852,1.4933314104096738,1.8788849976146564,0.43855215645986023,&
            1.0962509713450812,1.184459852071655,1.5632133222351117,1.9719624245484915,1.5579355043036953,&
            1.0787378132321805,1.2327884666050934,1.391804944240413,1.5558767442537391,1.5715772772567775,&
            0.3275493457504366,1.7752872843156364,1.138682380881329,1.7705242491161552,0.2272965820496058,&
            1.2144168285453842,1.2166842844169907,1.3659327721080636,1.508148175730962,1.7866740082764236,&
            1.4931183237983396,1.3880273753281673,0.22136529713189823,0.29556325372398096,0.5896468999740754,&
            0.36775229776211926,0.4552708243946131,1.548227255086557,0.6239444205435762,0.5919328666143584,&
            0.9530965642421205,0.38972782365064296,0.20265766160585041,1.407309066235313,0.9174573486301338,&
            0.9686041353720602,0.8592105233142817,0.14457934791341343,1.8665349446460362,0.4841949182713212,&
            1.0116382755376194,1.2421931479783126,0.23595951044368668,0.5748205579213277,0.5150868235755741,&
            0.17430406446481417,1.0102591716255525,1.6672710134604647,1.1380565813956371,1.6169521721215334,&
            1.7201760072113084,1.9860275441508382,0.00041517144350855517,1.516832273089308,1.9371350886568068,&
            1.7867082688173852,0.9126941823120895,0.03912141458027074,0.0596162437291099,0.5306432479265921,&
            0.827019050501479,0.385826086751627,1.6764449427017651,1.2499851697720703,0.12342888365115856,&
            0.18806714021211102,1.5245088005127774,0.669288315382579,1.8099442845278255,1.4159042552240284,&
            0.23751388632428805,0.24969394442600512,1.7957346387230673,1.5304637612497474,0.4642446111022571,&
            0.11769118052601613,0.7395177571628344,0.866756850076269,0.4539970364618431,0.43754080282325747,&
            1.060593020316368,1.2618125167259717,1.0358122930378824,0.6189550192316844,0.960496605181544,&
            1.3673305965541522,0.28258678834446593,1.8420509709287853,0.1353274288000259,0.2911865626816441,&
            0.31194434791810455,1.9654266064123376,1.7952432271148377,1.9511651272570236,0.7893498472841793,&
            0.13997181031188433,0.5664962820281314,1.7352513873125743,1.284221698760447,0.63839140330363,&
            1.0422828070218615,1.0290513099159284,1.0049671768145831,0.42121905627069633,0.8357675521083192,&
            0.7497324411971964,0.5290478053768726,1.111957618121615,0.1725746456321664,0.2840674743130278,&
            0.28655068428299346,0.3396802207748695,1.233326801051129,1.1886072566150947,1.7575624466890947,&
            1.8152073108274474,1.4898037874304033,1.029487178858652,0.3854609285040618,1.2616071474034705,&
            0.408592986685286,1.5783795813961778,1.9770943328850485,1.066782902461084,0.20211493528818592,&
            1.270398801511487,0.6965088099225802,1.1108177708860625,0.18243340115502127,1.035913978843063/)

    do i = 1,149
        a(2*i, 2*i + 1) = complex(0.0d0, v1(i))
        a(2*i + 1, 2*i) = complex(0.0d0, -v1(i))
    end do
    do i = 1,150
        a(2*i - 1, 2*i) = complex(0.0d0, v2(i))
        a(2*i, 2*i - 1) = complex(0.0d0, -v2(i))
    end do

    lwork = 64*300
    lrwork = 24*300
    liwork = 10*300

    write(*,*) 'This works'
    call zheevr('V', 'V', 'L', 300_8, a, 300_8, -10.0d0, 10.0d0, 0_8, 0_8, &
        2.0d-16, m, w, z, 300_8, isuppz, work, lwork, rwork, lrwork, iwork, liwork, info)

    write(*,*) w

    write(*,*) 'This does not work'
    call zheevr('V', 'A', 'L', 300_8, a, 300_8, 0.0d0, 0.0d0, 0_8, 0_8, &
        2.0d-16, m, w, z, 300_8, isuppz, work, lwork, rwork, lrwork, iwork, liwork, info)

    write(*,*) w

end program

Re: zheevr hangs

PostPosted: Sun Dec 13, 2015 1:20 pm
by andreasnoackjensen
This doesn't happen on 3.6.0. I read through the bugfixes and didn't think anything matched, but something changed that fixed this. It was reported that approximately 1/1000 of random uniformly random v1 and v2s would give the error, but after trying 20000 samples, I still haven't been able to reproduce this on 3.6.0. Could this be http://icl.utk.edu/lapack-forum/viewtop ... f=2&t=4331?