text:
module M0_2
function f(q::Vector{T}, q_dot::Vector{T}, xi::T) where T
    l1 = q[1]
    l2 = q[2]
    l3 = q[3]
    l1_dot = q_dot[1]
    l2_dot = q_dot[2]
    l3_dot = q_dot[3]

    -2.67167722233334e+17*l1.^18 + 1.92897054519174e+18*l1.^17.*l2 + 2.73392656696369e+18*l1.^17.*l3 - 2.19182832066861e+16*l1.^17 - 7.94325636050451e+18*l1.^16.*l2.^2 - 1.61381303512517e+19*l1.^16.*l2.*l3 + 1.15178429399841e+17*l1.^16.*l2 - 1.45432786330216e+19*l1.^16.*l3.^2 + 1.87809603163173e+17*l1.^16.*l3 - 1.23494057378614e+16*l1.^16 + 2.23589262858673e+19*l1.^15.*l2.^3 + 5.77346754029511e+19*l1.^15.*l2.^2.*l3 - 3.42097126127885e+17*l1.^15.*l2.^2 + 6.90209566581104e+19*l1.^15.*l2.*l3.^2 - 7.04823224685592e+17*l1.^15.*l2.*l3 + 7.83253529924195e+16*l1.^15.*l2 + 5.27349412587774e+19*l1.^15.*l3.^3 - 8.20001654085433e+17*l1.^15.*l3.^2 + 1.22694111718278e+17*l1.^15.*l3 + 514345935737395.0*l1.^15 - 4.73332066262277e+19*l1.^14.*l2.^4 - 1.42062799779999e+20*l1.^14.*l2.^3.*l3 + 5.98240200464844e+17*l1.^14.*l2.^3 - 2.14397615727157e+20*l1.^14.*l2.^2.*l3.^2 + 1.65547503749323e+18*l1.^14.*l2.^2.*l3 - 2.94430177907812e+17*l1.^14.*l2.^2 - 1.97932639584095e+20*l1.^14.*l2.*l3.^3 + 1.90817994975855e+18*l1.^14.*l2.*l3.^2 - 6.00581940887649e+17*l1.^14.*l2.*l3 - 2.18430027254712e+15*l1.^14.*l2 - 1.44293197226472e+20*l1.^14.*l3.^4 + 2.38780355875192e+18*l1.^14.*l3.^3 - 6.32851447039082e+17*l1.^14.*l3.^2 - 3.8809738787458e+15*l1.^14.*l3 + 230711649643284.0*l1.^14 + 7.75486271057917e+19*l1.^13.*l2.^5 + 2.71351798953846e+20*l1.^13.*l2.^4.*l3 - 5.35493742657468e+17*l1.^13.*l2.^4 + 4.44916979110224e+20*l1.^13.*l2.^3.*l3.^2 - 2.04570643262403e+18*l1.^13.*l2.^3.*l3 + 7.46057186484663e+17*l1.^13.*l2.^3 + 5.48866429956099e+20*l1.^13.*l2.^2.*l3.^3 - 3.03245894718386e+18*l1.^13.*l2.^2.*l3.^2 + 1.91907583473315e+18*l1.^13.*l2.^2.*l3 + 5.28373552166597e+15*l1.^13.*l2.^2 + 4.14159386919363e+20*l1.^13.*l2.*l3.^4 - 2.50298198815176e+18*l1.^13.*l2.*l3.^3 + 2.32115782938678e+18*l1.^13.*l2.*l3.^2 + 1.0848023371916e+16*l1.^13.*l2.*l3 - 1.20213890956875e+15*l1.^13.*l2 + 3.14442254811672e+20*l1.^13.*l3.^5 - 5.0601150289318e+18*l1.^13.*l3.^4 + 2.21242248965811e+18*l1.^13.*l3.^3 + 1.47757559720924e+16*l1.^13.*l3.^2 - 2.07042229545173e+15*l1.^13.*l3 - 6389716502175.74*l1.^13 - 9.91535086159478e+19*l1.^12.*l2.^6 - 4.15778261693094e+20*l1.^12.*l2.^5.*l3 - 3.85074152023348e+17*l1.^12.*l2.^5 - 7.20349905829104e+20*l1.^12.*l2.^4.*l3.^2 + 1.1973399414476e+18*l1.^12.*l2.^4.*l3 - 1.39006840194432e+18*l1.^12.*l2.^4 - 9.69592853362292e+20*l1.^12.*l2.^3.*l3.^3 - 9.3861824555691e+17*l1.^12.*l2.^3.*l3.^2 - 4.18055266581092e+18*l1.^12.*l2.^3.*l3 - 6.31242739314076e+15*l1.^12.*l2.^3 - 1.05305129905122e+21*l1.^12.*l2.^2.*l3.^4 + 2.14197497062987e+18*l1.^12.*l2.^2.*l3.^3 - 6.27065234831404e+18*l1.^12.*l2.^2.*l3.^2 - 2.02465263794811e+16*l1.^12.*l2.^2.*l3 + 3.84561436440081e+15*l1.^12.*l2.^2 - 6.57198362003287e+20*l1.^12.*l2.*l3.^5 - 1.20335672507296e+18*l1.^12.*l2.*l3.^4 - 5.92280406770679e+18*l1.^12.*l2.*l3.^3 - 2.01997676580504e+16*l1.^12.*l2.*l3.^2 + 8.07626110144377e+15*l1.^12.*l2.*l3 + 20952600877744.5*l1.^12.*l2 - 5.62753372265446e+20*l1.^12.*l3.^6 + 8.1046075433664e+18*l1.^12.*l3.^5 - 5.77154944915541e+18*l1.^12.*l3.^4 - 3.71264248159538e+16*l1.^12.*l3.^3 + 9.5569755581068e+15*l1.^12.*l3.^2 + 41208356517728.5*l1.^12.*l3 - 7513753376921.59*l1.^12 + 9.53176070260235e+19*l1.^11.*l2.^7 + 5.38021820290143e+20*l1.^11.*l2.^6.*l3 + 2.31044491214009e+18*l1.^11.*l2.^6 + 8.84936193498399e+20*l1.^11.*l2.^5.*l3.^2 + 1.2996252630788e+18*l1.^11.*l2.^5.*l3 + 1.89990189163657e+18*l1.^11.*l2.^5 + 1.42728392693868e+21*l1.^11.*l2.^4.*l3.^3 + 9.35008175381691e+18*l1.^11.*l2.^4.*l3.^2 + 7.18131136514905e+18*l1.^11.*l2.^4.*l3 - 1.75157894736842*l1.^11.*l2.^4 + 1.50195169747444e+21*l1.^11.*l2.^3.*l3.^4 + 1.22742385957442e+19*l1.^11.*l2.^3.*l3.^3 + 1.07643347379027e+19*l1.^11.*l2.^3.*l3.^2 + 1.30924420005882e+16*l1.^11.*l2.^3.*l3 - 8.01504935132244e+15*l1.^11.*l2.^3 + 1.63207261432562e+21*l1.^11.*l2.^2.*l3.^5 + 4.44038631551923e+18*l1.^11.*l2.^2.*l3.^4 + 1.43600457798315e+19*l1.^11.*l2.^2.*l3.^3 + 1.87970060151303e+16*l1.^11.*l2.^2.*l3.^2 - 2.23630885304469e+16*l1.^11.*l2.^2.*l3 - 39129631740680.6*l1.^11.*l2.^2 + 7.84732576150571e+20*l1.^11.*l2.*l3.^6 + 1.29240512272836e+19*l1.^11.*l2.*l3.^5 + 1.05940003597763e+19*l1.^11.*l2.*l3.^4 + 3.3666279430084e+15*l1.^11.*l2.*l3.^3 - 2.63462084991332e+16*l1.^11.*l2.*l3.^2 - 75519126275252.6*l1.^11.*l2.*l3 + 35220122045670.3*l1.^11.*l2 + 8.43332375411548e+20*l1.^11.*l3.^7 - 9.74718947309099e+18*l1.^11.*l3.^6 + 1.18212614170407e+19*l1.^11.*l3.^5 + 6.62571082672626e+16*l1.^11.*l3.^4 - 2.97411323850717e+16*l1.^11.*l3.^3 - 132884843560035.0*l1.^11.*l3.^2 + 55320137157848.1*l1.^11.*l3 + 56282802068.8989*l1.^11 - 5.94735919891829e+19*l1.^10.*l2.^8 - 6.03946374063737e+20*l1.^10.*l2.^7.*l3 - 4.68621490364128e+18*l1.^10.*l2.^7 - 8.55817017771676e+20*l1.^10.*l2.^6.*l3.^2 - 3.15279461969116e+18*l1.^10.*l2.^6.*l3 - 1.80713177845105e+18*l1.^10.*l2.^6 - 1.58656104587735e+21*l1.^10.*l2.^5.*l3.^3 - 2.40430673669578e+19*l1.^10.*l2.^5.*l3.^2 - 9.93580436081432e+18*l1.^10.*l2.^5.*l3 + 1.80488664722395e+16*l1.^10.*l2.^5 - 1.97987562019239e+21*l1.^10.*l2.^4.*l3.^4 - 2.28276770746341e+19*l1.^10.*l2.^4.*l3.^3 - 1.4637439493664e+19*l1.^10.*l2.^4.*l3.^2 + 6.0786337859874e+15*l1.^10.*l2.^4.*l3 + 1.18204975106259e+16*l1.^10.*l2.^4 - 1.77375809785776e+21*l1.^10.*l2.^3.*l3.^5 - 4.00236446759267e+19*l1.^10.*l2.^3.*l3.^4 - 1.98019743894815e+19*l1.^10.*l2.^3.*l3.^3 + 6.78001460744748e+16*l1.^10.*l2.^3.*l3.^2 + 4.10115833708114e+16*l1.^10.*l2.^3.*l3 + 19204582315226.8*l1.^10.*l2.^3 - 2.1190926796731e+21*l1.^10.*l2.^2.*l3.^6 - 1.24547421045051e+19*l1.^10.*l2.^2.*l3.^5 - 2.46123043560196e+19*l1.^10.*l2.^2.*l3.^4 + 1.58044478435672e+16*l1.^10.*l2.^2.*l3.^3 + 6.18145306430279e+16*l1.^10.*l2.^2.*l3.^2 + 100475634536061.0*l1.^10.*l2.^2.*l3 - 93786127407624.5*l1.^10.*l2.^2 - 6.58456229759496e+20*l1.^10.*l2.*l3.^7 - 3.22980945009583e+19*l1.^10.*l2.*l3.^6 - 1.33484735633902e+19*l1.^10.*l2.*l3.^5 + 8.50541142823929e+16*l1.^10.*l2.*l3.^4 + 5.55044676534117e+16*l1.^10.*l2.*l3.^3 + 50125613373815.0*l1.^10.*l2.*l3.^2 - 200348542653087.0*l1.^10.*l2.*l3 - 74918244894.3874*l1.^10.*l2 - 1.07043017981332e+21*l1.^10.*l3.^8 + 8.21376918914087e+18*l1.^10.*l3.^7 - 1.95429028415933e+19*l1.^10.*l3.^6 - 8.58022538252836e+16*l1.^10.*l3.^5 + 6.83751630099804e+16*l1.^10.*l3.^4 + 277899518631595.0*l1.^10.*l3.^3 - 205331983176591.0*l1.^10.*l3.^2 - 373650040490.852*l1.^10.*l3 + 63466254217.0792*l1.^10 + 2.3536472307069e+18*l1.^9.*l2.^9 + 6.15564570195812e+20*l1.^9.*l2.^8.*l3 + 6.30172130705173e+18*l1.^9.*l2.^8 + 5.67226509278647e+20*l1.^9.*l2.^7.*l3.^2 + 2.92587592296312e+18*l1.^9.*l2.^7.*l3 + 8.39904639449429e+17*l1.^9.*l2.^7 + 1.60821529586853e+21*l1.^9.*l2.^6.*l3.^3 + 3.5559191225906e+19*l1.^9.*l2.^6.*l3.^2 + 1.191174470459e+19*l1.^9.*l2.^6.*l3 - 4.20360905661744e+16*l1.^9.*l2.^6 + 1.61541075197846e+21*l1.^9.*l2.^5.*l3.^4 + 3.67986486527312e+19*l1.^9.*l2.^5.*l3.^3 + 1.38328136581061e+19*l1.^9.*l2.^5.*l3.^2 - 3.32922096586386e+16*l1.^9.*l2.^5.*l3 - 1.12330094747385e+16*l1.^9.*l2.^5 + 2.40819861861687e+21*l1.^9.*l2.^4.*l3.^5 + 4.78935976579039e+19*l1.^9.*l2.^4.*l3.^4 + 2.53673816494009e+19*l1.^9.*l2.^4.*l3.^3 - 1.6622725468604e+17*l1.^9.*l2.^4.*l3.^2 - 6.16218205899107e+16*l1.^9.*l2.^4.*l3 + 62716071398434.9*l1.^9.*l2.^4 + 1.42909616159643e+21*l1.^9.*l2.^3.*l3.^6 + 7.04685698202726e+19*l1.^9.*l2.^3.*l3.^5 + 2.37728362971435e+19*l1.^9.*l2.^3.*l3.^4 - 2.18830816295546e+17*l1.^9.*l2.^3.*l3.^3 - 8.16583713159569e+16*l1.^9.*l2.^3.*l3.^2 + 46771307483578.5*l1.^9.*l2.^3.*l3 + 160540877156364.0*l1.^9.*l2.^3 + 2.42971563598519e+21*l1.^9.*l2.^2.*l3.^7 + 1.56556709931992e+19*l1.^9.*l2.^2.*l3.^6 + 3.48330997618425e+19*l1.^9.*l2.^2.*l3.^5 - 9.58553789328782e+16*l1.^9.*l2.^2.*l3.^4 - 1.2426867398285e+17*l1.^9.*l2.^2.*l3.^3 + 54625580078674.2*l1.^9.*l2.^2.*l3.^2 + 457950342540753.0*l1.^9.*l2.^2.*l3 + 256754990040.06*l1.^9.*l2.^2 + 2.5837486761846e+20*l1.^9.*l2.*l3.^8 + 5.12801872984663e+19*l1.^9.*l2.*l3.^7 + 1.03608579534047e+19*l1.^9.*l2.*l3.^6 - 2.48008258468286e+17*l1.^9.*l2.*l3.^5 - 7.61919928397844e+16*l1.^9.*l2.*l3.^4 + 260903581391982.0*l1.^9.*l2.*l3.^3 + 543418406956199.0*l1.^9.*l2.*l3.^2 - 112189130545.362*l1.^9.*l2.*l3 - 224108705047.151*l1.^9.*l2 + 1.15826424997009e+21*l1.^9.*l3.^9 - 3.23230211759777e+18*l1.^9.*l3.^8 + 2.65101403686162e+19*l1.^9.*l3.^7 + 7.54218176676744e+16*l1.^9.*l3.^6 - 1.22037907812257e+17*l1.^9.*l3.^5 - 394485270189777.0*l1.^9.*l3.^4 + 506068392448943.0*l1.^9.*l3.^3 + 1245562880568.24*l1.^9.*l3.^2 - 417245858850.693*l1.^9.*l3 - 1003803259.05759*l1.^9 + 5.18074456144522e+19*l1.^8.*l2.^10 - 5.81099713632707e+20*l1.^8.*l2.^9.*l3 - 6.2763648617734e+18*l1.^8.*l2.^9 - 1.54898457917441e+20*l1.^8.*l2.^8.*l3.^2 + 5.80189849588763e+16*l1.^8.*l2.^8.*l3 + 6.97059183538048e+17*l1.^8.*l2.^8 - 1.38571067029246e+21*l1.^8.*l2.^7.*l3.^3 - 4.36921636063634e+19*l1.^8.*l2.^7.*l3.^2 - 1.27344253934741e+19*l1.^8.*l2.^7.*l3 + 6.01784744812752e+16*l1.^8.*l2.^7 - 1.23374302514609e+21*l1.^8.*l2.^6.*l3.^4 - 2.41513694722143e+19*l1.^8.*l2.^6.*l3.^3 - 8.92902551913404e+18*l1.^8.*l2.^6.*l3.^2 + 3.10010323085356e+16*l1.^8.*l2.^6.*l3 + 4.11770748070764e+15*l1.^8.*l2.^6 - 1.53381699495838e+21*l1.^8.*l2.^5.*l3.^5 - 7.99269536793461e+19*l1.^8.*l2.^5.*l3.^4 - 2.29567774287337e+19*l1.^8.*l2.^5.*l3.^3 + 3.07625628292393e+17*l1.^8.*l2.^5.*l3.^2 + 7.50306929717819e+16*l1.^8.*l2.^5.*l3 - 204022112492761.0*l1.^8.*l2.^5 - 2.37767861224096e+21*l1.^8.*l2.^4.*l3.^6 - 3.92053621028771e+19*l1.^8.*l2.^4.*l3.^5 - 2.80053981857538e+19*l1.^8.*l2.^4.*l3.^4 + 2.25143243688687e+17*l1.^8.*l2.^4.*l3.^3 + 8.91356377879753e+16*l1.^8.*l2.^4.*l3.^2 - 175746731150416.0*l1.^8.*l2.^4.*l3 - 191768998655968.0*l1.^8.*l2.^4 - 5.74660579713542e+20*l1.^8.*l2.^3.*l3.^7 - 1.00720957888607e+20*l1.^8.*l2.^3.*l3.^6 - 1.97059798022247e+19*l1.^8.*l2.^3.*l3.^5 + 5.10605238022941e+17*l1.^8.*l2.^3.*l3.^4 + 1.24350444692011e+17*l1.^8.*l2.^3.*l3.^3 - 799718492351792.0*l1.^8.*l2.^3.*l3.^2 - 682324641836310.0*l1.^8.*l2.^3.*l3 - 679911307935.995*l1.^8.*l2.^3 - 2.52346351632351e+21*l1.^8.*l2.^2.*l3.^8 - 6.63737187929529e+18*l1.^8.*l2.^2.*l3.^7 - 4.22666704960742e+19*l1.^8.*l2.^2.*l3.^6 + 1.16990321019542e+17*l1.^8.*l2.^2.*l3.^5 + 1.8583351741097e+17*l1.^8.*l2.^2.*l3.^4 - 304899318860751.0*l1.^8.*l2.^2.*l3.^3 - 1.0357083895907e+15*l1.^8.*l2.^2.*l3.^2 + 474356726466.973*l1.^8.*l2.^2.*l3 + 464064223519.974*l1.^8.*l2.^2 + 2.5837486761846e+20*l1.^8.*l2.*l3.^9 - 5.94269123272103e+19*l1.^8.*l2.*l3.^8 - 8.41316948521782e+17*l1.^8.*l2.*l3.^7 + 4.23774292326183e+17*l1.^8.*l2.*l3.^6 + 6.14666782915347e+16*l1.^8.*l2.*l3.^5 - 1.0091263917669e+15*l1.^8.*l2.*l3.^4 - 937893063707445.0*l1.^8.*l2.*l3.^3 + 850453845308.647*l1.^8.*l2.*l3.^2 + 1092441782250.68*l1.^8.*l2.*l3 + 538782579.941454*l1.^8.*l2 - 1.07043017981332e+21*l1.^8.*l3.^10 - 3.23230211759777e+18*l1.^8.*l3.^9 - 2.97441099025041e+19*l1.^8.*l3.^8 - 3.04399276513676e+16*l1.^8.*l3.^7 + 1.73222333563331e+17*l1.^8.*l3.^6 + 368926404181075.0*l1.^8.*l3.^5 - 907942529455657.0*l1.^8.*l3.^4 - 2257147423438.69*l1.^8.*l3.^3 + 1351001863270.09*l1.^8.*l3.^2 + 5884916870.19386*l1.^8.*l3 - 296136255.422314*l1.^8 - 8.16872045020224e+19*l1.^7.*l2.^11 + 5.15088985412317e+20*l1.^7.*l2.^10.*l3 + 4.64839512085327e+18*l1.^7.*l2.^10 - 2.6069584741182e+20*l1.^7.*l2.^9.*l3.^2 - 2.89493246431838e+18*l1.^7.*l2.^9.*l3 - 2.06748138416277e+18*l1.^7.*l2.^9 + 1.28725845858113e+21*l1.^7.*l2.^8.*l3.^3 + 4.14487628546203e+19*l1.^7.*l2.^8.*l3.^2 + 1.26273980213873e+19*l1.^7.*l2.^8.*l3 - 6.05191451659844e+16*l1.^7.*l2.^8 + 2.14163997022289e+20*l1.^7.*l2.^7.*l3.^4 + 1.03557441597707e+19*l1.^7.*l2.^7.*l3.^3 + 3.98183906631534e+17*l1.^7.*l2.^7.*l3.^2 - 8.97767451468903e+15*l1.^7.*l2.^7.*l3 + 7.47777855681224e+15*l1.^7.*l2.^7 + 1.75598750170749e+21*l1.^7.*l2.^6.*l3.^5 + 6.1371192978721e+19*l1.^7.*l2.^6.*l3.^4 + 2.21098083071349e+19*l1.^7.*l2.^6.*l3.^3 - 3.47323782787034e+17*l1.^7.*l2.^6.*l3.^2 - 8.31702986265265e+16*l1.^7.*l2.^6.*l3 + 317371667523040.0*l1.^7.*l2.^6 + 3.6707934068841e+20*l1.^7.*l2.^5.*l3.^6 + 7.01797642062551e+19*l1.^7.*l2.^5.*l3.^5 + 1.22737737870294e+19*l1.^7.*l2.^5.*l3.^4 - 2.85041165841378e+17*l1.^7.*l2.^5.*l3.^3 - 4.96833002008919e+16*l1.^7.*l2.^5.*l3.^2 + 278572741996889.0*l1.^7.*l2.^5.*l3 + 150879445301329.0*l1.^7.*l2.^5 + 2.47838943195935e+21*l1.^7.*l2.^4.*l3.^7 + 2.44040743844796e+19*l1.^7.*l2.^4.*l3.^6 + 3.20373505141543e+19*l1.^7.*l2.^4.*l3.^5 - 3.73134597016765e+17*l1.^7.*l2.^4.*l3.^4 - 1.5232144253147e+17*l1.^7.*l2.^4.*l3.^3 + 1.15564105574009e+15*l1.^7.*l2.^4.*l3.^2 + 790713909016856.0*l1.^7.*l2.^4.*l3 + 1643871941363.52*l1.^7.*l2.^4 - 5.74660579713542e+20*l1.^7.*l2.^3.*l3.^8 + 1.0784826786311e+20*l1.^7.*l2.^3.*l3.^7 + 4.15579752492444e+18*l1.^7.*l2.^3.*l3.^6 - 6.84547681745042e+17*l1.^7.*l2.^3.*l3.^5 - 9.37656866641387e+16*l1.^7.*l2.^3.*l3.^4 + 1.56825611304787e+15*l1.^7.*l2.^3.*l3.^3 + 1.1392043272137e+15*l1.^7.*l2.^3.*l3.^2 - 2599926629349.94*l1.^7.*l2.^3.*l3 - 632453501454.477*l1.^7.*l2.^3 + 2.42971563598519e+21*l1.^7.*l2.^2.*l3.^9 - 6.63737187929529e+18*l1.^7.*l2.^2.*l3.^8 + 4.64617214941348e+19*l1.^7.*l2.^2.*l3.^7 - 6.50881402314957e+16*l1.^7.*l2.^2.*l3.^6 - 2.40297292473647e+17*l1.^7.*l2.^2.*l3.^5 + 582692539066249.0*l1.^7.*l2.^2.*l3.^4 + 1.62538779208852e+15*l1.^7.*l2.^2.*l3.^3 + 1216386177154.59*l1.^7.*l2.^2.*l3.^2 - 1862403660846.78*l1.^7.*l2.^2.*l3 - 7087556557.56318*l1.^7.*l2.^2 - 6.58456229759496e+20*l1.^7.*l2.*l3.^10 + 5.12801872984663e+19*l1.^7.*l2.*l3.^9 - 1.11887964859285e+19*l1.^7.*l2.*l3.^8 - 4.97619673099909e+17*l1.^7.*l2.*l3.^7 + 189259331005762.0*l1.^7.*l2.*l3.^6 + 1.84115960565281e+15*l1.^7.*l2.*l3.^5 + 1.05519005066544e+15*l1.^7.*l2.*l3.^4 - 4741308423115.14*l1.^7.*l2.*l3.^3 - 2474181302915.12*l1.^7.*l2.*l3.^2 + 9954649572.25164*l1.^7.*l2.*l3 + 354164227.731665*l1.^7.*l2 + 8.43332375411548e+20*l1.^7.*l3.^11 + 8.21376918914087e+18*l1.^7.*l3.^10 + 2.76598603172169e+19*l1.^7.*l3.^9 - 3.04399276513676e+16*l1.^7.*l3.^8 - 1.98139612921163e+17*l1.^7.*l3.^7 - 151404391573735.0*l1.^7.*l3.^6 + 1.24512229983859e+15*l1.^7.*l3.^5 + 2589197131965.57*l1.^7.*l3.^4 - 2818210692836.75*l1.^7.*l3.^3 - 18119771289.6977*l1.^7.*l3.^2 + 2173187731.96062*l1.^7.*l3 + 23739287.4470653*l1.^7 + 8.09910501475175e+19*l1.^6.*l2.^12 - 4.16287374153702e+20*l1.^6.*l2.^11.*l3 - 2.43078058464738e+18*l1.^6.*l2.^11 + 4.99685137751365e+20*l1.^6.*l2.^10.*l3.^2 + 3.87480865473494e+18*l1.^6.*l2.^10.*l3 + 2.61461524579083e+18*l1.^6.*l2.^10 - 1.13386030292494e+21*l1.^6.*l2.^9.*l3.^3 - 3.44400694715882e+19*l1.^6.*l2.^9.*l3.^2 - 1.1377644199708e+19*l1.^6.*l2.^9.*l3 + 4.44207853591387e+16*l1.^6.*l2.^9 + 3.24054709471956e+20*l1.^6.*l2.^8.*l3.^4 + 1.53427982446803e+19*l1.^6.*l2.^8.*l3.^3 + 6.92401599739838e+18*l1.^6.*l2.^8.*l3.^2 - 2.38469479296429e+16*l1.^6.*l2.^8.*l3 - 1.71630929315618e+16*l1.^6.*l2.^8 - 9.16896113904311e+20*l1.^6.*l2.^7.*l3.^5 - 7.39342371884828e+19*l1.^6.*l2.^7.*l3.^4 - 1.85963698286906e+19*l1.^6.*l2.^7.*l3.^3 + 3.58545875930395e+17*l1.^6.*l2.^7.*l3.^2 + 8.26892867358835e+16*l1.^6.*l2.^7.*l3 - 340651022838730.0*l1.^6.*l2.^7 - 9.68831755946434e+20*l1.^6.*l2.^6.*l3.^6 + 9.0973768415516e+18*l1.^6.*l2.^6.*l3.^5 - 6.10269379027546e+18*l1.^6.*l2.^6.*l3.^4 + 2.74941282012351e+16*l1.^6.*l2.^6.*l3.^3 + 1.29059176877081e+15*l1.^6.*l2.^6.*l3.^2 - 117884954543837.0*l1.^6.*l2.^6.*l3 - 59495291549315.6*l1.^6.*l2.^6 + 3.6707934068841e+20*l1.^6.*l2.^5.*l3.^7 - 1.01081964906129e+20*l1.^6.*l2.^5.*l3.^6 - 8.98547562787135e+18*l1.^6.*l2.^5.*l3.^5 + 6.55931344229471e+17*l1.^6.*l2.^5.*l3.^4 + 1.0955536387949e+17*l1.^6.*l2.^5.*l3.^3 - 1.70601887327222e+15*l1.^6.*l2.^5.*l3.^2 - 715576028027987.0*l1.^6.*l2.^5.*l3 - 2458749032187.14*l1.^6.*l2.^5 - 2.37767861224096e+21*l1.^6.*l2.^4.*l3.^8 + 2.44040743844797e+19*l1.^6.*l2.^4.*l3.^7 - 2.98235503666176e+19*l1.^6.*l2.^4.*l3.^6 + 5.89159890026468e+16*l1.^6.*l2.^4.*l3.^5 + 1.28407403343398e+17*l1.^6.*l2.^4.*l3.^4 - 726549742386952.0*l1.^6.*l2.^4.*l3.^3 - 964698736183567.0*l1.^6.*l2.^4.*l3.^2 + 4157962591638.48*l1.^6.*l2.^4.*l3 + 682620831820.005*l1.^6.*l2.^4 + 1.42909616159643e+21*l1.^6.*l2.^3.*l3.^9 - 1.00720957888607e+20*l1.^6.*l2.^3.*l3.^8 + 1.36717777760352e+19*l1.^6.*l2.^3.*l3.^7 + 8.2482384603706e+17*l1.^6.*l2.^3.*l3.^6 + 2.47414998756287e+16*l1.^6.*l2.^3.*l3.^5 - 2.85340408458528e+15*l1.^6.*l2.^3.*l3.^4 - 1.37373571830988e+15*l1.^6.*l2.^3.*l3.^3 - 835771375203.7*l1.^6.*l2.^3.*l3.^2 + 1833268290864.26*l1.^6.*l2.^3.*l3 + 20486566194.4405*l1.^6.*l2.^3 - 2.1190926796731e+21*l1.^6.*l2.^2.*l3.^10 + 1.56556709931992e+19*l1.^6.*l2.^2.*l3.^9 - 4.58351630902407e+19*l1.^6.*l2.^2.*l3.^8 - 6.50881402314955e+16*l1.^6.*l2.^2.*l3.^7 + 2.67741486718061e+17*l1.^6.*l2.^2.*l3.^6 - 211144107041398.0*l1.^6.*l2.^2.*l3.^5 - 1.81170800459111e+15*l1.^6.*l2.^2.*l3.^4 + 1451305698833.48*l1.^6.*l2.^2.*l3.^3 + 3716534961911.88*l1.^6.*l2.^2.*l3.^2 - 15592624426.639*l1.^6.*l2.^2.*l3 - 609108049.215642*l1.^6.*l2.^2 + 7.84732576150571e+20*l1.^6.*l2.*l3.^11 - 3.22980945009583e+19*l1.^6.*l2.*l3.^10 + 1.92018959478691e+19*l1.^6.*l2.*l3.^9 + 4.23774292326183e+17*l1.^6.*l2.*l3.^8 - 7.88246739140156e+16*l1.^6.*l2.*l3.^7 - 2.24473929674217e+15*l1.^6.*l2.*l3.^6 - 740910681835343.0*l1.^6.*l2.*l3.^5 + 8754140444870.29*l1.^6.*l2.*l3.^4 + 3260250582931.17*l1.^6.*l2.*l3.^3 - 15817117168.2813*l1.^6.*l2.*l3.^2 - 1362130158.83847*l1.^6.*l2.*l3 - 15179499.4722142*l1.^6.*l2 - 5.62753372265445e+20*l1.^6.*l3.^12 - 9.74718947309099e+18*l1.^6.*l3.^11 - 2.12318106050603e+19*l1.^6.*l3.^10 + 7.54218176676744e+16*l1.^6.*l3.^9 + 1.83099075218958e+17*l1.^6.*l3.^8 - 151404391573735.0*l1.^6.*l3.^7 - 1.33055491398971e+15*l1.^6.*l3.^6 - 1257610035526.13*l1.^6.*l3.^5 + 4153719087535.84*l1.^6.*l3.^4 + 22147812482.5934*l1.^6.*l3.^3 - 7225022120.65678*l1.^6.*l3.^2 - 89979041.4641573*l1.^6.*l3 + 4180491.71735646*l1.^6 - 5.99261363986121e+19*l1.^5.*l2.^13 + 2.97545892179622e+20*l1.^5.*l2.^12.*l3 + 6.67862982415494e+17*l1.^5.*l2.^12 - 5.44355385002108e+20*l1.^5.*l2.^11.*l3.^2 - 2.38264631564446e+18*l1.^5.*l2.^11.*l3 - 2.25827355945301e+18*l1.^5.*l2.^11 + 1.04481396228959e+21*l1.^5.*l2.^10.*l3.^3 + 2.16965217530655e+19*l1.^5.*l2.^10.*l3.^2 + 9.00649529394583e+18*l1.^5.*l2.^10.*l3 - 2.20233577938466e+16*l1.^5.*l2.^10 - 9.45299446656119e+20*l1.^5.*l2.^9.*l3.^4 - 2.04329971917389e+19*l1.^5.*l2.^9.*l3.^3 - 1.0799791931553e+19*l1.^5.*l2.^9.*l3.^2 + 2.99255817156302e+16*l1.^5.*l2.^9.*l3 + 1.99641868742144e+16*l1.^5.*l2.^9 + 1.37678819892655e+21*l1.^5.*l2.^8.*l3.^5 + 4.80861347339156e+19*l1.^5.*l2.^8.*l3.^4 + 1.79668597819788e+19*l1.^5.*l2.^8.*l3.^3 - 2.63017808047531e+17*l1.^5.*l2.^8.*l3.^2 - 7.50035462729172e+16*l1.^5.*l2.^8.*l3 + 254336700846308.0*l1.^5.*l2.^8 - 9.16896113904311e+20*l1.^5.*l2.^7.*l3.^6 + 1.73283368410506e+18*l1.^5.*l2.^7.*l3.^5 - 7.94938807577487e+18*l1.^5.*l2.^7.*l3.^4 + 5.38660470881345e+16*l1.^5.*l2.^7.*l3.^3 + 5.18679002674295e+16*l1.^5.*l2.^7.*l3.^2 - 23527384976588.7*l1.^5.*l2.^7.*l3 - 27310516181741.8*l1.^5.*l2.^7 + 1.75598750170749e+21*l1.^5.*l2.^6.*l3.^7 + 9.09737684155159e+18*l1.^5.*l2.^6.*l3.^6 + 1.80019958495951e+19*l1.^5.*l2.^6.*l3.^5 - 3.37785003615176e+17*l1.^5.*l2.^6.*l3.^4 - 1.20510480295665e+17*l1.^5.*l2.^6.*l3.^3 + 1.39311173964534e+15*l1.^5.*l2.^6.*l3.^2 + 565161968946109.0*l1.^5.*l2.^6.*l3 + 2552490956703.23*l1.^5.*l2.^6 - 1.53381699495838e+21*l1.^5.*l2.^5.*l3.^8 + 7.01797642062551e+19*l1.^5.*l2.^5.*l3.^7 - 9.4354783657426e+18*l1.^5.*l2.^5.*l3.^6 - 3.77062329616941e+17*l1.^5.*l2.^5.*l3.^5 + 1.79008921074154e+16*l1.^5.*l2.^5.*l3.^4 + 880930489891462.0*l1.^5.*l2.^5.*l3.^3 + 429941301385715.0*l1.^5.*l2.^5.*l3.^2 - 6390262757976.52*l1.^5.*l2.^5.*l3 - 634267887669.848*l1.^5.*l2.^5 + 2.40819861861687e+21*l1.^5.*l2.^4.*l3.^9 - 3.92053621028771e+19*l1.^5.*l2.^4.*l3.^8 + 3.23587810412051e+19*l1.^5.*l2.^4.*l3.^7 + 5.89159890026467e+16*l1.^5.*l2.^4.*l3.^6 - 1.70683250353374e+17*l1.^5.*l2.^4.*l3.^5 + 979894324589670.0*l1.^5.*l2.^4.*l3.^4 + 1.23051160136091e+15*l1.^5.*l2.^4.*l3.^3 + 7957334086483.5*l1.^5.*l2.^4.*l3.^2 - 1176138127126.77*l1.^5.*l2.^4.*l3 - 37762886183.3966*l1.^5.*l2.^4 - 1.77375809785776e+21*l1.^5.*l2.^3.*l3.^10 + 7.04685698202726e+19*l1.^5.*l2.^3.*l3.^9 - 2.70036802540832e+19*l1.^5.*l2.^3.*l3.^8 - 6.84547681745042e+17*l1.^5.*l2.^3.*l3.^7 + 9.22137669578403e+16*l1.^5.*l2.^3.*l3.^6 + 2.84978993809792e+15*l1.^5.*l2.^3.*l3.^5 + 810692291885775.0*l1.^5.*l2.^3.*l3.^4 - 11639810530877.7*l1.^5.*l2.^3.*l3.^3 - 2982644044668.27*l1.^5.*l2.^3.*l3.^2 + 49465372101.2917*l1.^5.*l2.^3.*l3 + 1687611632.49097*l1.^5.*l2.^3 + 1.63207261432562e+21*l1.^5.*l2.^2.*l3.^11 - 1.24547421045051e+19*l1.^5.*l2.^2.*l3.^10 + 3.96446616419064e+19*l1.^5.*l2.^2.*l3.^9 + 1.16990321019542e+17*l1.^5.*l2.^2.*l3.^8 - 2.69213978366023e+17*l1.^5.*l2.^2.*l3.^7 - 211144107041395.0*l1.^5.*l2.^2.*l3.^6 + 1.6921654665364e+15*l1.^5.*l2.^2.*l3.^5 + 3398427118902.66*l1.^5.*l2.^2.*l3.^4 - 4557498226788.3*l1.^5.*l2.^2.*l3.^3 - 48182556434.7643*l1.^5.*l2.^2.*l3.^2 - 467782498.640614*l1.^5.*l2.^2.*l3 + 141060615.530766*l1.^5.*l2.^2 - 6.57198362003287e+20*l1.^5.*l2.*l3.^12 + 1.29240512272836e+19*l1.^5.*l2.*l3.^11 - 1.96154087360816e+19*l1.^5.*l2.*l3.^10 - 2.48008258468286e+17*l1.^5.*l2.*l3.^9 + 1.27956299698395e+17*l1.^5.*l2.*l3.^8 + 1.84115960565281e+15*l1.^5.*l2.*l3.^7 + 163498243263647.0*l1.^5.*l2.*l3.^6 - 12021554753605.9*l1.^5.*l2.*l3.^5 - 2493736001248.76*l1.^5.*l2.*l3.^4 + 70734455852.3138*l1.^5.*l2.*l3.^3 + 3832933555.00853*l1.^5.*l2.*l3.^2 - 216371826.044244*l1.^5.*l2.*l3 - 3173474.87066834*l1.^5.*l2 + 3.14442254811672e+20*l1.^5.*l3.^13 + 8.1046075433664e+18*l1.^5.*l3.^12 + 1.33122052128129e+19*l1.^5.*l3.^11 - 8.58022538252836e+16*l1.^5.*l3.^10 - 1.36010137961215e+17*l1.^5.*l3.^9 + 368926404181075.0*l1.^5.*l3.^8 + 1.11632761630427e+15*l1.^5.*l3.^7 - 830688981705.857*l1.^5.*l3.^6 - 4505107601618.93*l1.^5.*l3.^5 - 14543922619.253*l1.^5.*l3.^4 + 13634038433.5181*l1.^5.*l3.^3 + 207737419.743336*l1.^5.*l3.^2 - 26284641.0336298*l1.^5.*l3 - 656274.840023902*l1.^5 + 3.42489429236059e+19*l1.^4.*l2.^14 - 1.78731385994021e+20*l1.^4.*l2.^13.*l3 + 1.68469941510215e+17*l1.^4.*l2.^13 + 4.19553921981763e+20*l1.^4.*l2.^12.*l3.^2 + 4.99393040905279e+17*l1.^4.*l2.^12.*l3 + 1.43591012760727e+18*l1.^4.*l2.^12 - 7.95023847424999e+20*l1.^4.*l2.^11.*l3.^3 - 1.08302105256567e+19*l1.^4.*l2.^11.*l3.^2 - 5.90245848168715e+18*l1.^4.*l2.^11.*l3 + 5.56428785025e+15*l1.^4.*l2.^11 + 9.14333066930908e+20*l1.^4.*l2.^10.*l3.^4 + 2.04209636244882e+19*l1.^4.*l2.^10.*l3.^3 + 9.88291224124519e+18*l1.^4.*l2.^10.*l3.^2 - 1.93113519508677e+16*l1.^4.*l2.^10.*l3 - 1.57843115768757e+16*l1.^4.*l2.^10 - 9.45299446656119e+20*l1.^4.*l2.^9.*l3.^5 - 4.64495695878163e+19*l1.^4.*l2.^9.*l3.^4 - 1.45604856105133e+19*l1.^4.*l2.^9.*l3.^3 + 1.72305888472027e+17*l1.^4.*l2.^9.*l3.^2 + 5.71284872227044e+16*l1.^4.*l2.^9.*l3 - 134054126247125.0*l1.^4.*l2.^9 + 3.24054709471956e+20*l1.^4.*l2.^8.*l3.^6 + 4.80861347339155e+19*l1.^4.*l2.^8.*l3.^5 + 9.97403787813099e+18*l1.^4.*l2.^8.*l3.^4 - 1.97088010830284e+17*l1.^4.*l2.^8.*l3.^3 - 6.91134246812742e+16*l1.^4.*l2.^8.*l3.^2 + 136770641580767.0*l1.^4.*l2.^8.*l3 + 63766966484790.2*l1.^4.*l2.^8 + 2.14163997022289e+20*l1.^4.*l2.^7.*l3.^7 - 7.39342371884828e+19*l1.^4.*l2.^7.*l3.^6 - 7.37315391777758e+18*l1.^4.*l2.^7.*l3.^5 + 4.76938958592858e+17*l1.^4.*l2.^7.*l3.^4 + 9.51575601395977e+16*l1.^4.*l2.^7.*l3.^3 - 1.21428235413805e+15*l1.^4.*l2.^7.*l3.^2 - 384184647332557.0*l1.^4.*l2.^7.*l3 - 1590224454441.66*l1.^4.*l2.^7 - 1.23374302514609e+21*l1.^4.*l2.^6.*l3.^8 + 6.1371192978721e+19*l1.^4.*l2.^6.*l3.^7 - 6.77496697460563e+18*l1.^4.*l2.^6.*l3.^6 - 3.37785003615177e+17*l1.^4.*l2.^6.*l3.^5 - 1.48704129916276e+16*l1.^4.*l2.^6.*l3.^4 + 610330129852001.0*l1.^4.*l2.^6.*l3.^3 - 48666970951049.9*l1.^4.*l2.^6.*l3.^2 + 5877505725081.26*l1.^4.*l2.^6.*l3 + 559235068244.745*l1.^4.*l2.^6 + 1.61541075197846e+21*l1.^4.*l2.^5.*l3.^9 - 7.99269536793461e+19*l1.^4.*l2.^5.*l3.^8 + 1.31714384720776e+19*l1.^4.*l2.^5.*l3.^7 + 6.5593134422947e+17*l1.^4.*l2.^5.*l3.^6 - 3.36818303725905e+15*l1.^4.*l2.^5.*l3.^5 - 2.48383988984761e+15*l1.^4.*l2.^5.*l3.^4 - 640596005375469.0*l1.^4.*l2.^5.*l3.^3 - 9612500235620.01*l1.^4.*l2.^5.*l3.^2 + 73689456808.3148*l1.^4.*l2.^5.*l3 + 38664064189.132*l1.^4.*l2.^5 - 1.97987562019239e+21*l1.^4.*l2.^4.*l3.^10 + 4.78935976579039e+19*l1.^4.*l2.^4.*l3.^9 - 2.87673326933157e+19*l1.^4.*l2.^4.*l3.^8 - 3.73134597016765e+17*l1.^4.*l2.^4.*l3.^7 + 1.46131632630627e+17*l1.^4.*l2.^4.*l3.^6 + 979894324589670.0*l1.^4.*l2.^4.*l3.^5 - 723074380709585.0*l1.^4.*l2.^4.*l3.^4 + 8592068563327.39*l1.^4.*l2.^4.*l3.^3 + 2539464799850.23*l1.^4.*l2.^4.*l3.^2 - 64997062783.7706*l1.^4.*l2.^4.*l3 - 4270997996.86942*l1.^4.*l2.^4 + 1.50195169747444e+21*l1.^4.*l2.^3.*l3.^11 - 4.00236446759267e+19*l1.^4.*l2.^3.*l3.^10 + 2.81657518848702e+19*l1.^4.*l2.^3.*l3.^9 + 5.10605238022942e+17*l1.^4.*l2.^3.*l3.^8 - 1.52088294172706e+17*l1.^4.*l2.^3.*l3.^7 - 2.85340408458528e+15*l1.^4.*l2.^3.*l3.^6 - 227564514771925.0*l1.^4.*l2.^3.*l3.^5 + 3501204409637.16*l1.^4.*l2.^3.*l3.^4 + 1749520295732.65*l1.^4.*l2.^3.*l3.^3 + 73979979488.6279*l1.^4.*l2.^3.*l3.^2 + 6877834822.8286*l1.^4.*l2.^3.*l3 - 265214850.329136*l1.^4.*l2.^3 - 1.05305129905122e+21*l1.^4.*l2.^2.*l3.^12 + 4.44038631551923e+18*l1.^4.*l2.^2.*l3.^11 - 2.83359599723695e+19*l1.^4.*l2.^2.*l3.^10 - 9.58553789328781e+16*l1.^4.*l2.^2.*l3.^9 + 2.25777423909418e+17*l1.^4.*l2.^2.*l3.^8 + 582692539066250.0*l1.^4.*l2.^2.*l3.^7 - 1.29732316852693e+15*l1.^4.*l2.^2.*l3.^6 - 870783419300.084*l1.^4.*l2.^2.*l3.^5 + 4340197477796.28*l1.^4.*l2.^2.*l3.^4 - 26721050333.763*l1.^4.*l2.^2.*l3.^3 - 8262855628.64587*l1.^4.*l2.^2.*l3.^2 + 265332107.698654*l1.^4.*l2.^2.*l3 + 13158967.4246181*l1.^4.*l2.^2 + 4.14159386919363e+20*l1.^4.*l2.*l3.^13 - 1.20335672507296e+18*l1.^4.*l2.*l3.^12 + 1.4119635550336e+19*l1.^4.*l2.*l3.^11 + 8.50541142823928e+16*l1.^4.*l2.*l3.^10 - 1.22007095065473e+17*l1.^4.*l2.*l3.^9 - 1.00912639176691e+15*l1.^4.*l2.*l3.^8 + 262352110069670.0*l1.^4.*l2.*l3.^7 + 8896447462810.37*l1.^4.*l2.*l3.^6 + 667979642935.547*l1.^4.*l2.*l3.^5 - 67258025396.0249*l1.^4.*l2.*l3.^4 - 515372611.279489*l1.^4.*l2.*l3.^3 + 163925802.586875*l1.^4.*l2.*l3.^2 - 12225910.3562607*l1.^4.*l2.*l3 - 266302.479054925*l1.^4.*l2 - 1.44293197226472e+20*l1.^4.*l3.^14 - 5.0601150289318e+18*l1.^4.*l3.^13 - 6.68657896327377e+18*l1.^4.*l3.^12 + 6.62571082672626e+16*l1.^4.*l3.^11 + 7.99427883070284e+16*l1.^4.*l3.^10 - 394485270189778.0*l1.^4.*l3.^9 - 728459698853858.0*l1.^4.*l3.^8 + 2446890114025.48*l1.^4.*l3.^7 + 3631897742837.9*l1.^4.*l3.^6 - 9925786219.75479*l1.^4.*l3.^5 - 17046489976.9234*l1.^4.*l3.^4 - 79671052.7073939*l1.^4.*l3.^3 + 75801231.5206411*l1.^4.*l3.^2 + 1193002.12753089*l1.^4.*l3 - 174304.969190237*l1.^4 - 1.5063557773862e+19*l1.^3.*l2.^15 + 8.69061582107638e+19*l1.^3.*l2.^14.*l3 - 3.07715505411514e+17*l1.^3.*l2.^14 - 2.48874740945517e+20*l1.^3.*l2.^13.*l3.^2 + 6.01678362536481e+17*l1.^3.*l2.^13.*l3 - 6.74421831421232e+17*l1.^3.*l2.^13 + 5.25148988861926e+20*l1.^3.*l2.^12.*l3.^3 + 2.74365333316635e+18*l1.^3.*l2.^12.*l3.^2 + 3.0341302167617e+18*l1.^3.*l2.^12.*l3 + 1.54303780721219e+15*l1.^3.*l2.^12 - 7.95023847424998e+20*l1.^3.*l2.^11.*l3.^4 - 8.76043695853116e+18*l1.^3.*l2.^11.*l3.^3 - 6.39487674024328e+18*l1.^3.*l2.^11.*l3.^2 + 1.49627908578151e+15*l1.^3.*l2.^11.*l3 + 8.93416379913129e+15*l1.^3.*l2.^11 + 1.04481396228959e+21*l1.^3.*l2.^10.*l3.^5 + 2.04209636244882e+19*l1.^3.*l2.^10.*l3.^4 + 1.01247778483681e+19*l1.^3.*l2.^10.*l3.^3 - 6.56492448886638e+16*l1.^3.*l2.^10.*l3.^2 - 3.48677700849008e+16*l1.^3.*l2.^10.*l3 + 40617809706067.2*l1.^3.*l2.^10 - 1.13386030292494e+21*l1.^3.*l2.^9.*l3.^6 - 2.04329971917389e+19*l1.^3.*l2.^9.*l3.^5 - 1.05706586208749e+19*l1.^3.*l2.^9.*l3.^4 + 1.0848023371916e+17*l1.^3.*l2.^9.*l3.^3 + 5.98326652245744e+16*l1.^3.*l2.^9.*l3.^2 - 74763226356326.1*l1.^3.*l2.^9.*l3 - 53855462661133.5*l1.^3.*l2.^9 + 1.28725845858113e+21*l1.^3.*l2.^8.*l3.^7 + 1.53427982446803e+19*l1.^3.*l2.^8.*l3.^6 + 1.07851712006297e+19*l1.^3.*l2.^8.*l3.^5 - 1.97088010830283e+17*l1.^3.*l2.^8.*l3.^4 - 8.60566148308147e+16*l1.^3.*l2.^8.*l3.^3 + 580566570544268.0*l1.^3.*l2.^8.*l3.^2 + 232541438880557.0*l1.^3.*l2.^8.*l3 + 436521130427.345*l1.^3.*l2.^8 - 1.38571067029246e+21*l1.^3.*l2.^7.*l3.^8 + 1.03557441597707e+19*l1.^3.*l2.^7.*l3.^7 - 9.40494115888989e+18*l1.^3.*l2.^7.*l3.^6 + 5.38660470881345e+16*l1.^3.*l2.^7.*l3.^5 + 7.63863823955901e+16*l1.^3.*l2.^7.*l3.^4 - 341572275864921.0*l1.^3.*l2.^7.*l3.^3 - 174867623986424.0*l1.^3.*l2.^7.*l3.^2 - 3921348938793.65*l1.^3.*l2.^7.*l3 - 429117554118.618*l1.^3.*l2.^7 + 1.60821529586853e+21*l1.^3.*l2.^6.*l3.^9 - 2.41513694722143e+19*l1.^3.*l2.^6.*l3.^8 + 1.33025357426657e+19*l1.^3.*l2.^6.*l3.^7 + 2.74941282012353e+16*l1.^3.*l2.^6.*l3.^6 - 9.42308314540547e+16*l1.^3.*l2.^6.*l3.^5 + 610330129851998.0*l1.^3.*l2.^6.*l3.^4 + 496731979851054.0*l1.^3.*l2.^6.*l3.^3 + 10718203176599.0*l1.^3.*l2.^6.*l3.^2 + 614526865190.127*l1.^3.*l2.^6.*l3 - 22853361099.1834*l1.^3.*l2.^6 - 1.58656104587735e+21*l1.^3.*l2.^5.*l3.^10 + 3.67986486527312e+19*l1.^3.*l2.^5.*l3.^9 - 1.68001553479059e+19*l1.^3.*l2.^5.*l3.^8 - 2.85041165841378e+17*l1.^3.*l2.^5.*l3.^7 + 9.74550984676623e+16*l1.^3.*l2.^5.*l3.^6 + 880930489891461.0*l1.^3.*l2.^5.*l3.^5 - 130350641257638.0*l1.^3.*l2.^5.*l3.^4 - 15509206113915.4*l1.^3.*l2.^5.*l3.^3 - 1758427789367.83*l1.^3.*l2.^5.*l3.^2 + 69759515945.7531*l1.^3.*l2.^5.*l3 + 6191926689.09258*l1.^3.*l2.^5 + 1.42728392693868e+21*l1.^3.*l2.^4.*l3.^11 - 2.28276770746341e+19*l1.^3.*l2.^4.*l3.^10 + 2.22856736078574e+19*l1.^3.*l2.^4.*l3.^9 + 2.25143243688687e+17*l1.^3.*l2.^4.*l3.^8 - 1.53806526830009e+17*l1.^3.*l2.^4.*l3.^7 - 726549742386952.0*l1.^3.*l2.^4.*l3.^6 + 726907231413613.0*l1.^3.*l2.^4.*l3.^5 + 13572814191230.6*l1.^3.*l2.^4.*l3.^4 - 770043048753.046*l1.^3.*l2.^4.*l3.^3 - 141661334054.607*l1.^3.*l2.^4.*l3.^2 - 11923697113.4005*l1.^3.*l2.^4.*l3 + 292791651.687716*l1.^3.*l2.^4 - 9.69592853362292e+20*l1.^3.*l2.^3.*l3.^12 + 1.22742385957442e+19*l1.^3.*l2.^3.*l3.^11 - 2.03264574079547e+19*l1.^3.*l2.^3.*l3.^10 - 2.18830816295546e+17*l1.^3.*l2.^3.*l3.^9 + 1.54254290595564e+17*l1.^3.*l2.^3.*l3.^8 + 1.56825611304786e+15*l1.^3.*l2.^3.*l3.^7 - 348358169781036.0*l1.^3.*l2.^3.*l3.^6 - 13916722817919.2*l1.^3.*l2.^3.*l3.^5 - 763280046647.537*l1.^3.*l2.^3.*l3.^4 + 129718320199.238*l1.^3.*l2.^3.*l3.^3 + 8242753526.51793*l1.^3.*l2.^3.*l3.^2 - 554691316.387737*l1.^3.*l2.^3.*l3 - 30607225.3133669*l1.^3.*l2.^3 + 5.48866429956099e+20*l1.^3.*l2.^2.*l3.^13 + 2.14197497062987e+18*l1.^3.*l2.^2.*l3.^12 + 1.58571431908151e+19*l1.^3.*l2.^2.*l3.^11 + 1.58044478435672e+16*l1.^3.*l2.^2.*l3.^10 - 1.51989469950011e+17*l1.^3.*l2.^2.*l3.^9 - 304899318860752.0*l1.^3.*l2.^2.*l3.^8 + 894987750105847.0*l1.^3.*l2.^2.*l3.^7 + 4582060093515.51*l1.^3.*l2.^2.*l3.^6 - 3103696279354.33*l1.^3.*l2.^2.*l3.^5 - 67129743829.3722*l1.^3.*l2.^2.*l3.^4 + 4147648771.41937*l1.^3.*l2.^2.*l3.^3 + 617967656.884271*l1.^3.*l2.^2.*l3.^2 + 45841994.1082023*l1.^3.*l2.^2.*l3 + 998428.179986113*l1.^3.*l2.^2 - 1.97932639584095e+20*l1.^3.*l2.*l3.^14 - 2.50298198815176e+18*l1.^3.*l2.*l3.^13 - 7.3475320330573e+18*l1.^3.*l2.*l3.^12 + 3.36662794300841e+15*l1.^3.*l2.*l3.^11 + 7.93746677371195e+16*l1.^3.*l2.*l3.^10 + 260903581391982.0*l1.^3.*l2.*l3.^9 - 358874082913893.0*l1.^3.*l2.*l3.^8 - 4741308423115.14*l1.^3.*l2.*l3.^7 + 670405135663.373*l1.^3.*l2.*l3.^6 + 73043524052.0629*l1.^3.*l2.*l3.^5 - 2712974941.21667*l1.^3.*l2.*l3.^4 - 692713900.071887*l1.^3.*l2.*l3.^3 - 15030793.2457005*l1.^3.*l2.*l3.^2 + 1907814.04499411*l1.^3.*l2.*l3 + 207231.183399743*l1.^3.*l2 + 5.27349412587774e+19*l1.^3.*l3.^15 + 2.38780355875192e+18*l1.^3.*l3.^14 + 2.60356449133687e+18*l1.^3.*l3.^13 - 3.71264248159538e+16*l1.^3.*l3.^12 - 3.61175597734263e+16*l1.^3.*l3.^11 + 277899518631595.0*l1.^3.*l3.^10 + 361857390598533.0*l1.^3.*l3.^9 - 2399454441378.78*l1.^3.*l3.^8 - 2151148702542.41*l1.^3.*l3.^7 + 20993278382.7188*l1.^3.*l3.^6 + 14109375696.013*l1.^3.*l3.^5 - 52808455.3267901*l1.^3.*l3.^4 - 96169805.209277*l1.^3.*l3.^3 - 50292.418645048*l1.^3.*l3.^2 + 501779.843664946*l1.^3.*l3 + 1768.67254556143*l1.^3 + 4.88997743188684e+18*l1.^2.*l2.^16 - 3.18799904842467e+19*l1.^2.*l2.^15.*l3 + 1.75346265653489e+17*l1.^2.*l2.^15 + 1.06729366503797e+20*l1.^2.*l2.^14.*l3.^2 - 6.03397443572299e+17*l1.^2.*l2.^14.*l3 + 2.24608064443901e+17*l1.^2.*l2.^14 - 2.48874740945517e+20*l1.^2.*l2.^13.*l3.^3 + 1.44402807008755e+17*l1.^2.*l2.^13.*l3.^2 - 1.13527502438012e+18*l1.^2.*l2.^13.*l3 - 2.10414246438025e+15*l1.^2.*l2.^13 + 4.19553921981763e+20*l1.^2.*l2.^12.*l3.^4 + 2.74365333316635e+18*l1.^2.*l2.^12.*l3.^3 + 2.84321098659082e+18*l1.^2.*l2.^12.*l3.^2 + 4.53559597877521e+15*l1.^2.*l2.^12.*l3 - 3.52641138772522e+15*l1.^2.*l2.^12 - 5.44355385002108e+20*l1.^2.*l2.^11.*l3.^5 - 1.08302105256567e+19*l1.^2.*l2.^11.*l3.^4 - 4.94180712821364e+18*l1.^2.*l2.^11.*l3.^3 + 1.62720350578739e+16*l1.^2.*l2.^11.*l3.^2 + 1.5496650111384e+16*l1.^2.*l2.^11.*l3 - 2669271588709.23*l1.^2.*l2.^11 + 4.99685137751365e+20*l1.^2.*l2.^10.*l3.^6 + 2.16965217530655e+19*l1.^2.*l2.^10.*l3.^5 + 5.88697080816367e+18*l1.^2.*l2.^10.*l3.^4 - 6.56492448886639e+16*l1.^2.*l2.^10.*l3.^3 - 3.28496454886624e+16*l1.^2.*l2.^10.*l3.^2 + 24082498979549.6*l1.^2.*l2.^10.*l3 + 27291227299289.8*l1.^2.*l2.^10 - 2.6069584741182e+20*l1.^2.*l2.^9.*l3.^7 - 3.44400694715882e+19*l1.^2.*l2.^9.*l3.^6 - 5.20180525917302e+18*l1.^2.*l2.^9.*l3.^5 + 1.72305888472027e+17*l1.^2.*l2.^9.*l3.^4 + 4.90351866108632e+16*l1.^2.*l2.^9.*l3.^3 - 283934907046774.0*l1.^2.*l2.^9.*l3.^2 - 109852539759509.0*l1.^2.*l2.^9.*l3 + 224001787498.293*l1.^2.*l2.^9 - 1.54898457917441e+20*l1.^2.*l2.^8.*l3.^8 + 4.14487628546203e+19*l1.^2.*l2.^8.*l3.^7 + 2.117880279503e+18*l1.^2.*l2.^8.*l3.^6 - 2.63017808047532e+17*l1.^2.*l2.^8.*l3.^5 - 4.48190978004241e+16*l1.^2.*l2.^8.*l3.^4 + 580566570544267.0*l1.^2.*l2.^8.*l3.^3 + 148816532162793.0*l1.^2.*l2.^8.*l3.^2 + 987678469750.876*l1.^2.*l2.^8.*l3 + 258101386095.605*l1.^2.*l2.^8 + 5.67226509278647e+20*l1.^2.*l2.^7.*l3.^9 - 4.36921636063634e+19*l1.^2.*l2.^7.*l3.^8 + 1.95172672574023e+18*l1.^2.*l2.^7.*l3.^7 + 3.58545875930395e+17*l1.^2.*l2.^7.*l3.^6 + 2.42596839044738e+16*l1.^2.*l2.^7.*l3.^5 - 1.21428235413806e+15*l1.^2.*l2.^7.*l3.^4 - 233391141103625.0*l1.^2.*l2.^7.*l3.^3 - 5136605695170.93*l1.^2.*l2.^7.*l3.^2 - 752828365611.664*l1.^2.*l2.^7.*l3 + 3694509119.59855*l1.^2.*l2.^7 - 8.55817017771676e+20*l1.^2.*l2.^6.*l3.^10 + 3.5559191225906e+19*l1.^2.*l2.^6.*l3.^9 - 6.9856482741782e+18*l1.^2.*l2.^6.*l3.^8 - 3.47323782787034e+17*l1.^2.*l2.^6.*l3.^7 + 2.03603531047472e+16*l1.^2.*l2.^6.*l3.^6 + 1.39311173964534e+15*l1.^2.*l2.^6.*l3.^5 + 50903043645249.9*l1.^2.*l2.^6.*l3.^4 + 9010518961317.87*l1.^2.*l2.^6.*l3.^3 + 1594085068263.01*l1.^2.*l2.^6.*l3.^2 - 35707174077.7866*l1.^2.*l2.^6.*l3 - 5577327091.4661*l1.^2.*l2.^6 + 8.84936193498399e+20*l1.^2.*l2.^5.*l3.^11 - 2.40430673669578e+19*l1.^2.*l2.^5.*l3.^10 + 1.04850214678596e+19*l1.^2.*l2.^5.*l3.^9 + 3.07625628292393e+17*l1.^2.*l2.^5.*l3.^8 - 6.08429818838026e+16*l1.^2.*l2.^5.*l3.^7 - 1.70601887327222e+15*l1.^2.*l2.^5.*l3.^6 + 6017749614737.17*l1.^2.*l2.^5.*l3.^5 - 8331737074159.17*l1.^2.*l2.^5.*l3.^4 - 1192506969895.08*l1.^2.*l2.^5.*l3.^3 + 106755919768.4*l1.^2.*l2.^5.*l3.^2 + 14007686234.0435*l1.^2.*l2.^5.*l3 - 132074437.121302*l1.^2.*l2.^5 - 7.20349905829104e+20*l1.^2.*l2.^4.*l3.^12 + 9.35008175381691e+18*l1.^2.*l2.^4.*l3.^11 - 1.20390309860777e+19*l1.^2.*l2.^4.*l3.^10 - 1.6622725468604e+17*l1.^2.*l2.^4.*l3.^9 + 9.66673454517468e+16*l1.^2.*l2.^4.*l3.^8 + 1.15564105574009e+15*l1.^2.*l2.^4.*l3.^7 - 362947421819374.0*l1.^2.*l2.^4.*l3.^6 + 4968886709741.54*l1.^2.*l2.^4.*l3.^5 + 1880169363004.06*l1.^2.*l2.^4.*l3.^4 - 112797981557.743*l1.^2.*l2.^4.*l3.^3 - 15642262772.3414*l1.^2.*l2.^4.*l3.^2 + 447422142.800033*l1.^2.*l2.^4.*l3 + 46415783.9236457*l1.^2.*l2.^4 + 4.44916979110224e+20*l1.^2.*l2.^3.*l3.^13 - 9.3861824555691e+17*l1.^2.*l2.^3.*l3.^12 + 9.96249974018226e+18*l1.^2.*l2.^3.*l3.^11 + 6.78001460744748e+16*l1.^2.*l2.^3.*l3.^10 - 9.49737455788177e+16*l1.^2.*l2.^3.*l3.^9 - 799718492351792.0*l1.^2.*l2.^3.*l3.^8 + 357254217425989.0*l1.^2.*l2.^3.*l3.^7 + 587298804197.215*l1.^2.*l2.^3.*l3.^6 - 962921277761.552*l1.^2.*l2.^3.*l3.^5 + 62434638489.8822*l1.^2.*l2.^3.*l3.^4 + 10997861349.7113*l1.^2.*l2.^3.*l3.^3 - 727080969.101676*l1.^2.*l2.^3.*l3.^2 - 99008112.5988915*l1.^2.*l2.^3.*l3 - 774997.926661392*l1.^2.*l2.^3 - 2.14397615727157e+20*l1.^2.*l2.^2.*l3.^14 - 3.03245894718386e+18*l1.^2.*l2.^2.*l3.^13 - 6.44446795162982e+18*l1.^2.*l2.^2.*l3.^12 + 1.87970060151303e+16*l1.^2.*l2.^2.*l3.^11 + 7.41253817120345e+16*l1.^2.*l2.^2.*l3.^10 + 54625580078674.7*l1.^2.*l2.^2.*l3.^9 - 469288617766510.0*l1.^2.*l2.^2.*l3.^8 + 362544069514.035*l1.^2.*l2.^2.*l3.^7 + 2002863286739.03*l1.^2.*l2.^2.*l3.^6 - 27400942637.0225*l1.^2.*l2.^2.*l3.^5 - 10597812469.8469*l1.^2.*l2.^2.*l3.^4 + 456792072.600648*l1.^2.*l2.^2.*l3.^3 + 71628188.8236778*l1.^2.*l2.^2.*l3.^2 - 2436296.67370682*l1.^2.*l2.^2.*l3 - 123602.398589065*l1.^2.*l2.^2 + 6.90209566581104e+19*l1.^2.*l2.*l3.^15 + 1.90817994975855e+18*l1.^2.*l2.*l3.^14 + 2.67668206805471e+18*l1.^2.*l2.*l3.^13 - 2.01997676580504e+16*l1.^2.*l2.*l3.^12 - 3.50945996254184e+16*l1.^2.*l2.*l3.^11 + 50125613373814.8*l1.^2.*l2.*l3.^10 + 224224781801995.0*l1.^2.*l2.*l3.^9 + 423532791488.37*l1.^2.*l2.*l3.^8 - 872427948608.341*l1.^2.*l2.*l3.^7 - 13508048968.5322*l1.^2.*l2.*l3.^6 + 6085477689.45127*l1.^2.*l2.*l3.^5 + 163925802.586875*l1.^2.*l2.*l3.^4 - 39207130.8882439*l1.^2.*l2.*l3.^3 - 2918609.21317163*l1.^2.*l2.*l3.^2 - 386384.249787706*l1.^2.*l2.*l3 - 1784.32451499118*l1.^2.*l2 - 1.45432786330216e+19*l1.^2.*l3.^16 - 8.20001654085432e+17*l1.^2.*l3.^15 - 7.42062178732242e+17*l1.^2.*l3.^14 + 1.47757559720924e+16*l1.^2.*l3.^13 + 1.18801149990525e+16*l1.^2.*l3.^12 - 132884843560036.0*l1.^2.*l3.^11 - 129991201197225.0*l1.^2.*l3.^10 + 1482741243801.73*l1.^2.*l3.^9 + 898710224121.573*l1.^2.*l3.^8 - 20428839489.4469*l1.^2.*l3.^7 - 7838114774.31136*l1.^2.*l3.^6 + 207737419.743336*l1.^2.*l3.^5 + 79536811.4688813*l1.^2.*l3.^4 - 1435395.09608243*l1.^2.*l3.^3 - 556086.380560454*l1.^2.*l3.^2 + 1017.37801293357*l1.^2.*l3 + 338.376014109347*l1.^2 - 1.07310327735902e+18*l1.*l2.^17 + 8.08746815850928e+18*l1.*l2.^16.*l3 - 5.62999039230564e+16*l1.*l2.^16 - 3.18799904842467e+19*l1.*l2.^15.*l3.^2 + 2.81929289874237e+17*l1.*l2.^15.*l3 - 4.77555967941239e+16*l1.*l2.^15 + 8.69061582107638e+19*l1.*l2.^14.*l3.^3 - 6.03397443572299e+17*l1.*l2.^14.*l3.^2 + 2.73352319214813e+17*l1.*l2.^14.*l3 + 935174428613445.0*l1.*l2.^14 - 1.78731385994021e+20*l1.*l2.^13.*l3.^4 + 6.01678362536481e+17*l1.*l2.^13.*l3.^3 - 7.90660202505082e+17*l1.*l2.^13.*l3.^2 - 3.74069771445378e+15*l1.*l2.^13.*l3 + 887676066772980.0*l1.*l2.^13 + 2.97545892179622e+20*l1.*l2.^12.*l3.^5 + 4.99393040905279e+17*l1.*l2.^12.*l3.^4 + 1.54079932196986e+18*l1.*l2.^12.*l3.^3 + 4.53559597877521e+15*l1.*l2.^12.*l3.^2 - 4.51318637103606e+15*l1.*l2.^12.*l3 - 3933041765664.56*l1.*l2.^12 - 4.16287374153702e+20*l1.*l2.^11.*l3.^6 - 2.38264631564446e+18*l1.*l2.^11.*l3.^5 - 2.14900060332646e+18*l1.*l2.^11.*l3.^4 + 1.49627908578151e+15*l1.*l2.^11.*l3.^3 + 1.16201056316289e+16*l1.*l2.^11.*l3.^2 + 11291255038964.9*l1.*l2.^11.*l3 - 8511229003556.33*l1.*l2.^11 + 5.15088985412317e+20*l1.*l2.^10.*l3.^7 + 3.87480865473494e+18*l1.*l2.^10.*l3.^6 + 2.34726453478493e+18*l1.*l2.^10.*l3.^5 - 1.93113519508676e+16*l1.*l2.^10.*l3.^4 - 2.06537736591318e+16*l1.*l2.^10.*l3.^3 + 24082498979549.6*l1.*l2.^10.*l3.^2 + 37412188697275.1*l1.*l2.^10.*l3 - 244331361489.735*l1.*l2.^10 - 5.81099713632707e+20*l1.*l2.^9.*l3.^8 - 2.89493246431838e+18*l1.*l2.^9.*l3.^7 - 2.14492182523317e+18*l1.*l2.^9.*l3.^6 + 2.99255817156302e+16*l1.*l2.^9.*l3.^5 + 2.69922354651375e+16*l1.*l2.^9.*l3.^4 - 74763226356326.2*l1.*l2.^9.*l3.^3 - 76370122527713.0*l1.*l2.^9.*l3.^2 + 251484359745.983*l1.*l2.^9.*l3 - 101278673369.125*l1.*l2.^9 + 6.15564570195812e+20*l1.*l2.^8.*l3.^9 + 5.80189849588754e+16*l1.*l2.^8.*l3.^8 + 2.12993660217546e+18*l1.*l2.^8.*l3.^7 - 2.38469479296429e+16*l1.*l2.^8.*l3.^6 - 3.04760238616368e+16*l1.*l2.^8.*l3.^5 + 136770641580768.0*l1.*l2.^8.*l3.^4 + 133042900638102.0*l1.*l2.^8.*l3.^3 + 1414599523571.15*l1.*l2.^8.*l3.^2 + 420341573889.307*l1.*l2.^8.*l3 + 3755442863.75859*l1.*l2.^8 - 6.03946374063737e+20*l1.*l2.^7.*l3.^10 + 2.92587592296312e+18*l1.*l2.^7.*l3.^9 - 2.62534967903943e+18*l1.*l2.^7.*l3.^8 - 8.97767451468907e+15*l1.*l2.^7.*l3.^7 + 3.25219956418282e+16*l1.*l2.^7.*l3.^6 - 23527384976587.7*l1.*l2.^7.*l3.^5 - 157823239194915.0*l1.*l2.^7.*l3.^4 - 5059805082314.38*l1.*l2.^7.*l3.^3 - 914084873436.022*l1.*l2.^7.*l3.^2 + 4335916952.86218*l1.*l2.^7.*l3 + 2935912754.7783*l1.*l2.^7 + 5.38021820290143e+20*l1.*l2.^6.*l3.^11 - 3.15279461969116e+18*l1.*l2.^6.*l3.^10 + 3.61726865003955e+18*l1.*l2.^6.*l3.^9 + 3.10010323085357e+16*l1.*l2.^6.*l3.^8 - 3.84515107713215e+16*l1.*l2.^6.*l3.^7 - 117884954543837.0*l1.*l2.^6.*l3.^6 + 212222845526626.0*l1.*l2.^6.*l3.^5 + 8723646083883.1*l1.*l2.^6.*l3.^4 + 965135736783.083*l1.*l2.^6.*l3.^3 - 47252515076.5321*l1.*l2.^6.*l3.^2 - 9502195668.01013*l1.*l2.^6.*l3 - 15819085.1241333*l1.*l2.^6 - 4.15778261693094e+20*l1.*l2.^5.*l3.^12 + 1.2996252630788e+18*l1.*l2.^5.*l3.^11 - 4.28956029003474e+18*l1.*l2.^5.*l3.^10 - 3.32922096586386e+16*l1.*l2.^5.*l3.^9 + 4.42815225011059e+16*l1.*l2.^5.*l3.^8 + 278572741996889.0*l1.*l2.^5.*l3.^7 - 225123907829914.0*l1.*l2.^5.*l3.^6 - 9805631188538.73*l1.*l2.^5.*l3.^5 - 702472460821.05*l1.*l2.^5.*l3.^4 + 89386595643.6203*l1.*l2.^5.*l3.^3 + 13976572487.5862*l1.*l2.^5.*l3.^2 - 156698484.720189*l1.*l2.^5.*l3 - 36430291.3696959*l1.*l2.^5 + 2.71351798953846e+20*l1.*l2.^4.*l3.^13 + 1.1973399414476e+18*l1.*l2.^4.*l3.^12 + 4.14239887705173e+18*l1.*l2.^4.*l3.^11 + 6.07863378598739e+15*l1.*l2.^4.*l3.^10 - 4.62126609203732e+16*l1.*l2.^4.*l3.^9 - 175746731150416.0*l1.*l2.^4.*l3.^8 + 271308159415837.0*l1.*l2.^4.*l3.^7 + 7146409968380.42*l1.*l2.^4.*l3.^6 - 182439398753.918*l1.*l2.^4.*l3.^5 - 99633085780.0069*l1.*l2.^4.*l3.^4 - 11603214895.4989*l1.*l2.^4.*l3.^3 + 568303831.01275*l1.*l2.^4.*l3.^2 + 91798783.0786655*l1.*l2.^4.*l3 + 371834.111621583*l1.*l2.^4 - 1.42062799779999e+20*l1.*l2.^3.*l3.^14 - 2.04570643262403e+18*l1.*l2.^3.*l3.^13 - 3.03394267015841e+18*l1.*l2.^3.*l3.^12 + 1.30924420005882e+16*l1.*l2.^3.*l3.^11 + 3.75109943555685e+16*l1.*l2.^3.*l3.^10 + 46771307483578.4*l1.*l2.^3.*l3.^9 - 228082953041808.0*l1.*l2.^3.*l3.^8 - 3738382772870.67*l1.*l2.^3.*l3.^7 + 521935047310.807*l1.*l2.^3.*l3.^6 + 71401519998.908*l1.*l2.^3.*l3.^5 + 5000714710.793*l1.*l2.^3.*l3.^4 - 662141705.910152*l1.*l2.^3.*l3.^3 - 81148682.6216307*l1.*l2.^3.*l3.^2 + 1032231.28104262*l1.*l2.^3.*l3 + 64600.2708646329*l1.*l2.^3 + 5.77346754029511e+19*l1.*l2.^2.*l3.^15 + 1.65547503749323e+18*l1.*l2.^2.*l3.^14 + 1.68121439009269e+18*l1.*l2.^2.*l3.^13 - 2.02465263794811e+16*l1.*l2.^2.*l3.^12 - 2.36467189933819e+16*l1.*l2.^2.*l3.^11 + 100475634536061.0*l1.*l2.^2.*l3.^10 + 180665385870543.0*l1.*l2.^2.*l3.^9 + 474356726466.974*l1.*l2.^2.*l3.^8 - 819579670987.814*l1.*l2.^2.*l3.^7 - 24828897225.6354*l1.*l2.^2.*l3.^6 + 1753647889.3448*l1.*l2.^2.*l3.^5 + 386213795.911371*l1.*l2.^2.*l3.^4 + 36062329.7493262*l1.*l2.^2.*l3.^3 + 1199597.8545663*l1.*l2.^2.*l3.^2 + 56951.7643216409*l1.*l2.^2.*l3 + 532.166960611405*l1.*l2.^2 - 1.61381303512517e+19*l1.*l2.*l3.^16 - 7.04823224685592e+17*l1.*l2.*l3.^15 - 6.17390911463002e+17*l1.*l2.*l3.^14 + 1.0848023371916e+16*l1.*l2.*l3.^13 + 9.74826469964713e+15*l1.*l2.*l3.^12 - 75519126275252.6*l1.*l2.*l3.^11 - 80799836034088.8*l1.*l2.*l3.^10 + 267296250628.217*l1.*l2.*l3.^9 + 428411110959.563*l1.*l2.*l3.^8 + 6491047272.628*l1.*l2.*l3.^7 - 2853454999.64785*l1.*l2.*l3.^6 - 216371826.044244*l1.*l2.*l3.^5 + 5906342.87564684*l1.*l2.*l3.^4 + 2600365.3837128*l1.*l2.*l3.^3 + 314823.980664968*l1.*l2.*l3.^2 - 4382.55144032922*l1.*l2.*l3 - 509.640917107584*l1.*l2 + 2.73392656696369e+18*l1.*l3.^17 + 1.87809603163173e+17*l1.*l3.^16 + 1.38376140649056e+17*l1.*l3.^15 - 3.8809738787458e+15*l1.*l3.^14 - 2.55644402468979e+15*l1.*l3.^13 + 41208356517728.6*l1.*l3.^12 + 30667502245969.6*l1.*l3.^11 - 515957058430.944*l1.*l3.^10 - 241244999118.861*l1.*l3.^9 + 8193985069.94296*l1.*l3.^8 + 2548611754.36774*l1.*l3.^7 - 103410340.154459*l1.*l3.^6 - 31751599.3286667*l1.*l3.^5 + 933295.375511379*l1.*l3.^4 + 265956.837590088*l1.*l3.^3 + 78.2598471487353*l1.*l3.^2 - 174.301234567901*l1.*l3 - 1.07851851851852*l1 + 1.22417180883999e+17*l2.^18 - 1.07310327735902e+18*l2.^17.*l3 + 8.59540517909258e+15*l2.^17 + 4.88997743188684e+18*l2.^16.*l3.^2 - 5.62999039230564e+16*l2.^16.*l3 + 4.87005506469132e+15*l2.^16 - 1.5063557773862e+19*l2.^15.*l3.^3 + 1.75346265653489e+17*l2.^15.*l3.^2 - 3.13231192477919e+16*l2.^15.*l3 - 173675251028211.0*l2.^15 + 3.42489429236059e+19*l2.^14.*l3.^4 - 3.07715505411514e+17*l2.^14.*l3.^3 + 1.01364482846411e+17*l2.^14.*l3.^2 + 935174428613445.0*l2.^14.*l3 - 108496888712493.0*l2.^14 - 5.99261363986121e+19*l2.^13.*l3.^5 + 1.68469941510215e+17*l2.^13.*l3.^4 - 2.14156724591291e+17*l2.^13.*l3.^3 - 2.10414246438025e+15*l2.^13.*l3.^2 + 638839374391187.0*l2.^13.*l3 + 1133849878389.78*l2.^13 + 8.09910501475175e+19*l2.^12.*l3.^6 + 6.67862982415494e+17*l2.^12.*l3.^5 + 3.13381254107917e+17*l2.^12.*l3.^4 + 1.54303780721219e+15*l2.^12.*l3.^3 - 1.90897288724357e+15*l2.^12.*l3.^2 - 3933041765664.55*l2.^12.*l3 + 1307082200861.11*l2.^12 - 8.16872045020224e+19*l2.^11.*l3.^7 - 2.43078058464738e+18*l2.^11.*l3.^6 - 3.14895838726707e+17*l2.^11.*l3.^5 + 5.56428785025e+15*l2.^11.*l3.^4 + 3.75659129045642e+15*l2.^11.*l3.^3 - 2669271588709.24*l2.^11.*l3.^2 - 6591478250478.96*l2.^11.*l3 + 87341873444.7125*l2.^11 + 5.18074456144522e+19*l2.^10.*l3.^8 + 4.64839512085327e+18*l2.^10.*l3.^7 + 1.61627884319423e+17*l2.^10.*l3.^6 - 2.20233577938466e+16*l2.^10.*l3.^5 - 5.09948628446207e+15*l2.^10.*l3.^4 + 40617809706067.2*l2.^10.*l3.^3 + 16416360339719.6*l2.^10.*l3.^2 - 339202706783.129*l2.^10.*l3 + 20586406299.653*l2.^10 + 2.35364723070691e+18*l2.^9.*l3.^9 - 6.2763648617734e+18*l2.^9.*l3.^8 + 1.1782593587141e+17*l2.^9.*l3.^7 + 4.44207853591386e+16*l2.^9.*l3.^6 + 4.62178664090049e+15*l2.^9.*l3.^5 - 134054126247125.0*l2.^9.*l3.^4 - 28028823631994.0*l2.^9.*l3.^3 + 556051496025.175*l2.^9.*l3.^2 - 120235740759.037*l2.^9.*l3 - 2347552669.74491*l2.^9 - 5.94735919891829e+19*l2.^8.*l3.^10 + 6.30172130705173e+18*l2.^8.*l3.^9 - 4.49228874098923e+17*l2.^8.*l3.^8 - 6.05191451659844e+16*l2.^8.*l3.^7 - 1.57074631680427e+15*l2.^8.*l3.^6 + 254336700846307.0*l2.^8.*l3.^5 + 29345771413672.5*l2.^8.*l3.^4 - 275013959273.116*l2.^8.*l3.^3 + 351105083349.374*l2.^8.*l3.^2 + 6064511063.50768*l2.^8.*l3 - 760040241.071163*l2.^8 + 9.53176070260235e+19*l2.^7.*l3.^11 - 4.68621490364128e+18*l2.^7.*l3.^10 + 7.35596722411776e+17*l2.^7.*l3.^9 + 6.01784744812752e+16*l2.^7.*l3.^8 - 3.17529027518843e+15*l2.^7.*l3.^7 - 340651022838729.0*l2.^7.*l3.^6 - 16370429551961.0*l2.^7.*l3.^5 - 736382346801.11*l2.^7.*l3.^4 - 636203400852.488*l2.^7.*l3.^3 - 2078161379.77418*l2.^7.*l3.^2 + 3376649830.51008*l2.^7.*l3 + 34836098.5078624*l2.^7 - 9.91535086159477e+19*l2.^6.*l3.^12 + 2.31044491214009e+18*l2.^6.*l3.^11 - 9.04668631069648e+17*l2.^6.*l3.^10 - 4.20360905661744e+16*l2.^6.*l3.^9 + 7.84929422680759e+15*l2.^6.*l3.^8 + 317371667523040.0*l2.^6.*l3.^7 - 14068014349435.6*l2.^6.*l3.^6 + 1983262884942.87*l2.^6.*l3.^5 + 849376870129.105*l2.^6.*l3.^4 - 13617088300.187*l2.^6.*l3.^3 - 7209448847.79601*l2.^6.*l3.^2 - 42681682.5047371*l2.^6.*l3 + 13070163.416794*l2.^6 + 7.75486271057916e+19*l2.^5.*l3.^13 - 3.85074152023348e+17*l2.^5.*l3.^12 + 8.94354350266748e+17*l2.^5.*l3.^11 + 1.80488664722395e+16*l2.^5.*l3.^10 - 1.03041594753966e+16*l2.^5.*l3.^9 - 204022112492761.0*l2.^5.*l3.^8 + 41741660037001.8*l2.^5.*l3.^7 - 2601056050127.24*l2.^5.*l3.^6 - 834902560404.371*l2.^5.*l3.^5 + 32891393689.7593*l2.^5.*l3.^4 + 9556083441.84019*l2.^5.*l3.^3 - 91780541.0503962*l2.^5.*l3.^2 - 43051501.8959307*l2.^5.*l3 - 159121.914729414*l2.^5 - 4.73332066262277e+19*l2.^4.*l3.^14 - 5.35493742657468e+17*l2.^4.*l3.^13 - 7.17847552365456e+17*l2.^4.*l3.^12 + 0.875789473684211*l2.^4.*l3.^11 + 9.81515654400127e+15*l2.^4.*l3.^10 + 62716071398434.7*l2.^4.*l3.^9 - 58039218257552.4*l2.^4.*l3.^8 + 2355407031063.98*l2.^4.*l3.^7 + 682917122036.772*l2.^4.*l3.^6 - 38917420283.2711*l2.^4.*l3.^5 - 8623470985.73083*l2.^4.*l3.^4 + 252497755.61681*l2.^4.*l3.^3 + 61525994.9502354*l2.^4.*l3.^2 - 61010.4750775989*l2.^4.*l3 - 32195.7889694515*l2.^4 + 2.23589262858673e+19*l2.^3.*l3.^15 + 5.98240200464844e+17*l2.^3.*l3.^14 + 4.51019233102509e+17*l2.^3.*l3.^13 - 6.31242739314076e+15*l2.^3.*l3.^12 - 6.96759908934595e+15*l2.^3.*l3.^11 + 19204582315226.9*l2.^3.*l3.^10 + 50001644811278.6*l2.^3.*l3.^9 - 1533753415576.55*l2.^3.*l3.^8 - 437592595642.974*l2.^3.*l3.^7 + 28568304893.5624*l2.^3.*l3.^6 + 5527105647.73348*l2.^3.*l3.^5 - 278646149.019437*l2.^3.*l3.^4 - 54783562.9559103*l2.^3.*l3.^3 + 90691.2467369713*l2.^3.*l3.^2 + 66687.2001219326*l2.^3.*l3 + 375.647266313933*l2.^3 - 7.94325636050451e+18*l2.^2.*l3.^16 - 3.42097126127885e+17*l2.^2.*l3.^15 - 2.14217656137318e+17*l2.^2.*l3.^14 + 5.28373552166597e+15*l2.^2.*l3.^13 + 3.69072100415127e+15*l2.^2.*l3.^12 - 39129631740680.6*l2.^2.*l3.^11 - 32516376655904.3*l2.^2.*l3.^10 + 825983061800.43*l2.^2.*l3.^9 + 253903602859.021*l2.^2.*l3.^8 - 15169295256.685*l2.^2.*l3.^7 - 2854322459.20013*l2.^2.*l3.^6 + 181354511.601671*l2.^2.*l3.^5 + 30273380.0526512*l2.^2.*l3.^4 - 1079225.83616996*l2.^2.*l3.^3 - 120472.004703116*l2.^2.*l3.^2 + 2410.40329218107*l2.^2.*l3 + 296.285008818342*l2.^2 + 1.92897054519174e+18*l2.*l3.^17 + 1.15178429399841e+17*l2.*l3.^16 + 6.87509481280438e+16*l2.*l3.^15 - 2.18430027254712e+15*l2.*l3.^14 - 1.30692482323831e+15*l2.*l3.^13 + 20952600877744.5*l2.*l3.^12 + 13068358662882.9*l2.*l3.^11 - 312096608127.875*l2.*l3.^10 - 100204317423.853*l2.*l3.^9 + 5156918979.43964*l2.*l3.^8 + 1170325325.87057*l2.*l3.^7 - 55473395.5431199*l2.*l3.^6 - 13530265.3451433*l2.*l3.^5 - 179733.561715089*l2.*l3.^4 - 26504.8934178152*l2.*l3.^3 - 845.206349206348*l2.*l3.^2 - 87.0377425044091*l2.*l3 - 0.616296296296297*l2 - 2.67167722233334e+17*l3.^18 - 2.19182832066861e+16*l3.^17 - 1.27311322420115e+16*l3.^16 + 514345935737395.0*l3.^15 + 272912195565257.0*l3.^14 - 6389716502175.74*l3.^13 - 3587033700895.71*l3.^12 + 103718474715.596*l3.^11 + 32706040081.65*l3.^10 - 2158337358.93214*l3.^9 - 433891646.581982*l3.^8 + 37170586.1373672*l3.^7 + 7202533.92267439*l3.^6 - 309999.170664557*l3.^5 - 58480.3954101073*l3.^4 + 829.554379776602*l3.^3 + 127.07442680776*l3.^2 - 1.07851851851852*l3 - 0.221703703703704
