maths.scm 287 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2013, 2014, 2015, 2016, 2019, 2020 Andreas Enge <andreas@enge.fr>
  3. ;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
  4. ;;; Copyright © 2014, 2016, 2017 John Darrington <jmd@gnu.org>
  5. ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Eric Bavier <bavier@posteo.net>
  6. ;;; Copyright © 2014 Federico Beffa <beffa@fbengineering.ch>
  7. ;;; Copyright © 2014 Mathieu Lirzin <mathieu.lirzin@openmailbox.org>
  8. ;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
  9. ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
  10. ;;; Copyright © 2015, 2018 Mark H Weaver <mhw@netris.org>
  11. ;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
  12. ;;; Copyright © 2015 Fabian Harfert <fhmgufs@web.de>
  13. ;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
  14. ;;; Copyright © 2016, 2018, 2020, 2021 Kei Kebreau <kkebreau@posteo.net>
  15. ;;; Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
  16. ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
  17. ;;; Copyright © 2016, 2017 Thomas Danckaert <post@thomasdanckaert.be>
  18. ;;; Copyright © 2017, 2018, 2019, 2020, 2021 Paul Garlick <pgarlick@tourbillion-technology.com>
  19. ;;; Copyright © 2017 Nikita <nikita@n0.is>
  20. ;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
  21. ;;; Copyright © 2017 Theodoros Foradis <theodoros@foradis.org>
  22. ;;; Copyright © 2017, 2019 Arun Isaac <arunisaac@systemreboot.net>
  23. ;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <me@tobias.gr>
  24. ;;; Copyright © 2017 Dave Love <me@fx@gnu.org>
  25. ;;; Copyright © 2018, 2019, 2020, 2021 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
  26. ;;; Copyright © 2018 Joshua Sierles, Nextjournal <joshua@nextjournal.com>
  27. ;;; Copyright © 2018 Nadya Voronova <voronovank@gmail.com>
  28. ;;; Copyright © 2018 Adam Massmann <massmannak@gmail.com>
  29. ;;; Copyright © 2018, 2020, 2021 Marius Bakke <marius@gnu.org>
  30. ;;; Copyright © 2018 Eric Brown <brown@fastmail.com>
  31. ;;; Copyright © 2018, 2021 Julien Lepiller <julien@lepiller.eu>
  32. ;;; Copyright © 2018 Amin Bandali <bandali@gnu.org>
  33. ;;; Copyright © 2019, 2021 Nicolas Goaziou <mail@nicolasgoaziou.fr>
  34. ;;; Copyright © 2019 Steve Sprang <scs@stevesprang.com>
  35. ;;; Copyright © 2019 Robert Smith <robertsmith@posteo.net>
  36. ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
  37. ;;; Copyright © 2020, 2021 Felix Gruber <felgru@posteo.net>
  38. ;;; Copyright © 2020 R Veera Kumar <vkor@vkten.in>
  39. ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
  40. ;;; Copyright © 2020 Nicolò Balzarotti <nicolo@nixo.xyz>
  41. ;;; Copyright © 2020 B. Wilson <elaexuotee@wilsonb.com>
  42. ;;; Copyright © 2020, 2021 Vinicius Monego <monego@posteo.net>
  43. ;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
  44. ;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
  45. ;;; Copyright © 2021 Gerd Heber <gerd.heber@gmail.com>
  46. ;;; Copyright © 2021 Franck Pérignon <franck.perignon@univ-grenoble-alpes.fr>
  47. ;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
  48. ;;; Copyright © 2021 Paul A. Patience <paul@apatience.com>
  49. ;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru>
  50. ;;; Copyright © 2021 Jean-Baptiste Volatier <jbv@pm.me>
  51. ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
  52. ;;;
  53. ;;; This file is part of GNU Guix.
  54. ;;;
  55. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  56. ;;; under the terms of the GNU General Public License as published by
  57. ;;; the Free Software Foundation; either version 3 of the License, or (at
  58. ;;; your option) any later version.
  59. ;;;
  60. ;;; GNU Guix is distributed in the hope that it will be useful, but
  61. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  62. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  63. ;;; GNU General Public License for more details.
  64. ;;;
  65. ;;; You should have received a copy of the GNU General Public License
  66. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  67. (define-module (gnu packages maths)
  68. #:use-module (ice-9 regex)
  69. #:use-module (ice-9 match)
  70. #:use-module (gnu packages)
  71. #:use-module ((guix licenses) #:prefix license:)
  72. #:use-module (guix packages)
  73. #:use-module (guix download)
  74. #:use-module (guix git-download)
  75. #:use-module (guix gexp)
  76. #:use-module (guix utils)
  77. #:use-module ((guix build utils) #:select (alist-replace))
  78. #:use-module (guix build-system cmake)
  79. #:use-module (guix build-system glib-or-gtk)
  80. #:use-module (guix build-system gnu)
  81. #:use-module (guix build-system ocaml)
  82. #:use-module (guix build-system python)
  83. #:use-module (guix build-system ruby)
  84. #:use-module (gnu packages algebra)
  85. #:use-module (gnu packages audio)
  86. #:use-module (gnu packages autotools)
  87. #:use-module (gnu packages base)
  88. #:use-module (gnu packages bash)
  89. #:use-module (gnu packages bison)
  90. #:use-module (gnu packages boost)
  91. #:use-module (gnu packages check)
  92. #:use-module (gnu packages cmake)
  93. #:use-module (gnu packages compression)
  94. #:use-module (gnu packages coq)
  95. #:use-module (gnu packages curl)
  96. #:use-module (gnu packages cyrus-sasl)
  97. #:use-module (gnu packages dbm)
  98. #:use-module (gnu packages documentation)
  99. #:use-module (gnu packages elf)
  100. #:use-module (gnu packages emacs)
  101. #:use-module (gnu packages file)
  102. #:use-module (gnu packages flex)
  103. #:use-module (gnu packages fltk)
  104. #:use-module (gnu packages fontutils)
  105. #:use-module (gnu packages gettext)
  106. #:use-module (gnu packages gcc)
  107. #:use-module (gnu packages gd)
  108. #:use-module (gnu packages ghostscript)
  109. #:use-module (gnu packages glib)
  110. #:use-module (gnu packages graphviz)
  111. #:use-module (gnu packages gtk)
  112. #:use-module (gnu packages icu4c)
  113. #:use-module (gnu packages image)
  114. #:use-module (gnu packages java)
  115. #:use-module (gnu packages less)
  116. #:use-module (gnu packages lisp)
  117. #:use-module (gnu packages linux)
  118. #:use-module (gnu packages llvm)
  119. #:use-module (gnu packages logging)
  120. #:use-module (gnu packages lua)
  121. #:use-module (gnu packages gnome)
  122. #:use-module (gnu packages guile)
  123. #:use-module (gnu packages xorg)
  124. #:use-module (gnu packages gl)
  125. #:use-module (gnu packages imagemagick)
  126. #:use-module (gnu packages m4)
  127. #:use-module (gnu packages mpi)
  128. #:use-module (gnu packages multiprecision)
  129. #:use-module (gnu packages ncurses)
  130. #:use-module (gnu packages netpbm)
  131. #:use-module (gnu packages ocaml)
  132. #:use-module (gnu packages onc-rpc)
  133. #:use-module (gnu packages parallel)
  134. #:use-module (gnu packages pcre)
  135. #:use-module (gnu packages popt)
  136. #:use-module (gnu packages perl)
  137. #:use-module (gnu packages pkg-config)
  138. #:use-module (gnu packages pulseaudio)
  139. #:use-module (gnu packages python)
  140. #:use-module (gnu packages python-web)
  141. #:use-module (gnu packages python-xyz)
  142. #:use-module (gnu packages qt)
  143. #:use-module (gnu packages readline)
  144. #:use-module (gnu packages ruby)
  145. #:use-module (gnu packages tbb)
  146. #:use-module (gnu packages scheme)
  147. #:use-module (gnu packages serialization)
  148. #:use-module (gnu packages shells)
  149. #:use-module (gnu packages sphinx)
  150. #:use-module (gnu packages tcl)
  151. #:use-module (gnu packages texinfo)
  152. #:use-module (gnu packages tex)
  153. #:use-module (gnu packages tls)
  154. #:use-module (gnu packages version-control)
  155. #:use-module (gnu packages wxwidgets)
  156. #:use-module (gnu packages xml)
  157. #:use-module (srfi srfi-1)
  158. #:use-module (srfi srfi-26))
  159. (define-public aris
  160. (package
  161. (name "aris")
  162. (version "2.2")
  163. (source (origin
  164. (method url-fetch)
  165. (uri (string-append "mirror://gnu/" name "/" name "-" version ".tar.gz"))
  166. (sha256 (base32
  167. "1q1887ryqdr9sn0522hc7p16kqwlxxyz5dkmma8ar2nxplhgll7q"))))
  168. (build-system gnu-build-system)
  169. (inputs `(("gtk+" ,gtk+)
  170. ("libxml2" ,libxml2)))
  171. (native-inputs `(("pkg-config" ,pkg-config)))
  172. (arguments
  173. `(#:configure-flags '("CFLAGS=-fcommon")))
  174. (synopsis "Natural deduction first-order logic interface")
  175. (description "Aris is a program for performing logical proofs. It supports
  176. propositional and predicate logic, as well as Boolean algebra and
  177. arithmetical logic. In addition to its predefined inference and equivalence
  178. rules, Aris also supports references to older proofs. Its use of standard
  179. logical symbols and its natural deduction interface make it easy to use for
  180. beginners.")
  181. (license license:gpl3+)
  182. (home-page "https://www.gnu.org/software/aris/")))
  183. (define-public bitwise
  184. (package
  185. (name "bitwise")
  186. (version "0.42")
  187. (source (origin
  188. (method url-fetch)
  189. (uri (string-append "https://github.com/mellowcandle/bitwise"
  190. "/releases/download/v" version
  191. "/bitwise-v" version ".tar.gz"))
  192. (sha256
  193. (base32 "1lniw4bsb5qs5ybf018qllf95pzixb1q3lvybzl4k3xz8zpkrm6k"))))
  194. (build-system gnu-build-system)
  195. (inputs
  196. `(("ncurses" ,ncurses)
  197. ("readline" ,readline)))
  198. (native-inputs
  199. `(("cunit" ,cunit)
  200. ("pkg-config" ,pkg-config)))
  201. (synopsis "Terminal based bit manipulator in ncurses")
  202. (description "Bitwise is a multi base interactive calculator supporting
  203. dynamic base conversion and bit manipulation. It's a handy tool for low level
  204. hackers, kernel developers and device drivers developers.
  205. Some of the features include:
  206. @itemize
  207. @item Interactive ncurses interface.
  208. @item Command line calculator supporting all bitwise operations.
  209. @item Individual bit manipulator.
  210. @item Bitwise operations such as NOT, OR, AND, XOR, and shifts.
  211. @end itemize")
  212. (license license:gpl3+)
  213. (home-page "https://github.com/mellowcandle/bitwise/")))
  214. (define-public c-graph
  215. (package
  216. (name "c-graph")
  217. (version "2.0.1")
  218. (source (origin
  219. (method url-fetch)
  220. (uri (string-append "mirror://gnu/c-graph/c-graph-" version
  221. ".tar.gz"))
  222. (sha256 (base32
  223. "092412jzxy6wdvpk96pfj499hpmaww8xllavbvlqspfpr7ips9id"))))
  224. (build-system gnu-build-system)
  225. (inputs
  226. `(("fortran" ,gfortran)))
  227. (synopsis "Visualizing and demonstrating convolution")
  228. (description
  229. "GNU C-Graph is a tool for demonstrating the theory of convolution.
  230. Thus, it can serve as an excellent aid to students of signal and systems
  231. theory in visualizing the convolution process. Rather than forcing the
  232. student to write code, the program offers an intuitive interface with
  233. interactive dialogs to guide them.")
  234. (license license:gpl3+)
  235. (home-page "https://www.gnu.org/software/c-graph/")))
  236. (define-public coda
  237. (package
  238. (name "coda")
  239. (version "2.19")
  240. (source
  241. (origin
  242. (method url-fetch)
  243. (uri (string-append "https://github.com/stcorp/coda/releases/download/"
  244. version "/coda-" version ".tar.gz"))
  245. (sha256
  246. (base32 "1fbxd2afm7dshd92p10yy8dwbr9gc1h1fmnnnmr7d0c5lnw80245"))
  247. (patches (search-patches "coda-use-system-libs.patch"))
  248. (modules '((guix build utils)))
  249. (snippet
  250. ;; Make sure we don't use the bundled software.
  251. '(begin
  252. (for-each (lambda (d)
  253. (delete-file-recursively (string-append "libcoda/" d)))
  254. '("zlib" "pcre" "expat"))
  255. #t))))
  256. (native-inputs
  257. `(("fortran" ,gfortran)
  258. ("python" ,python)
  259. ("python-numpy" ,python-numpy)))
  260. (inputs
  261. `(("zlib" ,zlib)
  262. ("pcre" ,pcre)
  263. ("expat" ,expat)
  264. ("hdf4" ,hdf4-alt)
  265. ("hdf5" ,hdf5)))
  266. (build-system gnu-build-system)
  267. (arguments
  268. '(#:configure-flags '("--with-hdf4" "--with-hdf5" "--enable-python"
  269. "LIBS= -lz -lpcre -lexpat")))
  270. (synopsis "A common interface to various earth observation data formats")
  271. (description
  272. "The Common Data Access toolbox (CODA) provides a set of interfaces for
  273. reading remote sensing data from earth observation data files. It consists of
  274. command line applications and interfaces to the C, Fortran, Python, and Java
  275. programming languages.")
  276. (home-page "https://stcorp.nl/coda")
  277. (license license:gpl2+)))
  278. (define-public qhull
  279. (package
  280. (name "qhull")
  281. (version "2020.2")
  282. (source (origin
  283. (method url-fetch)
  284. (uri (string-append "http://www.qhull.org/download/qhull-"
  285. (car (string-split version #\.))
  286. "-src-8.0.2.tgz"))
  287. (sha256
  288. (base32
  289. "0zlbhg0lb6j60188c2xhcrvviskr079552icjldqhy1jhgmxghmm"))))
  290. (build-system cmake-build-system)
  291. (arguments
  292. `(#:configure-flags '("-DLINK_APPS_SHARED=ON"
  293. "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")))
  294. (synopsis "Calculate convex hulls and related structures")
  295. (description
  296. "@code{Qhull} computes the convex hull, Delaunay triangulation, Voronoi
  297. diagram, halfspace intersection about a point, furthest-site Delaunay
  298. triangulation, and furthest-site Voronoi diagram. The source code runs in 2-d,
  299. 3-d, 4-d, and higher dimensions. @code{Qhull} implements the Quickhull
  300. algorithm for computing the convex hull. It handles roundoff errors from
  301. floating point arithmetic. It computes volumes, surface areas, and
  302. approximations to the convex hull.
  303. @code{Qhull} does not support triangulation of non-convex surfaces, mesh
  304. generation of non-convex objects, medium-sized inputs in 9-D and higher, alpha
  305. shapes, weighted Voronoi diagrams, Voronoi volumes, or constrained Delaunay
  306. triangulations.")
  307. (home-page "http://qhull.org")
  308. (license (license:non-copyleft "file://COPYING.txt"
  309. "See COPYING in the distribution."))))
  310. (define-public python-cvxopt
  311. (package
  312. (name "python-cvxopt")
  313. (version "1.2.3")
  314. (source (origin
  315. (method git-fetch)
  316. (uri (git-reference
  317. (url "https://github.com/cvxopt/cvxopt")
  318. (commit version)))
  319. (file-name (git-file-name name version))
  320. (sha256
  321. (base32
  322. "1kiy2m62xgs2d5id6dnnwy4vap85cd70p7pgkb9nh23qf9xnak7b"))))
  323. (build-system python-build-system)
  324. (arguments
  325. `(#:phases
  326. (modify-phases %standard-phases
  327. (add-after 'unpack 'find-libraries
  328. (lambda* (#:key inputs #:allow-other-keys)
  329. (setenv "CVXOPT_BLAS_LIB" "openblas")
  330. (setenv "CVXOPT_BUILD_FFTW" "1")
  331. (setenv "CVXOPT_BUILD_GLPK" "1")
  332. (setenv "CVXOPT_BUILD_GSL" "1")
  333. #t)))))
  334. (inputs
  335. `(("fftw" ,fftw)
  336. ("glpk" ,glpk)
  337. ("gsl" ,gsl)
  338. ("lapack" ,lapack)
  339. ("openblas" ,openblas)
  340. ("suitesparse" ,suitesparse)))
  341. (home-page "https://www.cvxopt.org")
  342. (synopsis "Python library for convex optimization")
  343. (description
  344. "CVXOPT is a package for convex optimization based on the Python
  345. programming language. Its main purpose is to make the development of software
  346. for convex optimization applications straightforward by building on Python’s
  347. extensive standard library and on the strengths of Python as a high-level
  348. programming language.")
  349. (license license:gpl3+)))
  350. (define-public python2-cvxopt
  351. (package-with-python2 python-cvxopt))
  352. (define-public units
  353. (package
  354. (name "units")
  355. (version "2.21")
  356. (source (origin
  357. (method url-fetch)
  358. (uri (string-append "mirror://gnu/units/units-" version
  359. ".tar.gz"))
  360. (sha256 (base32
  361. "1bybhqs4yrly9myb5maz3kdmf8k4fhk2m1d5cbcryn40z6lq0gkc"))))
  362. (build-system gnu-build-system)
  363. (inputs
  364. `(("readline" ,readline)
  365. ("python" ,python-wrapper) ;for 'units_cur' script
  366. ("python-requests" ,python-requests)))
  367. (arguments
  368. `(#:phases (modify-phases %standard-phases
  369. (add-after 'install 'wrap-units_cur
  370. (lambda* (#:key outputs #:allow-other-keys)
  371. (let* ((out (assoc-ref outputs "out"))
  372. (bin (string-append out "/bin")))
  373. (wrap-program (string-append bin "/units_cur")
  374. `("GUIX_PYTHONPATH" ":" prefix
  375. ,(search-path-as-string->list (getenv "GUIX_PYTHONPATH"))))
  376. #t))))))
  377. (synopsis "Conversion between thousands of scales")
  378. (description
  379. "GNU Units converts numeric quantities between units of measure. It
  380. can handle scale changes through adaptive usage of standard scale
  381. prefixes (micro-, kilo-, etc.). It can also handle nonlinear
  382. conversions such as Fahrenheit to Celsius. Its interpreter is powerful
  383. enough to be used effectively as a scientific calculator.")
  384. (license license:gpl3+)
  385. (home-page "https://www.gnu.org/software/units/")))
  386. (define-public double-conversion
  387. (package
  388. (name "double-conversion")
  389. (version "3.1.5")
  390. (home-page "https://github.com/google/double-conversion")
  391. (source (origin
  392. (method git-fetch)
  393. (uri (git-reference (url home-page)
  394. (commit (string-append "v" version))))
  395. (file-name (git-file-name name version))
  396. (sha256
  397. (base32
  398. "0csy4pjw1p8rp6g5qxi2h0ychhhp1fldv7gb761627fs2mclw9gv"))))
  399. (build-system cmake-build-system)
  400. (arguments
  401. '(#:test-target "test"
  402. #:configure-flags '("-DBUILD_SHARED_LIBS=ON"
  403. "-DBUILD_TESTING=ON")))
  404. (synopsis "Conversion routines for IEEE doubles")
  405. (description
  406. "The double-conversion library provides binary-decimal and decimal-binary
  407. routines for IEEE doubles. The library consists of efficient conversion
  408. routines that have been extracted from the V8 JavaScript engine.")
  409. (license license:bsd-3)))
  410. (define-public dionysus
  411. (package
  412. (name "dionysus")
  413. (version "1.4.0")
  414. (source (origin
  415. (method url-fetch)
  416. (uri (string-append "mirror://gnu/dionysus/dionysus-" version
  417. ".tar.xz"))
  418. (sha256
  419. (base32
  420. "194pzs1mlsj4ww6v37qq3961h5hckm5h805cv0r14xj3g9wfx2sk"))))
  421. (build-system gnu-build-system)
  422. (inputs `(("tcl" ,tcl))) ;for 'tclsh'
  423. (synopsis "Local search for universal constants and scientific values")
  424. (description
  425. "GNU Dionysus is a convenient system for quickly retrieving the values of
  426. mathematical constants used in science and engineering. Values can be
  427. searched using a simple command-line tool, choosing from three databases:
  428. universal constants, atomic numbers, and constants related to
  429. semiconductors.")
  430. (license license:gpl3+)
  431. (home-page "https://www.gnu.org/software/dionysus/")))
  432. (define-public dsfmt
  433. (package
  434. (name "dsfmt")
  435. (version "2.2.3")
  436. (source
  437. (origin
  438. (method url-fetch)
  439. (uri
  440. (string-append
  441. "http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/"
  442. "dSFMT-src-" version ".tar.gz"))
  443. (sha256
  444. (base32
  445. "03kaqbjbi6viz0n33dk5jlf6ayxqlsq4804n7kwkndiga9s4hd42"))
  446. (modules '((guix build utils)))
  447. ;; Don't distribute html documentation with bundled jquery.
  448. (snippet
  449. '(begin
  450. (delete-file-recursively "html") #t))
  451. ;; Add patches borrowed from Julia.
  452. (patches
  453. (list
  454. (origin
  455. (method url-fetch)
  456. (uri (string-append
  457. "https://raw.githubusercontent.com/JuliaLang/julia/"
  458. "v1.3.0/deps/patches/dSFMT.c.patch"))
  459. (sha256 (base32
  460. "09mhv11bms8jsmkmdqvlcgljwhzw3b6n9nncpi2b6dla9798hw2y"))
  461. (file-name "dSFMT.c.patch"))
  462. (origin
  463. (method url-fetch)
  464. (uri (string-append
  465. "https://raw.githubusercontent.com/JuliaLang/julia/"
  466. "v1.3.0/deps/patches/dSFMT.h.patch"))
  467. (sha256 (base32
  468. "1py5rd0yxic335lzka23f6x2dhncrpizpyrk57gi2f28c0p98y5n"))
  469. (file-name "dSFMT.h.patch"))))))
  470. (build-system gnu-build-system)
  471. (arguments
  472. `(#:phases
  473. (modify-phases %standard-phases
  474. (delete 'configure) ; no configure script
  475. (replace 'build
  476. ;; Upstream Makefile does not build a shared library. Borrow from Julia
  477. ;; https://github.com/JuliaLang/julia/blob/v1.3.0/deps/dsfmt.mk
  478. (lambda _
  479. (invoke
  480. "gcc" "-DNDEBUG" "-DDSFMT_MEXP=19937"
  481. "-fPIC" "-DDSFMT_DO_NOT_USE_OLD_NAMES"
  482. "-O3" "-finline-functions" "-fomit-frame-pointer"
  483. "-fno-strict-aliasing" "--param" "max-inline-insns-single=1800"
  484. "-Wmissing-prototypes" "-Wall" "-std=c99" "-shared" "dSFMT.c"
  485. "-o" "libdSFMT.so")))
  486. (replace 'install ; no "install" target
  487. (lambda* (#:key outputs #:allow-other-keys)
  488. (let* ((out (assoc-ref outputs "out"))
  489. (lib (string-append out "/lib"))
  490. (inc (string-append out "/include"))
  491. (doc (string-append out "/share/doc/" ,name "-" ,version)))
  492. (install-file "libdSFMT.so" lib)
  493. (install-file "dSFMT.h" inc)
  494. (install-file "LICENSE.txt" doc)
  495. #t))))))
  496. (synopsis "Double precision SIMD-oriented Fast Mersenne Twister")
  497. (description
  498. "The dSMFT package speeds up Fast Mersenne Twister generation by avoiding
  499. the expensive conversion of integer to double (floating point). dSFMT directly
  500. generates double precision floating point pseudorandom numbers which have the
  501. IEEE Standard for Binary Floating-Point Arithmetic (ANSI/IEEE Std 754-1985)
  502. format. dSFMT is only available on the CPUs which use IEEE 754 format double
  503. precision floating point numbers.")
  504. (home-page "http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/")
  505. (license license:bsd-3)))
  506. (define-public gsl
  507. (package
  508. (name "gsl")
  509. (version "2.7")
  510. (source (origin
  511. (method url-fetch)
  512. (uri (string-append "mirror://gnu/gsl/gsl-"
  513. version ".tar.gz"))
  514. (sha256
  515. (base32
  516. "0av04cpblphvvs3kl5rwphniarml503501vrpqw31rd0bmwg7fzg"))))
  517. (build-system gnu-build-system)
  518. (arguments
  519. (let ((system (%current-system)))
  520. `(#:configure-flags (list "--disable-static") ;halves package size
  521. #:phases
  522. (modify-phases %standard-phases
  523. ,@(cond
  524. ((or (string-prefix? "aarch64" system)
  525. (string-prefix? "powerpc" system))
  526. ;; Some sparse matrix tests are failing on AArch64 and PowerPC:
  527. ;; https://lists.gnu.org/archive/html/bug-gsl/2020-04/msg00001.html
  528. '((add-before 'check 'disable-failing-tests
  529. (lambda _
  530. (substitute* "spmatrix/test.c"
  531. ((".*test_complex.*") "\n"))))))
  532. ((string-prefix? "i686" system)
  533. ;; There are rounding issues with these tests on i686:
  534. ;; https://lists.gnu.org/archive/html/bug-gsl/2016-10/msg00000.html
  535. ;; https://lists.gnu.org/archive/html/bug-gsl/2020-04/msg00000.html
  536. '((add-before 'check 'disable-failing-tests
  537. (lambda _
  538. (substitute* "linalg/test.c"
  539. ((".*gsl_test\\(test_LU_decomp.*") "\n")
  540. ((".*gsl_test\\(test_LUc_decomp.*") "\n")
  541. ((".*gsl_test\\(test_QR_decomp_r.*") "\n")
  542. ((".*gsl_test\\(test_cholesky_decomp.*") "\n")
  543. ((".*gsl_test\\(test_pcholesky_solve.*") "\n")
  544. ((".*gsl_test\\(test_COD_lssolve2.*") "\n"))
  545. (substitute* "spmatrix/test.c"
  546. ((".*test_all.*") "\n")
  547. ((".*test_float.*") "\n")
  548. ((".*test_complex.*") "\n"))
  549. ;; XXX: These tests abort with:
  550. ;; gsl: cholesky.c:645: ERROR: matrix is not positive definite
  551. (substitute* '("multifit_nlinear/test.c"
  552. "multilarge_nlinear/test.c")
  553. (("gsl_ieee_env_setup.*" all)
  554. (string-append "exit (77);\n" all)))))))
  555. (else '()))))))
  556. (home-page "https://www.gnu.org/software/gsl/")
  557. (synopsis "Numerical library for C and C++")
  558. (description
  559. "The GNU Scientific Library is a library for numerical analysis in C
  560. and C++. It includes a wide range of mathematical routines, with over 1000
  561. functions in total. Subject areas covered by the library include:
  562. differential equations, linear algebra, Fast Fourier Transforms and random
  563. numbers.")
  564. (license license:gpl3+)))
  565. (define-public sleef
  566. (package
  567. (name "sleef")
  568. (version "3.5.1")
  569. (source
  570. (origin
  571. (method git-fetch)
  572. (uri (git-reference
  573. (url "https://github.com/shibatch/sleef")
  574. (commit version)))
  575. (file-name (git-file-name name version))
  576. (sha256
  577. (base32 "1jybqrl2dvjxzg30xrhh847s375n2jr1pix644wi6hb5wh5mx3f7"))))
  578. (build-system cmake-build-system)
  579. (arguments
  580. '(#:configure-flags (list "-DCMAKE_BUILD_TYPE=Release"
  581. (string-append "-DCMAKE_INSTALL_LIBDIR="
  582. (assoc-ref %outputs "out")
  583. "/lib")
  584. (string-append "-DCMAKE_INSTALL_PREFIX="
  585. (assoc-ref %outputs "out")))
  586. #:phases
  587. (modify-phases %standard-phases
  588. ;; SLEEF generates a header library during the build process and writes
  589. ;; to it via shell redirection. Make the checkout writable so the
  590. ;; build can succeed.
  591. (add-after 'unpack 'make-git-checkout-writable
  592. (lambda _
  593. (for-each make-file-writable (find-files "."))
  594. #t)))))
  595. (inputs
  596. `(("fftw" ,fftw)
  597. ("gmp" ,gmp)
  598. ("mpfr" ,mpfr)
  599. ("openssl" ,openssl)))
  600. (home-page "https://sleef.org/")
  601. (synopsis "SIMD library for evaluating elementary functions and DFT")
  602. (description
  603. "SLEEF (SIMD Library for Evaluating Elementary Functions) is a library that
  604. implements vectorized versions of all C99 real floating point math functions.
  605. It can utilize SIMD instructions that are available on modern processors.")
  606. (license (list license:boost1.0 ;sleef
  607. license:cc-by4.0)))) ;simplex algorithm
  608. (define-public glpk
  609. (package
  610. (name "glpk")
  611. (version "5.0")
  612. (source
  613. (origin
  614. (method url-fetch)
  615. (uri (string-append "mirror://gnu/glpk/glpk-"
  616. version ".tar.gz"))
  617. (sha256
  618. (base32
  619. "05bgxidxj8d9xdp82niy7cy36w181cxq7p8vc3y2ixshpgp1642a"))))
  620. (build-system gnu-build-system)
  621. (inputs
  622. `(("gmp" ,gmp)))
  623. (arguments
  624. `(#:configure-flags '("--with-gmp"
  625. "--disable-static")))
  626. (home-page "https://www.gnu.org/software/glpk/")
  627. (synopsis "GNU Linear Programming Kit, supporting the MathProg language")
  628. (description
  629. "GLPK is a C library for solving large-scale linear programming (LP),
  630. mixed integer programming (MIP), and other related problems. It supports the
  631. GNU MathProg modeling language, a subset of the AMPL language, and features a
  632. translator for the language. In addition to the C library, a stand-alone
  633. LP/MIP solver is included in the package.")
  634. (license license:gpl3+)))
  635. (define-public glpk-4
  636. (package
  637. (inherit glpk)
  638. (name "glpk")
  639. (version "4.65")
  640. (source
  641. (origin
  642. (method url-fetch)
  643. (uri (string-append "mirror://gnu/glpk/glpk-"
  644. version ".tar.gz"))
  645. (sha256
  646. (base32
  647. "040sfaa9jclg2nqdh83w71sv9rc1sznpnfiripjdyr48cady50a2"))))))
  648. (define-public 4ti2
  649. (package
  650. (name "4ti2")
  651. (version "1.6.9")
  652. (source
  653. (origin
  654. (method url-fetch)
  655. (uri (string-append "https://github.com/4ti2/4ti2/releases/download/"
  656. "Release_"
  657. (string-map (lambda (c) (if (char=? c #\.) #\_ c))
  658. version)
  659. "/4ti2-" version ".tar.gz"))
  660. (sha256
  661. (base32 "0rj92x6p9m3la5gasjbj7sa569im527ffmka5y2sv1amgd3fflrh"))))
  662. (build-system gnu-build-system)
  663. (native-inputs
  664. `(("which" ,(@ (gnu packages base) which)))) ; for the tests
  665. (inputs
  666. `(("glpk" ,glpk)
  667. ("gmp" ,gmp)))
  668. (home-page "http://www.4ti2.de/")
  669. (synopsis "Mathematical tool suite for problems on linear spaces")
  670. (description
  671. "4ti2 implements algorithms for solving algebraic, geometric and
  672. combinatorial problems on linear spaces. Among others, it solves systems
  673. of linear equations, computes extreme rays of polyhedral cones, solves
  674. integer programming problems and computes Markov bases for statistics.")
  675. (license license:gpl2+)))
  676. (define-public cddlib
  677. (package
  678. (name "cddlib")
  679. (version "0.94i")
  680. (source
  681. (origin
  682. (method url-fetch)
  683. (uri (string-append "ftp://ftp.math.ethz.ch/users/fukudak/cdd/cddlib-"
  684. (string-delete #\. version) ".tar.gz"))
  685. (sha256
  686. (base32
  687. "00zdgiqb91vx6gd2103h3ijij0llspsxc6zz3iw2bll39fvkl4xq"))))
  688. (build-system gnu-build-system)
  689. (inputs
  690. `(("gmp" ,gmp)))
  691. (home-page "https://www.inf.ethz.ch/personal/fukudak/cdd_home/index.html")
  692. (synopsis "Library for convex hulls and extreme rays of polyhedra")
  693. (description
  694. "The C-library cddlib implements the Double Description Method of
  695. Motzkin et al. for generating all vertices (i.e. extreme points) and extreme
  696. rays of a general convex polyhedron given by a system of linear inequalities
  697. in arbitrary dimension. It can also be used for the converse operation of
  698. computing convex hulls.")
  699. (license license:gpl2+)))
  700. (define-public lrslib
  701. (package
  702. (name "lrslib")
  703. (version "7.1")
  704. (source
  705. (origin
  706. (method url-fetch)
  707. (uri (string-append "http://cgm.cs.mcgill.ca/~avis/C/lrslib/archive/"
  708. "lrslib-0"
  709. (string-delete #\. version) ".tar.gz"))
  710. (sha256
  711. (base32
  712. "05kq3hzam31dlmkccv3v358r478kpvx76mw37ka12c6ypwv5dsnk"))))
  713. (build-system gnu-build-system)
  714. (inputs
  715. `(("gmp" ,gmp)))
  716. (arguments
  717. `(#:tests? #f ; no check phase
  718. #:make-flags `("CC=gcc"
  719. ,(string-append "prefix=" (assoc-ref %outputs "out"))
  720. "all-shared")
  721. #:phases
  722. (modify-phases %standard-phases
  723. (replace 'configure
  724. (lambda _
  725. (substitute* "makefile"
  726. (("-L \\.") "-L . -Wl,-rpath='$$ORIGIN/../lib'"))
  727. #t)))))
  728. (home-page "http://cgm.cs.mcgill.ca/~avis/C/lrs.html")
  729. (synopsis "Convex hulls of polyhedra with exact arithmetic")
  730. (description
  731. "The C code of lrslib implements the reverse search algorithm for
  732. vertex enumeration and convex hull problems. Its input file format is
  733. compatible with cddlib. All computations are done exactly in either
  734. multiple precision or fixed integer arithmetic. Output is not stored
  735. in memory, so even problems with very large output sizes can sometimes
  736. be solved.")
  737. (license license:gpl2+)))
  738. (define-public libcerf
  739. (package
  740. (name "libcerf")
  741. (version "1.14")
  742. (source
  743. (origin
  744. (method git-fetch)
  745. (uri (git-reference
  746. (url "https://jugit.fz-juelich.de/mlz/libcerf")
  747. (commit (string-append "v" version))))
  748. (file-name (git-file-name name version))
  749. (sha256
  750. (base32 "1ic2q7kvxpqmgxlishygvx8d00i4wn51vkq4fyac44ahhf6c3kwd"))))
  751. (build-system cmake-build-system)
  752. (native-inputs
  753. `(("perl" ,perl)))
  754. (home-page "https://jugit.fz-juelich.de/mlz/libcerf")
  755. (synopsis "Library for complex error functions")
  756. (description
  757. "@code{libcerf} is a self-contained numeric library that provides an
  758. efficient and accurate implementation of complex error functions, along with
  759. Dawson, Faddeeva, and Voigt functions.")
  760. (license license:expat)))
  761. (define-public vinci
  762. (package
  763. (name "vinci")
  764. (version "1.0.5")
  765. (source
  766. (origin
  767. (method url-fetch)
  768. (uri (string-append "https://www.math.u-bordeaux.fr/~aenge/software/"
  769. "vinci/vinci-" version ".tar.gz"))
  770. (sha256
  771. (base32
  772. "1aq0qc1y27iw9grhgnyji3290wwfznsrk3sg6ynqpxwjdda53h4m"))))
  773. (build-system gnu-build-system)
  774. (inputs
  775. `(("lrslib" ,lrslib)))
  776. (arguments
  777. `(#:tests? #f ; no check phase
  778. #:phases
  779. (modify-phases %standard-phases
  780. (replace 'configure
  781. ;; register the lrs location in the config file
  782. (lambda* (#:key inputs #:allow-other-keys)
  783. (let* ((lrs (assoc-ref inputs "lrslib"))
  784. (lrsexec (string-append lrs "/bin/lrs")))
  785. (substitute* "vinci.h"
  786. (("#define LRS_EXEC \"lrs\"")
  787. (string-append "#define LRS_EXEC \"" lrsexec "\""))))
  788. #t))
  789. (replace 'install
  790. (lambda* (#:key outputs #:allow-other-keys)
  791. (let* ((out (assoc-ref outputs "out"))
  792. (bin (string-append out "/bin")))
  793. (install-file "vinci" bin))
  794. #t)))))
  795. (home-page
  796. "https://www.math.u-bordeaux.fr/~aenge/?category=software&page=vinci")
  797. (synopsis "Volume computation for polytopes")
  798. (description
  799. "Vinci implements a number of volume computation algorithms for convex
  800. polytopes in arbitrary dimension. The polytopes can be given by their
  801. V-representation (as the convex hull of a finite number of vertices), by
  802. their H-representation (as the bounded intersection of a finite number of
  803. halfspaces) or by their double description with both representations.")
  804. (license license:gpl2+)))
  805. (define-public arpack-ng
  806. (package
  807. (name "arpack-ng")
  808. (version "3.8.0")
  809. (home-page "https://github.com/opencollab/arpack-ng")
  810. (source (origin
  811. (method git-fetch)
  812. (uri (git-reference (url home-page) (commit version)))
  813. (file-name (git-file-name name version))
  814. (sha256
  815. (base32
  816. "0l7as5z6xvbxly8alam9s4kws70952qq35a6vkljzayi4b9gbklx"))))
  817. (build-system gnu-build-system)
  818. (native-inputs
  819. `(("autoconf" ,autoconf)
  820. ("automake" ,automake)
  821. ("libtool" ,libtool)
  822. ("pkg-config" ,pkg-config)))
  823. (inputs
  824. `(("eigen" ,eigen)
  825. ("lapack" ,lapack)
  826. ("fortran" ,gfortran)))
  827. (synopsis "Fortran subroutines for solving eigenvalue problems")
  828. (description
  829. "ARPACK-NG is a collection of Fortran77 subroutines designed to solve
  830. large scale eigenvalue problems.")
  831. (license (license:non-copyleft "file://COPYING"
  832. "See COPYING in the distribution."))))
  833. (define-public arpack-ng-3.3.0
  834. (package
  835. (inherit arpack-ng)
  836. (version "3.3.0")
  837. (source
  838. (origin
  839. (method git-fetch)
  840. (uri (git-reference (url (package-home-page arpack-ng))
  841. (commit version)))
  842. (file-name (git-file-name (package-name arpack-ng) version))
  843. (sha256
  844. (base32
  845. "00h6bjvxjq7bv0b8pwnc0gw33ns6brlqv00xx2rh3w9b5n205918"))))))
  846. (define-public arpack-ng-openmpi
  847. (package (inherit arpack-ng)
  848. (name "arpack-ng-openmpi")
  849. (inputs
  850. `(("mpi" ,openmpi)
  851. ,@(package-inputs arpack-ng)))
  852. (arguments
  853. (substitute-keyword-arguments (package-arguments arpack-ng)
  854. ((#:configure-flags _ '())
  855. ''("--enable-mpi"))
  856. ((#:phases phases '%standard-phases)
  857. `(modify-phases ,phases
  858. (add-before 'check 'mpi-setup
  859. ,%openmpi-setup)))))
  860. (synopsis "Fortran subroutines for solving eigenvalue problems with MPI")))
  861. (define-public lapack
  862. (package
  863. (name "lapack")
  864. (version "3.9.0")
  865. (source
  866. (origin
  867. (method url-fetch)
  868. (uri (string-append "http://www.netlib.org/lapack/lapack-"
  869. version ".tgz"))
  870. (sha256
  871. (base32
  872. "1155qixp26c12yrxc76z9mlfw2h3xxymxxv5znpgzh5gaykpndgj"))))
  873. (build-system cmake-build-system)
  874. (home-page "http://www.netlib.org/lapack/")
  875. (inputs `(("fortran" ,gfortran)
  876. ("python" ,python-wrapper)))
  877. (arguments
  878. `(#:configure-flags (list
  879. "-DBUILD_SHARED_LIBS:BOOL=YES"
  880. "-DLAPACKE=ON"
  881. ;; Build the 'LAPACKE_clatms' functions.
  882. "-DLAPACKE_WITH_TMG=ON"
  883. "-DBUILD_TESTING=ON")))
  884. (synopsis "Library for numerical linear algebra")
  885. (description
  886. "LAPACK is a Fortran 90 library for solving the most commonly occurring
  887. problems in numerical linear algebra.")
  888. (license (license:non-copyleft "file://LICENSE"
  889. "See LICENSE in the distribution."))))
  890. (define-public clapack
  891. (package
  892. (name "clapack")
  893. (version "3.2.1")
  894. (source
  895. (origin
  896. (method url-fetch)
  897. (uri (string-append "http://www.netlib.org/clapack/clapack-"
  898. version "-CMAKE.tgz"))
  899. (sha256
  900. (base32
  901. "0nnap9q1mv14g57dl3vkvxrdr10k5w7zzyxs6rgxhia8q8mphgqb"))))
  902. (build-system cmake-build-system)
  903. (arguments
  904. `(#:phases
  905. (modify-phases %standard-phases
  906. ;; These tests use a lot of stack variables and segfault without
  907. ;; lifting resource limits.
  908. (add-after 'unpack 'disable-broken-tests
  909. (lambda _
  910. (substitute* "TESTING/CMakeLists.txt"
  911. (("add_lapack_test.* xeigtstz\\)") ""))
  912. #t))
  913. (replace 'install
  914. (lambda* (#:key outputs #:allow-other-keys)
  915. (let* ((out (assoc-ref outputs "out"))
  916. (libdir (string-append out "/lib"))
  917. (f2cinc (string-append out "/include/libf2c")))
  918. (mkdir-p f2cinc)
  919. (display (getcwd))
  920. (for-each (lambda (file)
  921. (install-file file libdir))
  922. '("SRC/liblapack.a"
  923. "F2CLIBS/libf2c/libf2c.a"
  924. "TESTING/MATGEN/libtmglib.a"
  925. "BLAS/SRC/libblas.a"))
  926. (for-each (lambda (file)
  927. (install-file file f2cinc))
  928. (cons "F2CLIBS/libf2c/arith.h"
  929. (find-files (string-append "../clapack-"
  930. ,version "-CMAKE/F2CLIBS/libf2c")
  931. "\\.h$")))
  932. (copy-recursively (string-append "../clapack-"
  933. ,version "-CMAKE/INCLUDE")
  934. (string-append out "/include"))
  935. #t))))))
  936. (home-page "https://www.netlib.org/clapack/")
  937. (synopsis "Numerical linear algebra library for C")
  938. (description
  939. "The CLAPACK library was built using a Fortran to C conversion utility
  940. called f2c. The entire Fortran 77 LAPACK library is run through f2c to obtain
  941. C code, and then modified to improve readability. CLAPACK's goal is to
  942. provide LAPACK for someone who does not have access to a Fortran compiler.")
  943. (license (license:non-copyleft "file://LICENSE"
  944. "See LICENSE in the distribution."))))
  945. (define-public scalapack
  946. (package
  947. (name "scalapack")
  948. (version "2.0.2")
  949. (source
  950. (origin
  951. (method url-fetch)
  952. (uri (string-append "http://www.netlib.org/scalapack/scalapack-"
  953. version ".tgz"))
  954. (sha256
  955. (base32
  956. "0p1r61ss1fq0bs8ynnx7xq4wwsdvs32ljvwjnx6yxr8gd6pawx0c"))
  957. (patches (search-patches "scalapack-blacs-mpi-deprecations.patch"))))
  958. (build-system cmake-build-system)
  959. (inputs
  960. `(("mpi" ,openmpi)
  961. ("fortran" ,gfortran)
  962. ("lapack" ,lapack))) ;for testing only
  963. (arguments
  964. `(#:configure-flags `("-DBUILD_SHARED_LIBS:BOOL=YES")
  965. #:phases (modify-phases %standard-phases
  966. (add-before 'check 'mpi-setup
  967. ,%openmpi-setup))))
  968. (home-page "http://www.netlib.org/scalapack/")
  969. (synopsis "Library for scalable numerical linear algebra")
  970. (description
  971. "ScaLAPACK is a Fortran 90 library of high-performance linear algebra
  972. routines on parallel distributed memory machines. ScaLAPACK solves dense and
  973. banded linear systems, least squares problems, eigenvalue problems, and
  974. singular value problems.")
  975. (license (license:non-copyleft "file://LICENSE"
  976. "See LICENSE in the distribution."))))
  977. (define-public gnuplot
  978. (package
  979. (name "gnuplot")
  980. (version "5.4.2")
  981. (source (origin
  982. (method url-fetch)
  983. (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
  984. version "/gnuplot-"
  985. version ".tar.gz"))
  986. (sha256
  987. (base32 "1fp7rbhjmz2w63r72kicf8lfszzimz2csfx868fracw167hpaz75"))))
  988. (build-system gnu-build-system)
  989. (inputs `(("readline" ,readline)
  990. ("cairo" ,cairo)
  991. ("pango" ,pango)
  992. ("gd" ,gd)
  993. ("lua" ,lua)))
  994. (native-inputs
  995. `(("pkg-config" ,pkg-config)
  996. ("texlive" ,texlive-tiny)))
  997. (arguments `(#:configure-flags (list (string-append
  998. "--with-texdir=" %output
  999. "/texmf-local/tex/latex/gnuplot"))
  1000. ;; Plot on a dumb terminal during tests.
  1001. #:make-flags '("GNUTERM=dumb")))
  1002. (home-page "http://www.gnuplot.info")
  1003. (synopsis "Command-line driven graphing utility")
  1004. (description "Gnuplot is a portable command-line driven graphing
  1005. utility. It was originally created to allow scientists and students to
  1006. visualize mathematical functions and data interactively, but has grown to
  1007. support many non-interactive uses such as web scripting. It is also used as a
  1008. plotting engine by third-party applications like Octave.")
  1009. ;; X11 Style with the additional restriction that derived works may only be
  1010. ;; distributed as patches to the original.
  1011. (license (license:fsf-free
  1012. "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright"))))
  1013. (define-public gctp
  1014. (package
  1015. (name "gctp")
  1016. (version "2.0.0")
  1017. (source
  1018. (origin
  1019. (method git-fetch)
  1020. (uri (git-reference
  1021. (url "https://github.com/OkoSanto/GCTP")
  1022. (commit (string-append "v" version))))
  1023. (file-name (git-file-name name version))
  1024. (sha256
  1025. (base32 "11wqmd443b4nksdbzp1msdws3av948nmwq1xz80w6hka3ss2aigd"))))
  1026. (native-inputs
  1027. `(("fortran" ,gfortran)))
  1028. (build-system gnu-build-system)
  1029. (synopsis "General Cartographic Transformation Package (GCTP)")
  1030. (description
  1031. "The General Cartographic Transformation Package (GCTP) is a system of
  1032. software routines designed to permit the transformation of coordinate pairs
  1033. from one map projection to another. The GCTP is the standard computer
  1034. software used by the National Mapping Division for map projection
  1035. computations.")
  1036. (home-page "https://github.com/OkoSanto/GCTP")
  1037. (license license:public-domain))) ;https://www2.usgs.gov/laws/info_policies.html
  1038. (define-public hdf4
  1039. (package
  1040. (name "hdf4")
  1041. (version "4.2.14")
  1042. (source
  1043. (origin
  1044. (method url-fetch)
  1045. (uri (string-append "https://support.hdfgroup.org/ftp/HDF/releases/HDF"
  1046. version "/src/hdf-" version ".tar.bz2"))
  1047. (sha256
  1048. (base32 "0n29klrrbwan9307np0d9hr128dlpc4nnlf57a140080ll3jmp8l"))
  1049. (patches (search-patches "hdf4-architectures.patch"
  1050. "hdf4-reproducibility.patch"
  1051. "hdf4-shared-fortran.patch"
  1052. "hdf4-tirpc.patch"))))
  1053. (build-system gnu-build-system)
  1054. (native-inputs
  1055. `(("gfortran" ,gfortran)
  1056. ("bison" ,bison)
  1057. ("flex" ,flex)))
  1058. (inputs
  1059. `(("zlib" ,zlib)
  1060. ("libjpeg" ,libjpeg-turbo)
  1061. ("libtirpc" ,libtirpc)))
  1062. (arguments
  1063. `(#:parallel-tests? #f
  1064. #:configure-flags (list "--enable-shared"
  1065. "FCFLAGS=-fallow-argument-mismatch"
  1066. "FFLAGS=-fallow-argument-mismatch"
  1067. (string-append "CPPFLAGS=-I"
  1068. (assoc-ref %build-inputs "libtirpc")
  1069. "/include/tirpc"))
  1070. #:phases
  1071. (modify-phases %standard-phases
  1072. ;; This is inspired by two of Debian's patches.
  1073. (add-before 'configure 'add-more-aarch64-support
  1074. (lambda _
  1075. (substitute* '("mfhdf/ncgen/ncgen.l"
  1076. "mfhdf/ncgen/ncgenyy.c"
  1077. "mfhdf/libsrc/netcdf.h.in")
  1078. (("AIX5L64") "__aarch64__"))
  1079. #t))
  1080. (add-before 'configure 'patchbuild
  1081. (lambda _
  1082. (substitute*
  1083. '("mfhdf/hdfimport/testutil.sh.in" "hdf/util/testutil.sh.in")
  1084. (("/bin/rm") "rm")
  1085. (("/bin/mkdir") "mkdir"))
  1086. (substitute* (find-files "." "^Makefile\\.in$")
  1087. (("@HDF_BUILD_XDR_TRUE@XDR_ADD = \
  1088. -R\\$\\(abs_top_builddir\\)/mfhdf/xdr/\\.libs") "")
  1089. (("@HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = \
  1090. -R\\$\\(abs_top_builddir\\)/mfhdf/libsrc/\\.libs \
  1091. -R\\$\\(abs_top_builddir\\)/hdf/src/\\.libs \\$\\(XDR_ADD\\)") ""))
  1092. #t))
  1093. (add-after 'configure 'patch-settings
  1094. (lambda _
  1095. ;; libhdf4.settings contains the full path of the
  1096. ;; compilers used, and its contents are included in
  1097. ;; .so-files. We truncate the hashes to avoid
  1098. ;; unnecessary store references to those compilers:
  1099. (substitute* "libhdf4.settings"
  1100. (("(/gnu/store/)([0-9A-Za-z]*)" all prefix hash)
  1101. (string-append prefix (string-take hash 10) "...")))
  1102. #t))
  1103. (add-after 'install 'provide-absolute-libjpeg-reference
  1104. (lambda* (#:key inputs outputs #:allow-other-keys)
  1105. (let ((out (assoc-ref outputs "out"))
  1106. (libjpeg (assoc-ref inputs "libjpeg")))
  1107. ;; libjpeg-turbo does not provide a .la file, so libtool is
  1108. ;; unable to add an absolute reference for -ljpeg in the .la
  1109. ;; files. Fix it manually to avoid having to propagate it.
  1110. (substitute* (find-files (string-append out "/lib") "\\.la$")
  1111. (("-ljpeg")
  1112. (string-append "-L" libjpeg "/lib -ljpeg")))
  1113. #t))))))
  1114. (home-page "https://www.hdfgroup.org/products/hdf4/")
  1115. (synopsis
  1116. "Library and multi-object file format for storing and managing data")
  1117. (description "HDF4 is a library and multi-object file format for storing
  1118. and managing data between machines. HDF4 is an older hierarchical data format,
  1119. incompatible with HDF5.")
  1120. (license
  1121. (license:non-copyleft
  1122. "https://www.hdfgroup.org/ftp/HDF/HDF_Current/src/unpacked/COPYING"))))
  1123. (define-public hdf4-alt
  1124. (package
  1125. (inherit hdf4)
  1126. (name "hdf4-alt")
  1127. (arguments
  1128. (substitute-keyword-arguments (package-arguments hdf4)
  1129. ((#:configure-flags flags) `(cons* "--disable-netcdf" ,flags))))
  1130. (synopsis
  1131. "HDF4 without netCDF API, can be combined with the regular netCDF library")))
  1132. (define-public hdf5-1.8
  1133. (package
  1134. (name "hdf5")
  1135. (version "1.8.22")
  1136. (source
  1137. (origin
  1138. (method url-fetch)
  1139. (uri (list (string-append "https://support.hdfgroup.org/ftp/HDF5/releases/"
  1140. "hdf5-" (version-major+minor version)
  1141. "/hdf5-" version "/src/hdf5-"
  1142. version ".tar.bz2")
  1143. (string-append "https://support.hdfgroup.org/ftp/HDF5/"
  1144. "current"
  1145. (match (string-split version #\.)
  1146. ((major minor _ ...)
  1147. (string-append major minor)))
  1148. "/src/hdf5-" version ".tar.bz2")))
  1149. (sha256
  1150. (base32 "194ki2s5jrgl4czkvy5nc9nwjyapah0fj72l0gb0aysplp38i6v8"))
  1151. (patches (search-patches "hdf5-config-date.patch"))))
  1152. (build-system gnu-build-system)
  1153. (inputs
  1154. `(("zlib" ,zlib)))
  1155. (native-inputs
  1156. `(("gfortran" ,gfortran)
  1157. ("perl" ,perl))) ;part of the test machinery needs Perl
  1158. (outputs '("out" ; core library
  1159. "fortran")) ; fortran interface
  1160. (arguments
  1161. `(;; Some of the users, notably Flann, need the C++ interface.
  1162. #:configure-flags '("--enable-cxx"
  1163. "--enable-fortran"
  1164. "--enable-fortran2003"
  1165. ;; Build a thread-safe library. Unfortunately,
  1166. ;; 'configure' invites you to either turn off C++,
  1167. ;; Fortran, and the high-level interface (HL), or
  1168. ;; to pass '--enable-unsupported'. Debian
  1169. ;; packagers chose to pass '--enable-unsupported'
  1170. ;; and we follow their lead here.
  1171. "--enable-threadsafe"
  1172. "--with-pthread"
  1173. "--enable-unsupported")
  1174. ;; Use -fPIC to allow the R bindings to link with the static libraries
  1175. #:make-flags (list "CFLAGS=-fPIC"
  1176. "CXXFLAGS=-fPIC")
  1177. #:phases
  1178. (modify-phases %standard-phases
  1179. (add-before 'configure 'patch-configure
  1180. (lambda* (#:key outputs #:allow-other-keys)
  1181. (substitute* "configure"
  1182. (("/bin/mv") "mv"))
  1183. (substitute* "fortran/src/Makefile.in"
  1184. (("libhdf5_fortran_la_LDFLAGS =")
  1185. (string-append "libhdf5_fortran_la_LDFLAGS = -Wl-rpath="
  1186. (assoc-ref outputs "fortran") "/lib")))
  1187. (substitute* "hl/fortran/src/Makefile.in"
  1188. (("libhdf5hl_fortran_la_LDFLAGS =")
  1189. (string-append "libhdf5hl_fortran_la_LDFLAGS = -Wl,-rpath="
  1190. (assoc-ref outputs "fortran") "/lib")))
  1191. #t))
  1192. (add-after 'configure 'patch-settings
  1193. (lambda _
  1194. ;; libhdf5.settings contains the full path of the
  1195. ;; compilers used, and its contents are included in
  1196. ;; libhdf5.so. We truncate the hashes to avoid
  1197. ;; unnecessary store references to those compilers:
  1198. (substitute* "src/libhdf5.settings"
  1199. (("(/gnu/store/)([a-zA-Z0-9]*)" all prefix hash)
  1200. (string-append prefix (string-take hash 10) "..."))
  1201. ;; Don't record the build-time kernel version to make the
  1202. ;; settings file reproducible.
  1203. (("Uname information:.*")
  1204. "Uname information: Linux\n"))
  1205. #t))
  1206. (add-after 'install 'patch-references
  1207. (lambda* (#:key inputs outputs #:allow-other-keys)
  1208. (let ((bin (string-append (assoc-ref outputs "out") "/bin"))
  1209. (zlib (assoc-ref inputs "zlib")))
  1210. (substitute* (find-files bin "h5p?cc")
  1211. (("-lz" lib)
  1212. (string-append "-L" zlib "/lib " lib)))
  1213. #t)))
  1214. (add-after 'install 'split
  1215. (lambda* (#:key inputs outputs #:allow-other-keys)
  1216. ;; Move all fortran-related files
  1217. (let* ((out (assoc-ref outputs "out"))
  1218. (bin (string-append out "/bin"))
  1219. (lib (string-append out "/lib"))
  1220. (inc (string-append out "/include"))
  1221. (ex (string-append out "/share/hdf5_examples/fortran"))
  1222. (fort (assoc-ref outputs "fortran"))
  1223. (fbin (string-append fort "/bin"))
  1224. (flib (string-append fort "/lib"))
  1225. (finc (string-append fort "/include"))
  1226. (fex (string-append fort "/share/hdf5_examples/fortran")))
  1227. (mkdir-p fbin)
  1228. (mkdir-p flib)
  1229. (mkdir-p finc)
  1230. (mkdir-p fex)
  1231. ;; Note: When built with --enable-parallel, the 'h5fc' file
  1232. ;; doesn't exist, hence this condition.
  1233. (when (file-exists? (string-append bin "/h5fc"))
  1234. (rename-file (string-append bin "/h5fc")
  1235. (string-append fbin "/h5fc")))
  1236. (for-each (lambda (file)
  1237. (rename-file file
  1238. (string-append flib "/" (basename file))))
  1239. (find-files lib ".*fortran.*"))
  1240. (for-each (lambda (file)
  1241. (rename-file file
  1242. (string-append finc "/" (basename file))))
  1243. (find-files inc ".*mod"))
  1244. (for-each (lambda (file)
  1245. (rename-file file
  1246. (string-append fex "/" (basename file))))
  1247. (find-files ex ".*"))
  1248. (delete-file-recursively ex))
  1249. #t)))))
  1250. (home-page "https://www.hdfgroup.org")
  1251. (synopsis "Management suite for extremely large and complex data")
  1252. (description "HDF5 is a suite that makes possible the management of
  1253. extremely large and complex data collections.")
  1254. (license (license:x11-style
  1255. "https://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
  1256. (define-public hdf5-1.10
  1257. (package
  1258. (inherit hdf5-1.8)
  1259. (version "1.10.7")
  1260. (source
  1261. (origin
  1262. (method url-fetch)
  1263. (uri (list (string-append "https://support.hdfgroup.org/ftp/HDF5/releases/"
  1264. "hdf5-" (version-major+minor version)
  1265. "/hdf5-" version "/src/hdf5-"
  1266. version ".tar.bz2")
  1267. (string-append "https://support.hdfgroup.org/ftp/HDF5/"
  1268. "current"
  1269. (apply string-append
  1270. (take (string-split version #\.) 2))
  1271. "/src/hdf5-" version ".tar.bz2")))
  1272. (sha256
  1273. (base32 "0pm5xxry55i0h7wmvc7svzdaa90rnk7h78rrjmnlkz2ygsn8y082"))
  1274. (patches (search-patches "hdf5-config-date.patch"))))))
  1275. (define-public hdf5-1.12
  1276. (package
  1277. (inherit hdf5-1.8)
  1278. (version "1.12.0")
  1279. (source
  1280. (origin
  1281. (method url-fetch)
  1282. (uri (list (string-append "https://support.hdfgroup.org/ftp/HDF5/releases/"
  1283. "hdf5-" (version-major+minor version)
  1284. "/hdf5-" version "/src/hdf5-"
  1285. version ".tar.bz2")
  1286. (string-append "https://support.hdfgroup.org/ftp/HDF5/"
  1287. "current"
  1288. (apply string-append
  1289. (take (string-split version #\.) 2))
  1290. "/src/hdf5-" version ".tar.bz2")))
  1291. (sha256
  1292. (base32 "0qazfslkqbmzg495jafpvqp0khws3jkxa0z7rph9qvhacil6544p"))
  1293. (patches (search-patches "hdf5-config-date.patch"))))))
  1294. (define-public hdf5
  1295. ;; Default version of HDF5.
  1296. hdf5-1.10)
  1297. (define-public hdf-java
  1298. (package
  1299. (name "hdf-java")
  1300. (version "3.3.2")
  1301. (source
  1302. (origin
  1303. (method url-fetch)
  1304. (uri (string-append
  1305. "https://www.hdfgroup.org/ftp/HDF5/releases/HDF-JAVA/hdfjni-"
  1306. version "/src/CMake-hdfjava-" version ".tar.gz"))
  1307. (sha256
  1308. (base32 "0m1gp2aspcblqzmpqbdpfp6giskws85ds6p5gz8sx7asyp7wznpr"))
  1309. (modules '((guix build utils)))
  1310. (snippet ; Make sure we don't use the bundled sources and binaries.
  1311. `(begin
  1312. (for-each delete-file
  1313. (list "SZip.tar.gz" "ZLib.tar.gz" "JPEG8d.tar.gz"
  1314. "HDF4.tar.gz" "HDF5.tar.gz"))
  1315. (delete-file-recursively ,(string-append "hdfjava-" version "/lib"))
  1316. #t))))
  1317. (build-system gnu-build-system)
  1318. (native-inputs
  1319. `(("jdk" ,icedtea "jdk")
  1320. ("automake" ,automake) ; For up to date 'config.guess' and 'config.sub'.
  1321. ;; For tests:
  1322. ("hamcrest-core" ,java-hamcrest-core)
  1323. ("junit" ,java-junit)
  1324. ("slf4j-simple" ,java-slf4j-simple)))
  1325. (inputs
  1326. `(("hdf4" ,hdf4)
  1327. ("hdf5" ,hdf5-1.8)
  1328. ("zlib" ,zlib)
  1329. ("libjpeg" ,libjpeg-turbo)
  1330. ("slf4j-api" ,java-slf4j-api)))
  1331. (arguments
  1332. `(#:configure-flags
  1333. (list (string-append "--target=" ,(or (%current-target-system) (%current-system)))
  1334. (string-append "--with-jdk=" (assoc-ref %build-inputs "jdk") "/include,"
  1335. (assoc-ref %build-inputs "jdk") "/lib" )
  1336. (string-append "--with-hdf4=" (assoc-ref %build-inputs "hdf4") "/lib")
  1337. (string-append "--with-hdf5=" (assoc-ref %build-inputs "hdf5") "/lib"))
  1338. #:make-flags
  1339. (list (string-append "HDFLIB=" (assoc-ref %build-inputs "hdf4") "/lib")
  1340. (string-append "HDF5LIB=" (assoc-ref %build-inputs "hdf5") "/lib")
  1341. (string-append "ZLIB=" (assoc-ref %build-inputs "zlib") "/lib/libz.so")
  1342. (string-append "JPEGLIB="
  1343. (assoc-ref %build-inputs "libjpeg") "/lib/libjpeg.so")
  1344. "LLEXT=so")
  1345. #:phases
  1346. (modify-phases %standard-phases
  1347. (add-before 'configure 'chdir-to-source
  1348. (lambda _ (chdir ,(string-append "hdfjava-" version)) #t))
  1349. (add-before 'configure 'patch-build
  1350. (lambda* (#:key inputs outputs #:allow-other-keys)
  1351. (substitute* "configure"
  1352. (("COPT=\"") "COPT=\"-O2 ") ; CFLAGS is ignored in Makefiles
  1353. (("/bin/cat") (which "cat")))
  1354. ;; Set classpath for compilation
  1355. (substitute* '("hdf/hdf5lib/Makefile.in"
  1356. "hdf/hdf5lib/exceptions/Makefile.in"
  1357. "hdf/hdflib/Makefile.in")
  1358. (("\\$\\(TOP\\)/lib/slf4j-api-1\\.7\\.5\\.jar")
  1359. (search-input-file inputs "/share/java/slf4j-api.jar")))
  1360. ;; Replace outdated config.sub and config.guess:
  1361. (with-directory-excursion "config"
  1362. (for-each (lambda (file)
  1363. (install-file
  1364. (search-input-file inputs
  1365. (string-append
  1366. "/share/automake-"
  1367. ,(version-major+minor (package-version automake))
  1368. "/" file))
  1369. "."))
  1370. '("config.sub" "config.guess")))
  1371. ;; Fix embedded version number
  1372. (let ((hdf5version (list ,@(string-split (package-version hdf5) #\.))))
  1373. (substitute* "hdf/hdf5lib/H5.java"
  1374. (("1, 8, 19")
  1375. (string-join hdf5version ", "))))
  1376. (mkdir-p (string-append (assoc-ref outputs "out")))
  1377. ;; Set classpath for tests
  1378. (let* ((build-dir (getcwd))
  1379. (lib (string-append build-dir "/lib"))
  1380. (jhdf (string-append lib "/jhdf.jar"))
  1381. (jhdf5 (string-append lib "/jhdf5.jar"))
  1382. (testjars
  1383. (append
  1384. (map (lambda (i)
  1385. (string-append (assoc-ref inputs i)
  1386. "/share/java/" i ".jar"))
  1387. '("slf4j-api" "slf4j-simple"))
  1388. (list
  1389. (car (find-files (assoc-ref inputs "junit") "jar$"))
  1390. (car (find-files (assoc-ref inputs "hamcrest-core")
  1391. "jar$")))))
  1392. (class-path
  1393. (string-join `("." ,build-dir ,jhdf ,jhdf5 ,@testjars) ":")))
  1394. (substitute* '("test/hdf5lib/Makefile.in"
  1395. "test/hdf5lib/junit.sh.in"
  1396. "examples/runExample.sh.in")
  1397. (("/usr/bin/test")
  1398. (search-input-file inputs "/bin/test"))
  1399. (("/usr/bin/uname")
  1400. (search-input-file inputs "/bin/uname"))
  1401. (("CLASSPATH=[^\n]*")
  1402. (string-append "CLASSPATH=" class-path)))
  1403. (setenv "CLASSPATH" class-path))
  1404. #t))
  1405. (add-before 'check 'build-examples
  1406. (lambda _
  1407. (apply invoke `("javac"
  1408. ,@(find-files "examples" ".*\\.java"))))))
  1409. #:parallel-build? #f
  1410. #:parallel-tests? #f ))
  1411. (home-page "https://support.hdfgroup.org/products/java")
  1412. (synopsis "Java interface for the HDF4 and HDF5 libraries")
  1413. (description "Java HDF Interface (JHI) and Java HDF5 Interface (JHI5) use
  1414. the Java Native Interface to wrap the HDF4 and HDF5 libraries, which are
  1415. implemented in C.")
  1416. ;; BSD-style license:
  1417. (license (license:x11-style
  1418. "https://support.hdfgroup.org/ftp/HDF5/hdf-java\
  1419. /current/src/unpacked/COPYING"))))
  1420. (define-public hdf-eos2
  1421. (package
  1422. (name "hdf-eos2")
  1423. (version "19.1.0")
  1424. (source
  1425. (origin
  1426. (method url-fetch)
  1427. (uri "ftp://edhs1.gsfc.nasa.gov\
  1428. /edhs/hdfeos/latest_release/HDF-EOS2.19v1.00.tar.Z")
  1429. (sha256
  1430. (base32 "0c9fcz25s292ldap12wxmlrvnyz99z24p63d8fwx51bf8s0s1zrz"))
  1431. (patches (search-patches "hdf-eos2-remove-gctp.patch"
  1432. "hdf-eos2-build-shared.patch"
  1433. "hdf-eos2-fortrantests.patch"))))
  1434. (build-system gnu-build-system)
  1435. (native-inputs
  1436. `(("gfortran" ,gfortran)))
  1437. (inputs
  1438. `(("hdf4" ,hdf4-alt) ; assume most HDF-EOS2 users won't use the HDF4 netCDF API
  1439. ;; XXX: These inputs are really dependencies of hdf4.
  1440. ("zlib" ,zlib)
  1441. ("libjpeg" ,libjpeg-turbo)
  1442. ("libtirpc" ,libtirpc)
  1443. ("gctp" ,gctp)))
  1444. (arguments
  1445. `( #:configure-flags '("--enable-install-include" "--enable-shared"
  1446. "CC=h4cc -Df2cFortran" "LIBS=-lgctp")
  1447. #:parallel-tests? #f))
  1448. (home-page "https://hdfeos.org/software/library.php#HDF-EOS2")
  1449. (synopsis "HDF4-based data format for NASA's Earth Observing System")
  1450. (description "HDF-EOS2 is a software library built on HDF4 which supports
  1451. the construction of data structures used in NASA's Earth Observing
  1452. System (Grid, Point and Swath).")
  1453. ;; Source files carry a permissive license header.
  1454. (license (license:non-copyleft home-page))))
  1455. (define-public hdf-eos5
  1456. (package
  1457. (name "hdf-eos5")
  1458. (version "1.15")
  1459. (source (origin
  1460. (method url-fetch)
  1461. (uri (string-append "ftp://edhs1.gsfc.nasa.gov\
  1462. /edhs/hdfeos5/latest_release/HDF-EOS5." version ".tar.Z"))
  1463. (sha256
  1464. (base32
  1465. "1p83333nzzy8rn5chxlm0hrkjjnhh2w1ji8ac0f9q4xzg838i58i"))
  1466. (patches (search-patches "hdf-eos5-build-shared.patch"
  1467. "hdf-eos5-remove-gctp.patch"
  1468. "hdf-eos5-fix-szip.patch"
  1469. "hdf-eos5-fortrantests.patch"))))
  1470. (native-inputs
  1471. `(("gfortran" ,gfortran)))
  1472. (build-system gnu-build-system)
  1473. (inputs
  1474. `(("hdf5" ,hdf5-1.8)
  1475. ("zlib" ,zlib)
  1476. ("gctp" ,gctp)))
  1477. (arguments
  1478. `(#:configure-flags '("--enable-install-include" "--enable-shared"
  1479. "CC=h5cc -Df2cFortran" "LIBS=-lgctp")
  1480. #:parallel-tests? #f))
  1481. (synopsis "HDF5-based data format for NASA's Earth Observing System")
  1482. (description
  1483. "HDF-EOS5 is a software library built on HDF5 to support the construction
  1484. of data structures used in NASA's Earth Observing System (Grid, Point and
  1485. Swath).")
  1486. (home-page "http://www.hdfeos.org/software/library.php#HDF-EOS5")
  1487. ;; Source files carry a permissive license header.
  1488. (license (license:non-copyleft home-page))))
  1489. (define-public hdf5-parallel-openmpi
  1490. (package/inherit hdf5-1.10 ;use the latest
  1491. (name "hdf5-parallel-openmpi")
  1492. (inputs
  1493. `(("mpi" ,openmpi)
  1494. ,@(package-inputs hdf5)))
  1495. (arguments
  1496. (substitute-keyword-arguments (package-arguments hdf5)
  1497. ((#:configure-flags flags)
  1498. ``("--enable-parallel"
  1499. ,@(delete "--enable-cxx"
  1500. (delete "--enable-threadsafe" ,flags))))
  1501. ((#:phases phases)
  1502. `(modify-phases ,phases
  1503. (add-after 'build 'mpi-setup
  1504. ,%openmpi-setup)
  1505. (add-before 'check 'patch-tests
  1506. (lambda _
  1507. ;; OpenMPI's mpirun will exit with non-zero status if it
  1508. ;; detects an "abnormal termination", i.e. any process not
  1509. ;; calling MPI_Finalize(). Since the test is explicitly
  1510. ;; avoiding MPI_Finalize so as not to have at_exit and thus
  1511. ;; H5C_flush_cache from being called, mpirun will always
  1512. ;; complain, so turn this test off.
  1513. (substitute* "testpar/Makefile"
  1514. (("(^TEST_PROG_PARA.*)t_pflush1(.*)" front back)
  1515. (string-append front back "\n")))
  1516. (substitute* "tools/test/h5diff/testph5diff.sh"
  1517. (("/bin/sh") (which "sh")))
  1518. #t))))))
  1519. (synopsis "Management suite for data with parallel IO support")))
  1520. (define-public hdf5-blosc
  1521. (package
  1522. (name "hdf5-blosc")
  1523. (version "1.0.0")
  1524. (source
  1525. (origin
  1526. (method git-fetch)
  1527. (uri (git-reference
  1528. (url "https://github.com/Blosc/hdf5-blosc")
  1529. (commit (string-append "v" version))))
  1530. (file-name (git-file-name name version))
  1531. (sha256
  1532. (base32 "1nj2bm1v6ymm3fmyvhbn6ih5fgdiapavlfghh1pvbmhw71cysyqs"))))
  1533. (build-system cmake-build-system)
  1534. (arguments
  1535. `(#:configure-flags
  1536. (list (string-append "-DBLOSC_INSTALL_DIR="
  1537. (assoc-ref %build-inputs "c-blosc"))
  1538. (string-append "-DPLUGIN_INSTALL_PATH="
  1539. (assoc-ref %outputs "out")
  1540. "/hdf5/lib/plugin"))
  1541. #:phases
  1542. (modify-phases %standard-phases
  1543. (add-after 'unpack 'do-not-build-blosc
  1544. (lambda _
  1545. (substitute* "CMakeLists.txt"
  1546. (("set\\(BLOSC_INSTALL_DIR.*") "")
  1547. (("ExternalProject_Add\\(project_blosc") "message("))
  1548. #t)))))
  1549. (inputs
  1550. `(("c-blosc" ,c-blosc)
  1551. ("hdf5" ,hdf5-1.10)))
  1552. (home-page "https://github.com/Blosc/hdf5-blosc")
  1553. (synopsis "Filter for HDF5 using the Blosc compressor")
  1554. (description "This is a filter for HDF5 that uses the Blosc compressor; by
  1555. installing this filter, you can read and write HDF5 files with
  1556. Blosc-compressed datasets.")
  1557. (license license:expat)))
  1558. (define-public h5check
  1559. (package
  1560. (name "h5check")
  1561. (version "2.0.1")
  1562. (source
  1563. (origin
  1564. (method url-fetch)
  1565. (uri (string-append "https://www.hdfgroup.org/ftp/HDF5/tools/"
  1566. "h5check/src/h5check-" version ".tar.gz"))
  1567. (sha256
  1568. (base32
  1569. "1gm76jbwhz9adbxgn14zx8cj33dmjdr2g5xcy0m9c2gakp8w59kj"))))
  1570. (build-system gnu-build-system)
  1571. (inputs `(("hdf5" ,hdf5-1.8))) ;h5cc for tests
  1572. (home-page "https://www.hdfgroup.org/products/hdf5_tools/h5check.html")
  1573. (synopsis "HDF5 format checker")
  1574. (description "@code{h5check} is a validation tool for verifying that an
  1575. HDF5 file is encoded according to the HDF File Format Specification.")
  1576. (license (license:x11-style "file://COPYING"))))
  1577. (define-public itpp
  1578. (package
  1579. (name "itpp")
  1580. (version "4.3.1")
  1581. (source (origin
  1582. (method url-fetch)
  1583. (uri (string-append "mirror://sourceforge/itpp/itpp/"
  1584. version "/itpp-"
  1585. version ".tar.gz"))
  1586. (sha256
  1587. (base32
  1588. "14ddy2xnb6sgp4hiax9v5sv4pr4l4dd4ps76nfha3nrpr1ikhcqm"))))
  1589. (build-system cmake-build-system)
  1590. (arguments `(#:tests? #f)) ; Tests require googletest *sources*
  1591. (inputs `(("lapack" ,lapack)
  1592. ("fftw" ,fftw)))
  1593. ;; FIXME: Even though the fonts are available dvips complains:
  1594. ;; "Font cmmi10 not found; characters will be left blank."
  1595. (native-inputs
  1596. `(("texlive" ,texlive-tiny)
  1597. ("ghostscript" ,ghostscript)
  1598. ("doxygen" ,doxygen)))
  1599. (home-page "http://itpp.sourceforge.net")
  1600. (synopsis "C++ library of maths, signal processing and communication classes")
  1601. (description "IT++ is a C++ library of mathematical, signal processing and
  1602. communication classes and functions. Its main use is in simulation of
  1603. communication systems and for performing research in the area of
  1604. communications. The kernel of the library consists of generic vector and
  1605. matrix classes, and a set of accompanying routines. Such a kernel makes IT++
  1606. similar to MATLAB, GNU Octave or SciPy.")
  1607. (license license:gpl3+)))
  1608. (define-public netcdf
  1609. (package
  1610. (name "netcdf")
  1611. (version "4.7.4")
  1612. (source
  1613. (origin
  1614. (method url-fetch)
  1615. (uri (string-append
  1616. "https://www.unidata.ucar.edu/downloads/netcdf/ftp/"
  1617. "netcdf-c-" version ".tar.gz"))
  1618. (sha256
  1619. (base32
  1620. "1a2fpp15a2rl1m50gcvvzd9y6bavl6vjf9zzf63sz5gdmq06yiqf"))
  1621. (modules '((guix build utils)))
  1622. (snippet
  1623. ;; Make sure this variable is defined only once. Failing to do so
  1624. ;; would break builds of 'netcdf-parallel-openmpi' with a
  1625. ;; multiple-definition link error with GCC 10.
  1626. '(substitute* "ncdump/ocprint.c"
  1627. (("^int ocdebug") "static int ocdebug")))
  1628. (patches (search-patches "netcdf-date-time.patch"))))
  1629. (build-system gnu-build-system)
  1630. (native-inputs
  1631. `(("m4" ,m4)
  1632. ("doxygen" ,doxygen)
  1633. ("graphviz" ,graphviz)))
  1634. (inputs
  1635. `(("hdf4" ,hdf4-alt)
  1636. ("hdf5" ,hdf5)
  1637. ("curl" ,curl)
  1638. ("zlib" ,zlib)
  1639. ("libjpeg" ,libjpeg-turbo)))
  1640. (arguments
  1641. `(#:configure-flags '("--enable-doxygen" "--enable-dot" "--enable-hdf4")
  1642. #:phases (modify-phases %standard-phases
  1643. (add-before 'configure 'fix-source-date
  1644. (lambda _
  1645. ;; As we ${SOURCE_DATE_EPOCH} evaluates to "1" in the build
  1646. ;; environment, `date -u -d ${SOURCE_DATE_EPOCH}` will evaluate
  1647. ;; to '1st hour of the current day', and therefore makes the
  1648. ;; package not reproducible.
  1649. (substitute* "./configure"
  1650. (("date -u -d \"\\$\\{SOURCE_DATE_EPOCH\\}\"")
  1651. "date --date='@0'"))
  1652. #t))
  1653. (add-after 'configure 'patch-settings
  1654. (lambda _
  1655. ;; libnetcdf.settings contains the full filename of the compilers
  1656. ;; used to build the library. We truncate the hashes of those
  1657. ;; filenames to avoid unnecessary references to the corresponding
  1658. ;; store items.
  1659. (substitute* "libnetcdf.settings"
  1660. (("(/gnu/store/)([0-9A-Za-z]*)" all prefix hash)
  1661. (string-append prefix (string-take hash 10) "...")))
  1662. #t)))
  1663. #:parallel-tests? #f)) ;various race conditions
  1664. (home-page "https://www.unidata.ucar.edu/software/netcdf/")
  1665. (synopsis "Library for scientific data")
  1666. (description "NetCDF is an interface for scientific data access and a
  1667. software library that provides an implementation of the interface. The netCDF
  1668. library defines a machine-independent format for representing scientific data.
  1669. Together, the interface, library, and format support the creation, access, and
  1670. sharing of scientific data.")
  1671. (license (license:x11-style "file://COPYRIGHT"))))
  1672. (define-public netcdf-parallel-openmpi
  1673. (package (inherit netcdf)
  1674. (name "netcdf-parallel-openmpi")
  1675. (inputs
  1676. `(("mpi" ,openmpi)
  1677. ,@(alist-replace "hdf5" (list hdf5-parallel-openmpi)
  1678. (package-inputs netcdf))))
  1679. ;; TODO: Replace pkg-config references in nc-config with absolute references
  1680. (arguments
  1681. (substitute-keyword-arguments (package-arguments netcdf)
  1682. ((#:configure-flags flags)
  1683. `(cons* "CC=mpicc" "CXX=mpicxx"
  1684. "--enable-parallel-tests"
  1685. ;; Shared libraries not supported with parallel IO.
  1686. "--disable-shared" "--with-pic"
  1687. ,flags))
  1688. ((#:phases phases '%standard-phases)
  1689. `(modify-phases ,phases
  1690. (add-after 'build 'mpi-setup
  1691. ,%openmpi-setup)))))))
  1692. (define-public netcdf-fortran
  1693. (package
  1694. (name "netcdf-fortran")
  1695. (version "4.5.3")
  1696. (source (origin
  1697. (method url-fetch)
  1698. (uri (string-append
  1699. "ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-fortran-"
  1700. version ".tar.gz"))
  1701. (sha256
  1702. (base32
  1703. "0x4acvfhbsx1q79dkkwrwbgfhm0w5ngnp4zj5kk92s1khihmqfhj"))))
  1704. (build-system gnu-build-system)
  1705. (arguments
  1706. `(#:configure-flags '("FCFLAGS=-fallow-argument-mismatch"
  1707. "FFLAGS=-fallow-argument-mismatch")
  1708. #:parallel-tests? #f))
  1709. (inputs
  1710. `(("netcdf" ,netcdf)))
  1711. (native-inputs
  1712. `(("gfortran" ,gfortran)))
  1713. (synopsis "Fortran interface for the netCDF library")
  1714. (description (package-description netcdf))
  1715. (home-page (package-home-page netcdf))
  1716. (license (package-license netcdf))))
  1717. (define-public nlopt
  1718. (package
  1719. (name "nlopt")
  1720. (version "2.4.2")
  1721. (source (origin
  1722. (method url-fetch)
  1723. (uri (string-append "http://ab-initio.mit.edu/nlopt/nlopt-"
  1724. version ".tar.gz"))
  1725. (sha256
  1726. (base32 "12cfkkhcdf4zmb6h7y6qvvdvqjs2xf9sjpa3rl3bq76px4yn76c0"))))
  1727. (build-system gnu-build-system)
  1728. (arguments
  1729. `(;; Shared libraries are not built by default. They are required to
  1730. ;; build the Guile, Octave, and Python bindings.
  1731. #:configure-flags '("--enable-shared")
  1732. #:phases
  1733. (modify-phases %standard-phases
  1734. (add-before 'configure 'set-libnlopt-file-name
  1735. (lambda* (#:key outputs #:allow-other-keys)
  1736. ;; Make sure the Scheme module refers to the library by its
  1737. ;; absolute file name (we cannot do that from a snippet
  1738. ;; because the expansion of @libdir@ contains
  1739. ;; ${exec_prefix}.)
  1740. (let ((out (assoc-ref outputs "out")))
  1741. (substitute* "swig/nlopt.scm.in"
  1742. (("libnlopt")
  1743. (string-append out "/lib/libnlopt")))
  1744. #t))))))
  1745. (inputs `(("guile" ,guile-2.0)))
  1746. (native-inputs `(("pkg-config" ,pkg-config)))
  1747. (home-page "http://ab-initio.mit.edu/wiki/")
  1748. (synopsis "Library for nonlinear optimization")
  1749. (description "NLopt is a library for nonlinear optimization, providing a
  1750. common interface for a number of different free optimization routines available
  1751. online as well as original implementations of various other algorithms.")
  1752. (license license:lgpl2.1+)))
  1753. (define-public ipopt
  1754. (package
  1755. (name "ipopt")
  1756. (version "3.13.4")
  1757. (source (origin
  1758. (method git-fetch)
  1759. (uri (git-reference
  1760. (url "https://github.com/coin-or/Ipopt")
  1761. (commit (string-append "releases/" version))))
  1762. (file-name (git-file-name name version))
  1763. (sha256
  1764. (base32
  1765. "08gznhwhqv1x4baksz350ih8q16r5rd0k8vals6078m3h94khr4b"))))
  1766. (build-system gnu-build-system)
  1767. (arguments
  1768. '(#:phases (modify-phases %standard-phases
  1769. (add-after 'install 'add--L-flags-in-ipopt.pc
  1770. (lambda* (#:key inputs outputs #:allow-other-keys)
  1771. ;; The '.pc' file lists '-llapack -lblas' in "Libs";
  1772. ;; move it to "Libs.private" where it belongs, and add a
  1773. ;; '-L' flag for LAPACK.
  1774. (let ((out (assoc-ref outputs "out"))
  1775. (lapack (assoc-ref inputs "lapack")))
  1776. (substitute* (string-append out "/lib/pkgconfig/"
  1777. "ipopt.pc")
  1778. (("Libs: (.*)-llapack -lblas(.*)$" _ before after)
  1779. (string-append "Libs: " before " " after "\n"
  1780. "Libs.private: " before
  1781. "-L" lapack "/lib -llapack -lblas "
  1782. after "\n")))
  1783. #t))))))
  1784. (native-inputs
  1785. `(("gfortran" ,gfortran)
  1786. ("pkg-config" ,pkg-config)))
  1787. (inputs
  1788. ;; TODO: Maybe add dependency on COIN-MUMPS, ASL, and HSL.
  1789. `(("lapack" ,lapack))) ;for both libblas and liblapack
  1790. (home-page "https://www.coin-or.org")
  1791. (synopsis "Large-scale nonlinear optimizer")
  1792. (description
  1793. "The Interior Point Optimizer (IPOPT) is a software package for
  1794. large-scale nonlinear optimization. It provides C++, C, and Fortran
  1795. interfaces.")
  1796. (license license:epl2.0)))
  1797. (define-public nomad-optimizer
  1798. (package
  1799. (name "nomad-optimizer")
  1800. (version "4.1.0")
  1801. (source
  1802. (origin
  1803. (method git-fetch)
  1804. (uri (git-reference
  1805. (url "https://github.com/bbopt/nomad/")
  1806. (commit (string-append "v" version))))
  1807. (file-name (git-file-name name version))
  1808. (sha256
  1809. (base32
  1810. "0w386d8r5ldbvnv0c0g7vz95pfpvwdxis26vaalk2amsa5akl775"))))
  1811. (build-system cmake-build-system)
  1812. (native-inputs
  1813. `(("python" ,python-wrapper)
  1814. ("python-cython" ,python-cython)))
  1815. (arguments
  1816. `(#:imported-modules ((guix build python-build-system)
  1817. ,@%cmake-build-system-modules)
  1818. #:modules (((guix build python-build-system)
  1819. #:select (python-version site-packages))
  1820. (guix build cmake-build-system)
  1821. (guix build utils))
  1822. #:configure-flags
  1823. '("-DBUILD_INTERFACES=ON"
  1824. "-DBUILD_TESTS=ON")
  1825. #:phases
  1826. (modify-phases %standard-phases
  1827. (add-after 'unpack 'fix-sources-for-build
  1828. (lambda* (#:key outputs #:allow-other-keys)
  1829. (substitute* "CMakeLists.txt"
  1830. ;; CMAKE_INSTALL_PREFIX is accidentally hardcoded.
  1831. (("set\\(CMAKE_INSTALL_PREFIX .* FORCE\\)") "")
  1832. ;; Requiring GCC version 8 or later is unwarranted.
  1833. (("message\\(FATAL_ERROR \"GCC version < 8")
  1834. "message(STATUS \"GCC version < 8"))
  1835. (let ((out (assoc-ref outputs "out")))
  1836. (substitute* "interfaces/PyNomad/CMakeLists.txt"
  1837. ;; We don't want to build in-place, and anyway the install
  1838. ;; command further below runs build_ext as a prerequisite.
  1839. (("COMMAND python setup_PyNomad\\.py .* build_ext --inplace\n")
  1840. "")
  1841. ;; Don't install locally.
  1842. (("COMMAND python (setup_PyNomad\\.py .* install) --user\n"
  1843. _ args)
  1844. (string-append "COMMAND ${CMAKE_COMMAND} -E env"
  1845. " CC=" ,(cc-for-target)
  1846. " CXX=" ,(cxx-for-target)
  1847. " " (which "python")
  1848. " " args
  1849. " --prefix=" out
  1850. "\n")))
  1851. ;; Fix erroneous assumptions about the paths of the include and
  1852. ;; library directories.
  1853. (substitute* "interfaces/PyNomad/setup_PyNomad.py"
  1854. (("^( +os_include_dirs = ).*" _ prefix)
  1855. (string-append prefix "[\"../../src\"]\n"))
  1856. (("^(installed_lib_dir = ).*" _ prefix)
  1857. (string-append prefix "\"" out "/lib\"\n"))))
  1858. #t))
  1859. ;; Fix the tests so they run in out-of-source builds.
  1860. (add-after 'fix-sources-for-build 'fix-sources-for-tests
  1861. (lambda _
  1862. (substitute*
  1863. (map (lambda (d) (string-append "examples/" d "/CMakeLists.txt"))
  1864. (append
  1865. (map (lambda (d) (string-append "basic/library/" d))
  1866. '("example1" "example2" "example3"
  1867. "single_obj_parallel"))
  1868. (map (lambda (d) (string-append "advanced/library/" d))
  1869. '("FixedVariable" "NMonly" "PSDMads" "Restart"
  1870. "c_api/example1" "c_api/example2"
  1871. "exampleSuggestAndObserve"))))
  1872. ;; The built examples are assumed to be in the source tree
  1873. ;; (which isn't the case here).
  1874. (("(COMMAND \\$\\{CMAKE_BINARY_DIR\\}/examples/runExampleTest\\.sh )\\.(/.*)"
  1875. _ command test)
  1876. (string-append command "${CMAKE_CURRENT_BINARY_DIR}" test)))
  1877. ;; (Unrelated to support for out-of-source testing.)
  1878. (make-file-writable
  1879. "examples/advanced/library/exampleSuggestAndObserve/cache0.txt")
  1880. (let* ((builddir (string-append (getcwd) "/../build"))
  1881. ;; The BB_EXE and SURROGATE_EXE paths are interpreted
  1882. ;; relative to the configuration file provided to NOMAD.
  1883. ;; However, the configuration files are all in the source
  1884. ;; tree rather than in the build tree (unlike the compiled
  1885. ;; executables).
  1886. (fix-exe-path (lambda* (dir #:optional
  1887. (file "param.txt")
  1888. (exe-opt "BB_EXE"))
  1889. (substitute* (string-append dir "/" file)
  1890. (((string-append "^" exe-opt " +"))
  1891. ;; The $ prevents NOMAD from prefixing
  1892. ;; the executable with the path of the
  1893. ;; parent directory of the configuration
  1894. ;; file NOMAD was provided with as
  1895. ;; argument (param.txt or some such).
  1896. (string-append exe-opt " $"
  1897. builddir "/" dir "/"))))))
  1898. (for-each
  1899. (lambda (dir)
  1900. (let ((dir (string-append "examples/" dir)))
  1901. (substitute* (string-append dir "/CMakeLists.txt")
  1902. ;; The install phase has not yet run.
  1903. (("COMMAND \\$\\{CMAKE_INSTALL_PREFIX\\}/bin/nomad ")
  1904. "COMMAND ${CMAKE_BINARY_DIR}/src/nomad "))
  1905. (fix-exe-path dir)
  1906. (when (equal? dir "examples/basic/batch/surrogate_sort")
  1907. (fix-exe-path dir "param.txt" "SURROGATE_EXE"))))
  1908. (append (map (lambda (d) (string-append "basic/batch/" d))
  1909. '("example1" "example2"
  1910. "single_obj" "single_obj_parallel"
  1911. "surrogate_sort"))
  1912. '("advanced/batch/LHonly")))
  1913. (let ((dir "examples/advanced/batch/FixedVariable"))
  1914. (substitute* (string-append dir "/runFixed.sh")
  1915. ;; Hardcoded path to NOMAD executable.
  1916. (("^\\.\\./\\.\\./\\.\\./\\.\\./bin/nomad ")
  1917. (string-append builddir "/src/nomad ")))
  1918. (for-each
  1919. (lambda (f) (fix-exe-path dir f))
  1920. '("param1.txt" "param2.txt" "param3.txt" "param10.txt"))))
  1921. #t))
  1922. ;; The information in the .egg-info file is not kept up to date.
  1923. (add-after 'install 'delete-superfluous-egg-info
  1924. (lambda* (#:key inputs outputs #:allow-other-keys)
  1925. (delete-file (string-append
  1926. (site-packages inputs outputs)
  1927. "PyNomad-0.0.0-py"
  1928. (python-version (assoc-ref inputs "python"))
  1929. ".egg-info"))
  1930. #t)))))
  1931. (home-page "https://www.gerad.ca/nomad/")
  1932. (synopsis "Nonlinear optimization by mesh-adaptive direct search")
  1933. (description
  1934. "NOMAD is a C++ implementation of the mesh-adaptive direct search (MADS)
  1935. algorithm, designed for difficult blackbox optimization problems. These
  1936. problems occur when the functions defining the objective and constraints are
  1937. the result of costly computer simulations.")
  1938. (license license:lgpl3+)))
  1939. (define-public cbc
  1940. (package
  1941. (name "cbc")
  1942. (version "2.10.5")
  1943. (source (origin
  1944. (method url-fetch)
  1945. (uri (string-append "https://www.coin-or.org/download/source/"
  1946. "Cbc/Cbc-" version ".tgz"))
  1947. (sha256
  1948. (base32
  1949. "0wk9vr6zc62gw71v7gnra5wxqlcljcgbhm5lasx236v791b986ns"))
  1950. (modules '((guix build utils)))
  1951. (snippet
  1952. ;; Make sure we don't use the bundled software.
  1953. '(delete-file-recursively "ThirdParty"))))
  1954. (build-system gnu-build-system)
  1955. (native-inputs
  1956. `(("gfortran" ,gfortran)
  1957. ("pkg-config" ,pkg-config)))
  1958. (inputs
  1959. `(("openblas" ,openblas)))
  1960. (home-page "https://www.coin-or.org")
  1961. (synopsis "Branch-and-cut solver")
  1962. (description
  1963. "Cbc (Coin-or branch and cut) is a mixed integer linear programming
  1964. solver written in C++. It can be used as a library or as a standalone
  1965. executable.")
  1966. (license license:epl1.0)))
  1967. (define-public clp
  1968. (package
  1969. (name "clp")
  1970. (version "1.17.6")
  1971. (source (origin
  1972. (method url-fetch)
  1973. (uri (string-append "https://www.coin-or.org/download/source/"
  1974. "Clp/Clp-" version ".tgz"))
  1975. (sha256
  1976. (base32
  1977. "0ap1f0lxppa6pnbc4bg7ih7a96avwaki482nig8w5fr3vg9wvkzr"))
  1978. (modules '((guix build utils)))
  1979. (snippet
  1980. ;; Make sure we don't use the bundled software.
  1981. '(begin
  1982. (delete-file-recursively "ThirdParty")
  1983. #t))))
  1984. (build-system gnu-build-system)
  1985. (native-inputs
  1986. `(("gfortran" ,gfortran)
  1987. ("pkg-config" ,pkg-config)))
  1988. (inputs
  1989. `(("openblas" ,openblas)))
  1990. (home-page "https://www.coin-or.org")
  1991. (synopsis "Linear programming solver")
  1992. (description
  1993. "CLP is a high quality linear programming solver. Its main strengths are
  1994. its dual and primal Simplex algorithms. It also has a barrier algorithm for
  1995. linear and quadratic objectives. There are limited facilities for nonlinear
  1996. and quadratic objectives using the Simplex algorithm.")
  1997. (license license:epl1.0)))
  1998. (define-public libflame
  1999. (package
  2000. (name "libflame")
  2001. (version "5.2.0")
  2002. (outputs '("out" "static"))
  2003. (source
  2004. (origin
  2005. (method git-fetch)
  2006. (uri (git-reference
  2007. (url "https://github.com/flame/libflame")
  2008. (commit version)))
  2009. (file-name (git-file-name name version))
  2010. (sha256
  2011. (base32
  2012. "1n6lf0wvpp77lxqlr721h2jbfbzigphdp19wq8ajiccilcksh7ay"))))
  2013. (build-system gnu-build-system)
  2014. (arguments
  2015. `(#:configure-flags
  2016. ;; Sensible defaults: https://github.com/flame/libflame/issues/28
  2017. (list "--enable-dynamic-build"
  2018. "--enable-max-arg-list-hack"
  2019. "--enable-lapack2flame"
  2020. "--enable-verbose-make-output"
  2021. "--enable-multithreading=pthreads" ; Openblas isn't built with openmp.
  2022. ,@(if (any (cute string-prefix? <> (or (%current-target-system)
  2023. (%current-system)))
  2024. '("x86_64" "i686"))
  2025. '("--enable-vector-intrinsics=sse")
  2026. '())
  2027. "--enable-supermatrix"
  2028. "--enable-memory-alignment=16"
  2029. "--enable-ldim-alignment")
  2030. #:phases
  2031. (modify-phases %standard-phases
  2032. (add-after 'unpack 'patch-/usr/bin/env-bash
  2033. (lambda _
  2034. (substitute* "build/config.mk.in"
  2035. (("/usr/bin/env bash") (which "bash")))
  2036. #t))
  2037. (replace 'check
  2038. (lambda* (#:key tests? #:allow-other-keys)
  2039. (substitute* "test/Makefile"
  2040. (("LIBBLAS .*") "LIBBLAS = -lblas\n")
  2041. (("LIBLAPACK .*") "LIBLAPACK = -llapack\n"))
  2042. (if tests?
  2043. (with-directory-excursion "test"
  2044. (mkdir "obj")
  2045. (invoke "make")
  2046. (invoke "./test_libflame.x"))
  2047. #t)))
  2048. (add-after 'install 'install-static
  2049. (lambda* (#:key outputs #:allow-other-keys)
  2050. (let ((out (assoc-ref outputs "out"))
  2051. (static (assoc-ref outputs "static")))
  2052. (mkdir-p (string-append static "/lib"))
  2053. (rename-file (string-append out "/lib/libflame.a")
  2054. (string-append static "/lib/libflame.a"))
  2055. (install-file (string-append out "/include/FLAME.h")
  2056. (string-append static "/include"))
  2057. #t))))))
  2058. (inputs
  2059. `(("gfortran" ,gfortran)))
  2060. (native-inputs
  2061. `(("lapack" ,lapack)
  2062. ("openblas" ,openblas)
  2063. ("perl" ,perl)
  2064. ("python" ,python-wrapper)))
  2065. (home-page "https://github.com/flame/libflame")
  2066. (synopsis "High-performance object-based library for DLA computations")
  2067. (description "@code{libflame} is a portable library for dense matrix
  2068. computations, providing much of the functionality present in LAPACK, developed
  2069. by current and former members of the @acronym{SHPC, Science of High-Performance
  2070. Computing} group in the @url{https://www.ices.utexas.edu/, Institute for
  2071. Computational Engineering and Sciences} at The University of Texas at Austin.
  2072. @code{libflame} includes a compatibility layer, @code{lapack2flame}, which
  2073. includes a complete LAPACK implementation.")
  2074. (license license:bsd-3)))
  2075. (define-public ceres
  2076. (package
  2077. (name "ceres-solver")
  2078. (version "1.14.0")
  2079. (home-page "http://ceres-solver.org/")
  2080. (source (origin
  2081. (method url-fetch)
  2082. (uri (string-append home-page "ceres-solver-"
  2083. version ".tar.gz"))
  2084. (sha256
  2085. (base32
  2086. "13lfxy8x58w8vprr0nkbzziaijlh0vvqshgahvcgw0mrqdgh0i27"))))
  2087. (build-system cmake-build-system)
  2088. (arguments
  2089. ;; TODO: Build HTML user documentation and install separately.
  2090. '(#:configure-flags '("-DBUILD_EXAMPLES=OFF"
  2091. "-DBUILD_SHARED_LIBS=ON")
  2092. #:phases (modify-phases %standard-phases
  2093. (add-before 'configure 'set-library-directory
  2094. (lambda _
  2095. ;; Install libraries to lib/, not lib64/.
  2096. (substitute* "internal/ceres/CMakeLists.txt"
  2097. (("set\\(LIB_SUFFIX \"64\"\\)")
  2098. "set(LIB_SUFFIX \"\")"))
  2099. #t)))))
  2100. (native-inputs
  2101. `(("pkg-config" ,pkg-config)))
  2102. (propagated-inputs
  2103. `(("glog" ,glog))) ;for #include <glog/glog.h>
  2104. (inputs
  2105. `(("eigen" ,eigen)
  2106. ("blas" ,openblas)
  2107. ("lapack" ,lapack)
  2108. ("suitesparse" ,suitesparse)
  2109. ("gflags" ,gflags)))
  2110. (synopsis "C++ library for solving large optimization problems")
  2111. (description
  2112. "Ceres Solver is a C++ library for modeling and solving large,
  2113. complicated optimization problems. It is a feature rich, mature and
  2114. performant library which has been used in production since 2010. Ceres Solver
  2115. can solve two kinds of problems:
  2116. @enumerate
  2117. @item non-linear least squares problems with bounds constraints;
  2118. @item general unconstrained optimization problems.
  2119. @end enumerate\n")
  2120. (license license:bsd-3)))
  2121. ;; For a fully featured Octave, users are strongly recommended also to install
  2122. ;; the following packages: less, ghostscript, gnuplot.
  2123. (define-public octave-cli
  2124. (package
  2125. (name "octave-cli")
  2126. (version "6.2.0")
  2127. (source
  2128. (origin
  2129. (method url-fetch)
  2130. (uri (string-append "mirror://gnu/octave/octave-"
  2131. version ".tar.xz"))
  2132. (sha256
  2133. (base32
  2134. "06id09zspya24gshcwgp039cp35c06150mdlxysawgnbrhj16wkv"))))
  2135. (build-system gnu-build-system)
  2136. (inputs
  2137. `(("alsa-lib" ,alsa-lib)
  2138. ("arpack" ,arpack-ng)
  2139. ("bdb" ,bdb)
  2140. ("curl" ,curl)
  2141. ("fftw" ,fftw)
  2142. ("fftwf" ,fftwf)
  2143. ("fltk" ,fltk)
  2144. ("fontconfig" ,fontconfig)
  2145. ("freetype" ,freetype)
  2146. ("gl2ps" ,gl2ps)
  2147. ("glpk" ,glpk)
  2148. ("glu" ,glu)
  2149. ("graphicsmagick" ,graphicsmagick)
  2150. ;; TODO: libjpeg-turbo is indirectly required through libtiff. In
  2151. ;; the next rebuild cycle, add an absolute reference for -ljpeg in
  2152. ;; libtiff.la instead of having to provide it here.
  2153. ("libjpeg" ,libjpeg-turbo)
  2154. ("hdf5" ,hdf5)
  2155. ("lapack" ,lapack)
  2156. ("libsndfile" ,libsndfile)
  2157. ("libxft" ,libxft)
  2158. ("mesa" ,mesa)
  2159. ("pcre" ,pcre)
  2160. ("portaudio" ,portaudio)
  2161. ("qhull" ,qhull)
  2162. ("readline" ,readline)
  2163. ("suitesparse" ,suitesparse)
  2164. ("texinfo" ,texinfo)
  2165. ("zlib" ,zlib)))
  2166. (native-inputs
  2167. `(("gfortran" ,gfortran)
  2168. ("pkg-config" ,pkg-config)
  2169. ("perl" ,perl)
  2170. ;; The following inputs are not actually used in the build process.
  2171. ;; However, the ./configure gratuitously tests for their existence and
  2172. ;; assumes that programs not present at build time are also not, and
  2173. ;; can never be, available at run time! If these inputs are therefore
  2174. ;; not present, support for them will be built out. However, Octave
  2175. ;; will still run without them, albeit without the features they
  2176. ;; provide.
  2177. ("less" ,less)
  2178. ("ghostscript" ,ghostscript)
  2179. ("gnuplot" ,gnuplot)))
  2180. ;; Octave code uses this variable to detect directories holding multiple CA
  2181. ;; certificates to verify peers with. This is required for the networking
  2182. ;; functions that require encryption to work properly.
  2183. (native-search-paths
  2184. (list (search-path-specification
  2185. (variable "CURLOPT_CAPATH")
  2186. (files '("etc/ssl/certs")))))
  2187. (arguments
  2188. `(#:configure-flags
  2189. (list (string-append "--with-shell="
  2190. (assoc-ref %build-inputs "bash")
  2191. "/bin/sh")
  2192. ;; XXX: Without this flag, linking octave-cli fails with
  2193. ;; undefined references to 'logf@GLIBCXX_3.4' et.al. due to
  2194. ;; not pulling in liboctinterp.la for -lstdc++.
  2195. "--enable-link-all-dependencies")
  2196. #:phases
  2197. (modify-phases %standard-phases
  2198. (add-after 'configure 'configure-makeinfo
  2199. (lambda* (#:key inputs #:allow-other-keys)
  2200. (substitute* "libinterp/corefcn/help.h"
  2201. (("\"makeinfo\"")
  2202. (string-append
  2203. "\"" (assoc-ref inputs "texinfo") "/bin/makeinfo\"")))
  2204. #t)))))
  2205. (home-page "https://www.gnu.org/software/octave/")
  2206. (synopsis "High-level language for numerical computation (no GUI)")
  2207. (description "GNU Octave is a high-level interpreted language that is
  2208. specialized for numerical computations. It can be used for both linear and
  2209. non-linear applications and it provides great support for visualizing results.
  2210. Work may be performed both at the interactive command-line as well as via
  2211. script files.")
  2212. (license license:gpl3+)))
  2213. (define-public octave
  2214. (package (inherit octave-cli)
  2215. (name "octave")
  2216. (inputs
  2217. `(("qscintilla" ,qscintilla)
  2218. ("qt" ,qtbase-5)
  2219. ,@(package-inputs octave-cli)))
  2220. (native-inputs
  2221. `(("qttools" , qttools) ;for lrelease
  2222. ("texlive" ,(texlive-updmap.cfg (list texlive-epsf))) ; for texi2dvi
  2223. ,@(package-native-inputs octave-cli)))
  2224. (arguments
  2225. (substitute-keyword-arguments (package-arguments octave-cli)
  2226. ((#:phases phases)
  2227. `(modify-phases ,phases
  2228. (add-before 'configure 'patch-qscintilla-library-name
  2229. (lambda* (#:key inputs #:allow-other-keys)
  2230. ;; The QScintilla library that the Octave configure script tries
  2231. ;; to link with should be named libqscintilla-qt5.so, but the
  2232. ;; QScintilla input provides the shared library as
  2233. ;; libqscintilla2_qt5.so.
  2234. (substitute* "configure"
  2235. (("qscintilla2-qt5")
  2236. "qscintilla2_qt5"))
  2237. #t))))))
  2238. (synopsis "High-level language for numerical computation (with GUI)")))
  2239. (define-public opencascade-oce
  2240. (package
  2241. (name "opencascade-oce")
  2242. (version "0.17.2")
  2243. (source
  2244. (origin
  2245. (method git-fetch)
  2246. (uri (git-reference
  2247. (url "https://github.com/tpaviot/oce")
  2248. (commit (string-append "OCE-" version))))
  2249. (file-name (git-file-name name version))
  2250. (patches (search-patches "opencascade-oce-glibc-2.26.patch"))
  2251. (sha256
  2252. (base32 "0rg5wzkvfmzfl6v2amyryb8dnjad0nn9kyr607wy2gch6rciah69"))))
  2253. (build-system cmake-build-system)
  2254. (arguments
  2255. '(#:configure-flags
  2256. (list "-DOCE_TESTING:BOOL=ON"
  2257. "-DOCE_USE_TCL_TEST_FRAMEWORK:BOOL=ON"
  2258. "-DOCE_DRAW:BOOL=ON"
  2259. (string-append "-DOCE_INSTALL_PREFIX:PATH="
  2260. (assoc-ref %outputs "out"))
  2261. "-UCMAKE_INSTALL_RPATH")))
  2262. (inputs
  2263. `(("freetype" ,freetype)
  2264. ("glu" ,glu)
  2265. ("libxmu" ,libxmu)
  2266. ("mesa" ,mesa)
  2267. ("tcl" ,tcl)
  2268. ("tk" ,tk)))
  2269. (native-inputs
  2270. `(("python" ,python-wrapper)))
  2271. (home-page "https://github.com/tpaviot/oce")
  2272. (synopsis "Libraries for 3D modeling and numerical simulation")
  2273. (description
  2274. "Open CASCADE is a set of libraries for the development of applications
  2275. dealing with 3D CAD data or requiring industrial 3D capabilities. It includes
  2276. C++ class libraries providing services for 3D surface and solid modeling, CAD
  2277. data exchange, and visualization. It is used for development of specialized
  2278. software dealing with 3D models in design (CAD), manufacturing (CAM),
  2279. numerical simulation (CAE), measurement equipment (CMM), and quality
  2280. control (CAQ) domains.
  2281. This is the ``Community Edition'' (OCE) of Open CASCADE, which gathers
  2282. patches, improvements, and experiments contributed by users over the official
  2283. Open CASCADE library.")
  2284. (license (list license:lgpl2.1; OCE libraries, with an exception for the
  2285. ; use of header files; see
  2286. ; OCCT_LGPL_EXCEPTION.txt
  2287. license:public-domain; files
  2288. ; src/Standard/Standard_StdAllocator.hxx and
  2289. ; src/NCollection/NCollection_StdAllocator.hxx
  2290. license:expat; file src/OpenGl/OpenGl_glext.h
  2291. license:bsd-3)))); test framework gtest
  2292. (define-public opencascade-occt
  2293. (package
  2294. (name "opencascade-occt")
  2295. (version "7.3.0p3")
  2296. (source
  2297. (origin
  2298. (method git-fetch)
  2299. (uri (git-reference
  2300. (url "https://git.dev.opencascade.org/repos/occt.git")
  2301. (commit
  2302. (string-append "V"
  2303. (string-map (lambda (x) (if (eq? x #\.) #\_ x))
  2304. version)))))
  2305. (file-name (git-file-name name version))
  2306. (sha256
  2307. (base32 "0bdywwxb6mk0ykbiajlvsb37295akqjp0a60y672qjfa67k0ljv4"))
  2308. (modules '((guix build utils)))
  2309. (snippet
  2310. '(begin
  2311. ;; Remove files specific to non-free operating systems.
  2312. (delete-file-recursively "samples/ios")
  2313. (delete-file-recursively "samples/mfc")
  2314. (delete-file-recursively "samples/qt/FuncDemo")
  2315. (delete-file "genconf.bat")
  2316. (delete-file "gendoc.bat")
  2317. (delete-file "genproj.bat")
  2318. (delete-file "upgrade.bat")
  2319. ;; Remove references to deleted files.
  2320. (substitute* "dox/FILES_HTML.txt"
  2321. ((".*standard.*") "" )
  2322. ((".*UIKitSample.*") ""))
  2323. #t))))
  2324. (build-system cmake-build-system)
  2325. (arguments
  2326. '(;; There is no test target for make. OCCT provides an
  2327. ;; 'Automated Testing System', which may be accessed after
  2328. ;; installation via the draw.sh script. draw.sh is located in
  2329. ;; the bin directory. For details see:
  2330. ;; https://www.opencascade.com/doc/occt-7.3.0/overview/html/\
  2331. ;; occt_dev_guides__tests.html
  2332. #:tests? #f
  2333. ;; Configure without freeimage: attempting to link against the
  2334. ;; freeimage version 3.17 library leads to 'undefined
  2335. ;; reference' errors.
  2336. #:configure-flags
  2337. (list "-DUSE_FREEIMAGE:BOOL=OFF"
  2338. "-DUSE_TBB:BOOL=ON"
  2339. "-DUSE_VTK:BOOL=OFF"
  2340. "-DBUILD_DOC_Overview:BOOL=OFF"
  2341. "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON"
  2342. "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON"
  2343. "-UCMAKE_INSTALL_LIBDIR")))
  2344. (inputs
  2345. `(("doxygen" ,doxygen)
  2346. ;("freeimage" ,freeimage)
  2347. ("freetype" ,freetype)
  2348. ("glu" ,glu)
  2349. ("libxext" ,libxext)
  2350. ("libxi" ,libxi)
  2351. ("libxmu" ,libxmu)
  2352. ("mesa" ,mesa)
  2353. ("tbb" ,tbb)
  2354. ("tcl" ,tcl)
  2355. ("tk" ,tk)))
  2356. ;; TODO: build Overview documentation and add 'doc' output.
  2357. (home-page "https://www.opencascade.com")
  2358. (synopsis "Libraries for 3D modeling and numerical simulation")
  2359. (description
  2360. "Open CASCADE is a set of libraries for the development of applications
  2361. dealing with 3D CAD data or requiring industrial 3D capabilities. It includes
  2362. C++ class libraries providing services for 3D surface and solid modeling, CAD
  2363. data exchange, and visualization. It is used for development of specialized
  2364. software dealing with 3D models in design (CAD), manufacturing (CAM),
  2365. numerical simulation (CAE), measurement equipment (CMM), and quality
  2366. control (CAQ) domains.
  2367. This is the certified version of the Open Cascade Technology (OCCT) library.")
  2368. (license (list ;; OCCT library:
  2369. license:lgpl2.1; with an exception for the use of header
  2370. ; files, see OCCT_LGPL_EXCEPTION.txt.
  2371. ;; Files src/OpenGl/glext.h, adm/cmake/cotire.cmake and
  2372. ;; src/OpenGl/OpenGl_HaltonSampler.hxx:
  2373. license:expat
  2374. ;; Files src/ExprIntrp/ExprIntrp.tab.* and
  2375. ;; src/StepFile/step.tab.*:
  2376. license:gpl3+ ; with Bison 2.2 exception.
  2377. ;; File src/NCollection/NCollection_UtfIterator.lxx:
  2378. (license:non-copyleft
  2379. "https://www.unicode.org/license.html")
  2380. ;; File src/NCollection/NCollection_StdAllocator.hxx:
  2381. license:public-domain))))
  2382. (define-public gmsh
  2383. (package
  2384. (name "gmsh")
  2385. (version "4.8.4")
  2386. (source
  2387. (origin
  2388. (method git-fetch)
  2389. (uri (git-reference
  2390. (url "https://gitlab.onelab.info/gmsh/gmsh.git")
  2391. (commit
  2392. (string-append "gmsh_"
  2393. (string-replace-substring version "." "_")))))
  2394. (file-name (git-file-name name version))
  2395. (sha256
  2396. (base32 "07mi6ja3b9libgcdp2b4dwnkap1b9ha2wi2zdn9mhmwvp3g1pxhp"))
  2397. (modules '((guix build utils)))
  2398. (snippet
  2399. '(begin
  2400. (delete-file-recursively "contrib/metis")
  2401. #t))))
  2402. (build-system cmake-build-system)
  2403. (propagated-inputs
  2404. `(("fltk" ,fltk)
  2405. ("gfortran" ,gfortran)
  2406. ("glu" ,glu)
  2407. ("gmp" ,gmp)
  2408. ("hdf5" ,hdf5)
  2409. ("lapack" ,lapack)
  2410. ("libx11" ,libx11)
  2411. ("libxext" ,libxext)
  2412. ("mesa" ,mesa)
  2413. ("metis" ,metis)
  2414. ("opencascade-occt" ,opencascade-occt)))
  2415. (inputs
  2416. `(("fontconfig" ,fontconfig)
  2417. ("libxft" ,libxft)
  2418. ("python" ,python)))
  2419. (arguments
  2420. `(#:configure-flags `("-DENABLE_SYSTEM_CONTRIB:BOOL=ON"
  2421. "-DENABLE_BUILD_SHARED:BOOL=ON"
  2422. "-DENABLE_BUILD_DYNAMIC:BOOL=ON")
  2423. #:imported-modules (,@%cmake-build-system-modules
  2424. (guix build python-build-system))
  2425. #:modules (((guix build python-build-system) #:select (site-packages))
  2426. (guix build cmake-build-system)
  2427. (guix build utils))
  2428. #:phases
  2429. (modify-phases %standard-phases
  2430. (add-after 'unpack 'patch-paths
  2431. (lambda* (#:key inputs outputs #:allow-other-keys)
  2432. ;; Use the standard Guix site-package path for
  2433. ;; installation of the Python API.
  2434. (substitute* "CMakeLists.txt"
  2435. (("include\\(GNUInstallDirs\\)\n")
  2436. (string-append "include(GNUInstallDirs)\n"
  2437. " set(GMSH_PY_LIB "
  2438. (site-packages inputs outputs) ")\n"))
  2439. (("\\$\\{GMSH\\_PY\\} DESTINATION \\$\\{GMSH\\_LIB\\}")
  2440. "${GMSH_PY} DESTINATION ${GMSH_PY_LIB}"))
  2441. ;; Find the shared library.
  2442. (let ((libgmsh (string-append (assoc-ref outputs "out")
  2443. "/lib/libgmsh.so")))
  2444. (substitute* "api/gmsh.py"
  2445. (("find_library\\(\"gmsh\"\\)")
  2446. (simple-format #f "\"~a\"" libgmsh))))
  2447. #t)))))
  2448. (home-page "http://gmsh.info/")
  2449. (synopsis "3D finite element grid generator")
  2450. (description "Gmsh is a 3D finite element grid generator with a built-in
  2451. CAD engine and post-processor. Its design goal is to provide a fast, light
  2452. and user-friendly meshing tool with parametric input and advanced
  2453. visualization capabilities. Gmsh is built around four modules: geometry,
  2454. mesh, solver and post-processing. The specification of any input to these
  2455. modules is done either interactively using the graphical user interface or in
  2456. ASCII text files using Gmsh's own scripting language.")
  2457. (license license:gpl2+)))
  2458. (define-public veusz
  2459. (package
  2460. (name "veusz")
  2461. (version "3.3.1")
  2462. (source
  2463. (origin
  2464. (method url-fetch)
  2465. (uri (pypi-uri "veusz" version))
  2466. (sha256
  2467. (base32 "1q7hi1qwwg4pgiz62isvv1pia85m13bspdpp1q3mrnwl11in0ag0"))))
  2468. (build-system python-build-system)
  2469. (arguments
  2470. `(;; Tests will fail because they depend on optional packages like
  2471. ;; python-astropy, which is not packaged.
  2472. #:tests? #f
  2473. #:phases
  2474. (modify-phases %standard-phases
  2475. ;; Veusz will append 'PyQt5' to sip_dir by default. That is not how
  2476. ;; the path is defined in Guix, therefore we have to change it.
  2477. (add-after 'unpack 'fix-sip-dir
  2478. (lambda _
  2479. (substitute* "pyqtdistutils.py"
  2480. (("os.path.join\\(sip_dir, 'PyQt5'\\)") "sip_dir"))
  2481. #t))
  2482. ;; Now we have to pass the correct sip_dir to setup.py.
  2483. (replace 'build
  2484. (lambda* (#:key inputs #:allow-other-keys)
  2485. ;; We need to tell setup.py where to locate QtCoremod.sip
  2486. ((@@ (guix build python-build-system) call-setuppy)
  2487. "build_ext"
  2488. (list (string-append "--sip-dir="
  2489. (assoc-ref inputs "python-pyqt")
  2490. "/share/sip"))
  2491. #t)))
  2492. ;; Ensure that icons are found at runtime.
  2493. (add-after 'install 'wrap-executable
  2494. (lambda* (#:key inputs outputs #:allow-other-keys)
  2495. (let ((out (assoc-ref outputs "out")))
  2496. (wrap-program (string-append out "/bin/veusz")
  2497. `("QT_PLUGIN_PATH" prefix
  2498. ,(list (string-append (assoc-ref inputs "qtsvg")
  2499. "/lib/qt5/plugins/"))))))))))
  2500. (native-inputs
  2501. `(("pkg-config" ,pkg-config)
  2502. ;;("python-astropy" ,python-astropy) ;; FIXME: Package this.
  2503. ("qttools" ,qttools)
  2504. ("python-sip" ,python-sip-4)))
  2505. (inputs
  2506. `(("ghostscript" ,ghostscript) ;optional, for EPS/PS output
  2507. ("python-dbus" ,python-dbus)
  2508. ("python-h5py" ,python-h5py) ;optional, for HDF5 data
  2509. ("python-pyqt" ,python-pyqt)
  2510. ("qtbase" ,qtbase-5)
  2511. ("qtsvg" ,qtsvg)))
  2512. (propagated-inputs
  2513. `(("python-numpy" ,python-numpy)))
  2514. (home-page "https://veusz.github.io/")
  2515. (synopsis "Scientific plotting package")
  2516. (description
  2517. "Veusz is a scientific plotting and graphing program with a graphical
  2518. user interface, designed to produce publication-ready 2D and 3D plots. In
  2519. addition it can be used as a module in Python for plotting. It supports
  2520. vector and bitmap output, including PDF, Postscript, SVG and EMF.")
  2521. (license license:gpl2+)))
  2522. (define-public maxflow
  2523. (package
  2524. (name "maxflow")
  2525. ;; Versioning is ambiguous: the git tag matching this commit is ‘3.0.5’,
  2526. ;; which matches CMakeLists.txt, but README.md and CHANGES say ‘3.04’.
  2527. (version "3.0.5")
  2528. (source (origin
  2529. (method git-fetch)
  2530. (uri (git-reference
  2531. (url "https://github.com/gerddie/maxflow")
  2532. (commit version)))
  2533. (file-name (git-file-name name version))
  2534. (sha256
  2535. (base32
  2536. "0rll38whw55h0vcjrrwdnh9ascvxby0ph7n1l0d12z17cg215kkb"))))
  2537. (build-system cmake-build-system)
  2538. (home-page "https://pub.ist.ac.at/~vnk/software.html")
  2539. (synopsis "Library implementing Maxflow algorithm")
  2540. (description "An implementation of the maxflow algorithm described in
  2541. @cite{An Experimental Comparison of Min-Cut/Max-Flow Algorithms for
  2542. Energy Minimization in Computer Vision.\n
  2543. Yuri Boykov and Vladimir Kolmogorov.\n
  2544. In IEEE Transactions on Pattern Analysis and Machine Intelligence,\n
  2545. September 2004}")
  2546. (license license:gpl3+)))
  2547. (define-public petsc
  2548. (package
  2549. (name "petsc")
  2550. (version "3.11.2")
  2551. (source
  2552. (origin
  2553. (method url-fetch)
  2554. ;; The *-lite-* tarball does not contain the *large* documentation
  2555. (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
  2556. "petsc-lite-" version ".tar.gz"))
  2557. (sha256
  2558. (base32 "1645nwwcp9bcnfnxikk480mhbbacdvhsay2c401818hk97dqj5nx"))))
  2559. (outputs '("out" ; libraries and headers
  2560. "examples")) ; ~30MiB of examples
  2561. (build-system gnu-build-system)
  2562. (native-inputs
  2563. `(("python" ,python-2)))
  2564. (inputs
  2565. `(("gfortran" ,gfortran)
  2566. ("openblas" ,openblas)
  2567. ("superlu" ,superlu)
  2568. ;; leaving out hdf5 and fftw, as petsc expects them to be built with mpi
  2569. ;; leaving out opengl, as configuration seems to only be for mac
  2570. ))
  2571. (arguments
  2572. `(#:test-target "test"
  2573. #:parallel-build? #f ; build is parallel by default
  2574. #:configure-flags
  2575. `("--with-mpi=0"
  2576. "--with-openmp=1"
  2577. "--with-openblas=1"
  2578. "--with-superlu=1")
  2579. #:make-flags
  2580. ;; Honor (parallel-job-count) for build. Do not use --with-make-np,
  2581. ;; whose value is dumped to $out/lib/petsc/conf/petscvariables.
  2582. (list (format #f "MAKE_NP=~a" (parallel-job-count)))
  2583. #:phases
  2584. (modify-phases %standard-phases
  2585. (replace 'configure
  2586. ;; PETSc's configure script is actually a python script, so we can't
  2587. ;; run it with bash.
  2588. (lambda* (#:key outputs (configure-flags '())
  2589. #:allow-other-keys)
  2590. (let* ((prefix (assoc-ref outputs "out"))
  2591. (flags `(,(string-append "--prefix=" prefix)
  2592. ,@configure-flags)))
  2593. (format #t "build directory: ~s~%" (getcwd))
  2594. (format #t "configure flags: ~s~%" flags)
  2595. (apply invoke "./configure" flags))))
  2596. (add-after 'configure 'clean-local-references
  2597. (lambda* (#:key outputs #:allow-other-keys)
  2598. (let ((out (assoc-ref outputs "out")))
  2599. (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
  2600. ;; Prevent build directory from leaking into compiled code
  2601. (((getcwd)) out)
  2602. ;; Scrub timestamp for reproducibility
  2603. ((".*Libraries compiled on.*") ""))
  2604. (substitute* (find-files "." "petscvariables")
  2605. ;; Do not expose build machine characteristics, set to defaults.
  2606. (("MAKE_NP = [:digit:]+") "MAKE_NP = 2")
  2607. (("NPMAX = [:digit:]+") "NPMAX = 2"))
  2608. #t)))
  2609. (add-after 'install 'clean-install
  2610. ;; Try to keep installed files from leaking build directory names.
  2611. (lambda* (#:key inputs outputs #:allow-other-keys)
  2612. (let ((out (assoc-ref outputs "out")))
  2613. (substitute* (map (lambda (file)
  2614. (string-append out "/lib/petsc/conf/" file))
  2615. '("petscvariables"))
  2616. (((getcwd)) out))
  2617. ;; Make compiler references point to the store
  2618. (substitute* (string-append out "/lib/petsc/conf/petscvariables")
  2619. (("= (gcc|g\\+\\+|gfortran)" _ compiler)
  2620. (string-append "= " (which compiler))))
  2621. ;; PETSc installs some build logs, which aren't necessary.
  2622. (for-each (lambda (file)
  2623. (let ((f (string-append out "/lib/petsc/conf/" file)))
  2624. (when (file-exists? f)
  2625. (delete-file f))))
  2626. '("configure.log" "make.log" "gmake.log"
  2627. "test.log" "error.log" "RDict.db"
  2628. "PETScBuildInternal.cmake"
  2629. ;; Once installed, should uninstall with Guix
  2630. "uninstall.py"))
  2631. #t)))
  2632. (add-after 'install 'move-examples
  2633. (lambda* (#:key outputs #:allow-other-keys)
  2634. (let* ((out (assoc-ref outputs "out"))
  2635. (examples (assoc-ref outputs "examples"))
  2636. (exdir (string-append out "/share/petsc/examples"))
  2637. (exdir' (string-append examples "/share/petsc/examples")))
  2638. (copy-recursively exdir exdir')
  2639. (delete-file-recursively exdir)
  2640. #t))))))
  2641. (home-page "https://www.mcs.anl.gov/petsc")
  2642. (synopsis "Library to solve PDEs")
  2643. (description "PETSc, pronounced PET-see (the S is silent), is a suite of
  2644. data structures and routines for the scalable (parallel) solution of
  2645. scientific applications modeled by partial differential equations.")
  2646. (license (license:non-copyleft
  2647. "https://www.mcs.anl.gov/petsc/documentation/copyright.html"))))
  2648. (define-public petsc-complex
  2649. (package (inherit petsc)
  2650. (name "petsc-complex")
  2651. (arguments
  2652. (substitute-keyword-arguments (package-arguments petsc)
  2653. ((#:configure-flags cf)
  2654. `(cons "--with-scalar-type=complex" ,cf))))
  2655. (synopsis "Library to solve PDEs (with complex scalars)")))
  2656. (define-public petsc-openmpi
  2657. (package (inherit petsc)
  2658. (name "petsc-openmpi")
  2659. (inputs
  2660. `(("hdf5" ,hdf5-parallel-openmpi)
  2661. ("hypre" ,hypre-openmpi)
  2662. ("metis" ,metis)
  2663. ("mumps" ,mumps-openmpi)
  2664. ("openmpi" ,openmpi)
  2665. ("scalapack" ,scalapack)
  2666. ("scotch" ,pt-scotch32)
  2667. ,@(package-inputs petsc)))
  2668. (arguments
  2669. (substitute-keyword-arguments (package-arguments petsc)
  2670. ((#:configure-flags cf)
  2671. ``("--with-hypre=1"
  2672. "--with-mpiexec=mpirun"
  2673. "--with-metis=1"
  2674. "--with-mumps=1"
  2675. "--with-scalapack=1"
  2676. "--with-ptscotch=1"
  2677. ,(string-append "--with-mpi-dir="
  2678. (assoc-ref %build-inputs "openmpi"))
  2679. ,(string-append "--with-hdf5-include="
  2680. (assoc-ref %build-inputs "hdf5") "/include")
  2681. ,(string-append "--with-hdf5-lib="
  2682. (assoc-ref %build-inputs "hdf5") "/lib/libhdf5.a")
  2683. ,@(delete "--with-mpi=0" ,cf)))
  2684. ((#:phases phases)
  2685. `(modify-phases ,phases
  2686. (add-before 'configure 'mpi-setup
  2687. ,%openmpi-setup)))))
  2688. (synopsis "Library to solve PDEs (with MUMPS and MPI support)")))
  2689. (define-public petsc-complex-openmpi
  2690. (package (inherit petsc-complex)
  2691. (name "petsc-complex-openmpi")
  2692. (inputs
  2693. `(("openmpi" ,openmpi)
  2694. ,@(package-inputs petsc-complex)))
  2695. (arguments
  2696. (substitute-keyword-arguments (package-arguments petsc-complex)
  2697. ((#:configure-flags cf)
  2698. ``("--with-mpiexec=mpirun"
  2699. ,(string-append "--with-mpi-dir="
  2700. (assoc-ref %build-inputs "openmpi"))
  2701. ,@(delete "--with-mpi=0" ,cf)))
  2702. ((#:phases phases)
  2703. `(modify-phases ,phases
  2704. (add-before 'configure 'mpi-setup
  2705. ,%openmpi-setup)))))
  2706. (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
  2707. (define-public python-petsc4py
  2708. (package
  2709. (name "python-petsc4py")
  2710. (version "3.11.0")
  2711. (source
  2712. (origin
  2713. (method url-fetch)
  2714. (uri (pypi-uri "petsc4py" version))
  2715. (sha256
  2716. (base32
  2717. "1rm1qj5wlkhxl39by9n78lh3gbmii31wsnb8j1rr5hvfr5xgbx2q"))
  2718. (modules '((guix build utils)))
  2719. (snippet
  2720. '(begin
  2721. ;; Ensure source file is regenerated in the build phase.
  2722. (delete-file "src/petsc4py.PETSc.c")
  2723. ;; Remove legacy GC code. See
  2724. ;; https://bitbucket.org/petsc/petsc4py/issues/125.
  2725. (substitute* "src/PETSc/cyclicgc.pxi"
  2726. ((".*gc_refs.*") "" )
  2727. ((".*PyGC_Head.*") ""))
  2728. #t))))
  2729. (build-system python-build-system)
  2730. (arguments
  2731. `(#:phases
  2732. (modify-phases %standard-phases
  2733. (add-before 'build 'pre-build
  2734. (lambda _
  2735. ;; Define path to PETSc installation.
  2736. (setenv "PETSC_DIR" (assoc-ref %build-inputs "petsc"))
  2737. #t))
  2738. (add-before 'check 'mpi-setup
  2739. ,%openmpi-setup))))
  2740. (native-inputs
  2741. `(("python-cython" ,python-cython)))
  2742. (inputs
  2743. `(("petsc" ,petsc-openmpi)
  2744. ("python-numpy" ,python-numpy)))
  2745. (home-page "https://bitbucket.org/petsc/petsc4py/")
  2746. (synopsis "Python bindings for PETSc")
  2747. (description "PETSc, the Portable, Extensible Toolkit for
  2748. Scientific Computation, is a suite of data structures and routines for
  2749. the scalable (parallel) solution of scientific applications modeled by
  2750. partial differential equations. It employs the MPI standard for all
  2751. message-passing communication. @code{petsc4py} provides Python
  2752. bindings to almost all functions of PETSc.")
  2753. (license license:bsd-3)))
  2754. (define-public python-kiwisolver
  2755. (package
  2756. (name "python-kiwisolver")
  2757. (version "1.0.1")
  2758. (source (origin
  2759. (method url-fetch)
  2760. (uri (pypi-uri "kiwisolver" version))
  2761. (sha256
  2762. (base32
  2763. "0y22ci86znwwwfhbmvbgdfnbi6lv5gv2xkdlxvjw7lml43ayafyf"))))
  2764. (build-system python-build-system)
  2765. (home-page "https://github.com/nucleic/kiwi")
  2766. (synopsis "Fast implementation of the Cassowary constraint solver")
  2767. (description
  2768. "Kiwi is an efficient C++ implementation of the Cassowary constraint
  2769. solving algorithm. Kiwi has been designed from the ground up to be
  2770. lightweight and fast. Kiwi ranges from 10x to 500x faster than the original
  2771. Cassowary solver with typical use cases gaining a 40x improvement. Memory
  2772. savings are consistently > 5x.")
  2773. (license license:bsd-3)))
  2774. (define-public python2-kiwisolver
  2775. (package-with-python2 python-kiwisolver))
  2776. (define-public slepc
  2777. (package
  2778. (name "slepc")
  2779. (version "3.11.1")
  2780. (source
  2781. (origin
  2782. (method url-fetch)
  2783. (uri (string-append "http://slepc.upv.es/download/distrib/slepc-"
  2784. version ".tar.gz"))
  2785. (sha256
  2786. (base32
  2787. "1yq84q9wannc8xwapxpay4ypdd675picwi395hhsdvng9q6hf5j8"))))
  2788. (build-system gnu-build-system)
  2789. (native-inputs
  2790. `(("python" ,python-2)
  2791. ("petsc:examples" ,petsc "examples"))) ;for gmakegen.py script
  2792. (inputs
  2793. `(("arpack" ,arpack-ng)
  2794. ("gfortran" ,gfortran)))
  2795. (propagated-inputs
  2796. `(("petsc" ,petsc)))
  2797. (arguments
  2798. `(#:parallel-build? #f ;build is parallel by default
  2799. #:configure-flags
  2800. `(,(string-append "--with-arpack-dir="
  2801. (assoc-ref %build-inputs "arpack") "/lib"))
  2802. #:make-flags ;honor (parallel-job-count)
  2803. `(,(format #f "MAKE_NP=~a" (parallel-job-count))
  2804. ,(string-append "PETSCCONFIGDIR="
  2805. (assoc-ref %build-inputs "petsc:examples")
  2806. "/share/petsc/examples/config"))
  2807. #:phases
  2808. (modify-phases %standard-phases
  2809. (replace 'configure
  2810. ;; configure is a python script, so we can't run it with bash.
  2811. (lambda* (#:key inputs outputs (configure-flags '())
  2812. #:allow-other-keys)
  2813. (let* ((prefix (assoc-ref outputs "out"))
  2814. (flags `(,(string-append "--prefix=" prefix)
  2815. ,@configure-flags)))
  2816. (format #t "build directory: ~s~%" (getcwd))
  2817. (format #t "configure flags: ~s~%" flags)
  2818. (setenv "SLEPC_DIR" (getcwd))
  2819. (setenv "PETSC_DIR" (assoc-ref inputs "petsc"))
  2820. (apply invoke "./configure" flags))))
  2821. (add-after 'install 'delete-doc
  2822. ;; TODO: SLEPc installs HTML documentation alongside headers in
  2823. ;; $out/include. We'd like to move them to share/doc, but delete
  2824. ;; them for now, as they are incomplete and installing the complete
  2825. ;; documentation is difficult.
  2826. (lambda* (#:key outputs #:allow-other-keys)
  2827. (let* ((out (assoc-ref outputs "out")))
  2828. (for-each delete-file (find-files out "\\.html$"))
  2829. #t)))
  2830. (add-after 'install 'clean-install
  2831. ;; Clean up unnecessary build logs from installation.
  2832. (lambda* (#:key outputs #:allow-other-keys)
  2833. (let ((out (assoc-ref outputs "out")))
  2834. (for-each (lambda (file)
  2835. (let ((f (string-append out "/lib/slepc/conf/" file)))
  2836. (when (file-exists? f)
  2837. (delete-file f))))
  2838. '("configure.log" "make.log" "gmake.log"
  2839. "test.log" "error.log" "RDict.db"
  2840. "uninstall.py"))
  2841. #t))))))
  2842. (home-page "https://slepc.upv.es")
  2843. (synopsis "Scalable library for eigenproblems")
  2844. (description "SLEPc is a software library for the solution of large sparse
  2845. eigenproblems on parallel computers. It can be used for the solution of
  2846. linear eigenvalue problems formulated in either standard or generalized form,
  2847. as well as other related problems such as the singular value decomposition.
  2848. The emphasis of the software is on methods and techniques appropriate for
  2849. problems in which the associated matrices are sparse, for example, those
  2850. arising after the discretization of partial differential equations.")
  2851. (license license:bsd-2)))
  2852. (define-public slepc-complex
  2853. (package (inherit slepc)
  2854. (name "slepc-complex")
  2855. (propagated-inputs
  2856. `(("petsc" ,petsc-complex)
  2857. ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
  2858. (synopsis "Scalable library for eigenproblems (with complex scalars)")))
  2859. (define-public slepc-openmpi
  2860. (package (inherit slepc)
  2861. (name "slepc-openmpi")
  2862. (arguments
  2863. (substitute-keyword-arguments (package-arguments slepc)
  2864. ((#:phases phases '%standard-phases)
  2865. `(modify-phases ,phases
  2866. (add-before 'check 'mpi-setup
  2867. ,%openmpi-setup)))))
  2868. (inputs
  2869. `(("mpi" ,openmpi)
  2870. ("arpack" ,arpack-ng-openmpi)
  2871. ,@(alist-delete "arpack" (package-inputs slepc))))
  2872. (propagated-inputs
  2873. `(("petsc" ,petsc-openmpi)
  2874. ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
  2875. (synopsis "Scalable library for eigenproblems (with MPI support)")))
  2876. (define-public slepc-complex-openmpi
  2877. (package (inherit slepc-openmpi)
  2878. (name "slepc-complex-openmpi")
  2879. (propagated-inputs
  2880. `(("petsc" ,petsc-complex-openmpi)
  2881. ,@(alist-delete "petsc" (package-propagated-inputs slepc-openmpi))))
  2882. (synopsis "Scalable library for eigenproblems (with complex scalars and MPI support)")))
  2883. (define-public python-slepc4py
  2884. (package
  2885. (name "python-slepc4py")
  2886. (version "3.11.0")
  2887. (source
  2888. (origin
  2889. (method url-fetch)
  2890. (uri (pypi-uri "slepc4py" version))
  2891. (sha256
  2892. (base32
  2893. "1ksp08kxf4wg408b9nn39z3qfhy643j22d4rfbl30vzxk2rxh4lq"))))
  2894. (build-system python-build-system)
  2895. (arguments
  2896. `(#:phases
  2897. (modify-phases %standard-phases
  2898. (add-before 'build 'pre-build
  2899. (lambda _
  2900. ;; Define path to PETSc installation.
  2901. (setenv "PETSC_DIR" (assoc-ref %build-inputs "petsc"))
  2902. ;; Define path to SLEPc installation.
  2903. (setenv "SLEPC_DIR" (assoc-ref %build-inputs "slepc"))
  2904. #t))
  2905. (add-before 'check 'mpi-setup
  2906. ,%openmpi-setup))))
  2907. (inputs
  2908. `(("python-numpy" ,python-numpy)
  2909. ("python-petsc4py" ,python-petsc4py)
  2910. ("slepc" ,slepc-openmpi)))
  2911. (home-page "https://bitbucket.org/slepc/slepc4py/")
  2912. (synopsis "Python bindings for SLEPc")
  2913. (description "SLEPc, the Scalable Library for Eigenvalue Problem
  2914. Computations, is based on PETSc, the Portable, Extensible Toolkit for
  2915. Scientific Computation. It employs the MPI standard for all
  2916. message-passing communication. @code{slepc4py} provides Python
  2917. bindings to almost all functions of SLEPc.")
  2918. (license license:bsd-3)))
  2919. (define-public metamath
  2920. (package
  2921. (name "metamath")
  2922. (version "0.193")
  2923. (source
  2924. (origin
  2925. (method git-fetch)
  2926. (uri (git-reference
  2927. (url "https://github.com/metamath/metamath-exe")
  2928. (commit (string-append "v" version))))
  2929. (file-name (git-file-name name version))
  2930. (sha256
  2931. (base32 "1s9hyknfvhj86g3giayyf3dxzg23iij0rs7bdvj075v9qbyhqn9b"))))
  2932. (build-system gnu-build-system)
  2933. (native-inputs
  2934. `(("autoconf" ,autoconf)
  2935. ("automake" ,automake)))
  2936. (home-page "http://us.metamath.org/")
  2937. (synopsis "Proof verifier based on a minimalistic formalism")
  2938. (description
  2939. "Metamath is a tiny formal language and that can express theorems in
  2940. abstract mathematics, with an accompyaning @command{metamath} executable that
  2941. verifies databases of these proofs. There is a public database,
  2942. @url{https://github.com/metamath/set.mm, set.mm}, implementing first-order
  2943. logic and Zermelo-Frenkel set theory with Choice, along with a large swath of
  2944. associated, high-level theorems, e.g.@: the fundamental theorem of arithmetic,
  2945. the Cauchy-Schwarz inequality, Stirling's formula, etc. See the Metamath
  2946. book.")
  2947. (license license:gpl2+)))
  2948. (define-public mumps
  2949. (package
  2950. (name "mumps")
  2951. (version "5.2.1")
  2952. (source
  2953. (origin
  2954. (method url-fetch)
  2955. (uri (string-append "http://mumps.enseeiht.fr/MUMPS_"
  2956. version ".tar.gz"))
  2957. (sha256
  2958. (base32
  2959. "0jklh54x4y3ik1zkw6db7766kakjm5910diyaghfxxf8vwsgr26r"))
  2960. (patches (search-patches "mumps-build-parallelism.patch"
  2961. "mumps-shared-libseq.patch"
  2962. "mumps-shared-mumps.patch"
  2963. "mumps-shared-pord.patch"))))
  2964. (build-system gnu-build-system)
  2965. (inputs
  2966. `(("fortran" ,gfortran)
  2967. ;; These are required for linking against mumps, but we let the user
  2968. ;; declare the dependency.
  2969. ("blas" ,openblas)
  2970. ("metis" ,metis)
  2971. ("scotch" ,scotch)))
  2972. (arguments
  2973. `(#:modules ((ice-9 match)
  2974. (ice-9 popen)
  2975. (srfi srfi-1)
  2976. ,@%gnu-build-system-modules)
  2977. #:phases
  2978. (modify-phases %standard-phases
  2979. (replace 'configure
  2980. (lambda* (#:key inputs #:allow-other-keys)
  2981. (call-with-output-file "Makefile.inc"
  2982. (lambda (port)
  2983. (format port "
  2984. PLAT =
  2985. LIBEXT = .a
  2986. OUTC = -o
  2987. OUTF = -o
  2988. RM = rm -f~:[
  2989. CC = gcc
  2990. FC = gfortran
  2991. FL = gfortran
  2992. INCSEQ = -I$(topdir)/libseq
  2993. LIBSEQ = $(topdir)/libseq/libmpiseq.a
  2994. LIBSEQNEEDED = libseqneeded~;
  2995. CC = mpicc
  2996. FC = mpifort
  2997. FL = mpifort~]
  2998. AR = ar vr # rules require trailing space, ugh...
  2999. RANLIB = ranlib
  3000. BLASDIR = ~a
  3001. LIBBLAS = -Wl,-rpath=$(BLASDIR) -Wl,-rpath='$$ORIGIN' -L$(BLASDIR) -lopenblas~@[
  3002. SCALAPDIR = ~a
  3003. SCALAP = -Wl,-rpath=$(SCALAPDIR) -Wl,-rpath='$$ORIGIN' -L$(SCALAPDIR) -lscalapack~]
  3004. LIBOTHERS = -pthread
  3005. CDEFS = -DAdd_
  3006. PIC = -fPIC
  3007. OPTF = -O2 -DALLOW_NON_INIT $(PIC)
  3008. OPTL = -O2 $(PIC)
  3009. OPTC = -O2 $(PIC)
  3010. INCS = $(INCSEQ)
  3011. LIBS = $(SCALAP) $(LIBSEQ)
  3012. LPORDDIR = $(topdir)/PORD/lib
  3013. IPORD = -I$(topdir)/PORD/include
  3014. LPORD = $(LPORDDIR)/libpord.a
  3015. ORDERINGSF = -Dpord~@[
  3016. METISDIR = ~a
  3017. IMETIS = -I$(METISDIR)/include
  3018. LMETIS = -Wl,-rpath $(METISDIR)/lib -L$(METISDIR)/lib -lmetis
  3019. ORDERINGSF += -Dmetis~]~@[~:{
  3020. SCOTCHDIR = ~a
  3021. ISCOTCH = -I$(SCOTCHDIR)/include
  3022. LSCOTCH = -Wl,-rpath $(SCOTCHDIR)/lib -L$(SCOTCHDIR)/lib ~a-lesmumps -lscotch -lscotcherr
  3023. ORDERINGSF += ~a~}~]
  3024. ORDERINGSC = $(ORDERINGSF)
  3025. LORDERINGS = $(LPORD) $(LMETIS) $(LSCOTCH) $(LIBSEQ)
  3026. IORDERINGSF = $(ISCOTCH)
  3027. IORDERINGSC = $(IPORD) $(IMETIS) $(ISCOTCH)"
  3028. (assoc-ref inputs "mpi")
  3029. (assoc-ref inputs "blas")
  3030. (assoc-ref inputs "scalapack")
  3031. (assoc-ref inputs "metis")
  3032. (match (list (assoc-ref inputs "pt-scotch")
  3033. (assoc-ref inputs "scotch"))
  3034. ((#f #f)
  3035. #f)
  3036. ((#f scotch)
  3037. `((,scotch "" "-Dscotch")))
  3038. ((ptscotch _)
  3039. `((,ptscotch
  3040. "-lptesmumps -lptscotch -lptscotcherr "
  3041. "-Dptscotch")))))))))
  3042. (replace 'build
  3043. ;; By default only the d-precision library is built. Make with "all"
  3044. ;; target so that all precision libraries and examples are built.
  3045. (lambda _
  3046. (invoke "make" "all"
  3047. (format #f "-j~a" (parallel-job-count)))))
  3048. (replace 'check
  3049. ;; Run the simple test drivers, which read test input from stdin:
  3050. ;; from the "real" input for the single- and double-precision
  3051. ;; testers, and from the "cmplx" input for complex-precision
  3052. ;; testers. The EXEC-PREFIX key is used by the mumps-openmpi
  3053. ;; package to prefix execution with "mpirun".
  3054. (lambda* (#:key (exec-prefix '()) #:allow-other-keys)
  3055. (with-directory-excursion "examples"
  3056. (every
  3057. (lambda (prec type)
  3058. (let ((tester (apply open-pipe*
  3059. `(,OPEN_WRITE
  3060. ,@exec-prefix
  3061. ,(string-append "./" prec
  3062. "simpletest"))))
  3063. (input (open-input-file
  3064. (string-append "input_simpletest_" type))))
  3065. (begin
  3066. (dump-port input tester)
  3067. (close-port input)
  3068. (zero? (close-pipe tester)))))
  3069. '("s" "d" "c" "z")
  3070. '("real" "real" "cmplx" "cmplx")))))
  3071. (replace 'install
  3072. (lambda* (#:key outputs #:allow-other-keys)
  3073. (let* ((out (assoc-ref outputs "out"))
  3074. (libdir (string-append out "/lib")))
  3075. (copy-recursively "lib" libdir)
  3076. (copy-recursively "include" (string-append out "/include"))
  3077. (when (file-exists? "libseq/libmpiseq.a")
  3078. (install-file "libseq/libmpiseq.a" libdir))
  3079. (when (file-exists? "libseq/libmpiseq.so")
  3080. (install-file "libseq/libmpiseq.so" libdir))
  3081. #t))))))
  3082. (home-page "http://mumps.enseeiht.fr")
  3083. (synopsis "Multifrontal sparse direct solver")
  3084. (description
  3085. "MUMPS (MUltifrontal Massively Parallel sparse direct Solver) solves a
  3086. sparse system of linear equations A x = b using Gaussian elimination.")
  3087. (license license:cecill-c)))
  3088. (define-public mumps-metis
  3089. (package (inherit mumps)
  3090. (name "mumps-metis")
  3091. (inputs
  3092. (alist-delete "scotch" (package-inputs mumps)))))
  3093. (define-public mumps-openmpi
  3094. (package (inherit mumps)
  3095. (name "mumps-openmpi")
  3096. (inputs
  3097. `(("mpi" ,openmpi)
  3098. ("scalapack" ,scalapack)
  3099. ("pt-scotch" ,pt-scotch)
  3100. ,@(alist-delete "scotch" (package-inputs mumps))))
  3101. (arguments
  3102. (substitute-keyword-arguments (package-arguments mumps)
  3103. ((#:phases phases)
  3104. `(modify-phases ,phases
  3105. (add-before 'check 'mpi-setup
  3106. ,%openmpi-setup)
  3107. (replace 'check
  3108. (lambda _
  3109. ((assoc-ref ,phases 'check)
  3110. #:exec-prefix '("mpirun" "-n" "2"))))))))
  3111. (synopsis "Multifrontal sparse direct solver (with MPI)")))
  3112. (define-public mumps-metis-openmpi
  3113. (package (inherit mumps-openmpi)
  3114. (name "mumps-metis-openmpi")
  3115. (inputs
  3116. (alist-delete "pt-scotch" (package-inputs mumps-openmpi)))))
  3117. (define-public ruby-asciimath
  3118. (package
  3119. (name "ruby-asciimath")
  3120. (version "2.0.1")
  3121. (source
  3122. (origin
  3123. (method url-fetch)
  3124. (uri (rubygems-uri "asciimath" version))
  3125. (sha256
  3126. (base32
  3127. "1aapydwwkydbwgz07n7ma3a5jy9n3v0shy6q6j8mi4wr3crhx45a"))))
  3128. (build-system ruby-build-system)
  3129. (native-inputs
  3130. `(("ruby-nokogiri" ,ruby-nokogiri)
  3131. ("ruby-rspec" ,ruby-rspec)))
  3132. (synopsis "AsciiMath parsing and conversion library")
  3133. (description
  3134. "A pure Ruby AsciiMath parsing and conversion library. AsciiMath is an
  3135. easy-to-write markup language for mathematics.")
  3136. (home-page "https://github.com/asciidoctor/asciimath")
  3137. (license license:expat)))
  3138. (define-public superlu
  3139. (package
  3140. (name "superlu")
  3141. (version "5.2.2")
  3142. (source
  3143. (origin
  3144. (method url-fetch)
  3145. (uri (string-append "https://portal.nersc.gov/project/sparse/superlu/"
  3146. "superlu_" version ".tar.gz"))
  3147. (sha256
  3148. (base32 "13520vk6fqspyl22cq4ak2jh3rlmhja4czq56j75fdx65fkk80s7"))
  3149. (modules '((guix build utils)))
  3150. (snippet
  3151. ;; Replace the non-free implementation of MC64 with a stub adapted
  3152. ;; from Debian
  3153. '(begin
  3154. (use-modules (ice-9 regex)
  3155. (ice-9 rdelim))
  3156. (call-with-output-file "SRC/mc64ad.c"
  3157. (lambda (port)
  3158. (display "
  3159. #include <stdio.h>
  3160. #include <stdlib.h>
  3161. void mc64id_(int *a) {
  3162. fprintf (stderr, \"SuperLU: non-free MC64 not available. Aborting.\\n\");
  3163. abort ();
  3164. }
  3165. void mc64ad_ (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
  3166. int *h, int *i, int *j, int *k, double *l, int *m, int *n) {
  3167. fprintf (stderr, \"SuperLU: non-free MC64 not available. Aborting.\\n\");
  3168. abort ();
  3169. }\n" port)))
  3170. ;; Remove the corresponding license verbiage. MC64 license follows
  3171. ;; a "------" line separator.
  3172. (with-atomic-file-replacement "License.txt"
  3173. (let ((rx (make-regexp "-{8}")))
  3174. (lambda (in out)
  3175. (let loop ()
  3176. (let ((line (read-line in 'concat)))
  3177. (unless (regexp-exec rx line)
  3178. (display line out)
  3179. (loop))))
  3180. #t)))))))
  3181. (build-system cmake-build-system)
  3182. (native-inputs
  3183. `(("tcsh" ,tcsh)))
  3184. (inputs
  3185. `(("blas" ,openblas)
  3186. ("gfortran" ,gfortran)))
  3187. (arguments
  3188. `(#:configure-flags '("-Denable_blaslib:BOOL=NO" ;do not use internal cblas
  3189. "-DTPL_BLAS_LIBRARIES=openblas"
  3190. "-DBUILD_SHARED_LIBS:BOOL=YES")))
  3191. (home-page "https://portal.nersc.gov/project/sparse/superlu/")
  3192. (synopsis "Supernodal direct solver for sparse linear systems")
  3193. (description
  3194. "SuperLU is a general purpose library for the direct solution of large,
  3195. sparse, nonsymmetric systems of linear equations on high performance machines.
  3196. The library is written in C and is callable from either C or Fortran. The
  3197. library routines perform an LU decomposition with partial pivoting and
  3198. triangular system solves through forward and back substitution. The library
  3199. also provides threshold-based ILU factorization preconditioners.")
  3200. (license (list license:bsd-3
  3201. license:gpl2+ ;EXAMPLE/*fgmr.c
  3202. (license:fsf-free "file://SRC/colamd.h")))))
  3203. (define-public superlu-dist
  3204. (package
  3205. (name "superlu-dist")
  3206. (version "6.4.0")
  3207. (source
  3208. (origin
  3209. (method git-fetch)
  3210. (uri (git-reference
  3211. (url "https://github.com/xiaoyeli/superlu_dist")
  3212. (commit (string-append "v" version))))
  3213. (file-name (git-file-name name version))
  3214. (sha256
  3215. (base32 "0fa29yr72p4yq5ln4rgfsawmi5935n4qcr5niz6864bjladz4lql"))
  3216. (modules '((guix build utils)))
  3217. (snippet
  3218. ;; Replace the non-free implementation of MC64 with a stub
  3219. '(begin
  3220. (make-file-writable "SRC/mc64ad_dist.c")
  3221. (call-with-output-file "SRC/mc64ad_dist.c"
  3222. (lambda (port)
  3223. (display "
  3224. #include <stdio.h>
  3225. #include <stdlib.h>
  3226. void mc64id_dist(int *a) {
  3227. fprintf (stderr, \"SuperLU_DIST: non-free MC64 not available. Aborting.\\n\");
  3228. abort ();
  3229. }
  3230. void mc64ad_dist (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
  3231. int *h, int *i, int *j, int *k, double *l, int *m, int *n) {
  3232. fprintf (stderr, \"SuperLU_DIST: non-free MC64 not available. Aborting.\\n\");
  3233. abort ();
  3234. }\n" port)))
  3235. (substitute* "SRC/util.c" ;adjust default algorithm
  3236. (("RowPerm[[:blank:]]*=[[:blank:]]*LargeDiag_MC64;")
  3237. ;; TODO: set to "LargeDiag_AWPM" once combinatorial-blas has
  3238. ;; general (i.e. non-square) processor-grid support.
  3239. "RowPerm = NOROWPERM;"))
  3240. #t))
  3241. (patches (search-patches "superlu-dist-scotchmetis.patch"
  3242. "superlu-dist-awpm-grid.patch"))))
  3243. (build-system cmake-build-system)
  3244. (native-inputs
  3245. `(("tcsh" ,tcsh)))
  3246. (inputs
  3247. `(("gfortran" ,gfortran)
  3248. ("blas" ,openblas)
  3249. ("lapack" ,lapack)
  3250. ("combblas" ,combinatorial-blas)))
  3251. (propagated-inputs
  3252. `(("mpi" ,openmpi) ;headers include MPI heades
  3253. ("parmetis" ,pt-scotch32 "metis")
  3254. ("pt-scotch" ,pt-scotch32)))
  3255. (arguments
  3256. `(#:parallel-tests? #f ;tests use MPI and OpenMP
  3257. #:configure-flags (list "-DBUILD_SHARED_LIBS:BOOL=YES"
  3258. "-DTPL_ENABLE_COMBBLASLIB=YES"
  3259. "-DTPL_BLAS_LIBRARIES=-lopenblas"
  3260. "-DTPL_LAPACK_LIBRARIES=-llapack"
  3261. (string-append "-DTPL_PARMETIS_LIBRARIES="
  3262. (string-join
  3263. '("ptscotchparmetis" "ptscotch" "ptscotcherr"
  3264. "scotchmetis" "scotch" "scotcherr")
  3265. ";"))
  3266. (string-append "-DTPL_PARMETIS_INCLUDE_DIRS="
  3267. (assoc-ref %build-inputs "parmetis")
  3268. "/include")
  3269. "-DTPL_ENABLE_COMBBLASLIB=ON"
  3270. (string-append "-DTPL_COMBBLAS_INCLUDE_DIRS="
  3271. (assoc-ref %build-inputs "combblas")
  3272. "/include/CombBLAS;"
  3273. (assoc-ref %build-inputs "combblas")
  3274. "/include/BipartiteMatchings")
  3275. "-DTPL_COMBBLAS_LIBRARIES=CombBLAS")
  3276. #:phases
  3277. (modify-phases %standard-phases
  3278. (add-before 'configure 'set-c++-standard
  3279. (lambda _
  3280. (substitute* "CMakeLists.txt"
  3281. ;; AWPM headers require C++14
  3282. (("CMAKE_CXX_STANDARD 11") "CMAKE_CXX_STANDARD 14"))))
  3283. (add-before 'check 'mpi-setup
  3284. ,%openmpi-setup)
  3285. (add-before 'check 'omp-setup
  3286. (lambda _ (setenv "OMP_NUM_THREADS" "1") #t)))))
  3287. (home-page (package-home-page superlu))
  3288. (synopsis "Parallel supernodal direct solver")
  3289. (description
  3290. "SuperLU_DIST is a parallel extension to the serial SuperLU library.
  3291. It is targeted for distributed memory parallel machines. SuperLU_DIST is
  3292. implemented in ANSI C, and MPI for communications.")
  3293. (license license:bsd-3)))
  3294. (define-public scotch
  3295. (package
  3296. (name "scotch")
  3297. (version "6.1.1")
  3298. (source
  3299. (origin
  3300. (method url-fetch)
  3301. (uri (string-append "https://gforge.inria.fr/frs/download.php/"
  3302. "latestfile/298/scotch_" version ".tar.gz"))
  3303. (sha256
  3304. (base32 "04dkz24a2g20wq703fnyi4440ac4mwycy9gwrrllljj7zxcjy19r"))
  3305. (patches (search-patches "scotch-build-parallelism.patch"
  3306. "scotch-integer-declarations.patch"))))
  3307. (build-system gnu-build-system)
  3308. (inputs
  3309. `(("zlib" ,zlib)))
  3310. (native-inputs
  3311. `(("flex" ,flex)
  3312. ("bison" ,bison)
  3313. ("gfortran" ,gfortran)))
  3314. (outputs '("out" "metis"))
  3315. (arguments
  3316. `(#:make-flags (list (string-append "prefix=" %output))
  3317. #:phases
  3318. (modify-phases %standard-phases
  3319. (add-after
  3320. 'unpack 'chdir-to-src
  3321. (lambda _ (chdir "src") #t))
  3322. (replace
  3323. 'configure
  3324. (lambda _
  3325. (call-with-output-file "Makefile.inc"
  3326. (lambda (port)
  3327. (format port "
  3328. EXE =
  3329. LIB = .a
  3330. OBJ = .o
  3331. MAKE = make
  3332. AR = ar
  3333. ARFLAGS = -ruv
  3334. CAT = cat
  3335. CCS = gcc
  3336. CCP = mpicc
  3337. CCD = gcc
  3338. FC = gfortran
  3339. CPPFLAGS =~{ -D~a~}
  3340. CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
  3341. LDFLAGS = -lz -lm -lrt -lpthread
  3342. CP = cp
  3343. LEX = flex -Pscotchyy -olex.yy.c
  3344. LN = ln
  3345. MKDIR = mkdir
  3346. MV = mv
  3347. RANLIB = ranlib
  3348. YACC = bison -pscotchyy -y -b y
  3349. "
  3350. '("COMMON_FILE_COMPRESS_GZ"
  3351. "COMMON_PTHREAD"
  3352. "COMMON_RANDOM_FIXED_SEED"
  3353. "INTSIZE64" ;use 'int64_t'
  3354. ;; Prevents symbol clashes with libesmumps
  3355. "SCOTCH_RENAME"
  3356. ;; XXX: Causes invalid frees in superlu-dist tests
  3357. ;; "SCOTCH_PTHREAD"
  3358. ;; "SCOTCH_PTHREAD_NUMBER=2"
  3359. "restrict=__restrict"))))
  3360. #t))
  3361. (add-after 'build 'build-esmumps
  3362. (lambda _
  3363. (invoke "make"
  3364. (format #f "-j~a" (parallel-job-count))
  3365. "esmumps")))
  3366. (add-before 'install 'make-install-dirs
  3367. (lambda* (#:key outputs #:allow-other-keys)
  3368. (mkdir (assoc-ref outputs "out"))))
  3369. (add-after 'install 'install-metis
  3370. (lambda* (#:key outputs #:allow-other-keys)
  3371. (let ((out (assoc-ref outputs "metis")))
  3372. (mkdir out)
  3373. ;; metis files are not installed with 'make install'
  3374. (for-each (lambda (f)
  3375. (install-file f (string-append out "/include")))
  3376. (find-files "../include/" ".*metis\\.h"))
  3377. (for-each (lambda (f)
  3378. (install-file f (string-append out "/lib")))
  3379. (find-files "../lib/" ".*metis\\..*"))
  3380. #t))))))
  3381. (home-page "https://www.labri.fr/perso/pelegrin/scotch/")
  3382. (properties
  3383. `((release-monitoring-url . "https://gforge.inria.fr/frs/?group_id=248")))
  3384. (synopsis "Programs and libraries for graph algorithms")
  3385. (description "SCOTCH is a set of programs and libraries which implement
  3386. the static mapping and sparse matrix reordering algorithms developed within
  3387. the SCOTCH project. Its purpose is to apply graph theory, with a divide and
  3388. conquer approach, to scientific computing problems such as graph and mesh
  3389. partitioning, static mapping, and sparse matrix ordering, in application
  3390. domains ranging from structural mechanics to operating systems or
  3391. bio-chemistry.")
  3392. ;; See LICENSE_en.txt
  3393. (license license:cecill-c)))
  3394. (define-public scotch32
  3395. ;; This is the 'INTSIZE32' variant, which uses 32-bit integers, as needed by
  3396. ;; some applications.
  3397. (package (inherit scotch)
  3398. (name "scotch32")
  3399. (arguments
  3400. (substitute-keyword-arguments (package-arguments scotch)
  3401. ((#:phases scotch-phases)
  3402. `(modify-phases ,scotch-phases
  3403. (replace
  3404. 'configure
  3405. (lambda _
  3406. (call-with-output-file "Makefile.inc"
  3407. (lambda (port)
  3408. (format port "
  3409. EXE =
  3410. LIB = .a
  3411. OBJ = .o
  3412. MAKE = make
  3413. AR = ar
  3414. ARFLAGS = -ruv
  3415. CAT = cat
  3416. CCS = gcc
  3417. CCP = mpicc
  3418. CCD = gcc
  3419. FC = gfortran
  3420. CPPFLAGS =~{ -D~a~}
  3421. CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
  3422. LDFLAGS = -lz -lm -lrt -lpthread
  3423. CP = cp
  3424. LEX = flex -Pscotchyy -olex.yy.c
  3425. LN = ln
  3426. MKDIR = mkdir
  3427. MV = mv
  3428. RANLIB = ranlib
  3429. YACC = bison -pscotchyy -y -b y
  3430. "
  3431. '("COMMON_FILE_COMPRESS_GZ"
  3432. "COMMON_PTHREAD"
  3433. "COMMON_RANDOM_FIXED_SEED"
  3434. "INTSIZE32" ;use 32-bit integers. See INSTALL.txt
  3435. ;; Prevents symbolc clashes with libesmumps
  3436. "SCOTCH_RENAME"
  3437. ;; XXX: Causes invalid frees in superlu-dist tests
  3438. ;; "SCOTCH_PTHREAD"
  3439. ;; "SCOTCH_PTHREAD_NUMBER=2"
  3440. "restrict=__restrict"))))))))))
  3441. (synopsis
  3442. "Programs and libraries for graph algorithms (32-bit integers)")))
  3443. (define-public scotch-shared
  3444. (package (inherit scotch)
  3445. (name "scotch-shared")
  3446. (native-inputs
  3447. `(("gcc" ,gcc)
  3448. ("flex" ,flex)
  3449. ("bison" ,bison)))
  3450. (arguments
  3451. (substitute-keyword-arguments (package-arguments scotch)
  3452. ((#:phases scotch-shared-phases)
  3453. `(modify-phases ,scotch-shared-phases
  3454. (replace
  3455. 'configure
  3456. (lambda _
  3457. ;; Otherwise, the RUNPATH will lack the final path component.
  3458. (setenv "RPATHFLAGS" (string-append "-Wl,-rpath="
  3459. (assoc-ref %outputs "out") "/lib"))
  3460. (call-with-output-file "Makefile.inc"
  3461. (lambda (port)
  3462. (format port "
  3463. EXE =
  3464. LIB = .so
  3465. OBJ = .o
  3466. MAKE = make
  3467. AR = gcc
  3468. ARFLAGS = -shared -o
  3469. CAT = cat
  3470. CCS = gcc
  3471. CCP = mpicc
  3472. CCD = gcc
  3473. FC = gfortran
  3474. CPPFLAGS =~{ -D~a~}
  3475. CFLAGS = -O2 -g -fPIC $(CPPFLAGS) $(RPATHFLAGS)
  3476. CLIBFLAGS = -shared -fPIC
  3477. LDFLAGS = -lz -lm -lrt -lpthread -Xlinker --no-as-needed
  3478. CP = cp
  3479. LEX = flex -Pscotchyy -olex.yy.c
  3480. LN = ln
  3481. MKDIR = mkdir
  3482. MV = mv
  3483. RANLIB = echo
  3484. YACC = bison -pscotchyy -y -b y
  3485. "
  3486. '("COMMON_FILE_COMPRESS_GZ"
  3487. "COMMON_PTHREAD"
  3488. "COMMON_RANDOM_FIXED_SEED"
  3489. "INTSIZE64" ;use 'int64_t'
  3490. ;; Prevents symbolc clashes with libesmumps
  3491. "SCOTCH_RENAME"
  3492. ;; XXX: Causes invalid frees in superlu-dist tests
  3493. ;; "SCOTCH_PTHREAD"
  3494. ;; "SCOTCH_PTHREAD_NUMBER=2"
  3495. "restrict=__restrict"
  3496. ))))#t))
  3497. (delete 'check)))))
  3498. (synopsis
  3499. "Programs and libraries for graph algorithms (shared libraries version)")))
  3500. (define-public pt-scotch
  3501. (package (inherit scotch)
  3502. (name "pt-scotch")
  3503. (propagated-inputs
  3504. `(("openmpi" ,openmpi))) ;Headers include MPI headers
  3505. (arguments
  3506. (substitute-keyword-arguments (package-arguments scotch)
  3507. ((#:phases scotch-phases)
  3508. `(modify-phases ,scotch-phases
  3509. (replace
  3510. 'build
  3511. (lambda _
  3512. (invoke "make" (format #f "-j~a" (parallel-job-count))
  3513. "ptscotch" "ptesmumps")
  3514. ;; Install the serial metis compatibility library
  3515. (invoke "make" "-C" "libscotchmetis" "install")))
  3516. (add-before 'check 'mpi-setup
  3517. ,%openmpi-setup)
  3518. (replace 'check
  3519. (lambda _
  3520. (invoke "make" "ptcheck")))))))
  3521. (synopsis "Programs and libraries for graph algorithms (with MPI)")))
  3522. (define-public pt-scotch32
  3523. (package (inherit scotch32)
  3524. (name "pt-scotch32")
  3525. (propagated-inputs
  3526. `(("openmpi" ,openmpi))) ;headers include MPI headers
  3527. (arguments
  3528. (substitute-keyword-arguments (package-arguments scotch32)
  3529. ((#:phases scotch32-phases)
  3530. `(modify-phases ,scotch32-phases
  3531. (replace 'build
  3532. (lambda _
  3533. (invoke "make" (format #f "-j~a" (parallel-job-count))
  3534. "ptscotch" "ptesmumps")
  3535. ;; Install the serial metis compatibility library
  3536. (invoke "make" "-C" "libscotchmetis" "install")))
  3537. (add-before 'check 'mpi-setup
  3538. ,%openmpi-setup)
  3539. (replace 'check
  3540. (lambda _
  3541. (invoke "make" "ptcheck")))))))
  3542. (synopsis
  3543. "Programs and libraries for graph algorithms (with MPI and 32-bit integers)")))
  3544. (define-public pt-scotch-shared
  3545. (package (inherit scotch-shared)
  3546. (name "pt-scotch-shared")
  3547. (propagated-inputs
  3548. `(("openmpi" ,openmpi))) ;Headers include MPI headers
  3549. (arguments
  3550. (substitute-keyword-arguments (package-arguments scotch-shared)
  3551. ((#:phases scotch-shared-phases)
  3552. `(modify-phases ,scotch-shared-phases
  3553. (replace
  3554. 'build
  3555. (lambda _
  3556. (invoke "make" (format #f "-j~a" (parallel-job-count))
  3557. "ptscotch" "ptesmumps")
  3558. ;; Install the serial metis compatibility library
  3559. (invoke "make" "-C" "libscotchmetis" "install")))
  3560. (add-before 'check 'mpi-setup
  3561. ,%openmpi-setup)))))
  3562. (synopsis "Graph algorithms (shared libraries version, with MPI)")))
  3563. (define-public metis
  3564. (package
  3565. (name "metis")
  3566. (version "5.1.0")
  3567. (source
  3568. (origin
  3569. (method url-fetch)
  3570. (uri (string-append "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/"
  3571. "metis-" version ".tar.gz"))
  3572. (sha256
  3573. (base32
  3574. "1cjxgh41r8k6j029yxs8msp3z6lcnpm16g5pvckk35kc7zhfpykn"))))
  3575. (properties
  3576. `((release-monitoring-url
  3577. . "http://glaros.dtc.umn.edu/gkhome/metis/metis/download")))
  3578. (build-system cmake-build-system)
  3579. (inputs
  3580. `(("blas" ,openblas)))
  3581. (arguments
  3582. `(#:tests? #f ;no tests
  3583. #:configure-flags `("-DSHARED=ON"
  3584. ,(string-append "-DGKLIB_PATH=" (getcwd)
  3585. "/metis-" ,version "/GKlib"))))
  3586. (home-page "http://glaros.dtc.umn.edu/gkhome/metis/metis/overview")
  3587. (synopsis "Graph partitioning and fill-reducing matrix ordering library")
  3588. (description
  3589. "METIS is a set of serial programs for partitioning graphs, partitioning
  3590. finite element meshes, and producing fill-reducing orderings for sparse
  3591. matrices. The algorithms implemented in METIS are based on the multilevel
  3592. recursive-bisection, multilevel k-way, and multi-constraint partitioning
  3593. schemes.")
  3594. (license license:asl2.0))) ;As of version 5.0.3
  3595. (define-public p4est
  3596. (package
  3597. (name "p4est")
  3598. (version "2.0")
  3599. (source
  3600. (origin
  3601. (method url-fetch)
  3602. (uri (string-append "http://p4est.github.io/release/p4est-"
  3603. version ".tar.gz"))
  3604. (sha256
  3605. (base32
  3606. "16h267z256kxcxfjs390qqzv19hr58vrj4x8lndb7alnk2vca8n5"))))
  3607. (build-system gnu-build-system)
  3608. (inputs
  3609. `(("fortran" ,gfortran)
  3610. ("blas" ,openblas)
  3611. ("lapack" ,lapack)
  3612. ("zlib" ,zlib)))
  3613. (arguments
  3614. `(#:configure-flags `(,(string-append "BLAS_LIBS=-L"
  3615. (assoc-ref %build-inputs "blas")
  3616. " -lopenblas")
  3617. ,(string-append "LAPACK_LIBS=-L"
  3618. (assoc-ref %build-inputs "lapack")
  3619. " -llapack"))
  3620. #:phases (modify-phases %standard-phases
  3621. (add-before 'check 'mpi-setup
  3622. ,%openmpi-setup))))
  3623. (home-page "http://www.p4est.org")
  3624. (synopsis "Adaptive mesh refinement on forests of octrees")
  3625. (description
  3626. "The p4est software library enables the dynamic management of a
  3627. collection of adaptive octrees, conveniently called a forest of octrees.
  3628. p4est is designed to work in parallel and scales to hundreds of thousands of
  3629. processor cores.")
  3630. (license license:gpl2+)))
  3631. (define-public p4est-openmpi
  3632. (package (inherit p4est)
  3633. (name "p4est-openmpi")
  3634. (inputs
  3635. `(("mpi" ,openmpi)
  3636. ,@(package-inputs p4est)))
  3637. (arguments
  3638. (substitute-keyword-arguments (package-arguments p4est)
  3639. ((#:configure-flags cf)
  3640. ``("--enable-mpi" ,@,cf))))
  3641. (synopsis "Parallel adaptive mesh refinement on forests of octrees")))
  3642. (define-public gsegrafix
  3643. ;; This is an old and equally dead "experimental fork" of the longer-dead
  3644. ;; original. At least it no longer requires the even-deader libgnomeprint{,ui}
  3645. ;; libraries, instead rendering plots with Pango.
  3646. (package
  3647. (name "gsegrafix")
  3648. (version "1.0.7.2")
  3649. (source
  3650. (origin
  3651. (method url-fetch)
  3652. (uri (string-append "mirror://savannah/gsegrafix-experimental/"
  3653. "gsegrafix-experimental-" version ".tar.gz"))
  3654. (sha256
  3655. (base32 "0fwh6719xy2zasmqlp0vdx6kzm45hn37ga88xmw5cz0yx7xw4j6f"))))
  3656. (build-system gnu-build-system)
  3657. (arguments
  3658. `(#:configure-flags
  3659. (list "--disable-static")))
  3660. (inputs
  3661. `(("glib" ,glib)
  3662. ("gtk+" ,gtk+)))
  3663. (native-inputs
  3664. `(("pkg-config" ,pkg-config)))
  3665. (home-page "https://www.gnu.org/software/gsegrafix/")
  3666. (synopsis "GNOME application to create scientific and engineering plots")
  3667. (description
  3668. "GSEGrafix is an application which produces high-quality graphical
  3669. plots for science and engineering. Plots are specified via simple ASCII
  3670. parameter files and data files and are presented in an anti-aliased GNOME
  3671. canvas. The program supports rectangular two-dimensional plots, histograms,
  3672. polar-axis plots and three-dimensional plots. Plots can be printed or saved
  3673. to BMP, JPEG or PNG image formats.")
  3674. (license license:gpl3+)))
  3675. (define-public maxima
  3676. (package
  3677. (name "maxima")
  3678. (version "5.45.1")
  3679. (source
  3680. (origin
  3681. (method url-fetch)
  3682. (uri (string-append "mirror://sourceforge/maxima/Maxima-source/"
  3683. version "-source/" name "-" version ".tar.gz"))
  3684. (sha256
  3685. (base32
  3686. "1p77nk5sz1qfkn5zr97szpbi8ib4b22k8i52l4ag5gkhd4kid47y"))
  3687. (patches (search-patches "maxima-defsystem-mkdir.patch"))))
  3688. (build-system gnu-build-system)
  3689. (inputs
  3690. `(("bash" ,bash-minimal)
  3691. ("gnuplot" ,gnuplot) ;for plots
  3692. ("sbcl" ,sbcl)
  3693. ("sed" ,sed)
  3694. ("tk" ,tk))) ;Tcl/Tk is used by 'xmaxima'
  3695. (native-inputs
  3696. `(("texinfo" ,texinfo)
  3697. ("perl" ,perl)
  3698. ("python" ,python)))
  3699. (arguments
  3700. `(#:configure-flags
  3701. ,#~(list "--enable-sbcl"
  3702. (string-append "--with-sbcl=" #$sbcl "/bin/sbcl")
  3703. (string-append "--with-posix-shell=" #$bash-minimal "/bin/sh")
  3704. (string-append "--with-wish=" #$tk "/bin/wish"
  3705. #$(version-major+minor (package-version tk))))
  3706. ;; By default Maxima attempts to write temporary files to
  3707. ;; '/tmp/nix-build-maxima-*', which won't exist at run time.
  3708. ;; Work around that.
  3709. #:make-flags (list "TMPDIR=/tmp")
  3710. #:phases
  3711. (modify-phases %standard-phases
  3712. (add-after 'unpack 'patch-paths
  3713. (lambda* (#:key inputs #:allow-other-keys)
  3714. (let* ((sed (search-input-file inputs "/bin/sed"))
  3715. (coreutils (assoc-ref inputs "coreutils"))
  3716. (dirname (string-append coreutils "/bin/dirname"))
  3717. (head (string-append coreutils "/bin/head"))
  3718. (perl (search-input-file inputs "/bin/perl"))
  3719. (python (search-input-file inputs "/bin/python3")))
  3720. (substitute* "src/maxima.in"
  3721. (("sed ") (string-append sed " "))
  3722. (("dirname") dirname)
  3723. (("head") head))
  3724. (substitute* "doc/info/Makefile.in"
  3725. (("/usr/bin/env perl") perl))
  3726. (substitute* "doc/info/build_html.sh.in"
  3727. (("python") python))
  3728. #t)))
  3729. (add-before 'check 'pre-check
  3730. (lambda _
  3731. (chmod "src/maxima" #o555)
  3732. #t))
  3733. (replace 'check
  3734. (lambda _
  3735. ;; This is derived from the testing code in the "debian/rules" file
  3736. ;; of Debian's Maxima package.
  3737. ;; If Maxima can successfully run this, the binary to be installed
  3738. ;; should be fine.
  3739. (invoke "sh" "-c"
  3740. (string-append
  3741. "./maxima-local "
  3742. "--lisp=sbcl "
  3743. "--batch-string=\"run_testsuite();\" "
  3744. "| grep -q \"No unexpected errors found\""))))
  3745. ;; Make sure the doc and emacs files are found in the
  3746. ;; standard location. Also configure maxima to find gnuplot
  3747. ;; without having it on the PATH.
  3748. (add-after 'install 'post-install
  3749. (lambda* (#:key outputs inputs #:allow-other-keys)
  3750. (let* ((gnuplot (assoc-ref inputs "gnuplot"))
  3751. (out (assoc-ref outputs "out"))
  3752. (datadir (string-append out "/share/maxima/" ,version))
  3753. (binutils (dirname (search-input-file inputs "/bin/as"))))
  3754. (with-directory-excursion out
  3755. (mkdir-p "share/emacs")
  3756. (mkdir-p "share/doc")
  3757. (symlink
  3758. (string-append datadir "/doc/")
  3759. (string-append out "/share/doc/maxima"))
  3760. (with-atomic-file-replacement
  3761. (string-append datadir "/share/maxima-init.lisp")
  3762. (lambda (in out)
  3763. (format out "~a ~s~a~%"
  3764. "(setf $gnuplot_command "
  3765. (string-append gnuplot "/bin/gnuplot") ")")
  3766. (dump-port in out))))
  3767. ;; Ensure that Maxima will have access to the GNU binutils
  3768. ;; components at runtime.
  3769. (wrap-program (string-append out "/bin/maxima")
  3770. `("PATH" prefix (,binutils))))
  3771. #t)))))
  3772. (home-page "https://maxima.sourceforge.io")
  3773. (synopsis "Numeric and symbolic expression manipulation")
  3774. (description "Maxima is a system for the manipulation of symbolic and
  3775. numerical expressions. It yields high precision numeric results by using
  3776. exact fractions, arbitrary precision integers, and variable precision floating
  3777. point numbers.")
  3778. ;; Some files are lgpl2.1+. Some are gpl2+. Some explicitly state gpl1+.
  3779. ;; Others simply say "GNU General Public License" without stating a
  3780. ;; version (which implicitly means gpl1+).
  3781. ;; At least one file (src/maxima.asd) says "version 2."
  3782. ;; GPLv2 only is therefore the smallest subset.
  3783. (license license:gpl2)))
  3784. (define-public wxmaxima
  3785. (package
  3786. (name "wxmaxima")
  3787. (version "21.05.2")
  3788. (source
  3789. (origin
  3790. (method git-fetch)
  3791. (uri (git-reference
  3792. (url "https://github.com/wxMaxima-developers/wxmaxima")
  3793. (commit (string-append "Version-" version))))
  3794. (file-name (git-file-name name version))
  3795. (sha256
  3796. (base32 "0h7ryykh2dapcyvpp4f1j1b3vrrz80x9k8nkci2yxifgdb29vyhw"))))
  3797. (build-system cmake-build-system)
  3798. (native-inputs
  3799. `(("gettext" ,gettext-minimal)))
  3800. (inputs
  3801. `(("wxwidgets" ,wxwidgets)
  3802. ("maxima" ,maxima)
  3803. ;; Runtime support.
  3804. ("adwaita-icon-theme" ,adwaita-icon-theme)
  3805. ("gtk+" ,gtk+)
  3806. ("shared-mime-info" ,shared-mime-info)))
  3807. (arguments
  3808. `(#:tests? #f ; tests fail non-deterministically
  3809. #:phases
  3810. (modify-phases %standard-phases
  3811. (add-after 'unpack 'patch-doc-path
  3812. (lambda _
  3813. ;; Don't look in share/doc/wxmaxima-xx.xx.x for the
  3814. ;; documentation. Only licensing information is placed there by
  3815. ;; Guix.
  3816. (substitute* "src/Dirstructure.cpp"
  3817. (("/doc/wxmaxima-\\%s") "/doc/wxmaxima"))
  3818. #t))
  3819. (add-after 'install 'wrap-program
  3820. (lambda* (#:key inputs outputs #:allow-other-keys)
  3821. (wrap-program (string-append (assoc-ref outputs "out")
  3822. "/bin/wxmaxima")
  3823. `("PATH" ":" prefix
  3824. (,(string-append (assoc-ref inputs "maxima")
  3825. "/bin")))
  3826. ;; For GtkFileChooserDialog.
  3827. `("GSETTINGS_SCHEMA_DIR" =
  3828. (,(string-append (assoc-ref inputs "gtk+")
  3829. "/share/glib-2.0/schemas")))
  3830. `("XDG_DATA_DIRS" ":" prefix
  3831. (;; Needed by gdk-pixbuf to know supported icon formats.
  3832. ,(string-append
  3833. (assoc-ref inputs "shared-mime-info") "/share")
  3834. ;; The default icon theme of GTK+.
  3835. ,(string-append
  3836. (assoc-ref inputs "adwaita-icon-theme") "/share"))))
  3837. #t)))))
  3838. (home-page "https://wxmaxima-developers.github.io/wxmaxima/")
  3839. (synopsis "Graphical user interface for the Maxima computer algebra system")
  3840. (description
  3841. "wxMaxima is a graphical user interface for the Maxima computer algebra
  3842. system. It eases the use of Maxima by making most of its commands available
  3843. through a menu system and by providing input dialogs for commands that require
  3844. more than one argument. It also implements its own display engine that
  3845. outputs mathematical symbols directly instead of depicting them with ASCII
  3846. characters.
  3847. wxMaxima also features 2D and 3D inline plots, simple animations, mixing of
  3848. text and mathematical calculations to create documents, exporting of input and
  3849. output to TeX, and a browser for Maxima's manual including command index and
  3850. full text searching.")
  3851. (license license:gpl2+)))
  3852. (define-public armadillo
  3853. (package
  3854. (name "armadillo")
  3855. (version "9.100.5")
  3856. (source (origin
  3857. (method url-fetch)
  3858. (uri (string-append "mirror://sourceforge/arma/armadillo-"
  3859. version ".tar.xz"))
  3860. (sha256
  3861. (base32
  3862. "1ka1vd9fcmvp12qkcm4888dkfqwnalvv00x04wy29f3nx3qwczby"))))
  3863. (build-system cmake-build-system)
  3864. (arguments `(#:tests? #f)) ; no test target
  3865. (inputs
  3866. `(("openblas" ,openblas)
  3867. ("lapack" ,lapack)
  3868. ("arpack" ,arpack-ng)))
  3869. (home-page "http://arma.sourceforge.net/")
  3870. (synopsis "C++ linear algebra library")
  3871. (description
  3872. "Armadillo is a C++ linear algebra library, aiming towards a good balance
  3873. between speed and ease of use. It is useful for algorithm development
  3874. directly in C++, or quick conversion of research code into production
  3875. environments. It can be used for machine learning, pattern recognition,
  3876. signal processing, bioinformatics, statistics, econometrics, etc. The library
  3877. provides efficient classes for vectors, matrices and cubes, as well as 150+
  3878. associated functions (e.g., contiguous and non-contiguous submatrix views).")
  3879. (license license:asl2.0)))
  3880. (define-public muparser
  3881. ;; When switching download sites, muparser re-issued a 2.2.5 release with a
  3882. ;; different hash. In order to make `guix package --upgrade` work correctly,
  3883. ;; we set a Guix packaging revision.
  3884. ;; When the next version of muparser is released, we can remove
  3885. ;; UPSTREAM-VERSION and REVISION and use the plain VERSION.
  3886. (let ((upstream-version "2.2.5")
  3887. (revision "2"))
  3888. (package
  3889. (name "muparser")
  3890. (version (string-append upstream-version "-" revision))
  3891. (source
  3892. (origin
  3893. (method git-fetch)
  3894. (uri (git-reference
  3895. (url "https://github.com/beltoforion/muparser")
  3896. (commit (string-append "v" upstream-version))))
  3897. (file-name (git-file-name name version))
  3898. (sha256
  3899. (base32 "0f0g4995xngf1pp3zr4p6ai2f8v6f8bxwa0k8ayjjiv1l8h44m24"))))
  3900. (build-system gnu-build-system)
  3901. (arguments
  3902. `(#:configure-flags '("--enable-samples=no")
  3903. #:tests? #f)) ;no "check" target
  3904. (home-page "http://muparser.beltoforion.de/")
  3905. (synopsis "Fast parser library for mathematical expressions")
  3906. (description
  3907. "muParser is an extensible high performance math parser library. It is
  3908. based on transforming an expression into a bytecode and precalculating constant
  3909. parts of it.")
  3910. (license license:expat))))
  3911. (define-public openblas
  3912. (package
  3913. (name "openblas")
  3914. (version "0.3.13")
  3915. (source
  3916. (origin
  3917. (method git-fetch)
  3918. (uri (git-reference
  3919. (url "https://github.com/xianyi/OpenBLAS")
  3920. (commit (string-append "v" version))))
  3921. (file-name (git-file-name name version))
  3922. (sha256
  3923. (base32
  3924. "14jxh0v3jfbw4mfjx4mcz4dd51lyq7pqvh9k8dg94539ypzjr2lj"))))
  3925. (build-system gnu-build-system)
  3926. (arguments
  3927. `(#:test-target "test"
  3928. ;; DYNAMIC_ARCH is only supported on x86. When it is disabled and no
  3929. ;; TARGET is specified, OpenBLAS will tune itself to the build host, so
  3930. ;; we need to disable substitutions.
  3931. #:substitutable?
  3932. ,(let ((system (or (%current-target-system) (%current-system))))
  3933. (or (string-prefix? "x86_64" system)
  3934. (string-prefix? "i686" system)
  3935. (string-prefix? "mips" system)
  3936. (string-prefix? "aarch64" system)))
  3937. #:make-flags
  3938. (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
  3939. "SHELL=bash"
  3940. "MAKE_NB_JOBS=0" ;use jobserver for submakes
  3941. ;; This is the maximum number of threads OpenBLAS will ever use (that
  3942. ;; is, if $OPENBLAS_NUM_THREADS is greater than that, then NUM_THREADS
  3943. ;; is used.) If we don't set it, the makefile sets it to the number
  3944. ;; of cores of the build machine, which is obviously wrong.
  3945. "NUM_THREADS=128"
  3946. ;; Build the library for all supported CPUs. This allows
  3947. ;; switching CPU targets at runtime with the environment variable
  3948. ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
  3949. ;; Unfortunately, this is not supported on all architectures,
  3950. ;; where it leads to failed builds.
  3951. ,@(let ((system (or (%current-target-system) (%current-system))))
  3952. (cond
  3953. ((or (string-prefix? "x86_64" system)
  3954. (string-prefix? "i686" system))
  3955. '("DYNAMIC_ARCH=1"))
  3956. ;; On some of these architectures the CPU can't be detected.
  3957. ((or (string-prefix? "powerpc64le" system)
  3958. (string-prefix? "aarch64" system))
  3959. '("DYNAMIC_ARCH=1"
  3960. "TARGET=GENERIC"))
  3961. ;; On MIPS we force the "SICORTEX" TARGET, as for the other
  3962. ;; two available MIPS targets special extended instructions
  3963. ;; for Loongson cores are used.
  3964. ((string-prefix? "mips" system)
  3965. '("TARGET=SICORTEX"))
  3966. ;; Failed to detect CPU.
  3967. ((string-prefix? "armhf" system)
  3968. '("TARGET=ARMV7"))
  3969. (else '()))))
  3970. ;; no configure script
  3971. #:phases
  3972. (modify-phases %standard-phases
  3973. (delete 'configure)
  3974. (add-before 'build 'set-extralib
  3975. (lambda* (#:key inputs #:allow-other-keys)
  3976. ;; Get libgfortran found when building in utest.
  3977. (setenv "FEXTRALIB"
  3978. (string-append "-L" (assoc-ref inputs "fortran-lib")
  3979. "/lib"))
  3980. #t)))))
  3981. (inputs
  3982. `(("fortran-lib" ,gfortran "lib")))
  3983. (native-inputs
  3984. `(("cunit" ,cunit)
  3985. ("fortran" ,gfortran)
  3986. ("perl" ,perl)))
  3987. (home-page "https://www.openblas.net/")
  3988. (synopsis "Optimized BLAS library based on GotoBLAS")
  3989. (description
  3990. "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
  3991. (license license:bsd-3)))
  3992. (define-public openblas-ilp64
  3993. (package/inherit openblas
  3994. (name "openblas-ilp64")
  3995. (supported-systems '("x86_64-linux" "aarch64-linux" "mips64el-linux"))
  3996. (arguments
  3997. (substitute-keyword-arguments (package-arguments openblas)
  3998. ((#:make-flags flags '())
  3999. `(append (list "INTERFACE64=1" "LIBNAMESUFFIX=ilp64")
  4000. ,flags))))
  4001. (synopsis "Optimized BLAS library based on GotoBLAS (ILP64 version)")
  4002. (license license:bsd-3)))
  4003. (define-public blis
  4004. (package
  4005. (name "blis")
  4006. (version "0.8.1")
  4007. (home-page "https://github.com/flame/blis")
  4008. (source (origin
  4009. (method git-fetch)
  4010. (uri (git-reference (url home-page) (commit version)))
  4011. (sha256
  4012. (base32
  4013. "05ifil6jj9424sr8kmircl8k4bmxnl3y12a79vwj1kxxva5gz50g"))
  4014. (file-name (git-file-name "blis" version))))
  4015. (native-inputs
  4016. `(("python" ,python)
  4017. ("perl" ,perl)))
  4018. (build-system gnu-build-system)
  4019. (arguments
  4020. `(#:modules
  4021. ((guix build gnu-build-system)
  4022. (guix build utils)
  4023. (srfi srfi-1))
  4024. #:test-target "test"
  4025. #:phases
  4026. (modify-phases %standard-phases
  4027. (replace 'configure
  4028. (lambda* (#:key outputs
  4029. target
  4030. system
  4031. (configure-flags '())
  4032. #:allow-other-keys)
  4033. ;; This is a home-made 'configure' script.
  4034. (let* ((out (assoc-ref outputs "out"))
  4035. ;; Guix-specific support for choosing the configuration
  4036. ;; via #:configure-flags: see below for details.
  4037. (config-flag-prefix "--blis-config=")
  4038. (maybe-config-flag (find
  4039. (lambda (s)
  4040. (string-prefix? config-flag-prefix s))
  4041. configure-flags))
  4042. (configure-flags (if maybe-config-flag
  4043. (delete maybe-config-flag
  4044. configure-flags)
  4045. configure-flags))
  4046. ;; Select the "configuration" to build.
  4047. ;; The "generic" configuration is non-optimized but
  4048. ;; portable (no assembly).
  4049. ;; The "x86_64" configuration family includes
  4050. ;; sub-configurations for all supported
  4051. ;; x86_64 microarchitectures.
  4052. ;; BLIS currently lacks runtime hardware detection
  4053. ;; for other architectures: see
  4054. ;; <https://github.com/flame/blis/commit/c534da6>.
  4055. ;; Conservatively, we stick to "generic" on armhf,
  4056. ;; aarch64, and ppc64le for now. (But perhaps
  4057. ;; "power9", "cortexa9", and "cortexa57" might be
  4058. ;; general enough to use?)
  4059. ;; Another approach would be to use the "auto"
  4060. ;; configuration and make this package
  4061. ;; non-substitutable.
  4062. ;; The build is fairly intensive, though.
  4063. (blis-config
  4064. (cond
  4065. (maybe-config-flag
  4066. (substring maybe-config-flag
  4067. (string-length config-flag-prefix)))
  4068. ((string-prefix? "x86_64" (or target system))
  4069. "x86_64")
  4070. (else
  4071. "generic")))
  4072. (configure-args
  4073. `("-p" ,out
  4074. "-d" "opt"
  4075. "--disable-static"
  4076. "--enable-shared"
  4077. "--enable-threading=openmp"
  4078. "--enable-verbose-make"
  4079. ,@configure-flags
  4080. ,blis-config)))
  4081. (format #t "configure args: ~s~%" configure-args)
  4082. (apply invoke
  4083. "./configure"
  4084. configure-args)
  4085. #t)))
  4086. (add-before 'check 'show-test-output
  4087. (lambda _
  4088. ;; By default "make check" is silent. Make it verbose.
  4089. (system "tail -F output.testsuite &")
  4090. #t)))))
  4091. (synopsis "High-performance basic linear algebra (BLAS) routines")
  4092. (description
  4093. "BLIS is a portable software framework for instantiating high-performance
  4094. BLAS-like dense linear algebra libraries. The framework was designed to
  4095. isolate essential kernels of computation that, when optimized, immediately
  4096. enable optimized implementations of most of its commonly used and
  4097. computationally intensive operations. While BLIS exports a new BLAS-like API,
  4098. it also includes a BLAS compatibility layer which gives application developers
  4099. access to BLIS implementations via traditional BLAS routine calls.")
  4100. (license license:bsd-3)))
  4101. (define-public blis-sandybridge (deprecated-package "blis-sandybridge" blis))
  4102. (define-public blis-haswell (deprecated-package "blis-haswell" blis))
  4103. (define-public blis-knl (deprecated-package "blis-knl" blis))
  4104. (define ignorance blis)
  4105. (define-public openlibm
  4106. (package
  4107. (name "openlibm")
  4108. (version "0.7.4")
  4109. (source
  4110. (origin
  4111. (method git-fetch)
  4112. (uri (git-reference
  4113. (url "https://github.com/JuliaLang/openlibm")
  4114. (commit (string-append "v" version))))
  4115. (file-name (git-file-name name version))
  4116. (sha256
  4117. (base32 "1azms0lpxb7vxb3bln5lyz0wpwx6jnzbffkclclpq2v5aiw8d14i"))))
  4118. (build-system gnu-build-system)
  4119. (arguments
  4120. `(#:make-flags
  4121. (list (string-append "prefix=" (assoc-ref %outputs "out"))
  4122. ,(string-append "CC=" (cc-for-target)))
  4123. #:phases
  4124. ;; no configure script
  4125. (modify-phases %standard-phases (delete 'configure))
  4126. #:tests? #f)) ;the tests are part of the default target
  4127. (home-page "https://openlibm.org/")
  4128. (synopsis "Portable C mathematical library (libm)")
  4129. (description
  4130. "OpenLibm is an effort to have a high quality, portable, standalone C
  4131. mathematical library (libm). It can be used standalone in applications and
  4132. programming language implementations. The project was born out of a need to
  4133. have a good libm for the Julia programming language that worked consistently
  4134. across compilers and operating systems, and in 32-bit and 64-bit
  4135. environments.")
  4136. ;; Each architecture has its own make target, and there is none for mips.
  4137. (supported-systems (delete "mips64el-linux" %supported-systems))
  4138. ;; See LICENSE.md for details.
  4139. (license (list license:expat
  4140. license:isc
  4141. license:bsd-2
  4142. license:public-domain
  4143. license:lgpl2.1+))))
  4144. (define-public openspecfun
  4145. (package
  4146. (name "openspecfun")
  4147. (version "0.5.3")
  4148. (source
  4149. (origin
  4150. (method git-fetch)
  4151. (uri (git-reference
  4152. (url "https://github.com/JuliaLang/openspecfun")
  4153. (commit (string-append "v" version))))
  4154. (file-name (git-file-name name version))
  4155. (sha256
  4156. (base32 "0pfw6l3ch7isz403llx7inxlvavqh01jh1hb9dpidi86sjjx9kfh"))))
  4157. (build-system gnu-build-system)
  4158. (arguments
  4159. '(#:tests? #f ; no "check" target
  4160. #:make-flags
  4161. (list (string-append "prefix=" (assoc-ref %outputs "out")))
  4162. #:phases
  4163. (modify-phases %standard-phases
  4164. (delete 'configure)))) ; no configure script
  4165. (inputs
  4166. `(("fortran" ,gfortran)))
  4167. (home-page "https://github.com/JuliaLang/openspecfun")
  4168. (synopsis "Collection of special mathematical functions")
  4169. (description
  4170. "Openspecfun provides AMOS and Faddeeva. AMOS (from Netlib) is a
  4171. portable package for Bessel Functions of a Complex Argument and Nonnegative
  4172. Order; it contains subroutines for computing Bessel functions and Airy
  4173. functions. Faddeeva allows computing the various error functions of arbitrary
  4174. complex arguments (Faddeeva function, error function, complementary error
  4175. function, scaled complementary error function, imaginary error function, and
  4176. Dawson function); given these, one can also easily compute Voigt functions,
  4177. Fresnel integrals, and similar related functions as well.")
  4178. ;; Faddeeva is released under the Expat license; AMOS is included as
  4179. ;; public domain software.
  4180. (license (list license:expat license:public-domain))))
  4181. (define-public suitesparse
  4182. (package
  4183. (name "suitesparse")
  4184. (version "5.10.1")
  4185. (source
  4186. (origin
  4187. (method git-fetch)
  4188. (uri (git-reference
  4189. (url "https://github.com/DrTimothyAldenDavis/SuiteSparse")
  4190. (commit (string-append "v" version))))
  4191. (file-name (git-file-name name version))
  4192. (sha256
  4193. (base32
  4194. "19gx5wlgqnqpgz6mvam9lalyzpbfwgqhppps8z3np9sh0mgaiyw9"))
  4195. (patches (search-patches "suitesparse-mongoose-cmake.patch"))
  4196. (modules '((guix build utils)))
  4197. (snippet
  4198. ;; Remove bundled metis source
  4199. '(begin
  4200. (delete-file-recursively "metis-5.1.0")
  4201. #t))))
  4202. (build-system gnu-build-system)
  4203. (arguments
  4204. `(#:tests? #f ;no "check" target
  4205. #:make-flags
  4206. (list (string-append "CC=" ,(cc-for-target))
  4207. "TBB=-ltbb"
  4208. "MY_METIS_LIB=-lmetis"
  4209. ;; The default is to link against netlib lapack. Use OpenBLAS
  4210. ;; instead.
  4211. "BLAS=-lopenblas" "LAPACK=-lopenblas"
  4212. ;; Flags for cmake (required to build GraphBLAS and Mongoose)
  4213. (string-append "CMAKE_OPTIONS=-DCMAKE_INSTALL_PREFIX="
  4214. (assoc-ref %outputs "out")
  4215. " -DCMAKE_VERBOSE_MAKEFILE=ON"
  4216. " -DCMAKE_C_FLAGS_RELEASE=\"$(CFLAGS) $(CPPFLAGS)\""
  4217. " -DCMAKE_CXX_FLAGS_RELEASE=\"$(CXXFLAGS) $(CPPFLAGS)\""
  4218. " -DCMAKE_SKIP_RPATH=TRUE"
  4219. " -DCMAKE_BUILD_TYPE=Release"
  4220. " -DCMAKE_INSTALL_LIBDIR=lib")
  4221. (string-append "INSTALL_LIB="
  4222. (assoc-ref %outputs "out") "/lib")
  4223. (string-append "INSTALL_INCLUDE="
  4224. (assoc-ref %outputs "out") "/include")
  4225. "library")
  4226. #:phases
  4227. (modify-phases %standard-phases
  4228. (delete 'configure)))) ;no configure script
  4229. (inputs
  4230. `(("tbb" ,tbb)
  4231. ("openblas" ,openblas)
  4232. ("gmp" ,gmp)
  4233. ("mpfr" ,mpfr)
  4234. ("metis" ,metis)))
  4235. (native-inputs
  4236. `(("cmake" ,cmake-minimal)
  4237. ("m4" ,m4)))
  4238. (home-page "http://faculty.cse.tamu.edu/davis/suitesparse.html")
  4239. (synopsis "Suite of sparse matrix software")
  4240. (description
  4241. "SuiteSparse is a suite of sparse matrix algorithms, including: UMFPACK,
  4242. multifrontal LU factorization; CHOLMOD, supernodal Cholesky; SPQR,
  4243. multifrontal QR; KLU and BTF, sparse LU factorization, well-suited for circuit
  4244. simulation; ordering methods (AMD, CAMD, COLAMD, and CCOLAMD); CSparse and
  4245. CXSparse, a concise sparse Cholesky factorization package; and many other
  4246. packages.")
  4247. ;; LGPLv2.1+:
  4248. ;; AMD, CAMD, BTF, COLAMD, CCOLAMD, CSparse, CXSparse, KLU, LDL
  4249. ;; GPLv2+:
  4250. ;; GPUQREngine, RBio, SuiteSparse_GPURuntime, SuiteSparseQR, UMFPACK
  4251. (license (list license:gpl2+ license:lgpl2.1+))))
  4252. (define-public atlas
  4253. (package
  4254. (name "atlas")
  4255. (version "3.10.3")
  4256. (source (origin
  4257. (method url-fetch)
  4258. (uri (string-append "mirror://sourceforge/math-atlas/Stable/"
  4259. version "/atlas" version ".tar.bz2"))
  4260. (patches (search-patches "atlas-gfortran-compat.patch"))
  4261. (sha256
  4262. (base32
  4263. "1dyjlq3fiparvm8ypwk6rsmjzmnwk81l88gkishphpvc79ryp216"))))
  4264. (build-system gnu-build-system)
  4265. (home-page "http://math-atlas.sourceforge.net/")
  4266. (inputs `(("gfortran" ,gfortran)
  4267. ("lapack-tar" ,(package-source lapack))))
  4268. (outputs '("out" "doc"))
  4269. ;; For the moment we drop support for MIPS at it fails to compile. See
  4270. ;; https://lists.gnu.org/archive/html/guix-devel/2014-11/msg00516.html
  4271. (supported-systems (delete "mips64el-linux" %supported-systems))
  4272. (arguments
  4273. `(#:parallel-build? #f
  4274. #:parallel-tests? #f
  4275. ;; ATLAS tunes itself for the machine it is built on, as explained at
  4276. ;; <http://lists.gnu.org/archive/html/guix-devel/2014-10/msg00305.html>.
  4277. ;; For this reason, we want users to build it locally instead of using
  4278. ;; substitutes.
  4279. #:substitutable? #f
  4280. #:modules ((srfi srfi-26)
  4281. (guix build gnu-build-system)
  4282. (guix build utils))
  4283. #:configure-flags
  4284. `(;; Generate position independent code suitable for dynamic libraries
  4285. ;; and use WALL timer to get more accurate timing.
  4286. "-Fa" "alg" "-fPIC" "-D" "c" "-DWALL"
  4287. ;; Set word width.
  4288. "-b"
  4289. ,,(if (string-match "64" (%current-system))
  4290. "64"
  4291. "32")
  4292. ;; Disable parallel build as it gives errors: atlas_pthread.h is
  4293. ;; needed to compile C files before it is generated.
  4294. "-Ss" "pmake" "make -j 1"
  4295. ;; Probe is failing for MIPS. We therefore define the system
  4296. ;; architecture explicitly by setting (-A) MACHINETYPE = 49
  4297. ;; 'MIPSR1xK' and (-V) ISA = 1 'none'.
  4298. ,,@(if (string-prefix? "mips" (%current-system))
  4299. (list "-A" "49" "-V" "1")
  4300. (list))
  4301. ;; Generate shared libraries.
  4302. "--shared"
  4303. ;; Build a full LAPACK library.
  4304. ,(string-append "--with-netlib-lapack-tarfile="
  4305. (assoc-ref %build-inputs "lapack-tar")))
  4306. #:phases
  4307. (modify-phases %standard-phases
  4308. (add-after 'install 'install-doc
  4309. (lambda* (#:key outputs inputs #:allow-other-keys)
  4310. (let ((doc (string-append (assoc-ref outputs "doc")
  4311. "/share/doc/atlas")))
  4312. (mkdir-p doc)
  4313. (for-each (cut install-file <> doc)
  4314. (find-files "../ATLAS/doc" ".*"))
  4315. #t)))
  4316. (add-after 'check 'check-pt
  4317. (lambda _ (invoke "make" "ptcheck")))
  4318. ;; Fix files required to run configure.
  4319. (add-before 'configure 'fix-/bin/sh
  4320. (lambda _
  4321. ;; Use `sh', not `/bin/sh'.
  4322. (substitute* (find-files "." "Makefile|configure|SpewMakeInc\\.c")
  4323. (("/bin/sh")
  4324. "sh"))
  4325. #t))
  4326. ;; Fix /bin/sh in generated make files.
  4327. (add-after 'configure 'fix-/bin/sh-in-generated-files
  4328. (lambda _
  4329. (substitute* (find-files "." "^[Mm]ake\\.inc.*")
  4330. (("/bin/sh")
  4331. "sh"))
  4332. #t))
  4333. ;; ATLAS configure program does not accepts the default flags
  4334. ;; passed by the 'gnu-build-system'.
  4335. (replace 'configure
  4336. (lambda* (#:key native-inputs inputs outputs
  4337. (configure-flags '())
  4338. #:allow-other-keys #:rest args)
  4339. (let* ((prefix (assoc-ref outputs "out"))
  4340. (bash (or (and=> (assoc-ref
  4341. (or native-inputs inputs) "bash")
  4342. (cut string-append <> "/bin/bash"))
  4343. "/bin/sh"))
  4344. (flags `(,(string-append "--prefix=" prefix)
  4345. ,@configure-flags))
  4346. (abs-srcdir (getcwd))
  4347. (srcdir (string-append "../" (basename abs-srcdir))))
  4348. (format #t "source directory: ~s (relative from build: ~s)~%"
  4349. abs-srcdir srcdir)
  4350. (mkdir "../build")
  4351. (chdir "../build")
  4352. (format #t "build directory: ~s~%" (getcwd))
  4353. (format #t "configure flags: ~s~%" flags)
  4354. (apply invoke bash
  4355. (string-append srcdir "/configure")
  4356. flags)))))))
  4357. (synopsis "Automatically Tuned Linear Algebra Software")
  4358. (description
  4359. "ATLAS is an automatically tuned linear algebra software library
  4360. providing C and Fortran77 interfaces to a portably efficient BLAS
  4361. implementation, as well as a few routines from LAPACK.
  4362. Optimization occurs at build time. For this reason, the library is built on
  4363. the machine where it is installed, without resorting to pre-built substitutes.
  4364. Before building the library, CPU throttling should be disabled. This can be
  4365. done in the BIOS, or, on GNU/Linux, with the following command:
  4366. @example
  4367. # cpupower --governor performance
  4368. @end example
  4369. Failure to do so will result in a library with poor performance.")
  4370. ;; The test suite is notoriously lengthy and routinely exceeds the default
  4371. ;; timeout of 21600 seconds on the not unbeefy berlin build nodes.
  4372. (properties '((timeout . 86400))) ; 1 day
  4373. (license license:bsd-3)))
  4374. (define-public cglm
  4375. (package
  4376. (name "cglm")
  4377. (version "0.8.2")
  4378. (source
  4379. (origin
  4380. (method git-fetch)
  4381. (uri (git-reference
  4382. (url "https://github.com/recp/cglm")
  4383. (commit (string-append "v" version))))
  4384. (file-name (git-file-name name version))
  4385. (sha256
  4386. (base32 "1lcfl9ph4bnl3hckpx4hzwh8r4llnw94ik75igc5qy38wk468gmk"))))
  4387. (build-system cmake-build-system)
  4388. (arguments
  4389. `(#:configure-flags
  4390. (list "-DCGLM_USE_TEST=ON")))
  4391. (home-page "https://github.com/recp/cglm")
  4392. (synopsis "Mathematics C library for graphics programming")
  4393. (description
  4394. "@acronym{CGLM, C OpenGL Mathematics} is an optimised 3D maths library
  4395. for graphics software based on the @acronym{GLSL, OpenGL Shading Language}
  4396. specifications.
  4397. It's similar to the original C++ GLM library but written in C99 and compatible
  4398. with C89.")
  4399. (license license:expat)))
  4400. (define-public glm
  4401. (package
  4402. (name "glm")
  4403. (version "0.9.9.8")
  4404. (source
  4405. (origin
  4406. (method url-fetch)
  4407. (uri (string-append "https://github.com/g-truc/glm/releases/download/"
  4408. version "/glm-" version ".zip"))
  4409. (sha256
  4410. (base32 "0k6yk9v46h690rshdx49x98y5qspkzibld1wb51jwcm35vba7qip"))))
  4411. (build-system cmake-build-system)
  4412. (arguments
  4413. `(#:phases (modify-phases %standard-phases
  4414. (replace 'install
  4415. (lambda* (#:key outputs #:allow-other-keys)
  4416. ;; Since version 0.9.9.6, 'make install' is not supported
  4417. ;; and we have to do it "manually". Upstream discussion:
  4418. ;; <https://github.com/g-truc/glm/pull/968>.
  4419. (let* ((source (string-append "../glm"))
  4420. (out (assoc-ref outputs "out"))
  4421. (inc (string-append out "/include"))
  4422. (lib (string-append out "/lib"))
  4423. (pkgconfig (string-append lib "/pkgconfig")))
  4424. (with-directory-excursion source
  4425. (mkdir-p inc)
  4426. (mkdir-p pkgconfig)
  4427. (copy-recursively "glm" (string-append inc "/glm"))
  4428. (copy-recursively "cmake" (string-append lib "/cmake"))
  4429. (call-with-output-file (string-append pkgconfig "/glm.pc")
  4430. (lambda (port)
  4431. (format port
  4432. "prefix=~a
  4433. includedir=${prefix}/include
  4434. Name: GLM
  4435. Description: OpenGL Mathematics
  4436. Version: ~a
  4437. Cflags: -I${includedir}~%" out ,(version-prefix version 3)))))
  4438. #t))))))
  4439. (native-inputs
  4440. `(("unzip" ,unzip)))
  4441. (home-page "https://glm.g-truc.net/")
  4442. (synopsis "OpenGL Mathematics library")
  4443. (description "OpenGL Mathematics (GLM) is a header-only C++ mathematics
  4444. library for graphics software based on the OpenGL Shading Language (GLSL)
  4445. specifications.")
  4446. (license license:expat)))
  4447. (define-public lpsolve
  4448. (package
  4449. (name "lpsolve")
  4450. (version "5.5.2.5")
  4451. (source
  4452. (origin
  4453. (method url-fetch)
  4454. (uri (string-append "mirror://sourceforge/lpsolve/lpsolve/" version
  4455. "/lp_solve_" version "_source.tar.gz"))
  4456. (sha256
  4457. (base32
  4458. "12pj1idjz31r7c2mb5w03vy1cmvycvbkx9z29s40qdmkp1i7q6i0"))
  4459. (modules '((guix build utils)))
  4460. (snippet
  4461. '(begin
  4462. (substitute* (list "lp_solve/ccc" "lpsolve55/ccc")
  4463. (("^c=cc") "c=gcc")
  4464. ;; Pretend to be on a 64 bit platform to obtain a common directory
  4465. ;; name for the build results on all architectures; nothing else
  4466. ;; seems to depend on it.
  4467. (("^PLATFORM=.*$") "PLATFORM=ux64\n")
  4468. ;; The check for 'isnan' as it is written fails with
  4469. ;; "non-floating-point argument in call to function
  4470. ;; ‘__builtin_isnan’", which leads to the 'NOISNAN' cpp macro
  4471. ;; definition, which in turn leads to bad things. Fix the feature
  4472. ;; test.
  4473. (("isnan\\(0\\)") "isnan(0.)"))
  4474. #t))))
  4475. (build-system gnu-build-system)
  4476. (arguments
  4477. `(#:tests? #f ; no check target
  4478. #:phases
  4479. (modify-phases %standard-phases
  4480. (delete 'configure) ; no configure script
  4481. (replace 'build
  4482. (lambda _
  4483. (with-directory-excursion "lpsolve55"
  4484. (invoke "bash" "ccc"))
  4485. (with-directory-excursion "lp_solve"
  4486. (invoke "bash" "ccc"))
  4487. #t))
  4488. (replace 'install
  4489. (lambda* (#:key outputs #:allow-other-keys)
  4490. (let* ((out (assoc-ref outputs "out"))
  4491. (bin (string-append out "/bin"))
  4492. (lib (string-append out "/lib"))
  4493. ;; This is where LibreOffice expects to find the header
  4494. ;; files, and where they are installed by Debian.
  4495. (include (string-append out "/include/lpsolve")))
  4496. (install-file "lpsolve55/bin/ux64/liblpsolve55.a" lib)
  4497. (install-file "lpsolve55/bin/ux64/liblpsolve55.so" lib)
  4498. (install-file "lp_solve/bin/ux64/lp_solve" bin)
  4499. ;; Install a subset of the header files as on Debian
  4500. ;; (plus lp_bit.h, which matches the regular expression).
  4501. (for-each (lambda (name)
  4502. (install-file name include))
  4503. (find-files "." "lp_[HMSa-z].*\\.h$"))
  4504. (with-directory-excursion "shared"
  4505. (for-each (lambda (name)
  4506. (install-file name include))
  4507. (find-files "." "\\.h$")))
  4508. #t))))))
  4509. (home-page "http://lpsolve.sourceforge.net/")
  4510. (synopsis "Mixed integer linear programming (MILP) solver")
  4511. (description
  4512. "lp_solve is a mixed integer linear programming solver based on the
  4513. revised simplex and the branch-and-bound methods.")
  4514. (license license:lgpl2.1+)))
  4515. ;; Private Trilinos package for dealii-openmpi (similar to
  4516. ;; trilinos-serial-xyce and trilinos-parallel-xyce).
  4517. ;; This version is the latest known to be compatible with deal.II [1].
  4518. ;; Since the latest version of Trilinos is not necessarily supported by
  4519. ;; deal.II, it may be worth keeping this package even if and when Trilinos
  4520. ;; gets packaged separately for Guix (unless various versions of Trilinos are
  4521. ;; packaged).
  4522. ;;
  4523. ;; An insightful source of information for building Trilinos for deal.II lies
  4524. ;; in the Trilinos package for candi [2], which is a source-based installer
  4525. ;; for deal.II and its dependencies.
  4526. ;;
  4527. ;; [1]: https://www.dealii.org/current/external-libs/trilinos.html
  4528. ;; [2]: https://github.com/dealii/candi/blob/master/deal.II-toolchain/packages/trilinos.package
  4529. (define trilinos-for-dealii-openmpi
  4530. (package
  4531. (name "trilinos-for-dealii-openmpi")
  4532. (version "12.18.1")
  4533. (source
  4534. (origin
  4535. (method git-fetch)
  4536. (uri (git-reference
  4537. (url "https://github.com/trilinos/Trilinos/")
  4538. (commit
  4539. (string-append "trilinos-release-"
  4540. (string-replace-substring version "." "-")))))
  4541. (file-name (git-file-name "trilinos" version))
  4542. (sha256
  4543. (base32 "0fnwlhzsh85qj38cq3igbs8nm1b2jdgr2z734sapmyyzsy21mkgp"))))
  4544. (build-system cmake-build-system)
  4545. (native-inputs
  4546. `(("gfortran" ,gfortran)
  4547. ;; Trilinos's repository contains several C-shell scripts, but adding
  4548. ;; tcsh to the native inputs does not result in the check phase running
  4549. ;; any more tests than without it (nor is tcsh required to build
  4550. ;; Trilinos).
  4551. ;; It seems that Trilinos has replaced its use of C-shell test scripts
  4552. ;; with CMake's testing facilities.
  4553. ;; For example,
  4554. ;; packages/zoltan/doc/Zoltan_html/dev_html/dev_test_script.html [1]
  4555. ;; states that Zoltan's C-shell test script
  4556. ;; packages/zoltan/test/test_zoltan has been obsoleted by the tests now
  4557. ;; performed through CMake.
  4558. ;;
  4559. ;; Perl is required for some Zoltan tests and Python 2 for one ML test.
  4560. ;;
  4561. ;; [1]: https://cs.sandia.gov/zoltan/dev_html/dev_test_script.html
  4562. ("perl" ,perl)
  4563. ("python" ,python-2)))
  4564. (inputs
  4565. `(("blas" ,openblas)
  4566. ("lapack" ,lapack)
  4567. ("mumps" ,mumps-openmpi)
  4568. ("scalapack" ,scalapack)))
  4569. (propagated-inputs
  4570. `(("mpi" ,openmpi)))
  4571. (arguments
  4572. `(#:build-type "Release"
  4573. #:configure-flags
  4574. `("-DBUILD_SHARED_LIBS=ON"
  4575. ;; Obtain the equivalent of RelWithDebInfo but with -O3 (the Release
  4576. ;; default) rather than -O2 (the RelWithDebInfo default), to conform
  4577. ;; to candi's trilinos.package's compilation flags, which are -g -O3.
  4578. "-DCMAKE_C_FLAGS=-g"
  4579. "-DCMAKE_CXX_FLAGS=-g"
  4580. "-DCMAKE_Fortran_FLAGS=-g"
  4581. ;; Trilinos libraries that deal.II can interface with.
  4582. "-DTrilinos_ENABLE_Amesos=ON"
  4583. "-DTrilinos_ENABLE_AztecOO=ON"
  4584. "-DTrilinos_ENABLE_Epetra=ON"
  4585. "-DTrilinos_ENABLE_EpetraExt=ON"
  4586. "-DTrilinos_ENABLE_Ifpack=ON"
  4587. "-DTrilinos_ENABLE_ML=ON"
  4588. "-DTrilinos_ENABLE_MueLu=ON"
  4589. "-DTrilinos_ENABLE_ROL=ON"
  4590. ;; Optional; required for deal.II's GridIn::read_exodusii, but
  4591. ;; depends on netcdf.
  4592. ;; Enable if and when someone needs it.
  4593. ;;"-DTrilinos_ENABLE_SEACAS=ON"
  4594. "-DTrilinos_ENABLE_Sacado=ON"
  4595. "-DTrilinos_ENABLE_Teuchos=ON"
  4596. "-DTrilinos_ENABLE_Tpetra=ON"
  4597. "-DTrilinos_ENABLE_Zoltan=ON"
  4598. ;; Third-party libraries (TPLs) that Trilinos can interface with.
  4599. "-DBLAS_LIBRARY_NAMES=openblas"
  4600. "-DTPL_ENABLE_MPI=ON"
  4601. "-DTPL_ENABLE_MUMPS=ON"
  4602. "-DTPL_ENABLE_SCALAPACK=ON"
  4603. ;; Enable the tests but not the examples (which are enabled by
  4604. ;; default when enabling tests).
  4605. ;; Although some examples are run as tests, they are otherwise
  4606. ;; unnecessary since this is a private package meant for
  4607. ;; dealii-openmpi.
  4608. ;; Besides, some MueLu and ROL examples require a lot of memory to
  4609. ;; compile.
  4610. ;;
  4611. ;; (For future reference, note that some ROL and SEACAS examples
  4612. ;; require removing gfortran from CPLUS_INCLUDE_PATH as in the
  4613. ;; dune-istl, dune-localfunctions and dune-alugrid packages.)
  4614. "-DTrilinos_ENABLE_TESTS=ON"
  4615. "-DTrilinos_ENABLE_EXAMPLES=OFF"
  4616. ;; MueLu tests require considerably more time and memory to compile
  4617. ;; than the rest of the tests.
  4618. "-DMueLu_ENABLE_TESTS=OFF"
  4619. ;; The following options were gleaned from candi's trilinos.package.
  4620. ;; (We do not enable the complex instantiations, which are anyway
  4621. ;; provided only as an option in trilinos.package, because they are
  4622. ;; costly in compilation time and memory usage, and disk space [1].)
  4623. ;;
  4624. ;; [1]: https://www.docs.trilinos.org/files/TrilinosBuildReference.html#enabling-float-and-complex-scalar-types
  4625. "-DTrilinos_ENABLE_Ifpack2=OFF"
  4626. "-DTeuchos_ENABLE_FLOAT=ON"
  4627. "-DTpetra_INST_INT_LONG=ON"
  4628. "-DTPL_ENABLE_Boost=OFF")
  4629. #:phases
  4630. (modify-phases %standard-phases
  4631. (add-after 'configure 'fix-kokkos-config
  4632. (lambda _
  4633. ;; GNU Make 4.3 accidentally leaves the backslash preceding the
  4634. ;; number sign in strings containing a literal backslash–number
  4635. ;; sign (\#) [1, 2].
  4636. ;; This is still an issue in Trilinos 13.0.1, but should be fixed
  4637. ;; in the following version.
  4638. ;; (The latest versions of Kokkos incorporate the fix [2].)
  4639. ;;
  4640. ;; [1]: https://github.com/GEOSX/thirdPartyLibs/issues/136
  4641. ;; [2]: https://github.com/kokkos/kokkos/blob/3.4.00/Makefile.kokkos#L441
  4642. (substitute* "KokkosCore_config.h"
  4643. (("\\\\#") "#"))
  4644. #t))
  4645. (add-before 'check 'mpi-setup
  4646. ,%openmpi-setup))))
  4647. (home-page "https://trilinos.github.io/")
  4648. (synopsis "Algorithms for engineering and scientific problems")
  4649. (description
  4650. "The Trilinos Project is an effort to develop algorithms and enabling
  4651. technologies within an object-oriented software framework for the solution of
  4652. large-scale, complex multi-physics engineering and scientific problems.
  4653. A unique design feature of Trilinos is its focus on packages.")
  4654. ;; The packages are variously licensed under more than just BSD-3 and
  4655. ;; LGPL-2.1+, but all the licenses are either BSD- or LGPL-compatible.
  4656. ;; See https://trilinos.github.io/license.html.
  4657. (license (list license:bsd-3 license:lgpl2.1+))))
  4658. (define-public dealii
  4659. (package
  4660. (name "dealii")
  4661. (version "9.3.1")
  4662. (source
  4663. (origin
  4664. (method url-fetch)
  4665. (uri (string-append "https://github.com/dealii/dealii/releases/"
  4666. "download/v" version "/dealii-" version ".tar.gz"))
  4667. (sha256
  4668. (base32 "1f0sqvlxvl0myqcn0q6xrn1vnp5pgx143lai4a4jkh1dmdv4cbx6"))
  4669. (modules '((guix build utils)))
  4670. (snippet
  4671. '(begin
  4672. ;; Remove bundled boost, muparser, TBB and UMFPACK.
  4673. (delete-file-recursively "bundled")
  4674. #t))))
  4675. (build-system cmake-build-system)
  4676. (outputs '("out" "doc"))
  4677. (native-inputs
  4678. ;; Required to build the documentation.
  4679. `(("dot" ,graphviz)
  4680. ("doxygen" ,doxygen)
  4681. ("perl" ,perl)))
  4682. (inputs
  4683. `(("arpack" ,arpack-ng)
  4684. ("blas" ,openblas)
  4685. ("gfortran" ,gfortran)
  4686. ("lapack" ,lapack)
  4687. ("muparser" ,muparser)
  4688. ("zlib" ,zlib)))
  4689. (propagated-inputs
  4690. ;; Some scripts are installed into share/deal.II/scripts that require
  4691. ;; perl and python, but they are not executable (and some are missing the
  4692. ;; shebang line) and therefore must be explicitly passed to the
  4693. ;; interpreter.
  4694. ;; Anyway, they are meant to be used at build time, so rather than adding
  4695. ;; the interpreters here, any package depending on them should just add
  4696. ;; the requisite interpreter to its native inputs.
  4697. `(("boost" ,boost)
  4698. ("hdf5" ,hdf5)
  4699. ("suitesparse" ,suitesparse) ; For UMFPACK.
  4700. ("tbb" ,tbb)))
  4701. (arguments
  4702. `(#:build-type "DebugRelease" ; Supports only Debug, Release and DebugRelease.
  4703. ;; The tests take too long and must be explicitly enabled with "make
  4704. ;; setup_tests".
  4705. ;; See https://www.dealii.org/developer/developers/testsuite.html.
  4706. ;; (They can also be run for an already installed deal.II.)
  4707. #:tests? #f
  4708. #:configure-flags
  4709. (let ((doc (string-append (assoc-ref %outputs "doc")
  4710. "/share/doc/" ,name "-" ,version)))
  4711. `("-DDEAL_II_COMPONENT_DOCUMENTATION=ON"
  4712. ,(string-append "-DDEAL_II_DOCREADME_RELDIR=" doc)
  4713. ,(string-append "-DDEAL_II_DOCHTML_RELDIR=" doc "/html")
  4714. ;; Don't compile the examples because the source and CMakeLists.txt
  4715. ;; are installed anyway, allowing users to do so for themselves.
  4716. "-DDEAL_II_COMPILE_EXAMPLES=OFF"
  4717. ,(string-append "-DDEAL_II_EXAMPLES_RELDIR=" doc "/examples")))
  4718. #:phases
  4719. (modify-phases %standard-phases
  4720. (add-after 'install 'remove-build-logs
  4721. ;; These build logs leak the name of the build directory by storing
  4722. ;; the values of CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR.
  4723. (lambda* (#:key outputs #:allow-other-keys)
  4724. (let ((doc (string-append (assoc-ref outputs "doc")
  4725. "/share/doc/" ,name "-" ,version)))
  4726. (for-each delete-file (map (lambda (f) (string-append doc "/" f))
  4727. '("detailed.log" "summary.log"))))
  4728. #t)))))
  4729. (home-page "https://www.dealii.org/")
  4730. (synopsis "Finite element library")
  4731. (description
  4732. "Deal.II is a C++ program library targeted at the computational solution
  4733. of partial differential equations using adaptive finite elements. The main
  4734. aim of deal.II is to enable rapid development of modern finite element codes,
  4735. using among other aspects adaptive meshes and a wide array of tools often used
  4736. in finite element programs.")
  4737. (license license:lgpl2.1+)))
  4738. (define-public dealii-openmpi
  4739. (package/inherit dealii
  4740. (name "dealii-openmpi")
  4741. (inputs
  4742. `(("arpack" ,arpack-ng-openmpi)
  4743. ("metis" ,metis)
  4744. ("scalapack" ,scalapack)
  4745. ,@(alist-delete "arpack" (package-inputs dealii))))
  4746. (propagated-inputs
  4747. `(("hdf5" ,hdf5-parallel-openmpi)
  4748. ("mpi" ,openmpi)
  4749. ("p4est" ,p4est-openmpi)
  4750. ("petsc" ,petsc-openmpi)
  4751. ("slepc" ,slepc-openmpi)
  4752. ("trilinos" ,trilinos-for-dealii-openmpi)
  4753. ,@(alist-delete "hdf5" (package-propagated-inputs dealii))))
  4754. (arguments
  4755. (substitute-keyword-arguments (package-arguments dealii)
  4756. ((#:configure-flags flags)
  4757. `(cons "-DDEAL_II_WITH_MPI=ON" ,flags))))
  4758. (synopsis "Finite element library (with MPI support)")))
  4759. (define-public flann
  4760. (package
  4761. (name "flann")
  4762. (version "1.9.1")
  4763. (home-page "https://github.com/mariusmuja/flann/")
  4764. (source
  4765. (origin
  4766. (method git-fetch)
  4767. (uri (git-reference (url home-page) (commit version)))
  4768. (file-name (git-file-name name version))
  4769. (sha256
  4770. (base32
  4771. "0p56fl2yx1r86ds1mgjq40926jdcgq3hka7p3l1hv2acv9jxp15x"))
  4772. (patches (search-patches "flann-cmake-3.11.patch"))))
  4773. (build-system cmake-build-system)
  4774. (outputs '("out"))
  4775. (native-inputs
  4776. `(("unzip" ,unzip)))
  4777. (inputs
  4778. `(("hdf5" ,hdf5)
  4779. ;; FIXME: 'mkoctfile' fails with a linker error:
  4780. ;; ld: cannot find -loctinterp
  4781. ;; ld: cannot find -loctave
  4782. ;; Disable it for now.
  4783. ;;("octave" ,octave-cli)
  4784. ("python" ,python-2) ; print syntax
  4785. ;; ("python2-numpy" ,python2-numpy) ; only required for the tests
  4786. ("zlib" ,zlib)))
  4787. (arguments
  4788. `(;; The 'share/flann/octave' contains a .mex file, which is an ELF file
  4789. ;; taken 46 MiB unstripped, and 6 MiB stripped.
  4790. #:strip-directories '("lib" "lib64" "libexec"
  4791. "bin" "sbin" "share/flann/octave")
  4792. ;; Save 12 MiB by not installing .a files. Passing
  4793. ;; '-DBUILD_STATIC_LIBS=OFF' has no effect.
  4794. #:phases (modify-phases %standard-phases
  4795. (add-after 'install 'remove-static-libraries
  4796. (lambda* (#:key outputs #:allow-other-keys)
  4797. (let* ((out (assoc-ref outputs "out"))
  4798. (lib (string-append out "/lib")))
  4799. (for-each delete-file
  4800. (find-files lib "\\.a$"))
  4801. #t))))
  4802. #:tests? #f)) ; The test data are downloaded from the Internet.
  4803. (synopsis "Library for approximate nearest neighbors computation")
  4804. (description "FLANN is a library for performing fast approximate
  4805. nearest neighbor searches in high dimensional spaces. It implements a
  4806. collection of algorithms and a system for automatically choosing the best
  4807. algorithm and optimum parameters depending on the dataset.
  4808. FLANN is written in C++ and contains bindings for C, Octave and Python.")
  4809. (license (license:non-copyleft "file://COPYING"
  4810. "See COPYING in the distribution."))))
  4811. (define-public wcalc
  4812. (package
  4813. (name "wcalc")
  4814. (version "2.5")
  4815. (source
  4816. (origin
  4817. (method url-fetch)
  4818. (uri (string-append "mirror://sourceforge/w-calc/Wcalc/" version "/"
  4819. "wcalc-" version ".tar.bz2"))
  4820. (sha256
  4821. (base32
  4822. "1vi8dl6rccqiq1apmpwawyg2ywx6a1ic1d3cvkf2hlwk1z11fb0f"))))
  4823. (build-system gnu-build-system)
  4824. (inputs
  4825. `(("mpfr" ,mpfr)
  4826. ("readline" ,readline)))
  4827. (home-page "http://w-calc.sourceforge.net/index.php")
  4828. (synopsis "Flexible command-line scientific calculator")
  4829. (description "Wcalc is a very capable calculator. It has standard functions
  4830. (sin, asin, and sinh for example, in either radians or degrees), many
  4831. pre-defined constants (pi, e, c, etc.), support for using variables, \"active\"
  4832. variables, a command history, hex/octal/binary input and output, unit
  4833. conversions, embedded comments, and an expandable expression entry field. It
  4834. evaluates expressions using the standard order of operations.")
  4835. (license license:gpl2+)))
  4836. (define-public xaos
  4837. (package
  4838. (name "xaos")
  4839. (version "4.2.1")
  4840. (source (origin
  4841. (method git-fetch)
  4842. (uri (git-reference
  4843. (url "https://github.com/xaos-project/XaoS")
  4844. (commit (string-append "release-" version))))
  4845. (file-name (git-file-name name version))
  4846. (sha256
  4847. (base32
  4848. "0maw5am6rrkyjrprfg113zjq37mqj0iaznkg4h2927ff7wrprc94"))))
  4849. (build-system gnu-build-system)
  4850. (native-inputs `(("gettext" ,gettext-minimal)
  4851. ("qtbase" ,qtbase-5)
  4852. ("qttools" ,qttools)))
  4853. (inputs `(("libx11" ,libx11)
  4854. ("zlib" ,zlib)
  4855. ("libpng" ,libpng)
  4856. ("gsl" ,gsl)))
  4857. ;; The upstream project file ("XaoS.pro") and the Makefile it generates are
  4858. ;; not enough for this package to install properly. These phases fix that.
  4859. (arguments
  4860. `(#:tests? #f ;no "check" target
  4861. #:phases
  4862. (modify-phases %standard-phases
  4863. (add-before 'configure 'make-qt-deterministic
  4864. (lambda _
  4865. ;; Make Qt deterministic.
  4866. (setenv "QT_RCC_SOURCE_DATE_OVERRIDE" "1")
  4867. #t))
  4868. (replace 'configure
  4869. (lambda* (#:key outputs #:allow-other-keys)
  4870. (let ((out (assoc-ref outputs "out")))
  4871. (substitute* "XaoS.pro"
  4872. ;; The DESTDIR is originally set to install the xaos binary to
  4873. ;; the "bin" folder inside the build directory. Setting make
  4874. ;; flags doesn't seem to change this.
  4875. (("DESTDIR.*$")
  4876. (string-append "DESTDIR=" out "/bin"))
  4877. ;; Set the correct path to the lrelease binary.
  4878. (("lrelease-qt5") "lrelease"))
  4879. (substitute* "src/include/config.h"
  4880. (("/usr/share/XaoS")
  4881. (string-append out "/share/XaoS")))
  4882. (invoke "qmake"))))
  4883. (add-after 'install 'install-data
  4884. (lambda* (#:key outputs #:allow-other-keys)
  4885. (let* ((out (assoc-ref outputs "out"))
  4886. (share (string-append out "/share")))
  4887. (mkdir-p share)
  4888. (for-each
  4889. (lambda (folder)
  4890. (copy-recursively folder
  4891. (string-append share "/XaoS/" folder)))
  4892. '("catalogs" "examples" "tutorial"))
  4893. (install-file "xdg/xaos.png"
  4894. (string-append share "/pixmaps"))
  4895. (install-file "xdg/xaos.desktop"
  4896. (string-append share "/applications")))
  4897. #t)))))
  4898. (synopsis "Real-time fractal zoomer")
  4899. (description "GNU XaoS is a graphical program that generates fractal
  4900. patterns and allows you to zoom in and out of them infinitely in a fluid,
  4901. continuous manner. It also includes tutorials that help to explain how fractals
  4902. are built. It can generate many different fractal types such as the Mandelbrot
  4903. set.")
  4904. (home-page "https://xaos-project.github.io/")
  4905. (license license:gpl2+)))
  4906. (define-public hypre
  4907. (package
  4908. (name "hypre")
  4909. (version "2.20.0")
  4910. (source
  4911. (origin
  4912. (method git-fetch)
  4913. (uri (git-reference
  4914. (url "https://github.com/hypre-space/hypre")
  4915. (commit (string-append "v" version))))
  4916. (file-name (git-file-name name version))
  4917. (sha256
  4918. (base32 "14iqjwg5sv1qjn7c2cfv0xxmn9rwamjrhh9hgs8fjbywcbvrkjdi"))))
  4919. (build-system gnu-build-system)
  4920. (outputs '("out" ;5.3 MiB of headers and libraries
  4921. "doc")) ;12 MiB of documentation
  4922. (native-inputs
  4923. `(("doc++" ,doc++)
  4924. ("doxygen" ,doxygen)
  4925. ("python" ,python)
  4926. ("python-breathe" ,python-breathe)
  4927. ("python-sphinx" ,python-sphinx)
  4928. ("texlive" ,(texlive-updmap.cfg (list texlive-adjustbox
  4929. texlive-amsfonts
  4930. texlive-bibtex
  4931. texlive-caption
  4932. texlive-cm
  4933. texlive-etoolbox
  4934. texlive-jknappen
  4935. texlive-sectsty
  4936. texlive-tex-gyre
  4937. texlive-wasy
  4938. texlive-xcolor
  4939. texlive-xypic
  4940. texlive-generic-listofitems
  4941. texlive-generic-ulem
  4942. texlive-latex-capt-of
  4943. texlive-latex-cmap
  4944. texlive-latex-colortbl
  4945. texlive-latex-etoc
  4946. texlive-latex-fancyhdr
  4947. texlive-latex-fancyvrb
  4948. texlive-latex-float
  4949. texlive-latex-fncychap
  4950. texlive-latex-framed
  4951. texlive-latex-geometry
  4952. texlive-latex-hanging
  4953. texlive-hyperref
  4954. texlive-latex-multirow
  4955. texlive-latex-natbib
  4956. texlive-latex-needspace
  4957. texlive-latex-newunicodechar
  4958. texlive-latex-parskip
  4959. texlive-latex-stackengine
  4960. texlive-latex-tabulary
  4961. texlive-latex-titlesec
  4962. texlive-latex-tocloft
  4963. texlive-latex-upquote
  4964. texlive-latex-varwidth
  4965. texlive-wasysym
  4966. texlive-latex-wrapfig)))))
  4967. (inputs
  4968. `(("blas" ,openblas)
  4969. ("lapack" ,lapack)))
  4970. (arguments
  4971. `(#:modules ((srfi srfi-1)
  4972. ,@%gnu-build-system-modules)
  4973. #:configure-flags '("--enable-shared"
  4974. "--disable-fortran"
  4975. "--without-MPI"
  4976. "--with-openmp"
  4977. "--with-fei"
  4978. "--with-lapack"
  4979. "--with-blas")
  4980. #:phases
  4981. (modify-phases %standard-phases
  4982. (add-before 'configure 'chdir-src
  4983. (lambda _ (chdir "src")))
  4984. (replace 'configure
  4985. (lambda* (#:key build target configure-flags
  4986. #:allow-other-keys #:rest args)
  4987. (let* ((configure (assoc-ref %standard-phases 'configure)))
  4988. (apply configure
  4989. (append args
  4990. (list #:configure-flags
  4991. (cons (string-append
  4992. "--host=" (or target build))
  4993. configure-flags)))))))
  4994. (add-after 'build 'build-docs
  4995. (lambda _
  4996. (invoke "make" "-C" "docs")))
  4997. (replace 'check
  4998. (lambda _
  4999. (setenv "LD_LIBRARY_PATH" (string-append (getcwd) "/hypre/lib"))
  5000. (setenv "PATH" (string-append "." ":" (getenv "PATH")))
  5001. (invoke "make" "check" "CHECKRUN=")
  5002. (for-each (lambda (filename)
  5003. (let ((size (stat:size (stat filename))))
  5004. (when (positive? size)
  5005. (error (format #f "~a size ~d; error indication~%"
  5006. filename size)))))
  5007. (find-files "test" ".*\\.err$"))))
  5008. (add-after 'install 'install-docs
  5009. (lambda* (#:key outputs #:allow-other-keys)
  5010. ;; Custom install because docs/Makefile doesn't honor ${docdir}.
  5011. (let* ((doc (assoc-ref outputs "doc"))
  5012. (docdir (string-append doc "/share/doc/hypre-" ,version)))
  5013. (with-directory-excursion "docs"
  5014. (for-each (lambda (base)
  5015. (install-file (string-append base ".pdf") docdir)
  5016. (copy-recursively (string-append base "-html")
  5017. (string-append docdir "/" base)))
  5018. '("usr-manual" "ref-manual")))))))))
  5019. (home-page "https://computing.llnl.gov/projects\
  5020. /hypre-scalable-linear-solvers-multigrid-methods")
  5021. (synopsis "Library of solvers and preconditioners for linear equations")
  5022. (description
  5023. "HYPRE is a software library of high performance preconditioners and
  5024. solvers for the solution of large, sparse linear systems of equations. It
  5025. features multigrid solvers for both structured and unstructured grid
  5026. problems.")
  5027. (license license:lgpl2.1)))
  5028. (define-public hypre-openmpi
  5029. (package (inherit hypre)
  5030. (name "hypre-openmpi")
  5031. (inputs
  5032. `(("mpi" ,openmpi)
  5033. ,@(package-inputs hypre)))
  5034. (arguments
  5035. (substitute-keyword-arguments (package-arguments hypre)
  5036. ((#:configure-flags flags)
  5037. ``("--with-MPI"
  5038. ,@(delete "--without-MPI" ,flags)))
  5039. ((#:phases phases)
  5040. `(modify-phases ,phases
  5041. (add-before 'check 'mpi-setup
  5042. ,%openmpi-setup)))))
  5043. (synopsis "Parallel solvers and preconditioners for linear equations")
  5044. (description
  5045. "HYPRE is a software library of high performance preconditioners and
  5046. solvers for the solution of large, sparse linear systems of equations on
  5047. parallel computers. It features parallel multigrid solvers for both
  5048. structured and unstructured grid problems.")))
  5049. (define-public matio
  5050. (package
  5051. (name "matio")
  5052. (version "1.5.19")
  5053. (source
  5054. (origin
  5055. (method url-fetch)
  5056. (uri (string-append "mirror://sourceforge/matio/matio/" version "/"
  5057. "matio-" version ".tar.gz"))
  5058. (sha256
  5059. (base32
  5060. "0vr8c1mz1k6mz0sgh6n3scl5c3a71iqmy5fnydrgq504icj4vym4"))))
  5061. (build-system gnu-build-system)
  5062. (inputs
  5063. `(("zlib" ,zlib)
  5064. ("hdf5" ,hdf5-1.8)))
  5065. (home-page "http://matio.sourceforge.net/")
  5066. (synopsis "Library for reading and writing MAT files")
  5067. (description "Matio is a library for reading and writing MAT files. It
  5068. supports compressed MAT files, as well as newer (version 7.3) MAT files.")
  5069. (license license:bsd-2)))
  5070. (define-public vc
  5071. (package
  5072. (name "vc")
  5073. (version "1.4.2")
  5074. (source
  5075. (origin (method url-fetch)
  5076. (uri (string-append "https://github.com/VcDevel/Vc/releases/"
  5077. "download/" version "/Vc-" version ".tar.gz"))
  5078. (sha256
  5079. (base32
  5080. "0lirdqzcxys9walz04bllsphydynk7973aimd5k1h1qbwi8z3lsh"))))
  5081. (build-system cmake-build-system)
  5082. (arguments
  5083. '(#:configure-flags
  5084. '("-DBUILD_TESTING=ON"
  5085. ;; By default, Vc will optimize for the CPU of the build machine.
  5086. ;; Setting this to "none" makes it create portable binaries. See
  5087. ;; "cmake/OptimizeForArchitecture.cmake".
  5088. "-DTARGET_ARCHITECTURE=none")
  5089. #:phases (modify-phases %standard-phases
  5090. (add-after 'unpack 'copy-testdata
  5091. (lambda* (#:key inputs native-inputs #:allow-other-keys)
  5092. (let ((testdata (assoc-ref (or native-inputs inputs)
  5093. "testdata")))
  5094. (copy-recursively testdata "tests/testdata")
  5095. #t))))))
  5096. (native-inputs
  5097. `(("virtest" ,virtest)
  5098. ;; This is a submodule in the git project, but not part of the
  5099. ;; released sources. See the git branch for the commit to take.
  5100. ("testdata" ,(let ((commit "9ada1f34d6a41f1b5553d6223f277eae72c039d3"))
  5101. (origin
  5102. (method git-fetch)
  5103. (uri (git-reference
  5104. (url "https://github.com/VcDevel/vc-testdata")
  5105. (commit "9ada1f34d6a41f1b5553d6223f277eae72c039d3")))
  5106. (file-name (git-file-name "vc-testdata"
  5107. (string-take commit 7)))
  5108. (sha256
  5109. (base32
  5110. "1hkhqib03qlcq412ym2dciynfxcdr2ygqhnplz4l1vissr1wnqn2")))))))
  5111. (synopsis "SIMD vector classes for C++")
  5112. (description "Vc provides portable, zero-overhead C++ types for explicitly
  5113. data-parallel programming. It is a library designed to ease explicit
  5114. vectorization of C++ code. Its types enable explicitly stating data-parallel
  5115. operations on multiple values. The parallelism is therefore added via the type
  5116. system. Vc has an intuitive API and provides portability between different
  5117. compilers and compiler versions as well as portability between different vector
  5118. instruction sets. Thus, an application written with Vc can be compiled for:
  5119. @enumerate
  5120. @item AVX and AVX2
  5121. @item SSE2 up to SSE4.2 or SSE4a
  5122. @item Scalar
  5123. @item MIC
  5124. @item NEON (in development)
  5125. @item NVIDIA GPUs / CUDA (in development)
  5126. @end enumerate\n")
  5127. (home-page "https://github.com/VcDevel/Vc")
  5128. ;; "No support_???.cpp file exists for this architecture."
  5129. (supported-systems '("x86_64-linux" "i686-linux"))
  5130. (license license:bsd-3)))
  5131. (define-public reducelcs
  5132. ;; This is the last commit which is available upstream, no
  5133. ;; release happened since 2010.
  5134. (let ((commit "474f88deb968061abe8cf11c959e02319b8ae5c0")
  5135. (revision "1"))
  5136. (package
  5137. (name "reducelcs")
  5138. (version (string-append "1.0-" revision "." (string-take commit 7)))
  5139. (source
  5140. (origin
  5141. (method git-fetch)
  5142. (uri (git-reference
  5143. (url "https://github.com/gdv/Reduce-Expand-for-LCS")
  5144. (commit commit)))
  5145. (file-name (string-append name "-" version "-checkout"))
  5146. (sha256
  5147. (base32
  5148. "1rllzcfwc042c336mhq262a8ha90x6afq30kvk60r7i4761j4yjm"))))
  5149. (build-system gnu-build-system)
  5150. (inputs
  5151. `(("openlibm" ,openlibm)))
  5152. (arguments
  5153. `(#:tests? #f ; no tests
  5154. #:phases
  5155. (modify-phases %standard-phases
  5156. (delete 'configure) ; No configure script exists.
  5157. (replace 'install ; No install phase exists.
  5158. (lambda* (#:key outputs #:allow-other-keys)
  5159. (let* ((out (assoc-ref outputs "out"))
  5160. (bin (string-append out "/bin")))
  5161. (install-file "Approximation" bin)
  5162. (install-file "CollectResults" bin)
  5163. (install-file "GenerateInstances" bin)
  5164. #t))))))
  5165. (synopsis "Approximate Longest Commons Subsequence computation tool")
  5166. (description
  5167. "@code{reduceLCS} is an implementation of the Reduce-Expand
  5168. algorithm for LCS. It is a fast program to compute the approximate
  5169. Longest Commons Subsequence of a set of strings.")
  5170. (home-page "https://github.com/gdv/Reduce-Expand-for-LCS")
  5171. (license license:gpl3+))))
  5172. (define-public jacal
  5173. (package
  5174. (name "jacal")
  5175. (version "1c4")
  5176. (source (origin
  5177. (method url-fetch)
  5178. (uri (string-append
  5179. "http://groups.csail.mit.edu/mac/ftpdir/scm/jacal-"
  5180. version ".zip"))
  5181. (sha256 (base32
  5182. "055zrn12a1dmy0dqkwrkq3fklbhg3yir6vn0lacp4mvbg8573a3q"))
  5183. (patches (search-patches "jacal-fix-texinfo.patch"))))
  5184. (build-system gnu-build-system)
  5185. (arguments
  5186. `(#:phases
  5187. (modify-phases %standard-phases
  5188. (add-before 'build 'pre-build
  5189. ;; Don't use upstream's script - it really doesn't fit into
  5190. ;; Guix's functional paradigm.
  5191. (lambda* (#:key inputs outputs #:allow-other-keys)
  5192. (substitute* "Makefile"
  5193. (("^install: install-script") "install: "))))
  5194. (add-after 'install 'post-install
  5195. ;; Instead, we provide our own simplified script.
  5196. (lambda* (#:key inputs outputs #:allow-other-keys)
  5197. (let ((wrapper (string-append (assoc-ref outputs "out")
  5198. "/bin/jacal")))
  5199. (format (open wrapper (logior O_WRONLY O_CREAT))
  5200. (string-append "#!~a\nexec ~a/bin/scm -ip1 "
  5201. "-e '(slib:load \"~a/lib/jacal/math\") "
  5202. "(math)' \"$@\"\n")
  5203. (which "bash")
  5204. (assoc-ref inputs "scm")
  5205. (assoc-ref outputs "out"))
  5206. (chmod wrapper #o555))))
  5207. (replace 'configure
  5208. (lambda* (#:key outputs #:allow-other-keys)
  5209. (invoke "./configure"
  5210. (string-append "--prefix="
  5211. (assoc-ref outputs "out"))))))))
  5212. (inputs `(("scm" ,scm)))
  5213. (native-inputs `(("unzip" ,unzip)
  5214. ("texinfo" ,texinfo)))
  5215. (synopsis "Symbolic mathematics system")
  5216. (description "GNU JACAL is an interactive symbolic mathematics program based on
  5217. Scheme. It manipulate and simplify a range of mathematical expressions such
  5218. as equations, scalars, vectors, and matrices.")
  5219. (home-page "https://www.gnu.org/software/jacal/")
  5220. (license license:gpl3+)))
  5221. (define-public z3
  5222. (package
  5223. (name "z3")
  5224. (version "4.8.9")
  5225. (home-page "https://github.com/Z3Prover/z3")
  5226. (source (origin
  5227. (method git-fetch)
  5228. (uri (git-reference (url home-page)
  5229. (commit (string-append "z3-" version))))
  5230. (file-name (git-file-name name version))
  5231. (sha256
  5232. (base32
  5233. "1hnbzq10d23drd7ksm3c1n2611c3kd0q0yxgz8y78zaafwczvwxx"))))
  5234. (build-system gnu-build-system)
  5235. (arguments
  5236. `(#:imported-modules ((guix build python-build-system)
  5237. ,@%gnu-build-system-modules)
  5238. #:modules (((guix build python-build-system) #:select (site-packages))
  5239. (guix build gnu-build-system)
  5240. (guix build utils))
  5241. #:phases
  5242. (modify-phases %standard-phases
  5243. (add-after 'unpack 'enable-bytecode-determinism
  5244. (lambda _
  5245. (setenv "PYTHONHASHSEED" "0")
  5246. #t))
  5247. (add-after 'unpack 'fix-compatability
  5248. ;; Versions after 4.8.3 have immintrin.h IFDEFed for Windows only.
  5249. (lambda _
  5250. (substitute* "src/util/mpz.cpp"
  5251. (("#include <immintrin.h>") ""))
  5252. #t))
  5253. (add-before 'configure 'bootstrap
  5254. (lambda _
  5255. (invoke "python" "scripts/mk_make.py")))
  5256. ;; work around gnu-build-system's setting --enable-fast-install
  5257. ;; (z3's `configure' is a wrapper around the above python file,
  5258. ;; which fails when passed --enable-fast-install)
  5259. (replace 'configure
  5260. (lambda* (#:key inputs outputs #:allow-other-keys)
  5261. (invoke "./configure"
  5262. "--python"
  5263. (string-append "--prefix=" (assoc-ref outputs "out"))
  5264. (string-append "--pypkgdir=" (site-packages inputs outputs)))))
  5265. (add-after 'configure 'change-directory
  5266. (lambda _
  5267. (chdir "build")
  5268. #t))
  5269. (add-before 'check 'make-test-z3
  5270. (lambda _
  5271. ;; Build the test suite executable.
  5272. (invoke "make" "test-z3" "-j"
  5273. (number->string (parallel-job-count)))))
  5274. (replace 'check
  5275. (lambda _
  5276. ;; Run all the tests that don't require arguments.
  5277. (invoke "./test-z3" "/a"))))))
  5278. (native-inputs
  5279. `(("which" ,which)
  5280. ("python" ,python-wrapper)))
  5281. (synopsis "Theorem prover")
  5282. (description "Z3 is a theorem prover and @dfn{satisfiability modulo
  5283. theories} (SMT) solver. It provides a C/C++ API, as well as Python bindings.")
  5284. (license license:expat)))
  5285. (define-public elpa
  5286. (package
  5287. (name "elpa")
  5288. (version "2018.11.001")
  5289. (source (origin
  5290. (method url-fetch)
  5291. (uri (string-append "http://elpa.mpcdf.mpg.de/html/Releases/"
  5292. version "/elpa-" version ".tar.gz"))
  5293. (sha256
  5294. (base32
  5295. "05hv3v5i6xmziaizw350ff72y1c3k662r85fm3xfdrkclj5zw9yc"))))
  5296. (build-system gnu-build-system)
  5297. (native-inputs
  5298. `(("fortran" ,gfortran)
  5299. ("perl" ,perl))) ;for configure and deps
  5300. (inputs
  5301. `(("blas" ,openblas)))
  5302. (arguments
  5303. `(#:configure-flags
  5304. `("--enable-openmp"
  5305. "--with-mpi=no"
  5306. ;; ELPA unfortunately does not support runtime dispatch, so we can
  5307. ;; only enable the "generic" kernels. See the "Cross compilation"
  5308. ;; section of INSTALL.md.
  5309. "--enable-generic"
  5310. "--disable-sse" "--disable-sse-assembly" ;Require SSE3
  5311. "--disable-avx" "--disable-avx2" "--disable-avx512"
  5312. ,(string-append "CFLAGS=-O3 "
  5313. "-funsafe-loop-optimizations -funsafe-math-optimizations "
  5314. "-ftree-vect-loop-version -ftree-vectorize "
  5315. ,(let ((system (or (%current-target-system)
  5316. (%current-system))))
  5317. (cond
  5318. ((or (string-prefix? "x86_64" system)
  5319. (string-prefix? "i686" system))
  5320. "-msse2")
  5321. (else "")))))
  5322. #:parallel-tests? #f ;tests are multi-threaded, via BLAS
  5323. #:phases
  5324. (modify-phases %standard-phases
  5325. (add-before 'configure 'patch-header-generation
  5326. (lambda _
  5327. (substitute* "configure"
  5328. (("^ *make.*top_srcdir=\"\\$srcdir\"" &)
  5329. (string-append & " CPP=\"$CPP\"")))
  5330. #t))
  5331. (add-before 'check 'setup-tests
  5332. (lambda _
  5333. ;; Decrease test time and RAM use by computing fewer eigenvalues.
  5334. ;; The flags are (MATRIX-SIZE, EIGENVALUES, BLOCK-SIZE), where
  5335. ;; the default is (500, 250, 16) for C tests and (5000, 150, 16)
  5336. ;; for Fortran. This also causes several tests to pass that
  5337. ;; otherwise would otherwise fail with matrix size 5000; possibly
  5338. ;; due to floating point tolerances that are too tight.
  5339. (setenv "TEST_FLAGS" "1500 50 16") ;from elpa.spec
  5340. (setenv "OMP_NUM_THREADS" (number->string (parallel-job-count)))
  5341. (substitute* "Makefile"
  5342. ;; Test scripts are generated, patch the shebang
  5343. (("#!/bin/bash") (string-append "#!" (which "sh"))))
  5344. #t)))))
  5345. (home-page "https://elpa.mpcdf.mpg.de")
  5346. (synopsis "Eigenvalue solvers for symmetric matrices")
  5347. (description
  5348. "The ELPA library provides efficient and scalable direct eigensolvers for
  5349. symmetric matrices.")
  5350. (license license:lgpl3)))
  5351. (define-public elpa-openmpi
  5352. (package (inherit elpa)
  5353. (name "elpa-openmpi")
  5354. (inputs
  5355. `(("mpi" ,openmpi)
  5356. ("scalapack" ,scalapack)
  5357. ,@(package-inputs elpa)))
  5358. (arguments
  5359. (substitute-keyword-arguments (package-arguments elpa)
  5360. ((#:configure-flags cf '())
  5361. `(cons "--with-mpi=yes" (delete "--with-mpi=no" ,cf)))
  5362. ((#:phases phases '%standard-phases)
  5363. `(modify-phases ,phases
  5364. (add-before 'check 'mpi-setup
  5365. (lambda _
  5366. ;; Tests use 2 mpi tasks by default, use our remaining build
  5367. ;; cores as OpenMP threads.
  5368. (setenv "OMP_NUM_THREADS" (number->string
  5369. (max (quotient (parallel-job-count) 2)
  5370. 1)))
  5371. (,%openmpi-setup)))))))
  5372. (synopsis "Eigenvalue solvers for symmetric matrices (with MPI support)")))
  5373. (define-public elemental
  5374. (package
  5375. (name "elemental")
  5376. (version "0.87.7")
  5377. (source (origin
  5378. (method git-fetch)
  5379. (uri (git-reference
  5380. (url "https://github.com/elemental/Elemental")
  5381. (commit (string-append "v" version))))
  5382. (file-name (git-file-name name version))
  5383. (sha256
  5384. (base32
  5385. "1687xpjjzig27y2pnqv7hv09smpijyfdpz7qjgmcxf4shfajlfkc"))))
  5386. (build-system cmake-build-system)
  5387. (home-page "https://github.com/elemental/Elemental")
  5388. (native-inputs
  5389. `(("gfortran" ,gfortran)))
  5390. (inputs
  5391. `(("blas" ,openblas)
  5392. ("gfortran:lib" ,gfortran "lib")
  5393. ("gmp" ,gmp)
  5394. ("lapack" ,lapack)
  5395. ("metis" ,metis)
  5396. ("mpc" ,mpc)
  5397. ("mpfr" ,mpfr)
  5398. ("mpi" ,openmpi)
  5399. ("qd" ,qd)))
  5400. (arguments
  5401. `(#:build-type "Release" ;default RelWithDebInfo not supported
  5402. #:configure-flags `("-DEL_DISABLE_PARMETIS:BOOL=YES"
  5403. "-DEL_AVOID_COMPLEX_MPI:BOOL=NO"
  5404. "-DEL_CACHE_WARNINGS:BOOL=YES"
  5405. "-DEL_TESTS:BOOL=YES"
  5406. "-DCMAKE_INSTALL_LIBDIR=lib"
  5407. "-DGFORTRAN_LIB=gfortran")
  5408. #:phases (modify-phases %standard-phases
  5409. (add-before 'check 'mpi-setup
  5410. ,%openmpi-setup)
  5411. (add-before 'check 'setup-tests
  5412. (lambda _
  5413. ;; Parallelism is done at the MPI layer.
  5414. (setenv "OMP_NUM_THREADS" "1")
  5415. #t))
  5416. (add-after 'install 'remove-tests
  5417. (lambda* (#:key outputs #:allow-other-keys)
  5418. ;; Tests are installed, with no easy configuration
  5419. ;; switch to prevent this, so delete them.
  5420. (delete-file-recursively
  5421. (string-append (assoc-ref outputs "out") "/bin"))
  5422. #t)))))
  5423. (synopsis "Dense and sparse-direct linear algebra and optimization")
  5424. (description "Elemental is a modern C++ library for distributed-memory
  5425. dense and sparse-direct linear algebra, conic optimization, and lattice
  5426. reduction.")
  5427. (license license:bsd-2)))
  5428. (define-public mcrl2
  5429. (package
  5430. (name "mcrl2")
  5431. (version "202106.0")
  5432. (source (origin
  5433. (method url-fetch)
  5434. (uri (string-append
  5435. "https://www.mcrl2.org/download/release/mcrl2-"
  5436. version ".tar.gz"))
  5437. (sha256
  5438. (base32
  5439. "0db9wgy9spwm76mgfisnifrlg69y9cadjgxjr4gdwzfgg6wgqf6d"))))
  5440. (inputs
  5441. `(("boost" ,boost)
  5442. ("glu" ,glu)
  5443. ("mesa" ,mesa)
  5444. ("qtbase" ,qtbase-5)))
  5445. (build-system cmake-build-system)
  5446. (synopsis "Toolset for the mCRL2 formal specification language")
  5447. (description
  5448. "@dfn{mCRL2} (micro Common Representation Language 2) is a formal
  5449. specification language for describing concurrent discrete event systems. Its
  5450. toolset supports analysis and automatic verification, linearisation, simulation,
  5451. state-space exploration and generation, and tools to optimise and analyse
  5452. specifications. Also, state spaces can be manipulated, visualised and
  5453. analysed.")
  5454. (home-page "https://mcrl2.org")
  5455. (license license:boost1.0)))
  5456. (define-public mcrl2-minimal
  5457. (package
  5458. (inherit mcrl2)
  5459. (name "mcrl2-minimal")
  5460. (inputs
  5461. `(("boost" ,boost)))
  5462. (arguments
  5463. '(#:configure-flags '("-DMCRL2_ENABLE_GUI_TOOLS=OFF")))))
  5464. (define-public tcalc
  5465. (package
  5466. (name "tcalc")
  5467. (version "2.0")
  5468. (source
  5469. (origin
  5470. (method url-fetch)
  5471. (uri (string-append "https://sites.google.com/site/mohammedisam2000/tcalc/tcalc-"
  5472. version ".tar.gz"))
  5473. (sha256
  5474. (base32
  5475. "0jq806m4dqfia85nppfm75mml9w57g0cgv4cdw9bp3zymda83s0m"))))
  5476. (build-system gnu-build-system)
  5477. (synopsis "The terminal calculator")
  5478. (description
  5479. "The terminal calculator is a small program to help users of the GNU/Linux
  5480. terminal do calculations simply and quickly. The formula to be calculated can
  5481. be fed to @command{tcalc} through the command line.")
  5482. (home-page "https://sites.google.com/site/mohammedisam2000/tcalc")
  5483. (license license:gpl3+)))
  5484. (define-public tiny-bignum
  5485. (let ((commit "1d7a1f9b8e77316187a6b3eae8e68d60a6f9a4d4"))
  5486. (package
  5487. (name "tiny-bignum")
  5488. (version (git-version "0" "0" commit))
  5489. (source
  5490. (origin
  5491. (method git-fetch)
  5492. (uri (git-reference
  5493. (url "https://github.com/kokke/tiny-bignum-c")
  5494. (commit commit)))
  5495. (file-name (git-file-name "tiny-bignum" commit))
  5496. (sha256
  5497. (base32 "0vj71qlhlaa7d92bfar1kwqv6582dqrby8x3kdw0yzh82k2023g6"))))
  5498. (build-system gnu-build-system)
  5499. (arguments
  5500. `(#:phases
  5501. (modify-phases %standard-phases
  5502. (delete 'configure)
  5503. (add-after 'unpack 'patch-tests
  5504. (lambda _
  5505. (substitute* "scripts/test_rand.py"
  5506. (("\t") " ")
  5507. (("\" % (\\w+)" _ symbol) (string-append "\" % int(" symbol ")")))
  5508. #t))
  5509. (replace 'check
  5510. (lambda* (#:key tests? #:allow-other-keys)
  5511. (when tests?
  5512. (invoke "make" "test"))
  5513. #t))
  5514. (replace 'install
  5515. (lambda* (#:key outputs #:allow-other-keys)
  5516. (let ((share (string-append (assoc-ref outputs "out") "/share"))
  5517. (doc (string-append (assoc-ref outputs "out") "/doc")))
  5518. (mkdir-p share)
  5519. (install-file "bn.c" share)
  5520. (install-file "bn.h" share)
  5521. (mkdir-p doc)
  5522. (install-file "LICENSE" doc)
  5523. (install-file "README.md" doc))
  5524. #t)))))
  5525. (native-inputs
  5526. `(("python" ,python-wrapper)))
  5527. (home-page "https://github.com/kokke/tiny-bignum-c")
  5528. (synopsis "Small portable multiple-precision unsigned integer arithmetic in C")
  5529. (description
  5530. "This library provides portable Arbitrary-precision unsigned integer
  5531. arithmetic in C, for calculating with large numbers. Basic arithmetic (+, -,
  5532. *, /, %) and bitwise operations (&, |, ^. <<, >>) plus increments, decrements
  5533. and comparisons are supported.")
  5534. (license license:unlicense))))
  5535. (define-public sundials
  5536. (package
  5537. (name "sundials")
  5538. (version "3.1.1")
  5539. (source
  5540. (origin
  5541. (method url-fetch)
  5542. (uri (string-append "https://computation.llnl.gov/projects/sundials/download/"
  5543. "sundials-" version ".tar.gz"))
  5544. (sha256
  5545. (base32
  5546. "090s8ymhd0g1s1d44fa73r5yi32hb4biwahhbfi327zd64yn8kd2"))))
  5547. (build-system cmake-build-system)
  5548. (native-inputs
  5549. `(("python" ,python-2))) ;for tests; syntax incompatible with python 3
  5550. (inputs
  5551. `(("fortran" ,gfortran) ;for fcmix
  5552. ("blas" ,openblas)
  5553. ("suitesparse" ,suitesparse))) ;TODO: Add hypre
  5554. (arguments
  5555. `(#:configure-flags `("-DEXAMPLES_ENABLE_C:BOOL=ON"
  5556. "-DEXAMPLES_ENABLE_CXX:BOOL=ON"
  5557. "-DEXAMPLES_ENABLE_F77:BOOL=ON"
  5558. "-DEXAMPLES_ENABLE_F90:BOOL=ON"
  5559. "-DEXAMPLES_INSTALL:BOOL=OFF"
  5560. "-DFCMIX_ENABLE:BOOL=ON"
  5561. "-DKLU_ENABLE:BOOL=ON"
  5562. ,(string-append "-DKLU_INCLUDE_DIR="
  5563. (assoc-ref %build-inputs "suitesparse")
  5564. "/include")
  5565. ,(string-append "-DKLU_LIBRARY_DIR="
  5566. (assoc-ref %build-inputs "suitesparse")
  5567. "/lib"))))
  5568. (home-page "https://computation.llnl.gov/projects/sundials")
  5569. (synopsis "Suite of nonlinear and differential/algebraic equation solvers")
  5570. (description "SUNDIALS is a family of software packages implemented with
  5571. the goal of providing robust time integrators and nonlinear solvers that can
  5572. easily be incorporated into existing simulation codes.")
  5573. (license license:bsd-3)))
  5574. (define-public sundials-openmpi
  5575. (package (inherit sundials)
  5576. (name "sundials-openmpi")
  5577. (inputs
  5578. `(("mpi" ,openmpi)
  5579. ("petsc" ,petsc-openmpi) ;support in SUNDIALS requires MPI
  5580. ,@(package-inputs sundials)))
  5581. (arguments
  5582. (substitute-keyword-arguments (package-arguments sundials)
  5583. ((#:configure-flags flags '())
  5584. `(cons* "-DMPI_ENABLE:BOOL=ON"
  5585. "-DPETSC_ENABLE:BOOL=ON"
  5586. (string-append "-DPETSC_INCLUDE_DIR="
  5587. (assoc-ref %build-inputs "petsc")
  5588. "/include")
  5589. (string-append "-DPETSC_LIBRARY_DIR="
  5590. (assoc-ref %build-inputs "petsc")
  5591. "/lib")
  5592. ,flags))
  5593. ((#:phases phases '%standard-phases)
  5594. `(modify-phases ,phases
  5595. (add-before 'check 'mpi-setup
  5596. ,%openmpi-setup)))))
  5597. (synopsis "SUNDIALS with OpenMPI support")))
  5598. (define-public combinatorial-blas
  5599. (package
  5600. (name "combinatorial-blas")
  5601. (version "1.6.2")
  5602. (source
  5603. (origin
  5604. (method url-fetch)
  5605. (uri (string-append "http://eecs.berkeley.edu/~aydin/CombBLAS_FILES/"
  5606. "CombBLAS_beta_"
  5607. (match (string-split version #\.)
  5608. ((major minor patch)
  5609. (string-append major minor "_" patch))) ;e.g. "16_2"
  5610. ".tgz"))
  5611. (sha256
  5612. (base32
  5613. "1a9wbgdqyy1whhfc0yl0yqkax3amnqa6iihhq48d063gc0jwfd9a"))
  5614. (patches (search-patches "combinatorial-blas-awpm.patch"
  5615. "combinatorial-blas-io-fix.patch"))))
  5616. (build-system cmake-build-system)
  5617. (inputs
  5618. `(("mpi" ,openmpi)
  5619. ("test-data" ,(origin
  5620. (method url-fetch)
  5621. (uri (string-append "https://people.eecs.berkeley.edu/~aydin/"
  5622. "CombBLAS_FILES/testdata_combblas1.6.1.tgz"))
  5623. (sha256
  5624. (base32
  5625. "01y2781cy3fww7znmidrp85mf8zx0c905w5vzvk1mgrmhhynim87"))))))
  5626. (arguments
  5627. `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES"
  5628. "-DCMAKE_CXX_FLAGS=-DUSE_FUNNEL")
  5629. #:parallel-tests? #f ;tests use 'mpiexec -n4'
  5630. #:phases
  5631. (modify-phases %standard-phases
  5632. (add-before 'check 'mpi-setup
  5633. ,%openmpi-setup)
  5634. (add-before 'check 'test-setup
  5635. (lambda* (#:key inputs #:allow-other-keys)
  5636. (setenv "OMP_NUM_THREADS" "2")
  5637. (invoke "tar" "xf" (assoc-ref inputs "test-data")))))))
  5638. (home-page "https://people.eecs.berkeley.edu/~aydin/CombBLAS/html/")
  5639. (synopsis "Linear algebra primitives for graph analytics")
  5640. (description "The Combinatorial BLAS (CombBLAS) is an extensible
  5641. distributed-memory parallel graph library offering a small but powerful set of
  5642. linear algebra primitives specifically targeting graph analytics.")
  5643. (license (list
  5644. license:gpl2+ ;include/psort/(funnel|sort)*.h
  5645. license:x11 ;usort and psort
  5646. license:bsd-3)))) ;CombBLAS and MersenneTwister.h
  5647. (define-public dune-common
  5648. (package
  5649. (name "dune-common")
  5650. (version "2.7.0")
  5651. (source
  5652. (origin
  5653. (method url-fetch)
  5654. (uri (string-append "https://dune-project.org/download/"
  5655. version "/dune-common-" version ".tar.gz"))
  5656. (sha256
  5657. (base32
  5658. "140q1zh44cr5yrjwg4b5ga803rkqv55vk30l2cqm29aklj1wb0rw"))))
  5659. (build-system cmake-build-system)
  5660. (arguments
  5661. `(#:phases
  5662. (modify-phases %standard-phases
  5663. (add-after 'build 'build-tests
  5664. (lambda* (#:key make-flags #:allow-other-keys)
  5665. (apply invoke "make" "build_tests" make-flags))))))
  5666. (inputs
  5667. `(("gmp" ,gmp)
  5668. ("metis" ,metis)
  5669. ("openblas" ,openblas)
  5670. ("python" ,python)
  5671. ("superlu" ,superlu)))
  5672. (native-inputs
  5673. `(("gfortran" ,gfortran)
  5674. ("pkg-config" ,pkg-config)))
  5675. (home-page "https://dune-project.org/")
  5676. (synopsis "Distributed and Unified Numerics Environment")
  5677. (description "DUNE, the Distributed and Unified Numerics Environment is a
  5678. modular toolbox for solving @dfn{partial differential equations} (PDEs) with
  5679. grid-based methods. It supports the easy implementation of methods like
  5680. @dfn{Finite Elements} (FE), @dfn{Finite Volumes} (FV), and also @dfn{Finite
  5681. Differences} (FD).")
  5682. ;; GPL version 2 with "runtime exception" to make it behave like LGPLv2.
  5683. (license license:gpl2)))
  5684. (define-public dune-geometry
  5685. (package
  5686. (name "dune-geometry")
  5687. (version "2.7.0")
  5688. (source
  5689. (origin
  5690. (method url-fetch)
  5691. (uri (string-append "https://dune-project.org/download/"
  5692. version "/dune-geometry-" version ".tar.gz"))
  5693. (sha256
  5694. (base32
  5695. "1cicvlwbyyw76npicnblxckyvhbfn3ip8isydiv3hlrlz8zcg5nr"))))
  5696. (build-system cmake-build-system)
  5697. (arguments
  5698. `(#:phases
  5699. (modify-phases %standard-phases
  5700. (add-after 'build 'build-tests
  5701. (lambda* (#:key make-flags #:allow-other-keys)
  5702. (apply invoke "make" "build_tests" make-flags))))))
  5703. (inputs
  5704. `(("dune-common" ,dune-common)
  5705. ;; Optional
  5706. ("openblas" ,openblas)
  5707. ("gmp" ,gmp)
  5708. ("python" ,python)))
  5709. (native-inputs
  5710. `(("gfortran" ,gfortran)
  5711. ("pkg-config" ,pkg-config)))
  5712. (home-page "https://dune-project.org/")
  5713. (synopsis "Distributed and Unified Numerics Environment")
  5714. (description "DUNE, the Distributed and Unified Numerics Environment is a
  5715. modular toolbox for solving @dfn{partial differential equations} (PDEs) with
  5716. grid-based methods. It supports the easy implementation of methods like
  5717. @dfn{Finite Elements} (FE), @dfn{Finite Volumes} (FV), and also @dfn{Finite
  5718. Differences} (FD).
  5719. This package contains the basic DUNE geometry classes.")
  5720. ;; GPL version 2 with "runtime exception"
  5721. (license license:gpl2)))
  5722. (define-public dune-uggrid
  5723. (package
  5724. (name "dune-uggrid")
  5725. (version "2.7.0")
  5726. (source
  5727. (origin
  5728. (method git-fetch)
  5729. (uri (git-reference
  5730. (url "https://gitlab.dune-project.org/staging/dune-uggrid.git")
  5731. (commit (string-append "v" version))))
  5732. (file-name (git-file-name name version))
  5733. (sha256
  5734. (base32
  5735. "192miqgmfj6jwk969gydzpbv9ki7jg5nky3ydnrwa2nq29b5xkh0"))))
  5736. (build-system cmake-build-system)
  5737. (arguments
  5738. `(#:phases
  5739. (modify-phases %standard-phases
  5740. (add-after 'build 'build-tests
  5741. (lambda* (#:key make-flags #:allow-other-keys)
  5742. (apply invoke "make" "build_tests" make-flags))))))
  5743. (inputs
  5744. `(("dune-common" ,dune-common)))
  5745. (native-inputs
  5746. `(("gfortran" ,gfortran)
  5747. ("pkg-config" ,pkg-config)))
  5748. (home-page "https://dune-project.org/")
  5749. (synopsis "Distributed and Unified Numerics Environment")
  5750. (description "DUNE, the Distributed and Unified Numerics Environment is a
  5751. modular toolbox for solving @dfn{partial differential equations} (PDEs) with
  5752. grid-based methods. It supports the easy implementation of methods like
  5753. @dfn{Finite Elements} (FE), @dfn{Finite Volumes} (FV), and also @dfn{Finite
  5754. Differences} (FD).
  5755. This package contains the DUNE UG grid classes.")
  5756. (license license:lgpl2.1)))
  5757. (define-public dune-grid
  5758. (package
  5759. (name "dune-grid")
  5760. (version "2.7.0")
  5761. (source
  5762. (origin
  5763. (method url-fetch)
  5764. (uri (string-append "https://dune-project.org/download/"
  5765. version "/dune-grid-" version ".tar.gz"))
  5766. (sha256
  5767. (base32
  5768. "17fjz30qazjgl11sryyxnw9klai4yz1ji4bs68013xcxc5hdv27s"))))
  5769. (build-system cmake-build-system)
  5770. (arguments
  5771. `(#:phases
  5772. (modify-phases %standard-phases
  5773. (add-after 'build 'build-tests
  5774. (lambda* (#:key make-flags #:allow-other-keys)
  5775. (apply invoke "make" "build_tests" make-flags))))))
  5776. (inputs
  5777. `(("dune-common" ,dune-common)
  5778. ("dune-geometry" ,dune-geometry)
  5779. ("gmp" ,gmp)
  5780. ("metis" ,metis)
  5781. ("openblas" ,openblas)
  5782. ("python" ,python)))
  5783. (propagated-inputs
  5784. `(("dune-uggrid" ,dune-uggrid)))
  5785. (native-inputs
  5786. `(("gfortran" ,gfortran)
  5787. ("pkg-config" ,pkg-config)))
  5788. (home-page "https://dune-project.org/")
  5789. (synopsis "Distributed and Unified Numerics Environment")
  5790. (description "DUNE, the Distributed and Unified Numerics Environment is a
  5791. modular toolbox for solving @dfn{partial differential equations} (PDEs) with
  5792. grid-based methods. It supports the easy implementation of methods like
  5793. @dfn{Finite Elements} (FE), @dfn{Finite Volumes} (FV), and also @dfn{Finite
  5794. Differences} (FD).
  5795. This package contains the basic DUNE grid classes.")
  5796. ;; GPL version 2 with "runtime exception"
  5797. (license license:gpl2)))
  5798. (define-public dune-istl
  5799. (package
  5800. (name "dune-istl")
  5801. (version "2.7.0")
  5802. (source
  5803. (origin
  5804. (method url-fetch)
  5805. (uri (string-append "https://dune-project.org/download/"
  5806. version "/dune-istl-" version ".tar.gz"))
  5807. (sha256
  5808. (base32
  5809. "0gl3wgz5rs6sb4m83440ny45sbx7z7lnbi3gx6r9nm3rvy5j33f9"))
  5810. (patches (search-patches "dune-istl-2.7-fix-non-mpi-tests.patch"))))
  5811. (build-system cmake-build-system)
  5812. (arguments
  5813. `(#:phases
  5814. (modify-phases %standard-phases
  5815. ;; XXX: istl/test/matrixtest.cc includes <fenv.h> and fails to find
  5816. ;; the stdlib types when the gfortran header is used. Remove gfortran
  5817. ;; from CPLUS_INCLUDE_PATH as a workaround.
  5818. (add-after 'set-paths 'hide-gfortran
  5819. (lambda* (#:key inputs #:allow-other-keys)
  5820. (let ((gfortran (assoc-ref inputs "gfortran")))
  5821. (setenv "CPLUS_INCLUDE_PATH"
  5822. (string-join
  5823. (delete (string-append gfortran "/include/c++")
  5824. (string-split (getenv "CPLUS_INCLUDE_PATH") #\:))
  5825. ":"))
  5826. #t)))
  5827. (add-after 'build 'build-tests
  5828. (lambda* (#:key make-flags #:allow-other-keys)
  5829. (apply invoke "make" "build_tests" make-flags))))))
  5830. (inputs
  5831. `(("dune-common" ,dune-common)
  5832. ;; Optional
  5833. ("metis" ,metis)
  5834. ("suitesparse" ,suitesparse)
  5835. ("superlu" ,superlu)
  5836. ("openblas" ,openblas)
  5837. ("gmp" ,gmp)
  5838. ("python" ,python)))
  5839. (native-inputs
  5840. `(("gfortran" ,gfortran)
  5841. ("pkg-config" ,pkg-config)))
  5842. (home-page "https://dune-project.org/")
  5843. (synopsis "Distributed and Unified Numerics Environment")
  5844. (description "DUNE, the Distributed and Unified Numerics Environment is a
  5845. modular toolbox for solving @dfn{partial differential equations} (PDEs) with
  5846. grid-based methods.
  5847. This is the iterative solver template library which provides generic sparse
  5848. matrix/vector classes and a variety of solvers based on these classes. A
  5849. special feature is the use of templates to exploit the recursive block
  5850. structure of finite element matrices at compile time. Available solvers
  5851. include Krylov methods, (block-) incomplete decompositions and
  5852. aggregation-based algebraic multigrid.")
  5853. ;; GPL version 2 with "runtime exception"
  5854. (license license:gpl2)))
  5855. (define-public dune-localfunctions
  5856. (package
  5857. (name "dune-localfunctions")
  5858. (version "2.7.0")
  5859. (source
  5860. (origin
  5861. (method url-fetch)
  5862. (uri (string-append "https://dune-project.org/download/"
  5863. version "/dune-localfunctions-" version ".tar.gz"))
  5864. (sha256
  5865. (base32
  5866. "1yih59h6vngii696bx1c2vil02lriij4kz0nc583mjn9kiaqxfqd"))))
  5867. (build-system cmake-build-system)
  5868. (arguments
  5869. `(#:phases
  5870. (modify-phases %standard-phases
  5871. ;; XXX: localfunctions/test/lagrangeshapefunctiontest.cc includes <fenv.h>
  5872. ;; and fails to find the stdlib types when the gfortran header is used.
  5873. ;; Hide gfortran from CPLUS_INCLUDE_PATH to ensure we get the GCC header.
  5874. (add-after 'set-paths 'hide-gfortran
  5875. (lambda* (#:key inputs #:allow-other-keys)
  5876. (let ((gfortran (assoc-ref inputs "gfortran")))
  5877. (setenv "CPLUS_INCLUDE_PATH"
  5878. (string-join
  5879. (delete (string-append gfortran "/include/c++")
  5880. (string-split (getenv "CPLUS_INCLUDE_PATH") #\:))
  5881. ":"))
  5882. #t)))
  5883. (add-after 'build 'build-tests
  5884. (lambda* (#:key make-flags #:allow-other-keys)
  5885. (apply invoke "make" "build_tests" make-flags))))))
  5886. (inputs
  5887. `(("dune-common" ,dune-common)
  5888. ("dune-geometry" ,dune-geometry)
  5889. ;; Optional
  5890. ("metis" ,metis)
  5891. ("superlu" ,superlu)
  5892. ("gmp" ,gmp)))
  5893. (native-inputs
  5894. `(("gfortran" ,gfortran)
  5895. ("pkg-config" ,pkg-config)))
  5896. (home-page "https://dune-project.org/")
  5897. (synopsis "Distributed and Unified Numerics Environment") ; TODO
  5898. (description "This DUNE module provides interface and implementation for
  5899. shape functions defined on the DUNE reference elements. In addition to the
  5900. shape function, interpolation operators and special keys are provided which
  5901. can be used to assemble global function spaces on finite-element grids.
  5902. This package provides an interface and implementation for shape functions
  5903. defined on the DUNE reference elements. In addition to the shape function,
  5904. interpolation operators and special keys are provided which can be used to
  5905. assemble global function spaces on finite-element grids.")
  5906. ;; GPL version 2 with "runtime exception"
  5907. (license license:gpl2)))
  5908. (define-public dune-alugrid
  5909. (package
  5910. (name "dune-alugrid")
  5911. (version "2.7.0-git-81d35682")
  5912. (source
  5913. (origin
  5914. (method git-fetch)
  5915. (uri (git-reference
  5916. (url "https://gitlab.dune-project.org/extensions/dune-alugrid.git")
  5917. (commit "81d356827c84454b971937db02c02b90bbcd7fe5")))
  5918. (file-name (git-file-name name version))
  5919. (sha256
  5920. (base32
  5921. "0z54lwfp53prcrs94k8gwh047l9z642jll3l56xlyfr69z0b2zz1"))))
  5922. (build-system cmake-build-system)
  5923. (arguments
  5924. `(#:phases
  5925. (modify-phases %standard-phases
  5926. (add-after 'unpack 'patch-include
  5927. (lambda _
  5928. (substitute* "dune/alugrid/test/test-alugrid.cc"
  5929. (("doc/grids/gridfactory/testgrids")
  5930. "doc/dune-grid/grids/gridfactory/testgrids"))
  5931. #t))
  5932. (add-after 'build 'build-tests
  5933. (lambda* (#:key inputs make-flags #:allow-other-keys)
  5934. (setenv "CPLUS_INCLUDE_PATH"
  5935. (string-append (assoc-ref inputs "dune-grid") "/share"))
  5936. (apply invoke "make" "build_tests" make-flags))))))
  5937. (inputs
  5938. `(("dune-common" ,dune-common)
  5939. ("dune-geometry" ,dune-geometry)
  5940. ("dune-grid" ,dune-grid)
  5941. ;; Optional
  5942. ("metis" ,metis)
  5943. ("openblas" ,openblas)
  5944. ("python" ,python)
  5945. ("superlu" ,superlu)
  5946. ("gmp" ,gmp)
  5947. ("zlib" ,zlib)))
  5948. (native-inputs
  5949. `(("gfortran" ,gfortran)
  5950. ("pkg-config" ,pkg-config)))
  5951. (home-page "https://dune-project.org/")
  5952. (synopsis "Distributed and Unified Numerics Environment")
  5953. (description "ALUGrid is an adaptive, loadbalancing, unstructured
  5954. implementation of the DUNE grid interface supporting either simplices or
  5955. cubes.")
  5956. (license license:gpl2+)))
  5957. (define-public dune-subgrid
  5958. (package
  5959. (name "dune-subgrid")
  5960. (version "2.7.0-git-2103a363")
  5961. (source
  5962. (origin
  5963. (method git-fetch)
  5964. (uri (git-reference
  5965. (url "https://git.imp.fu-berlin.de/agnumpde/dune-subgrid")
  5966. (commit "2103a363f32e8d7b60e66eee7ddecf969f6cf762")))
  5967. (file-name (git-file-name name version))
  5968. (sha256
  5969. (base32
  5970. "1wsjlypd3835c3arqjkw836cxx5q67zy447wa65q634lf6f6v9ia"))))
  5971. (build-system cmake-build-system)
  5972. (arguments
  5973. `(#:phases
  5974. (modify-phases %standard-phases
  5975. (add-after 'build 'build-tests
  5976. (lambda* (#:key make-flags #:allow-other-keys)
  5977. (apply invoke "make" "build_tests" make-flags))))))
  5978. (inputs
  5979. `(("dune-common" ,dune-common)
  5980. ("dune-geometry" ,dune-geometry)
  5981. ("dune-grid" ,dune-grid)
  5982. ;; Optional
  5983. ("metis" ,metis)
  5984. ("openblas" ,openblas)
  5985. ("gmp" ,gmp)))
  5986. (native-inputs
  5987. `(("gfortran" ,gfortran)
  5988. ("pkg-config" ,pkg-config)))
  5989. (home-page "http://numerik.mi.fu-berlin.de/dune-subgrid/index.php")
  5990. (synopsis "Distributed and Unified Numerics Environment")
  5991. (description "The dune-subgrid module marks elements of
  5992. another hierarchical dune grid. The set of marked elements can then be
  5993. accessed as a hierarchical dune grid in its own right. Dune-Subgrid
  5994. provides the full grid interface including adaptive mesh refinement.")
  5995. (license license:gpl2+)))
  5996. (define-public dune-typetree
  5997. (package
  5998. (name "dune-typetree")
  5999. (version "2.7.0")
  6000. (source
  6001. (origin
  6002. (method git-fetch)
  6003. (uri (git-reference
  6004. (url "https://gitlab.dune-project.org/staging/dune-typetree.git")
  6005. (commit (string-append "v" version))))
  6006. (file-name (git-file-name name version))
  6007. (sha256
  6008. (base32
  6009. "1rhv25yg0q1hw50c8wlfqhgwrjl4mh62zq9v14ilwgzbfgxmpiy7"))))
  6010. (build-system cmake-build-system)
  6011. (arguments
  6012. `(#:phases
  6013. (modify-phases %standard-phases
  6014. (add-after 'build 'build-tests
  6015. (lambda* (#:key make-flags #:allow-other-keys)
  6016. (apply invoke "make" "build_tests" make-flags))))))
  6017. (inputs
  6018. `(("dune-common" ,dune-common)
  6019. ;; Optional
  6020. ("openblas" ,openblas)
  6021. ("python" ,python)
  6022. ("metis" ,metis)
  6023. ("superlu" ,superlu)
  6024. ("gmp" ,gmp)))
  6025. (native-inputs
  6026. `(("gfortran" ,gfortran)
  6027. ("pkg-config" ,pkg-config)))
  6028. (home-page "https://dune-project.org/")
  6029. (synopsis "Distributed and Unified Numerics Environment")
  6030. (description "TypeTree is a template library for constructing and
  6031. operating on statically typed trees of objects.")
  6032. ;; Either GPL version 2 with "runtime exception" or LGPLv3+.
  6033. (license (list license:lgpl3+ license:gpl2))))
  6034. (define-public dune-functions
  6035. (package
  6036. (name "dune-functions")
  6037. (version "2.7.0")
  6038. (source
  6039. (origin
  6040. (method git-fetch)
  6041. (uri (git-reference
  6042. (url "https://gitlab.dune-project.org/staging/dune-functions.git")
  6043. (commit (string-append "v" version))))
  6044. (file-name (git-file-name name version))
  6045. (sha256
  6046. (base32
  6047. "1na4gcih0kin37ksj2xj07ds04v7zx53pjdhm1hzy55jjfqdjk8h"))))
  6048. (build-system cmake-build-system)
  6049. (arguments
  6050. `(#:phases
  6051. (modify-phases %standard-phases
  6052. (add-after 'unpack 'disable-failing-tests
  6053. (lambda _
  6054. (setenv "ARGS"
  6055. ;; unable to load GMSH file in this test
  6056. "--exclude-regex gridviewfunctionspacebasistest")
  6057. #t))
  6058. (add-after 'build 'build-tests
  6059. (lambda* (#:key make-flags #:allow-other-keys)
  6060. (apply invoke "make" "build_tests" make-flags))))))
  6061. (inputs
  6062. `(("dune-common" ,dune-common)
  6063. ("dune-istl" ,dune-istl)
  6064. ("dune-localfunctions" ,dune-localfunctions)
  6065. ("dune-grid" ,dune-grid)
  6066. ("dune-geometry" ,dune-geometry)
  6067. ("dune-typetree" ,dune-typetree)
  6068. ("openblas" ,openblas)
  6069. ("metis" ,metis)
  6070. ("python" ,python)
  6071. ("superlu" ,superlu)
  6072. ("gmp" ,gmp)))
  6073. (native-inputs
  6074. `(("gfortran" ,gfortran)
  6075. ("pkg-config" ,pkg-config)))
  6076. (home-page "https://dune-project.org/")
  6077. (synopsis "Distributed and Unified Numerics Environment")
  6078. (description "The dune-functions module provides an abstraction layer for
  6079. global finite element functions. Its two main concepts are functions
  6080. implemented as callable objects, and bases of finite element spaces.")
  6081. ;; Either GPL version 2 with "runtime exception" or LGPLv3+.
  6082. (license (list license:lgpl3+ license:gpl2))))
  6083. (define-public dune-pdelab
  6084. (package
  6085. (name "dune-pdelab")
  6086. (version "2.7.0-git-476fe437")
  6087. (source
  6088. (origin
  6089. (method git-fetch)
  6090. (uri (git-reference
  6091. (url "https://gitlab.dune-project.org/pdelab/dune-pdelab")
  6092. (commit "476fe43763fa6f459c5e4658e2a2b4b5582db834")))
  6093. (file-name (git-file-name name version))
  6094. (sha256
  6095. (base32
  6096. "0cs36piqzn6rq0j2ih3ab3q3q9yg199wk72k5qi86pkzh7i7fdn1"))))
  6097. (build-system cmake-build-system)
  6098. (arguments '(#:tests? #f)) ; XXX: the tests cannot be compiled
  6099. (inputs
  6100. `(("dune-common" ,dune-common)
  6101. ("dune-istl" ,dune-istl)
  6102. ("dune-localfunctions" ,dune-localfunctions)
  6103. ("dune-geometry" ,dune-geometry)
  6104. ("dune-grid" ,dune-grid)
  6105. ("dune-typetree" ,dune-typetree)
  6106. ("dune-functions" ,dune-functions)
  6107. ;; Optional
  6108. ("openblas" ,openblas)
  6109. ("eigen" ,eigen)
  6110. ("metis" ,metis)
  6111. ("python" ,python)
  6112. ("superlu" ,superlu)
  6113. ("gmp" ,gmp)))
  6114. (native-inputs
  6115. `(("gfortran" ,gfortran)
  6116. ("pkg-config" ,pkg-config)))
  6117. (home-page "https://dune-project.org/")
  6118. (synopsis "Differential equations solver toolbox")
  6119. (description "PDELab is a partial differential equations solver toolbox
  6120. built on top of DUNE, the Distributed and Unified Numerics Environment.")
  6121. ;; Either GPL version 2 with "runtime exception" or LGPLv3+.
  6122. (license (list license:lgpl3+ license:gpl2))))
  6123. (define add-openmpi-to-dune-package
  6124. (let ((dune-package?
  6125. (lambda (p) (string-prefix? "dune-" (package-name p)))))
  6126. (package-mapping
  6127. (lambda (p)
  6128. (if (dune-package? p)
  6129. (package (inherit p)
  6130. (name (string-append (package-name p) "-openmpi"))
  6131. (inputs `(,@(package-inputs p)
  6132. ("openmpi" ,openmpi)))
  6133. (arguments
  6134. (substitute-keyword-arguments (package-arguments p)
  6135. ((#:phases phases '%standard-phases)
  6136. `(modify-phases ,phases
  6137. (add-before 'check 'mpi-setup
  6138. ,%openmpi-setup)))))
  6139. (synopsis (string-append (package-synopsis p) " (with MPI support)")))
  6140. p))
  6141. (negate dune-package?))))
  6142. (define-public dune-common-openmpi
  6143. (add-openmpi-to-dune-package dune-common))
  6144. (define-public dune-geometry-openmpi
  6145. (add-openmpi-to-dune-package dune-geometry))
  6146. (define-public dune-istl-openmpi
  6147. (add-openmpi-to-dune-package dune-istl))
  6148. (define-public dune-typetree-openmpi
  6149. (add-openmpi-to-dune-package dune-typetree))
  6150. (define-public dune-uggrid-openmpi
  6151. (add-openmpi-to-dune-package dune-uggrid))
  6152. (define-public dune-grid-openmpi
  6153. (add-openmpi-to-dune-package dune-grid))
  6154. (define-public dune-alugrid-openmpi
  6155. (add-openmpi-to-dune-package dune-alugrid))
  6156. (define-public dune-subgrid-openmpi
  6157. (add-openmpi-to-dune-package dune-subgrid))
  6158. (define-public dune-localfunctions-openmpi
  6159. (add-openmpi-to-dune-package dune-localfunctions))
  6160. (define-public dune-functions-openmpi
  6161. (add-openmpi-to-dune-package dune-functions))
  6162. (define-public dune-pdelab-openmpi
  6163. (add-openmpi-to-dune-package dune-pdelab))
  6164. (define-public mlucas
  6165. (package
  6166. (name "mlucas")
  6167. (version "18")
  6168. (source
  6169. (origin
  6170. (method url-fetch)
  6171. (uri (string-append
  6172. "https://mersenneforum.org/mayer/src/C/mlucas_v" version ".txz"))
  6173. (sha256
  6174. (base32 "0h4xj6pyyac79ka5ibqjilfa3s9j3yxnzgpwc57b54kfh2bj3447"))))
  6175. (build-system gnu-build-system)
  6176. (inputs
  6177. `(("python2" ,python-2)))
  6178. (arguments
  6179. `(#:tests? #f ; no tests
  6180. #:phases
  6181. (modify-phases %standard-phases
  6182. (replace 'configure
  6183. (lambda _
  6184. (chdir "src")
  6185. (call-with-output-file "Makefile"
  6186. (lambda (port)
  6187. (format port "CC = gcc
  6188. CFLAGS = -O3 ~a -DUSE_THREADS
  6189. LDLIBS = -lm -lpthread -lrt
  6190. Mlucas: $(addsuffix .o,$(basename $(wildcard *.c)))
  6191. "
  6192. ,(let ((system (or (%current-target-system)
  6193. (%current-system))))
  6194. (cond
  6195. ((string-prefix? "x86_64" system) "-DUSE_SSE2")
  6196. (else ""))))))
  6197. #t))
  6198. (replace 'install
  6199. (lambda* (#:key outputs #:allow-other-keys)
  6200. (let ((bin (string-append (assoc-ref outputs "out") "/bin")))
  6201. (install-file "Mlucas" bin)
  6202. (install-file "primenet.py" bin))
  6203. #t)))))
  6204. (home-page "https://www.mersenne.org")
  6205. (synopsis "Great Internet Mersenne Prime Search (GIMPS) distributed computing client")
  6206. (description "Mlucas performs Lucas-Lehmer primality testing of Mersenne
  6207. numbers in search of a world-record prime. You may use it to test any
  6208. suitable number as you wish, but it is preferable that you do so in a
  6209. coordinated fashion, as part of the Great Internet Mersenne Prime
  6210. Search (GIMPS). Mlucas also includes a simple Python script for assignment
  6211. management via the GIMPS project's Primenet server.")
  6212. (license license:gpl2+)))
  6213. (define-public nauty
  6214. (package
  6215. (name "nauty")
  6216. (version "2.7r3")
  6217. (source
  6218. (origin
  6219. (method url-fetch)
  6220. (uri (string-append
  6221. "https://pallini.di.uniroma1.it/"
  6222. "nauty" (string-join (string-split version #\.) "") ".tar.gz"))
  6223. (sha256
  6224. (base32 "1hl81gpf3xjf809w04jczvilq1ixy9ch1qrax8a7lgx52svna1jg"))))
  6225. (build-system gnu-build-system)
  6226. (outputs '("out" "lib"))
  6227. (arguments
  6228. `(#:test-target "checks"
  6229. #:configure-flags '("--enable-generic") ;prevent -march-native
  6230. #:phases
  6231. (modify-phases %standard-phases
  6232. ;; Default make target does not build all available
  6233. ;; executables. Create them now.
  6234. (add-after 'build 'build-extra-programs
  6235. (lambda _
  6236. (for-each (lambda (target) (invoke "make" target))
  6237. '("blisstog" "bliss2dre" "checks6" "sumlines"))
  6238. #t))
  6239. ;; Upstream does not provide any install target.
  6240. (replace 'install
  6241. (lambda* (#:key outputs #:allow-other-keys)
  6242. (let* ((out (assoc-ref outputs "out"))
  6243. (lib-output (assoc-ref outputs "lib"))
  6244. (bin (string-append out "/bin"))
  6245. (doc (string-append out "/share/doc/nauty/"))
  6246. (include (string-append lib-output "/include/nauty"))
  6247. (lib (string-append lib-output "/lib/nauty")))
  6248. (for-each (lambda (f) (install-file f bin))
  6249. '("addedgeg" "amtog" "assembleg" "biplabg" "blisstog"
  6250. "bliss2dre" "catg" "checks6" "complg" "converseg"
  6251. "copyg" "countg" "cubhamg" "deledgeg" "delptg"
  6252. "directg" "dreadnaut" "dretodot" "dretog" "genbg"
  6253. "genbgL" "geng" "genquarticg" "genrang" "genspecialg"
  6254. "gentourng" "gentreeg" "hamheuristic" "labelg"
  6255. "linegraphg" "listg" "multig" "newedgeg" "pickg"
  6256. "planarg" "ranlabg" "shortg" "showg" "subdivideg"
  6257. "sumlines" "twohamg" "underlyingg" "vcolg"
  6258. "watercluster2" "NRswitchg"))
  6259. (for-each (lambda (f) (install-file f include))
  6260. (find-files "." "\\.h$"))
  6261. (for-each (lambda (f) (install-file f lib))
  6262. (find-files "." "\\.a$"))
  6263. (for-each (lambda (f) (install-file f doc))
  6264. (append '("formats.txt" "README" "schreier.txt")
  6265. (find-files "." "\\.pdf$")))))))))
  6266. (inputs
  6267. `(("gmp" ,gmp))) ;for sumlines
  6268. (home-page "https://pallini.di.uniroma1.it/")
  6269. (synopsis "Library for graph automorphisms")
  6270. (description "@code{nauty} (No AUTomorphisms, Yes?) is a set of
  6271. procedures for computing automorphism groups of graphs and digraphs.
  6272. @code{nauty} computes graph information in the form of a set of
  6273. generators, the size of the group, and the orbits of the group; it can
  6274. also produce a canonical label. The @code{nauty} suite is written in
  6275. C and comes with a command-line interface, a collection of
  6276. command-line tools, and an Application Programming Interface (API).
  6277. This package provides the static libraries required to run programs
  6278. compiled against the nauty library.")
  6279. (license license:asl2.0)))
  6280. (define-public ppl
  6281. (package
  6282. (name "ppl")
  6283. (version "1.2")
  6284. (source
  6285. (origin
  6286. (method url-fetch)
  6287. (uri (string-append "https://www.bugseng.com/products/ppl/download/"
  6288. "ftp/releases/" version
  6289. "/ppl-" version ".tar.gz"))
  6290. (sha256
  6291. (base32
  6292. "1j5aji1g2vmdvc0gqz45n2ll2l2f6czca04wiyfl5g3sm3a6vhvb"))))
  6293. (build-system gnu-build-system)
  6294. (native-inputs
  6295. `(("m4" ,m4)))
  6296. (inputs
  6297. `(("glpk" ,glpk)
  6298. ("gmp" ,gmp)))
  6299. (home-page "https://www.bugseng.com/parma-polyhedra-library")
  6300. (synopsis
  6301. "Parma Polyhedra Library for computations with polyhedra")
  6302. (description
  6303. "The Parma Polyhedra Library (PPL) provides numerical abstractions
  6304. especially targeted at applications in the field of analysis and
  6305. verification of complex systems. These abstractions include convex
  6306. polyhedra, defined as the intersection of a finite number of (open or
  6307. closed) halfspaces, each described by a linear inequality (strict or
  6308. non-strict) with rational coefficients; some special classes of polyhedra
  6309. shapes that offer interesting complexity/precision tradeoffs; and grids
  6310. which represent regularly spaced points that satisfy a set of linear
  6311. congruence relations. The library also supports finite powersets and
  6312. products of (any kind of) polyhedra and grids, a mixed integer linear
  6313. programming problem solver using an exact-arithmetic version of the simplex
  6314. algorithm, a parametric integer programming solver, and primitives for
  6315. termination analysis via the automatic synthesis of linear ranking
  6316. functions.")
  6317. (license license:gpl3+)))
  6318. (define-public speedcrunch
  6319. (package
  6320. (name "speedcrunch")
  6321. (version "0.12.0")
  6322. (source
  6323. (origin
  6324. (method git-fetch)
  6325. (uri (git-reference
  6326. (url "https://bitbucket.org/heldercorreia/speedcrunch.git")
  6327. (commit (string-append "release-" version))))
  6328. (file-name (git-file-name name version))
  6329. (sha256
  6330. (base32
  6331. "0vh7cd1915bjqzkdp3sk25ngy8cq624mkh8c53c5bnzk357kb0fk"))))
  6332. (build-system cmake-build-system)
  6333. (inputs `(("qtbase" ,qtbase-5)))
  6334. (native-inputs `(("qttools" ,qttools)))
  6335. (arguments
  6336. `(#:phases
  6337. (modify-phases %standard-phases
  6338. (add-after 'unpack 'chdir-to-src
  6339. (lambda _ (chdir "src") #t)))))
  6340. (synopsis "High-precision scientific calculator")
  6341. (description
  6342. "SpeedCrunch is a high-precision scientific calculator. It features a
  6343. syntax-highlighted scrollable display and is designed to be fully used via
  6344. keyboard. Some distinctive features are auto-completion of functions and
  6345. variables, a formula book, and quick insertion of constants from various
  6346. fields of knowledge.")
  6347. (home-page "https://speedcrunch.org/")
  6348. (license license:gpl2+)))
  6349. (define-public minisat
  6350. ;; This is the last commit which is available upstream, no
  6351. ;; release happened since 2010.
  6352. (let ((commit "37dc6c67e2af26379d88ce349eb9c4c6160e8543")
  6353. (revision "1"))
  6354. (package
  6355. (name "minisat")
  6356. (version (string-append "2.2.0-" revision "." (string-take commit 7)))
  6357. (source
  6358. (origin
  6359. (method git-fetch)
  6360. (uri (git-reference
  6361. (url "https://github.com/niklasso/minisat")
  6362. (commit commit)))
  6363. (file-name (string-append name "-" version "-checkout"))
  6364. (sha256
  6365. (base32
  6366. "091hf3qkm197s5r7xcr3m07xsdwyz2rqk1hc9kj0hn13imz09irq"))
  6367. (patches
  6368. (search-patches "minisat-friend-declaration.patch"
  6369. "minisat-install.patch"))))
  6370. (build-system gnu-build-system)
  6371. (arguments
  6372. '(#:make-flags (list (string-append "prefix=" %output))
  6373. #:tests? #f ;no check target
  6374. #:phases
  6375. (modify-phases %standard-phases
  6376. (delete 'configure))))
  6377. (inputs
  6378. `(("zlib:static" ,zlib "static")
  6379. ("zlib" ,zlib)))
  6380. (synopsis
  6381. "Small, yet efficient, SAT solver")
  6382. (description
  6383. "MiniSat is a minimalistic, open-source SAT solver, developed to help
  6384. researchers and developers alike to get started on SAT.")
  6385. (home-page
  6386. "http://minisat.se/MiniSat.html")
  6387. (license license:expat))))
  6388. (define-public libqalculate
  6389. (package
  6390. (name "libqalculate")
  6391. (version "3.19.0")
  6392. (source
  6393. (origin
  6394. (method git-fetch)
  6395. (uri (git-reference
  6396. (url "https://github.com/Qalculate/libqalculate/")
  6397. (commit (string-append "v" version))))
  6398. (file-name (git-file-name name version))
  6399. (sha256
  6400. (base32 "1w44407wb552q21dz4m2nwwdi8b9hzjb2w1l3ffsikzqckc7wbyj"))
  6401. (patches
  6402. (search-patches "libqalculate-3.8.0-libcurl-ssl-fix.patch"))))
  6403. (build-system gnu-build-system)
  6404. (native-inputs
  6405. `(("pkg-config" ,pkg-config)
  6406. ("gettext" ,gettext-minimal)
  6407. ("intltool" ,intltool)
  6408. ("automake" ,automake)
  6409. ("autoconf" ,autoconf)
  6410. ("libtool" ,libtool)
  6411. ("doxygen" ,doxygen)
  6412. ("file" ,file)))
  6413. (inputs
  6414. `(("gmp" ,gmp)
  6415. ("mpfr" ,mpfr)
  6416. ("libxml2" ,libxml2)
  6417. ("curl" ,curl)
  6418. ("icu4c" ,icu4c)
  6419. ("gnuplot" ,gnuplot)
  6420. ("readline" ,readline)
  6421. ("libiconv" ,libiconv)))
  6422. (arguments
  6423. `(#:phases
  6424. (modify-phases %standard-phases
  6425. (add-before 'bootstrap 'setenv
  6426. ;; Prevent the autogen.sh script to carry out the configure
  6427. ;; script, which has not yet been patched to replace /bin/sh.
  6428. (lambda _
  6429. (setenv "NOCONFIGURE" "TRUE")
  6430. #t)))))
  6431. (home-page "https://qalculate.github.io/")
  6432. (synopsis "Multi-purpose cli desktop calculator and library")
  6433. (description
  6434. "Libqalculate is a multi-purpose cli desktop calculator and library.
  6435. It provides basic and advanced functionality. Features include customizable
  6436. functions, unit calculations, and conversions, physical constants, symbolic
  6437. calculations (including integrals and equations), arbitrary precision,
  6438. uncertainty propagation, interval arithmetic, plotting and a user-friendly
  6439. cli.")
  6440. (license license:gpl2+)))
  6441. (define-public qalculate-gtk
  6442. (package
  6443. (name "qalculate-gtk")
  6444. (version "3.19.0")
  6445. (source
  6446. (origin
  6447. (method git-fetch)
  6448. (uri (git-reference
  6449. (url "https://github.com/Qalculate/qalculate-gtk/")
  6450. (commit (string-append "v" version))))
  6451. (file-name (git-file-name name version))
  6452. (sha256
  6453. (base32 "1nrx7gp6f1yalbdda1gb97azhbr4xclq2xf08vvbvsk8jfd6fd2v"))))
  6454. (build-system glib-or-gtk-build-system)
  6455. (native-inputs
  6456. `(("pkg-config" ,pkg-config)
  6457. ("intltool" ,intltool)
  6458. ("automake" ,automake)
  6459. ("autoconf" ,autoconf)
  6460. ("libtool" ,libtool)
  6461. ("file" ,file)))
  6462. (inputs
  6463. `(("gmp" ,gmp)
  6464. ("mpfr" ,mpfr)
  6465. ("libqalculate" ,libqalculate)
  6466. ("libxml2" ,libxml2)
  6467. ("glib" ,glib)
  6468. ("gtk+" ,gtk+)))
  6469. (arguments
  6470. `(#:phases
  6471. (modify-phases %standard-phases
  6472. (add-before 'bootstrap 'setenv
  6473. ;; Prevent the autogen.sh script to carry out the configure
  6474. ;; script, which has not yet been patched to replace /bin/sh.
  6475. (lambda _
  6476. (setenv "NOCONFIGURE" "TRUE")
  6477. #t)))))
  6478. (home-page "https://qalculate.github.io/")
  6479. (synopsis "Multi-purpose graphical desktop calculator")
  6480. (description
  6481. "Qalculate-gtk is the GTK frontend for libqalculate. It is a
  6482. multi-purpose GUI desktop calculator. It provides basic and advanced
  6483. functionality. Features include customizable functions, unit calculations,
  6484. and conversions, physical constants, symbolic calculations (including
  6485. integrals and equations), arbitrary precision, uncertainty propagation,
  6486. interval arithmetic, plotting.")
  6487. (license license:gpl2+)))
  6488. (define-public numdiff
  6489. (package
  6490. (name "numdiff")
  6491. (version "5.9.0")
  6492. (source
  6493. (origin
  6494. (method url-fetch)
  6495. (uri (string-append "mirror://savannah/numdiff/numdiff-"
  6496. version ".tar.gz"))
  6497. (sha256
  6498. (base32
  6499. "1vzmjh8mhwwysn4x4m2vif7q2k8i19x8azq7pzmkwwj4g48lla47"))))
  6500. (build-system gnu-build-system)
  6501. (arguments
  6502. '(#:tests? #f ; There are no tests.
  6503. #:phases
  6504. (modify-phases %standard-phases
  6505. (add-before 'compress-documentation 'delete-precompressed-info-file
  6506. (lambda _
  6507. (delete-file (string-append (assoc-ref %outputs "out")
  6508. "/share/info/numdiff.info.gz"))
  6509. #t)))))
  6510. (home-page "https://nongnu.org/numdiff/")
  6511. (synopsis "Compare files with numeric fields")
  6512. (description
  6513. "Numdiff compares files line by line and field by field, ignoring small
  6514. numeric differences and differences in numeric formats.")
  6515. (license license:gpl3+)))
  6516. (define-public why3
  6517. (package
  6518. (name "why3")
  6519. (version "1.3.3")
  6520. (source (origin
  6521. (method url-fetch)
  6522. (uri (string-append "https://gforge.inria.fr/frs/download.php/file"
  6523. "/38367/why3-" version ".tar.gz"))
  6524. (sha256
  6525. (base32
  6526. "1n0a2nn1gnk0zg339lh698g4wpk7m8m1vyi2yvifd5adqvk4milw"))))
  6527. (build-system ocaml-build-system)
  6528. (native-inputs
  6529. `(("coq" ,coq)
  6530. ("ocaml" ,ocaml)
  6531. ("which" ,which)))
  6532. (propagated-inputs
  6533. `(("camlzip" ,camlzip)
  6534. ("ocaml-graph" ,ocaml-graph)
  6535. ("ocaml-menhir" ,ocaml-menhir)
  6536. ("ocaml-num" ,ocaml-num)
  6537. ("ocaml-zarith" ,ocaml-zarith)))
  6538. (inputs
  6539. `(("coq-flocq" ,coq-flocq)
  6540. ("emacs-minimal" ,emacs-minimal)
  6541. ("zlib" ,zlib)))
  6542. (arguments
  6543. `(#:phases
  6544. (modify-phases %standard-phases
  6545. (add-before 'configure 'fix-configure
  6546. (lambda _
  6547. (setenv "CONFIG_SHELL" (which "sh"))
  6548. (substitute* "configure"
  6549. ;; find ocaml-num in the correct directory
  6550. (("\\$DIR/nums.cma") "$DIR/num.cma")
  6551. (("\\$DIR/num.cmi") "$DIR/core/num.cmi"))
  6552. #t))
  6553. (add-after 'configure 'fix-makefile
  6554. (lambda _
  6555. (substitute* "Makefile"
  6556. ;; find ocaml-num in the correct directory
  6557. (("site-lib/num") "site-lib"))
  6558. #t))
  6559. (add-after 'install 'install-lib
  6560. (lambda _
  6561. (invoke "make" "byte")
  6562. (invoke "make" "install-lib")
  6563. #t)))))
  6564. (home-page "http://why3.lri.fr")
  6565. (synopsis "Deductive program verification")
  6566. (description "Why3 provides a language for specification and programming,
  6567. called WhyML, and relies on external theorem provers, both automated and
  6568. interactive, to discharge verification conditions. Why3 comes with a standard
  6569. library of logical theories (integer and real arithmetic, Boolean operations,
  6570. sets and maps, etc.) and basic programming data structures (arrays, queues,
  6571. hash tables, etc.). A user can write WhyML programs directly and get
  6572. correct-by-construction OCaml programs through an automated extraction
  6573. mechanism. WhyML is also used as an intermediate language for the verification
  6574. of C, Java, or Ada programs.")
  6575. (license license:lgpl2.1)))
  6576. (define-public frama-c
  6577. (package
  6578. (name "frama-c")
  6579. (version "22.0")
  6580. (source (origin
  6581. (method url-fetch)
  6582. (uri (string-append "http://frama-c.com/download/frama-c-"
  6583. version "-Titanium.tar.gz"))
  6584. (sha256
  6585. (base32
  6586. "1mq1fijka95ydrla486yr4w6wdl9l7vmp512s1q00b0p6lmfwmkh"))))
  6587. (build-system ocaml-build-system)
  6588. (arguments
  6589. `(#:tests? #f; no test target in Makefile
  6590. #:phases
  6591. (modify-phases %standard-phases
  6592. (add-before 'configure 'export-shell
  6593. (lambda* (#:key inputs #:allow-other-keys)
  6594. (setenv "CONFIG_SHELL"
  6595. (search-input-file inputs "/bin/sh")))))))
  6596. (inputs
  6597. `(("gmp" ,gmp)))
  6598. (propagated-inputs
  6599. `(("ocaml-biniou" ,ocaml-biniou)
  6600. ("ocaml-easy-format" ,ocaml-easy-format)
  6601. ("ocaml-graph" ,ocaml-graph)
  6602. ("ocaml-yojson" ,ocaml-yojson)
  6603. ("ocaml-zarith" ,ocaml-zarith)
  6604. ("why3" ,why3)))
  6605. (native-search-paths
  6606. (list (search-path-specification
  6607. (variable "FRAMAC_SHARE")
  6608. (files '("share/frama-c"))
  6609. (separator #f))
  6610. (search-path-specification
  6611. (variable "FRAMAC_LIB")
  6612. (files '("lib/frama-c"))
  6613. (separator #f))))
  6614. (home-page "http://frama-c.com")
  6615. (synopsis "C source code analysis platform")
  6616. (description "Frama-C is an extensible and collaborative platform dedicated
  6617. to source-code analysis of C software. The Frama-C analyzers assist you in
  6618. various source-code-related activities, from the navigation through unfamiliar
  6619. projects up to the certification of critical software.")
  6620. (license license:lgpl2.1+)))
  6621. (define-public blitz
  6622. (package
  6623. (name "blitz")
  6624. (version "1.0.2")
  6625. (source
  6626. (origin
  6627. (method git-fetch)
  6628. (uri (git-reference
  6629. (url "https://github.com/blitzpp/blitz")
  6630. (commit version)))
  6631. (file-name (git-file-name name version))
  6632. (sha256
  6633. (base32 "0c88gc72j3zggyk4yrrip6i0v7xkx97l140vpy3xhxs2i7xy1461"))))
  6634. (build-system cmake-build-system)
  6635. (arguments
  6636. `(#:configure-flags '("-DBUILD_DOC=ON"
  6637. "-DBUILD_TESTING=ON")
  6638. ;; The default "check" target also includes examples and benchmarks.
  6639. #:test-target "check-testsuite"
  6640. #:phases
  6641. (modify-phases %standard-phases
  6642. (add-after 'build 'build-doc
  6643. (lambda _
  6644. (invoke "make" "-j" (number->string (parallel-job-count))
  6645. "blitz-doc"))))))
  6646. (native-inputs
  6647. `(("python" ,python)
  6648. ("texinfo" ,texinfo)))
  6649. (synopsis "C++ template class library for multidimensional arrays")
  6650. (description "Blitz++ is a C++ template class library that provides
  6651. high-performance multidimensional array containers for scientific computing.")
  6652. (home-page "https://github.com/blitzpp/blitz")
  6653. (license (list license:artistic2.0
  6654. license:bsd-3
  6655. license:lgpl3+))))
  6656. (define-public fxdiv
  6657. ;; There is currently no tag in this repo.
  6658. (let ((commit "63058eff77e11aa15bf531df5dd34395ec3017c8")
  6659. (version "0.0")
  6660. (revision "1"))
  6661. (package
  6662. (name "fxdiv")
  6663. (version (git-version version revision commit))
  6664. (home-page "https://github.com/Maratyszcza/FXdiv")
  6665. (source (origin
  6666. (method git-fetch)
  6667. (uri (git-reference (url home-page) (commit commit)))
  6668. (file-name (git-file-name name version))
  6669. (sha256
  6670. (base32
  6671. "0zwzh8gmbx4m6b18s5nf13b0dk5yjkd1fs8f421bl7fz5f9gjd9f"))
  6672. (patches (search-patches "fxdiv-system-libraries.patch"))))
  6673. (build-system cmake-build-system)
  6674. (inputs
  6675. `(("googletest" ,googletest)
  6676. ("googlebenchmark" ,googlebenchmark)))
  6677. (synopsis
  6678. "C++ library for division via fixed-point multiplication by inverse")
  6679. (description
  6680. "On modern CPUs and GPUs, integer division is several times slower than
  6681. multiplication. FXdiv implements an algorithm to replace an integer division
  6682. with a multiplication and two shifts. This algorithm improves performance
  6683. when an application performs repeated divisions by the same divisor.")
  6684. (license license:expat))))
  6685. (define-public fp16
  6686. ;; There is currently no tag in this repo.
  6687. (let ((commit "0a92994d729ff76a58f692d3028ca1b64b145d91")
  6688. (version "0.0")
  6689. (revision "1"))
  6690. (package
  6691. (name "fp16")
  6692. (version (git-version version revision commit))
  6693. (home-page "https://github.com/Maratyszcza/FP16")
  6694. (source (origin
  6695. (method git-fetch)
  6696. (uri (git-reference (url home-page) (commit commit)))
  6697. (file-name (git-file-name name version))
  6698. (sha256
  6699. (base32
  6700. "05mm4vrxsac35hjf5djif9r6rdxj9ippg97ia3p6q6b8lrp7srwv"))
  6701. (patches (search-patches "fp16-system-libraries.patch"))))
  6702. (build-system cmake-build-system)
  6703. (native-inputs
  6704. `(("python-wrapper" ,python-wrapper)))
  6705. (inputs
  6706. `(("psimd" ,psimd)
  6707. ("googletest" ,googletest)
  6708. ("googlebenchmark" ,googlebenchmark)))
  6709. (synopsis "C++ library for half-precision floating point formats")
  6710. (description
  6711. "This header-only C++ library implements conversion to and from
  6712. half-precision floating point formats.")
  6713. (license license:expat))))
  6714. (define-public optizelle
  6715. (let ((commit "ed4160b5287518448caeb34789d92dc6a0b7e2cc"))
  6716. (package
  6717. (name "optizelle")
  6718. (version (git-version "1.3.0" "0" commit))
  6719. (source
  6720. (origin
  6721. (method git-fetch)
  6722. (uri (git-reference
  6723. (url "https://github.com/OptimoJoe/Optizelle")
  6724. (commit commit)))
  6725. (file-name (git-file-name "optizelle" commit))
  6726. (sha256
  6727. (base32
  6728. "0rjrs5sdmd33a9f4xm8an7p0953aa0bxsmr4hs3ss1aad9k181vq"))
  6729. (modules '((guix build utils)))
  6730. (snippet
  6731. '(begin
  6732. ;; Reduce the stopping tolerance in one test so that the
  6733. ;; convergence check returns the correct stopping
  6734. ;; condition.
  6735. (substitute*
  6736. "src/unit/linear_algebra/tcg_loss_of_orthogonality.cpp"
  6737. (("1e-13") "5e-14"))
  6738. ;; Skip one set of python tests. See
  6739. ;; https://github.com/OptimoJoe/Optizelle/issues/2.
  6740. (substitute*
  6741. "src/examples/inequality_scaling/CMakeLists.txt"
  6742. (("add_unit(.*)\\$\\{interfaces\\}(.*)$" all middle end)
  6743. (string-append "add_unit" middle "\"cpp\"" end)))
  6744. ;; Install the licence for Optizelle, without also
  6745. ;; including the licences for the dependencies.
  6746. (substitute* "licenses/CMakeLists.txt"
  6747. (("file.*package.*$" all)
  6748. (string-append "# " all))
  6749. ((".*[^l].[.]txt\\)\n") "")
  6750. (("add_license.*\"\n") ""))
  6751. #t))))
  6752. (build-system cmake-build-system)
  6753. (arguments
  6754. `(#:imported-modules ((guix build python-build-system)
  6755. ,@%cmake-build-system-modules)
  6756. #:modules (((guix build python-build-system) #:select
  6757. (python-version))
  6758. (guix build cmake-build-system)
  6759. (guix build utils))
  6760. #:configure-flags `("-DCMAKE_CXX_FLAGS:STRING=-pthread"
  6761. "-DENABLE_CPP_UNIT:BOOL=ON"
  6762. "-DENABLE_CPP_EXAMPLES:BOOL=ON"
  6763. "-DENABLE_PYTHON:BOOL=ON"
  6764. "-DENABLE_PYTHON_UNIT:BOOL=ON"
  6765. "-DENABLE_PYTHON_EXAMPLES:BOOL=ON"
  6766. ,(string-append "-DBLAS_LIBRARY:FILEPATH="
  6767. (assoc-ref %build-inputs
  6768. "blas/lapack")
  6769. "/lib/libopenblas.so")
  6770. ,(string-append "-DLAPACK_LIBRARY:FILEPATH="
  6771. (assoc-ref %build-inputs
  6772. "fortran:lib")
  6773. "/lib/libgfortran.so;"
  6774. (assoc-ref %build-inputs
  6775. "fortran:lib")
  6776. "/lib/libquadmath.so"))
  6777. #:phases
  6778. (modify-phases %standard-phases
  6779. (add-after 'unpack 'set-numpy-path ; Needed for the unit tests.
  6780. (lambda* (#:key inputs #:allow-other-keys)
  6781. (let* ((pyver (python-version (assoc-ref inputs "python")))
  6782. (npdir (string-append (assoc-ref inputs "numpy")
  6783. "/lib/python" pyver
  6784. "/site-packages")))
  6785. (substitute* "src/cmake/Modules/Optizelle.cmake"
  6786. (("PYTHONPATH=")
  6787. (string-append "LD_LIBRARY_PATH=$ENV{LIBRARY_PATH};"
  6788. "PYTHONPATH=" npdir ":"))))))
  6789. (delete 'install-license-files)))) ; LICENSE.txt is installed.
  6790. (inputs
  6791. `(("blas/lapack" ,openblas)
  6792. ("fortran:lib" ,gfortran "lib")
  6793. ("jsoncpp" ,jsoncpp)
  6794. ("numpy" ,python-numpy)
  6795. ("python" ,python)))
  6796. (native-inputs
  6797. `(("fortran" ,gfortran)
  6798. ("pkg-config" ,pkg-config)))
  6799. (home-page "https://www.optimojoe.com/products/optizelle/")
  6800. (synopsis "Mathematical optimization library")
  6801. (description "@code{optizelle} is a software library designed to
  6802. solve nonlinear optimization problems. Four types of problem are
  6803. considered: unconstrained, equality constrained, inequality
  6804. constrained and constrained. Constraints may be applied as values of
  6805. functions or sets of partial differential equations (PDEs).
  6806. Solution algorithms such as the preconditioned nonlinear conjugate
  6807. gradient method, sequential quadratic programming (SQP) and the
  6808. primal-dual interior-point method are made available. Interfaces are
  6809. provided for applications written in C++ and Python. Parallel
  6810. computation is supported via MPI.")
  6811. (license license:bsd-2))))