end
end


text:
using LightNLP
using LightNLP.NER
#using JLD2, FileIO

include("config.jl")

if CONFIG["training"]
    ner = NER.Decoder(CONFIG)
    #save("ner.jld2", "ner", ner)
else
    ner = load("ner.jld2", "ner")
    decode(ner, testfile)
end

ext: jl


text:
@testset "Build from string [sucess]" begin
    for ibanstr in map( cc -> iban_random(CountryCode=cc)["value"] ,supported_countries())
        @test iban(ibanstr)["value"] == ibanstr
    end
end

function test_error(iban_str, snippet)
        try
            iban(iban_str)
        catch err
            @test err isa ValidationException
            @test occursin(snippet, sprint(showerror, err)) == true
            return
        end
        error("Expected test to fail: ('$iban_str , $snippet)")
    end

@testset "Build from string [error]" begin
        test_error("A", "value too short")
        test_error("XX", "value too short")
        test_error("AL1", "value too short")
        test_error("XX11", "country code not supported")
        # we use BR as it has a rich structure:
        # BR97 00360305 00001 0009795493 P 1
        test_error("BR9700360305000010009795493P1_", "unexpected BBAN length, expected:")
        # BankCode(EntrySpec(:N, 8)),
        test_error("BR970036030A000010009795493P1", "invalid characters [IbanGen.BankCode]")
        # BranchCode(EntrySpec(:N, 5)),
        test_error("BR97003603050000A0009795493P1", "invalid characters [IbanGen.BranchCode]")
        # AccountNumber(EntrySpec(:N, 10))
        test_error("BR970036030500001000979549AP1", "invalid characters [IbanGen.AccountNumber]")
        # AccountType(EntrySpec(:A, 1)),
        test_error("BR970036030500001000979549391", "invalid characters [IbanGen.AccountType]")
        # OwnerAccountType(EntrySpec(:C, 1)
        test_error("BR9700360305000010009795493P_", "invalid characters [IbanGen.OwnerAccountType]")
        # Invalid check digits
        test_error("BR9900360305000010009795493P1", "invalid check digits")
        # Invalid check digits
        test_error("BR9700360305000010009795493P2", "invalid check digits")
    end


text:
@testset "Token" begin
    s = "abcd"
    t = FP.Token(:ab, FP.subs(s, 2:3))
    @test typeof(t) <: FP.AbstractSpan
    @test t.name == :ab
    @test FP.from(t) == 2
    @test FP.to(t) == 3
    @test FP.parent_string(s) === s
    @test t.ss == "bc"
    t = FP.Token(:EOS, FP.subs(s, lastindex(s)))
    @test FP.is_eos(t)
end

@testset "Block" begin
    s = "abcd"
    t1 = FP.Token(:ab, FP.subs(s, 1))
    t2 = FP.Token(:cd, FP.subs(s, 4))
    b = FP.Block(:foo, t1 => t2)
    @test typeof(b) == FP.Block
    @test b.ss == "abcd"
    @test b.open === t1
    @test b.close === t2
    @test FP.content(b) == "bc"
    @test isa(b, FP.AbstractSpan)

    s = "abc def ghi"
    t = FP.TextBlock(FP.subs(s, 5:7))
    @test isa(t, FP.AbstractSpan)
    @test t.ss == "def"
end

@testset "concrete" begin
    @test isconcretetype(FP.SS)
    @test isconcretetype(FP.SubVector{FP.Token})
    @test isconcretetype(typeof(FP.EMPTY_TOKEN_SVEC))
    @test isconcretetype(FP.Token)
    @test isconcretetype(FP.Block)
    @test isconcretetype(Vector{FP.Block})
end

@testset "subv" begin
    a = [1,2,3,4]
    va = FP.subv(a)
    @test length(va) == length(a)
    @test va isa SubArray
    @test va === FP.subv(va)
end


text:
# tools for the regularization of the system.

# update regularization values in classic mode if there is a failure during factorization
function update_regu_trycatch!(regu, cnts, T, T0)
  T == Float32 && return 1
  T0 == Float128 && T == Float64 && return 1
  if cnts.c_pdd == 0 && cnts.c_catch == 0
    regu.δ *= T(1e2)
    regu.δ_min *= T(1e2)
    regu.ρ *= T(1e5)
    regu.ρ_min *= T(1e5)
  elseif cnts.c_pdd == 0 && cnts.c_catch != 0
    regu.δ *= T(1e1)
    regu.δ_min *= T(1e1)
    regu.ρ *= T(1e0)
    regu.ρ_min *= T(1e0)
  elseif cnts.c_pdd != 0 && cnts.c_catch == 0
    regu.δ *= T(1e5)
    regu.δ_min *= T(1e5)
    regu.ρ *= T(1e5)
    regu.ρ_min *= T(1e5)
  else
    regu.δ *= T(1e1)
    regu.δ_min *= T(1e1)
    regu.ρ *= T(1e1)
    regu.ρ_min *= T(1e1)
  end
  return 0
end

function update_regu!(regu)
  if regu.δ >= regu.δ_min
    regu.δ /= 10
  end
  if regu.ρ >= regu.ρ_min
    regu.ρ /= 10
  end
end

# update regularization, and corrects if the magnitude of the diagonal of the matrix is too high
function update_regu_diagK2!(regu, K_nzval, diagind_K, nvar, pdd, l_pdd, mean_pdd, cnts, T, T0)
  l_pdd[cnts.k % 6 + 1] = pdd
  mean_pdd = mean(l_pdd)

  if T == Float64 &&
     cnts.k > 10 &&
     mean_pdd != zero(T) &&
     std(l_pdd ./ mean_pdd) < T(1e-2) &&
     cnts.c_pdd < 5
    regu.δ_min /= 10
    regu.δ /= 10
    cnts.c_pdd += 1
  end
  if T == Float64 &&
     cnts.k > 10 &&
     cnts.c_catch <= 1 &&
     @views minimum(K_nzval[diagind_K[1:nvar]]) < -one(T) / regu.δ / T(1e-6)
    regu.δ /= 10
    regu.δ_min /= 10
    cnts.c_pdd += 1
  elseif T != T0 &&
         cnts.c_pdd < 2 &&
         @views minimum(K_nzval[diagind_K[1:nvar]]) < -one(T) / regu.δ / T(1e-5)
    return 1
  elseif T == Float128 &&
         cnts.k > 10 &&
         cnts.c_catch <= 1 &&
         @views minimum(K_nzval[diagind_K[1:nvar]]) < -one(T) / regu.δ / T(1e-15)
    regu.δ /= 10
    regu.δ_min /= 10
    cnts.c_pdd += 1
  end

  update_regu!(regu)

  return 0
end

function update_regu_diagK2_5!(regu, D, pdd, l_pdd, mean_pdd, cnts, T, T0)
  l_pdd[cnts.k % 6 + 1] = pdd
  mean_pdd = mean(l_pdd)

  if T == Float64 &&
     cnts.k > 10 &&
     mean_pdd != zero(T) &&
     std(l_pdd ./ mean_pdd) < T(1e-2) &&
     cnts.c_pdd < 5
    regu.δ_min /= 10
    regu.δ /= 10
    cnts.c_pdd += 1
  end
  if T == Float64 &&
     cnts.k > 10 &&
     cnts.c_catch <= 1 &&
     @views minimum(D) < -one(T) / regu.δ / T(1e-6)
    regu.δ /= 10
    regu.δ_min /= 10
    cnts.c_pdd += 1
  elseif T != T0 && cnts.c_pdd < 2 && @views minimum(D) < -one(T) / regu.δ / T(1e-5)
    return 1
  elseif T == Float128 &&
         cnts.k > 10 &&
         cnts.c_catch <= 1 &&
         @views minimum(D) < -one(T) / regu.δ / T(1e-15)
    regu.δ /= 10
    regu.δ_min /= 10
    cnts.c_pdd += 1
  end

  update_regu!(regu)

  return 0
end


text:
include("benchmarking_tools.jl")
include("benchmark_ncqp_netlib.jl")
include("benchmark_nlo_netlib.jl")
include("nl_functions.jl")

max_forks_repo_name: ohinder/Everest


text:
"""
    jlty_to_clty(::Type{T}, ctx::ASTContext) where {T}
Interface for mapping a Julia type to the corresponding Clang type representation.

See also, [`clty_to_jlty`](@ref). Note that, the mapping is not injective.
"""
jlty_to_clty(::Type{T}, ctx::ASTContext) where {T} = error("no mapping found for $T")

# builtin types
jlty_to_clty(::Type{Nothing}, ctx::ASTContext) = get_builtin_type(ctx, VoidTy)
jlty_to_clty(::Type{Bool}, ctx::ASTContext) = get_builtin_type(ctx, BoolTy)
jlty_to_clty(::Type{Int8}, ctx::ASTContext) = get_builtin_type(ctx, SignedCharTy)
jlty_to_clty(::Type{Int16}, ctx::ASTContext) = get_builtin_type(ctx, ShortTy)
jlty_to_clty(::Type{Int32}, ctx::ASTContext) = get_builtin_type(ctx, IntTy)
jlty_to_clty(::Type{Int64}, ctx::ASTContext) = get_builtin_type(ctx, LongLongTy)
jlty_to_clty(::Type{Int128}, ctx::ASTContext) = get_builtin_type(ctx, Int128Ty)
jlty_to_clty(::Type{UInt8}, ctx::ASTContext) = get_builtin_type(ctx, UnsignedCharTy)
jlty_to_clty(::Type{UInt16}, ctx::ASTContext) = get_builtin_type(ctx, UnsignedShortTy)
jlty_to_clty(::Type{UInt32}, ctx::ASTContext) = get_builtin_type(ctx, UnsignedIntTy)
jlty_to_clty(::Type{UInt64}, ctx::ASTContext) = get_builtin_type(ctx, UnsignedLongLongTy)
jlty_to_clty(::Type{UInt128}, ctx::ASTContext) = get_builtin_type(ctx, UnsignedInt128Ty)
jlty_to_clty(::Type{Float16}, ctx::ASTContext) = get_builtin_type(ctx, Float16Ty)
jlty_to_clty(::Type{Float32}, ctx::ASTContext) = get_builtin_type(ctx, FloatTy)
jlty_to_clty(::Type{Float64}, ctx::ASTContext) = get_builtin_type(ctx, DoubleTy)
jlty_to_clty(::Type{Ptr{Cvoid}}, ctx::ASTContext) = get_builtin_type(ctx, VoidPtrTy)

"""
    clty_to_jlty(::Type{T}) where {T}
Interface for mapping a Clang type to the corresponding Julia type representation.

See also, [`jlty_to_clty`](@ref). Note that, the mapping is not injective.
"""
clty_to_jlty(clty::T) where {T<:AbstractClangType} = error("no mapping found for $T")

# builtin types
clty_to_jlty(clty::T) where {T<:AbstractBuiltinType} = error("no mapping found for builtin type: $T")
clty_to_jlty(clty::VoidTy) = Cvoid
clty_to_jlty(clty::BoolTy) = Bool
clty_to_jlty(clty::CharTy) = Cuchar
clty_to_jlty(clty::WCharTy) = Cwchar_t
clty_to_jlty(clty::WideCharTy) = Cwchar_t
clty_to_jlty(clty::SignedCharTy) = Cchar
clty_to_jlty(clty::ShortTy) = Cshort
clty_to_jlty(clty::IntTy) = Cint
clty_to_jlty(clty::LongTy) = Clong
clty_to_jlty(clty::LongLongTy) = Clonglong
clty_to_jlty(clty::Int128Ty) = Int128
clty_to_jlty(clty::UnsignedCharTy) = Cuchar
clty_to_jlty(clty::UnsignedShortTy) = Cushort
clty_to_jlty(clty::UnsignedIntTy) = Cuint
clty_to_jlty(clty::UnsignedLongTy) = Culong
clty_to_jlty(clty::UnsignedLongLongTy) = Culonglong
clty_to_jlty(clty::UnsignedInt128Ty) = UInt128
clty_to_jlty(clty::FloatTy) = Cfloat
clty_to_jlty(clty::DoubleTy) = Cdouble
clty_to_jlty(clty::Float16Ty) = Float16
clty_to_jlty(clty::HalfTy) = Float16
clty_to_jlty(clty::BFloat16Ty) = Float16
clty_to_jlty(clty::NullPtrTy) = Ptr{Cvoid}
clty_to_jlty(clty::VoidPtrTy) = Ptr{Cvoid}

# Clang types
clty_to_jlty(clty::QualType) = clty_to_jlty(typeclass(clty))
clty_to_jlty(clty::BuiltinType) = clty_to_jlty(typeclass(clty))
clty_to_jlty(clty::ReferenceType) = clty_to_jlty(typeclass(clty))
clty_to_jlty(clty::FunctionType) = clty_to_jlty(typeclass(clty))
clty_to_jlty(clty::ArrayType) = clty_to_jlty(typeclass(clty))
clty_to_jlty(clty::TagType) = clty_to_jlty(typeclass(clty))

clty_to_jlty(clty::PointerType) = Ptr{clty_to_jlty(get_pointee_type(clty))}

typeclass(x::UnexposedType) = x

function typeclass(ty::QualType)
    is_builtin_type(ty) && return BuiltinType(ty.ptr)
    is_complex_type(ty) && return ComplexType(ty.ptr)
    is_pointer_type(ty) && return PointerType(ty.ptr)
    is_reference_type(ty) && return ReferenceType(ty.ptr)
    is_member_pointer_type(ty) && return MemberPointerType(ty.ptr)
    is_array_type(ty) && return ArrayType(ty.ptr)
    is_function_type(ty) && return FunctionType(ty.ptr)
    is_typedef_type(ty) && return TypedefType(ty.ptr)
    is_tag_type(ty) && return TagType(ty.ptr)
    is_template_type_parm_type(ty) && return TemplateTypeParmType(ty.ptr)
    is_subst_template_type_parm_type(ty) && return SubstTemplateTypeParmType(ty.ptr)
    is_subst_template_type_parm_pack_type(ty) && return SubstTemplateTypeParmPackType(ty.ptr)
    is_template_specialization_type(ty) && return TemplateSpecializationType(ty.ptr)
    is_elaborated_type(ty) && return ElaboratedType(ty.ptr)
    is_dependent_name_type(ty) && return DependentNameType(ty.ptr)
    is_dependent_template_specilization_type(ty) && return DependentTemplateSpecializationType(ty.ptr)
    return typeclass(UnexposedType(ty))
end

function typeclass(ty::BuiltinType)
    is_void_ty(ty) && return VoidTy(ty.ptr)
    is_bool_ty(ty) && return BoolTy(ty.ptr)
    is_char_ty(ty) && return CharTy(ty.ptr)
    is_wchar_ty(ty) && return WCharTy(ty.ptr)
    is_widechar_ty(ty) && return WideCharTy(ty.ptr)
    is_signed_char_ty(ty) && return SignedCharTy(ty.ptr)
    is_short_ty(ty) && return ShortTy(ty.ptr)
    is_int_ty(ty) && return IntTy(ty.ptr)
    is_long_ty(ty) && return LongTy(ty.ptr)
    is_longlong_ty(ty) && return LongLongTy(ty.ptr)
    is_int128_ty(ty) && return Int128Ty(ty.ptr)
    is_unsigned_char_ty(ty) && return UnsignedCharTy(ty.ptr)
    is_unsigned_short_ty(ty) && return UnsignedShortTy(ty.ptr)
    is_unsigned_int_ty(ty) && return UnsignedIntTy(ty.ptr)
    is_unsigned_long_ty(ty) && return UnsignedLongTy(ty.ptr)
    is_unsigned_longlong_ty(ty) && return UnsignedLongLongTy(ty.ptr)
    is_unsigned_int128_ty(ty) && return UnsignedInt128Ty(ty.ptr)
    is_float_ty(ty) && return FloatTy(ty.ptr)
    is_double_ty(ty) && return DoubleTy(ty.ptr)
    is_float16_ty(ty) && return Float16Ty(ty.ptr)
    is_half_ty(ty) && return HalfTy(ty.ptr)
    is_bfloat_ty(ty) && return BFloat16Ty(ty.ptr)
    is_nullptr_ty(ty) && return NullPtrTy(ty.ptr)
    return typeclass(UnexposedType(ty))
end

function typeclass(ty::ReferenceType)
    is_lvalue_reference_type(ty) && return LValueReferenceType(ty.ptr)
    is_rvalue_reference_type(ty) && return RValueReferenceType(ty.ptr)
    return typeclass(UnexposedType(ty))
end

function typeclass(ty::FunctionType)
    is_function_no_proto_type(ty) && return FunctionNoProtoType(ty.ptr)
    is_function_proto_type(ty) && return FunctionProtoType(ty.ptr)
    return typeclass(UnexposedType(ty))
end

function typeclass(ty::ArrayType)
    is_constant_array_type(ty) && return ConstantArrayType(ty.ptr)
    is_incomplete_array_type(ty) && return IncompleteArrayType(ty.ptr)
    is_variable_array_type(ty) && return VariableArrayType(ty.ptr)
    is_dependent_size_array_type(ty) && return DependentSizedArrayType(ty.ptr)
    return typeclass(UnexposedType(ty))
end

function typeclass(ty::TagType)
    is_record_type(ty) && return RecordType(ty.ptr)
    is_enum_type(ty) && return EnumType(ty.ptr)
    return typeclass(UnexposedType(ty))
end

"""
    jlty_to_llvmty(::Type{T}, ctx::LLVM.Context) where {T}
Interface for mapping a Julia type to the corresponding LLVM type representation.
"""
jlty_to_llvmty(::Type{T}, ctx::LLVM.Context) where {T} = error("no mapping found for $T")

# Julia type to IntegerType <: LLVMType
# LLVM does not make a distinction between signed and unsigned integer type.
jlty_to_llvmty(::Type{Bool}, ctx::LLVM.Context) = LLVM.Int8Type(ctx)
jlty_to_llvmty(::Type{Int8}, ctx::LLVM.Context) = LLVM.Int8Type(ctx)
jlty_to_llvmty(::Type{Int16}, ctx::LLVM.Context) = LLVM.Int16Type(ctx)
jlty_to_llvmty(::Type{Int32}, ctx::LLVM.Context) = LLVM.Int32Type(ctx)
jlty_to_llvmty(::Type{Int64}, ctx::LLVM.Context) = LLVM.Int64Type(ctx)
jlty_to_llvmty(::Type{Int128}, ctx::LLVM.Context) = LLVM.Int128Type(ctx)
jlty_to_llvmty(::Type{UInt8}, ctx::LLVM.Context) = LLVM.Int8Type(ctx)
jlty_to_llvmty(::Type{UInt16}, ctx::LLVM.Context) = LLVM.Int16Type(ctx)
jlty_to_llvmty(::Type{UInt32}, ctx::LLVM.Context) = LLVM.Int32Type(ctx)
jlty_to_llvmty(::Type{UInt64}, ctx::LLVM.Context) = LLVM.Int64Type(ctx)
jlty_to_llvmty(::Type{UInt128}, ctx::LLVM.Context) = LLVM.Int128Type(ctx)

# Julia type to FloatingPointType <: LLVMType
jlty_to_llvmty(::Type{Float16}, ctx::LLVM.Context) = LLVM.HalfType(ctx)
jlty_to_llvmty(::Type{Float32}, ctx::LLVM.Context) = LLVM.FloatType(ctx)
jlty_to_llvmty(::Type{Float64}, ctx::LLVM.Context) = LLVM.DoubleType(ctx)

# Julia type to VoidType <: LLVMType
jlty_to_llvmty(::Type{Nothing}, ctx::LLVM.Context) = LLVM.VoidType(ctx)

# Julia type to PointerType <: SequentialType <: CompositeType <: LLVMType
jlty_to_llvmty(::Type{Ptr{Cvoid}}, ctx::LLVM.Context) = LLVM.PointerType(LLVM.VoidType(ctx))


text:
export GaussLaguerreQuadrature

using DomainIntegrals
using FastGaussQuadrature

import Base: ==

struct GaussLaguerreQuadrature{ R <: DomainIntegrals.HalfLineRule, W <: AbstractVector } <: AbstractApproximationMethod
    rule :: R
    logw :: W
end

GaussLaguerreQuadrature(n::Int) = GaussLaguerreQuadrature(Float64, n)

function GaussLaguerreQuadrature(::Type{T}, n::Int) where T
    x, w = FastGaussQuadrature.gausslaguerre(n, zero(T))
    logw = log.(w)
    return GaussLaguerreQuadrature(DomainIntegrals.HalfLineRule(x, w), logw)
end

getpoints(approximation::GaussLaguerreQuadrature)     = points(approximation.rule)
getweights(approximation::GaussLaguerreQuadrature)    = weights(approximation.rule)
getlogweights(approximation::GaussLaguerreQuadrature) = approximation.logw
getlength(approximation::GaussLaguerreQuadrature)     = length(getweights(approximation))

approximation_name(approximation::GaussLaguerreQuadrature)       = "GaussLaguerre($(getlength(approximation)))"
approximation_short_name(approximation::GaussLaguerreQuadrature) = "GL$(getlength(approximation))"

approximate(approximation::GaussLaguerreQuadrature, fn::Function) = integral(approximation.rule, fn)

"""
This function calculates the log of the Gauss-laguerre integral by making use of the log of the integrable function.
    ln ( ∫ exp(-x)f(x) dx )
    ≈ ln ( ∑ wi * f(xi) )
    = ln ( ∑ exp( ln(wi) + logf(xi) ) )
    = ln ( ∑ exp( yi ) )
    = max(yi) + ln ( ∑ exp( yi - max(yi) ) )
    where we make use of the numerically stable log-sum-exp trick: https://en.wikipedia.org/wiki/LogSumExp
"""
function log_approximate(approximation::GaussLaguerreQuadrature, fn::Function)
    # get weights and points
    p    = getlength(approximation)
    x    = getpoints(approximation)
    logw = getlogweights(approximation)
    T    = eltype(logw)

    # calculate the ln(wi) + logf(xi) terms
    logresult = Vector{T}(undef, p)
    for i = 1:p
        logresult[i] = logw[i] + fn(x[i])
    end

    # log-sum-exp trick, calculate maximum
    max_logresult = maximum(logresult)

    # return log sum exp
    return max_logresult + log(sum(exp.(logresult .- max_logresult)))
end

function Base.:(==)(left::GaussLaguerreQuadrature{R}, right::GaussLaguerreQuadrature{R}) where R
    return getlength(left) == getlength(right)
end


text:
"""
    gmps2mps(gmps, maxdim)

Construct a matrix product state with a maximum bond dimension
`max_dim` from a set of GaussianMPS gates `gmps`.

Since the unitary gates orthogonalize the correlation matrix, if they
are applied in revese order to the configuration state (which is the
state in the occupation basis) they will generate the state in the
original spatial basis. So, a classical MPS from the configurations is
made and then the gates are applied in reverse order.

"""
function gmps2mps(gmps::GaussianMPS,
                  maxdim::Int64;
                  symmetry::Type{<:AbstractCharge}=Trivial)

    ##TODO: why are these defined complex here?!
    if symmetry == Trivial
        mps = MPS{Float64}(gmps.lx, 2, gmps.initconf)
        _applygmpsgates!(mps, gmps, maxdim)

    elseif symmetry == U1
        mps = U1MPS(Float64, gmps.lx, 2, gmps.initconf)
        _applygmpsgates!(mps, gmps, maxdim)
    else
        throw(ArgumentError("Unkown symmetry : $symmetry"))
    end
    mps
end

function _applygmpsgates!(mps::MPState{Array{T,3}},
                          gmps::GaussianMPS,
                          maxdim::Int) where {T}
    twobodyugate = Matrix{T}(I, 4, 4)
    ## NOTE: the gates are applies in reverse order
    for n=length(gmps.xs):-1:1
        site = gmps.xs[n]
        θ = gmps.θs[n]
        twobodyugate[2:3, 2:3] = rotationmat(θ)

        ugatetensor = reshape(twobodyugate, 2, 2, 2, 2)

        # produce the counterclockwise convention starting from bottom left
        ##NOTE: this is needed just because I followed the convention,
        ##probably best to avoid id, but need to remain consistant
        operator = permutedims(ugatetensor, [1,2,4,3])

        ## TODO: choose a better order of site or site+1 and push_to!
        center_at!(mps, site)
        apply!(mps, operator, site, maxdim=maxdim, pushto=:R, svnormalize=true)
    end
    nothing
end

function _applygmpsgates!(mps::MPState{SymTensor{S,T,3}},
                          gmps::GaussianMPS,
                          maxdim::Int) where {S,T}

    Vd = VectorSpace{S}(0=>1, 1=>1)
    # u is the two-body U gate matrix
    u = eye(Float64, fuse(false, Vd,Vd))

    #   twobodyugate = Matrix{ComplexF64}(I, 4, 4)
    ## NOTE: the gates are applies in reverse order

    for n=length(gmps.xs):-1:1
        site = gmps.xs[n]
        θ = gmps.θs[n]
        u[Sector{S}(1,1)] =  rotationmat(θ)

        uten = splitleg(splitleg(u, 2, (dual(Vd), dual(Vd))), 1, (Vd,Vd))

        ## TODO: choose a better order of site or site+1 and push_to!
        center_at!(mps, site)
        apply!(mps, uten, site, maxdim=maxdim, pushto=:R, svnormalize=true)
    end
    nothing
end

function rotationmat(θ::Float64)
    R = [
        cos(θ) sin(θ);
        -sin(θ) cos(θ)
    ]
    R
end

max_stars_repo_name: amiragha/mps

max_issues_repo_name: amiragha/mps

max_forks_repo_name: amiragha/mps


text:
#
# Introspecting and managing PostgreSQL catalog.
#

module PostgresCatalog

using LibPQ
using Tables

include("rectypes.jl")
include("entities.jl")
include("introspect.jl")
include("sql.jl")

end


text:
using Interpol
using Base.Test

# write your own tests here
include("base_types.jl")
include("interpolation_bases.jl")
include("interpolation.jl")

max_stars_repo_name: JKrehl/Interpol

max_issues_repo_name: JKrehl/Interpol

max_forks_repo_name: JKrehl/Interpol


text:
@testset "Poly" begin

  function _test_sturm()
    s = rand(1:20)
    Zx = Hecke.Globals.Zx
    M = random_symmetric_matrix(s)
    f = charpoly(Zx, M)

    while iszero(f)
      M = random_symmetric_matrix(s)
      f = charpoly(Zx, M)
    end

    npos = Hecke.n_positive_roots(f)
    nreal = Hecke.n_real_roots(f)

    p = 64

    local sgtpos
    local l

    while p < 4096
      l = roots(f, ArbField(p, cached = false))
      sgtpos = count(ispositive, l)
      sgtneg = count(isnegative, l)
      sgtz = count(iszero, l)
      if sgtpos + sgtneg + sgtz != length(l)
        p *= 2
      else
        break
      end
      if p > 4096
        error("Precision issue")
      end
    end
    return sgtpos == npos && nreal == length(l)
  end

  function random_symmetric_matrix(x::Int)
    M = zero_matrix(FlintZZ, x, x)
    for i = 1:x
      for j= i:x
        a = rand(1:5)
        M[i, j] = a
        M[j, i] = a
      end
    end
    return M
  end

  for i = 1:20
    @test _test_sturm()
  end

  for R in [ZZ, QQ]
    _, x = R["x"]
    f = x^5 + x^2 - x

    @test Hecke.n_real_roots(f) == 3
    @test Hecke.n_real_roots(f^2) == 3
    @test Hecke.n_positive_roots(f) == 1
    @test Hecke.n_positive_roots(f * x^3) == 1

    f = x^10 + x^9 - x^8 + x^7 - x^6 + x^5 - x^4 - x^3 - x
    @test Hecke.n_real_roots(f) == 4
    @test Hecke.n_real_roots(f^2) == 4
    @test Hecke.n_positive_roots(f) == 1
    @test Hecke.n_positive_roots(f^2 * x^3) == 1

    @test Hecke.n_positive_roots((x - 1)^2) == 1
    @test Hecke.n_positive_roots((x - 1)^2, multiplicities = true) == 2
  end
end

@testset "roots" begin
  o = CyclotomicField(2)[1](1)
  @test issetequal(roots(o, 2), [o, -o])
  o = CyclotomicField(1)[1](1)
  @test issetequal(roots(o, 2), [o, -o])

  o, a = CyclotomicField(4)
  _, x = o["x"]
  @test length(roots(x^2-a^2//4)) == 2

  Qx,x = PolynomialRing(QQ,"x")
  K, a = NumberField(x^4+2, "a")
  R, y = PolynomialRing(K,"y")
  f = y^2 + 2*y + 1
  @test roots(f) == [K(-1)]

  K, a = NumberField(x^2-5, "a")
  R, x = PolynomialRing(K)
  f = 3*x^4 + 5*x^3 - 15*x^2 + 15*x
  @test roots(f) == [K(0)]

  K, a = NumberField(x^4+2, "a") #relative
  R, y = PolynomialRing(K,"y")
  f = y^2 + 2*y + 1
  @test roots(f) == [K(-1)]

end


text:
let
       x = zeros(150, 150)
       carts = []
       mutable struct Cart
       dir::Int
       coord::Tuple{Int, Int}
       offset::Tuple{Int, Int}
       end
       #9
       d = Dict('^' => (0,1), 'v' => (0,-1), '<' => (-1,0), '>' => (1,0))
       mdirs = [(x, y) -> (y, -x), (x, y) -> (x, y), (x, y) -> (-y, x)]
       for (j, line) in eachline("day13.e") |> enumerate
       for (i, val) in split(line, "") |> enumerate
       val[1] in ['/' '\\' '+' '-' '|'] && (x[i,j] = 1)
       val[1] in ['^' 'v' '<' '>'] && push!(carts, Cart(3, (i, j), d[val[1]]))
       end
       end;
       while true;
       sort!(carts, by = x -> x.coord[2])
       for c in carts; @info c
       hasint = sum(x[max(1, c.coord[1] - 1): min(150, c.coord[1] + 1), max(1, c.coord[2] - 1): min(150, c.coord[2] + 1)]) > 3
       if hasint
       c.dir += 1; c.dir > 3 && (c.dir = 1)
       c.offset = mdirs[c.dir](c.offset...)
       else
       nc = c.coord .+ c.offset;
       if any(nc .> 150) || any(nc .< 1) || x[nc...] == 0; @info "here"
       for (z, i) in enumerate(mdirs);
       ncc = c.coord .+ i(c.offset...);
       (any(ncc .> 150) || any(ncc .< 1)) && continue
       x[ncc...] == 1 && (c.offset = i(c.offset...))
       end
       end
       end
       c.coord = c.coord .+ c.offset
       for cc in carts
       all(c.coord .== cc.coord) && c.offset != cc.offset && error(c.coord)
       end
       end
       end
       end

max_stars_repo_name: AnAverageHuman/competitive

max_issues_repo_name: AnAverageHuman/competitive

max_forks_repo_name: AnAverageHuman/competitive


text:
using Plots
using StatsBase
f1(point)=[0.00 0.00 ; 0.00 0.16]*point
f2(point)=[0.85 0.04 ; -0.04 0.85]*point + [0.00 ; 1.60]
f3(point)=[0.20 -0.26 ; 0.23 0.22]*point + [0.00 ; 1.60]
f4(point)=[-0.15 0.28 ; 0.26 0.24]*point + [0.00 ; 0.44]

f_list=[f1, f2, f3, f4]

p=100
num=500000
finalPoints=[]

for number_of_points in 1:num
    (number_of_points==1) ? (point=point=[0.0; 0.0]) : (point=[rand();rand()])
    for number_of_iteration in 1:p
        weights=[0.01,0.85,0.07,0.07]
        items=[f1, f2, f3, f4]
        point=sample(items, Weights(weights))(point)
    end
    push!(finalPoints, point)
end
scatter(hcat(finalPoints...)[1,:], hcat(finalPoints...)[2,:],markersize=0.7, color=:green, xlabel="x", ylabel="y", legend=false)
savefig("C:\\Users\\Narges\\Documents\\GitHub\\computational_physics\\chapter2\\report\\RandomBarnsleyFern.png")


text:
# NegativeBinomial is the distribution of the number of failures
# before the r-th success in a sequence of Bernoulli trials.
# We do not enforce integer size, as the distribution is well defined
# for non-integers, and this can be useful for e.g. overdispersed
# discrete survival times.

immutable NegativeBinomial <: DiscreteUnivariateDistribution
    r::Int
    p::Float64

    function NegativeBinomial(r::Int, p::Float64)
        r > 0 || error("r must be positive.")
        0.0 < p <= 1.0 || error("prob must be in (0, 1].")
        new(r, p)
    end

    @compat NegativeBinomial(r::Real, p::Real) = NegativeBinomial(round(Int, r), Float64(p))
    NegativeBinomial(r::Real) = NegativeBinomial(r, 0.5)
    NegativeBinomial() = new(1.0, 0.5)
end

@_jl_dist_2p NegativeBinomial nbinom

@distr_support NegativeBinomial 0 Inf

### Parameters

params(d::NegativeBinomial) = (d.r, d.p)

succprob(d::NegativeBinomial) = d.p
failprob(d::NegativeBinomial) = 1.0 - d.p

### Statistics

mean(d::NegativeBinomial) = (p = succprob(d); (1.0 - p) * d.r / p)

var(d::NegativeBinomial) = (p = succprob(d); (1.0 - p) * d.r / (p * p))

std(d::NegativeBinomial) = (p = succprob(d); sqrt((1.0 - p) * d.r) / p)

skewness(d::NegativeBinomial) = (p = succprob(d); (2.0 - p) / sqrt((1.0 - p) * d.r))

kurtosis(d::NegativeBinomial) = (p = succprob(d); 6.0 / d.r + (p * p) / ((1.0 - p) * d.r))

mode(d::NegativeBinomial) = (p = succprob(d); floor(Int,(1.0 - p) * (d.r - 1.) / p))

### Evaluation

immutable RecursiveNegBinomProbEvaluator <: RecursiveProbabilityEvaluator
    r::Float64
    p0::Float64
end

RecursiveNegBinomProbEvaluator(d::NegativeBinomial) = RecursiveNegBinomProbEvaluator(d.r, failprob(d))
nextpdf(s::RecursiveNegBinomProbEvaluator, p::Float64, x::Integer) = ((x + s.r - 1) / x) * s.p0 * p
_pdf!(r::AbstractArray, d::NegativeBinomial, rgn::UnitRange) = _pdf!(r, d, rgn, RecursiveNegBinomProbEvaluator(d))

function mgf(d::NegativeBinomial, t::Real)
    r, p = params(d)
    return ((1.0 - p) * exp(t))^r / (1.0 - p * exp(t))^r
end

function cf(d::NegativeBinomial, t::Real)
    r, p = params(d)
    return (((1.0 - p) * cis(t)) / (1.0 - p * cis(t)))^r
end


text:
# ---
# title: 1210. Minimum Moves to Reach Target with Rotations
# id: problem1210
# author: Tian Jun
# date: 2020-10-31
# difficulty: Hard
# categories: Breadth-first Search
# link: <https://leetcode.com/problems/minimum-moves-to-reach-target-with-rotations/description/>
# hidden: true
# ---
#
# In an `n*n` grid, there is a snake that spans 2 cells and starts moving from
# the top left corner at `(0, 0)` and `(0, 1)`. The grid has empty cells
# represented by zeros and blocked cells represented by ones. The snake wants to
# reach the lower right corner at `(n-1, n-2)` and `(n-1, n-1)`.
#
# In one move the snake can:
#
#   * Move one cell to the right if there are no blocked cells there. This move keeps the horizontal/vertical position of the snake as it is.
#   * Move down one cell if there are no blocked cells there. This move keeps the horizontal/vertical position of the snake as it is.
#   * Rotate clockwise if it's in a horizontal position and the two cells under it are both empty. In that case the snake moves from `(r, c)` and `(r, c+1)` to `(r, c)` and `(r+1, c)`.
# ![](https://assets.leetcode.com/uploads/2019/09/24/image-2.png)
#
#   * Rotate counterclockwise if it's in a vertical position and the two cells to its right are both empty. In that case the snake moves from `(r, c)` and `(r+1, c)` to `(r, c)` and `(r, c+1)`.
# ![](https://assets.leetcode.com/uploads/2019/09/24/image-1.png)
#
# Return the minimum number of moves to reach the target.
#
# If there is no way to reach the target, return `-1`.
#
#
#
# **Example 1:**
#
# **![](https://assets.leetcode.com/uploads/2019/09/24/image.png)**
#
#
#
#     Input: grid = [[0,0,0,0,0,1],
#                    [1,1,0,0,1,0],
#                    [0,0,0,0,1,1],
#                    [0,0,1,0,1,0],
#                    [0,1,1,0,0,0],
#                    [0,1,1,0,0,0]]
#     Output: 11
#     Explanation: One possible solution is [right, right, rotate clockwise, right, down, down, down, down, rotate counterclockwise, right, down].
#
#
# **Example 2:**
#
#
#
#     Input: grid = [[0,0,1,1,1,1],
#                    [0,0,0,0,1,1],
#                    [1,1,0,0,0,1],
#                    [1,1,1,0,0,1],
#                    [1,1,1,0,0,1],
#                    [1,1,1,0,0,0]]
#     Output: 9
#
#
#
#
# **Constraints:**
#
#   * `2 <= n <= 100`
#   * `0 <= grid[i][j] <= 1`
#   * It is guaranteed that the snake starts at empty cells.
#
#
## @lc code=start
using LeetCode

## add your code here:
## @lc code=end


text:
function FieldPolynomialFunction(arg0::Vector{RealFieldElement})
    return FieldPolynomialFunction((Vector{RealFieldElement},), arg0)
end

function add(obj::FieldPolynomialFunction, arg0::FieldPolynomialFunction)
    return jcall(obj, "add", FieldPolynomialFunction, (FieldPolynomialFunction,), arg0)
end

function anti_derivative(obj::FieldPolynomialFunction)
    return jcall(obj, "antiDerivative", FieldPolynomialFunction, ())
end

function degree(obj::FieldPolynomialFunction)
    return jcall(obj, "degree", jint, ())
end

function equals(obj::Object, arg0::Object)
    return jcall(obj, "equals", jboolean, (Object,), arg0)
end

function get_class(obj::Object)
    return jcall(obj, "getClass", Class, ())
end

function get_coefficients(obj::FieldPolynomialFunction)
    return jcall(obj, "getCoefficients", Vector{RealFieldElement}, ())
end

function get_field(obj::FieldPolynomialFunction)
    return jcall(obj, "getField", Field, ())
end

function hash_code(obj::Object)
    return jcall(obj, "hashCode", jint, ())
end

function integrate(obj::FieldPolynomialFunction, arg0::RealFieldElement, arg1::RealFieldElement)
    return jcall(obj, "integrate", RealFieldElement, (RealFieldElement, RealFieldElement), arg0, arg1)
end

function integrate(obj::FieldPolynomialFunction, arg0::jdouble, arg1::jdouble)
    return jcall(obj, "integrate", RealFieldElement, (jdouble, jdouble), arg0, arg1)
end

function multiply(obj::FieldPolynomialFunction, arg0::FieldPolynomialFunction)
    return jcall(obj, "multiply", FieldPolynomialFunction, (FieldPolynomialFunction,), arg0)
end

function negate(obj::FieldPolynomialFunction)
    return jcall(obj, "negate", FieldPolynomialFunction, ())
end

function notify(obj::Object)
    return jcall(obj, "notify", void, ())
end

function notify_all(obj::Object)
    return jcall(obj, "notifyAll", void, ())
end

function polynomial_derivative(obj::FieldPolynomialFunction)
    return jcall(obj, "polynomialDerivative", FieldPolynomialFunction, ())
end

function subtract(obj::FieldPolynomialFunction, arg0::FieldPolynomialFunction)
    return jcall(obj, "subtract", FieldPolynomialFunction, (FieldPolynomialFunction,), arg0)
end

function to_string(obj::Object)
    return jcall(obj, "toString", JString, ())
end

function value(obj::FieldPolynomialFunction, arg0::RealFieldElement)
    return jcall(obj, "value", RealFieldElement, (RealFieldElement,), arg0)
end

function value(obj::FieldPolynomialFunction, arg0::jdouble)
    return jcall(obj, "value", RealFieldElement, (jdouble,), arg0)
end

function wait(obj::Object)
    return jcall(obj, "wait", void, ())
end

function wait(obj::Object, arg0::jlong)
    return jcall(obj, "wait", void, (jlong,), arg0)
end

function wait(obj::Object, arg0::jlong, arg1::jint)
    return jcall(obj, "wait", void, (jlong, jint), arg0, arg1)
end


text:
# We separate some of the internals needed for implementing GradientGrassmann into a
# submodule, to keep the MPSKit module namespace cleaner.
"""
A module for functions related to treating an InfiniteMPS in left-canonical form as a bunch
of points on Grassmann manifolds, and performing things like retractions and transports
on these Grassmann manifolds.

The module exports nothing, and all references to it should be qualified, e.g.
`GrassmannMPS.fg`.
"""
module GrassmannMPS

using ..MPSKit
using TensorKit
import TensorKitManifolds.Grassmann

"""
Compute the expectation value, and its gradient with respect to the tensors in the unit
cell as tangent vectors on Grassmann manifolds.
"""
function fg(x::Tuple{T,<:Cache}) where T <: Union{<:InfiniteMPS,FiniteMPS}
    (state, envs) = x
    # The partial derivative with respect to AL, al_d, is the partial derivative with
    # respect to AC times CR'.
    ac_d = [ac_prime(state.AC[v], v, state, envs) for v in 1:length(state)]
    al_d = [d*c' for (d, c) in zip(ac_d, state.CR[1:end])]
    g = [Grassmann.project(d, a) for (d, a) in zip(al_d, state.AL)]
    f = real(sum(expectation_value(state, envs)))
    return f, g
end

function fg(x::Tuple{<:MPSMultiline,<:Cache})
    (state, envs) = x

    # The partial derivative with respect to AL, al_d, is the partial derivative with
    # respect to AC times CR'.
    ac_d = [ac_prime(state.AC[v], v, state, envs) for v in CartesianIndices(state.AC)]
    al_d = [d*c' for (d, c) in zip(ac_d, state.CR)]
    g = [Grassmann.project(d, a) for (d, a) in zip(al_d, state.AL)]

    f = expectation_value(state, envs)
    fi = imag.(f); fr = real.(f);

    sum(fi) > MPSKit.Defaults.tol && @warn "mpo is not hermitian $(fi)"

    g = -2*g./abs.(fr);
    return -log(sum(fr)^2), g[:]
end

"""
Retract a left-canonical MPSMultiline along Grassmann tangent `g` by distance `alpha`.
"""
function retract(x::Tuple{<:MPSMultiline,<:Cache}, tg, alpha)
    # the idea is to re-use imps transportation

    (state, envs) = x

    g = reshape(tg,size(state));

    transported = map(1:length(state)) do row
        (tx,th) = retract((state[row],envs),g[row,:],alpha);
        tx[1],th
    end

    nstate = MPSKit.Multiline(first.(transported));
    h = reduce(hcat,last.(transported))[:]

    return (nstate,envs), h
end

"""
Retract a left-canonical infinite MPS along Grassmann tangent `g` by distance `alpha`.
"""
function retract(x::Tuple{<:InfiniteMPS,<:Cache}, g, alpha)
    (state, envs) = x

    nal = similar(state.AL);
    h = similar(g)  # The tangent at the end-point
    for i in 1:length(g)
        (nal[i], h[i]) = Grassmann.retract(state.AL[i], g[i], alpha)
    end

    nstate = InfiniteMPS(nal,state.CR[end]);
    return (nstate,envs), h
end

"""
Retract a left-canonical finite MPS along Grassmann tangent `g` by distance `alpha`.
"""
function retract(x::Tuple{<:FiniteMPS,<:Cache}, g, alpha)
    (state, envs) = x
    y = copy(state)  # The end-point
    h = similar(g)  # The tangent at the end-point
    for i in 1:length(g)
        (yal, h[i]) = Grassmann.retract(state.AL[i], g[i], alpha)
        y.AC[i] = (yal,state.CR[i])
    end
    normalize!(y)
    return (y,envs), h
end

"""
Transport a tangent vector `h` along the retraction from `x` in direction `g` by distance
`alpha`. `xp` is the end-point of the retraction.
"""
function transport!(h, x, g, alpha, xp)
    (state, envs) = x
    for i in 1:length(h)
        h[i] = Grassmann.transport!(h[i], state.AL[i], g[i], alpha, xp[1].AL[i])
    end
    return h
end

"""
Euclidean inner product between two Grassmann tangents of an infinite MPS.
"""
function inner(x, g1, g2)
    (state, envs) = x
    tot = sum(Grassmann.inner(a, d1, d2) for (a, d1, d2) in zip(state.AL, g1, g2))
    return 2*real(tot)
end

"""
Scale a tangent vector by scalar `alpha`.
"""
scale!(g, alpha) = g .* alpha

"""
Add two tangents vectors, scaling the latter by `alpha`.
"""
add!(g1, g2, alpha) = g1 + g2 .* alpha

"""
Precondition a given Grassmann tangent `g` at state `x` by the Hilbert space inner product.

This requires inverting the right MPS transfer matrix. This is done using `reginv`, with a
regularisation parameter that is the norm of the tangent `g`.
"""
function precondition(x, g)
    (state, envs) = x
    #hacky workaround - what is eltype(state)?
    delta = min(real(one(eltype(state.AL[1]))), sqrt(inner(x, g, g)))
    crinvs = [MPSKit.reginv(cr, delta) for cr in state.CR[1:end]]
    g_prec = [Grassmann.project(d[]*(crinv'*crinv), a)
              for (d, crinv, a) in zip(g, crinvs, state.AL)]
    return g_prec
end

end  # module GrassmannMPS


text:
function Base.count(labels::AbstractArray{Symbol}, pos_labels::Set{Symbol})
    num_pos, num_neg = 0, 0
    for label in labels
        if label in pos_labels
            num_pos += 1
        else
            num_neg += 1
        end
    end
    num_pos, num_neg
end

"""
$(SIGNATURES)

Optimized function for computing the area under the receiver operator characteristic
curve.
"""
function auroc(scores::AbstractArray{Float64}, classes::AbstractArray{Symbol},
               pos_labels::Set{Symbol}; rev::Bool=true)

    num_scores = length(scores)
    ordering = sortperm(scores, rev=rev)
    labels = classes[ordering]
    num_pos, num_neg = count(labels, pos_labels)

    tprs = Array{Float64}(num_scores)
    fprs = Array{Float64}(num_scores)

    auroc = 0.0
    tp = labels[1] in pos_labels ? 1 : 0
    fp = 1-tp
    tn, fn = num_neg - fp, num_pos - tp
    tprs[1] = tp/(tp+fn)
    fprs[1] = fp/(fp+tn)

    for i in 2:num_scores
        dtp = labels[i] in pos_labels ? 1 : 0
        tp += dtp
        fp += 1-dtp
        tn = num_neg - fp
        fn = num_pos - tp
        tprs[i] = tp/(tp+fn)
        fprs[i] = fp/(fp+tn)
        auroc += (tprs[i] + tprs[i-1])/2*(fprs[i] - fprs[i-1])
    end
    auroc, tprs, fprs
end

"""
$(SIGNATURES)

Computes the area under the Precision-Recall curve using a lower
trapezoidal estimator, which is more accurate for skewed datasets.

K. Boyd, K. H. Eng, and C. D. Page, “Area under the Precision-Recall
Curve: Point Estimates and Confidence Intervals,” in Machine Learning
and Knowledge Discovery in Databases, H. Blockeel, K. Kersting,
S. Nijssen, and F. Železný, Eds. Springer Berlin Heidelberg, 2013,
pp. 451–466.
"""
function auprc(scores::AbstractArray{Float64}, classes::AbstractArray{Symbol},
               pos_labels::Set{Symbol}; rev::Bool=true)

    num_scores = length(scores) + 1
    ordering = sortperm(scores, rev=rev)
    labels = classes[ordering]
    num_pos, num_neg = count(labels, pos_labels)

    tn, fn, tp, fp = 0, 0, num_pos, num_neg

    p = Array{Float64}(num_scores)
    r = Array{Float64}(num_scores)
    p[num_scores] = tp/(tp+fp)
    r[num_scores] = tp/(tp+fn)
    auprc, prev_r = 0.0, r[num_scores]
    pmin, pmax = p[num_scores], p[num_scores]

    # traverse scores from lowest to highest
    for i in num_scores-1:-1:1
        dtn = labels[i] in pos_labels ? 0 : 1
        tn += dtn
        fn += 1-dtn
        tp = num_pos - fn
        fp = num_neg - tn
        p[i] = (tp+fp) == 0 ? 1-dtn : tp/(tp+fp)
        r[i] = tp/(tp+fn)

        # update max precision observed for current recall value
        if r[i] == prev_r
            pmax = p[i]
        else
            pmin = p[i] # min precision is always at recall switch
            auprc += (pmin + pmax)/2*(prev_r - r[i])
            prev_r = r[i]
            pmax = p[i]
        end
    end
    auprc, p, r
end

"""
$(SIGNATURES)

Given `N` positive examples, computes the percentage of the top `N/2`
hits that are correct
"""
function venn(scores::AbstractArray{Float64}, classes::AbstractArray{Symbol},
              pos_labels::Set{Symbol}; rev::Bool=true)

    num_scores = length(scores)
    ordering = sortperm(scores, rev=rev)
    labels = classes[ordering]
    num_pos, num_neg = count(labels, pos_labels)

    n_venn = round(Int, num_pos/2)
    n_correct = 0

    for i in 1:n_venn
        (labels[i] in pos_labels) && (n_correct += 1)
    end
    n_correct/n_venn
end

"""
$(SIGNATURES)

Computes the noise in an experiment, where noise is defined to be the
standard deviation of log2 fold change in the negative controls. If more than 2
bins are used then the name of log2 fold change information can be provided to
differentiate between multiple log 2 fold changes.
"""
function noise(guide_data::DataFrame; log2fc_col=nothing)
    if log2fc_col == nothing
        log2fc_col=first(name for name in names(guide_data) if contains(string(name), "log2fc"))
    end
    negcontrols = guide_data[guide_data[:class] .== :negcontrol, log2fc_col]
    std(negcontrols)
end

"""
$(SIGNATURES)

Computes the signal in an experiment, where the experimental signal is
defined to be the average of signal of true hit genes. That value, the
true hit gene signal, is the average ratio of the log2 fold change for
a guide targeting a specific gene to the guide's theoretical phenotype.

```math
\\frac{1}{N_{true} \\times k} \\sum_{i=1}^{N_{true}} \\sum_{j=1}^k
\\frac{\\log_2 fc_{ij}}{\\text{theo phenotype}_{ij}}
```

where ``N_{true}`` is the number of true hit genes and ``k`` is the number of
genes.
"""
function signal(guide_data::DataFrame; log2fc_col=nothing)
    if log2fc_col == nothing
        log2fc_col=first(name for name in names(guide_data) if contains(string(name), "log2fc"))
    end
    true_hits = guide_data[(guide_data[:class] .!= :inactive) .& (guide_data[:class] .!= :negcontrol), :]
    signal_df = by(true_hits, [:gene, :class, :behavior]) do guides
        signal = guides[log2fc_col] ./ guides[:theo_phenotype]
        DataFrame(mean_signal = mean(signal[find(isfinite, signal)]))
    end
    median(abs.(signal_df[find(isfinite, signal_df[:mean_signal]), :mean_signal]))
end


text: abstract type PSIResults <: IS.Results end


text:
# Command: Refresh
"""
	refresh!(session::Session)

This command causes the browser to reload the page in the current top-level browsing context.
"""
function refresh!(session::Session)
    @unpack addr, id = session
    response =
        HTTP.post("$addr/session/$id/timeouts", [("Content-Type" => "application/json")])
    @assert response.status == 200
    nothing
end


text:
using GraphPlot
export aplot

function aplot(s, A::LightAutomaton)
    el = map(t -> symbol(s, t), transitions(A))
    if haskey(s.ext, :statelabels)
        gplot(A.G, nodelabel=s.ext[:statelabels], edgelabel=el)
    else
        gplot(A.G, edgelabel=el)
    end
end
function aplot(s, osa::OneStateAutomaton)
    A = LightAutomaton(1)
    for σ in 1:ntransitions(osa)
        add_transition!(A, 1, 1, σ)
    end
    aplot(s, A)
end
function aplot(s)
    aplot(s, s.automaton)
end


text:
# Note that this script can accept some limited command-line arguments, run
# `julia build_tarballs.jl --help` to see a usage message.
using BinaryBuilder, Pkg

name = "MDAL"
version = v"0.8.1"

# Collection of sources required to complete build
sources = [
    ArchiveSource("https://github.com/lutraconsulting/MDAL/archive/refs/tags/release-$version.tar.gz", "0051495aff910b05d04efa792925cce377920ee02a03a89fa45529fd96cd2953"),
    DirectorySource("./bundled")
]

# Bash recipe for building across all platforms
script = raw"""

cd $WORKSPACE/srcdir/MDAL-*

atomic_patch -p1 ${WORKSPACE}/srcdir/patches/rename-findsqlite-library.patch

CMAKE_FLAGS=(-DCMAKE_INSTALL_PREFIX=$prefix
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN}
-DCMAKE_BUILD_TYPE=Release
-DENABLE_TESTS=OFF
-DENABLE_COVERAGE=OFF
-DWITH_HDF5=OFF
-DWITH_GDAL=ON
-DWITH_XML=ON
-DWITH_SQLITE3=ON
-DBUILD_STATIC=OFF
-DBUILD_SHARED=ON
-DBUILD_TOOLS=OFF
-DBUILD_EXTERNAL_DRIVERS=OFF)

#NetCDF is the most restrictive dependency as far as platform availability, so we'll use it where applicable but disable it otherwise
if ! find ${libdir} -name "libnetcdf*.${dlext}" -exec false '{}' +; then
    CMAKE_FLAGS+=(-DWITH_NETCDF=ON)
else
    CMAKE_FLAGS+=(-DWITH_NETCDF=OFF)
fi

cmake . ${CMAKE_FLAGS[@]}
make -j${nproc}
make install

"""

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = expand_cxxstring_abis(supported_platforms())

# The products that we will ensure are always built
products = [
    LibraryProduct("libmdal", :libmdal)
]

# Dependencies that must be installed before this package can be built
dependencies = [
    Dependency(PackageSpec(name="GDAL_jll", uuid="a7073274-a066-55f0-b90d-d619367d196c"))
    Dependency(PackageSpec(name="XML2_jll", uuid="02c8fc9c-b97f-50b9-bbe4-9be30ff0a78a"))
    Dependency(PackageSpec(name="SQLite_jll", uuid="76ed43ae-9a5d-5a62-8c75-30186b810ce8"))
    Dependency(PackageSpec(name="NetCDF_jll", uuid="7243133f-43d8-5620-bbf4-c2c921802cf3"))
]

# Build the tarballs, and possibly a `build.jl` as well.
#GDAL uses a preferred of 6 so match that
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6", preferred_gcc_version = v"6")

max_stars_repo_name: sharanry/Yggdrasil

max_issues_repo_name: sharanry/Yggdrasil

max_forks_repo_name: sharanry/Yggdrasil


text:
using LowRankModels
import StatsBase: sample, WeightVec

# test ordistic loss

## generate data
srand(1);
m,n,k = 200,50,3;
kfit = k+1
d = 7; # number of levels
D = n*d;
# coordinates of covariates
X_real = randn(m,k)
# directions of observations
Y_real = randn(k,n)
# centers of measurement
T_real = sqrt(k)*randn(d,n) # notice x^T y has variance k, so this scales the thresholds in the same way
for j=1:n
	T_real[:,j] = sort(T_real[:,j])
end
# variance of measurement
sigmasq = 1

XY = X_real*Y_real;
A = zeros(Int, (m, n))
for i=1:m
	for j=1:n
		wv = WeightVec(Float64[exp(-(XY[i,j] - T_real[l,j])^2/sigmasq) for l in 1:d])
		l = sample(wv)
		A[i,j] = l
	end
end

# and the model
losses = fill(OrdisticLoss(d),n)
rx, ry = lastentry1(QuadReg(.01)), lastentry_unpenalized(QuadReg(.01));
glrm = GLRM(A,losses,rx,ry,kfit, scale=false, offset=false, X=randn(kfit,m), Y=randn(kfit,D));

# fit w/o initialization
p = Params(1, max_iter=10, abs_tol=0.0000001, min_stepsize=0.000001)
@time X,Y,ch = fit!(glrm, params=p);
XYh = X'*Y[:,1:d:D];
@show ch.objective
println("After fitting, parameters differ from true parameters by $(vecnorm(XY - XYh)/sqrt(prod(size(XY)))) in RMSE")
A_imputed = impute(glrm)
println("After fitting, $(sum(A_imputed .!= A) / prod(size(A))*100)\% of imputed entries are wrong")
println("After fitting, imputed entries are off by $(sum(abs(A_imputed - A)) / prod(size(A))*100)\% on average")
println("(Picking randomly, $((d-1)/d*100)\% of entries would be wrong.)\n")

# initialize
init_svd!(glrm)
XYh = glrm.X' * glrm.Y[:,1:d:D]
println("After initialization with the svd, parameters differ from true parameters by $(vecnorm(XY - XYh)/sqrt(prod(size(XY)))) in RMSE")
A_imputed = impute(glrm)
println("After initialization with the svd, $(sum(A_imputed .!= A) / prod(size(A))*100)\% of imputed entries are wrong")
println("After fitting, imputed entries are off by $(sum(abs(A_imputed - A)) / prod(size(A))*100)\% on average")
println("(Picking randomly, $((d-1)/d*100)\% of entries would be wrong.)\n")

# fit w/ initialization
p = Params(1, max_iter=10, abs_tol=0.0000001, min_stepsize=0.000001)
@time X,Y,ch = fit!(glrm, params=p);
XYh = X'*Y[:,1:d:D];
@show ch.objective
println("After fitting, parameters differ from true parameters by $(vecnorm(XY - XYh)/sqrt(prod(size(XY)))) in RMSE")
A_imputed = impute(glrm)
println("After fitting, $(sum(A_imputed .!= A) / prod(size(A))*100)\% of imputed entries are wrong")
println("After fitting, imputed entries are off by $(sum(abs(A_imputed - A)) / prod(size(A))*100)\% on average")
println("(Picking randomly, $((d-1)/d*100)\% of entries would be wrong.)\n")