cpp.h 909 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568
  1. /// These are automatically generated C++ bindings for isl.
  2. ///
  3. /// isl is a library for computing with integer sets and maps described by
  4. /// Presburger formulas. On top of this, isl provides various tools for
  5. /// polyhedral compilation, ranging from dependence analysis over scheduling
  6. /// to AST generation.
  7. #ifndef ISL_CPP
  8. #define ISL_CPP
  9. #include <isl/ctx.h>
  10. #include <isl/options.h>
  11. #include <functional>
  12. #include <memory>
  13. #include <ostream>
  14. #include <stdexcept>
  15. #include <string>
  16. #include <type_traits>
  17. #if __cplusplus >= 201703L
  18. #include <any>
  19. #include <optional>
  20. #endif
  21. /* ISL_USE_EXCEPTIONS should be defined to 1 if exceptions are available.
  22. * gcc and clang define __cpp_exceptions; MSVC and xlC define _CPPUNWIND.
  23. * Older versions of gcc (e.g., 4.9) only define __EXCEPTIONS.
  24. * If exceptions are not available, any error condition will result
  25. * in an abort.
  26. */
  27. #ifndef ISL_USE_EXCEPTIONS
  28. #if defined(__cpp_exceptions) || defined(_CPPUNWIND) || defined(__EXCEPTIONS)
  29. #define ISL_USE_EXCEPTIONS 1
  30. #else
  31. #define ISL_USE_EXCEPTIONS 0
  32. #endif
  33. #endif
  34. namespace isl {
  35. class ctx {
  36. isl_ctx *ptr;
  37. public:
  38. /* implicit */ ctx(isl_ctx *ctx) : ptr(ctx) {}
  39. isl_ctx *release() {
  40. auto tmp = ptr;
  41. ptr = nullptr;
  42. return tmp;
  43. }
  44. isl_ctx *get() {
  45. return ptr;
  46. }
  47. #if __cplusplus >= 201703L
  48. static void free_user(void *user) {
  49. std::any *p = static_cast<std::any *>(user);
  50. delete p;
  51. }
  52. #endif
  53. };
  54. /* Macros hiding try/catch.
  55. * If exceptions are not available, then no exceptions will be thrown and
  56. * there is nothing to catch.
  57. */
  58. #if ISL_USE_EXCEPTIONS
  59. #define ISL_CPP_TRY try
  60. #define ISL_CPP_CATCH_ALL catch (...)
  61. #else
  62. #define ISL_CPP_TRY if (1)
  63. #define ISL_CPP_CATCH_ALL if (0)
  64. #endif
  65. #if ISL_USE_EXCEPTIONS
  66. /* Class capturing isl errors.
  67. *
  68. * The what() return value is stored in a reference counted string
  69. * to ensure that the copy constructor and the assignment operator
  70. * do not throw any exceptions.
  71. */
  72. class exception : public std::exception {
  73. std::shared_ptr<std::string> what_str;
  74. protected:
  75. inline exception(const char *what_arg, const char *msg,
  76. const char *file, int line);
  77. public:
  78. exception() {}
  79. exception(const char *what_arg) {
  80. what_str = std::make_shared<std::string>(what_arg);
  81. }
  82. static inline void throw_error(enum isl_error error, const char *msg,
  83. const char *file, int line);
  84. virtual const char *what() const noexcept {
  85. return what_str->c_str();
  86. }
  87. /* Default behavior on error conditions that occur inside isl calls
  88. * performed from inside the bindings.
  89. * In the case exceptions are available, isl should continue
  90. * without printing a warning since the warning message
  91. * will be included in the exception thrown from inside the bindings.
  92. */
  93. static constexpr auto on_error = ISL_ON_ERROR_CONTINUE;
  94. /* Wrapper for throwing an exception with the given message.
  95. */
  96. static void throw_invalid(const char *msg, const char *file, int line) {
  97. throw_error(isl_error_invalid, msg, file, line);
  98. }
  99. static inline void throw_last_error(ctx ctx);
  100. };
  101. /* Create an exception of a type described by "what_arg", with
  102. * error message "msg" in line "line" of file "file".
  103. *
  104. * Create a string holding the what() return value that
  105. * corresponds to what isl would have printed.
  106. * If no error message or no error file was set, then use "what_arg" instead.
  107. */
  108. exception::exception(const char *what_arg, const char *msg, const char *file,
  109. int line)
  110. {
  111. if (!msg || !file)
  112. what_str = std::make_shared<std::string>(what_arg);
  113. else
  114. what_str = std::make_shared<std::string>(std::string(file) +
  115. ":" + std::to_string(line) + ": " + msg);
  116. }
  117. class exception_abort : public exception {
  118. friend exception;
  119. exception_abort(const char *msg, const char *file, int line) :
  120. exception("execution aborted", msg, file, line) {}
  121. };
  122. class exception_alloc : public exception {
  123. friend exception;
  124. exception_alloc(const char *msg, const char *file, int line) :
  125. exception("memory allocation failure", msg, file, line) {}
  126. };
  127. class exception_unknown : public exception {
  128. friend exception;
  129. exception_unknown(const char *msg, const char *file, int line) :
  130. exception("unknown failure", msg, file, line) {}
  131. };
  132. class exception_internal : public exception {
  133. friend exception;
  134. exception_internal(const char *msg, const char *file, int line) :
  135. exception("internal error", msg, file, line) {}
  136. };
  137. class exception_invalid : public exception {
  138. friend exception;
  139. exception_invalid(const char *msg, const char *file, int line) :
  140. exception("invalid argument", msg, file, line) {}
  141. };
  142. class exception_quota : public exception {
  143. friend exception;
  144. exception_quota(const char *msg, const char *file, int line) :
  145. exception("quota exceeded", msg, file, line) {}
  146. };
  147. class exception_unsupported : public exception {
  148. friend exception;
  149. exception_unsupported(const char *msg, const char *file, int line) :
  150. exception("unsupported operation", msg, file, line) {}
  151. };
  152. /* Throw an exception of the class that corresponds to "error", with
  153. * error message "msg" in line "line" of file "file".
  154. *
  155. * isl_error_none is treated as an invalid error type.
  156. */
  157. void exception::throw_error(enum isl_error error, const char *msg,
  158. const char *file, int line)
  159. {
  160. switch (error) {
  161. case isl_error_none:
  162. break;
  163. case isl_error_abort: throw exception_abort(msg, file, line);
  164. case isl_error_alloc: throw exception_alloc(msg, file, line);
  165. case isl_error_unknown: throw exception_unknown(msg, file, line);
  166. case isl_error_internal: throw exception_internal(msg, file, line);
  167. case isl_error_invalid: throw exception_invalid(msg, file, line);
  168. case isl_error_quota: throw exception_quota(msg, file, line);
  169. case isl_error_unsupported:
  170. throw exception_unsupported(msg, file, line);
  171. }
  172. throw exception_invalid("invalid error type", file, line);
  173. }
  174. /* Throw an exception corresponding to the last error on "ctx" and
  175. * reset the error.
  176. *
  177. * If "ctx" is NULL or if it is not in an error state at the start,
  178. * then an invalid argument exception is thrown.
  179. */
  180. void exception::throw_last_error(ctx ctx)
  181. {
  182. enum isl_error error;
  183. const char *msg, *file;
  184. int line;
  185. error = isl_ctx_last_error(ctx.get());
  186. msg = isl_ctx_last_error_msg(ctx.get());
  187. file = isl_ctx_last_error_file(ctx.get());
  188. line = isl_ctx_last_error_line(ctx.get());
  189. isl_ctx_reset_error(ctx.get());
  190. throw_error(error, msg, file, line);
  191. }
  192. #else
  193. #include <stdio.h>
  194. #include <stdlib.h>
  195. class exception {
  196. public:
  197. /* Default behavior on error conditions that occur inside isl calls
  198. * performed from inside the bindings.
  199. * In the case exceptions are not available, isl should abort.
  200. */
  201. static constexpr auto on_error = ISL_ON_ERROR_ABORT;
  202. /* Wrapper for throwing an exception with the given message.
  203. * In the case exceptions are not available, print an error and abort.
  204. */
  205. static void throw_invalid(const char *msg, const char *file, int line) {
  206. fprintf(stderr, "%s:%d: %s\n", file, line, msg);
  207. abort();
  208. }
  209. /* Throw an exception corresponding to the last
  210. * error on "ctx".
  211. * isl should already abort when an error condition occurs,
  212. * so this function should never be called.
  213. */
  214. static void throw_last_error(ctx ctx) {
  215. abort();
  216. }
  217. };
  218. #endif
  219. /* Helper class for setting the on_error and resetting the option
  220. * to the original value when leaving the scope.
  221. */
  222. class options_scoped_set_on_error {
  223. isl_ctx *ctx;
  224. int saved_on_error;
  225. public:
  226. options_scoped_set_on_error(class ctx ctx, int on_error) {
  227. this->ctx = ctx.get();
  228. saved_on_error = isl_options_get_on_error(this->ctx);
  229. isl_options_set_on_error(this->ctx, on_error);
  230. }
  231. ~options_scoped_set_on_error() {
  232. isl_options_set_on_error(ctx, saved_on_error);
  233. }
  234. };
  235. } // namespace isl
  236. #include <isl/id.h>
  237. #include <isl/space.h>
  238. #include <isl/val.h>
  239. #include <isl/aff.h>
  240. #include <isl/set.h>
  241. #include <isl/map.h>
  242. #include <isl/ilp.h>
  243. #include <isl/union_set.h>
  244. #include <isl/union_map.h>
  245. #include <isl/flow.h>
  246. #include <isl/schedule.h>
  247. #include <isl/schedule_node.h>
  248. #include <isl/ast_build.h>
  249. #include <isl/fixed_box.h>
  250. namespace isl {
  251. // forward declarations
  252. class aff;
  253. class aff_list;
  254. class ast_build;
  255. class ast_expr;
  256. class ast_expr_id;
  257. class ast_expr_int;
  258. class ast_expr_op;
  259. class ast_expr_op_access;
  260. class ast_expr_op_add;
  261. class ast_expr_op_address_of;
  262. class ast_expr_op_and;
  263. class ast_expr_op_and_then;
  264. class ast_expr_op_call;
  265. class ast_expr_op_cond;
  266. class ast_expr_op_div;
  267. class ast_expr_op_eq;
  268. class ast_expr_op_fdiv_q;
  269. class ast_expr_op_ge;
  270. class ast_expr_op_gt;
  271. class ast_expr_op_le;
  272. class ast_expr_op_lt;
  273. class ast_expr_op_max;
  274. class ast_expr_op_member;
  275. class ast_expr_op_min;
  276. class ast_expr_op_minus;
  277. class ast_expr_op_mul;
  278. class ast_expr_op_or;
  279. class ast_expr_op_or_else;
  280. class ast_expr_op_pdiv_q;
  281. class ast_expr_op_pdiv_r;
  282. class ast_expr_op_select;
  283. class ast_expr_op_sub;
  284. class ast_expr_op_zdiv_r;
  285. class ast_node;
  286. class ast_node_block;
  287. class ast_node_for;
  288. class ast_node_if;
  289. class ast_node_list;
  290. class ast_node_mark;
  291. class ast_node_user;
  292. class basic_map;
  293. class basic_set;
  294. class fixed_box;
  295. class id;
  296. class id_list;
  297. class map;
  298. class map_list;
  299. class multi_aff;
  300. class multi_id;
  301. class multi_pw_aff;
  302. class multi_union_pw_aff;
  303. class multi_val;
  304. class point;
  305. class pw_aff;
  306. class pw_aff_list;
  307. class pw_multi_aff;
  308. class pw_multi_aff_list;
  309. class schedule;
  310. class schedule_constraints;
  311. class schedule_node;
  312. class schedule_node_band;
  313. class schedule_node_context;
  314. class schedule_node_domain;
  315. class schedule_node_expansion;
  316. class schedule_node_extension;
  317. class schedule_node_filter;
  318. class schedule_node_guard;
  319. class schedule_node_leaf;
  320. class schedule_node_mark;
  321. class schedule_node_sequence;
  322. class schedule_node_set;
  323. class set;
  324. class set_list;
  325. class space;
  326. class union_access_info;
  327. class union_flow;
  328. class union_map;
  329. class union_pw_aff;
  330. class union_pw_aff_list;
  331. class union_pw_multi_aff;
  332. class union_set;
  333. class union_set_list;
  334. class val;
  335. class val_list;
  336. // declarations for isl::aff
  337. inline aff manage(__isl_take isl_aff *ptr);
  338. inline aff manage_copy(__isl_keep isl_aff *ptr);
  339. class aff {
  340. friend inline aff manage(__isl_take isl_aff *ptr);
  341. friend inline aff manage_copy(__isl_keep isl_aff *ptr);
  342. protected:
  343. isl_aff *ptr = nullptr;
  344. inline explicit aff(__isl_take isl_aff *ptr);
  345. public:
  346. inline /* implicit */ aff();
  347. inline /* implicit */ aff(const aff &obj);
  348. inline explicit aff(isl::ctx ctx, const std::string &str);
  349. inline aff &operator=(aff obj);
  350. inline ~aff();
  351. inline __isl_give isl_aff *copy() const &;
  352. inline __isl_give isl_aff *copy() && = delete;
  353. inline __isl_keep isl_aff *get() const;
  354. inline __isl_give isl_aff *release();
  355. inline bool is_null() const;
  356. inline isl::ctx ctx() const;
  357. inline isl::aff add(isl::aff aff2) const;
  358. inline isl::multi_aff add(const isl::multi_aff &multi2) const;
  359. inline isl::multi_pw_aff add(const isl::multi_pw_aff &multi2) const;
  360. inline isl::multi_union_pw_aff add(const isl::multi_union_pw_aff &multi2) const;
  361. inline isl::pw_aff add(const isl::pw_aff &pwaff2) const;
  362. inline isl::pw_multi_aff add(const isl::pw_multi_aff &pma2) const;
  363. inline isl::union_pw_aff add(const isl::union_pw_aff &upa2) const;
  364. inline isl::union_pw_multi_aff add(const isl::union_pw_multi_aff &upma2) const;
  365. inline isl::aff add_constant(isl::val v) const;
  366. inline isl::aff add_constant(long v) const;
  367. inline isl::multi_aff add_constant(const isl::multi_val &mv) const;
  368. inline isl::union_pw_multi_aff apply(const isl::union_pw_multi_aff &upma2) const;
  369. inline isl::aff as_aff() const;
  370. inline isl::map as_map() const;
  371. inline isl::multi_aff as_multi_aff() const;
  372. inline isl::multi_union_pw_aff as_multi_union_pw_aff() const;
  373. inline isl::pw_multi_aff as_pw_multi_aff() const;
  374. inline isl::set as_set() const;
  375. inline isl::union_map as_union_map() const;
  376. inline isl::aff at(int pos) const;
  377. inline isl::basic_set bind(isl::id id) const;
  378. inline isl::basic_set bind(const std::string &id) const;
  379. inline isl::basic_set bind(const isl::multi_id &tuple) const;
  380. inline isl::pw_aff bind_domain(const isl::multi_id &tuple) const;
  381. inline isl::pw_aff bind_domain_wrapped_domain(const isl::multi_id &tuple) const;
  382. inline isl::aff ceil() const;
  383. inline isl::pw_aff coalesce() const;
  384. inline isl::pw_aff cond(const isl::pw_aff &pwaff_true, const isl::pw_aff &pwaff_false) const;
  385. inline isl::multi_val constant_multi_val() const;
  386. inline isl::val constant_val() const;
  387. inline isl::val get_constant_val() const;
  388. inline isl::aff div(isl::aff aff2) const;
  389. inline isl::pw_aff div(const isl::pw_aff &pa2) const;
  390. inline isl::set domain() const;
  391. inline isl::set eq_set(isl::aff aff2) const;
  392. inline isl::set eq_set(const isl::pw_aff &pwaff2) const;
  393. inline isl::val eval(isl::point pnt) const;
  394. inline isl::pw_multi_aff extract_pw_multi_aff(const isl::space &space) const;
  395. inline isl::multi_aff flat_range_product(const isl::multi_aff &multi2) const;
  396. inline isl::multi_pw_aff flat_range_product(const isl::multi_pw_aff &multi2) const;
  397. inline isl::multi_union_pw_aff flat_range_product(const isl::multi_union_pw_aff &multi2) const;
  398. inline isl::pw_multi_aff flat_range_product(const isl::pw_multi_aff &pma2) const;
  399. inline isl::union_pw_multi_aff flat_range_product(const isl::union_pw_multi_aff &upma2) const;
  400. inline isl::aff floor() const;
  401. inline void foreach_piece(const std::function<void(isl::set, isl::multi_aff)> &fn) const;
  402. inline isl::set ge_set(isl::aff aff2) const;
  403. inline isl::set ge_set(const isl::pw_aff &pwaff2) const;
  404. inline isl::aff gist(isl::set context) const;
  405. inline isl::union_pw_aff gist(const isl::union_set &context) const;
  406. inline isl::aff gist(const isl::basic_set &context) const;
  407. inline isl::aff gist(const isl::point &context) const;
  408. inline isl::aff gist_params(isl::set context) const;
  409. inline isl::set gt_set(isl::aff aff2) const;
  410. inline isl::set gt_set(const isl::pw_aff &pwaff2) const;
  411. inline bool has_range_tuple_id() const;
  412. inline isl::multi_aff identity() const;
  413. inline isl::pw_aff insert_domain(const isl::space &domain) const;
  414. inline isl::pw_aff intersect_domain(const isl::set &set) const;
  415. inline isl::union_pw_aff intersect_domain(const isl::space &space) const;
  416. inline isl::union_pw_aff intersect_domain(const isl::union_set &uset) const;
  417. inline isl::union_pw_aff intersect_domain_wrapped_domain(const isl::union_set &uset) const;
  418. inline isl::union_pw_aff intersect_domain_wrapped_range(const isl::union_set &uset) const;
  419. inline isl::pw_aff intersect_params(const isl::set &set) const;
  420. inline bool involves_locals() const;
  421. inline bool involves_nan() const;
  422. inline bool involves_param(const isl::id &id) const;
  423. inline bool involves_param(const std::string &id) const;
  424. inline bool involves_param(const isl::id_list &list) const;
  425. inline bool is_cst() const;
  426. inline bool isa_aff() const;
  427. inline bool isa_multi_aff() const;
  428. inline bool isa_pw_multi_aff() const;
  429. inline isl::set le_set(isl::aff aff2) const;
  430. inline isl::set le_set(const isl::pw_aff &pwaff2) const;
  431. inline isl::aff_list list() const;
  432. inline isl::set lt_set(isl::aff aff2) const;
  433. inline isl::set lt_set(const isl::pw_aff &pwaff2) const;
  434. inline isl::multi_pw_aff max(const isl::multi_pw_aff &multi2) const;
  435. inline isl::pw_aff max(const isl::pw_aff &pwaff2) const;
  436. inline isl::multi_val max_multi_val() const;
  437. inline isl::val max_val() const;
  438. inline isl::multi_pw_aff min(const isl::multi_pw_aff &multi2) const;
  439. inline isl::pw_aff min(const isl::pw_aff &pwaff2) const;
  440. inline isl::multi_val min_multi_val() const;
  441. inline isl::val min_val() const;
  442. inline isl::aff mod(isl::val mod) const;
  443. inline isl::aff mod(long mod) const;
  444. inline isl::aff mul(isl::aff aff2) const;
  445. inline isl::pw_aff mul(const isl::pw_aff &pwaff2) const;
  446. inline unsigned n_piece() const;
  447. inline isl::set ne_set(isl::aff aff2) const;
  448. inline isl::set ne_set(const isl::pw_aff &pwaff2) const;
  449. inline isl::aff neg() const;
  450. inline bool plain_is_empty() const;
  451. inline bool plain_is_equal(const isl::multi_aff &multi2) const;
  452. inline bool plain_is_equal(const isl::multi_pw_aff &multi2) const;
  453. inline bool plain_is_equal(const isl::multi_union_pw_aff &multi2) const;
  454. inline isl::pw_multi_aff preimage_domain_wrapped_domain(const isl::pw_multi_aff &pma2) const;
  455. inline isl::union_pw_multi_aff preimage_domain_wrapped_domain(const isl::union_pw_multi_aff &upma2) const;
  456. inline isl::multi_aff product(const isl::multi_aff &multi2) const;
  457. inline isl::multi_pw_aff product(const isl::multi_pw_aff &multi2) const;
  458. inline isl::pw_multi_aff product(const isl::pw_multi_aff &pma2) const;
  459. inline isl::aff pullback(isl::multi_aff ma) const;
  460. inline isl::pw_aff pullback(const isl::multi_pw_aff &mpa) const;
  461. inline isl::pw_aff pullback(const isl::pw_multi_aff &pma) const;
  462. inline isl::union_pw_aff pullback(const isl::union_pw_multi_aff &upma) const;
  463. inline isl::aff pullback(const isl::aff &ma) const;
  464. inline isl::pw_multi_aff_list pw_multi_aff_list() const;
  465. inline isl::pw_multi_aff range_factor_domain() const;
  466. inline isl::pw_multi_aff range_factor_range() const;
  467. inline isl::multi_aff range_product(const isl::multi_aff &multi2) const;
  468. inline isl::multi_pw_aff range_product(const isl::multi_pw_aff &multi2) const;
  469. inline isl::multi_union_pw_aff range_product(const isl::multi_union_pw_aff &multi2) const;
  470. inline isl::pw_multi_aff range_product(const isl::pw_multi_aff &pma2) const;
  471. inline isl::union_pw_multi_aff range_product(const isl::union_pw_multi_aff &upma2) const;
  472. inline isl::id range_tuple_id() const;
  473. inline isl::multi_aff reset_range_tuple_id() const;
  474. inline isl::aff scale(isl::val v) const;
  475. inline isl::aff scale(long v) const;
  476. inline isl::multi_aff scale(const isl::multi_val &mv) const;
  477. inline isl::aff scale_down(isl::val v) const;
  478. inline isl::aff scale_down(long v) const;
  479. inline isl::multi_aff scale_down(const isl::multi_val &mv) const;
  480. inline isl::multi_aff set_at(int pos, const isl::aff &el) const;
  481. inline isl::multi_pw_aff set_at(int pos, const isl::pw_aff &el) const;
  482. inline isl::multi_union_pw_aff set_at(int pos, const isl::union_pw_aff &el) const;
  483. inline isl::multi_aff set_range_tuple(const isl::id &id) const;
  484. inline isl::multi_aff set_range_tuple(const std::string &id) const;
  485. inline unsigned size() const;
  486. inline isl::space space() const;
  487. inline isl::aff sub(isl::aff aff2) const;
  488. inline isl::multi_aff sub(const isl::multi_aff &multi2) const;
  489. inline isl::multi_pw_aff sub(const isl::multi_pw_aff &multi2) const;
  490. inline isl::multi_union_pw_aff sub(const isl::multi_union_pw_aff &multi2) const;
  491. inline isl::pw_aff sub(const isl::pw_aff &pwaff2) const;
  492. inline isl::pw_multi_aff sub(const isl::pw_multi_aff &pma2) const;
  493. inline isl::union_pw_aff sub(const isl::union_pw_aff &upa2) const;
  494. inline isl::union_pw_multi_aff sub(const isl::union_pw_multi_aff &upma2) const;
  495. inline isl::pw_aff subtract_domain(const isl::set &set) const;
  496. inline isl::union_pw_aff subtract_domain(const isl::space &space) const;
  497. inline isl::union_pw_aff subtract_domain(const isl::union_set &uset) const;
  498. inline isl::pw_aff tdiv_q(const isl::pw_aff &pa2) const;
  499. inline isl::pw_aff tdiv_r(const isl::pw_aff &pa2) const;
  500. inline isl::aff_list to_list() const;
  501. inline isl::multi_pw_aff to_multi_pw_aff() const;
  502. inline isl::multi_union_pw_aff to_multi_union_pw_aff() const;
  503. inline isl::pw_multi_aff to_pw_multi_aff() const;
  504. inline isl::union_pw_aff to_union_pw_aff() const;
  505. inline isl::union_pw_multi_aff to_union_pw_multi_aff() const;
  506. inline isl::aff unbind_params_insert_domain(isl::multi_id domain) const;
  507. inline isl::multi_pw_aff union_add(const isl::multi_pw_aff &mpa2) const;
  508. inline isl::multi_union_pw_aff union_add(const isl::multi_union_pw_aff &mupa2) const;
  509. inline isl::pw_aff union_add(const isl::pw_aff &pwaff2) const;
  510. inline isl::pw_multi_aff union_add(const isl::pw_multi_aff &pma2) const;
  511. inline isl::union_pw_aff union_add(const isl::union_pw_aff &upa2) const;
  512. inline isl::union_pw_multi_aff union_add(const isl::union_pw_multi_aff &upma2) const;
  513. static inline isl::aff zero_on_domain(isl::space space);
  514. };
  515. // declarations for isl::aff_list
  516. inline aff_list manage(__isl_take isl_aff_list *ptr);
  517. inline aff_list manage_copy(__isl_keep isl_aff_list *ptr);
  518. class aff_list {
  519. friend inline aff_list manage(__isl_take isl_aff_list *ptr);
  520. friend inline aff_list manage_copy(__isl_keep isl_aff_list *ptr);
  521. protected:
  522. isl_aff_list *ptr = nullptr;
  523. inline explicit aff_list(__isl_take isl_aff_list *ptr);
  524. public:
  525. inline /* implicit */ aff_list();
  526. inline /* implicit */ aff_list(const aff_list &obj);
  527. inline explicit aff_list(isl::ctx ctx, int n);
  528. inline explicit aff_list(isl::aff el);
  529. inline explicit aff_list(isl::ctx ctx, const std::string &str);
  530. inline aff_list &operator=(aff_list obj);
  531. inline ~aff_list();
  532. inline __isl_give isl_aff_list *copy() const &;
  533. inline __isl_give isl_aff_list *copy() && = delete;
  534. inline __isl_keep isl_aff_list *get() const;
  535. inline __isl_give isl_aff_list *release();
  536. inline bool is_null() const;
  537. inline isl::ctx ctx() const;
  538. inline isl::aff_list add(isl::aff el) const;
  539. inline isl::aff at(int index) const;
  540. inline isl::aff get_at(int index) const;
  541. inline isl::aff_list clear() const;
  542. inline isl::aff_list concat(isl::aff_list list2) const;
  543. inline isl::aff_list drop(unsigned int first, unsigned int n) const;
  544. inline void foreach(const std::function<void(isl::aff)> &fn) const;
  545. inline void foreach_scc(const std::function<bool(isl::aff, isl::aff)> &follows, const std::function<void(isl::aff_list)> &fn) const;
  546. inline isl::aff_list insert(unsigned int pos, isl::aff el) const;
  547. inline unsigned size() const;
  548. };
  549. // declarations for isl::ast_build
  550. inline ast_build manage(__isl_take isl_ast_build *ptr);
  551. inline ast_build manage_copy(__isl_keep isl_ast_build *ptr);
  552. class ast_build {
  553. friend inline ast_build manage(__isl_take isl_ast_build *ptr);
  554. friend inline ast_build manage_copy(__isl_keep isl_ast_build *ptr);
  555. protected:
  556. isl_ast_build *ptr = nullptr;
  557. inline explicit ast_build(__isl_take isl_ast_build *ptr);
  558. public:
  559. inline /* implicit */ ast_build();
  560. inline /* implicit */ ast_build(const ast_build &obj);
  561. inline explicit ast_build(isl::ctx ctx);
  562. inline ast_build &operator=(ast_build obj);
  563. inline ~ast_build();
  564. inline __isl_give isl_ast_build *copy() const &;
  565. inline __isl_give isl_ast_build *copy() && = delete;
  566. inline __isl_keep isl_ast_build *get() const;
  567. inline __isl_give isl_ast_build *release();
  568. inline bool is_null() const;
  569. inline isl::ctx ctx() const;
  570. private:
  571. inline ast_build &copy_callbacks(const ast_build &obj);
  572. struct at_each_domain_data {
  573. std::function<isl::ast_node(isl::ast_node, isl::ast_build)> func;
  574. std::exception_ptr eptr;
  575. };
  576. std::shared_ptr<at_each_domain_data> at_each_domain_data;
  577. static inline isl_ast_node *at_each_domain(isl_ast_node *arg_0, isl_ast_build *arg_1, void *arg_2);
  578. inline void set_at_each_domain_data(const std::function<isl::ast_node(isl::ast_node, isl::ast_build)> &fn);
  579. public:
  580. inline isl::ast_build set_at_each_domain(const std::function<isl::ast_node(isl::ast_node, isl::ast_build)> &fn) const;
  581. inline isl::ast_expr access_from(isl::multi_pw_aff mpa) const;
  582. inline isl::ast_expr access_from(isl::pw_multi_aff pma) const;
  583. inline isl::ast_expr call_from(isl::multi_pw_aff mpa) const;
  584. inline isl::ast_expr call_from(isl::pw_multi_aff pma) const;
  585. inline isl::ast_expr expr_from(isl::pw_aff pa) const;
  586. inline isl::ast_expr expr_from(isl::set set) const;
  587. static inline isl::ast_build from_context(isl::set set);
  588. inline isl::ast_node node_from(isl::schedule schedule) const;
  589. inline isl::ast_node node_from_schedule_map(isl::union_map schedule) const;
  590. inline isl::union_map schedule() const;
  591. inline isl::union_map get_schedule() const;
  592. };
  593. // declarations for isl::ast_expr
  594. inline ast_expr manage(__isl_take isl_ast_expr *ptr);
  595. inline ast_expr manage_copy(__isl_keep isl_ast_expr *ptr);
  596. class ast_expr {
  597. friend inline ast_expr manage(__isl_take isl_ast_expr *ptr);
  598. friend inline ast_expr manage_copy(__isl_keep isl_ast_expr *ptr);
  599. protected:
  600. isl_ast_expr *ptr = nullptr;
  601. inline explicit ast_expr(__isl_take isl_ast_expr *ptr);
  602. public:
  603. inline /* implicit */ ast_expr();
  604. inline /* implicit */ ast_expr(const ast_expr &obj);
  605. inline ast_expr &operator=(ast_expr obj);
  606. inline ~ast_expr();
  607. inline __isl_give isl_ast_expr *copy() const &;
  608. inline __isl_give isl_ast_expr *copy() && = delete;
  609. inline __isl_keep isl_ast_expr *get() const;
  610. inline __isl_give isl_ast_expr *release();
  611. inline bool is_null() const;
  612. private:
  613. template <typename T,
  614. typename = typename std::enable_if<std::is_same<
  615. const decltype(isl_ast_expr_get_type(NULL)),
  616. const T>::value>::type>
  617. inline bool isa_type(T subtype) const;
  618. public:
  619. template <class T> inline bool isa() const;
  620. template <class T> inline T as() const;
  621. inline isl::ctx ctx() const;
  622. inline std::string to_C_str() const;
  623. };
  624. // declarations for isl::ast_expr_id
  625. class ast_expr_id : public ast_expr {
  626. template <class T>
  627. friend bool ast_expr::isa() const;
  628. friend ast_expr_id ast_expr::as<ast_expr_id>() const;
  629. static const auto type = isl_ast_expr_id;
  630. protected:
  631. inline explicit ast_expr_id(__isl_take isl_ast_expr *ptr);
  632. public:
  633. inline /* implicit */ ast_expr_id();
  634. inline /* implicit */ ast_expr_id(const ast_expr_id &obj);
  635. inline ast_expr_id &operator=(ast_expr_id obj);
  636. inline isl::ctx ctx() const;
  637. inline isl::id id() const;
  638. inline isl::id get_id() const;
  639. };
  640. // declarations for isl::ast_expr_int
  641. class ast_expr_int : public ast_expr {
  642. template <class T>
  643. friend bool ast_expr::isa() const;
  644. friend ast_expr_int ast_expr::as<ast_expr_int>() const;
  645. static const auto type = isl_ast_expr_int;
  646. protected:
  647. inline explicit ast_expr_int(__isl_take isl_ast_expr *ptr);
  648. public:
  649. inline /* implicit */ ast_expr_int();
  650. inline /* implicit */ ast_expr_int(const ast_expr_int &obj);
  651. inline ast_expr_int &operator=(ast_expr_int obj);
  652. inline isl::ctx ctx() const;
  653. inline isl::val val() const;
  654. inline isl::val get_val() const;
  655. };
  656. // declarations for isl::ast_expr_op
  657. class ast_expr_op : public ast_expr {
  658. template <class T>
  659. friend bool ast_expr::isa() const;
  660. friend ast_expr_op ast_expr::as<ast_expr_op>() const;
  661. static const auto type = isl_ast_expr_op;
  662. protected:
  663. inline explicit ast_expr_op(__isl_take isl_ast_expr *ptr);
  664. public:
  665. inline /* implicit */ ast_expr_op();
  666. inline /* implicit */ ast_expr_op(const ast_expr_op &obj);
  667. inline ast_expr_op &operator=(ast_expr_op obj);
  668. private:
  669. template <typename T,
  670. typename = typename std::enable_if<std::is_same<
  671. const decltype(isl_ast_expr_op_get_type(NULL)),
  672. const T>::value>::type>
  673. inline bool isa_type(T subtype) const;
  674. public:
  675. template <class T> inline bool isa() const;
  676. template <class T> inline T as() const;
  677. inline isl::ctx ctx() const;
  678. inline isl::ast_expr arg(int pos) const;
  679. inline isl::ast_expr get_arg(int pos) const;
  680. inline unsigned n_arg() const;
  681. inline unsigned get_n_arg() const;
  682. };
  683. // declarations for isl::ast_expr_op_access
  684. class ast_expr_op_access : public ast_expr_op {
  685. template <class T>
  686. friend bool ast_expr_op::isa() const;
  687. friend ast_expr_op_access ast_expr_op::as<ast_expr_op_access>() const;
  688. static const auto type = isl_ast_expr_op_access;
  689. protected:
  690. inline explicit ast_expr_op_access(__isl_take isl_ast_expr *ptr);
  691. public:
  692. inline /* implicit */ ast_expr_op_access();
  693. inline /* implicit */ ast_expr_op_access(const ast_expr_op_access &obj);
  694. inline ast_expr_op_access &operator=(ast_expr_op_access obj);
  695. inline isl::ctx ctx() const;
  696. };
  697. // declarations for isl::ast_expr_op_add
  698. class ast_expr_op_add : public ast_expr_op {
  699. template <class T>
  700. friend bool ast_expr_op::isa() const;
  701. friend ast_expr_op_add ast_expr_op::as<ast_expr_op_add>() const;
  702. static const auto type = isl_ast_expr_op_add;
  703. protected:
  704. inline explicit ast_expr_op_add(__isl_take isl_ast_expr *ptr);
  705. public:
  706. inline /* implicit */ ast_expr_op_add();
  707. inline /* implicit */ ast_expr_op_add(const ast_expr_op_add &obj);
  708. inline ast_expr_op_add &operator=(ast_expr_op_add obj);
  709. inline isl::ctx ctx() const;
  710. };
  711. // declarations for isl::ast_expr_op_address_of
  712. class ast_expr_op_address_of : public ast_expr_op {
  713. template <class T>
  714. friend bool ast_expr_op::isa() const;
  715. friend ast_expr_op_address_of ast_expr_op::as<ast_expr_op_address_of>() const;
  716. static const auto type = isl_ast_expr_op_address_of;
  717. protected:
  718. inline explicit ast_expr_op_address_of(__isl_take isl_ast_expr *ptr);
  719. public:
  720. inline /* implicit */ ast_expr_op_address_of();
  721. inline /* implicit */ ast_expr_op_address_of(const ast_expr_op_address_of &obj);
  722. inline ast_expr_op_address_of &operator=(ast_expr_op_address_of obj);
  723. inline isl::ctx ctx() const;
  724. };
  725. // declarations for isl::ast_expr_op_and
  726. class ast_expr_op_and : public ast_expr_op {
  727. template <class T>
  728. friend bool ast_expr_op::isa() const;
  729. friend ast_expr_op_and ast_expr_op::as<ast_expr_op_and>() const;
  730. static const auto type = isl_ast_expr_op_and;
  731. protected:
  732. inline explicit ast_expr_op_and(__isl_take isl_ast_expr *ptr);
  733. public:
  734. inline /* implicit */ ast_expr_op_and();
  735. inline /* implicit */ ast_expr_op_and(const ast_expr_op_and &obj);
  736. inline ast_expr_op_and &operator=(ast_expr_op_and obj);
  737. inline isl::ctx ctx() const;
  738. };
  739. // declarations for isl::ast_expr_op_and_then
  740. class ast_expr_op_and_then : public ast_expr_op {
  741. template <class T>
  742. friend bool ast_expr_op::isa() const;
  743. friend ast_expr_op_and_then ast_expr_op::as<ast_expr_op_and_then>() const;
  744. static const auto type = isl_ast_expr_op_and_then;
  745. protected:
  746. inline explicit ast_expr_op_and_then(__isl_take isl_ast_expr *ptr);
  747. public:
  748. inline /* implicit */ ast_expr_op_and_then();
  749. inline /* implicit */ ast_expr_op_and_then(const ast_expr_op_and_then &obj);
  750. inline ast_expr_op_and_then &operator=(ast_expr_op_and_then obj);
  751. inline isl::ctx ctx() const;
  752. };
  753. // declarations for isl::ast_expr_op_call
  754. class ast_expr_op_call : public ast_expr_op {
  755. template <class T>
  756. friend bool ast_expr_op::isa() const;
  757. friend ast_expr_op_call ast_expr_op::as<ast_expr_op_call>() const;
  758. static const auto type = isl_ast_expr_op_call;
  759. protected:
  760. inline explicit ast_expr_op_call(__isl_take isl_ast_expr *ptr);
  761. public:
  762. inline /* implicit */ ast_expr_op_call();
  763. inline /* implicit */ ast_expr_op_call(const ast_expr_op_call &obj);
  764. inline ast_expr_op_call &operator=(ast_expr_op_call obj);
  765. inline isl::ctx ctx() const;
  766. };
  767. // declarations for isl::ast_expr_op_cond
  768. class ast_expr_op_cond : public ast_expr_op {
  769. template <class T>
  770. friend bool ast_expr_op::isa() const;
  771. friend ast_expr_op_cond ast_expr_op::as<ast_expr_op_cond>() const;
  772. static const auto type = isl_ast_expr_op_cond;
  773. protected:
  774. inline explicit ast_expr_op_cond(__isl_take isl_ast_expr *ptr);
  775. public:
  776. inline /* implicit */ ast_expr_op_cond();
  777. inline /* implicit */ ast_expr_op_cond(const ast_expr_op_cond &obj);
  778. inline ast_expr_op_cond &operator=(ast_expr_op_cond obj);
  779. inline isl::ctx ctx() const;
  780. };
  781. // declarations for isl::ast_expr_op_div
  782. class ast_expr_op_div : public ast_expr_op {
  783. template <class T>
  784. friend bool ast_expr_op::isa() const;
  785. friend ast_expr_op_div ast_expr_op::as<ast_expr_op_div>() const;
  786. static const auto type = isl_ast_expr_op_div;
  787. protected:
  788. inline explicit ast_expr_op_div(__isl_take isl_ast_expr *ptr);
  789. public:
  790. inline /* implicit */ ast_expr_op_div();
  791. inline /* implicit */ ast_expr_op_div(const ast_expr_op_div &obj);
  792. inline ast_expr_op_div &operator=(ast_expr_op_div obj);
  793. inline isl::ctx ctx() const;
  794. };
  795. // declarations for isl::ast_expr_op_eq
  796. class ast_expr_op_eq : public ast_expr_op {
  797. template <class T>
  798. friend bool ast_expr_op::isa() const;
  799. friend ast_expr_op_eq ast_expr_op::as<ast_expr_op_eq>() const;
  800. static const auto type = isl_ast_expr_op_eq;
  801. protected:
  802. inline explicit ast_expr_op_eq(__isl_take isl_ast_expr *ptr);
  803. public:
  804. inline /* implicit */ ast_expr_op_eq();
  805. inline /* implicit */ ast_expr_op_eq(const ast_expr_op_eq &obj);
  806. inline ast_expr_op_eq &operator=(ast_expr_op_eq obj);
  807. inline isl::ctx ctx() const;
  808. };
  809. // declarations for isl::ast_expr_op_fdiv_q
  810. class ast_expr_op_fdiv_q : public ast_expr_op {
  811. template <class T>
  812. friend bool ast_expr_op::isa() const;
  813. friend ast_expr_op_fdiv_q ast_expr_op::as<ast_expr_op_fdiv_q>() const;
  814. static const auto type = isl_ast_expr_op_fdiv_q;
  815. protected:
  816. inline explicit ast_expr_op_fdiv_q(__isl_take isl_ast_expr *ptr);
  817. public:
  818. inline /* implicit */ ast_expr_op_fdiv_q();
  819. inline /* implicit */ ast_expr_op_fdiv_q(const ast_expr_op_fdiv_q &obj);
  820. inline ast_expr_op_fdiv_q &operator=(ast_expr_op_fdiv_q obj);
  821. inline isl::ctx ctx() const;
  822. };
  823. // declarations for isl::ast_expr_op_ge
  824. class ast_expr_op_ge : public ast_expr_op {
  825. template <class T>
  826. friend bool ast_expr_op::isa() const;
  827. friend ast_expr_op_ge ast_expr_op::as<ast_expr_op_ge>() const;
  828. static const auto type = isl_ast_expr_op_ge;
  829. protected:
  830. inline explicit ast_expr_op_ge(__isl_take isl_ast_expr *ptr);
  831. public:
  832. inline /* implicit */ ast_expr_op_ge();
  833. inline /* implicit */ ast_expr_op_ge(const ast_expr_op_ge &obj);
  834. inline ast_expr_op_ge &operator=(ast_expr_op_ge obj);
  835. inline isl::ctx ctx() const;
  836. };
  837. // declarations for isl::ast_expr_op_gt
  838. class ast_expr_op_gt : public ast_expr_op {
  839. template <class T>
  840. friend bool ast_expr_op::isa() const;
  841. friend ast_expr_op_gt ast_expr_op::as<ast_expr_op_gt>() const;
  842. static const auto type = isl_ast_expr_op_gt;
  843. protected:
  844. inline explicit ast_expr_op_gt(__isl_take isl_ast_expr *ptr);
  845. public:
  846. inline /* implicit */ ast_expr_op_gt();
  847. inline /* implicit */ ast_expr_op_gt(const ast_expr_op_gt &obj);
  848. inline ast_expr_op_gt &operator=(ast_expr_op_gt obj);
  849. inline isl::ctx ctx() const;
  850. };
  851. // declarations for isl::ast_expr_op_le
  852. class ast_expr_op_le : public ast_expr_op {
  853. template <class T>
  854. friend bool ast_expr_op::isa() const;
  855. friend ast_expr_op_le ast_expr_op::as<ast_expr_op_le>() const;
  856. static const auto type = isl_ast_expr_op_le;
  857. protected:
  858. inline explicit ast_expr_op_le(__isl_take isl_ast_expr *ptr);
  859. public:
  860. inline /* implicit */ ast_expr_op_le();
  861. inline /* implicit */ ast_expr_op_le(const ast_expr_op_le &obj);
  862. inline ast_expr_op_le &operator=(ast_expr_op_le obj);
  863. inline isl::ctx ctx() const;
  864. };
  865. // declarations for isl::ast_expr_op_lt
  866. class ast_expr_op_lt : public ast_expr_op {
  867. template <class T>
  868. friend bool ast_expr_op::isa() const;
  869. friend ast_expr_op_lt ast_expr_op::as<ast_expr_op_lt>() const;
  870. static const auto type = isl_ast_expr_op_lt;
  871. protected:
  872. inline explicit ast_expr_op_lt(__isl_take isl_ast_expr *ptr);
  873. public:
  874. inline /* implicit */ ast_expr_op_lt();
  875. inline /* implicit */ ast_expr_op_lt(const ast_expr_op_lt &obj);
  876. inline ast_expr_op_lt &operator=(ast_expr_op_lt obj);
  877. inline isl::ctx ctx() const;
  878. };
  879. // declarations for isl::ast_expr_op_max
  880. class ast_expr_op_max : public ast_expr_op {
  881. template <class T>
  882. friend bool ast_expr_op::isa() const;
  883. friend ast_expr_op_max ast_expr_op::as<ast_expr_op_max>() const;
  884. static const auto type = isl_ast_expr_op_max;
  885. protected:
  886. inline explicit ast_expr_op_max(__isl_take isl_ast_expr *ptr);
  887. public:
  888. inline /* implicit */ ast_expr_op_max();
  889. inline /* implicit */ ast_expr_op_max(const ast_expr_op_max &obj);
  890. inline ast_expr_op_max &operator=(ast_expr_op_max obj);
  891. inline isl::ctx ctx() const;
  892. };
  893. // declarations for isl::ast_expr_op_member
  894. class ast_expr_op_member : public ast_expr_op {
  895. template <class T>
  896. friend bool ast_expr_op::isa() const;
  897. friend ast_expr_op_member ast_expr_op::as<ast_expr_op_member>() const;
  898. static const auto type = isl_ast_expr_op_member;
  899. protected:
  900. inline explicit ast_expr_op_member(__isl_take isl_ast_expr *ptr);
  901. public:
  902. inline /* implicit */ ast_expr_op_member();
  903. inline /* implicit */ ast_expr_op_member(const ast_expr_op_member &obj);
  904. inline ast_expr_op_member &operator=(ast_expr_op_member obj);
  905. inline isl::ctx ctx() const;
  906. };
  907. // declarations for isl::ast_expr_op_min
  908. class ast_expr_op_min : public ast_expr_op {
  909. template <class T>
  910. friend bool ast_expr_op::isa() const;
  911. friend ast_expr_op_min ast_expr_op::as<ast_expr_op_min>() const;
  912. static const auto type = isl_ast_expr_op_min;
  913. protected:
  914. inline explicit ast_expr_op_min(__isl_take isl_ast_expr *ptr);
  915. public:
  916. inline /* implicit */ ast_expr_op_min();
  917. inline /* implicit */ ast_expr_op_min(const ast_expr_op_min &obj);
  918. inline ast_expr_op_min &operator=(ast_expr_op_min obj);
  919. inline isl::ctx ctx() const;
  920. };
  921. // declarations for isl::ast_expr_op_minus
  922. class ast_expr_op_minus : public ast_expr_op {
  923. template <class T>
  924. friend bool ast_expr_op::isa() const;
  925. friend ast_expr_op_minus ast_expr_op::as<ast_expr_op_minus>() const;
  926. static const auto type = isl_ast_expr_op_minus;
  927. protected:
  928. inline explicit ast_expr_op_minus(__isl_take isl_ast_expr *ptr);
  929. public:
  930. inline /* implicit */ ast_expr_op_minus();
  931. inline /* implicit */ ast_expr_op_minus(const ast_expr_op_minus &obj);
  932. inline ast_expr_op_minus &operator=(ast_expr_op_minus obj);
  933. inline isl::ctx ctx() const;
  934. };
  935. // declarations for isl::ast_expr_op_mul
  936. class ast_expr_op_mul : public ast_expr_op {
  937. template <class T>
  938. friend bool ast_expr_op::isa() const;
  939. friend ast_expr_op_mul ast_expr_op::as<ast_expr_op_mul>() const;
  940. static const auto type = isl_ast_expr_op_mul;
  941. protected:
  942. inline explicit ast_expr_op_mul(__isl_take isl_ast_expr *ptr);
  943. public:
  944. inline /* implicit */ ast_expr_op_mul();
  945. inline /* implicit */ ast_expr_op_mul(const ast_expr_op_mul &obj);
  946. inline ast_expr_op_mul &operator=(ast_expr_op_mul obj);
  947. inline isl::ctx ctx() const;
  948. };
  949. // declarations for isl::ast_expr_op_or
  950. class ast_expr_op_or : public ast_expr_op {
  951. template <class T>
  952. friend bool ast_expr_op::isa() const;
  953. friend ast_expr_op_or ast_expr_op::as<ast_expr_op_or>() const;
  954. static const auto type = isl_ast_expr_op_or;
  955. protected:
  956. inline explicit ast_expr_op_or(__isl_take isl_ast_expr *ptr);
  957. public:
  958. inline /* implicit */ ast_expr_op_or();
  959. inline /* implicit */ ast_expr_op_or(const ast_expr_op_or &obj);
  960. inline ast_expr_op_or &operator=(ast_expr_op_or obj);
  961. inline isl::ctx ctx() const;
  962. };
  963. // declarations for isl::ast_expr_op_or_else
  964. class ast_expr_op_or_else : public ast_expr_op {
  965. template <class T>
  966. friend bool ast_expr_op::isa() const;
  967. friend ast_expr_op_or_else ast_expr_op::as<ast_expr_op_or_else>() const;
  968. static const auto type = isl_ast_expr_op_or_else;
  969. protected:
  970. inline explicit ast_expr_op_or_else(__isl_take isl_ast_expr *ptr);
  971. public:
  972. inline /* implicit */ ast_expr_op_or_else();
  973. inline /* implicit */ ast_expr_op_or_else(const ast_expr_op_or_else &obj);
  974. inline ast_expr_op_or_else &operator=(ast_expr_op_or_else obj);
  975. inline isl::ctx ctx() const;
  976. };
  977. // declarations for isl::ast_expr_op_pdiv_q
  978. class ast_expr_op_pdiv_q : public ast_expr_op {
  979. template <class T>
  980. friend bool ast_expr_op::isa() const;
  981. friend ast_expr_op_pdiv_q ast_expr_op::as<ast_expr_op_pdiv_q>() const;
  982. static const auto type = isl_ast_expr_op_pdiv_q;
  983. protected:
  984. inline explicit ast_expr_op_pdiv_q(__isl_take isl_ast_expr *ptr);
  985. public:
  986. inline /* implicit */ ast_expr_op_pdiv_q();
  987. inline /* implicit */ ast_expr_op_pdiv_q(const ast_expr_op_pdiv_q &obj);
  988. inline ast_expr_op_pdiv_q &operator=(ast_expr_op_pdiv_q obj);
  989. inline isl::ctx ctx() const;
  990. };
  991. // declarations for isl::ast_expr_op_pdiv_r
  992. class ast_expr_op_pdiv_r : public ast_expr_op {
  993. template <class T>
  994. friend bool ast_expr_op::isa() const;
  995. friend ast_expr_op_pdiv_r ast_expr_op::as<ast_expr_op_pdiv_r>() const;
  996. static const auto type = isl_ast_expr_op_pdiv_r;
  997. protected:
  998. inline explicit ast_expr_op_pdiv_r(__isl_take isl_ast_expr *ptr);
  999. public:
  1000. inline /* implicit */ ast_expr_op_pdiv_r();
  1001. inline /* implicit */ ast_expr_op_pdiv_r(const ast_expr_op_pdiv_r &obj);
  1002. inline ast_expr_op_pdiv_r &operator=(ast_expr_op_pdiv_r obj);
  1003. inline isl::ctx ctx() const;
  1004. };
  1005. // declarations for isl::ast_expr_op_select
  1006. class ast_expr_op_select : public ast_expr_op {
  1007. template <class T>
  1008. friend bool ast_expr_op::isa() const;
  1009. friend ast_expr_op_select ast_expr_op::as<ast_expr_op_select>() const;
  1010. static const auto type = isl_ast_expr_op_select;
  1011. protected:
  1012. inline explicit ast_expr_op_select(__isl_take isl_ast_expr *ptr);
  1013. public:
  1014. inline /* implicit */ ast_expr_op_select();
  1015. inline /* implicit */ ast_expr_op_select(const ast_expr_op_select &obj);
  1016. inline ast_expr_op_select &operator=(ast_expr_op_select obj);
  1017. inline isl::ctx ctx() const;
  1018. };
  1019. // declarations for isl::ast_expr_op_sub
  1020. class ast_expr_op_sub : public ast_expr_op {
  1021. template <class T>
  1022. friend bool ast_expr_op::isa() const;
  1023. friend ast_expr_op_sub ast_expr_op::as<ast_expr_op_sub>() const;
  1024. static const auto type = isl_ast_expr_op_sub;
  1025. protected:
  1026. inline explicit ast_expr_op_sub(__isl_take isl_ast_expr *ptr);
  1027. public:
  1028. inline /* implicit */ ast_expr_op_sub();
  1029. inline /* implicit */ ast_expr_op_sub(const ast_expr_op_sub &obj);
  1030. inline ast_expr_op_sub &operator=(ast_expr_op_sub obj);
  1031. inline isl::ctx ctx() const;
  1032. };
  1033. // declarations for isl::ast_expr_op_zdiv_r
  1034. class ast_expr_op_zdiv_r : public ast_expr_op {
  1035. template <class T>
  1036. friend bool ast_expr_op::isa() const;
  1037. friend ast_expr_op_zdiv_r ast_expr_op::as<ast_expr_op_zdiv_r>() const;
  1038. static const auto type = isl_ast_expr_op_zdiv_r;
  1039. protected:
  1040. inline explicit ast_expr_op_zdiv_r(__isl_take isl_ast_expr *ptr);
  1041. public:
  1042. inline /* implicit */ ast_expr_op_zdiv_r();
  1043. inline /* implicit */ ast_expr_op_zdiv_r(const ast_expr_op_zdiv_r &obj);
  1044. inline ast_expr_op_zdiv_r &operator=(ast_expr_op_zdiv_r obj);
  1045. inline isl::ctx ctx() const;
  1046. };
  1047. // declarations for isl::ast_node
  1048. inline ast_node manage(__isl_take isl_ast_node *ptr);
  1049. inline ast_node manage_copy(__isl_keep isl_ast_node *ptr);
  1050. class ast_node {
  1051. friend inline ast_node manage(__isl_take isl_ast_node *ptr);
  1052. friend inline ast_node manage_copy(__isl_keep isl_ast_node *ptr);
  1053. protected:
  1054. isl_ast_node *ptr = nullptr;
  1055. inline explicit ast_node(__isl_take isl_ast_node *ptr);
  1056. public:
  1057. inline /* implicit */ ast_node();
  1058. inline /* implicit */ ast_node(const ast_node &obj);
  1059. inline ast_node &operator=(ast_node obj);
  1060. inline ~ast_node();
  1061. inline __isl_give isl_ast_node *copy() const &;
  1062. inline __isl_give isl_ast_node *copy() && = delete;
  1063. inline __isl_keep isl_ast_node *get() const;
  1064. inline __isl_give isl_ast_node *release();
  1065. inline bool is_null() const;
  1066. private:
  1067. template <typename T,
  1068. typename = typename std::enable_if<std::is_same<
  1069. const decltype(isl_ast_node_get_type(NULL)),
  1070. const T>::value>::type>
  1071. inline bool isa_type(T subtype) const;
  1072. public:
  1073. template <class T> inline bool isa() const;
  1074. template <class T> inline T as() const;
  1075. inline isl::ctx ctx() const;
  1076. inline std::string to_C_str() const;
  1077. inline isl::ast_node_list to_list() const;
  1078. };
  1079. // declarations for isl::ast_node_block
  1080. class ast_node_block : public ast_node {
  1081. template <class T>
  1082. friend bool ast_node::isa() const;
  1083. friend ast_node_block ast_node::as<ast_node_block>() const;
  1084. static const auto type = isl_ast_node_block;
  1085. protected:
  1086. inline explicit ast_node_block(__isl_take isl_ast_node *ptr);
  1087. public:
  1088. inline /* implicit */ ast_node_block();
  1089. inline /* implicit */ ast_node_block(const ast_node_block &obj);
  1090. inline ast_node_block &operator=(ast_node_block obj);
  1091. inline isl::ctx ctx() const;
  1092. inline isl::ast_node_list children() const;
  1093. inline isl::ast_node_list get_children() const;
  1094. };
  1095. // declarations for isl::ast_node_for
  1096. class ast_node_for : public ast_node {
  1097. template <class T>
  1098. friend bool ast_node::isa() const;
  1099. friend ast_node_for ast_node::as<ast_node_for>() const;
  1100. static const auto type = isl_ast_node_for;
  1101. protected:
  1102. inline explicit ast_node_for(__isl_take isl_ast_node *ptr);
  1103. public:
  1104. inline /* implicit */ ast_node_for();
  1105. inline /* implicit */ ast_node_for(const ast_node_for &obj);
  1106. inline ast_node_for &operator=(ast_node_for obj);
  1107. inline isl::ctx ctx() const;
  1108. inline isl::ast_node body() const;
  1109. inline isl::ast_node get_body() const;
  1110. inline isl::ast_expr cond() const;
  1111. inline isl::ast_expr get_cond() const;
  1112. inline isl::ast_expr inc() const;
  1113. inline isl::ast_expr get_inc() const;
  1114. inline isl::ast_expr init() const;
  1115. inline isl::ast_expr get_init() const;
  1116. inline bool is_degenerate() const;
  1117. inline isl::ast_expr iterator() const;
  1118. inline isl::ast_expr get_iterator() const;
  1119. };
  1120. // declarations for isl::ast_node_if
  1121. class ast_node_if : public ast_node {
  1122. template <class T>
  1123. friend bool ast_node::isa() const;
  1124. friend ast_node_if ast_node::as<ast_node_if>() const;
  1125. static const auto type = isl_ast_node_if;
  1126. protected:
  1127. inline explicit ast_node_if(__isl_take isl_ast_node *ptr);
  1128. public:
  1129. inline /* implicit */ ast_node_if();
  1130. inline /* implicit */ ast_node_if(const ast_node_if &obj);
  1131. inline ast_node_if &operator=(ast_node_if obj);
  1132. inline isl::ctx ctx() const;
  1133. inline isl::ast_expr cond() const;
  1134. inline isl::ast_expr get_cond() const;
  1135. inline isl::ast_node else_node() const;
  1136. inline isl::ast_node get_else_node() const;
  1137. inline bool has_else_node() const;
  1138. inline isl::ast_node then_node() const;
  1139. inline isl::ast_node get_then_node() const;
  1140. };
  1141. // declarations for isl::ast_node_list
  1142. inline ast_node_list manage(__isl_take isl_ast_node_list *ptr);
  1143. inline ast_node_list manage_copy(__isl_keep isl_ast_node_list *ptr);
  1144. class ast_node_list {
  1145. friend inline ast_node_list manage(__isl_take isl_ast_node_list *ptr);
  1146. friend inline ast_node_list manage_copy(__isl_keep isl_ast_node_list *ptr);
  1147. protected:
  1148. isl_ast_node_list *ptr = nullptr;
  1149. inline explicit ast_node_list(__isl_take isl_ast_node_list *ptr);
  1150. public:
  1151. inline /* implicit */ ast_node_list();
  1152. inline /* implicit */ ast_node_list(const ast_node_list &obj);
  1153. inline explicit ast_node_list(isl::ctx ctx, int n);
  1154. inline explicit ast_node_list(isl::ast_node el);
  1155. inline ast_node_list &operator=(ast_node_list obj);
  1156. inline ~ast_node_list();
  1157. inline __isl_give isl_ast_node_list *copy() const &;
  1158. inline __isl_give isl_ast_node_list *copy() && = delete;
  1159. inline __isl_keep isl_ast_node_list *get() const;
  1160. inline __isl_give isl_ast_node_list *release();
  1161. inline bool is_null() const;
  1162. inline isl::ctx ctx() const;
  1163. inline isl::ast_node_list add(isl::ast_node el) const;
  1164. inline isl::ast_node at(int index) const;
  1165. inline isl::ast_node get_at(int index) const;
  1166. inline isl::ast_node_list clear() const;
  1167. inline isl::ast_node_list concat(isl::ast_node_list list2) const;
  1168. inline isl::ast_node_list drop(unsigned int first, unsigned int n) const;
  1169. inline void foreach(const std::function<void(isl::ast_node)> &fn) const;
  1170. inline void foreach_scc(const std::function<bool(isl::ast_node, isl::ast_node)> &follows, const std::function<void(isl::ast_node_list)> &fn) const;
  1171. inline isl::ast_node_list insert(unsigned int pos, isl::ast_node el) const;
  1172. inline unsigned size() const;
  1173. };
  1174. // declarations for isl::ast_node_mark
  1175. class ast_node_mark : public ast_node {
  1176. template <class T>
  1177. friend bool ast_node::isa() const;
  1178. friend ast_node_mark ast_node::as<ast_node_mark>() const;
  1179. static const auto type = isl_ast_node_mark;
  1180. protected:
  1181. inline explicit ast_node_mark(__isl_take isl_ast_node *ptr);
  1182. public:
  1183. inline /* implicit */ ast_node_mark();
  1184. inline /* implicit */ ast_node_mark(const ast_node_mark &obj);
  1185. inline ast_node_mark &operator=(ast_node_mark obj);
  1186. inline isl::ctx ctx() const;
  1187. inline isl::id id() const;
  1188. inline isl::id get_id() const;
  1189. inline isl::ast_node node() const;
  1190. inline isl::ast_node get_node() const;
  1191. };
  1192. // declarations for isl::ast_node_user
  1193. class ast_node_user : public ast_node {
  1194. template <class T>
  1195. friend bool ast_node::isa() const;
  1196. friend ast_node_user ast_node::as<ast_node_user>() const;
  1197. static const auto type = isl_ast_node_user;
  1198. protected:
  1199. inline explicit ast_node_user(__isl_take isl_ast_node *ptr);
  1200. public:
  1201. inline /* implicit */ ast_node_user();
  1202. inline /* implicit */ ast_node_user(const ast_node_user &obj);
  1203. inline ast_node_user &operator=(ast_node_user obj);
  1204. inline isl::ctx ctx() const;
  1205. inline isl::ast_expr expr() const;
  1206. inline isl::ast_expr get_expr() const;
  1207. };
  1208. // declarations for isl::basic_map
  1209. inline basic_map manage(__isl_take isl_basic_map *ptr);
  1210. inline basic_map manage_copy(__isl_keep isl_basic_map *ptr);
  1211. class basic_map {
  1212. friend inline basic_map manage(__isl_take isl_basic_map *ptr);
  1213. friend inline basic_map manage_copy(__isl_keep isl_basic_map *ptr);
  1214. protected:
  1215. isl_basic_map *ptr = nullptr;
  1216. inline explicit basic_map(__isl_take isl_basic_map *ptr);
  1217. public:
  1218. inline /* implicit */ basic_map();
  1219. inline /* implicit */ basic_map(const basic_map &obj);
  1220. inline explicit basic_map(isl::ctx ctx, const std::string &str);
  1221. inline basic_map &operator=(basic_map obj);
  1222. inline ~basic_map();
  1223. inline __isl_give isl_basic_map *copy() const &;
  1224. inline __isl_give isl_basic_map *copy() && = delete;
  1225. inline __isl_keep isl_basic_map *get() const;
  1226. inline __isl_give isl_basic_map *release();
  1227. inline bool is_null() const;
  1228. inline isl::ctx ctx() const;
  1229. inline isl::basic_map affine_hull() const;
  1230. inline isl::basic_map apply_domain(isl::basic_map bmap2) const;
  1231. inline isl::map apply_domain(const isl::map &map2) const;
  1232. inline isl::union_map apply_domain(const isl::union_map &umap2) const;
  1233. inline isl::basic_map apply_range(isl::basic_map bmap2) const;
  1234. inline isl::map apply_range(const isl::map &map2) const;
  1235. inline isl::union_map apply_range(const isl::union_map &umap2) const;
  1236. inline isl::map as_map() const;
  1237. inline isl::multi_union_pw_aff as_multi_union_pw_aff() const;
  1238. inline isl::pw_multi_aff as_pw_multi_aff() const;
  1239. inline isl::union_pw_multi_aff as_union_pw_multi_aff() const;
  1240. inline isl::set bind_domain(const isl::multi_id &tuple) const;
  1241. inline isl::set bind_range(const isl::multi_id &tuple) const;
  1242. inline isl::map coalesce() const;
  1243. inline isl::map complement() const;
  1244. inline isl::union_map compute_divs() const;
  1245. inline isl::map curry() const;
  1246. inline isl::basic_set deltas() const;
  1247. inline isl::basic_map detect_equalities() const;
  1248. inline isl::set domain() const;
  1249. inline isl::map domain_factor_domain() const;
  1250. inline isl::map domain_factor_range() const;
  1251. inline isl::union_map domain_map() const;
  1252. inline isl::union_pw_multi_aff domain_map_union_pw_multi_aff() const;
  1253. inline isl::map domain_product(const isl::map &map2) const;
  1254. inline isl::union_map domain_product(const isl::union_map &umap2) const;
  1255. inline unsigned domain_tuple_dim() const;
  1256. inline isl::id domain_tuple_id() const;
  1257. inline isl::map eq_at(const isl::multi_pw_aff &mpa) const;
  1258. inline isl::union_map eq_at(const isl::multi_union_pw_aff &mupa) const;
  1259. inline bool every_map(const std::function<bool(isl::map)> &test) const;
  1260. inline isl::map extract_map(const isl::space &space) const;
  1261. inline isl::map factor_domain() const;
  1262. inline isl::map factor_range() const;
  1263. inline isl::union_map fixed_power(const isl::val &exp) const;
  1264. inline isl::union_map fixed_power(long exp) const;
  1265. inline isl::basic_map flatten() const;
  1266. inline isl::basic_map flatten_domain() const;
  1267. inline isl::basic_map flatten_range() const;
  1268. inline void foreach_basic_map(const std::function<void(isl::basic_map)> &fn) const;
  1269. inline void foreach_map(const std::function<void(isl::map)> &fn) const;
  1270. inline isl::basic_map gist(isl::basic_map context) const;
  1271. inline isl::map gist(const isl::map &context) const;
  1272. inline isl::union_map gist(const isl::union_map &context) const;
  1273. inline isl::map gist_domain(const isl::set &context) const;
  1274. inline isl::union_map gist_domain(const isl::union_set &uset) const;
  1275. inline isl::map gist_params(const isl::set &context) const;
  1276. inline isl::union_map gist_range(const isl::union_set &uset) const;
  1277. inline bool has_domain_tuple_id() const;
  1278. inline bool has_range_tuple_id() const;
  1279. inline isl::basic_map intersect(isl::basic_map bmap2) const;
  1280. inline isl::map intersect(const isl::map &map2) const;
  1281. inline isl::union_map intersect(const isl::union_map &umap2) const;
  1282. inline isl::basic_map intersect_domain(isl::basic_set bset) const;
  1283. inline isl::map intersect_domain(const isl::set &set) const;
  1284. inline isl::union_map intersect_domain(const isl::space &space) const;
  1285. inline isl::union_map intersect_domain(const isl::union_set &uset) const;
  1286. inline isl::basic_map intersect_domain(const isl::point &bset) const;
  1287. inline isl::map intersect_domain_factor_domain(const isl::map &factor) const;
  1288. inline isl::union_map intersect_domain_factor_domain(const isl::union_map &factor) const;
  1289. inline isl::map intersect_domain_factor_range(const isl::map &factor) const;
  1290. inline isl::union_map intersect_domain_factor_range(const isl::union_map &factor) const;
  1291. inline isl::map intersect_domain_wrapped_domain(const isl::set &domain) const;
  1292. inline isl::union_map intersect_domain_wrapped_domain(const isl::union_set &domain) const;
  1293. inline isl::map intersect_params(const isl::set &params) const;
  1294. inline isl::basic_map intersect_range(isl::basic_set bset) const;
  1295. inline isl::map intersect_range(const isl::set &set) const;
  1296. inline isl::union_map intersect_range(const isl::space &space) const;
  1297. inline isl::union_map intersect_range(const isl::union_set &uset) const;
  1298. inline isl::basic_map intersect_range(const isl::point &bset) const;
  1299. inline isl::map intersect_range_factor_domain(const isl::map &factor) const;
  1300. inline isl::union_map intersect_range_factor_domain(const isl::union_map &factor) const;
  1301. inline isl::map intersect_range_factor_range(const isl::map &factor) const;
  1302. inline isl::union_map intersect_range_factor_range(const isl::union_map &factor) const;
  1303. inline isl::map intersect_range_wrapped_domain(const isl::set &domain) const;
  1304. inline isl::union_map intersect_range_wrapped_domain(const isl::union_set &domain) const;
  1305. inline bool is_bijective() const;
  1306. inline bool is_disjoint(const isl::map &map2) const;
  1307. inline bool is_disjoint(const isl::union_map &umap2) const;
  1308. inline bool is_empty() const;
  1309. inline bool is_equal(const isl::basic_map &bmap2) const;
  1310. inline bool is_equal(const isl::map &map2) const;
  1311. inline bool is_equal(const isl::union_map &umap2) const;
  1312. inline bool is_injective() const;
  1313. inline bool is_single_valued() const;
  1314. inline bool is_strict_subset(const isl::map &map2) const;
  1315. inline bool is_strict_subset(const isl::union_map &umap2) const;
  1316. inline bool is_subset(const isl::basic_map &bmap2) const;
  1317. inline bool is_subset(const isl::map &map2) const;
  1318. inline bool is_subset(const isl::union_map &umap2) const;
  1319. inline bool isa_map() const;
  1320. inline isl::map lex_ge_at(const isl::multi_pw_aff &mpa) const;
  1321. inline isl::map lex_gt_at(const isl::multi_pw_aff &mpa) const;
  1322. inline isl::map lex_le_at(const isl::multi_pw_aff &mpa) const;
  1323. inline isl::map lex_lt_at(const isl::multi_pw_aff &mpa) const;
  1324. inline isl::map lexmax() const;
  1325. inline isl::pw_multi_aff lexmax_pw_multi_aff() const;
  1326. inline isl::map lexmin() const;
  1327. inline isl::pw_multi_aff lexmin_pw_multi_aff() const;
  1328. inline isl::map lower_bound(const isl::multi_pw_aff &lower) const;
  1329. inline isl::map_list map_list() const;
  1330. inline isl::multi_pw_aff max_multi_pw_aff() const;
  1331. inline isl::multi_pw_aff min_multi_pw_aff() const;
  1332. inline unsigned n_basic_map() const;
  1333. inline isl::basic_map polyhedral_hull() const;
  1334. inline isl::map preimage_domain(const isl::multi_aff &ma) const;
  1335. inline isl::map preimage_domain(const isl::multi_pw_aff &mpa) const;
  1336. inline isl::map preimage_domain(const isl::pw_multi_aff &pma) const;
  1337. inline isl::union_map preimage_domain(const isl::union_pw_multi_aff &upma) const;
  1338. inline isl::map preimage_range(const isl::multi_aff &ma) const;
  1339. inline isl::map preimage_range(const isl::pw_multi_aff &pma) const;
  1340. inline isl::union_map preimage_range(const isl::union_pw_multi_aff &upma) const;
  1341. inline isl::map product(const isl::map &map2) const;
  1342. inline isl::union_map product(const isl::union_map &umap2) const;
  1343. inline isl::map project_out_all_params() const;
  1344. inline isl::set range() const;
  1345. inline isl::map range_factor_domain() const;
  1346. inline isl::map range_factor_range() const;
  1347. inline isl::fixed_box range_lattice_tile() const;
  1348. inline isl::union_map range_map() const;
  1349. inline isl::map range_product(const isl::map &map2) const;
  1350. inline isl::union_map range_product(const isl::union_map &umap2) const;
  1351. inline isl::map range_reverse() const;
  1352. inline isl::fixed_box range_simple_fixed_box_hull() const;
  1353. inline unsigned range_tuple_dim() const;
  1354. inline isl::id range_tuple_id() const;
  1355. inline isl::basic_map reverse() const;
  1356. inline isl::basic_map sample() const;
  1357. inline isl::map set_domain_tuple(const isl::id &id) const;
  1358. inline isl::map set_domain_tuple(const std::string &id) const;
  1359. inline isl::map set_range_tuple(const isl::id &id) const;
  1360. inline isl::map set_range_tuple(const std::string &id) const;
  1361. inline isl::space space() const;
  1362. inline isl::map subtract(const isl::map &map2) const;
  1363. inline isl::union_map subtract(const isl::union_map &umap2) const;
  1364. inline isl::union_map subtract_domain(const isl::union_set &dom) const;
  1365. inline isl::union_map subtract_range(const isl::union_set &dom) const;
  1366. inline isl::map_list to_list() const;
  1367. inline isl::union_map to_union_map() const;
  1368. inline isl::map uncurry() const;
  1369. inline isl::map unite(isl::basic_map bmap2) const;
  1370. inline isl::map unite(const isl::map &map2) const;
  1371. inline isl::union_map unite(const isl::union_map &umap2) const;
  1372. inline isl::basic_map unshifted_simple_hull() const;
  1373. inline isl::map upper_bound(const isl::multi_pw_aff &upper) const;
  1374. inline isl::set wrap() const;
  1375. inline isl::map zip() const;
  1376. };
  1377. // declarations for isl::basic_set
  1378. inline basic_set manage(__isl_take isl_basic_set *ptr);
  1379. inline basic_set manage_copy(__isl_keep isl_basic_set *ptr);
  1380. class basic_set {
  1381. friend inline basic_set manage(__isl_take isl_basic_set *ptr);
  1382. friend inline basic_set manage_copy(__isl_keep isl_basic_set *ptr);
  1383. protected:
  1384. isl_basic_set *ptr = nullptr;
  1385. inline explicit basic_set(__isl_take isl_basic_set *ptr);
  1386. public:
  1387. inline /* implicit */ basic_set();
  1388. inline /* implicit */ basic_set(const basic_set &obj);
  1389. inline /* implicit */ basic_set(isl::point pnt);
  1390. inline explicit basic_set(isl::ctx ctx, const std::string &str);
  1391. inline basic_set &operator=(basic_set obj);
  1392. inline ~basic_set();
  1393. inline __isl_give isl_basic_set *copy() const &;
  1394. inline __isl_give isl_basic_set *copy() && = delete;
  1395. inline __isl_keep isl_basic_set *get() const;
  1396. inline __isl_give isl_basic_set *release();
  1397. inline bool is_null() const;
  1398. inline isl::ctx ctx() const;
  1399. inline isl::basic_set affine_hull() const;
  1400. inline isl::basic_set apply(isl::basic_map bmap) const;
  1401. inline isl::set apply(const isl::map &map) const;
  1402. inline isl::union_set apply(const isl::union_map &umap) const;
  1403. inline isl::pw_multi_aff as_pw_multi_aff() const;
  1404. inline isl::set as_set() const;
  1405. inline isl::set bind(const isl::multi_id &tuple) const;
  1406. inline isl::set coalesce() const;
  1407. inline isl::set complement() const;
  1408. inline isl::union_set compute_divs() const;
  1409. inline isl::basic_set detect_equalities() const;
  1410. inline isl::val dim_max_val(int pos) const;
  1411. inline isl::val dim_min_val(int pos) const;
  1412. inline bool every_set(const std::function<bool(isl::set)> &test) const;
  1413. inline isl::set extract_set(const isl::space &space) const;
  1414. inline isl::basic_set flatten() const;
  1415. inline void foreach_basic_set(const std::function<void(isl::basic_set)> &fn) const;
  1416. inline void foreach_point(const std::function<void(isl::point)> &fn) const;
  1417. inline void foreach_set(const std::function<void(isl::set)> &fn) const;
  1418. inline isl::basic_set gist(isl::basic_set context) const;
  1419. inline isl::set gist(const isl::set &context) const;
  1420. inline isl::union_set gist(const isl::union_set &context) const;
  1421. inline isl::basic_set gist(const isl::point &context) const;
  1422. inline isl::set gist_params(const isl::set &context) const;
  1423. inline isl::map identity() const;
  1424. inline isl::pw_aff indicator_function() const;
  1425. inline isl::map insert_domain(const isl::space &domain) const;
  1426. inline isl::basic_set intersect(isl::basic_set bset2) const;
  1427. inline isl::set intersect(const isl::set &set2) const;
  1428. inline isl::union_set intersect(const isl::union_set &uset2) const;
  1429. inline isl::basic_set intersect(const isl::point &bset2) const;
  1430. inline isl::basic_set intersect_params(isl::basic_set bset2) const;
  1431. inline isl::set intersect_params(const isl::set &params) const;
  1432. inline isl::basic_set intersect_params(const isl::point &bset2) const;
  1433. inline bool involves_locals() const;
  1434. inline bool is_disjoint(const isl::set &set2) const;
  1435. inline bool is_disjoint(const isl::union_set &uset2) const;
  1436. inline bool is_empty() const;
  1437. inline bool is_equal(const isl::basic_set &bset2) const;
  1438. inline bool is_equal(const isl::set &set2) const;
  1439. inline bool is_equal(const isl::union_set &uset2) const;
  1440. inline bool is_equal(const isl::point &bset2) const;
  1441. inline bool is_singleton() const;
  1442. inline bool is_strict_subset(const isl::set &set2) const;
  1443. inline bool is_strict_subset(const isl::union_set &uset2) const;
  1444. inline bool is_subset(const isl::basic_set &bset2) const;
  1445. inline bool is_subset(const isl::set &set2) const;
  1446. inline bool is_subset(const isl::union_set &uset2) const;
  1447. inline bool is_subset(const isl::point &bset2) const;
  1448. inline bool is_wrapping() const;
  1449. inline bool isa_set() const;
  1450. inline isl::fixed_box lattice_tile() const;
  1451. inline isl::set lexmax() const;
  1452. inline isl::pw_multi_aff lexmax_pw_multi_aff() const;
  1453. inline isl::set lexmin() const;
  1454. inline isl::pw_multi_aff lexmin_pw_multi_aff() const;
  1455. inline isl::set lower_bound(const isl::multi_pw_aff &lower) const;
  1456. inline isl::set lower_bound(const isl::multi_val &lower) const;
  1457. inline isl::multi_pw_aff max_multi_pw_aff() const;
  1458. inline isl::val max_val(const isl::aff &obj) const;
  1459. inline isl::multi_pw_aff min_multi_pw_aff() const;
  1460. inline isl::val min_val(const isl::aff &obj) const;
  1461. inline unsigned n_basic_set() const;
  1462. inline isl::pw_aff param_pw_aff_on_domain(const isl::id &id) const;
  1463. inline isl::pw_aff param_pw_aff_on_domain(const std::string &id) const;
  1464. inline isl::basic_set params() const;
  1465. inline isl::multi_val plain_multi_val_if_fixed() const;
  1466. inline isl::basic_set polyhedral_hull() const;
  1467. inline isl::set preimage(const isl::multi_aff &ma) const;
  1468. inline isl::set preimage(const isl::multi_pw_aff &mpa) const;
  1469. inline isl::set preimage(const isl::pw_multi_aff &pma) const;
  1470. inline isl::union_set preimage(const isl::union_pw_multi_aff &upma) const;
  1471. inline isl::set product(const isl::set &set2) const;
  1472. inline isl::set project_out_all_params() const;
  1473. inline isl::set project_out_param(const isl::id &id) const;
  1474. inline isl::set project_out_param(const std::string &id) const;
  1475. inline isl::set project_out_param(const isl::id_list &list) const;
  1476. inline isl::pw_aff pw_aff_on_domain(const isl::val &v) const;
  1477. inline isl::pw_aff pw_aff_on_domain(long v) const;
  1478. inline isl::pw_multi_aff pw_multi_aff_on_domain(const isl::multi_val &mv) const;
  1479. inline isl::basic_set sample() const;
  1480. inline isl::point sample_point() const;
  1481. inline isl::set_list set_list() const;
  1482. inline isl::fixed_box simple_fixed_box_hull() const;
  1483. inline isl::space space() const;
  1484. inline isl::val stride(int pos) const;
  1485. inline isl::set subtract(const isl::set &set2) const;
  1486. inline isl::union_set subtract(const isl::union_set &uset2) const;
  1487. inline isl::set_list to_list() const;
  1488. inline isl::set to_set() const;
  1489. inline isl::union_set to_union_set() const;
  1490. inline isl::map translation() const;
  1491. inline unsigned tuple_dim() const;
  1492. inline isl::set unbind_params(const isl::multi_id &tuple) const;
  1493. inline isl::map unbind_params_insert_domain(const isl::multi_id &domain) const;
  1494. inline isl::set unite(isl::basic_set bset2) const;
  1495. inline isl::set unite(const isl::set &set2) const;
  1496. inline isl::union_set unite(const isl::union_set &uset2) const;
  1497. inline isl::set unite(const isl::point &bset2) const;
  1498. inline isl::basic_set unshifted_simple_hull() const;
  1499. inline isl::map unwrap() const;
  1500. inline isl::set upper_bound(const isl::multi_pw_aff &upper) const;
  1501. inline isl::set upper_bound(const isl::multi_val &upper) const;
  1502. };
  1503. // declarations for isl::fixed_box
  1504. inline fixed_box manage(__isl_take isl_fixed_box *ptr);
  1505. inline fixed_box manage_copy(__isl_keep isl_fixed_box *ptr);
  1506. class fixed_box {
  1507. friend inline fixed_box manage(__isl_take isl_fixed_box *ptr);
  1508. friend inline fixed_box manage_copy(__isl_keep isl_fixed_box *ptr);
  1509. protected:
  1510. isl_fixed_box *ptr = nullptr;
  1511. inline explicit fixed_box(__isl_take isl_fixed_box *ptr);
  1512. public:
  1513. inline /* implicit */ fixed_box();
  1514. inline /* implicit */ fixed_box(const fixed_box &obj);
  1515. inline fixed_box &operator=(fixed_box obj);
  1516. inline ~fixed_box();
  1517. inline __isl_give isl_fixed_box *copy() const &;
  1518. inline __isl_give isl_fixed_box *copy() && = delete;
  1519. inline __isl_keep isl_fixed_box *get() const;
  1520. inline __isl_give isl_fixed_box *release();
  1521. inline bool is_null() const;
  1522. inline isl::ctx ctx() const;
  1523. inline bool is_valid() const;
  1524. inline isl::multi_aff offset() const;
  1525. inline isl::multi_aff get_offset() const;
  1526. inline isl::multi_val size() const;
  1527. inline isl::multi_val get_size() const;
  1528. inline isl::space space() const;
  1529. inline isl::space get_space() const;
  1530. };
  1531. // declarations for isl::id
  1532. inline id manage(__isl_take isl_id *ptr);
  1533. inline id manage_copy(__isl_keep isl_id *ptr);
  1534. class id {
  1535. friend inline id manage(__isl_take isl_id *ptr);
  1536. friend inline id manage_copy(__isl_keep isl_id *ptr);
  1537. protected:
  1538. isl_id *ptr = nullptr;
  1539. inline explicit id(__isl_take isl_id *ptr);
  1540. public:
  1541. inline /* implicit */ id();
  1542. inline /* implicit */ id(const id &obj);
  1543. inline explicit id(isl::ctx ctx, const std::string &str);
  1544. inline id &operator=(id obj);
  1545. inline ~id();
  1546. inline __isl_give isl_id *copy() const &;
  1547. inline __isl_give isl_id *copy() && = delete;
  1548. inline __isl_keep isl_id *get() const;
  1549. inline __isl_give isl_id *release();
  1550. inline bool is_null() const;
  1551. inline isl::ctx ctx() const;
  1552. inline std::string name() const;
  1553. inline std::string get_name() const;
  1554. inline isl::id_list to_list() const;
  1555. #if __cplusplus >= 201703L
  1556. inline explicit id(isl::ctx ctx, const std::string &str, const std::any &any);
  1557. template <class T>
  1558. std::optional<T> try_user() const;
  1559. template <class T>
  1560. T user() const;
  1561. #endif
  1562. };
  1563. // declarations for isl::id_list
  1564. inline id_list manage(__isl_take isl_id_list *ptr);
  1565. inline id_list manage_copy(__isl_keep isl_id_list *ptr);
  1566. class id_list {
  1567. friend inline id_list manage(__isl_take isl_id_list *ptr);
  1568. friend inline id_list manage_copy(__isl_keep isl_id_list *ptr);
  1569. protected:
  1570. isl_id_list *ptr = nullptr;
  1571. inline explicit id_list(__isl_take isl_id_list *ptr);
  1572. public:
  1573. inline /* implicit */ id_list();
  1574. inline /* implicit */ id_list(const id_list &obj);
  1575. inline explicit id_list(isl::ctx ctx, int n);
  1576. inline explicit id_list(isl::id el);
  1577. inline explicit id_list(isl::ctx ctx, const std::string &str);
  1578. inline id_list &operator=(id_list obj);
  1579. inline ~id_list();
  1580. inline __isl_give isl_id_list *copy() const &;
  1581. inline __isl_give isl_id_list *copy() && = delete;
  1582. inline __isl_keep isl_id_list *get() const;
  1583. inline __isl_give isl_id_list *release();
  1584. inline bool is_null() const;
  1585. inline isl::ctx ctx() const;
  1586. inline isl::id_list add(isl::id el) const;
  1587. inline isl::id_list add(const std::string &el) const;
  1588. inline isl::id at(int index) const;
  1589. inline isl::id get_at(int index) const;
  1590. inline isl::id_list clear() const;
  1591. inline isl::id_list concat(isl::id_list list2) const;
  1592. inline isl::id_list drop(unsigned int first, unsigned int n) const;
  1593. inline void foreach(const std::function<void(isl::id)> &fn) const;
  1594. inline void foreach_scc(const std::function<bool(isl::id, isl::id)> &follows, const std::function<void(isl::id_list)> &fn) const;
  1595. inline isl::id_list insert(unsigned int pos, isl::id el) const;
  1596. inline isl::id_list insert(unsigned int pos, const std::string &el) const;
  1597. inline unsigned size() const;
  1598. };
  1599. // declarations for isl::map
  1600. inline map manage(__isl_take isl_map *ptr);
  1601. inline map manage_copy(__isl_keep isl_map *ptr);
  1602. class map {
  1603. friend inline map manage(__isl_take isl_map *ptr);
  1604. friend inline map manage_copy(__isl_keep isl_map *ptr);
  1605. protected:
  1606. isl_map *ptr = nullptr;
  1607. inline explicit map(__isl_take isl_map *ptr);
  1608. public:
  1609. inline /* implicit */ map();
  1610. inline /* implicit */ map(const map &obj);
  1611. inline /* implicit */ map(isl::basic_map bmap);
  1612. inline explicit map(isl::ctx ctx, const std::string &str);
  1613. inline map &operator=(map obj);
  1614. inline ~map();
  1615. inline __isl_give isl_map *copy() const &;
  1616. inline __isl_give isl_map *copy() && = delete;
  1617. inline __isl_keep isl_map *get() const;
  1618. inline __isl_give isl_map *release();
  1619. inline bool is_null() const;
  1620. inline isl::ctx ctx() const;
  1621. inline isl::basic_map affine_hull() const;
  1622. inline isl::map apply_domain(isl::map map2) const;
  1623. inline isl::union_map apply_domain(const isl::union_map &umap2) const;
  1624. inline isl::map apply_domain(const isl::basic_map &map2) const;
  1625. inline isl::map apply_range(isl::map map2) const;
  1626. inline isl::union_map apply_range(const isl::union_map &umap2) const;
  1627. inline isl::map apply_range(const isl::basic_map &map2) const;
  1628. inline isl::map as_map() const;
  1629. inline isl::multi_union_pw_aff as_multi_union_pw_aff() const;
  1630. inline isl::pw_multi_aff as_pw_multi_aff() const;
  1631. inline isl::union_pw_multi_aff as_union_pw_multi_aff() const;
  1632. inline isl::set bind_domain(isl::multi_id tuple) const;
  1633. inline isl::set bind_range(isl::multi_id tuple) const;
  1634. inline isl::map coalesce() const;
  1635. inline isl::map complement() const;
  1636. inline isl::union_map compute_divs() const;
  1637. inline isl::map curry() const;
  1638. inline isl::set deltas() const;
  1639. inline isl::map detect_equalities() const;
  1640. inline isl::set domain() const;
  1641. inline isl::map domain_factor_domain() const;
  1642. inline isl::map domain_factor_range() const;
  1643. inline isl::union_map domain_map() const;
  1644. inline isl::union_pw_multi_aff domain_map_union_pw_multi_aff() const;
  1645. inline isl::map domain_product(isl::map map2) const;
  1646. inline isl::union_map domain_product(const isl::union_map &umap2) const;
  1647. inline isl::map domain_product(const isl::basic_map &map2) const;
  1648. inline unsigned domain_tuple_dim() const;
  1649. inline isl::id domain_tuple_id() const;
  1650. inline isl::id get_domain_tuple_id() const;
  1651. static inline isl::map empty(isl::space space);
  1652. inline isl::map eq_at(isl::multi_pw_aff mpa) const;
  1653. inline isl::union_map eq_at(const isl::multi_union_pw_aff &mupa) const;
  1654. inline isl::map eq_at(const isl::aff &mpa) const;
  1655. inline isl::map eq_at(const isl::multi_aff &mpa) const;
  1656. inline isl::map eq_at(const isl::pw_aff &mpa) const;
  1657. inline isl::map eq_at(const isl::pw_multi_aff &mpa) const;
  1658. inline bool every_map(const std::function<bool(isl::map)> &test) const;
  1659. inline isl::map extract_map(const isl::space &space) const;
  1660. inline isl::map factor_domain() const;
  1661. inline isl::map factor_range() const;
  1662. inline isl::union_map fixed_power(const isl::val &exp) const;
  1663. inline isl::union_map fixed_power(long exp) const;
  1664. inline isl::map flatten() const;
  1665. inline isl::map flatten_domain() const;
  1666. inline isl::map flatten_range() const;
  1667. inline void foreach_basic_map(const std::function<void(isl::basic_map)> &fn) const;
  1668. inline void foreach_map(const std::function<void(isl::map)> &fn) const;
  1669. inline isl::map gist(isl::map context) const;
  1670. inline isl::union_map gist(const isl::union_map &context) const;
  1671. inline isl::map gist(const isl::basic_map &context) const;
  1672. inline isl::map gist_domain(isl::set context) const;
  1673. inline isl::union_map gist_domain(const isl::union_set &uset) const;
  1674. inline isl::map gist_domain(const isl::basic_set &context) const;
  1675. inline isl::map gist_domain(const isl::point &context) const;
  1676. inline isl::map gist_params(isl::set context) const;
  1677. inline isl::union_map gist_range(const isl::union_set &uset) const;
  1678. inline bool has_domain_tuple_id() const;
  1679. inline bool has_range_tuple_id() const;
  1680. inline isl::map intersect(isl::map map2) const;
  1681. inline isl::union_map intersect(const isl::union_map &umap2) const;
  1682. inline isl::map intersect(const isl::basic_map &map2) const;
  1683. inline isl::map intersect_domain(isl::set set) const;
  1684. inline isl::union_map intersect_domain(const isl::space &space) const;
  1685. inline isl::union_map intersect_domain(const isl::union_set &uset) const;
  1686. inline isl::map intersect_domain(const isl::basic_set &set) const;
  1687. inline isl::map intersect_domain(const isl::point &set) const;
  1688. inline isl::map intersect_domain_factor_domain(isl::map factor) const;
  1689. inline isl::union_map intersect_domain_factor_domain(const isl::union_map &factor) const;
  1690. inline isl::map intersect_domain_factor_domain(const isl::basic_map &factor) const;
  1691. inline isl::map intersect_domain_factor_range(isl::map factor) const;
  1692. inline isl::union_map intersect_domain_factor_range(const isl::union_map &factor) const;
  1693. inline isl::map intersect_domain_factor_range(const isl::basic_map &factor) const;
  1694. inline isl::map intersect_domain_wrapped_domain(isl::set domain) const;
  1695. inline isl::union_map intersect_domain_wrapped_domain(const isl::union_set &domain) const;
  1696. inline isl::map intersect_domain_wrapped_domain(const isl::basic_set &domain) const;
  1697. inline isl::map intersect_domain_wrapped_domain(const isl::point &domain) const;
  1698. inline isl::map intersect_params(isl::set params) const;
  1699. inline isl::map intersect_range(isl::set set) const;
  1700. inline isl::union_map intersect_range(const isl::space &space) const;
  1701. inline isl::union_map intersect_range(const isl::union_set &uset) const;
  1702. inline isl::map intersect_range(const isl::basic_set &set) const;
  1703. inline isl::map intersect_range(const isl::point &set) const;
  1704. inline isl::map intersect_range_factor_domain(isl::map factor) const;
  1705. inline isl::union_map intersect_range_factor_domain(const isl::union_map &factor) const;
  1706. inline isl::map intersect_range_factor_domain(const isl::basic_map &factor) const;
  1707. inline isl::map intersect_range_factor_range(isl::map factor) const;
  1708. inline isl::union_map intersect_range_factor_range(const isl::union_map &factor) const;
  1709. inline isl::map intersect_range_factor_range(const isl::basic_map &factor) const;
  1710. inline isl::map intersect_range_wrapped_domain(isl::set domain) const;
  1711. inline isl::union_map intersect_range_wrapped_domain(const isl::union_set &domain) const;
  1712. inline isl::map intersect_range_wrapped_domain(const isl::basic_set &domain) const;
  1713. inline isl::map intersect_range_wrapped_domain(const isl::point &domain) const;
  1714. inline bool is_bijective() const;
  1715. inline bool is_disjoint(const isl::map &map2) const;
  1716. inline bool is_disjoint(const isl::union_map &umap2) const;
  1717. inline bool is_disjoint(const isl::basic_map &map2) const;
  1718. inline bool is_empty() const;
  1719. inline bool is_equal(const isl::map &map2) const;
  1720. inline bool is_equal(const isl::union_map &umap2) const;
  1721. inline bool is_equal(const isl::basic_map &map2) const;
  1722. inline bool is_injective() const;
  1723. inline bool is_single_valued() const;
  1724. inline bool is_strict_subset(const isl::map &map2) const;
  1725. inline bool is_strict_subset(const isl::union_map &umap2) const;
  1726. inline bool is_strict_subset(const isl::basic_map &map2) const;
  1727. inline bool is_subset(const isl::map &map2) const;
  1728. inline bool is_subset(const isl::union_map &umap2) const;
  1729. inline bool is_subset(const isl::basic_map &map2) const;
  1730. inline bool isa_map() const;
  1731. inline isl::map lex_ge_at(isl::multi_pw_aff mpa) const;
  1732. inline isl::map lex_gt_at(isl::multi_pw_aff mpa) const;
  1733. inline isl::map lex_le_at(isl::multi_pw_aff mpa) const;
  1734. inline isl::map lex_lt_at(isl::multi_pw_aff mpa) const;
  1735. inline isl::map lexmax() const;
  1736. inline isl::pw_multi_aff lexmax_pw_multi_aff() const;
  1737. inline isl::map lexmin() const;
  1738. inline isl::pw_multi_aff lexmin_pw_multi_aff() const;
  1739. inline isl::map lower_bound(isl::multi_pw_aff lower) const;
  1740. inline isl::map_list map_list() const;
  1741. inline isl::multi_pw_aff max_multi_pw_aff() const;
  1742. inline isl::multi_pw_aff min_multi_pw_aff() const;
  1743. inline unsigned n_basic_map() const;
  1744. inline isl::basic_map polyhedral_hull() const;
  1745. inline isl::map preimage_domain(isl::multi_aff ma) const;
  1746. inline isl::map preimage_domain(isl::multi_pw_aff mpa) const;
  1747. inline isl::map preimage_domain(isl::pw_multi_aff pma) const;
  1748. inline isl::union_map preimage_domain(const isl::union_pw_multi_aff &upma) const;
  1749. inline isl::map preimage_range(isl::multi_aff ma) const;
  1750. inline isl::map preimage_range(isl::pw_multi_aff pma) const;
  1751. inline isl::union_map preimage_range(const isl::union_pw_multi_aff &upma) const;
  1752. inline isl::map product(isl::map map2) const;
  1753. inline isl::union_map product(const isl::union_map &umap2) const;
  1754. inline isl::map product(const isl::basic_map &map2) const;
  1755. inline isl::map project_out_all_params() const;
  1756. inline isl::set range() const;
  1757. inline isl::map range_factor_domain() const;
  1758. inline isl::map range_factor_range() const;
  1759. inline isl::fixed_box range_lattice_tile() const;
  1760. inline isl::fixed_box get_range_lattice_tile() const;
  1761. inline isl::union_map range_map() const;
  1762. inline isl::map range_product(isl::map map2) const;
  1763. inline isl::union_map range_product(const isl::union_map &umap2) const;
  1764. inline isl::map range_product(const isl::basic_map &map2) const;
  1765. inline isl::map range_reverse() const;
  1766. inline isl::fixed_box range_simple_fixed_box_hull() const;
  1767. inline isl::fixed_box get_range_simple_fixed_box_hull() const;
  1768. inline unsigned range_tuple_dim() const;
  1769. inline isl::id range_tuple_id() const;
  1770. inline isl::id get_range_tuple_id() const;
  1771. inline isl::map reverse() const;
  1772. inline isl::basic_map sample() const;
  1773. inline isl::map set_domain_tuple(isl::id id) const;
  1774. inline isl::map set_domain_tuple(const std::string &id) const;
  1775. inline isl::map set_range_tuple(isl::id id) const;
  1776. inline isl::map set_range_tuple(const std::string &id) const;
  1777. inline isl::space space() const;
  1778. inline isl::space get_space() const;
  1779. inline isl::map subtract(isl::map map2) const;
  1780. inline isl::union_map subtract(const isl::union_map &umap2) const;
  1781. inline isl::map subtract(const isl::basic_map &map2) const;
  1782. inline isl::union_map subtract_domain(const isl::union_set &dom) const;
  1783. inline isl::union_map subtract_range(const isl::union_set &dom) const;
  1784. inline isl::map_list to_list() const;
  1785. inline isl::union_map to_union_map() const;
  1786. inline isl::map uncurry() const;
  1787. inline isl::map unite(isl::map map2) const;
  1788. inline isl::union_map unite(const isl::union_map &umap2) const;
  1789. inline isl::map unite(const isl::basic_map &map2) const;
  1790. static inline isl::map universe(isl::space space);
  1791. inline isl::basic_map unshifted_simple_hull() const;
  1792. inline isl::map upper_bound(isl::multi_pw_aff upper) const;
  1793. inline isl::set wrap() const;
  1794. inline isl::map zip() const;
  1795. };
  1796. // declarations for isl::map_list
  1797. inline map_list manage(__isl_take isl_map_list *ptr);
  1798. inline map_list manage_copy(__isl_keep isl_map_list *ptr);
  1799. class map_list {
  1800. friend inline map_list manage(__isl_take isl_map_list *ptr);
  1801. friend inline map_list manage_copy(__isl_keep isl_map_list *ptr);
  1802. protected:
  1803. isl_map_list *ptr = nullptr;
  1804. inline explicit map_list(__isl_take isl_map_list *ptr);
  1805. public:
  1806. inline /* implicit */ map_list();
  1807. inline /* implicit */ map_list(const map_list &obj);
  1808. inline explicit map_list(isl::ctx ctx, int n);
  1809. inline explicit map_list(isl::map el);
  1810. inline explicit map_list(isl::ctx ctx, const std::string &str);
  1811. inline map_list &operator=(map_list obj);
  1812. inline ~map_list();
  1813. inline __isl_give isl_map_list *copy() const &;
  1814. inline __isl_give isl_map_list *copy() && = delete;
  1815. inline __isl_keep isl_map_list *get() const;
  1816. inline __isl_give isl_map_list *release();
  1817. inline bool is_null() const;
  1818. inline isl::ctx ctx() const;
  1819. inline isl::map_list add(isl::map el) const;
  1820. inline isl::map at(int index) const;
  1821. inline isl::map get_at(int index) const;
  1822. inline isl::map_list clear() const;
  1823. inline isl::map_list concat(isl::map_list list2) const;
  1824. inline isl::map_list drop(unsigned int first, unsigned int n) const;
  1825. inline void foreach(const std::function<void(isl::map)> &fn) const;
  1826. inline void foreach_scc(const std::function<bool(isl::map, isl::map)> &follows, const std::function<void(isl::map_list)> &fn) const;
  1827. inline isl::map_list insert(unsigned int pos, isl::map el) const;
  1828. inline unsigned size() const;
  1829. };
  1830. // declarations for isl::multi_aff
  1831. inline multi_aff manage(__isl_take isl_multi_aff *ptr);
  1832. inline multi_aff manage_copy(__isl_keep isl_multi_aff *ptr);
  1833. class multi_aff {
  1834. friend inline multi_aff manage(__isl_take isl_multi_aff *ptr);
  1835. friend inline multi_aff manage_copy(__isl_keep isl_multi_aff *ptr);
  1836. protected:
  1837. isl_multi_aff *ptr = nullptr;
  1838. inline explicit multi_aff(__isl_take isl_multi_aff *ptr);
  1839. public:
  1840. inline /* implicit */ multi_aff();
  1841. inline /* implicit */ multi_aff(const multi_aff &obj);
  1842. inline /* implicit */ multi_aff(isl::aff aff);
  1843. inline explicit multi_aff(isl::space space, isl::aff_list list);
  1844. inline explicit multi_aff(isl::ctx ctx, const std::string &str);
  1845. inline multi_aff &operator=(multi_aff obj);
  1846. inline ~multi_aff();
  1847. inline __isl_give isl_multi_aff *copy() const &;
  1848. inline __isl_give isl_multi_aff *copy() && = delete;
  1849. inline __isl_keep isl_multi_aff *get() const;
  1850. inline __isl_give isl_multi_aff *release();
  1851. inline bool is_null() const;
  1852. inline isl::ctx ctx() const;
  1853. inline isl::multi_aff add(isl::multi_aff multi2) const;
  1854. inline isl::multi_pw_aff add(const isl::multi_pw_aff &multi2) const;
  1855. inline isl::multi_union_pw_aff add(const isl::multi_union_pw_aff &multi2) const;
  1856. inline isl::pw_multi_aff add(const isl::pw_multi_aff &pma2) const;
  1857. inline isl::union_pw_multi_aff add(const isl::union_pw_multi_aff &upma2) const;
  1858. inline isl::multi_aff add(const isl::aff &multi2) const;
  1859. inline isl::multi_aff add_constant(isl::multi_val mv) const;
  1860. inline isl::multi_aff add_constant(isl::val v) const;
  1861. inline isl::multi_aff add_constant(long v) const;
  1862. inline isl::union_pw_multi_aff apply(const isl::union_pw_multi_aff &upma2) const;
  1863. inline isl::map as_map() const;
  1864. inline isl::multi_aff as_multi_aff() const;
  1865. inline isl::multi_union_pw_aff as_multi_union_pw_aff() const;
  1866. inline isl::pw_multi_aff as_pw_multi_aff() const;
  1867. inline isl::set as_set() const;
  1868. inline isl::union_map as_union_map() const;
  1869. inline isl::aff at(int pos) const;
  1870. inline isl::aff get_at(int pos) const;
  1871. inline isl::basic_set bind(isl::multi_id tuple) const;
  1872. inline isl::multi_aff bind_domain(isl::multi_id tuple) const;
  1873. inline isl::multi_aff bind_domain_wrapped_domain(isl::multi_id tuple) const;
  1874. inline isl::pw_multi_aff coalesce() const;
  1875. inline isl::multi_val constant_multi_val() const;
  1876. inline isl::multi_val get_constant_multi_val() const;
  1877. inline isl::set domain() const;
  1878. static inline isl::multi_aff domain_map(isl::space space);
  1879. inline isl::pw_multi_aff extract_pw_multi_aff(const isl::space &space) const;
  1880. inline isl::multi_aff flat_range_product(isl::multi_aff multi2) const;
  1881. inline isl::multi_pw_aff flat_range_product(const isl::multi_pw_aff &multi2) const;
  1882. inline isl::multi_union_pw_aff flat_range_product(const isl::multi_union_pw_aff &multi2) const;
  1883. inline isl::pw_multi_aff flat_range_product(const isl::pw_multi_aff &pma2) const;
  1884. inline isl::union_pw_multi_aff flat_range_product(const isl::union_pw_multi_aff &upma2) const;
  1885. inline isl::multi_aff flat_range_product(const isl::aff &multi2) const;
  1886. inline isl::multi_aff floor() const;
  1887. inline void foreach_piece(const std::function<void(isl::set, isl::multi_aff)> &fn) const;
  1888. inline isl::multi_aff gist(isl::set context) const;
  1889. inline isl::union_pw_multi_aff gist(const isl::union_set &context) const;
  1890. inline isl::multi_aff gist(const isl::basic_set &context) const;
  1891. inline isl::multi_aff gist(const isl::point &context) const;
  1892. inline isl::multi_aff gist_params(isl::set context) const;
  1893. inline bool has_range_tuple_id() const;
  1894. inline isl::multi_aff identity() const;
  1895. static inline isl::multi_aff identity_on_domain(isl::space space);
  1896. inline isl::multi_aff insert_domain(isl::space domain) const;
  1897. inline isl::pw_multi_aff intersect_domain(const isl::set &set) const;
  1898. inline isl::union_pw_multi_aff intersect_domain(const isl::space &space) const;
  1899. inline isl::union_pw_multi_aff intersect_domain(const isl::union_set &uset) const;
  1900. inline isl::union_pw_multi_aff intersect_domain_wrapped_domain(const isl::union_set &uset) const;
  1901. inline isl::union_pw_multi_aff intersect_domain_wrapped_range(const isl::union_set &uset) const;
  1902. inline isl::pw_multi_aff intersect_params(const isl::set &set) const;
  1903. inline bool involves_locals() const;
  1904. inline bool involves_nan() const;
  1905. inline bool involves_param(const isl::id &id) const;
  1906. inline bool involves_param(const std::string &id) const;
  1907. inline bool involves_param(const isl::id_list &list) const;
  1908. inline bool isa_multi_aff() const;
  1909. inline bool isa_pw_multi_aff() const;
  1910. inline isl::aff_list list() const;
  1911. inline isl::aff_list get_list() const;
  1912. inline isl::multi_pw_aff max(const isl::multi_pw_aff &multi2) const;
  1913. inline isl::multi_val max_multi_val() const;
  1914. inline isl::multi_pw_aff min(const isl::multi_pw_aff &multi2) const;
  1915. inline isl::multi_val min_multi_val() const;
  1916. static inline isl::multi_aff multi_val_on_domain(isl::space space, isl::multi_val mv);
  1917. inline unsigned n_piece() const;
  1918. inline isl::multi_aff neg() const;
  1919. inline bool plain_is_empty() const;
  1920. inline bool plain_is_equal(const isl::multi_aff &multi2) const;
  1921. inline bool plain_is_equal(const isl::multi_pw_aff &multi2) const;
  1922. inline bool plain_is_equal(const isl::multi_union_pw_aff &multi2) const;
  1923. inline bool plain_is_equal(const isl::aff &multi2) const;
  1924. inline isl::pw_multi_aff preimage_domain_wrapped_domain(const isl::pw_multi_aff &pma2) const;
  1925. inline isl::union_pw_multi_aff preimage_domain_wrapped_domain(const isl::union_pw_multi_aff &upma2) const;
  1926. inline isl::multi_aff product(isl::multi_aff multi2) const;
  1927. inline isl::multi_pw_aff product(const isl::multi_pw_aff &multi2) const;
  1928. inline isl::pw_multi_aff product(const isl::pw_multi_aff &pma2) const;
  1929. inline isl::multi_aff product(const isl::aff &multi2) const;
  1930. inline isl::multi_aff pullback(isl::multi_aff ma2) const;
  1931. inline isl::multi_pw_aff pullback(const isl::multi_pw_aff &mpa2) const;
  1932. inline isl::pw_multi_aff pullback(const isl::pw_multi_aff &pma2) const;
  1933. inline isl::union_pw_multi_aff pullback(const isl::union_pw_multi_aff &upma2) const;
  1934. inline isl::multi_aff pullback(const isl::aff &ma2) const;
  1935. inline isl::pw_multi_aff_list pw_multi_aff_list() const;
  1936. inline isl::pw_multi_aff range_factor_domain() const;
  1937. inline isl::pw_multi_aff range_factor_range() const;
  1938. static inline isl::multi_aff range_map(isl::space space);
  1939. inline isl::multi_aff range_product(isl::multi_aff multi2) const;
  1940. inline isl::multi_pw_aff range_product(const isl::multi_pw_aff &multi2) const;
  1941. inline isl::multi_union_pw_aff range_product(const isl::multi_union_pw_aff &multi2) const;
  1942. inline isl::pw_multi_aff range_product(const isl::pw_multi_aff &pma2) const;
  1943. inline isl::union_pw_multi_aff range_product(const isl::union_pw_multi_aff &upma2) const;
  1944. inline isl::multi_aff range_product(const isl::aff &multi2) const;
  1945. inline isl::id range_tuple_id() const;
  1946. inline isl::id get_range_tuple_id() const;
  1947. inline isl::multi_aff reset_range_tuple_id() const;
  1948. inline isl::multi_aff scale(isl::multi_val mv) const;
  1949. inline isl::multi_aff scale(isl::val v) const;
  1950. inline isl::multi_aff scale(long v) const;
  1951. inline isl::multi_aff scale_down(isl::multi_val mv) const;
  1952. inline isl::multi_aff scale_down(isl::val v) const;
  1953. inline isl::multi_aff scale_down(long v) const;
  1954. inline isl::multi_aff set_at(int pos, isl::aff el) const;
  1955. inline isl::multi_pw_aff set_at(int pos, const isl::pw_aff &el) const;
  1956. inline isl::multi_union_pw_aff set_at(int pos, const isl::union_pw_aff &el) const;
  1957. inline isl::multi_aff set_range_tuple(isl::id id) const;
  1958. inline isl::multi_aff set_range_tuple(const std::string &id) const;
  1959. inline unsigned size() const;
  1960. inline isl::space space() const;
  1961. inline isl::space get_space() const;
  1962. inline isl::multi_aff sub(isl::multi_aff multi2) const;
  1963. inline isl::multi_pw_aff sub(const isl::multi_pw_aff &multi2) const;
  1964. inline isl::multi_union_pw_aff sub(const isl::multi_union_pw_aff &multi2) const;
  1965. inline isl::pw_multi_aff sub(const isl::pw_multi_aff &pma2) const;
  1966. inline isl::union_pw_multi_aff sub(const isl::union_pw_multi_aff &upma2) const;
  1967. inline isl::multi_aff sub(const isl::aff &multi2) const;
  1968. inline isl::pw_multi_aff subtract_domain(const isl::set &set) const;
  1969. inline isl::union_pw_multi_aff subtract_domain(const isl::space &space) const;
  1970. inline isl::union_pw_multi_aff subtract_domain(const isl::union_set &uset) const;
  1971. inline isl::pw_multi_aff_list to_list() const;
  1972. inline isl::multi_pw_aff to_multi_pw_aff() const;
  1973. inline isl::multi_union_pw_aff to_multi_union_pw_aff() const;
  1974. inline isl::pw_multi_aff to_pw_multi_aff() const;
  1975. inline isl::union_pw_multi_aff to_union_pw_multi_aff() const;
  1976. inline isl::multi_aff unbind_params_insert_domain(isl::multi_id domain) const;
  1977. inline isl::multi_pw_aff union_add(const isl::multi_pw_aff &mpa2) const;
  1978. inline isl::multi_union_pw_aff union_add(const isl::multi_union_pw_aff &mupa2) const;
  1979. inline isl::pw_multi_aff union_add(const isl::pw_multi_aff &pma2) const;
  1980. inline isl::union_pw_multi_aff union_add(const isl::union_pw_multi_aff &upma2) const;
  1981. static inline isl::multi_aff zero(isl::space space);
  1982. };
  1983. // declarations for isl::multi_id
  1984. inline multi_id manage(__isl_take isl_multi_id *ptr);
  1985. inline multi_id manage_copy(__isl_keep isl_multi_id *ptr);
  1986. class multi_id {
  1987. friend inline multi_id manage(__isl_take isl_multi_id *ptr);
  1988. friend inline multi_id manage_copy(__isl_keep isl_multi_id *ptr);
  1989. protected:
  1990. isl_multi_id *ptr = nullptr;
  1991. inline explicit multi_id(__isl_take isl_multi_id *ptr);
  1992. public:
  1993. inline /* implicit */ multi_id();
  1994. inline /* implicit */ multi_id(const multi_id &obj);
  1995. inline explicit multi_id(isl::space space, isl::id_list list);
  1996. inline explicit multi_id(isl::ctx ctx, const std::string &str);
  1997. inline multi_id &operator=(multi_id obj);
  1998. inline ~multi_id();
  1999. inline __isl_give isl_multi_id *copy() const &;
  2000. inline __isl_give isl_multi_id *copy() && = delete;
  2001. inline __isl_keep isl_multi_id *get() const;
  2002. inline __isl_give isl_multi_id *release();
  2003. inline bool is_null() const;
  2004. inline isl::ctx ctx() const;
  2005. inline isl::id at(int pos) const;
  2006. inline isl::id get_at(int pos) const;
  2007. inline isl::multi_id flat_range_product(isl::multi_id multi2) const;
  2008. inline isl::id_list list() const;
  2009. inline isl::id_list get_list() const;
  2010. inline bool plain_is_equal(const isl::multi_id &multi2) const;
  2011. inline isl::multi_id range_product(isl::multi_id multi2) const;
  2012. inline isl::multi_id set_at(int pos, isl::id el) const;
  2013. inline isl::multi_id set_at(int pos, const std::string &el) const;
  2014. inline unsigned size() const;
  2015. inline isl::space space() const;
  2016. inline isl::space get_space() const;
  2017. };
  2018. // declarations for isl::multi_pw_aff
  2019. inline multi_pw_aff manage(__isl_take isl_multi_pw_aff *ptr);
  2020. inline multi_pw_aff manage_copy(__isl_keep isl_multi_pw_aff *ptr);
  2021. class multi_pw_aff {
  2022. friend inline multi_pw_aff manage(__isl_take isl_multi_pw_aff *ptr);
  2023. friend inline multi_pw_aff manage_copy(__isl_keep isl_multi_pw_aff *ptr);
  2024. protected:
  2025. isl_multi_pw_aff *ptr = nullptr;
  2026. inline explicit multi_pw_aff(__isl_take isl_multi_pw_aff *ptr);
  2027. public:
  2028. inline /* implicit */ multi_pw_aff();
  2029. inline /* implicit */ multi_pw_aff(const multi_pw_aff &obj);
  2030. inline /* implicit */ multi_pw_aff(isl::aff aff);
  2031. inline /* implicit */ multi_pw_aff(isl::multi_aff ma);
  2032. inline /* implicit */ multi_pw_aff(isl::pw_aff pa);
  2033. inline explicit multi_pw_aff(isl::space space, isl::pw_aff_list list);
  2034. inline /* implicit */ multi_pw_aff(isl::pw_multi_aff pma);
  2035. inline explicit multi_pw_aff(isl::ctx ctx, const std::string &str);
  2036. inline multi_pw_aff &operator=(multi_pw_aff obj);
  2037. inline ~multi_pw_aff();
  2038. inline __isl_give isl_multi_pw_aff *copy() const &;
  2039. inline __isl_give isl_multi_pw_aff *copy() && = delete;
  2040. inline __isl_keep isl_multi_pw_aff *get() const;
  2041. inline __isl_give isl_multi_pw_aff *release();
  2042. inline bool is_null() const;
  2043. inline isl::ctx ctx() const;
  2044. inline isl::multi_pw_aff add(isl::multi_pw_aff multi2) const;
  2045. inline isl::multi_union_pw_aff add(const isl::multi_union_pw_aff &multi2) const;
  2046. inline isl::multi_pw_aff add(const isl::aff &multi2) const;
  2047. inline isl::multi_pw_aff add(const isl::multi_aff &multi2) const;
  2048. inline isl::multi_pw_aff add(const isl::pw_aff &multi2) const;
  2049. inline isl::multi_pw_aff add(const isl::pw_multi_aff &multi2) const;
  2050. inline isl::multi_pw_aff add_constant(isl::multi_val mv) const;
  2051. inline isl::multi_pw_aff add_constant(isl::val v) const;
  2052. inline isl::multi_pw_aff add_constant(long v) const;
  2053. inline isl::map as_map() const;
  2054. inline isl::multi_aff as_multi_aff() const;
  2055. inline isl::set as_set() const;
  2056. inline isl::pw_aff at(int pos) const;
  2057. inline isl::pw_aff get_at(int pos) const;
  2058. inline isl::set bind(isl::multi_id tuple) const;
  2059. inline isl::multi_pw_aff bind_domain(isl::multi_id tuple) const;
  2060. inline isl::multi_pw_aff bind_domain_wrapped_domain(isl::multi_id tuple) const;
  2061. inline isl::multi_pw_aff coalesce() const;
  2062. inline isl::set domain() const;
  2063. inline isl::multi_pw_aff flat_range_product(isl::multi_pw_aff multi2) const;
  2064. inline isl::multi_union_pw_aff flat_range_product(const isl::multi_union_pw_aff &multi2) const;
  2065. inline isl::multi_pw_aff flat_range_product(const isl::aff &multi2) const;
  2066. inline isl::multi_pw_aff flat_range_product(const isl::multi_aff &multi2) const;
  2067. inline isl::multi_pw_aff flat_range_product(const isl::pw_aff &multi2) const;
  2068. inline isl::multi_pw_aff flat_range_product(const isl::pw_multi_aff &multi2) const;
  2069. inline isl::multi_pw_aff gist(isl::set set) const;
  2070. inline isl::multi_union_pw_aff gist(const isl::union_set &context) const;
  2071. inline isl::multi_pw_aff gist(const isl::basic_set &set) const;
  2072. inline isl::multi_pw_aff gist(const isl::point &set) const;
  2073. inline bool has_range_tuple_id() const;
  2074. inline isl::multi_pw_aff identity() const;
  2075. static inline isl::multi_pw_aff identity_on_domain(isl::space space);
  2076. inline isl::multi_pw_aff insert_domain(isl::space domain) const;
  2077. inline isl::multi_pw_aff intersect_domain(isl::set domain) const;
  2078. inline isl::multi_union_pw_aff intersect_domain(const isl::union_set &uset) const;
  2079. inline isl::multi_pw_aff intersect_domain(const isl::basic_set &domain) const;
  2080. inline isl::multi_pw_aff intersect_domain(const isl::point &domain) const;
  2081. inline isl::multi_pw_aff intersect_params(isl::set set) const;
  2082. inline bool involves_nan() const;
  2083. inline bool involves_param(const isl::id &id) const;
  2084. inline bool involves_param(const std::string &id) const;
  2085. inline bool involves_param(const isl::id_list &list) const;
  2086. inline bool isa_multi_aff() const;
  2087. inline isl::pw_aff_list list() const;
  2088. inline isl::pw_aff_list get_list() const;
  2089. inline isl::multi_pw_aff max(isl::multi_pw_aff multi2) const;
  2090. inline isl::multi_val max_multi_val() const;
  2091. inline isl::multi_pw_aff min(isl::multi_pw_aff multi2) const;
  2092. inline isl::multi_val min_multi_val() const;
  2093. inline isl::multi_pw_aff neg() const;
  2094. inline bool plain_is_equal(const isl::multi_pw_aff &multi2) const;
  2095. inline bool plain_is_equal(const isl::multi_union_pw_aff &multi2) const;
  2096. inline bool plain_is_equal(const isl::aff &multi2) const;
  2097. inline bool plain_is_equal(const isl::multi_aff &multi2) const;
  2098. inline bool plain_is_equal(const isl::pw_aff &multi2) const;
  2099. inline bool plain_is_equal(const isl::pw_multi_aff &multi2) const;
  2100. inline isl::multi_pw_aff product(isl::multi_pw_aff multi2) const;
  2101. inline isl::multi_pw_aff pullback(isl::multi_aff ma) const;
  2102. inline isl::multi_pw_aff pullback(isl::multi_pw_aff mpa2) const;
  2103. inline isl::multi_pw_aff pullback(isl::pw_multi_aff pma) const;
  2104. inline isl::multi_union_pw_aff pullback(const isl::union_pw_multi_aff &upma) const;
  2105. inline isl::multi_pw_aff range_product(isl::multi_pw_aff multi2) const;
  2106. inline isl::multi_union_pw_aff range_product(const isl::multi_union_pw_aff &multi2) const;
  2107. inline isl::multi_pw_aff range_product(const isl::aff &multi2) const;
  2108. inline isl::multi_pw_aff range_product(const isl::multi_aff &multi2) const;
  2109. inline isl::multi_pw_aff range_product(const isl::pw_aff &multi2) const;
  2110. inline isl::multi_pw_aff range_product(const isl::pw_multi_aff &multi2) const;
  2111. inline isl::id range_tuple_id() const;
  2112. inline isl::id get_range_tuple_id() const;
  2113. inline isl::multi_pw_aff reset_range_tuple_id() const;
  2114. inline isl::multi_pw_aff scale(isl::multi_val mv) const;
  2115. inline isl::multi_pw_aff scale(isl::val v) const;
  2116. inline isl::multi_pw_aff scale(long v) const;
  2117. inline isl::multi_pw_aff scale_down(isl::multi_val mv) const;
  2118. inline isl::multi_pw_aff scale_down(isl::val v) const;
  2119. inline isl::multi_pw_aff scale_down(long v) const;
  2120. inline isl::multi_pw_aff set_at(int pos, isl::pw_aff el) const;
  2121. inline isl::multi_union_pw_aff set_at(int pos, const isl::union_pw_aff &el) const;
  2122. inline isl::multi_pw_aff set_range_tuple(isl::id id) const;
  2123. inline isl::multi_pw_aff set_range_tuple(const std::string &id) const;
  2124. inline unsigned size() const;
  2125. inline isl::space space() const;
  2126. inline isl::space get_space() const;
  2127. inline isl::multi_pw_aff sub(isl::multi_pw_aff multi2) const;
  2128. inline isl::multi_union_pw_aff sub(const isl::multi_union_pw_aff &multi2) const;
  2129. inline isl::multi_pw_aff sub(const isl::aff &multi2) const;
  2130. inline isl::multi_pw_aff sub(const isl::multi_aff &multi2) const;
  2131. inline isl::multi_pw_aff sub(const isl::pw_aff &multi2) const;
  2132. inline isl::multi_pw_aff sub(const isl::pw_multi_aff &multi2) const;
  2133. inline isl::multi_pw_aff unbind_params_insert_domain(isl::multi_id domain) const;
  2134. inline isl::multi_pw_aff union_add(isl::multi_pw_aff mpa2) const;
  2135. inline isl::multi_union_pw_aff union_add(const isl::multi_union_pw_aff &mupa2) const;
  2136. inline isl::multi_pw_aff union_add(const isl::aff &mpa2) const;
  2137. inline isl::multi_pw_aff union_add(const isl::multi_aff &mpa2) const;
  2138. inline isl::multi_pw_aff union_add(const isl::pw_aff &mpa2) const;
  2139. inline isl::multi_pw_aff union_add(const isl::pw_multi_aff &mpa2) const;
  2140. static inline isl::multi_pw_aff zero(isl::space space);
  2141. };
  2142. // declarations for isl::multi_union_pw_aff
  2143. inline multi_union_pw_aff manage(__isl_take isl_multi_union_pw_aff *ptr);
  2144. inline multi_union_pw_aff manage_copy(__isl_keep isl_multi_union_pw_aff *ptr);
  2145. class multi_union_pw_aff {
  2146. friend inline multi_union_pw_aff manage(__isl_take isl_multi_union_pw_aff *ptr);
  2147. friend inline multi_union_pw_aff manage_copy(__isl_keep isl_multi_union_pw_aff *ptr);
  2148. protected:
  2149. isl_multi_union_pw_aff *ptr = nullptr;
  2150. inline explicit multi_union_pw_aff(__isl_take isl_multi_union_pw_aff *ptr);
  2151. public:
  2152. inline /* implicit */ multi_union_pw_aff();
  2153. inline /* implicit */ multi_union_pw_aff(const multi_union_pw_aff &obj);
  2154. inline /* implicit */ multi_union_pw_aff(isl::multi_pw_aff mpa);
  2155. inline /* implicit */ multi_union_pw_aff(isl::union_pw_aff upa);
  2156. inline explicit multi_union_pw_aff(isl::space space, isl::union_pw_aff_list list);
  2157. inline explicit multi_union_pw_aff(isl::ctx ctx, const std::string &str);
  2158. inline multi_union_pw_aff &operator=(multi_union_pw_aff obj);
  2159. inline ~multi_union_pw_aff();
  2160. inline __isl_give isl_multi_union_pw_aff *copy() const &;
  2161. inline __isl_give isl_multi_union_pw_aff *copy() && = delete;
  2162. inline __isl_keep isl_multi_union_pw_aff *get() const;
  2163. inline __isl_give isl_multi_union_pw_aff *release();
  2164. inline bool is_null() const;
  2165. inline isl::ctx ctx() const;
  2166. inline isl::multi_union_pw_aff add(isl::multi_union_pw_aff multi2) const;
  2167. inline isl::union_pw_aff at(int pos) const;
  2168. inline isl::union_pw_aff get_at(int pos) const;
  2169. inline isl::union_set bind(isl::multi_id tuple) const;
  2170. inline isl::multi_union_pw_aff coalesce() const;
  2171. inline isl::union_set domain() const;
  2172. inline isl::multi_union_pw_aff flat_range_product(isl::multi_union_pw_aff multi2) const;
  2173. inline isl::multi_union_pw_aff gist(isl::union_set context) const;
  2174. inline bool has_range_tuple_id() const;
  2175. inline isl::multi_union_pw_aff intersect_domain(isl::union_set uset) const;
  2176. inline isl::multi_union_pw_aff intersect_params(isl::set params) const;
  2177. inline bool involves_nan() const;
  2178. inline isl::union_pw_aff_list list() const;
  2179. inline isl::union_pw_aff_list get_list() const;
  2180. inline isl::multi_union_pw_aff neg() const;
  2181. inline bool plain_is_equal(const isl::multi_union_pw_aff &multi2) const;
  2182. inline isl::multi_union_pw_aff pullback(isl::union_pw_multi_aff upma) const;
  2183. inline isl::multi_union_pw_aff range_product(isl::multi_union_pw_aff multi2) const;
  2184. inline isl::id range_tuple_id() const;
  2185. inline isl::id get_range_tuple_id() const;
  2186. inline isl::multi_union_pw_aff reset_range_tuple_id() const;
  2187. inline isl::multi_union_pw_aff scale(isl::multi_val mv) const;
  2188. inline isl::multi_union_pw_aff scale(isl::val v) const;
  2189. inline isl::multi_union_pw_aff scale(long v) const;
  2190. inline isl::multi_union_pw_aff scale_down(isl::multi_val mv) const;
  2191. inline isl::multi_union_pw_aff scale_down(isl::val v) const;
  2192. inline isl::multi_union_pw_aff scale_down(long v) const;
  2193. inline isl::multi_union_pw_aff set_at(int pos, isl::union_pw_aff el) const;
  2194. inline isl::multi_union_pw_aff set_range_tuple(isl::id id) const;
  2195. inline isl::multi_union_pw_aff set_range_tuple(const std::string &id) const;
  2196. inline unsigned size() const;
  2197. inline isl::space space() const;
  2198. inline isl::space get_space() const;
  2199. inline isl::multi_union_pw_aff sub(isl::multi_union_pw_aff multi2) const;
  2200. inline isl::multi_union_pw_aff union_add(isl::multi_union_pw_aff mupa2) const;
  2201. static inline isl::multi_union_pw_aff zero(isl::space space);
  2202. };
  2203. // declarations for isl::multi_val
  2204. inline multi_val manage(__isl_take isl_multi_val *ptr);
  2205. inline multi_val manage_copy(__isl_keep isl_multi_val *ptr);
  2206. class multi_val {
  2207. friend inline multi_val manage(__isl_take isl_multi_val *ptr);
  2208. friend inline multi_val manage_copy(__isl_keep isl_multi_val *ptr);
  2209. protected:
  2210. isl_multi_val *ptr = nullptr;
  2211. inline explicit multi_val(__isl_take isl_multi_val *ptr);
  2212. public:
  2213. inline /* implicit */ multi_val();
  2214. inline /* implicit */ multi_val(const multi_val &obj);
  2215. inline explicit multi_val(isl::space space, isl::val_list list);
  2216. inline explicit multi_val(isl::ctx ctx, const std::string &str);
  2217. inline multi_val &operator=(multi_val obj);
  2218. inline ~multi_val();
  2219. inline __isl_give isl_multi_val *copy() const &;
  2220. inline __isl_give isl_multi_val *copy() && = delete;
  2221. inline __isl_keep isl_multi_val *get() const;
  2222. inline __isl_give isl_multi_val *release();
  2223. inline bool is_null() const;
  2224. inline isl::ctx ctx() const;
  2225. inline isl::multi_val add(isl::multi_val multi2) const;
  2226. inline isl::multi_val add(isl::val v) const;
  2227. inline isl::multi_val add(long v) const;
  2228. inline isl::val at(int pos) const;
  2229. inline isl::val get_at(int pos) const;
  2230. inline isl::multi_val flat_range_product(isl::multi_val multi2) const;
  2231. inline bool has_range_tuple_id() const;
  2232. inline bool involves_nan() const;
  2233. inline isl::val_list list() const;
  2234. inline isl::val_list get_list() const;
  2235. inline isl::multi_val max(isl::multi_val multi2) const;
  2236. inline isl::multi_val min(isl::multi_val multi2) const;
  2237. inline isl::multi_val neg() const;
  2238. inline bool plain_is_equal(const isl::multi_val &multi2) const;
  2239. inline isl::multi_val product(isl::multi_val multi2) const;
  2240. inline isl::multi_val range_product(isl::multi_val multi2) const;
  2241. inline isl::id range_tuple_id() const;
  2242. inline isl::id get_range_tuple_id() const;
  2243. inline isl::multi_val reset_range_tuple_id() const;
  2244. inline isl::multi_val scale(isl::multi_val mv) const;
  2245. inline isl::multi_val scale(isl::val v) const;
  2246. inline isl::multi_val scale(long v) const;
  2247. inline isl::multi_val scale_down(isl::multi_val mv) const;
  2248. inline isl::multi_val scale_down(isl::val v) const;
  2249. inline isl::multi_val scale_down(long v) const;
  2250. inline isl::multi_val set_at(int pos, isl::val el) const;
  2251. inline isl::multi_val set_at(int pos, long el) const;
  2252. inline isl::multi_val set_range_tuple(isl::id id) const;
  2253. inline isl::multi_val set_range_tuple(const std::string &id) const;
  2254. inline unsigned size() const;
  2255. inline isl::space space() const;
  2256. inline isl::space get_space() const;
  2257. inline isl::multi_val sub(isl::multi_val multi2) const;
  2258. static inline isl::multi_val zero(isl::space space);
  2259. };
  2260. // declarations for isl::point
  2261. inline point manage(__isl_take isl_point *ptr);
  2262. inline point manage_copy(__isl_keep isl_point *ptr);
  2263. class point {
  2264. friend inline point manage(__isl_take isl_point *ptr);
  2265. friend inline point manage_copy(__isl_keep isl_point *ptr);
  2266. protected:
  2267. isl_point *ptr = nullptr;
  2268. inline explicit point(__isl_take isl_point *ptr);
  2269. public:
  2270. inline /* implicit */ point();
  2271. inline /* implicit */ point(const point &obj);
  2272. inline point &operator=(point obj);
  2273. inline ~point();
  2274. inline __isl_give isl_point *copy() const &;
  2275. inline __isl_give isl_point *copy() && = delete;
  2276. inline __isl_keep isl_point *get() const;
  2277. inline __isl_give isl_point *release();
  2278. inline bool is_null() const;
  2279. inline isl::ctx ctx() const;
  2280. inline isl::basic_set affine_hull() const;
  2281. inline isl::basic_set apply(const isl::basic_map &bmap) const;
  2282. inline isl::set apply(const isl::map &map) const;
  2283. inline isl::union_set apply(const isl::union_map &umap) const;
  2284. inline isl::pw_multi_aff as_pw_multi_aff() const;
  2285. inline isl::set as_set() const;
  2286. inline isl::set bind(const isl::multi_id &tuple) const;
  2287. inline isl::set coalesce() const;
  2288. inline isl::set complement() const;
  2289. inline isl::union_set compute_divs() const;
  2290. inline isl::basic_set detect_equalities() const;
  2291. inline isl::val dim_max_val(int pos) const;
  2292. inline isl::val dim_min_val(int pos) const;
  2293. inline bool every_set(const std::function<bool(isl::set)> &test) const;
  2294. inline isl::set extract_set(const isl::space &space) const;
  2295. inline isl::basic_set flatten() const;
  2296. inline void foreach_basic_set(const std::function<void(isl::basic_set)> &fn) const;
  2297. inline void foreach_point(const std::function<void(isl::point)> &fn) const;
  2298. inline void foreach_set(const std::function<void(isl::set)> &fn) const;
  2299. inline isl::basic_set gist(const isl::basic_set &context) const;
  2300. inline isl::set gist(const isl::set &context) const;
  2301. inline isl::union_set gist(const isl::union_set &context) const;
  2302. inline isl::set gist_params(const isl::set &context) const;
  2303. inline isl::map identity() const;
  2304. inline isl::pw_aff indicator_function() const;
  2305. inline isl::map insert_domain(const isl::space &domain) const;
  2306. inline isl::basic_set intersect(const isl::basic_set &bset2) const;
  2307. inline isl::set intersect(const isl::set &set2) const;
  2308. inline isl::union_set intersect(const isl::union_set &uset2) const;
  2309. inline isl::basic_set intersect_params(const isl::basic_set &bset2) const;
  2310. inline isl::set intersect_params(const isl::set &params) const;
  2311. inline bool involves_locals() const;
  2312. inline bool is_disjoint(const isl::set &set2) const;
  2313. inline bool is_disjoint(const isl::union_set &uset2) const;
  2314. inline bool is_empty() const;
  2315. inline bool is_equal(const isl::basic_set &bset2) const;
  2316. inline bool is_equal(const isl::set &set2) const;
  2317. inline bool is_equal(const isl::union_set &uset2) const;
  2318. inline bool is_singleton() const;
  2319. inline bool is_strict_subset(const isl::set &set2) const;
  2320. inline bool is_strict_subset(const isl::union_set &uset2) const;
  2321. inline bool is_subset(const isl::basic_set &bset2) const;
  2322. inline bool is_subset(const isl::set &set2) const;
  2323. inline bool is_subset(const isl::union_set &uset2) const;
  2324. inline bool is_wrapping() const;
  2325. inline bool isa_set() const;
  2326. inline isl::fixed_box lattice_tile() const;
  2327. inline isl::set lexmax() const;
  2328. inline isl::pw_multi_aff lexmax_pw_multi_aff() const;
  2329. inline isl::set lexmin() const;
  2330. inline isl::pw_multi_aff lexmin_pw_multi_aff() const;
  2331. inline isl::set lower_bound(const isl::multi_pw_aff &lower) const;
  2332. inline isl::set lower_bound(const isl::multi_val &lower) const;
  2333. inline isl::multi_pw_aff max_multi_pw_aff() const;
  2334. inline isl::val max_val(const isl::aff &obj) const;
  2335. inline isl::multi_pw_aff min_multi_pw_aff() const;
  2336. inline isl::val min_val(const isl::aff &obj) const;
  2337. inline isl::multi_val multi_val() const;
  2338. inline isl::multi_val get_multi_val() const;
  2339. inline unsigned n_basic_set() const;
  2340. inline isl::pw_aff param_pw_aff_on_domain(const isl::id &id) const;
  2341. inline isl::pw_aff param_pw_aff_on_domain(const std::string &id) const;
  2342. inline isl::basic_set params() const;
  2343. inline isl::multi_val plain_multi_val_if_fixed() const;
  2344. inline isl::basic_set polyhedral_hull() const;
  2345. inline isl::set preimage(const isl::multi_aff &ma) const;
  2346. inline isl::set preimage(const isl::multi_pw_aff &mpa) const;
  2347. inline isl::set preimage(const isl::pw_multi_aff &pma) const;
  2348. inline isl::union_set preimage(const isl::union_pw_multi_aff &upma) const;
  2349. inline isl::set product(const isl::set &set2) const;
  2350. inline isl::set project_out_all_params() const;
  2351. inline isl::set project_out_param(const isl::id &id) const;
  2352. inline isl::set project_out_param(const std::string &id) const;
  2353. inline isl::set project_out_param(const isl::id_list &list) const;
  2354. inline isl::pw_aff pw_aff_on_domain(const isl::val &v) const;
  2355. inline isl::pw_aff pw_aff_on_domain(long v) const;
  2356. inline isl::pw_multi_aff pw_multi_aff_on_domain(const isl::multi_val &mv) const;
  2357. inline isl::basic_set sample() const;
  2358. inline isl::point sample_point() const;
  2359. inline isl::set_list set_list() const;
  2360. inline isl::fixed_box simple_fixed_box_hull() const;
  2361. inline isl::space space() const;
  2362. inline isl::val stride(int pos) const;
  2363. inline isl::set subtract(const isl::set &set2) const;
  2364. inline isl::union_set subtract(const isl::union_set &uset2) const;
  2365. inline isl::set_list to_list() const;
  2366. inline isl::set to_set() const;
  2367. inline isl::union_set to_union_set() const;
  2368. inline isl::map translation() const;
  2369. inline unsigned tuple_dim() const;
  2370. inline isl::set unbind_params(const isl::multi_id &tuple) const;
  2371. inline isl::map unbind_params_insert_domain(const isl::multi_id &domain) const;
  2372. inline isl::set unite(const isl::basic_set &bset2) const;
  2373. inline isl::set unite(const isl::set &set2) const;
  2374. inline isl::union_set unite(const isl::union_set &uset2) const;
  2375. inline isl::basic_set unshifted_simple_hull() const;
  2376. inline isl::map unwrap() const;
  2377. inline isl::set upper_bound(const isl::multi_pw_aff &upper) const;
  2378. inline isl::set upper_bound(const isl::multi_val &upper) const;
  2379. };
  2380. // declarations for isl::pw_aff
  2381. inline pw_aff manage(__isl_take isl_pw_aff *ptr);
  2382. inline pw_aff manage_copy(__isl_keep isl_pw_aff *ptr);
  2383. class pw_aff {
  2384. friend inline pw_aff manage(__isl_take isl_pw_aff *ptr);
  2385. friend inline pw_aff manage_copy(__isl_keep isl_pw_aff *ptr);
  2386. protected:
  2387. isl_pw_aff *ptr = nullptr;
  2388. inline explicit pw_aff(__isl_take isl_pw_aff *ptr);
  2389. public:
  2390. inline /* implicit */ pw_aff();
  2391. inline /* implicit */ pw_aff(const pw_aff &obj);
  2392. inline /* implicit */ pw_aff(isl::aff aff);
  2393. inline explicit pw_aff(isl::ctx ctx, const std::string &str);
  2394. inline pw_aff &operator=(pw_aff obj);
  2395. inline ~pw_aff();
  2396. inline __isl_give isl_pw_aff *copy() const &;
  2397. inline __isl_give isl_pw_aff *copy() && = delete;
  2398. inline __isl_keep isl_pw_aff *get() const;
  2399. inline __isl_give isl_pw_aff *release();
  2400. inline bool is_null() const;
  2401. inline isl::ctx ctx() const;
  2402. inline isl::multi_pw_aff add(const isl::multi_pw_aff &multi2) const;
  2403. inline isl::multi_union_pw_aff add(const isl::multi_union_pw_aff &multi2) const;
  2404. inline isl::pw_aff add(isl::pw_aff pwaff2) const;
  2405. inline isl::pw_multi_aff add(const isl::pw_multi_aff &pma2) const;
  2406. inline isl::union_pw_aff add(const isl::union_pw_aff &upa2) const;
  2407. inline isl::union_pw_multi_aff add(const isl::union_pw_multi_aff &upma2) const;
  2408. inline isl::pw_aff add(const isl::aff &pwaff2) const;
  2409. inline isl::pw_aff add_constant(isl::val v) const;
  2410. inline isl::pw_aff add_constant(long v) const;
  2411. inline isl::pw_multi_aff add_constant(const isl::multi_val &mv) const;
  2412. inline isl::union_pw_multi_aff apply(const isl::union_pw_multi_aff &upma2) const;
  2413. inline isl::aff as_aff() const;
  2414. inline isl::map as_map() const;
  2415. inline isl::multi_aff as_multi_aff() const;
  2416. inline isl::multi_union_pw_aff as_multi_union_pw_aff() const;
  2417. inline isl::pw_multi_aff as_pw_multi_aff() const;
  2418. inline isl::set as_set() const;
  2419. inline isl::union_map as_union_map() const;
  2420. inline isl::pw_aff at(int pos) const;
  2421. inline isl::set bind(const isl::multi_id &tuple) const;
  2422. inline isl::set bind(isl::id id) const;
  2423. inline isl::set bind(const std::string &id) const;
  2424. inline isl::pw_aff bind_domain(isl::multi_id tuple) const;
  2425. inline isl::pw_aff bind_domain_wrapped_domain(isl::multi_id tuple) const;
  2426. inline isl::pw_aff ceil() const;
  2427. inline isl::pw_aff coalesce() const;
  2428. inline isl::pw_aff cond(isl::pw_aff pwaff_true, isl::pw_aff pwaff_false) const;
  2429. inline isl::pw_aff div(isl::pw_aff pa2) const;
  2430. inline isl::set domain() const;
  2431. inline isl::set eq_set(isl::pw_aff pwaff2) const;
  2432. inline isl::val eval(isl::point pnt) const;
  2433. inline isl::pw_multi_aff extract_pw_multi_aff(const isl::space &space) const;
  2434. inline isl::multi_pw_aff flat_range_product(const isl::multi_pw_aff &multi2) const;
  2435. inline isl::multi_union_pw_aff flat_range_product(const isl::multi_union_pw_aff &multi2) const;
  2436. inline isl::pw_multi_aff flat_range_product(const isl::pw_multi_aff &pma2) const;
  2437. inline isl::union_pw_multi_aff flat_range_product(const isl::union_pw_multi_aff &upma2) const;
  2438. inline isl::pw_aff floor() const;
  2439. inline void foreach_piece(const std::function<void(isl::set, isl::multi_aff)> &fn) const;
  2440. inline isl::set ge_set(isl::pw_aff pwaff2) const;
  2441. inline isl::pw_aff gist(isl::set context) const;
  2442. inline isl::union_pw_aff gist(const isl::union_set &context) const;
  2443. inline isl::pw_aff gist(const isl::basic_set &context) const;
  2444. inline isl::pw_aff gist(const isl::point &context) const;
  2445. inline isl::pw_aff gist_params(isl::set context) const;
  2446. inline isl::set gt_set(isl::pw_aff pwaff2) const;
  2447. inline bool has_range_tuple_id() const;
  2448. inline isl::multi_pw_aff identity() const;
  2449. inline isl::pw_aff insert_domain(isl::space domain) const;
  2450. inline isl::pw_aff intersect_domain(isl::set set) const;
  2451. inline isl::union_pw_aff intersect_domain(const isl::space &space) const;
  2452. inline isl::union_pw_aff intersect_domain(const isl::union_set &uset) const;
  2453. inline isl::pw_aff intersect_domain(const isl::basic_set &set) const;
  2454. inline isl::pw_aff intersect_domain(const isl::point &set) const;
  2455. inline isl::union_pw_aff intersect_domain_wrapped_domain(const isl::union_set &uset) const;
  2456. inline isl::union_pw_aff intersect_domain_wrapped_range(const isl::union_set &uset) const;
  2457. inline isl::pw_aff intersect_params(isl::set set) const;
  2458. inline bool involves_locals() const;
  2459. inline bool involves_nan() const;
  2460. inline bool involves_param(const isl::id &id) const;
  2461. inline bool involves_param(const std::string &id) const;
  2462. inline bool involves_param(const isl::id_list &list) const;
  2463. inline bool isa_aff() const;
  2464. inline bool isa_multi_aff() const;
  2465. inline bool isa_pw_multi_aff() const;
  2466. inline isl::set le_set(isl::pw_aff pwaff2) const;
  2467. inline isl::pw_aff_list list() const;
  2468. inline isl::set lt_set(isl::pw_aff pwaff2) const;
  2469. inline isl::multi_pw_aff max(const isl::multi_pw_aff &multi2) const;
  2470. inline isl::pw_aff max(isl::pw_aff pwaff2) const;
  2471. inline isl::pw_aff max(const isl::aff &pwaff2) const;
  2472. inline isl::multi_val max_multi_val() const;
  2473. inline isl::val max_val() const;
  2474. inline isl::multi_pw_aff min(const isl::multi_pw_aff &multi2) const;
  2475. inline isl::pw_aff min(isl::pw_aff pwaff2) const;
  2476. inline isl::pw_aff min(const isl::aff &pwaff2) const;
  2477. inline isl::multi_val min_multi_val() const;
  2478. inline isl::val min_val() const;
  2479. inline isl::pw_aff mod(isl::val mod) const;
  2480. inline isl::pw_aff mod(long mod) const;
  2481. inline isl::pw_aff mul(isl::pw_aff pwaff2) const;
  2482. inline unsigned n_piece() const;
  2483. inline isl::set ne_set(isl::pw_aff pwaff2) const;
  2484. inline isl::pw_aff neg() const;
  2485. static inline isl::pw_aff param_on_domain(isl::set domain, isl::id id);
  2486. inline bool plain_is_empty() const;
  2487. inline bool plain_is_equal(const isl::multi_pw_aff &multi2) const;
  2488. inline bool plain_is_equal(const isl::multi_union_pw_aff &multi2) const;
  2489. inline isl::pw_multi_aff preimage_domain_wrapped_domain(const isl::pw_multi_aff &pma2) const;
  2490. inline isl::union_pw_multi_aff preimage_domain_wrapped_domain(const isl::union_pw_multi_aff &upma2) const;
  2491. inline isl::multi_pw_aff product(const isl::multi_pw_aff &multi2) const;
  2492. inline isl::pw_multi_aff product(const isl::pw_multi_aff &pma2) const;
  2493. inline isl::pw_aff pullback(isl::multi_aff ma) const;
  2494. inline isl::pw_aff pullback(isl::multi_pw_aff mpa) const;
  2495. inline isl::pw_aff pullback(isl::pw_multi_aff pma) const;
  2496. inline isl::union_pw_aff pullback(const isl::union_pw_multi_aff &upma) const;
  2497. inline isl::pw_multi_aff_list pw_multi_aff_list() const;
  2498. inline isl::pw_multi_aff range_factor_domain() const;
  2499. inline isl::pw_multi_aff range_factor_range() const;
  2500. inline isl::multi_pw_aff range_product(const isl::multi_pw_aff &multi2) const;
  2501. inline isl::multi_union_pw_aff range_product(const isl::multi_union_pw_aff &multi2) const;
  2502. inline isl::pw_multi_aff range_product(const isl::pw_multi_aff &pma2) const;
  2503. inline isl::union_pw_multi_aff range_product(const isl::union_pw_multi_aff &upma2) const;
  2504. inline isl::id range_tuple_id() const;
  2505. inline isl::multi_pw_aff reset_range_tuple_id() const;
  2506. inline isl::pw_aff scale(isl::val v) const;
  2507. inline isl::pw_aff scale(long v) const;
  2508. inline isl::pw_multi_aff scale(const isl::multi_val &mv) const;
  2509. inline isl::pw_aff scale_down(isl::val f) const;
  2510. inline isl::pw_aff scale_down(long f) const;
  2511. inline isl::pw_multi_aff scale_down(const isl::multi_val &mv) const;
  2512. inline isl::multi_pw_aff set_at(int pos, const isl::pw_aff &el) const;
  2513. inline isl::multi_union_pw_aff set_at(int pos, const isl::union_pw_aff &el) const;
  2514. inline isl::pw_multi_aff set_range_tuple(const isl::id &id) const;
  2515. inline isl::pw_multi_aff set_range_tuple(const std::string &id) const;
  2516. inline unsigned size() const;
  2517. inline isl::space space() const;
  2518. inline isl::space get_space() const;
  2519. inline isl::multi_pw_aff sub(const isl::multi_pw_aff &multi2) const;
  2520. inline isl::multi_union_pw_aff sub(const isl::multi_union_pw_aff &multi2) const;
  2521. inline isl::pw_aff sub(isl::pw_aff pwaff2) const;
  2522. inline isl::pw_multi_aff sub(const isl::pw_multi_aff &pma2) const;
  2523. inline isl::union_pw_aff sub(const isl::union_pw_aff &upa2) const;
  2524. inline isl::union_pw_multi_aff sub(const isl::union_pw_multi_aff &upma2) const;
  2525. inline isl::pw_aff sub(const isl::aff &pwaff2) const;
  2526. inline isl::pw_aff subtract_domain(isl::set set) const;
  2527. inline isl::union_pw_aff subtract_domain(const isl::space &space) const;
  2528. inline isl::union_pw_aff subtract_domain(const isl::union_set &uset) const;
  2529. inline isl::pw_aff subtract_domain(const isl::basic_set &set) const;
  2530. inline isl::pw_aff subtract_domain(const isl::point &set) const;
  2531. inline isl::pw_aff tdiv_q(isl::pw_aff pa2) const;
  2532. inline isl::pw_aff tdiv_r(isl::pw_aff pa2) const;
  2533. inline isl::pw_aff_list to_list() const;
  2534. inline isl::multi_pw_aff to_multi_pw_aff() const;
  2535. inline isl::union_pw_aff to_union_pw_aff() const;
  2536. inline isl::union_pw_multi_aff to_union_pw_multi_aff() const;
  2537. inline isl::multi_pw_aff unbind_params_insert_domain(const isl::multi_id &domain) const;
  2538. inline isl::multi_pw_aff union_add(const isl::multi_pw_aff &mpa2) const;
  2539. inline isl::multi_union_pw_aff union_add(const isl::multi_union_pw_aff &mupa2) const;
  2540. inline isl::pw_aff union_add(isl::pw_aff pwaff2) const;
  2541. inline isl::pw_multi_aff union_add(const isl::pw_multi_aff &pma2) const;
  2542. inline isl::union_pw_aff union_add(const isl::union_pw_aff &upa2) const;
  2543. inline isl::union_pw_multi_aff union_add(const isl::union_pw_multi_aff &upma2) const;
  2544. inline isl::pw_aff union_add(const isl::aff &pwaff2) const;
  2545. };
  2546. // declarations for isl::pw_aff_list
  2547. inline pw_aff_list manage(__isl_take isl_pw_aff_list *ptr);
  2548. inline pw_aff_list manage_copy(__isl_keep isl_pw_aff_list *ptr);
  2549. class pw_aff_list {
  2550. friend inline pw_aff_list manage(__isl_take isl_pw_aff_list *ptr);
  2551. friend inline pw_aff_list manage_copy(__isl_keep isl_pw_aff_list *ptr);
  2552. protected:
  2553. isl_pw_aff_list *ptr = nullptr;
  2554. inline explicit pw_aff_list(__isl_take isl_pw_aff_list *ptr);
  2555. public:
  2556. inline /* implicit */ pw_aff_list();
  2557. inline /* implicit */ pw_aff_list(const pw_aff_list &obj);
  2558. inline explicit pw_aff_list(isl::ctx ctx, int n);
  2559. inline explicit pw_aff_list(isl::pw_aff el);
  2560. inline explicit pw_aff_list(isl::ctx ctx, const std::string &str);
  2561. inline pw_aff_list &operator=(pw_aff_list obj);
  2562. inline ~pw_aff_list();
  2563. inline __isl_give isl_pw_aff_list *copy() const &;
  2564. inline __isl_give isl_pw_aff_list *copy() && = delete;
  2565. inline __isl_keep isl_pw_aff_list *get() const;
  2566. inline __isl_give isl_pw_aff_list *release();
  2567. inline bool is_null() const;
  2568. inline isl::ctx ctx() const;
  2569. inline isl::pw_aff_list add(isl::pw_aff el) const;
  2570. inline isl::pw_aff at(int index) const;
  2571. inline isl::pw_aff get_at(int index) const;
  2572. inline isl::pw_aff_list clear() const;
  2573. inline isl::pw_aff_list concat(isl::pw_aff_list list2) const;
  2574. inline isl::pw_aff_list drop(unsigned int first, unsigned int n) const;
  2575. inline void foreach(const std::function<void(isl::pw_aff)> &fn) const;
  2576. inline void foreach_scc(const std::function<bool(isl::pw_aff, isl::pw_aff)> &follows, const std::function<void(isl::pw_aff_list)> &fn) const;
  2577. inline isl::pw_aff_list insert(unsigned int pos, isl::pw_aff el) const;
  2578. inline unsigned size() const;
  2579. };
  2580. // declarations for isl::pw_multi_aff
  2581. inline pw_multi_aff manage(__isl_take isl_pw_multi_aff *ptr);
  2582. inline pw_multi_aff manage_copy(__isl_keep isl_pw_multi_aff *ptr);
  2583. class pw_multi_aff {
  2584. friend inline pw_multi_aff manage(__isl_take isl_pw_multi_aff *ptr);
  2585. friend inline pw_multi_aff manage_copy(__isl_keep isl_pw_multi_aff *ptr);
  2586. protected:
  2587. isl_pw_multi_aff *ptr = nullptr;
  2588. inline explicit pw_multi_aff(__isl_take isl_pw_multi_aff *ptr);
  2589. public:
  2590. inline /* implicit */ pw_multi_aff();
  2591. inline /* implicit */ pw_multi_aff(const pw_multi_aff &obj);
  2592. inline /* implicit */ pw_multi_aff(isl::multi_aff ma);
  2593. inline /* implicit */ pw_multi_aff(isl::pw_aff pa);
  2594. inline explicit pw_multi_aff(isl::ctx ctx, const std::string &str);
  2595. inline pw_multi_aff &operator=(pw_multi_aff obj);
  2596. inline ~pw_multi_aff();
  2597. inline __isl_give isl_pw_multi_aff *copy() const &;
  2598. inline __isl_give isl_pw_multi_aff *copy() && = delete;
  2599. inline __isl_keep isl_pw_multi_aff *get() const;
  2600. inline __isl_give isl_pw_multi_aff *release();
  2601. inline bool is_null() const;
  2602. inline isl::ctx ctx() const;
  2603. inline isl::multi_pw_aff add(const isl::multi_pw_aff &multi2) const;
  2604. inline isl::multi_union_pw_aff add(const isl::multi_union_pw_aff &multi2) const;
  2605. inline isl::pw_multi_aff add(isl::pw_multi_aff pma2) const;
  2606. inline isl::union_pw_multi_aff add(const isl::union_pw_multi_aff &upma2) const;
  2607. inline isl::pw_multi_aff add(const isl::multi_aff &pma2) const;
  2608. inline isl::pw_multi_aff add(const isl::pw_aff &pma2) const;
  2609. inline isl::pw_multi_aff add_constant(isl::multi_val mv) const;
  2610. inline isl::pw_multi_aff add_constant(isl::val v) const;
  2611. inline isl::pw_multi_aff add_constant(long v) const;
  2612. inline isl::union_pw_multi_aff apply(const isl::union_pw_multi_aff &upma2) const;
  2613. inline isl::map as_map() const;
  2614. inline isl::multi_aff as_multi_aff() const;
  2615. inline isl::multi_union_pw_aff as_multi_union_pw_aff() const;
  2616. inline isl::pw_multi_aff as_pw_multi_aff() const;
  2617. inline isl::set as_set() const;
  2618. inline isl::union_map as_union_map() const;
  2619. inline isl::pw_aff at(int pos) const;
  2620. inline isl::pw_aff get_at(int pos) const;
  2621. inline isl::set bind(const isl::multi_id &tuple) const;
  2622. inline isl::pw_multi_aff bind_domain(isl::multi_id tuple) const;
  2623. inline isl::pw_multi_aff bind_domain_wrapped_domain(isl::multi_id tuple) const;
  2624. inline isl::pw_multi_aff coalesce() const;
  2625. inline isl::set domain() const;
  2626. static inline isl::pw_multi_aff domain_map(isl::space space);
  2627. inline isl::pw_multi_aff extract_pw_multi_aff(const isl::space &space) const;
  2628. inline isl::multi_pw_aff flat_range_product(const isl::multi_pw_aff &multi2) const;
  2629. inline isl::multi_union_pw_aff flat_range_product(const isl::multi_union_pw_aff &multi2) const;
  2630. inline isl::pw_multi_aff flat_range_product(isl::pw_multi_aff pma2) const;
  2631. inline isl::union_pw_multi_aff flat_range_product(const isl::union_pw_multi_aff &upma2) const;
  2632. inline isl::pw_multi_aff flat_range_product(const isl::multi_aff &pma2) const;
  2633. inline isl::pw_multi_aff flat_range_product(const isl::pw_aff &pma2) const;
  2634. inline void foreach_piece(const std::function<void(isl::set, isl::multi_aff)> &fn) const;
  2635. inline isl::pw_multi_aff gist(isl::set set) const;
  2636. inline isl::union_pw_multi_aff gist(const isl::union_set &context) const;
  2637. inline isl::pw_multi_aff gist(const isl::basic_set &set) const;
  2638. inline isl::pw_multi_aff gist(const isl::point &set) const;
  2639. inline isl::pw_multi_aff gist_params(isl::set set) const;
  2640. inline bool has_range_tuple_id() const;
  2641. inline isl::multi_pw_aff identity() const;
  2642. static inline isl::pw_multi_aff identity_on_domain(isl::space space);
  2643. inline isl::pw_multi_aff insert_domain(isl::space domain) const;
  2644. inline isl::pw_multi_aff intersect_domain(isl::set set) const;
  2645. inline isl::union_pw_multi_aff intersect_domain(const isl::space &space) const;
  2646. inline isl::union_pw_multi_aff intersect_domain(const isl::union_set &uset) const;
  2647. inline isl::pw_multi_aff intersect_domain(const isl::basic_set &set) const;
  2648. inline isl::pw_multi_aff intersect_domain(const isl::point &set) const;
  2649. inline isl::union_pw_multi_aff intersect_domain_wrapped_domain(const isl::union_set &uset) const;
  2650. inline isl::union_pw_multi_aff intersect_domain_wrapped_range(const isl::union_set &uset) const;
  2651. inline isl::pw_multi_aff intersect_params(isl::set set) const;
  2652. inline bool involves_locals() const;
  2653. inline bool involves_nan() const;
  2654. inline bool involves_param(const isl::id &id) const;
  2655. inline bool involves_param(const std::string &id) const;
  2656. inline bool involves_param(const isl::id_list &list) const;
  2657. inline bool isa_multi_aff() const;
  2658. inline bool isa_pw_multi_aff() const;
  2659. inline isl::pw_aff_list list() const;
  2660. inline isl::multi_pw_aff max(const isl::multi_pw_aff &multi2) const;
  2661. inline isl::multi_val max_multi_val() const;
  2662. inline isl::multi_pw_aff min(const isl::multi_pw_aff &multi2) const;
  2663. inline isl::multi_val min_multi_val() const;
  2664. static inline isl::pw_multi_aff multi_val_on_domain(isl::set domain, isl::multi_val mv);
  2665. inline unsigned n_piece() const;
  2666. inline isl::multi_pw_aff neg() const;
  2667. inline bool plain_is_empty() const;
  2668. inline bool plain_is_equal(const isl::multi_pw_aff &multi2) const;
  2669. inline bool plain_is_equal(const isl::multi_union_pw_aff &multi2) const;
  2670. inline isl::pw_multi_aff preimage_domain_wrapped_domain(isl::pw_multi_aff pma2) const;
  2671. inline isl::union_pw_multi_aff preimage_domain_wrapped_domain(const isl::union_pw_multi_aff &upma2) const;
  2672. inline isl::pw_multi_aff preimage_domain_wrapped_domain(const isl::multi_aff &pma2) const;
  2673. inline isl::pw_multi_aff preimage_domain_wrapped_domain(const isl::pw_aff &pma2) const;
  2674. inline isl::multi_pw_aff product(const isl::multi_pw_aff &multi2) const;
  2675. inline isl::pw_multi_aff product(isl::pw_multi_aff pma2) const;
  2676. inline isl::pw_multi_aff product(const isl::multi_aff &pma2) const;
  2677. inline isl::pw_multi_aff product(const isl::pw_aff &pma2) const;
  2678. inline isl::multi_pw_aff pullback(const isl::multi_pw_aff &mpa2) const;
  2679. inline isl::pw_multi_aff pullback(isl::multi_aff ma) const;
  2680. inline isl::pw_multi_aff pullback(isl::pw_multi_aff pma2) const;
  2681. inline isl::union_pw_multi_aff pullback(const isl::union_pw_multi_aff &upma2) const;
  2682. inline isl::pw_multi_aff_list pw_multi_aff_list() const;
  2683. inline isl::pw_multi_aff range_factor_domain() const;
  2684. inline isl::pw_multi_aff range_factor_range() const;
  2685. static inline isl::pw_multi_aff range_map(isl::space space);
  2686. inline isl::multi_pw_aff range_product(const isl::multi_pw_aff &multi2) const;
  2687. inline isl::multi_union_pw_aff range_product(const isl::multi_union_pw_aff &multi2) const;
  2688. inline isl::pw_multi_aff range_product(isl::pw_multi_aff pma2) const;
  2689. inline isl::union_pw_multi_aff range_product(const isl::union_pw_multi_aff &upma2) const;
  2690. inline isl::pw_multi_aff range_product(const isl::multi_aff &pma2) const;
  2691. inline isl::pw_multi_aff range_product(const isl::pw_aff &pma2) const;
  2692. inline isl::id range_tuple_id() const;
  2693. inline isl::id get_range_tuple_id() const;
  2694. inline isl::multi_pw_aff reset_range_tuple_id() const;
  2695. inline isl::pw_multi_aff scale(isl::multi_val mv) const;
  2696. inline isl::pw_multi_aff scale(isl::val v) const;
  2697. inline isl::pw_multi_aff scale(long v) const;
  2698. inline isl::pw_multi_aff scale_down(isl::multi_val mv) const;
  2699. inline isl::pw_multi_aff scale_down(isl::val v) const;
  2700. inline isl::pw_multi_aff scale_down(long v) const;
  2701. inline isl::multi_pw_aff set_at(int pos, const isl::pw_aff &el) const;
  2702. inline isl::multi_union_pw_aff set_at(int pos, const isl::union_pw_aff &el) const;
  2703. inline isl::pw_multi_aff set_range_tuple(isl::id id) const;
  2704. inline isl::pw_multi_aff set_range_tuple(const std::string &id) const;
  2705. inline unsigned size() const;
  2706. inline isl::space space() const;
  2707. inline isl::space get_space() const;
  2708. inline isl::multi_pw_aff sub(const isl::multi_pw_aff &multi2) const;
  2709. inline isl::multi_union_pw_aff sub(const isl::multi_union_pw_aff &multi2) const;
  2710. inline isl::pw_multi_aff sub(isl::pw_multi_aff pma2) const;
  2711. inline isl::union_pw_multi_aff sub(const isl::union_pw_multi_aff &upma2) const;
  2712. inline isl::pw_multi_aff sub(const isl::multi_aff &pma2) const;
  2713. inline isl::pw_multi_aff sub(const isl::pw_aff &pma2) const;
  2714. inline isl::pw_multi_aff subtract_domain(isl::set set) const;
  2715. inline isl::union_pw_multi_aff subtract_domain(const isl::space &space) const;
  2716. inline isl::union_pw_multi_aff subtract_domain(const isl::union_set &uset) const;
  2717. inline isl::pw_multi_aff subtract_domain(const isl::basic_set &set) const;
  2718. inline isl::pw_multi_aff subtract_domain(const isl::point &set) const;
  2719. inline isl::pw_multi_aff_list to_list() const;
  2720. inline isl::multi_pw_aff to_multi_pw_aff() const;
  2721. inline isl::union_pw_multi_aff to_union_pw_multi_aff() const;
  2722. inline isl::multi_pw_aff unbind_params_insert_domain(const isl::multi_id &domain) const;
  2723. inline isl::multi_pw_aff union_add(const isl::multi_pw_aff &mpa2) const;
  2724. inline isl::multi_union_pw_aff union_add(const isl::multi_union_pw_aff &mupa2) const;
  2725. inline isl::pw_multi_aff union_add(isl::pw_multi_aff pma2) const;
  2726. inline isl::union_pw_multi_aff union_add(const isl::union_pw_multi_aff &upma2) const;
  2727. inline isl::pw_multi_aff union_add(const isl::multi_aff &pma2) const;
  2728. inline isl::pw_multi_aff union_add(const isl::pw_aff &pma2) const;
  2729. static inline isl::pw_multi_aff zero(isl::space space);
  2730. };
  2731. // declarations for isl::pw_multi_aff_list
  2732. inline pw_multi_aff_list manage(__isl_take isl_pw_multi_aff_list *ptr);
  2733. inline pw_multi_aff_list manage_copy(__isl_keep isl_pw_multi_aff_list *ptr);
  2734. class pw_multi_aff_list {
  2735. friend inline pw_multi_aff_list manage(__isl_take isl_pw_multi_aff_list *ptr);
  2736. friend inline pw_multi_aff_list manage_copy(__isl_keep isl_pw_multi_aff_list *ptr);
  2737. protected:
  2738. isl_pw_multi_aff_list *ptr = nullptr;
  2739. inline explicit pw_multi_aff_list(__isl_take isl_pw_multi_aff_list *ptr);
  2740. public:
  2741. inline /* implicit */ pw_multi_aff_list();
  2742. inline /* implicit */ pw_multi_aff_list(const pw_multi_aff_list &obj);
  2743. inline explicit pw_multi_aff_list(isl::ctx ctx, int n);
  2744. inline explicit pw_multi_aff_list(isl::pw_multi_aff el);
  2745. inline explicit pw_multi_aff_list(isl::ctx ctx, const std::string &str);
  2746. inline pw_multi_aff_list &operator=(pw_multi_aff_list obj);
  2747. inline ~pw_multi_aff_list();
  2748. inline __isl_give isl_pw_multi_aff_list *copy() const &;
  2749. inline __isl_give isl_pw_multi_aff_list *copy() && = delete;
  2750. inline __isl_keep isl_pw_multi_aff_list *get() const;
  2751. inline __isl_give isl_pw_multi_aff_list *release();
  2752. inline bool is_null() const;
  2753. inline isl::ctx ctx() const;
  2754. inline isl::pw_multi_aff_list add(isl::pw_multi_aff el) const;
  2755. inline isl::pw_multi_aff at(int index) const;
  2756. inline isl::pw_multi_aff get_at(int index) const;
  2757. inline isl::pw_multi_aff_list clear() const;
  2758. inline isl::pw_multi_aff_list concat(isl::pw_multi_aff_list list2) const;
  2759. inline isl::pw_multi_aff_list drop(unsigned int first, unsigned int n) const;
  2760. inline void foreach(const std::function<void(isl::pw_multi_aff)> &fn) const;
  2761. inline void foreach_scc(const std::function<bool(isl::pw_multi_aff, isl::pw_multi_aff)> &follows, const std::function<void(isl::pw_multi_aff_list)> &fn) const;
  2762. inline isl::pw_multi_aff_list insert(unsigned int pos, isl::pw_multi_aff el) const;
  2763. inline unsigned size() const;
  2764. };
  2765. // declarations for isl::schedule
  2766. inline schedule manage(__isl_take isl_schedule *ptr);
  2767. inline schedule manage_copy(__isl_keep isl_schedule *ptr);
  2768. class schedule {
  2769. friend inline schedule manage(__isl_take isl_schedule *ptr);
  2770. friend inline schedule manage_copy(__isl_keep isl_schedule *ptr);
  2771. protected:
  2772. isl_schedule *ptr = nullptr;
  2773. inline explicit schedule(__isl_take isl_schedule *ptr);
  2774. public:
  2775. inline /* implicit */ schedule();
  2776. inline /* implicit */ schedule(const schedule &obj);
  2777. inline explicit schedule(isl::ctx ctx, const std::string &str);
  2778. inline schedule &operator=(schedule obj);
  2779. inline ~schedule();
  2780. inline __isl_give isl_schedule *copy() const &;
  2781. inline __isl_give isl_schedule *copy() && = delete;
  2782. inline __isl_keep isl_schedule *get() const;
  2783. inline __isl_give isl_schedule *release();
  2784. inline bool is_null() const;
  2785. inline isl::ctx ctx() const;
  2786. inline isl::union_set domain() const;
  2787. inline isl::union_set get_domain() const;
  2788. static inline isl::schedule from_domain(isl::union_set domain);
  2789. inline isl::union_map map() const;
  2790. inline isl::union_map get_map() const;
  2791. inline isl::schedule pullback(isl::union_pw_multi_aff upma) const;
  2792. inline isl::schedule_node root() const;
  2793. inline isl::schedule_node get_root() const;
  2794. };
  2795. // declarations for isl::schedule_constraints
  2796. inline schedule_constraints manage(__isl_take isl_schedule_constraints *ptr);
  2797. inline schedule_constraints manage_copy(__isl_keep isl_schedule_constraints *ptr);
  2798. class schedule_constraints {
  2799. friend inline schedule_constraints manage(__isl_take isl_schedule_constraints *ptr);
  2800. friend inline schedule_constraints manage_copy(__isl_keep isl_schedule_constraints *ptr);
  2801. protected:
  2802. isl_schedule_constraints *ptr = nullptr;
  2803. inline explicit schedule_constraints(__isl_take isl_schedule_constraints *ptr);
  2804. public:
  2805. inline /* implicit */ schedule_constraints();
  2806. inline /* implicit */ schedule_constraints(const schedule_constraints &obj);
  2807. inline explicit schedule_constraints(isl::ctx ctx, const std::string &str);
  2808. inline schedule_constraints &operator=(schedule_constraints obj);
  2809. inline ~schedule_constraints();
  2810. inline __isl_give isl_schedule_constraints *copy() const &;
  2811. inline __isl_give isl_schedule_constraints *copy() && = delete;
  2812. inline __isl_keep isl_schedule_constraints *get() const;
  2813. inline __isl_give isl_schedule_constraints *release();
  2814. inline bool is_null() const;
  2815. inline isl::ctx ctx() const;
  2816. inline isl::union_map coincidence() const;
  2817. inline isl::union_map get_coincidence() const;
  2818. inline isl::schedule compute_schedule() const;
  2819. inline isl::union_map conditional_validity() const;
  2820. inline isl::union_map get_conditional_validity() const;
  2821. inline isl::union_map conditional_validity_condition() const;
  2822. inline isl::union_map get_conditional_validity_condition() const;
  2823. inline isl::set context() const;
  2824. inline isl::set get_context() const;
  2825. inline isl::union_set domain() const;
  2826. inline isl::union_set get_domain() const;
  2827. static inline isl::schedule_constraints on_domain(isl::union_set domain);
  2828. inline isl::union_map proximity() const;
  2829. inline isl::union_map get_proximity() const;
  2830. inline isl::schedule_constraints set_coincidence(isl::union_map coincidence) const;
  2831. inline isl::schedule_constraints set_conditional_validity(isl::union_map condition, isl::union_map validity) const;
  2832. inline isl::schedule_constraints set_context(isl::set context) const;
  2833. inline isl::schedule_constraints set_proximity(isl::union_map proximity) const;
  2834. inline isl::schedule_constraints set_validity(isl::union_map validity) const;
  2835. inline isl::union_map validity() const;
  2836. inline isl::union_map get_validity() const;
  2837. };
  2838. // declarations for isl::schedule_node
  2839. inline schedule_node manage(__isl_take isl_schedule_node *ptr);
  2840. inline schedule_node manage_copy(__isl_keep isl_schedule_node *ptr);
  2841. class schedule_node {
  2842. friend inline schedule_node manage(__isl_take isl_schedule_node *ptr);
  2843. friend inline schedule_node manage_copy(__isl_keep isl_schedule_node *ptr);
  2844. protected:
  2845. isl_schedule_node *ptr = nullptr;
  2846. inline explicit schedule_node(__isl_take isl_schedule_node *ptr);
  2847. public:
  2848. inline /* implicit */ schedule_node();
  2849. inline /* implicit */ schedule_node(const schedule_node &obj);
  2850. inline schedule_node &operator=(schedule_node obj);
  2851. inline ~schedule_node();
  2852. inline __isl_give isl_schedule_node *copy() const &;
  2853. inline __isl_give isl_schedule_node *copy() && = delete;
  2854. inline __isl_keep isl_schedule_node *get() const;
  2855. inline __isl_give isl_schedule_node *release();
  2856. inline bool is_null() const;
  2857. private:
  2858. template <typename T,
  2859. typename = typename std::enable_if<std::is_same<
  2860. const decltype(isl_schedule_node_get_type(NULL)),
  2861. const T>::value>::type>
  2862. inline bool isa_type(T subtype) const;
  2863. public:
  2864. template <class T> inline bool isa() const;
  2865. template <class T> inline T as() const;
  2866. inline isl::ctx ctx() const;
  2867. inline isl::schedule_node ancestor(int generation) const;
  2868. inline unsigned ancestor_child_position(const isl::schedule_node &ancestor) const;
  2869. inline unsigned get_ancestor_child_position(const isl::schedule_node &ancestor) const;
  2870. inline isl::schedule_node child(int pos) const;
  2871. inline unsigned child_position() const;
  2872. inline unsigned get_child_position() const;
  2873. inline bool every_descendant(const std::function<bool(isl::schedule_node)> &test) const;
  2874. inline isl::schedule_node first_child() const;
  2875. inline void foreach_ancestor_top_down(const std::function<void(isl::schedule_node)> &fn) const;
  2876. inline void foreach_descendant_top_down(const std::function<bool(isl::schedule_node)> &fn) const;
  2877. static inline isl::schedule_node from_domain(isl::union_set domain);
  2878. static inline isl::schedule_node from_extension(isl::union_map extension);
  2879. inline isl::schedule_node graft_after(isl::schedule_node graft) const;
  2880. inline isl::schedule_node graft_before(isl::schedule_node graft) const;
  2881. inline bool has_children() const;
  2882. inline bool has_next_sibling() const;
  2883. inline bool has_parent() const;
  2884. inline bool has_previous_sibling() const;
  2885. inline isl::schedule_node insert_context(isl::set context) const;
  2886. inline isl::schedule_node insert_filter(isl::union_set filter) const;
  2887. inline isl::schedule_node insert_guard(isl::set context) const;
  2888. inline isl::schedule_node insert_mark(isl::id mark) const;
  2889. inline isl::schedule_node insert_mark(const std::string &mark) const;
  2890. inline isl::schedule_node insert_partial_schedule(isl::multi_union_pw_aff schedule) const;
  2891. inline isl::schedule_node insert_sequence(isl::union_set_list filters) const;
  2892. inline isl::schedule_node insert_set(isl::union_set_list filters) const;
  2893. inline bool is_equal(const isl::schedule_node &node2) const;
  2894. inline bool is_subtree_anchored() const;
  2895. inline isl::schedule_node map_descendant_bottom_up(const std::function<isl::schedule_node(isl::schedule_node)> &fn) const;
  2896. inline unsigned n_children() const;
  2897. inline isl::schedule_node next_sibling() const;
  2898. inline isl::schedule_node order_after(isl::union_set filter) const;
  2899. inline isl::schedule_node order_before(isl::union_set filter) const;
  2900. inline isl::schedule_node parent() const;
  2901. inline isl::multi_union_pw_aff prefix_schedule_multi_union_pw_aff() const;
  2902. inline isl::multi_union_pw_aff get_prefix_schedule_multi_union_pw_aff() const;
  2903. inline isl::union_map prefix_schedule_union_map() const;
  2904. inline isl::union_map get_prefix_schedule_union_map() const;
  2905. inline isl::union_pw_multi_aff prefix_schedule_union_pw_multi_aff() const;
  2906. inline isl::union_pw_multi_aff get_prefix_schedule_union_pw_multi_aff() const;
  2907. inline isl::schedule_node previous_sibling() const;
  2908. inline isl::schedule_node root() const;
  2909. inline isl::schedule schedule() const;
  2910. inline isl::schedule get_schedule() const;
  2911. inline isl::schedule_node shared_ancestor(const isl::schedule_node &node2) const;
  2912. inline isl::schedule_node get_shared_ancestor(const isl::schedule_node &node2) const;
  2913. inline unsigned tree_depth() const;
  2914. inline unsigned get_tree_depth() const;
  2915. };
  2916. // declarations for isl::schedule_node_band
  2917. class schedule_node_band : public schedule_node {
  2918. template <class T>
  2919. friend bool schedule_node::isa() const;
  2920. friend schedule_node_band schedule_node::as<schedule_node_band>() const;
  2921. static const auto type = isl_schedule_node_band;
  2922. protected:
  2923. inline explicit schedule_node_band(__isl_take isl_schedule_node *ptr);
  2924. public:
  2925. inline /* implicit */ schedule_node_band();
  2926. inline /* implicit */ schedule_node_band(const schedule_node_band &obj);
  2927. inline schedule_node_band &operator=(schedule_node_band obj);
  2928. inline isl::ctx ctx() const;
  2929. inline isl::union_set ast_build_options() const;
  2930. inline isl::union_set get_ast_build_options() const;
  2931. inline isl::set ast_isolate_option() const;
  2932. inline isl::set get_ast_isolate_option() const;
  2933. inline bool member_get_coincident(int pos) const;
  2934. inline schedule_node_band member_set_coincident(int pos, int coincident) const;
  2935. inline schedule_node_band mod(isl::multi_val mv) const;
  2936. inline unsigned n_member() const;
  2937. inline isl::multi_union_pw_aff partial_schedule() const;
  2938. inline isl::multi_union_pw_aff get_partial_schedule() const;
  2939. inline bool permutable() const;
  2940. inline bool get_permutable() const;
  2941. inline schedule_node_band scale(isl::multi_val mv) const;
  2942. inline schedule_node_band scale_down(isl::multi_val mv) const;
  2943. inline schedule_node_band set_ast_build_options(isl::union_set options) const;
  2944. inline schedule_node_band set_permutable(int permutable) const;
  2945. inline schedule_node_band shift(isl::multi_union_pw_aff shift) const;
  2946. inline schedule_node_band split(int pos) const;
  2947. inline schedule_node_band tile(isl::multi_val sizes) const;
  2948. inline schedule_node_band member_set_ast_loop_default(int pos) const;
  2949. inline schedule_node_band member_set_ast_loop_atomic(int pos) const;
  2950. inline schedule_node_band member_set_ast_loop_unroll(int pos) const;
  2951. inline schedule_node_band member_set_ast_loop_separate(int pos) const;
  2952. };
  2953. // declarations for isl::schedule_node_context
  2954. class schedule_node_context : public schedule_node {
  2955. template <class T>
  2956. friend bool schedule_node::isa() const;
  2957. friend schedule_node_context schedule_node::as<schedule_node_context>() const;
  2958. static const auto type = isl_schedule_node_context;
  2959. protected:
  2960. inline explicit schedule_node_context(__isl_take isl_schedule_node *ptr);
  2961. public:
  2962. inline /* implicit */ schedule_node_context();
  2963. inline /* implicit */ schedule_node_context(const schedule_node_context &obj);
  2964. inline schedule_node_context &operator=(schedule_node_context obj);
  2965. inline isl::ctx ctx() const;
  2966. inline isl::set context() const;
  2967. inline isl::set get_context() const;
  2968. };
  2969. // declarations for isl::schedule_node_domain
  2970. class schedule_node_domain : public schedule_node {
  2971. template <class T>
  2972. friend bool schedule_node::isa() const;
  2973. friend schedule_node_domain schedule_node::as<schedule_node_domain>() const;
  2974. static const auto type = isl_schedule_node_domain;
  2975. protected:
  2976. inline explicit schedule_node_domain(__isl_take isl_schedule_node *ptr);
  2977. public:
  2978. inline /* implicit */ schedule_node_domain();
  2979. inline /* implicit */ schedule_node_domain(const schedule_node_domain &obj);
  2980. inline schedule_node_domain &operator=(schedule_node_domain obj);
  2981. inline isl::ctx ctx() const;
  2982. inline isl::union_set domain() const;
  2983. inline isl::union_set get_domain() const;
  2984. };
  2985. // declarations for isl::schedule_node_expansion
  2986. class schedule_node_expansion : public schedule_node {
  2987. template <class T>
  2988. friend bool schedule_node::isa() const;
  2989. friend schedule_node_expansion schedule_node::as<schedule_node_expansion>() const;
  2990. static const auto type = isl_schedule_node_expansion;
  2991. protected:
  2992. inline explicit schedule_node_expansion(__isl_take isl_schedule_node *ptr);
  2993. public:
  2994. inline /* implicit */ schedule_node_expansion();
  2995. inline /* implicit */ schedule_node_expansion(const schedule_node_expansion &obj);
  2996. inline schedule_node_expansion &operator=(schedule_node_expansion obj);
  2997. inline isl::ctx ctx() const;
  2998. inline isl::union_pw_multi_aff contraction() const;
  2999. inline isl::union_pw_multi_aff get_contraction() const;
  3000. inline isl::union_map expansion() const;
  3001. inline isl::union_map get_expansion() const;
  3002. };
  3003. // declarations for isl::schedule_node_extension
  3004. class schedule_node_extension : public schedule_node {
  3005. template <class T>
  3006. friend bool schedule_node::isa() const;
  3007. friend schedule_node_extension schedule_node::as<schedule_node_extension>() const;
  3008. static const auto type = isl_schedule_node_extension;
  3009. protected:
  3010. inline explicit schedule_node_extension(__isl_take isl_schedule_node *ptr);
  3011. public:
  3012. inline /* implicit */ schedule_node_extension();
  3013. inline /* implicit */ schedule_node_extension(const schedule_node_extension &obj);
  3014. inline schedule_node_extension &operator=(schedule_node_extension obj);
  3015. inline isl::ctx ctx() const;
  3016. inline isl::union_map extension() const;
  3017. inline isl::union_map get_extension() const;
  3018. };
  3019. // declarations for isl::schedule_node_filter
  3020. class schedule_node_filter : public schedule_node {
  3021. template <class T>
  3022. friend bool schedule_node::isa() const;
  3023. friend schedule_node_filter schedule_node::as<schedule_node_filter>() const;
  3024. static const auto type = isl_schedule_node_filter;
  3025. protected:
  3026. inline explicit schedule_node_filter(__isl_take isl_schedule_node *ptr);
  3027. public:
  3028. inline /* implicit */ schedule_node_filter();
  3029. inline /* implicit */ schedule_node_filter(const schedule_node_filter &obj);
  3030. inline schedule_node_filter &operator=(schedule_node_filter obj);
  3031. inline isl::ctx ctx() const;
  3032. inline isl::union_set filter() const;
  3033. inline isl::union_set get_filter() const;
  3034. };
  3035. // declarations for isl::schedule_node_guard
  3036. class schedule_node_guard : public schedule_node {
  3037. template <class T>
  3038. friend bool schedule_node::isa() const;
  3039. friend schedule_node_guard schedule_node::as<schedule_node_guard>() const;
  3040. static const auto type = isl_schedule_node_guard;
  3041. protected:
  3042. inline explicit schedule_node_guard(__isl_take isl_schedule_node *ptr);
  3043. public:
  3044. inline /* implicit */ schedule_node_guard();
  3045. inline /* implicit */ schedule_node_guard(const schedule_node_guard &obj);
  3046. inline schedule_node_guard &operator=(schedule_node_guard obj);
  3047. inline isl::ctx ctx() const;
  3048. inline isl::set guard() const;
  3049. inline isl::set get_guard() const;
  3050. };
  3051. // declarations for isl::schedule_node_leaf
  3052. class schedule_node_leaf : public schedule_node {
  3053. template <class T>
  3054. friend bool schedule_node::isa() const;
  3055. friend schedule_node_leaf schedule_node::as<schedule_node_leaf>() const;
  3056. static const auto type = isl_schedule_node_leaf;
  3057. protected:
  3058. inline explicit schedule_node_leaf(__isl_take isl_schedule_node *ptr);
  3059. public:
  3060. inline /* implicit */ schedule_node_leaf();
  3061. inline /* implicit */ schedule_node_leaf(const schedule_node_leaf &obj);
  3062. inline schedule_node_leaf &operator=(schedule_node_leaf obj);
  3063. inline isl::ctx ctx() const;
  3064. };
  3065. // declarations for isl::schedule_node_mark
  3066. class schedule_node_mark : public schedule_node {
  3067. template <class T>
  3068. friend bool schedule_node::isa() const;
  3069. friend schedule_node_mark schedule_node::as<schedule_node_mark>() const;
  3070. static const auto type = isl_schedule_node_mark;
  3071. protected:
  3072. inline explicit schedule_node_mark(__isl_take isl_schedule_node *ptr);
  3073. public:
  3074. inline /* implicit */ schedule_node_mark();
  3075. inline /* implicit */ schedule_node_mark(const schedule_node_mark &obj);
  3076. inline schedule_node_mark &operator=(schedule_node_mark obj);
  3077. inline isl::ctx ctx() const;
  3078. };
  3079. // declarations for isl::schedule_node_sequence
  3080. class schedule_node_sequence : public schedule_node {
  3081. template <class T>
  3082. friend bool schedule_node::isa() const;
  3083. friend schedule_node_sequence schedule_node::as<schedule_node_sequence>() const;
  3084. static const auto type = isl_schedule_node_sequence;
  3085. protected:
  3086. inline explicit schedule_node_sequence(__isl_take isl_schedule_node *ptr);
  3087. public:
  3088. inline /* implicit */ schedule_node_sequence();
  3089. inline /* implicit */ schedule_node_sequence(const schedule_node_sequence &obj);
  3090. inline schedule_node_sequence &operator=(schedule_node_sequence obj);
  3091. inline isl::ctx ctx() const;
  3092. };
  3093. // declarations for isl::schedule_node_set
  3094. class schedule_node_set : public schedule_node {
  3095. template <class T>
  3096. friend bool schedule_node::isa() const;
  3097. friend schedule_node_set schedule_node::as<schedule_node_set>() const;
  3098. static const auto type = isl_schedule_node_set;
  3099. protected:
  3100. inline explicit schedule_node_set(__isl_take isl_schedule_node *ptr);
  3101. public:
  3102. inline /* implicit */ schedule_node_set();
  3103. inline /* implicit */ schedule_node_set(const schedule_node_set &obj);
  3104. inline schedule_node_set &operator=(schedule_node_set obj);
  3105. inline isl::ctx ctx() const;
  3106. };
  3107. // declarations for isl::set
  3108. inline set manage(__isl_take isl_set *ptr);
  3109. inline set manage_copy(__isl_keep isl_set *ptr);
  3110. class set {
  3111. friend inline set manage(__isl_take isl_set *ptr);
  3112. friend inline set manage_copy(__isl_keep isl_set *ptr);
  3113. protected:
  3114. isl_set *ptr = nullptr;
  3115. inline explicit set(__isl_take isl_set *ptr);
  3116. public:
  3117. inline /* implicit */ set();
  3118. inline /* implicit */ set(const set &obj);
  3119. inline /* implicit */ set(isl::basic_set bset);
  3120. inline /* implicit */ set(isl::point pnt);
  3121. inline explicit set(isl::ctx ctx, const std::string &str);
  3122. inline set &operator=(set obj);
  3123. inline ~set();
  3124. inline __isl_give isl_set *copy() const &;
  3125. inline __isl_give isl_set *copy() && = delete;
  3126. inline __isl_keep isl_set *get() const;
  3127. inline __isl_give isl_set *release();
  3128. inline bool is_null() const;
  3129. inline isl::ctx ctx() const;
  3130. inline isl::basic_set affine_hull() const;
  3131. inline isl::set apply(isl::map map) const;
  3132. inline isl::union_set apply(const isl::union_map &umap) const;
  3133. inline isl::set apply(const isl::basic_map &map) const;
  3134. inline isl::pw_multi_aff as_pw_multi_aff() const;
  3135. inline isl::set as_set() const;
  3136. inline isl::set bind(isl::multi_id tuple) const;
  3137. inline isl::set coalesce() const;
  3138. inline isl::set complement() const;
  3139. inline isl::union_set compute_divs() const;
  3140. inline isl::set detect_equalities() const;
  3141. inline isl::val dim_max_val(int pos) const;
  3142. inline isl::val dim_min_val(int pos) const;
  3143. static inline isl::set empty(isl::space space);
  3144. inline bool every_set(const std::function<bool(isl::set)> &test) const;
  3145. inline isl::set extract_set(const isl::space &space) const;
  3146. inline isl::set flatten() const;
  3147. inline void foreach_basic_set(const std::function<void(isl::basic_set)> &fn) const;
  3148. inline void foreach_point(const std::function<void(isl::point)> &fn) const;
  3149. inline void foreach_set(const std::function<void(isl::set)> &fn) const;
  3150. inline isl::set gist(isl::set context) const;
  3151. inline isl::union_set gist(const isl::union_set &context) const;
  3152. inline isl::set gist(const isl::basic_set &context) const;
  3153. inline isl::set gist(const isl::point &context) const;
  3154. inline isl::set gist_params(isl::set context) const;
  3155. inline isl::map identity() const;
  3156. inline isl::pw_aff indicator_function() const;
  3157. inline isl::map insert_domain(isl::space domain) const;
  3158. inline isl::set intersect(isl::set set2) const;
  3159. inline isl::union_set intersect(const isl::union_set &uset2) const;
  3160. inline isl::set intersect(const isl::basic_set &set2) const;
  3161. inline isl::set intersect(const isl::point &set2) const;
  3162. inline isl::set intersect_params(isl::set params) const;
  3163. inline bool involves_locals() const;
  3164. inline bool is_disjoint(const isl::set &set2) const;
  3165. inline bool is_disjoint(const isl::union_set &uset2) const;
  3166. inline bool is_disjoint(const isl::basic_set &set2) const;
  3167. inline bool is_disjoint(const isl::point &set2) const;
  3168. inline bool is_empty() const;
  3169. inline bool is_equal(const isl::set &set2) const;
  3170. inline bool is_equal(const isl::union_set &uset2) const;
  3171. inline bool is_equal(const isl::basic_set &set2) const;
  3172. inline bool is_equal(const isl::point &set2) const;
  3173. inline bool is_singleton() const;
  3174. inline bool is_strict_subset(const isl::set &set2) const;
  3175. inline bool is_strict_subset(const isl::union_set &uset2) const;
  3176. inline bool is_strict_subset(const isl::basic_set &set2) const;
  3177. inline bool is_strict_subset(const isl::point &set2) const;
  3178. inline bool is_subset(const isl::set &set2) const;
  3179. inline bool is_subset(const isl::union_set &uset2) const;
  3180. inline bool is_subset(const isl::basic_set &set2) const;
  3181. inline bool is_subset(const isl::point &set2) const;
  3182. inline bool is_wrapping() const;
  3183. inline bool isa_set() const;
  3184. inline isl::fixed_box lattice_tile() const;
  3185. inline isl::fixed_box get_lattice_tile() const;
  3186. inline isl::set lexmax() const;
  3187. inline isl::pw_multi_aff lexmax_pw_multi_aff() const;
  3188. inline isl::set lexmin() const;
  3189. inline isl::pw_multi_aff lexmin_pw_multi_aff() const;
  3190. inline isl::set lower_bound(isl::multi_pw_aff lower) const;
  3191. inline isl::set lower_bound(isl::multi_val lower) const;
  3192. inline isl::multi_pw_aff max_multi_pw_aff() const;
  3193. inline isl::val max_val(const isl::aff &obj) const;
  3194. inline isl::multi_pw_aff min_multi_pw_aff() const;
  3195. inline isl::val min_val(const isl::aff &obj) const;
  3196. inline unsigned n_basic_set() const;
  3197. inline isl::pw_aff param_pw_aff_on_domain(isl::id id) const;
  3198. inline isl::pw_aff param_pw_aff_on_domain(const std::string &id) const;
  3199. inline isl::set params() const;
  3200. inline isl::multi_val plain_multi_val_if_fixed() const;
  3201. inline isl::multi_val get_plain_multi_val_if_fixed() const;
  3202. inline isl::basic_set polyhedral_hull() const;
  3203. inline isl::set preimage(isl::multi_aff ma) const;
  3204. inline isl::set preimage(isl::multi_pw_aff mpa) const;
  3205. inline isl::set preimage(isl::pw_multi_aff pma) const;
  3206. inline isl::union_set preimage(const isl::union_pw_multi_aff &upma) const;
  3207. inline isl::set product(isl::set set2) const;
  3208. inline isl::set project_out_all_params() const;
  3209. inline isl::set project_out_param(isl::id id) const;
  3210. inline isl::set project_out_param(const std::string &id) const;
  3211. inline isl::set project_out_param(isl::id_list list) const;
  3212. inline isl::pw_aff pw_aff_on_domain(isl::val v) const;
  3213. inline isl::pw_aff pw_aff_on_domain(long v) const;
  3214. inline isl::pw_multi_aff pw_multi_aff_on_domain(isl::multi_val mv) const;
  3215. inline isl::basic_set sample() const;
  3216. inline isl::point sample_point() const;
  3217. inline isl::set_list set_list() const;
  3218. inline isl::fixed_box simple_fixed_box_hull() const;
  3219. inline isl::fixed_box get_simple_fixed_box_hull() const;
  3220. inline isl::space space() const;
  3221. inline isl::space get_space() const;
  3222. inline isl::val stride(int pos) const;
  3223. inline isl::val get_stride(int pos) const;
  3224. inline isl::set subtract(isl::set set2) const;
  3225. inline isl::union_set subtract(const isl::union_set &uset2) const;
  3226. inline isl::set subtract(const isl::basic_set &set2) const;
  3227. inline isl::set subtract(const isl::point &set2) const;
  3228. inline isl::set_list to_list() const;
  3229. inline isl::union_set to_union_set() const;
  3230. inline isl::map translation() const;
  3231. inline unsigned tuple_dim() const;
  3232. inline isl::set unbind_params(isl::multi_id tuple) const;
  3233. inline isl::map unbind_params_insert_domain(isl::multi_id domain) const;
  3234. inline isl::set unite(isl::set set2) const;
  3235. inline isl::union_set unite(const isl::union_set &uset2) const;
  3236. inline isl::set unite(const isl::basic_set &set2) const;
  3237. inline isl::set unite(const isl::point &set2) const;
  3238. static inline isl::set universe(isl::space space);
  3239. inline isl::basic_set unshifted_simple_hull() const;
  3240. inline isl::map unwrap() const;
  3241. inline isl::set upper_bound(isl::multi_pw_aff upper) const;
  3242. inline isl::set upper_bound(isl::multi_val upper) const;
  3243. };
  3244. // declarations for isl::set_list
  3245. inline set_list manage(__isl_take isl_set_list *ptr);
  3246. inline set_list manage_copy(__isl_keep isl_set_list *ptr);
  3247. class set_list {
  3248. friend inline set_list manage(__isl_take isl_set_list *ptr);
  3249. friend inline set_list manage_copy(__isl_keep isl_set_list *ptr);
  3250. protected:
  3251. isl_set_list *ptr = nullptr;
  3252. inline explicit set_list(__isl_take isl_set_list *ptr);
  3253. public:
  3254. inline /* implicit */ set_list();
  3255. inline /* implicit */ set_list(const set_list &obj);
  3256. inline explicit set_list(isl::ctx ctx, int n);
  3257. inline explicit set_list(isl::set el);
  3258. inline explicit set_list(isl::ctx ctx, const std::string &str);
  3259. inline set_list &operator=(set_list obj);
  3260. inline ~set_list();
  3261. inline __isl_give isl_set_list *copy() const &;
  3262. inline __isl_give isl_set_list *copy() && = delete;
  3263. inline __isl_keep isl_set_list *get() const;
  3264. inline __isl_give isl_set_list *release();
  3265. inline bool is_null() const;
  3266. inline isl::ctx ctx() const;
  3267. inline isl::set_list add(isl::set el) const;
  3268. inline isl::set at(int index) const;
  3269. inline isl::set get_at(int index) const;
  3270. inline isl::set_list clear() const;
  3271. inline isl::set_list concat(isl::set_list list2) const;
  3272. inline isl::set_list drop(unsigned int first, unsigned int n) const;
  3273. inline void foreach(const std::function<void(isl::set)> &fn) const;
  3274. inline void foreach_scc(const std::function<bool(isl::set, isl::set)> &follows, const std::function<void(isl::set_list)> &fn) const;
  3275. inline isl::set_list insert(unsigned int pos, isl::set el) const;
  3276. inline unsigned size() const;
  3277. };
  3278. // declarations for isl::space
  3279. inline space manage(__isl_take isl_space *ptr);
  3280. inline space manage_copy(__isl_keep isl_space *ptr);
  3281. class space {
  3282. friend inline space manage(__isl_take isl_space *ptr);
  3283. friend inline space manage_copy(__isl_keep isl_space *ptr);
  3284. protected:
  3285. isl_space *ptr = nullptr;
  3286. inline explicit space(__isl_take isl_space *ptr);
  3287. public:
  3288. inline /* implicit */ space();
  3289. inline /* implicit */ space(const space &obj);
  3290. inline explicit space(isl::ctx ctx, const std::string &str);
  3291. inline space &operator=(space obj);
  3292. inline ~space();
  3293. inline __isl_give isl_space *copy() const &;
  3294. inline __isl_give isl_space *copy() && = delete;
  3295. inline __isl_keep isl_space *get() const;
  3296. inline __isl_give isl_space *release();
  3297. inline bool is_null() const;
  3298. inline isl::ctx ctx() const;
  3299. inline isl::space add_named_tuple(isl::id tuple_id, unsigned int dim) const;
  3300. inline isl::space add_named_tuple(const std::string &tuple_id, unsigned int dim) const;
  3301. inline isl::space add_param(isl::id id) const;
  3302. inline isl::space add_param(const std::string &id) const;
  3303. inline isl::space add_unnamed_tuple(unsigned int dim) const;
  3304. inline isl::space curry() const;
  3305. inline isl::space domain() const;
  3306. inline isl::multi_aff domain_map_multi_aff() const;
  3307. inline isl::pw_multi_aff domain_map_pw_multi_aff() const;
  3308. inline isl::id domain_tuple_id() const;
  3309. inline isl::id get_domain_tuple_id() const;
  3310. inline isl::space flatten_domain() const;
  3311. inline isl::space flatten_range() const;
  3312. inline bool has_domain_tuple_id() const;
  3313. inline bool has_range_tuple_id() const;
  3314. inline isl::multi_aff identity_multi_aff_on_domain() const;
  3315. inline isl::multi_pw_aff identity_multi_pw_aff_on_domain() const;
  3316. inline isl::pw_multi_aff identity_pw_multi_aff_on_domain() const;
  3317. inline bool is_equal(const isl::space &space2) const;
  3318. inline bool is_wrapping() const;
  3319. inline isl::space map_from_set() const;
  3320. inline isl::multi_aff multi_aff(isl::aff_list list) const;
  3321. inline isl::multi_aff multi_aff_on_domain(isl::multi_val mv) const;
  3322. inline isl::multi_id multi_id(isl::id_list list) const;
  3323. inline isl::multi_pw_aff multi_pw_aff(isl::pw_aff_list list) const;
  3324. inline isl::multi_union_pw_aff multi_union_pw_aff(isl::union_pw_aff_list list) const;
  3325. inline isl::multi_val multi_val(isl::val_list list) const;
  3326. inline isl::aff param_aff_on_domain(isl::id id) const;
  3327. inline isl::aff param_aff_on_domain(const std::string &id) const;
  3328. inline isl::space params() const;
  3329. inline isl::space product(isl::space right) const;
  3330. inline isl::space range() const;
  3331. inline isl::multi_aff range_map_multi_aff() const;
  3332. inline isl::pw_multi_aff range_map_pw_multi_aff() const;
  3333. inline isl::space range_reverse() const;
  3334. inline isl::id range_tuple_id() const;
  3335. inline isl::id get_range_tuple_id() const;
  3336. inline isl::space reverse() const;
  3337. inline isl::space set_domain_tuple(isl::id id) const;
  3338. inline isl::space set_domain_tuple(const std::string &id) const;
  3339. inline isl::space set_range_tuple(isl::id id) const;
  3340. inline isl::space set_range_tuple(const std::string &id) const;
  3341. inline isl::space uncurry() const;
  3342. static inline isl::space unit(isl::ctx ctx);
  3343. inline isl::map universe_map() const;
  3344. inline isl::set universe_set() const;
  3345. inline isl::space unwrap() const;
  3346. inline isl::space wrap() const;
  3347. inline isl::aff zero_aff_on_domain() const;
  3348. inline isl::multi_aff zero_multi_aff() const;
  3349. inline isl::multi_pw_aff zero_multi_pw_aff() const;
  3350. inline isl::multi_union_pw_aff zero_multi_union_pw_aff() const;
  3351. inline isl::multi_val zero_multi_val() const;
  3352. };
  3353. // declarations for isl::union_access_info
  3354. inline union_access_info manage(__isl_take isl_union_access_info *ptr);
  3355. inline union_access_info manage_copy(__isl_keep isl_union_access_info *ptr);
  3356. class union_access_info {
  3357. friend inline union_access_info manage(__isl_take isl_union_access_info *ptr);
  3358. friend inline union_access_info manage_copy(__isl_keep isl_union_access_info *ptr);
  3359. protected:
  3360. isl_union_access_info *ptr = nullptr;
  3361. inline explicit union_access_info(__isl_take isl_union_access_info *ptr);
  3362. public:
  3363. inline /* implicit */ union_access_info();
  3364. inline /* implicit */ union_access_info(const union_access_info &obj);
  3365. inline explicit union_access_info(isl::union_map sink);
  3366. inline union_access_info &operator=(union_access_info obj);
  3367. inline ~union_access_info();
  3368. inline __isl_give isl_union_access_info *copy() const &;
  3369. inline __isl_give isl_union_access_info *copy() && = delete;
  3370. inline __isl_keep isl_union_access_info *get() const;
  3371. inline __isl_give isl_union_access_info *release();
  3372. inline bool is_null() const;
  3373. inline isl::ctx ctx() const;
  3374. inline isl::union_flow compute_flow() const;
  3375. inline isl::union_access_info set_kill(isl::union_map kill) const;
  3376. inline isl::union_access_info set_may_source(isl::union_map may_source) const;
  3377. inline isl::union_access_info set_must_source(isl::union_map must_source) const;
  3378. inline isl::union_access_info set_schedule(isl::schedule schedule) const;
  3379. inline isl::union_access_info set_schedule_map(isl::union_map schedule_map) const;
  3380. };
  3381. // declarations for isl::union_flow
  3382. inline union_flow manage(__isl_take isl_union_flow *ptr);
  3383. inline union_flow manage_copy(__isl_keep isl_union_flow *ptr);
  3384. class union_flow {
  3385. friend inline union_flow manage(__isl_take isl_union_flow *ptr);
  3386. friend inline union_flow manage_copy(__isl_keep isl_union_flow *ptr);
  3387. protected:
  3388. isl_union_flow *ptr = nullptr;
  3389. inline explicit union_flow(__isl_take isl_union_flow *ptr);
  3390. public:
  3391. inline /* implicit */ union_flow();
  3392. inline /* implicit */ union_flow(const union_flow &obj);
  3393. inline union_flow &operator=(union_flow obj);
  3394. inline ~union_flow();
  3395. inline __isl_give isl_union_flow *copy() const &;
  3396. inline __isl_give isl_union_flow *copy() && = delete;
  3397. inline __isl_keep isl_union_flow *get() const;
  3398. inline __isl_give isl_union_flow *release();
  3399. inline bool is_null() const;
  3400. inline isl::ctx ctx() const;
  3401. inline isl::union_map full_may_dependence() const;
  3402. inline isl::union_map get_full_may_dependence() const;
  3403. inline isl::union_map full_must_dependence() const;
  3404. inline isl::union_map get_full_must_dependence() const;
  3405. inline isl::union_map may_dependence() const;
  3406. inline isl::union_map get_may_dependence() const;
  3407. inline isl::union_map may_no_source() const;
  3408. inline isl::union_map get_may_no_source() const;
  3409. inline isl::union_map must_dependence() const;
  3410. inline isl::union_map get_must_dependence() const;
  3411. inline isl::union_map must_no_source() const;
  3412. inline isl::union_map get_must_no_source() const;
  3413. };
  3414. // declarations for isl::union_map
  3415. inline union_map manage(__isl_take isl_union_map *ptr);
  3416. inline union_map manage_copy(__isl_keep isl_union_map *ptr);
  3417. class union_map {
  3418. friend inline union_map manage(__isl_take isl_union_map *ptr);
  3419. friend inline union_map manage_copy(__isl_keep isl_union_map *ptr);
  3420. protected:
  3421. isl_union_map *ptr = nullptr;
  3422. inline explicit union_map(__isl_take isl_union_map *ptr);
  3423. public:
  3424. inline /* implicit */ union_map();
  3425. inline /* implicit */ union_map(const union_map &obj);
  3426. inline /* implicit */ union_map(isl::basic_map bmap);
  3427. inline /* implicit */ union_map(isl::map map);
  3428. inline explicit union_map(isl::ctx ctx, const std::string &str);
  3429. inline union_map &operator=(union_map obj);
  3430. inline ~union_map();
  3431. inline __isl_give isl_union_map *copy() const &;
  3432. inline __isl_give isl_union_map *copy() && = delete;
  3433. inline __isl_keep isl_union_map *get() const;
  3434. inline __isl_give isl_union_map *release();
  3435. inline bool is_null() const;
  3436. inline isl::ctx ctx() const;
  3437. inline isl::union_map affine_hull() const;
  3438. inline isl::union_map apply_domain(isl::union_map umap2) const;
  3439. inline isl::union_map apply_range(isl::union_map umap2) const;
  3440. inline isl::map as_map() const;
  3441. inline isl::multi_union_pw_aff as_multi_union_pw_aff() const;
  3442. inline isl::union_pw_multi_aff as_union_pw_multi_aff() const;
  3443. inline isl::union_set bind_range(isl::multi_id tuple) const;
  3444. inline isl::union_map coalesce() const;
  3445. inline isl::union_map compute_divs() const;
  3446. inline isl::union_map curry() const;
  3447. inline isl::union_set deltas() const;
  3448. inline isl::union_map detect_equalities() const;
  3449. inline isl::union_set domain() const;
  3450. inline isl::union_map domain_factor_domain() const;
  3451. inline isl::union_map domain_factor_range() const;
  3452. inline isl::union_map domain_map() const;
  3453. inline isl::union_pw_multi_aff domain_map_union_pw_multi_aff() const;
  3454. inline isl::union_map domain_product(isl::union_map umap2) const;
  3455. static inline isl::union_map empty(isl::ctx ctx);
  3456. inline isl::union_map eq_at(isl::multi_union_pw_aff mupa) const;
  3457. inline bool every_map(const std::function<bool(isl::map)> &test) const;
  3458. inline isl::map extract_map(isl::space space) const;
  3459. inline isl::union_map factor_domain() const;
  3460. inline isl::union_map factor_range() const;
  3461. inline isl::union_map fixed_power(isl::val exp) const;
  3462. inline isl::union_map fixed_power(long exp) const;
  3463. inline void foreach_map(const std::function<void(isl::map)> &fn) const;
  3464. static inline isl::union_map from(isl::multi_union_pw_aff mupa);
  3465. static inline isl::union_map from(isl::union_pw_multi_aff upma);
  3466. static inline isl::union_map from_domain(isl::union_set uset);
  3467. static inline isl::union_map from_domain_and_range(isl::union_set domain, isl::union_set range);
  3468. static inline isl::union_map from_range(isl::union_set uset);
  3469. inline isl::union_map gist(isl::union_map context) const;
  3470. inline isl::union_map gist_domain(isl::union_set uset) const;
  3471. inline isl::union_map gist_params(isl::set set) const;
  3472. inline isl::union_map gist_range(isl::union_set uset) const;
  3473. inline isl::union_map intersect(isl::union_map umap2) const;
  3474. inline isl::union_map intersect_domain(isl::space space) const;
  3475. inline isl::union_map intersect_domain(isl::union_set uset) const;
  3476. inline isl::union_map intersect_domain_factor_domain(isl::union_map factor) const;
  3477. inline isl::union_map intersect_domain_factor_range(isl::union_map factor) const;
  3478. inline isl::union_map intersect_domain_wrapped_domain(isl::union_set domain) const;
  3479. inline isl::union_map intersect_params(isl::set set) const;
  3480. inline isl::union_map intersect_range(isl::space space) const;
  3481. inline isl::union_map intersect_range(isl::union_set uset) const;
  3482. inline isl::union_map intersect_range_factor_domain(isl::union_map factor) const;
  3483. inline isl::union_map intersect_range_factor_range(isl::union_map factor) const;
  3484. inline isl::union_map intersect_range_wrapped_domain(isl::union_set domain) const;
  3485. inline bool is_bijective() const;
  3486. inline bool is_disjoint(const isl::union_map &umap2) const;
  3487. inline bool is_empty() const;
  3488. inline bool is_equal(const isl::union_map &umap2) const;
  3489. inline bool is_injective() const;
  3490. inline bool is_single_valued() const;
  3491. inline bool is_strict_subset(const isl::union_map &umap2) const;
  3492. inline bool is_subset(const isl::union_map &umap2) const;
  3493. inline bool isa_map() const;
  3494. inline isl::union_map lexmax() const;
  3495. inline isl::union_map lexmin() const;
  3496. inline isl::map_list map_list() const;
  3497. inline isl::map_list get_map_list() const;
  3498. inline isl::union_map polyhedral_hull() const;
  3499. inline isl::union_map preimage_domain(isl::multi_aff ma) const;
  3500. inline isl::union_map preimage_domain(isl::multi_pw_aff mpa) const;
  3501. inline isl::union_map preimage_domain(isl::pw_multi_aff pma) const;
  3502. inline isl::union_map preimage_domain(isl::union_pw_multi_aff upma) const;
  3503. inline isl::union_map preimage_range(isl::multi_aff ma) const;
  3504. inline isl::union_map preimage_range(isl::pw_multi_aff pma) const;
  3505. inline isl::union_map preimage_range(isl::union_pw_multi_aff upma) const;
  3506. inline isl::union_map product(isl::union_map umap2) const;
  3507. inline isl::union_map project_out_all_params() const;
  3508. inline isl::union_set range() const;
  3509. inline isl::union_map range_factor_domain() const;
  3510. inline isl::union_map range_factor_range() const;
  3511. inline isl::union_map range_map() const;
  3512. inline isl::union_map range_product(isl::union_map umap2) const;
  3513. inline isl::union_map range_reverse() const;
  3514. inline isl::union_map reverse() const;
  3515. inline isl::space space() const;
  3516. inline isl::space get_space() const;
  3517. inline isl::union_map subtract(isl::union_map umap2) const;
  3518. inline isl::union_map subtract_domain(isl::union_set dom) const;
  3519. inline isl::union_map subtract_range(isl::union_set dom) const;
  3520. inline isl::union_map uncurry() const;
  3521. inline isl::union_map unite(isl::union_map umap2) const;
  3522. inline isl::union_map universe() const;
  3523. inline isl::union_set wrap() const;
  3524. inline isl::union_map zip() const;
  3525. };
  3526. // declarations for isl::union_pw_aff
  3527. inline union_pw_aff manage(__isl_take isl_union_pw_aff *ptr);
  3528. inline union_pw_aff manage_copy(__isl_keep isl_union_pw_aff *ptr);
  3529. class union_pw_aff {
  3530. friend inline union_pw_aff manage(__isl_take isl_union_pw_aff *ptr);
  3531. friend inline union_pw_aff manage_copy(__isl_keep isl_union_pw_aff *ptr);
  3532. protected:
  3533. isl_union_pw_aff *ptr = nullptr;
  3534. inline explicit union_pw_aff(__isl_take isl_union_pw_aff *ptr);
  3535. public:
  3536. inline /* implicit */ union_pw_aff();
  3537. inline /* implicit */ union_pw_aff(const union_pw_aff &obj);
  3538. inline /* implicit */ union_pw_aff(isl::aff aff);
  3539. inline /* implicit */ union_pw_aff(isl::pw_aff pa);
  3540. inline explicit union_pw_aff(isl::ctx ctx, const std::string &str);
  3541. inline union_pw_aff &operator=(union_pw_aff obj);
  3542. inline ~union_pw_aff();
  3543. inline __isl_give isl_union_pw_aff *copy() const &;
  3544. inline __isl_give isl_union_pw_aff *copy() && = delete;
  3545. inline __isl_keep isl_union_pw_aff *get() const;
  3546. inline __isl_give isl_union_pw_aff *release();
  3547. inline bool is_null() const;
  3548. inline isl::ctx ctx() const;
  3549. inline isl::multi_union_pw_aff add(const isl::multi_union_pw_aff &multi2) const;
  3550. inline isl::union_pw_aff add(isl::union_pw_aff upa2) const;
  3551. inline isl::union_pw_multi_aff add(const isl::union_pw_multi_aff &upma2) const;
  3552. inline isl::union_pw_aff add(const isl::aff &upa2) const;
  3553. inline isl::union_pw_aff add(const isl::pw_aff &upa2) const;
  3554. inline isl::union_pw_multi_aff apply(const isl::union_pw_multi_aff &upma2) const;
  3555. inline isl::multi_union_pw_aff as_multi_union_pw_aff() const;
  3556. inline isl::pw_multi_aff as_pw_multi_aff() const;
  3557. inline isl::union_map as_union_map() const;
  3558. inline isl::union_pw_aff at(int pos) const;
  3559. inline isl::union_set bind(const isl::multi_id &tuple) const;
  3560. inline isl::union_set bind(isl::id id) const;
  3561. inline isl::union_set bind(const std::string &id) const;
  3562. inline isl::union_pw_aff coalesce() const;
  3563. inline isl::union_set domain() const;
  3564. inline isl::pw_multi_aff extract_pw_multi_aff(const isl::space &space) const;
  3565. inline isl::multi_union_pw_aff flat_range_product(const isl::multi_union_pw_aff &multi2) const;
  3566. inline isl::union_pw_multi_aff flat_range_product(const isl::union_pw_multi_aff &upma2) const;
  3567. inline isl::union_pw_aff gist(isl::union_set context) const;
  3568. inline bool has_range_tuple_id() const;
  3569. inline isl::union_pw_aff intersect_domain(isl::space space) const;
  3570. inline isl::union_pw_aff intersect_domain(isl::union_set uset) const;
  3571. inline isl::union_pw_aff intersect_domain_wrapped_domain(isl::union_set uset) const;
  3572. inline isl::union_pw_aff intersect_domain_wrapped_range(isl::union_set uset) const;
  3573. inline isl::union_pw_aff intersect_params(isl::set set) const;
  3574. inline bool involves_locals() const;
  3575. inline bool involves_nan() const;
  3576. inline bool isa_pw_multi_aff() const;
  3577. inline isl::union_pw_aff_list list() const;
  3578. inline isl::multi_union_pw_aff neg() const;
  3579. inline bool plain_is_empty() const;
  3580. inline bool plain_is_equal(const isl::multi_union_pw_aff &multi2) const;
  3581. inline isl::union_pw_multi_aff preimage_domain_wrapped_domain(const isl::union_pw_multi_aff &upma2) const;
  3582. inline isl::union_pw_aff pullback(isl::union_pw_multi_aff upma) const;
  3583. inline isl::pw_multi_aff_list pw_multi_aff_list() const;
  3584. inline isl::union_pw_multi_aff range_factor_domain() const;
  3585. inline isl::union_pw_multi_aff range_factor_range() const;
  3586. inline isl::multi_union_pw_aff range_product(const isl::multi_union_pw_aff &multi2) const;
  3587. inline isl::union_pw_multi_aff range_product(const isl::union_pw_multi_aff &upma2) const;
  3588. inline isl::id range_tuple_id() const;
  3589. inline isl::multi_union_pw_aff reset_range_tuple_id() const;
  3590. inline isl::multi_union_pw_aff scale(const isl::multi_val &mv) const;
  3591. inline isl::multi_union_pw_aff scale(const isl::val &v) const;
  3592. inline isl::multi_union_pw_aff scale(long v) const;
  3593. inline isl::multi_union_pw_aff scale_down(const isl::multi_val &mv) const;
  3594. inline isl::multi_union_pw_aff scale_down(const isl::val &v) const;
  3595. inline isl::multi_union_pw_aff scale_down(long v) const;
  3596. inline isl::multi_union_pw_aff set_at(int pos, const isl::union_pw_aff &el) const;
  3597. inline isl::multi_union_pw_aff set_range_tuple(const isl::id &id) const;
  3598. inline isl::multi_union_pw_aff set_range_tuple(const std::string &id) const;
  3599. inline unsigned size() const;
  3600. inline isl::space space() const;
  3601. inline isl::space get_space() const;
  3602. inline isl::multi_union_pw_aff sub(const isl::multi_union_pw_aff &multi2) const;
  3603. inline isl::union_pw_aff sub(isl::union_pw_aff upa2) const;
  3604. inline isl::union_pw_multi_aff sub(const isl::union_pw_multi_aff &upma2) const;
  3605. inline isl::union_pw_aff sub(const isl::aff &upa2) const;
  3606. inline isl::union_pw_aff sub(const isl::pw_aff &upa2) const;
  3607. inline isl::union_pw_aff subtract_domain(isl::space space) const;
  3608. inline isl::union_pw_aff subtract_domain(isl::union_set uset) const;
  3609. inline isl::union_pw_aff_list to_list() const;
  3610. inline isl::multi_union_pw_aff union_add(const isl::multi_union_pw_aff &mupa2) const;
  3611. inline isl::union_pw_aff union_add(isl::union_pw_aff upa2) const;
  3612. inline isl::union_pw_multi_aff union_add(const isl::union_pw_multi_aff &upma2) const;
  3613. inline isl::union_pw_aff union_add(const isl::aff &upa2) const;
  3614. inline isl::union_pw_aff union_add(const isl::pw_aff &upa2) const;
  3615. };
  3616. // declarations for isl::union_pw_aff_list
  3617. inline union_pw_aff_list manage(__isl_take isl_union_pw_aff_list *ptr);
  3618. inline union_pw_aff_list manage_copy(__isl_keep isl_union_pw_aff_list *ptr);
  3619. class union_pw_aff_list {
  3620. friend inline union_pw_aff_list manage(__isl_take isl_union_pw_aff_list *ptr);
  3621. friend inline union_pw_aff_list manage_copy(__isl_keep isl_union_pw_aff_list *ptr);
  3622. protected:
  3623. isl_union_pw_aff_list *ptr = nullptr;
  3624. inline explicit union_pw_aff_list(__isl_take isl_union_pw_aff_list *ptr);
  3625. public:
  3626. inline /* implicit */ union_pw_aff_list();
  3627. inline /* implicit */ union_pw_aff_list(const union_pw_aff_list &obj);
  3628. inline explicit union_pw_aff_list(isl::ctx ctx, int n);
  3629. inline explicit union_pw_aff_list(isl::union_pw_aff el);
  3630. inline explicit union_pw_aff_list(isl::ctx ctx, const std::string &str);
  3631. inline union_pw_aff_list &operator=(union_pw_aff_list obj);
  3632. inline ~union_pw_aff_list();
  3633. inline __isl_give isl_union_pw_aff_list *copy() const &;
  3634. inline __isl_give isl_union_pw_aff_list *copy() && = delete;
  3635. inline __isl_keep isl_union_pw_aff_list *get() const;
  3636. inline __isl_give isl_union_pw_aff_list *release();
  3637. inline bool is_null() const;
  3638. inline isl::ctx ctx() const;
  3639. inline isl::union_pw_aff_list add(isl::union_pw_aff el) const;
  3640. inline isl::union_pw_aff at(int index) const;
  3641. inline isl::union_pw_aff get_at(int index) const;
  3642. inline isl::union_pw_aff_list clear() const;
  3643. inline isl::union_pw_aff_list concat(isl::union_pw_aff_list list2) const;
  3644. inline isl::union_pw_aff_list drop(unsigned int first, unsigned int n) const;
  3645. inline void foreach(const std::function<void(isl::union_pw_aff)> &fn) const;
  3646. inline void foreach_scc(const std::function<bool(isl::union_pw_aff, isl::union_pw_aff)> &follows, const std::function<void(isl::union_pw_aff_list)> &fn) const;
  3647. inline isl::union_pw_aff_list insert(unsigned int pos, isl::union_pw_aff el) const;
  3648. inline unsigned size() const;
  3649. };
  3650. // declarations for isl::union_pw_multi_aff
  3651. inline union_pw_multi_aff manage(__isl_take isl_union_pw_multi_aff *ptr);
  3652. inline union_pw_multi_aff manage_copy(__isl_keep isl_union_pw_multi_aff *ptr);
  3653. class union_pw_multi_aff {
  3654. friend inline union_pw_multi_aff manage(__isl_take isl_union_pw_multi_aff *ptr);
  3655. friend inline union_pw_multi_aff manage_copy(__isl_keep isl_union_pw_multi_aff *ptr);
  3656. protected:
  3657. isl_union_pw_multi_aff *ptr = nullptr;
  3658. inline explicit union_pw_multi_aff(__isl_take isl_union_pw_multi_aff *ptr);
  3659. public:
  3660. inline /* implicit */ union_pw_multi_aff();
  3661. inline /* implicit */ union_pw_multi_aff(const union_pw_multi_aff &obj);
  3662. inline /* implicit */ union_pw_multi_aff(isl::multi_aff ma);
  3663. inline /* implicit */ union_pw_multi_aff(isl::pw_multi_aff pma);
  3664. inline /* implicit */ union_pw_multi_aff(isl::union_pw_aff upa);
  3665. inline explicit union_pw_multi_aff(isl::ctx ctx, const std::string &str);
  3666. inline union_pw_multi_aff &operator=(union_pw_multi_aff obj);
  3667. inline ~union_pw_multi_aff();
  3668. inline __isl_give isl_union_pw_multi_aff *copy() const &;
  3669. inline __isl_give isl_union_pw_multi_aff *copy() && = delete;
  3670. inline __isl_keep isl_union_pw_multi_aff *get() const;
  3671. inline __isl_give isl_union_pw_multi_aff *release();
  3672. inline bool is_null() const;
  3673. inline isl::ctx ctx() const;
  3674. inline isl::union_pw_multi_aff add(isl::union_pw_multi_aff upma2) const;
  3675. inline isl::union_pw_multi_aff apply(isl::union_pw_multi_aff upma2) const;
  3676. inline isl::multi_union_pw_aff as_multi_union_pw_aff() const;
  3677. inline isl::pw_multi_aff as_pw_multi_aff() const;
  3678. inline isl::union_map as_union_map() const;
  3679. inline isl::union_pw_multi_aff coalesce() const;
  3680. inline isl::union_set domain() const;
  3681. static inline isl::union_pw_multi_aff empty(isl::ctx ctx);
  3682. inline isl::pw_multi_aff extract_pw_multi_aff(isl::space space) const;
  3683. inline isl::union_pw_multi_aff flat_range_product(isl::union_pw_multi_aff upma2) const;
  3684. inline isl::union_pw_multi_aff gist(isl::union_set context) const;
  3685. inline isl::union_pw_multi_aff intersect_domain(isl::space space) const;
  3686. inline isl::union_pw_multi_aff intersect_domain(isl::union_set uset) const;
  3687. inline isl::union_pw_multi_aff intersect_domain_wrapped_domain(isl::union_set uset) const;
  3688. inline isl::union_pw_multi_aff intersect_domain_wrapped_range(isl::union_set uset) const;
  3689. inline isl::union_pw_multi_aff intersect_params(isl::set set) const;
  3690. inline bool involves_locals() const;
  3691. inline bool isa_pw_multi_aff() const;
  3692. inline bool plain_is_empty() const;
  3693. inline isl::union_pw_multi_aff preimage_domain_wrapped_domain(isl::union_pw_multi_aff upma2) const;
  3694. inline isl::union_pw_multi_aff pullback(isl::union_pw_multi_aff upma2) const;
  3695. inline isl::pw_multi_aff_list pw_multi_aff_list() const;
  3696. inline isl::pw_multi_aff_list get_pw_multi_aff_list() const;
  3697. inline isl::union_pw_multi_aff range_factor_domain() const;
  3698. inline isl::union_pw_multi_aff range_factor_range() const;
  3699. inline isl::union_pw_multi_aff range_product(isl::union_pw_multi_aff upma2) const;
  3700. inline isl::space space() const;
  3701. inline isl::space get_space() const;
  3702. inline isl::union_pw_multi_aff sub(isl::union_pw_multi_aff upma2) const;
  3703. inline isl::union_pw_multi_aff subtract_domain(isl::space space) const;
  3704. inline isl::union_pw_multi_aff subtract_domain(isl::union_set uset) const;
  3705. inline isl::union_pw_multi_aff union_add(isl::union_pw_multi_aff upma2) const;
  3706. };
  3707. // declarations for isl::union_set
  3708. inline union_set manage(__isl_take isl_union_set *ptr);
  3709. inline union_set manage_copy(__isl_keep isl_union_set *ptr);
  3710. class union_set {
  3711. friend inline union_set manage(__isl_take isl_union_set *ptr);
  3712. friend inline union_set manage_copy(__isl_keep isl_union_set *ptr);
  3713. protected:
  3714. isl_union_set *ptr = nullptr;
  3715. inline explicit union_set(__isl_take isl_union_set *ptr);
  3716. public:
  3717. inline /* implicit */ union_set();
  3718. inline /* implicit */ union_set(const union_set &obj);
  3719. inline /* implicit */ union_set(isl::basic_set bset);
  3720. inline /* implicit */ union_set(isl::point pnt);
  3721. inline /* implicit */ union_set(isl::set set);
  3722. inline explicit union_set(isl::ctx ctx, const std::string &str);
  3723. inline union_set &operator=(union_set obj);
  3724. inline ~union_set();
  3725. inline __isl_give isl_union_set *copy() const &;
  3726. inline __isl_give isl_union_set *copy() && = delete;
  3727. inline __isl_keep isl_union_set *get() const;
  3728. inline __isl_give isl_union_set *release();
  3729. inline bool is_null() const;
  3730. inline isl::ctx ctx() const;
  3731. inline isl::union_set affine_hull() const;
  3732. inline isl::union_set apply(isl::union_map umap) const;
  3733. inline isl::set as_set() const;
  3734. inline isl::union_set coalesce() const;
  3735. inline isl::union_set compute_divs() const;
  3736. inline isl::union_set detect_equalities() const;
  3737. static inline isl::union_set empty(isl::ctx ctx);
  3738. inline bool every_set(const std::function<bool(isl::set)> &test) const;
  3739. inline isl::set extract_set(isl::space space) const;
  3740. inline void foreach_point(const std::function<void(isl::point)> &fn) const;
  3741. inline void foreach_set(const std::function<void(isl::set)> &fn) const;
  3742. inline isl::union_set gist(isl::union_set context) const;
  3743. inline isl::union_set gist_params(isl::set set) const;
  3744. inline isl::union_map identity() const;
  3745. inline isl::union_set intersect(isl::union_set uset2) const;
  3746. inline isl::union_set intersect_params(isl::set set) const;
  3747. inline bool is_disjoint(const isl::union_set &uset2) const;
  3748. inline bool is_empty() const;
  3749. inline bool is_equal(const isl::union_set &uset2) const;
  3750. inline bool is_strict_subset(const isl::union_set &uset2) const;
  3751. inline bool is_subset(const isl::union_set &uset2) const;
  3752. inline bool isa_set() const;
  3753. inline isl::union_set lexmax() const;
  3754. inline isl::union_set lexmin() const;
  3755. inline isl::union_set polyhedral_hull() const;
  3756. inline isl::union_set preimage(isl::multi_aff ma) const;
  3757. inline isl::union_set preimage(isl::pw_multi_aff pma) const;
  3758. inline isl::union_set preimage(isl::union_pw_multi_aff upma) const;
  3759. inline isl::point sample_point() const;
  3760. inline isl::set_list set_list() const;
  3761. inline isl::set_list get_set_list() const;
  3762. inline isl::space space() const;
  3763. inline isl::space get_space() const;
  3764. inline isl::union_set subtract(isl::union_set uset2) const;
  3765. inline isl::union_set_list to_list() const;
  3766. inline isl::union_set unite(isl::union_set uset2) const;
  3767. inline isl::union_set universe() const;
  3768. inline isl::union_map unwrap() const;
  3769. };
  3770. // declarations for isl::union_set_list
  3771. inline union_set_list manage(__isl_take isl_union_set_list *ptr);
  3772. inline union_set_list manage_copy(__isl_keep isl_union_set_list *ptr);
  3773. class union_set_list {
  3774. friend inline union_set_list manage(__isl_take isl_union_set_list *ptr);
  3775. friend inline union_set_list manage_copy(__isl_keep isl_union_set_list *ptr);
  3776. protected:
  3777. isl_union_set_list *ptr = nullptr;
  3778. inline explicit union_set_list(__isl_take isl_union_set_list *ptr);
  3779. public:
  3780. inline /* implicit */ union_set_list();
  3781. inline /* implicit */ union_set_list(const union_set_list &obj);
  3782. inline explicit union_set_list(isl::ctx ctx, int n);
  3783. inline explicit union_set_list(isl::union_set el);
  3784. inline explicit union_set_list(isl::ctx ctx, const std::string &str);
  3785. inline union_set_list &operator=(union_set_list obj);
  3786. inline ~union_set_list();
  3787. inline __isl_give isl_union_set_list *copy() const &;
  3788. inline __isl_give isl_union_set_list *copy() && = delete;
  3789. inline __isl_keep isl_union_set_list *get() const;
  3790. inline __isl_give isl_union_set_list *release();
  3791. inline bool is_null() const;
  3792. inline isl::ctx ctx() const;
  3793. inline isl::union_set_list add(isl::union_set el) const;
  3794. inline isl::union_set at(int index) const;
  3795. inline isl::union_set get_at(int index) const;
  3796. inline isl::union_set_list clear() const;
  3797. inline isl::union_set_list concat(isl::union_set_list list2) const;
  3798. inline isl::union_set_list drop(unsigned int first, unsigned int n) const;
  3799. inline void foreach(const std::function<void(isl::union_set)> &fn) const;
  3800. inline void foreach_scc(const std::function<bool(isl::union_set, isl::union_set)> &follows, const std::function<void(isl::union_set_list)> &fn) const;
  3801. inline isl::union_set_list insert(unsigned int pos, isl::union_set el) const;
  3802. inline unsigned size() const;
  3803. };
  3804. // declarations for isl::val
  3805. inline val manage(__isl_take isl_val *ptr);
  3806. inline val manage_copy(__isl_keep isl_val *ptr);
  3807. class val {
  3808. friend inline val manage(__isl_take isl_val *ptr);
  3809. friend inline val manage_copy(__isl_keep isl_val *ptr);
  3810. protected:
  3811. isl_val *ptr = nullptr;
  3812. inline explicit val(__isl_take isl_val *ptr);
  3813. public:
  3814. inline /* implicit */ val();
  3815. inline /* implicit */ val(const val &obj);
  3816. inline explicit val(isl::ctx ctx, long i);
  3817. inline explicit val(isl::ctx ctx, const std::string &str);
  3818. inline val &operator=(val obj);
  3819. inline ~val();
  3820. inline __isl_give isl_val *copy() const &;
  3821. inline __isl_give isl_val *copy() && = delete;
  3822. inline __isl_keep isl_val *get() const;
  3823. inline __isl_give isl_val *release();
  3824. inline bool is_null() const;
  3825. inline isl::ctx ctx() const;
  3826. inline isl::val abs() const;
  3827. inline bool abs_eq(const isl::val &v2) const;
  3828. inline bool abs_eq(long v2) const;
  3829. inline isl::val add(isl::val v2) const;
  3830. inline isl::val add(long v2) const;
  3831. inline isl::val ceil() const;
  3832. inline int cmp_si(long i) const;
  3833. inline long den_si() const;
  3834. inline long get_den_si() const;
  3835. inline isl::val div(isl::val v2) const;
  3836. inline isl::val div(long v2) const;
  3837. inline bool eq(const isl::val &v2) const;
  3838. inline bool eq(long v2) const;
  3839. inline isl::val floor() const;
  3840. inline isl::val gcd(isl::val v2) const;
  3841. inline isl::val gcd(long v2) const;
  3842. inline bool ge(const isl::val &v2) const;
  3843. inline bool ge(long v2) const;
  3844. inline bool gt(const isl::val &v2) const;
  3845. inline bool gt(long v2) const;
  3846. static inline isl::val infty(isl::ctx ctx);
  3847. inline isl::val inv() const;
  3848. inline bool is_divisible_by(const isl::val &v2) const;
  3849. inline bool is_divisible_by(long v2) const;
  3850. inline bool is_infty() const;
  3851. inline bool is_int() const;
  3852. inline bool is_nan() const;
  3853. inline bool is_neg() const;
  3854. inline bool is_neginfty() const;
  3855. inline bool is_negone() const;
  3856. inline bool is_nonneg() const;
  3857. inline bool is_nonpos() const;
  3858. inline bool is_one() const;
  3859. inline bool is_pos() const;
  3860. inline bool is_rat() const;
  3861. inline bool is_zero() const;
  3862. inline bool le(const isl::val &v2) const;
  3863. inline bool le(long v2) const;
  3864. inline bool lt(const isl::val &v2) const;
  3865. inline bool lt(long v2) const;
  3866. inline isl::val max(isl::val v2) const;
  3867. inline isl::val max(long v2) const;
  3868. inline isl::val min(isl::val v2) const;
  3869. inline isl::val min(long v2) const;
  3870. inline isl::val mod(isl::val v2) const;
  3871. inline isl::val mod(long v2) const;
  3872. inline isl::val mul(isl::val v2) const;
  3873. inline isl::val mul(long v2) const;
  3874. static inline isl::val nan(isl::ctx ctx);
  3875. inline bool ne(const isl::val &v2) const;
  3876. inline bool ne(long v2) const;
  3877. inline isl::val neg() const;
  3878. static inline isl::val neginfty(isl::ctx ctx);
  3879. static inline isl::val negone(isl::ctx ctx);
  3880. inline long num_si() const;
  3881. inline long get_num_si() const;
  3882. static inline isl::val one(isl::ctx ctx);
  3883. inline isl::val pow2() const;
  3884. inline int sgn() const;
  3885. inline isl::val sub(isl::val v2) const;
  3886. inline isl::val sub(long v2) const;
  3887. inline isl::val_list to_list() const;
  3888. inline isl::val trunc() const;
  3889. static inline isl::val zero(isl::ctx ctx);
  3890. };
  3891. // declarations for isl::val_list
  3892. inline val_list manage(__isl_take isl_val_list *ptr);
  3893. inline val_list manage_copy(__isl_keep isl_val_list *ptr);
  3894. class val_list {
  3895. friend inline val_list manage(__isl_take isl_val_list *ptr);
  3896. friend inline val_list manage_copy(__isl_keep isl_val_list *ptr);
  3897. protected:
  3898. isl_val_list *ptr = nullptr;
  3899. inline explicit val_list(__isl_take isl_val_list *ptr);
  3900. public:
  3901. inline /* implicit */ val_list();
  3902. inline /* implicit */ val_list(const val_list &obj);
  3903. inline explicit val_list(isl::ctx ctx, int n);
  3904. inline explicit val_list(isl::val el);
  3905. inline explicit val_list(isl::ctx ctx, const std::string &str);
  3906. inline val_list &operator=(val_list obj);
  3907. inline ~val_list();
  3908. inline __isl_give isl_val_list *copy() const &;
  3909. inline __isl_give isl_val_list *copy() && = delete;
  3910. inline __isl_keep isl_val_list *get() const;
  3911. inline __isl_give isl_val_list *release();
  3912. inline bool is_null() const;
  3913. inline isl::ctx ctx() const;
  3914. inline isl::val_list add(isl::val el) const;
  3915. inline isl::val_list add(long el) const;
  3916. inline isl::val at(int index) const;
  3917. inline isl::val get_at(int index) const;
  3918. inline isl::val_list clear() const;
  3919. inline isl::val_list concat(isl::val_list list2) const;
  3920. inline isl::val_list drop(unsigned int first, unsigned int n) const;
  3921. inline void foreach(const std::function<void(isl::val)> &fn) const;
  3922. inline void foreach_scc(const std::function<bool(isl::val, isl::val)> &follows, const std::function<void(isl::val_list)> &fn) const;
  3923. inline isl::val_list insert(unsigned int pos, isl::val el) const;
  3924. inline isl::val_list insert(unsigned int pos, long el) const;
  3925. inline unsigned size() const;
  3926. };
  3927. // implementations for isl::aff
  3928. aff manage(__isl_take isl_aff *ptr) {
  3929. if (!ptr)
  3930. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  3931. return aff(ptr);
  3932. }
  3933. aff manage_copy(__isl_keep isl_aff *ptr) {
  3934. if (!ptr)
  3935. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  3936. auto saved_ctx = isl_aff_get_ctx(ptr);
  3937. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  3938. ptr = isl_aff_copy(ptr);
  3939. if (!ptr)
  3940. exception::throw_last_error(saved_ctx);
  3941. return aff(ptr);
  3942. }
  3943. aff::aff(__isl_take isl_aff *ptr)
  3944. : ptr(ptr) {}
  3945. aff::aff()
  3946. : ptr(nullptr) {}
  3947. aff::aff(const aff &obj)
  3948. : ptr(nullptr)
  3949. {
  3950. if (!obj.ptr)
  3951. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  3952. auto saved_ctx = isl_aff_get_ctx(obj.ptr);
  3953. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  3954. ptr = obj.copy();
  3955. if (!ptr)
  3956. exception::throw_last_error(saved_ctx);
  3957. }
  3958. aff::aff(isl::ctx ctx, const std::string &str)
  3959. {
  3960. auto saved_ctx = ctx;
  3961. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  3962. auto res = isl_aff_read_from_str(ctx.release(), str.c_str());
  3963. if (!res)
  3964. exception::throw_last_error(saved_ctx);
  3965. ptr = res;
  3966. }
  3967. aff &aff::operator=(aff obj) {
  3968. std::swap(this->ptr, obj.ptr);
  3969. return *this;
  3970. }
  3971. aff::~aff() {
  3972. if (ptr)
  3973. isl_aff_free(ptr);
  3974. }
  3975. __isl_give isl_aff *aff::copy() const & {
  3976. return isl_aff_copy(ptr);
  3977. }
  3978. __isl_keep isl_aff *aff::get() const {
  3979. return ptr;
  3980. }
  3981. __isl_give isl_aff *aff::release() {
  3982. isl_aff *tmp = ptr;
  3983. ptr = nullptr;
  3984. return tmp;
  3985. }
  3986. bool aff::is_null() const {
  3987. return ptr == nullptr;
  3988. }
  3989. isl::ctx aff::ctx() const {
  3990. return isl::ctx(isl_aff_get_ctx(ptr));
  3991. }
  3992. isl::aff aff::add(isl::aff aff2) const
  3993. {
  3994. if (!ptr || aff2.is_null())
  3995. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  3996. auto saved_ctx = ctx();
  3997. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  3998. auto res = isl_aff_add(copy(), aff2.release());
  3999. if (!res)
  4000. exception::throw_last_error(saved_ctx);
  4001. return manage(res);
  4002. }
  4003. isl::multi_aff aff::add(const isl::multi_aff &multi2) const
  4004. {
  4005. if (!ptr)
  4006. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4007. return isl::multi_aff(*this).add(multi2);
  4008. }
  4009. isl::multi_pw_aff aff::add(const isl::multi_pw_aff &multi2) const
  4010. {
  4011. if (!ptr)
  4012. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4013. return isl::pw_aff(*this).add(multi2);
  4014. }
  4015. isl::multi_union_pw_aff aff::add(const isl::multi_union_pw_aff &multi2) const
  4016. {
  4017. if (!ptr)
  4018. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4019. return isl::pw_aff(*this).add(multi2);
  4020. }
  4021. isl::pw_aff aff::add(const isl::pw_aff &pwaff2) const
  4022. {
  4023. if (!ptr)
  4024. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4025. return isl::pw_aff(*this).add(pwaff2);
  4026. }
  4027. isl::pw_multi_aff aff::add(const isl::pw_multi_aff &pma2) const
  4028. {
  4029. if (!ptr)
  4030. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4031. return isl::pw_aff(*this).add(pma2);
  4032. }
  4033. isl::union_pw_aff aff::add(const isl::union_pw_aff &upa2) const
  4034. {
  4035. if (!ptr)
  4036. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4037. return isl::pw_aff(*this).add(upa2);
  4038. }
  4039. isl::union_pw_multi_aff aff::add(const isl::union_pw_multi_aff &upma2) const
  4040. {
  4041. if (!ptr)
  4042. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4043. return isl::pw_aff(*this).add(upma2);
  4044. }
  4045. isl::aff aff::add_constant(isl::val v) const
  4046. {
  4047. if (!ptr || v.is_null())
  4048. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4049. auto saved_ctx = ctx();
  4050. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  4051. auto res = isl_aff_add_constant_val(copy(), v.release());
  4052. if (!res)
  4053. exception::throw_last_error(saved_ctx);
  4054. return manage(res);
  4055. }
  4056. isl::aff aff::add_constant(long v) const
  4057. {
  4058. if (!ptr)
  4059. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4060. return this->add_constant(isl::val(ctx(), v));
  4061. }
  4062. isl::multi_aff aff::add_constant(const isl::multi_val &mv) const
  4063. {
  4064. if (!ptr)
  4065. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4066. return isl::multi_aff(*this).add_constant(mv);
  4067. }
  4068. isl::union_pw_multi_aff aff::apply(const isl::union_pw_multi_aff &upma2) const
  4069. {
  4070. if (!ptr)
  4071. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4072. return isl::pw_aff(*this).apply(upma2);
  4073. }
  4074. isl::aff aff::as_aff() const
  4075. {
  4076. if (!ptr)
  4077. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4078. return isl::pw_aff(*this).as_aff();
  4079. }
  4080. isl::map aff::as_map() const
  4081. {
  4082. if (!ptr)
  4083. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4084. return isl::pw_aff(*this).as_map();
  4085. }
  4086. isl::multi_aff aff::as_multi_aff() const
  4087. {
  4088. if (!ptr)
  4089. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4090. return isl::pw_aff(*this).as_multi_aff();
  4091. }
  4092. isl::multi_union_pw_aff aff::as_multi_union_pw_aff() const
  4093. {
  4094. if (!ptr)
  4095. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4096. return isl::pw_aff(*this).as_multi_union_pw_aff();
  4097. }
  4098. isl::pw_multi_aff aff::as_pw_multi_aff() const
  4099. {
  4100. if (!ptr)
  4101. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4102. return isl::pw_aff(*this).as_pw_multi_aff();
  4103. }
  4104. isl::set aff::as_set() const
  4105. {
  4106. if (!ptr)
  4107. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4108. return isl::multi_aff(*this).as_set();
  4109. }
  4110. isl::union_map aff::as_union_map() const
  4111. {
  4112. if (!ptr)
  4113. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4114. return isl::pw_aff(*this).as_union_map();
  4115. }
  4116. isl::aff aff::at(int pos) const
  4117. {
  4118. if (!ptr)
  4119. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4120. return isl::multi_aff(*this).at(pos);
  4121. }
  4122. isl::basic_set aff::bind(isl::id id) const
  4123. {
  4124. if (!ptr || id.is_null())
  4125. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4126. auto saved_ctx = ctx();
  4127. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  4128. auto res = isl_aff_bind_id(copy(), id.release());
  4129. if (!res)
  4130. exception::throw_last_error(saved_ctx);
  4131. return manage(res);
  4132. }
  4133. isl::basic_set aff::bind(const std::string &id) const
  4134. {
  4135. if (!ptr)
  4136. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4137. return this->bind(isl::id(ctx(), id));
  4138. }
  4139. isl::basic_set aff::bind(const isl::multi_id &tuple) const
  4140. {
  4141. if (!ptr)
  4142. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4143. return isl::multi_aff(*this).bind(tuple);
  4144. }
  4145. isl::pw_aff aff::bind_domain(const isl::multi_id &tuple) const
  4146. {
  4147. if (!ptr)
  4148. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4149. return isl::pw_aff(*this).bind_domain(tuple);
  4150. }
  4151. isl::pw_aff aff::bind_domain_wrapped_domain(const isl::multi_id &tuple) const
  4152. {
  4153. if (!ptr)
  4154. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4155. return isl::pw_aff(*this).bind_domain_wrapped_domain(tuple);
  4156. }
  4157. isl::aff aff::ceil() const
  4158. {
  4159. if (!ptr)
  4160. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4161. auto saved_ctx = ctx();
  4162. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  4163. auto res = isl_aff_ceil(copy());
  4164. if (!res)
  4165. exception::throw_last_error(saved_ctx);
  4166. return manage(res);
  4167. }
  4168. isl::pw_aff aff::coalesce() const
  4169. {
  4170. if (!ptr)
  4171. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4172. return isl::pw_aff(*this).coalesce();
  4173. }
  4174. isl::pw_aff aff::cond(const isl::pw_aff &pwaff_true, const isl::pw_aff &pwaff_false) const
  4175. {
  4176. if (!ptr)
  4177. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4178. return isl::pw_aff(*this).cond(pwaff_true, pwaff_false);
  4179. }
  4180. isl::multi_val aff::constant_multi_val() const
  4181. {
  4182. if (!ptr)
  4183. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4184. return isl::multi_aff(*this).constant_multi_val();
  4185. }
  4186. isl::val aff::constant_val() const
  4187. {
  4188. if (!ptr)
  4189. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4190. auto saved_ctx = ctx();
  4191. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  4192. auto res = isl_aff_get_constant_val(get());
  4193. if (!res)
  4194. exception::throw_last_error(saved_ctx);
  4195. return manage(res);
  4196. }
  4197. isl::val aff::get_constant_val() const
  4198. {
  4199. return constant_val();
  4200. }
  4201. isl::aff aff::div(isl::aff aff2) const
  4202. {
  4203. if (!ptr || aff2.is_null())
  4204. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4205. auto saved_ctx = ctx();
  4206. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  4207. auto res = isl_aff_div(copy(), aff2.release());
  4208. if (!res)
  4209. exception::throw_last_error(saved_ctx);
  4210. return manage(res);
  4211. }
  4212. isl::pw_aff aff::div(const isl::pw_aff &pa2) const
  4213. {
  4214. if (!ptr)
  4215. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4216. return isl::pw_aff(*this).div(pa2);
  4217. }
  4218. isl::set aff::domain() const
  4219. {
  4220. if (!ptr)
  4221. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4222. return isl::pw_aff(*this).domain();
  4223. }
  4224. isl::set aff::eq_set(isl::aff aff2) const
  4225. {
  4226. if (!ptr || aff2.is_null())
  4227. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4228. auto saved_ctx = ctx();
  4229. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  4230. auto res = isl_aff_eq_set(copy(), aff2.release());
  4231. if (!res)
  4232. exception::throw_last_error(saved_ctx);
  4233. return manage(res);
  4234. }
  4235. isl::set aff::eq_set(const isl::pw_aff &pwaff2) const
  4236. {
  4237. if (!ptr)
  4238. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4239. return isl::pw_aff(*this).eq_set(pwaff2);
  4240. }
  4241. isl::val aff::eval(isl::point pnt) const
  4242. {
  4243. if (!ptr || pnt.is_null())
  4244. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4245. auto saved_ctx = ctx();
  4246. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  4247. auto res = isl_aff_eval(copy(), pnt.release());
  4248. if (!res)
  4249. exception::throw_last_error(saved_ctx);
  4250. return manage(res);
  4251. }
  4252. isl::pw_multi_aff aff::extract_pw_multi_aff(const isl::space &space) const
  4253. {
  4254. if (!ptr)
  4255. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4256. return isl::pw_aff(*this).extract_pw_multi_aff(space);
  4257. }
  4258. isl::multi_aff aff::flat_range_product(const isl::multi_aff &multi2) const
  4259. {
  4260. if (!ptr)
  4261. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4262. return isl::multi_aff(*this).flat_range_product(multi2);
  4263. }
  4264. isl::multi_pw_aff aff::flat_range_product(const isl::multi_pw_aff &multi2) const
  4265. {
  4266. if (!ptr)
  4267. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4268. return isl::pw_aff(*this).flat_range_product(multi2);
  4269. }
  4270. isl::multi_union_pw_aff aff::flat_range_product(const isl::multi_union_pw_aff &multi2) const
  4271. {
  4272. if (!ptr)
  4273. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4274. return isl::pw_aff(*this).flat_range_product(multi2);
  4275. }
  4276. isl::pw_multi_aff aff::flat_range_product(const isl::pw_multi_aff &pma2) const
  4277. {
  4278. if (!ptr)
  4279. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4280. return isl::pw_aff(*this).flat_range_product(pma2);
  4281. }
  4282. isl::union_pw_multi_aff aff::flat_range_product(const isl::union_pw_multi_aff &upma2) const
  4283. {
  4284. if (!ptr)
  4285. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4286. return isl::pw_aff(*this).flat_range_product(upma2);
  4287. }
  4288. isl::aff aff::floor() const
  4289. {
  4290. if (!ptr)
  4291. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4292. auto saved_ctx = ctx();
  4293. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  4294. auto res = isl_aff_floor(copy());
  4295. if (!res)
  4296. exception::throw_last_error(saved_ctx);
  4297. return manage(res);
  4298. }
  4299. void aff::foreach_piece(const std::function<void(isl::set, isl::multi_aff)> &fn) const
  4300. {
  4301. if (!ptr)
  4302. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4303. return isl::pw_aff(*this).foreach_piece(fn);
  4304. }
  4305. isl::set aff::ge_set(isl::aff aff2) const
  4306. {
  4307. if (!ptr || aff2.is_null())
  4308. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4309. auto saved_ctx = ctx();
  4310. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  4311. auto res = isl_aff_ge_set(copy(), aff2.release());
  4312. if (!res)
  4313. exception::throw_last_error(saved_ctx);
  4314. return manage(res);
  4315. }
  4316. isl::set aff::ge_set(const isl::pw_aff &pwaff2) const
  4317. {
  4318. if (!ptr)
  4319. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4320. return isl::pw_aff(*this).ge_set(pwaff2);
  4321. }
  4322. isl::aff aff::gist(isl::set context) const
  4323. {
  4324. if (!ptr || context.is_null())
  4325. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4326. auto saved_ctx = ctx();
  4327. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  4328. auto res = isl_aff_gist(copy(), context.release());
  4329. if (!res)
  4330. exception::throw_last_error(saved_ctx);
  4331. return manage(res);
  4332. }
  4333. isl::union_pw_aff aff::gist(const isl::union_set &context) const
  4334. {
  4335. if (!ptr)
  4336. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4337. return isl::pw_aff(*this).gist(context);
  4338. }
  4339. isl::aff aff::gist(const isl::basic_set &context) const
  4340. {
  4341. if (!ptr)
  4342. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4343. return this->gist(isl::set(context));
  4344. }
  4345. isl::aff aff::gist(const isl::point &context) const
  4346. {
  4347. if (!ptr)
  4348. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4349. return this->gist(isl::set(context));
  4350. }
  4351. isl::aff aff::gist_params(isl::set context) const
  4352. {
  4353. if (!ptr || context.is_null())
  4354. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4355. auto saved_ctx = ctx();
  4356. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  4357. auto res = isl_aff_gist_params(copy(), context.release());
  4358. if (!res)
  4359. exception::throw_last_error(saved_ctx);
  4360. return manage(res);
  4361. }
  4362. isl::set aff::gt_set(isl::aff aff2) const
  4363. {
  4364. if (!ptr || aff2.is_null())
  4365. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4366. auto saved_ctx = ctx();
  4367. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  4368. auto res = isl_aff_gt_set(copy(), aff2.release());
  4369. if (!res)
  4370. exception::throw_last_error(saved_ctx);
  4371. return manage(res);
  4372. }
  4373. isl::set aff::gt_set(const isl::pw_aff &pwaff2) const
  4374. {
  4375. if (!ptr)
  4376. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4377. return isl::pw_aff(*this).gt_set(pwaff2);
  4378. }
  4379. bool aff::has_range_tuple_id() const
  4380. {
  4381. if (!ptr)
  4382. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4383. return isl::multi_aff(*this).has_range_tuple_id();
  4384. }
  4385. isl::multi_aff aff::identity() const
  4386. {
  4387. if (!ptr)
  4388. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4389. return isl::multi_aff(*this).identity();
  4390. }
  4391. isl::pw_aff aff::insert_domain(const isl::space &domain) const
  4392. {
  4393. if (!ptr)
  4394. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4395. return isl::pw_aff(*this).insert_domain(domain);
  4396. }
  4397. isl::pw_aff aff::intersect_domain(const isl::set &set) const
  4398. {
  4399. if (!ptr)
  4400. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4401. return isl::pw_aff(*this).intersect_domain(set);
  4402. }
  4403. isl::union_pw_aff aff::intersect_domain(const isl::space &space) const
  4404. {
  4405. if (!ptr)
  4406. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4407. return isl::pw_aff(*this).intersect_domain(space);
  4408. }
  4409. isl::union_pw_aff aff::intersect_domain(const isl::union_set &uset) const
  4410. {
  4411. if (!ptr)
  4412. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4413. return isl::pw_aff(*this).intersect_domain(uset);
  4414. }
  4415. isl::union_pw_aff aff::intersect_domain_wrapped_domain(const isl::union_set &uset) const
  4416. {
  4417. if (!ptr)
  4418. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4419. return isl::pw_aff(*this).intersect_domain_wrapped_domain(uset);
  4420. }
  4421. isl::union_pw_aff aff::intersect_domain_wrapped_range(const isl::union_set &uset) const
  4422. {
  4423. if (!ptr)
  4424. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4425. return isl::pw_aff(*this).intersect_domain_wrapped_range(uset);
  4426. }
  4427. isl::pw_aff aff::intersect_params(const isl::set &set) const
  4428. {
  4429. if (!ptr)
  4430. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4431. return isl::pw_aff(*this).intersect_params(set);
  4432. }
  4433. bool aff::involves_locals() const
  4434. {
  4435. if (!ptr)
  4436. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4437. return isl::multi_aff(*this).involves_locals();
  4438. }
  4439. bool aff::involves_nan() const
  4440. {
  4441. if (!ptr)
  4442. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4443. return isl::multi_aff(*this).involves_nan();
  4444. }
  4445. bool aff::involves_param(const isl::id &id) const
  4446. {
  4447. if (!ptr)
  4448. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4449. return isl::pw_aff(*this).involves_param(id);
  4450. }
  4451. bool aff::involves_param(const std::string &id) const
  4452. {
  4453. if (!ptr)
  4454. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4455. return this->involves_param(isl::id(ctx(), id));
  4456. }
  4457. bool aff::involves_param(const isl::id_list &list) const
  4458. {
  4459. if (!ptr)
  4460. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4461. return isl::pw_aff(*this).involves_param(list);
  4462. }
  4463. bool aff::is_cst() const
  4464. {
  4465. if (!ptr)
  4466. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4467. auto saved_ctx = ctx();
  4468. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  4469. auto res = isl_aff_is_cst(get());
  4470. if (res < 0)
  4471. exception::throw_last_error(saved_ctx);
  4472. return res;
  4473. }
  4474. bool aff::isa_aff() const
  4475. {
  4476. if (!ptr)
  4477. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4478. return isl::pw_aff(*this).isa_aff();
  4479. }
  4480. bool aff::isa_multi_aff() const
  4481. {
  4482. if (!ptr)
  4483. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4484. return isl::pw_aff(*this).isa_multi_aff();
  4485. }
  4486. bool aff::isa_pw_multi_aff() const
  4487. {
  4488. if (!ptr)
  4489. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4490. return isl::pw_aff(*this).isa_pw_multi_aff();
  4491. }
  4492. isl::set aff::le_set(isl::aff aff2) const
  4493. {
  4494. if (!ptr || aff2.is_null())
  4495. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4496. auto saved_ctx = ctx();
  4497. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  4498. auto res = isl_aff_le_set(copy(), aff2.release());
  4499. if (!res)
  4500. exception::throw_last_error(saved_ctx);
  4501. return manage(res);
  4502. }
  4503. isl::set aff::le_set(const isl::pw_aff &pwaff2) const
  4504. {
  4505. if (!ptr)
  4506. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4507. return isl::pw_aff(*this).le_set(pwaff2);
  4508. }
  4509. isl::aff_list aff::list() const
  4510. {
  4511. if (!ptr)
  4512. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4513. return isl::multi_aff(*this).list();
  4514. }
  4515. isl::set aff::lt_set(isl::aff aff2) const
  4516. {
  4517. if (!ptr || aff2.is_null())
  4518. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4519. auto saved_ctx = ctx();
  4520. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  4521. auto res = isl_aff_lt_set(copy(), aff2.release());
  4522. if (!res)
  4523. exception::throw_last_error(saved_ctx);
  4524. return manage(res);
  4525. }
  4526. isl::set aff::lt_set(const isl::pw_aff &pwaff2) const
  4527. {
  4528. if (!ptr)
  4529. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4530. return isl::pw_aff(*this).lt_set(pwaff2);
  4531. }
  4532. isl::multi_pw_aff aff::max(const isl::multi_pw_aff &multi2) const
  4533. {
  4534. if (!ptr)
  4535. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4536. return isl::pw_aff(*this).max(multi2);
  4537. }
  4538. isl::pw_aff aff::max(const isl::pw_aff &pwaff2) const
  4539. {
  4540. if (!ptr)
  4541. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4542. return isl::pw_aff(*this).max(pwaff2);
  4543. }
  4544. isl::multi_val aff::max_multi_val() const
  4545. {
  4546. if (!ptr)
  4547. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4548. return isl::pw_aff(*this).max_multi_val();
  4549. }
  4550. isl::val aff::max_val() const
  4551. {
  4552. if (!ptr)
  4553. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4554. return isl::pw_aff(*this).max_val();
  4555. }
  4556. isl::multi_pw_aff aff::min(const isl::multi_pw_aff &multi2) const
  4557. {
  4558. if (!ptr)
  4559. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4560. return isl::pw_aff(*this).min(multi2);
  4561. }
  4562. isl::pw_aff aff::min(const isl::pw_aff &pwaff2) const
  4563. {
  4564. if (!ptr)
  4565. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4566. return isl::pw_aff(*this).min(pwaff2);
  4567. }
  4568. isl::multi_val aff::min_multi_val() const
  4569. {
  4570. if (!ptr)
  4571. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4572. return isl::pw_aff(*this).min_multi_val();
  4573. }
  4574. isl::val aff::min_val() const
  4575. {
  4576. if (!ptr)
  4577. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4578. return isl::pw_aff(*this).min_val();
  4579. }
  4580. isl::aff aff::mod(isl::val mod) const
  4581. {
  4582. if (!ptr || mod.is_null())
  4583. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4584. auto saved_ctx = ctx();
  4585. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  4586. auto res = isl_aff_mod_val(copy(), mod.release());
  4587. if (!res)
  4588. exception::throw_last_error(saved_ctx);
  4589. return manage(res);
  4590. }
  4591. isl::aff aff::mod(long mod) const
  4592. {
  4593. if (!ptr)
  4594. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4595. return this->mod(isl::val(ctx(), mod));
  4596. }
  4597. isl::aff aff::mul(isl::aff aff2) const
  4598. {
  4599. if (!ptr || aff2.is_null())
  4600. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4601. auto saved_ctx = ctx();
  4602. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  4603. auto res = isl_aff_mul(copy(), aff2.release());
  4604. if (!res)
  4605. exception::throw_last_error(saved_ctx);
  4606. return manage(res);
  4607. }
  4608. isl::pw_aff aff::mul(const isl::pw_aff &pwaff2) const
  4609. {
  4610. if (!ptr)
  4611. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4612. return isl::pw_aff(*this).mul(pwaff2);
  4613. }
  4614. unsigned aff::n_piece() const
  4615. {
  4616. if (!ptr)
  4617. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4618. return isl::pw_aff(*this).n_piece();
  4619. }
  4620. isl::set aff::ne_set(isl::aff aff2) const
  4621. {
  4622. if (!ptr || aff2.is_null())
  4623. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4624. auto saved_ctx = ctx();
  4625. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  4626. auto res = isl_aff_ne_set(copy(), aff2.release());
  4627. if (!res)
  4628. exception::throw_last_error(saved_ctx);
  4629. return manage(res);
  4630. }
  4631. isl::set aff::ne_set(const isl::pw_aff &pwaff2) const
  4632. {
  4633. if (!ptr)
  4634. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4635. return isl::pw_aff(*this).ne_set(pwaff2);
  4636. }
  4637. isl::aff aff::neg() const
  4638. {
  4639. if (!ptr)
  4640. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4641. auto saved_ctx = ctx();
  4642. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  4643. auto res = isl_aff_neg(copy());
  4644. if (!res)
  4645. exception::throw_last_error(saved_ctx);
  4646. return manage(res);
  4647. }
  4648. bool aff::plain_is_empty() const
  4649. {
  4650. if (!ptr)
  4651. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4652. return isl::pw_aff(*this).plain_is_empty();
  4653. }
  4654. bool aff::plain_is_equal(const isl::multi_aff &multi2) const
  4655. {
  4656. if (!ptr)
  4657. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4658. return isl::multi_aff(*this).plain_is_equal(multi2);
  4659. }
  4660. bool aff::plain_is_equal(const isl::multi_pw_aff &multi2) const
  4661. {
  4662. if (!ptr)
  4663. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4664. return isl::pw_aff(*this).plain_is_equal(multi2);
  4665. }
  4666. bool aff::plain_is_equal(const isl::multi_union_pw_aff &multi2) const
  4667. {
  4668. if (!ptr)
  4669. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4670. return isl::pw_aff(*this).plain_is_equal(multi2);
  4671. }
  4672. isl::pw_multi_aff aff::preimage_domain_wrapped_domain(const isl::pw_multi_aff &pma2) const
  4673. {
  4674. if (!ptr)
  4675. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4676. return isl::pw_aff(*this).preimage_domain_wrapped_domain(pma2);
  4677. }
  4678. isl::union_pw_multi_aff aff::preimage_domain_wrapped_domain(const isl::union_pw_multi_aff &upma2) const
  4679. {
  4680. if (!ptr)
  4681. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4682. return isl::pw_aff(*this).preimage_domain_wrapped_domain(upma2);
  4683. }
  4684. isl::multi_aff aff::product(const isl::multi_aff &multi2) const
  4685. {
  4686. if (!ptr)
  4687. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4688. return isl::multi_aff(*this).product(multi2);
  4689. }
  4690. isl::multi_pw_aff aff::product(const isl::multi_pw_aff &multi2) const
  4691. {
  4692. if (!ptr)
  4693. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4694. return isl::pw_aff(*this).product(multi2);
  4695. }
  4696. isl::pw_multi_aff aff::product(const isl::pw_multi_aff &pma2) const
  4697. {
  4698. if (!ptr)
  4699. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4700. return isl::pw_aff(*this).product(pma2);
  4701. }
  4702. isl::aff aff::pullback(isl::multi_aff ma) const
  4703. {
  4704. if (!ptr || ma.is_null())
  4705. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4706. auto saved_ctx = ctx();
  4707. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  4708. auto res = isl_aff_pullback_multi_aff(copy(), ma.release());
  4709. if (!res)
  4710. exception::throw_last_error(saved_ctx);
  4711. return manage(res);
  4712. }
  4713. isl::pw_aff aff::pullback(const isl::multi_pw_aff &mpa) const
  4714. {
  4715. if (!ptr)
  4716. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4717. return isl::pw_aff(*this).pullback(mpa);
  4718. }
  4719. isl::pw_aff aff::pullback(const isl::pw_multi_aff &pma) const
  4720. {
  4721. if (!ptr)
  4722. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4723. return isl::pw_aff(*this).pullback(pma);
  4724. }
  4725. isl::union_pw_aff aff::pullback(const isl::union_pw_multi_aff &upma) const
  4726. {
  4727. if (!ptr)
  4728. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4729. return isl::pw_aff(*this).pullback(upma);
  4730. }
  4731. isl::aff aff::pullback(const isl::aff &ma) const
  4732. {
  4733. if (!ptr)
  4734. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4735. return this->pullback(isl::multi_aff(ma));
  4736. }
  4737. isl::pw_multi_aff_list aff::pw_multi_aff_list() const
  4738. {
  4739. if (!ptr)
  4740. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4741. return isl::pw_aff(*this).pw_multi_aff_list();
  4742. }
  4743. isl::pw_multi_aff aff::range_factor_domain() const
  4744. {
  4745. if (!ptr)
  4746. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4747. return isl::pw_aff(*this).range_factor_domain();
  4748. }
  4749. isl::pw_multi_aff aff::range_factor_range() const
  4750. {
  4751. if (!ptr)
  4752. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4753. return isl::pw_aff(*this).range_factor_range();
  4754. }
  4755. isl::multi_aff aff::range_product(const isl::multi_aff &multi2) const
  4756. {
  4757. if (!ptr)
  4758. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4759. return isl::multi_aff(*this).range_product(multi2);
  4760. }
  4761. isl::multi_pw_aff aff::range_product(const isl::multi_pw_aff &multi2) const
  4762. {
  4763. if (!ptr)
  4764. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4765. return isl::pw_aff(*this).range_product(multi2);
  4766. }
  4767. isl::multi_union_pw_aff aff::range_product(const isl::multi_union_pw_aff &multi2) const
  4768. {
  4769. if (!ptr)
  4770. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4771. return isl::pw_aff(*this).range_product(multi2);
  4772. }
  4773. isl::pw_multi_aff aff::range_product(const isl::pw_multi_aff &pma2) const
  4774. {
  4775. if (!ptr)
  4776. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4777. return isl::pw_aff(*this).range_product(pma2);
  4778. }
  4779. isl::union_pw_multi_aff aff::range_product(const isl::union_pw_multi_aff &upma2) const
  4780. {
  4781. if (!ptr)
  4782. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4783. return isl::pw_aff(*this).range_product(upma2);
  4784. }
  4785. isl::id aff::range_tuple_id() const
  4786. {
  4787. if (!ptr)
  4788. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4789. return isl::multi_aff(*this).range_tuple_id();
  4790. }
  4791. isl::multi_aff aff::reset_range_tuple_id() const
  4792. {
  4793. if (!ptr)
  4794. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4795. return isl::multi_aff(*this).reset_range_tuple_id();
  4796. }
  4797. isl::aff aff::scale(isl::val v) const
  4798. {
  4799. if (!ptr || v.is_null())
  4800. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4801. auto saved_ctx = ctx();
  4802. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  4803. auto res = isl_aff_scale_val(copy(), v.release());
  4804. if (!res)
  4805. exception::throw_last_error(saved_ctx);
  4806. return manage(res);
  4807. }
  4808. isl::aff aff::scale(long v) const
  4809. {
  4810. if (!ptr)
  4811. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4812. return this->scale(isl::val(ctx(), v));
  4813. }
  4814. isl::multi_aff aff::scale(const isl::multi_val &mv) const
  4815. {
  4816. if (!ptr)
  4817. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4818. return isl::multi_aff(*this).scale(mv);
  4819. }
  4820. isl::aff aff::scale_down(isl::val v) const
  4821. {
  4822. if (!ptr || v.is_null())
  4823. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4824. auto saved_ctx = ctx();
  4825. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  4826. auto res = isl_aff_scale_down_val(copy(), v.release());
  4827. if (!res)
  4828. exception::throw_last_error(saved_ctx);
  4829. return manage(res);
  4830. }
  4831. isl::aff aff::scale_down(long v) const
  4832. {
  4833. if (!ptr)
  4834. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4835. return this->scale_down(isl::val(ctx(), v));
  4836. }
  4837. isl::multi_aff aff::scale_down(const isl::multi_val &mv) const
  4838. {
  4839. if (!ptr)
  4840. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4841. return isl::multi_aff(*this).scale_down(mv);
  4842. }
  4843. isl::multi_aff aff::set_at(int pos, const isl::aff &el) const
  4844. {
  4845. if (!ptr)
  4846. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4847. return isl::multi_aff(*this).set_at(pos, el);
  4848. }
  4849. isl::multi_pw_aff aff::set_at(int pos, const isl::pw_aff &el) const
  4850. {
  4851. if (!ptr)
  4852. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4853. return isl::pw_aff(*this).set_at(pos, el);
  4854. }
  4855. isl::multi_union_pw_aff aff::set_at(int pos, const isl::union_pw_aff &el) const
  4856. {
  4857. if (!ptr)
  4858. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4859. return isl::pw_aff(*this).set_at(pos, el);
  4860. }
  4861. isl::multi_aff aff::set_range_tuple(const isl::id &id) const
  4862. {
  4863. if (!ptr)
  4864. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4865. return isl::multi_aff(*this).set_range_tuple(id);
  4866. }
  4867. isl::multi_aff aff::set_range_tuple(const std::string &id) const
  4868. {
  4869. if (!ptr)
  4870. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4871. return this->set_range_tuple(isl::id(ctx(), id));
  4872. }
  4873. unsigned aff::size() const
  4874. {
  4875. if (!ptr)
  4876. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4877. return isl::multi_aff(*this).size();
  4878. }
  4879. isl::space aff::space() const
  4880. {
  4881. if (!ptr)
  4882. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4883. return isl::pw_aff(*this).space();
  4884. }
  4885. isl::aff aff::sub(isl::aff aff2) const
  4886. {
  4887. if (!ptr || aff2.is_null())
  4888. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4889. auto saved_ctx = ctx();
  4890. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  4891. auto res = isl_aff_sub(copy(), aff2.release());
  4892. if (!res)
  4893. exception::throw_last_error(saved_ctx);
  4894. return manage(res);
  4895. }
  4896. isl::multi_aff aff::sub(const isl::multi_aff &multi2) const
  4897. {
  4898. if (!ptr)
  4899. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4900. return isl::multi_aff(*this).sub(multi2);
  4901. }
  4902. isl::multi_pw_aff aff::sub(const isl::multi_pw_aff &multi2) const
  4903. {
  4904. if (!ptr)
  4905. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4906. return isl::pw_aff(*this).sub(multi2);
  4907. }
  4908. isl::multi_union_pw_aff aff::sub(const isl::multi_union_pw_aff &multi2) const
  4909. {
  4910. if (!ptr)
  4911. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4912. return isl::pw_aff(*this).sub(multi2);
  4913. }
  4914. isl::pw_aff aff::sub(const isl::pw_aff &pwaff2) const
  4915. {
  4916. if (!ptr)
  4917. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4918. return isl::pw_aff(*this).sub(pwaff2);
  4919. }
  4920. isl::pw_multi_aff aff::sub(const isl::pw_multi_aff &pma2) const
  4921. {
  4922. if (!ptr)
  4923. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4924. return isl::pw_aff(*this).sub(pma2);
  4925. }
  4926. isl::union_pw_aff aff::sub(const isl::union_pw_aff &upa2) const
  4927. {
  4928. if (!ptr)
  4929. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4930. return isl::pw_aff(*this).sub(upa2);
  4931. }
  4932. isl::union_pw_multi_aff aff::sub(const isl::union_pw_multi_aff &upma2) const
  4933. {
  4934. if (!ptr)
  4935. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4936. return isl::pw_aff(*this).sub(upma2);
  4937. }
  4938. isl::pw_aff aff::subtract_domain(const isl::set &set) const
  4939. {
  4940. if (!ptr)
  4941. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4942. return isl::pw_aff(*this).subtract_domain(set);
  4943. }
  4944. isl::union_pw_aff aff::subtract_domain(const isl::space &space) const
  4945. {
  4946. if (!ptr)
  4947. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4948. return isl::pw_aff(*this).subtract_domain(space);
  4949. }
  4950. isl::union_pw_aff aff::subtract_domain(const isl::union_set &uset) const
  4951. {
  4952. if (!ptr)
  4953. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4954. return isl::pw_aff(*this).subtract_domain(uset);
  4955. }
  4956. isl::pw_aff aff::tdiv_q(const isl::pw_aff &pa2) const
  4957. {
  4958. if (!ptr)
  4959. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4960. return isl::pw_aff(*this).tdiv_q(pa2);
  4961. }
  4962. isl::pw_aff aff::tdiv_r(const isl::pw_aff &pa2) const
  4963. {
  4964. if (!ptr)
  4965. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4966. return isl::pw_aff(*this).tdiv_r(pa2);
  4967. }
  4968. isl::aff_list aff::to_list() const
  4969. {
  4970. if (!ptr)
  4971. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4972. auto saved_ctx = ctx();
  4973. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  4974. auto res = isl_aff_to_list(copy());
  4975. if (!res)
  4976. exception::throw_last_error(saved_ctx);
  4977. return manage(res);
  4978. }
  4979. isl::multi_pw_aff aff::to_multi_pw_aff() const
  4980. {
  4981. if (!ptr)
  4982. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4983. return isl::multi_aff(*this).to_multi_pw_aff();
  4984. }
  4985. isl::multi_union_pw_aff aff::to_multi_union_pw_aff() const
  4986. {
  4987. if (!ptr)
  4988. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4989. return isl::multi_aff(*this).to_multi_union_pw_aff();
  4990. }
  4991. isl::pw_multi_aff aff::to_pw_multi_aff() const
  4992. {
  4993. if (!ptr)
  4994. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  4995. return isl::multi_aff(*this).to_pw_multi_aff();
  4996. }
  4997. isl::union_pw_aff aff::to_union_pw_aff() const
  4998. {
  4999. if (!ptr)
  5000. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5001. return isl::pw_aff(*this).to_union_pw_aff();
  5002. }
  5003. isl::union_pw_multi_aff aff::to_union_pw_multi_aff() const
  5004. {
  5005. if (!ptr)
  5006. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5007. return isl::pw_aff(*this).to_union_pw_multi_aff();
  5008. }
  5009. isl::aff aff::unbind_params_insert_domain(isl::multi_id domain) const
  5010. {
  5011. if (!ptr || domain.is_null())
  5012. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5013. auto saved_ctx = ctx();
  5014. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5015. auto res = isl_aff_unbind_params_insert_domain(copy(), domain.release());
  5016. if (!res)
  5017. exception::throw_last_error(saved_ctx);
  5018. return manage(res);
  5019. }
  5020. isl::multi_pw_aff aff::union_add(const isl::multi_pw_aff &mpa2) const
  5021. {
  5022. if (!ptr)
  5023. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5024. return isl::pw_aff(*this).union_add(mpa2);
  5025. }
  5026. isl::multi_union_pw_aff aff::union_add(const isl::multi_union_pw_aff &mupa2) const
  5027. {
  5028. if (!ptr)
  5029. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5030. return isl::pw_aff(*this).union_add(mupa2);
  5031. }
  5032. isl::pw_aff aff::union_add(const isl::pw_aff &pwaff2) const
  5033. {
  5034. if (!ptr)
  5035. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5036. return isl::pw_aff(*this).union_add(pwaff2);
  5037. }
  5038. isl::pw_multi_aff aff::union_add(const isl::pw_multi_aff &pma2) const
  5039. {
  5040. if (!ptr)
  5041. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5042. return isl::pw_aff(*this).union_add(pma2);
  5043. }
  5044. isl::union_pw_aff aff::union_add(const isl::union_pw_aff &upa2) const
  5045. {
  5046. if (!ptr)
  5047. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5048. return isl::pw_aff(*this).union_add(upa2);
  5049. }
  5050. isl::union_pw_multi_aff aff::union_add(const isl::union_pw_multi_aff &upma2) const
  5051. {
  5052. if (!ptr)
  5053. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5054. return isl::pw_aff(*this).union_add(upma2);
  5055. }
  5056. isl::aff aff::zero_on_domain(isl::space space)
  5057. {
  5058. if (space.is_null())
  5059. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5060. auto saved_ctx = space.ctx();
  5061. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5062. auto res = isl_aff_zero_on_domain_space(space.release());
  5063. if (!res)
  5064. exception::throw_last_error(saved_ctx);
  5065. return manage(res);
  5066. }
  5067. inline std::ostream &operator<<(std::ostream &os, const aff &obj)
  5068. {
  5069. if (!obj.get())
  5070. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5071. auto saved_ctx = isl_aff_get_ctx(obj.get());
  5072. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5073. char *str = isl_aff_to_str(obj.get());
  5074. if (!str)
  5075. exception::throw_last_error(saved_ctx);
  5076. os << str;
  5077. free(str);
  5078. return os;
  5079. }
  5080. // implementations for isl::aff_list
  5081. aff_list manage(__isl_take isl_aff_list *ptr) {
  5082. if (!ptr)
  5083. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5084. return aff_list(ptr);
  5085. }
  5086. aff_list manage_copy(__isl_keep isl_aff_list *ptr) {
  5087. if (!ptr)
  5088. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5089. auto saved_ctx = isl_aff_list_get_ctx(ptr);
  5090. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5091. ptr = isl_aff_list_copy(ptr);
  5092. if (!ptr)
  5093. exception::throw_last_error(saved_ctx);
  5094. return aff_list(ptr);
  5095. }
  5096. aff_list::aff_list(__isl_take isl_aff_list *ptr)
  5097. : ptr(ptr) {}
  5098. aff_list::aff_list()
  5099. : ptr(nullptr) {}
  5100. aff_list::aff_list(const aff_list &obj)
  5101. : ptr(nullptr)
  5102. {
  5103. if (!obj.ptr)
  5104. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5105. auto saved_ctx = isl_aff_list_get_ctx(obj.ptr);
  5106. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5107. ptr = obj.copy();
  5108. if (!ptr)
  5109. exception::throw_last_error(saved_ctx);
  5110. }
  5111. aff_list::aff_list(isl::ctx ctx, int n)
  5112. {
  5113. auto saved_ctx = ctx;
  5114. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5115. auto res = isl_aff_list_alloc(ctx.release(), n);
  5116. if (!res)
  5117. exception::throw_last_error(saved_ctx);
  5118. ptr = res;
  5119. }
  5120. aff_list::aff_list(isl::aff el)
  5121. {
  5122. if (el.is_null())
  5123. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5124. auto saved_ctx = el.ctx();
  5125. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5126. auto res = isl_aff_list_from_aff(el.release());
  5127. if (!res)
  5128. exception::throw_last_error(saved_ctx);
  5129. ptr = res;
  5130. }
  5131. aff_list::aff_list(isl::ctx ctx, const std::string &str)
  5132. {
  5133. auto saved_ctx = ctx;
  5134. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5135. auto res = isl_aff_list_read_from_str(ctx.release(), str.c_str());
  5136. if (!res)
  5137. exception::throw_last_error(saved_ctx);
  5138. ptr = res;
  5139. }
  5140. aff_list &aff_list::operator=(aff_list obj) {
  5141. std::swap(this->ptr, obj.ptr);
  5142. return *this;
  5143. }
  5144. aff_list::~aff_list() {
  5145. if (ptr)
  5146. isl_aff_list_free(ptr);
  5147. }
  5148. __isl_give isl_aff_list *aff_list::copy() const & {
  5149. return isl_aff_list_copy(ptr);
  5150. }
  5151. __isl_keep isl_aff_list *aff_list::get() const {
  5152. return ptr;
  5153. }
  5154. __isl_give isl_aff_list *aff_list::release() {
  5155. isl_aff_list *tmp = ptr;
  5156. ptr = nullptr;
  5157. return tmp;
  5158. }
  5159. bool aff_list::is_null() const {
  5160. return ptr == nullptr;
  5161. }
  5162. isl::ctx aff_list::ctx() const {
  5163. return isl::ctx(isl_aff_list_get_ctx(ptr));
  5164. }
  5165. isl::aff_list aff_list::add(isl::aff el) const
  5166. {
  5167. if (!ptr || el.is_null())
  5168. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5169. auto saved_ctx = ctx();
  5170. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5171. auto res = isl_aff_list_add(copy(), el.release());
  5172. if (!res)
  5173. exception::throw_last_error(saved_ctx);
  5174. return manage(res);
  5175. }
  5176. isl::aff aff_list::at(int index) const
  5177. {
  5178. if (!ptr)
  5179. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5180. auto saved_ctx = ctx();
  5181. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5182. auto res = isl_aff_list_get_at(get(), index);
  5183. if (!res)
  5184. exception::throw_last_error(saved_ctx);
  5185. return manage(res);
  5186. }
  5187. isl::aff aff_list::get_at(int index) const
  5188. {
  5189. return at(index);
  5190. }
  5191. isl::aff_list aff_list::clear() const
  5192. {
  5193. if (!ptr)
  5194. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5195. auto saved_ctx = ctx();
  5196. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5197. auto res = isl_aff_list_clear(copy());
  5198. if (!res)
  5199. exception::throw_last_error(saved_ctx);
  5200. return manage(res);
  5201. }
  5202. isl::aff_list aff_list::concat(isl::aff_list list2) const
  5203. {
  5204. if (!ptr || list2.is_null())
  5205. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5206. auto saved_ctx = ctx();
  5207. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5208. auto res = isl_aff_list_concat(copy(), list2.release());
  5209. if (!res)
  5210. exception::throw_last_error(saved_ctx);
  5211. return manage(res);
  5212. }
  5213. isl::aff_list aff_list::drop(unsigned int first, unsigned int n) const
  5214. {
  5215. if (!ptr)
  5216. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5217. auto saved_ctx = ctx();
  5218. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5219. auto res = isl_aff_list_drop(copy(), first, n);
  5220. if (!res)
  5221. exception::throw_last_error(saved_ctx);
  5222. return manage(res);
  5223. }
  5224. void aff_list::foreach(const std::function<void(isl::aff)> &fn) const
  5225. {
  5226. if (!ptr)
  5227. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5228. auto saved_ctx = ctx();
  5229. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5230. struct fn_data {
  5231. std::function<void(isl::aff)> func;
  5232. std::exception_ptr eptr;
  5233. } fn_data = { fn };
  5234. auto fn_lambda = [](isl_aff *arg_0, void *arg_1) -> isl_stat {
  5235. auto *data = static_cast<struct fn_data *>(arg_1);
  5236. ISL_CPP_TRY {
  5237. (data->func)(manage(arg_0));
  5238. return isl_stat_ok;
  5239. } ISL_CPP_CATCH_ALL {
  5240. data->eptr = std::current_exception();
  5241. return isl_stat_error;
  5242. }
  5243. };
  5244. auto res = isl_aff_list_foreach(get(), fn_lambda, &fn_data);
  5245. if (fn_data.eptr)
  5246. std::rethrow_exception(fn_data.eptr);
  5247. if (res < 0)
  5248. exception::throw_last_error(saved_ctx);
  5249. return;
  5250. }
  5251. void aff_list::foreach_scc(const std::function<bool(isl::aff, isl::aff)> &follows, const std::function<void(isl::aff_list)> &fn) const
  5252. {
  5253. if (!ptr)
  5254. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5255. auto saved_ctx = ctx();
  5256. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5257. struct follows_data {
  5258. std::function<bool(isl::aff, isl::aff)> func;
  5259. std::exception_ptr eptr;
  5260. } follows_data = { follows };
  5261. auto follows_lambda = [](isl_aff *arg_0, isl_aff *arg_1, void *arg_2) -> isl_bool {
  5262. auto *data = static_cast<struct follows_data *>(arg_2);
  5263. ISL_CPP_TRY {
  5264. auto ret = (data->func)(manage_copy(arg_0), manage_copy(arg_1));
  5265. return ret ? isl_bool_true : isl_bool_false;
  5266. } ISL_CPP_CATCH_ALL {
  5267. data->eptr = std::current_exception();
  5268. return isl_bool_error;
  5269. }
  5270. };
  5271. struct fn_data {
  5272. std::function<void(isl::aff_list)> func;
  5273. std::exception_ptr eptr;
  5274. } fn_data = { fn };
  5275. auto fn_lambda = [](isl_aff_list *arg_0, void *arg_1) -> isl_stat {
  5276. auto *data = static_cast<struct fn_data *>(arg_1);
  5277. ISL_CPP_TRY {
  5278. (data->func)(manage(arg_0));
  5279. return isl_stat_ok;
  5280. } ISL_CPP_CATCH_ALL {
  5281. data->eptr = std::current_exception();
  5282. return isl_stat_error;
  5283. }
  5284. };
  5285. auto res = isl_aff_list_foreach_scc(get(), follows_lambda, &follows_data, fn_lambda, &fn_data);
  5286. if (follows_data.eptr)
  5287. std::rethrow_exception(follows_data.eptr);
  5288. if (fn_data.eptr)
  5289. std::rethrow_exception(fn_data.eptr);
  5290. if (res < 0)
  5291. exception::throw_last_error(saved_ctx);
  5292. return;
  5293. }
  5294. isl::aff_list aff_list::insert(unsigned int pos, isl::aff el) const
  5295. {
  5296. if (!ptr || el.is_null())
  5297. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5298. auto saved_ctx = ctx();
  5299. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5300. auto res = isl_aff_list_insert(copy(), pos, el.release());
  5301. if (!res)
  5302. exception::throw_last_error(saved_ctx);
  5303. return manage(res);
  5304. }
  5305. unsigned aff_list::size() const
  5306. {
  5307. if (!ptr)
  5308. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5309. auto saved_ctx = ctx();
  5310. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5311. auto res = isl_aff_list_size(get());
  5312. if (res < 0)
  5313. exception::throw_last_error(saved_ctx);
  5314. return res;
  5315. }
  5316. inline std::ostream &operator<<(std::ostream &os, const aff_list &obj)
  5317. {
  5318. if (!obj.get())
  5319. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5320. auto saved_ctx = isl_aff_list_get_ctx(obj.get());
  5321. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5322. char *str = isl_aff_list_to_str(obj.get());
  5323. if (!str)
  5324. exception::throw_last_error(saved_ctx);
  5325. os << str;
  5326. free(str);
  5327. return os;
  5328. }
  5329. // implementations for isl::ast_build
  5330. ast_build manage(__isl_take isl_ast_build *ptr) {
  5331. if (!ptr)
  5332. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5333. return ast_build(ptr);
  5334. }
  5335. ast_build manage_copy(__isl_keep isl_ast_build *ptr) {
  5336. if (!ptr)
  5337. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5338. auto saved_ctx = isl_ast_build_get_ctx(ptr);
  5339. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5340. ptr = isl_ast_build_copy(ptr);
  5341. if (!ptr)
  5342. exception::throw_last_error(saved_ctx);
  5343. return ast_build(ptr);
  5344. }
  5345. ast_build::ast_build(__isl_take isl_ast_build *ptr)
  5346. : ptr(ptr) {}
  5347. ast_build::ast_build()
  5348. : ptr(nullptr) {}
  5349. ast_build::ast_build(const ast_build &obj)
  5350. : ptr(nullptr)
  5351. {
  5352. if (!obj.ptr)
  5353. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5354. auto saved_ctx = isl_ast_build_get_ctx(obj.ptr);
  5355. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5356. ptr = obj.copy();
  5357. copy_callbacks(obj);
  5358. if (!ptr)
  5359. exception::throw_last_error(saved_ctx);
  5360. }
  5361. ast_build::ast_build(isl::ctx ctx)
  5362. {
  5363. auto saved_ctx = ctx;
  5364. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5365. auto res = isl_ast_build_alloc(ctx.release());
  5366. if (!res)
  5367. exception::throw_last_error(saved_ctx);
  5368. ptr = res;
  5369. }
  5370. ast_build &ast_build::operator=(ast_build obj) {
  5371. std::swap(this->ptr, obj.ptr);
  5372. copy_callbacks(obj);
  5373. return *this;
  5374. }
  5375. ast_build::~ast_build() {
  5376. if (ptr)
  5377. isl_ast_build_free(ptr);
  5378. }
  5379. __isl_give isl_ast_build *ast_build::copy() const & {
  5380. return isl_ast_build_copy(ptr);
  5381. }
  5382. __isl_keep isl_ast_build *ast_build::get() const {
  5383. return ptr;
  5384. }
  5385. __isl_give isl_ast_build *ast_build::release() {
  5386. if (at_each_domain_data)
  5387. exception::throw_invalid("cannot release object with persistent callbacks", __FILE__, __LINE__);
  5388. isl_ast_build *tmp = ptr;
  5389. ptr = nullptr;
  5390. return tmp;
  5391. }
  5392. bool ast_build::is_null() const {
  5393. return ptr == nullptr;
  5394. }
  5395. isl::ctx ast_build::ctx() const {
  5396. return isl::ctx(isl_ast_build_get_ctx(ptr));
  5397. }
  5398. ast_build &ast_build::copy_callbacks(const ast_build &obj)
  5399. {
  5400. at_each_domain_data = obj.at_each_domain_data;
  5401. return *this;
  5402. }
  5403. isl_ast_node *ast_build::at_each_domain(isl_ast_node *arg_0, isl_ast_build *arg_1, void *arg_2)
  5404. {
  5405. auto *data = static_cast<struct at_each_domain_data *>(arg_2);
  5406. ISL_CPP_TRY {
  5407. auto ret = (data->func)(manage(arg_0), manage_copy(arg_1));
  5408. return ret.release();
  5409. } ISL_CPP_CATCH_ALL {
  5410. data->eptr = std::current_exception();
  5411. return NULL;
  5412. }
  5413. }
  5414. void ast_build::set_at_each_domain_data(const std::function<isl::ast_node(isl::ast_node, isl::ast_build)> &fn)
  5415. {
  5416. if (!ptr)
  5417. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5418. auto saved_ctx = isl_ast_build_get_ctx(ptr);
  5419. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5420. at_each_domain_data = std::make_shared<struct at_each_domain_data>();
  5421. at_each_domain_data->func = fn;
  5422. ptr = isl_ast_build_set_at_each_domain(ptr, &at_each_domain, at_each_domain_data.get());
  5423. if (!ptr)
  5424. exception::throw_last_error(saved_ctx);
  5425. }
  5426. isl::ast_build ast_build::set_at_each_domain(const std::function<isl::ast_node(isl::ast_node, isl::ast_build)> &fn) const
  5427. {
  5428. auto copy = *this;
  5429. copy.set_at_each_domain_data(fn);
  5430. return copy;
  5431. }
  5432. isl::ast_expr ast_build::access_from(isl::multi_pw_aff mpa) const
  5433. {
  5434. if (!ptr || mpa.is_null())
  5435. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5436. auto saved_ctx = ctx();
  5437. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5438. auto res = isl_ast_build_access_from_multi_pw_aff(get(), mpa.release());
  5439. if (at_each_domain_data && at_each_domain_data->eptr) {
  5440. std::exception_ptr eptr = at_each_domain_data->eptr;
  5441. at_each_domain_data->eptr = nullptr;
  5442. std::rethrow_exception(eptr);
  5443. }
  5444. if (!res)
  5445. exception::throw_last_error(saved_ctx);
  5446. return manage(res);
  5447. }
  5448. isl::ast_expr ast_build::access_from(isl::pw_multi_aff pma) const
  5449. {
  5450. if (!ptr || pma.is_null())
  5451. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5452. auto saved_ctx = ctx();
  5453. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5454. auto res = isl_ast_build_access_from_pw_multi_aff(get(), pma.release());
  5455. if (at_each_domain_data && at_each_domain_data->eptr) {
  5456. std::exception_ptr eptr = at_each_domain_data->eptr;
  5457. at_each_domain_data->eptr = nullptr;
  5458. std::rethrow_exception(eptr);
  5459. }
  5460. if (!res)
  5461. exception::throw_last_error(saved_ctx);
  5462. return manage(res);
  5463. }
  5464. isl::ast_expr ast_build::call_from(isl::multi_pw_aff mpa) const
  5465. {
  5466. if (!ptr || mpa.is_null())
  5467. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5468. auto saved_ctx = ctx();
  5469. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5470. auto res = isl_ast_build_call_from_multi_pw_aff(get(), mpa.release());
  5471. if (at_each_domain_data && at_each_domain_data->eptr) {
  5472. std::exception_ptr eptr = at_each_domain_data->eptr;
  5473. at_each_domain_data->eptr = nullptr;
  5474. std::rethrow_exception(eptr);
  5475. }
  5476. if (!res)
  5477. exception::throw_last_error(saved_ctx);
  5478. return manage(res);
  5479. }
  5480. isl::ast_expr ast_build::call_from(isl::pw_multi_aff pma) const
  5481. {
  5482. if (!ptr || pma.is_null())
  5483. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5484. auto saved_ctx = ctx();
  5485. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5486. auto res = isl_ast_build_call_from_pw_multi_aff(get(), pma.release());
  5487. if (at_each_domain_data && at_each_domain_data->eptr) {
  5488. std::exception_ptr eptr = at_each_domain_data->eptr;
  5489. at_each_domain_data->eptr = nullptr;
  5490. std::rethrow_exception(eptr);
  5491. }
  5492. if (!res)
  5493. exception::throw_last_error(saved_ctx);
  5494. return manage(res);
  5495. }
  5496. isl::ast_expr ast_build::expr_from(isl::pw_aff pa) const
  5497. {
  5498. if (!ptr || pa.is_null())
  5499. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5500. auto saved_ctx = ctx();
  5501. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5502. auto res = isl_ast_build_expr_from_pw_aff(get(), pa.release());
  5503. if (at_each_domain_data && at_each_domain_data->eptr) {
  5504. std::exception_ptr eptr = at_each_domain_data->eptr;
  5505. at_each_domain_data->eptr = nullptr;
  5506. std::rethrow_exception(eptr);
  5507. }
  5508. if (!res)
  5509. exception::throw_last_error(saved_ctx);
  5510. return manage(res);
  5511. }
  5512. isl::ast_expr ast_build::expr_from(isl::set set) const
  5513. {
  5514. if (!ptr || set.is_null())
  5515. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5516. auto saved_ctx = ctx();
  5517. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5518. auto res = isl_ast_build_expr_from_set(get(), set.release());
  5519. if (at_each_domain_data && at_each_domain_data->eptr) {
  5520. std::exception_ptr eptr = at_each_domain_data->eptr;
  5521. at_each_domain_data->eptr = nullptr;
  5522. std::rethrow_exception(eptr);
  5523. }
  5524. if (!res)
  5525. exception::throw_last_error(saved_ctx);
  5526. return manage(res);
  5527. }
  5528. isl::ast_build ast_build::from_context(isl::set set)
  5529. {
  5530. if (set.is_null())
  5531. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5532. auto saved_ctx = set.ctx();
  5533. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5534. auto res = isl_ast_build_from_context(set.release());
  5535. if (!res)
  5536. exception::throw_last_error(saved_ctx);
  5537. return manage(res);
  5538. }
  5539. isl::ast_node ast_build::node_from(isl::schedule schedule) const
  5540. {
  5541. if (!ptr || schedule.is_null())
  5542. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5543. auto saved_ctx = ctx();
  5544. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5545. auto res = isl_ast_build_node_from_schedule(get(), schedule.release());
  5546. if (at_each_domain_data && at_each_domain_data->eptr) {
  5547. std::exception_ptr eptr = at_each_domain_data->eptr;
  5548. at_each_domain_data->eptr = nullptr;
  5549. std::rethrow_exception(eptr);
  5550. }
  5551. if (!res)
  5552. exception::throw_last_error(saved_ctx);
  5553. return manage(res);
  5554. }
  5555. isl::ast_node ast_build::node_from_schedule_map(isl::union_map schedule) const
  5556. {
  5557. if (!ptr || schedule.is_null())
  5558. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5559. auto saved_ctx = ctx();
  5560. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5561. auto res = isl_ast_build_node_from_schedule_map(get(), schedule.release());
  5562. if (at_each_domain_data && at_each_domain_data->eptr) {
  5563. std::exception_ptr eptr = at_each_domain_data->eptr;
  5564. at_each_domain_data->eptr = nullptr;
  5565. std::rethrow_exception(eptr);
  5566. }
  5567. if (!res)
  5568. exception::throw_last_error(saved_ctx);
  5569. return manage(res);
  5570. }
  5571. isl::union_map ast_build::schedule() const
  5572. {
  5573. if (!ptr)
  5574. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5575. auto saved_ctx = ctx();
  5576. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5577. auto res = isl_ast_build_get_schedule(get());
  5578. if (at_each_domain_data && at_each_domain_data->eptr) {
  5579. std::exception_ptr eptr = at_each_domain_data->eptr;
  5580. at_each_domain_data->eptr = nullptr;
  5581. std::rethrow_exception(eptr);
  5582. }
  5583. if (!res)
  5584. exception::throw_last_error(saved_ctx);
  5585. return manage(res);
  5586. }
  5587. isl::union_map ast_build::get_schedule() const
  5588. {
  5589. return schedule();
  5590. }
  5591. // implementations for isl::ast_expr
  5592. ast_expr manage(__isl_take isl_ast_expr *ptr) {
  5593. if (!ptr)
  5594. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5595. return ast_expr(ptr);
  5596. }
  5597. ast_expr manage_copy(__isl_keep isl_ast_expr *ptr) {
  5598. if (!ptr)
  5599. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5600. auto saved_ctx = isl_ast_expr_get_ctx(ptr);
  5601. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5602. ptr = isl_ast_expr_copy(ptr);
  5603. if (!ptr)
  5604. exception::throw_last_error(saved_ctx);
  5605. return ast_expr(ptr);
  5606. }
  5607. ast_expr::ast_expr(__isl_take isl_ast_expr *ptr)
  5608. : ptr(ptr) {}
  5609. ast_expr::ast_expr()
  5610. : ptr(nullptr) {}
  5611. ast_expr::ast_expr(const ast_expr &obj)
  5612. : ptr(nullptr)
  5613. {
  5614. if (!obj.ptr)
  5615. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5616. auto saved_ctx = isl_ast_expr_get_ctx(obj.ptr);
  5617. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5618. ptr = obj.copy();
  5619. if (!ptr)
  5620. exception::throw_last_error(saved_ctx);
  5621. }
  5622. ast_expr &ast_expr::operator=(ast_expr obj) {
  5623. std::swap(this->ptr, obj.ptr);
  5624. return *this;
  5625. }
  5626. ast_expr::~ast_expr() {
  5627. if (ptr)
  5628. isl_ast_expr_free(ptr);
  5629. }
  5630. __isl_give isl_ast_expr *ast_expr::copy() const & {
  5631. return isl_ast_expr_copy(ptr);
  5632. }
  5633. __isl_keep isl_ast_expr *ast_expr::get() const {
  5634. return ptr;
  5635. }
  5636. __isl_give isl_ast_expr *ast_expr::release() {
  5637. isl_ast_expr *tmp = ptr;
  5638. ptr = nullptr;
  5639. return tmp;
  5640. }
  5641. bool ast_expr::is_null() const {
  5642. return ptr == nullptr;
  5643. }
  5644. template <typename T, typename>
  5645. bool ast_expr::isa_type(T subtype) const
  5646. {
  5647. if (is_null())
  5648. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5649. return isl_ast_expr_get_type(get()) == subtype;
  5650. }
  5651. template <class T>
  5652. bool ast_expr::isa() const
  5653. {
  5654. return isa_type<decltype(T::type)>(T::type);
  5655. }
  5656. template <class T>
  5657. T ast_expr::as() const
  5658. {
  5659. if (!isa<T>())
  5660. exception::throw_invalid("not an object of the requested subtype", __FILE__, __LINE__);
  5661. return T(copy());
  5662. }
  5663. isl::ctx ast_expr::ctx() const {
  5664. return isl::ctx(isl_ast_expr_get_ctx(ptr));
  5665. }
  5666. std::string ast_expr::to_C_str() const
  5667. {
  5668. if (!ptr)
  5669. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5670. auto saved_ctx = ctx();
  5671. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5672. auto res = isl_ast_expr_to_C_str(get());
  5673. std::string tmp(res);
  5674. free(res);
  5675. return tmp;
  5676. }
  5677. inline std::ostream &operator<<(std::ostream &os, const ast_expr &obj)
  5678. {
  5679. if (!obj.get())
  5680. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5681. auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
  5682. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5683. char *str = isl_ast_expr_to_str(obj.get());
  5684. if (!str)
  5685. exception::throw_last_error(saved_ctx);
  5686. os << str;
  5687. free(str);
  5688. return os;
  5689. }
  5690. // implementations for isl::ast_expr_id
  5691. ast_expr_id::ast_expr_id(__isl_take isl_ast_expr *ptr)
  5692. : ast_expr(ptr) {}
  5693. ast_expr_id::ast_expr_id()
  5694. : ast_expr() {}
  5695. ast_expr_id::ast_expr_id(const ast_expr_id &obj)
  5696. : ast_expr(obj)
  5697. {
  5698. }
  5699. ast_expr_id &ast_expr_id::operator=(ast_expr_id obj) {
  5700. std::swap(this->ptr, obj.ptr);
  5701. return *this;
  5702. }
  5703. isl::ctx ast_expr_id::ctx() const {
  5704. return isl::ctx(isl_ast_expr_get_ctx(ptr));
  5705. }
  5706. isl::id ast_expr_id::id() const
  5707. {
  5708. if (!ptr)
  5709. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5710. auto saved_ctx = ctx();
  5711. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5712. auto res = isl_ast_expr_id_get_id(get());
  5713. if (!res)
  5714. exception::throw_last_error(saved_ctx);
  5715. return manage(res);
  5716. }
  5717. isl::id ast_expr_id::get_id() const
  5718. {
  5719. return id();
  5720. }
  5721. inline std::ostream &operator<<(std::ostream &os, const ast_expr_id &obj)
  5722. {
  5723. if (!obj.get())
  5724. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5725. auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
  5726. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5727. char *str = isl_ast_expr_to_str(obj.get());
  5728. if (!str)
  5729. exception::throw_last_error(saved_ctx);
  5730. os << str;
  5731. free(str);
  5732. return os;
  5733. }
  5734. // implementations for isl::ast_expr_int
  5735. ast_expr_int::ast_expr_int(__isl_take isl_ast_expr *ptr)
  5736. : ast_expr(ptr) {}
  5737. ast_expr_int::ast_expr_int()
  5738. : ast_expr() {}
  5739. ast_expr_int::ast_expr_int(const ast_expr_int &obj)
  5740. : ast_expr(obj)
  5741. {
  5742. }
  5743. ast_expr_int &ast_expr_int::operator=(ast_expr_int obj) {
  5744. std::swap(this->ptr, obj.ptr);
  5745. return *this;
  5746. }
  5747. isl::ctx ast_expr_int::ctx() const {
  5748. return isl::ctx(isl_ast_expr_get_ctx(ptr));
  5749. }
  5750. isl::val ast_expr_int::val() const
  5751. {
  5752. if (!ptr)
  5753. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5754. auto saved_ctx = ctx();
  5755. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5756. auto res = isl_ast_expr_int_get_val(get());
  5757. if (!res)
  5758. exception::throw_last_error(saved_ctx);
  5759. return manage(res);
  5760. }
  5761. isl::val ast_expr_int::get_val() const
  5762. {
  5763. return val();
  5764. }
  5765. inline std::ostream &operator<<(std::ostream &os, const ast_expr_int &obj)
  5766. {
  5767. if (!obj.get())
  5768. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5769. auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
  5770. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5771. char *str = isl_ast_expr_to_str(obj.get());
  5772. if (!str)
  5773. exception::throw_last_error(saved_ctx);
  5774. os << str;
  5775. free(str);
  5776. return os;
  5777. }
  5778. // implementations for isl::ast_expr_op
  5779. ast_expr_op::ast_expr_op(__isl_take isl_ast_expr *ptr)
  5780. : ast_expr(ptr) {}
  5781. ast_expr_op::ast_expr_op()
  5782. : ast_expr() {}
  5783. ast_expr_op::ast_expr_op(const ast_expr_op &obj)
  5784. : ast_expr(obj)
  5785. {
  5786. }
  5787. ast_expr_op &ast_expr_op::operator=(ast_expr_op obj) {
  5788. std::swap(this->ptr, obj.ptr);
  5789. return *this;
  5790. }
  5791. template <typename T, typename>
  5792. bool ast_expr_op::isa_type(T subtype) const
  5793. {
  5794. if (is_null())
  5795. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5796. return isl_ast_expr_op_get_type(get()) == subtype;
  5797. }
  5798. template <class T>
  5799. bool ast_expr_op::isa() const
  5800. {
  5801. return isa_type<decltype(T::type)>(T::type);
  5802. }
  5803. template <class T>
  5804. T ast_expr_op::as() const
  5805. {
  5806. if (!isa<T>())
  5807. exception::throw_invalid("not an object of the requested subtype", __FILE__, __LINE__);
  5808. return T(copy());
  5809. }
  5810. isl::ctx ast_expr_op::ctx() const {
  5811. return isl::ctx(isl_ast_expr_get_ctx(ptr));
  5812. }
  5813. isl::ast_expr ast_expr_op::arg(int pos) const
  5814. {
  5815. if (!ptr)
  5816. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5817. auto saved_ctx = ctx();
  5818. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5819. auto res = isl_ast_expr_op_get_arg(get(), pos);
  5820. if (!res)
  5821. exception::throw_last_error(saved_ctx);
  5822. return manage(res);
  5823. }
  5824. isl::ast_expr ast_expr_op::get_arg(int pos) const
  5825. {
  5826. return arg(pos);
  5827. }
  5828. unsigned ast_expr_op::n_arg() const
  5829. {
  5830. if (!ptr)
  5831. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5832. auto saved_ctx = ctx();
  5833. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5834. auto res = isl_ast_expr_op_get_n_arg(get());
  5835. if (res < 0)
  5836. exception::throw_last_error(saved_ctx);
  5837. return res;
  5838. }
  5839. unsigned ast_expr_op::get_n_arg() const
  5840. {
  5841. return n_arg();
  5842. }
  5843. inline std::ostream &operator<<(std::ostream &os, const ast_expr_op &obj)
  5844. {
  5845. if (!obj.get())
  5846. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5847. auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
  5848. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5849. char *str = isl_ast_expr_to_str(obj.get());
  5850. if (!str)
  5851. exception::throw_last_error(saved_ctx);
  5852. os << str;
  5853. free(str);
  5854. return os;
  5855. }
  5856. // implementations for isl::ast_expr_op_access
  5857. ast_expr_op_access::ast_expr_op_access(__isl_take isl_ast_expr *ptr)
  5858. : ast_expr_op(ptr) {}
  5859. ast_expr_op_access::ast_expr_op_access()
  5860. : ast_expr_op() {}
  5861. ast_expr_op_access::ast_expr_op_access(const ast_expr_op_access &obj)
  5862. : ast_expr_op(obj)
  5863. {
  5864. }
  5865. ast_expr_op_access &ast_expr_op_access::operator=(ast_expr_op_access obj) {
  5866. std::swap(this->ptr, obj.ptr);
  5867. return *this;
  5868. }
  5869. isl::ctx ast_expr_op_access::ctx() const {
  5870. return isl::ctx(isl_ast_expr_get_ctx(ptr));
  5871. }
  5872. inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_access &obj)
  5873. {
  5874. if (!obj.get())
  5875. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5876. auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
  5877. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5878. char *str = isl_ast_expr_to_str(obj.get());
  5879. if (!str)
  5880. exception::throw_last_error(saved_ctx);
  5881. os << str;
  5882. free(str);
  5883. return os;
  5884. }
  5885. // implementations for isl::ast_expr_op_add
  5886. ast_expr_op_add::ast_expr_op_add(__isl_take isl_ast_expr *ptr)
  5887. : ast_expr_op(ptr) {}
  5888. ast_expr_op_add::ast_expr_op_add()
  5889. : ast_expr_op() {}
  5890. ast_expr_op_add::ast_expr_op_add(const ast_expr_op_add &obj)
  5891. : ast_expr_op(obj)
  5892. {
  5893. }
  5894. ast_expr_op_add &ast_expr_op_add::operator=(ast_expr_op_add obj) {
  5895. std::swap(this->ptr, obj.ptr);
  5896. return *this;
  5897. }
  5898. isl::ctx ast_expr_op_add::ctx() const {
  5899. return isl::ctx(isl_ast_expr_get_ctx(ptr));
  5900. }
  5901. inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_add &obj)
  5902. {
  5903. if (!obj.get())
  5904. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5905. auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
  5906. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5907. char *str = isl_ast_expr_to_str(obj.get());
  5908. if (!str)
  5909. exception::throw_last_error(saved_ctx);
  5910. os << str;
  5911. free(str);
  5912. return os;
  5913. }
  5914. // implementations for isl::ast_expr_op_address_of
  5915. ast_expr_op_address_of::ast_expr_op_address_of(__isl_take isl_ast_expr *ptr)
  5916. : ast_expr_op(ptr) {}
  5917. ast_expr_op_address_of::ast_expr_op_address_of()
  5918. : ast_expr_op() {}
  5919. ast_expr_op_address_of::ast_expr_op_address_of(const ast_expr_op_address_of &obj)
  5920. : ast_expr_op(obj)
  5921. {
  5922. }
  5923. ast_expr_op_address_of &ast_expr_op_address_of::operator=(ast_expr_op_address_of obj) {
  5924. std::swap(this->ptr, obj.ptr);
  5925. return *this;
  5926. }
  5927. isl::ctx ast_expr_op_address_of::ctx() const {
  5928. return isl::ctx(isl_ast_expr_get_ctx(ptr));
  5929. }
  5930. inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_address_of &obj)
  5931. {
  5932. if (!obj.get())
  5933. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5934. auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
  5935. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5936. char *str = isl_ast_expr_to_str(obj.get());
  5937. if (!str)
  5938. exception::throw_last_error(saved_ctx);
  5939. os << str;
  5940. free(str);
  5941. return os;
  5942. }
  5943. // implementations for isl::ast_expr_op_and
  5944. ast_expr_op_and::ast_expr_op_and(__isl_take isl_ast_expr *ptr)
  5945. : ast_expr_op(ptr) {}
  5946. ast_expr_op_and::ast_expr_op_and()
  5947. : ast_expr_op() {}
  5948. ast_expr_op_and::ast_expr_op_and(const ast_expr_op_and &obj)
  5949. : ast_expr_op(obj)
  5950. {
  5951. }
  5952. ast_expr_op_and &ast_expr_op_and::operator=(ast_expr_op_and obj) {
  5953. std::swap(this->ptr, obj.ptr);
  5954. return *this;
  5955. }
  5956. isl::ctx ast_expr_op_and::ctx() const {
  5957. return isl::ctx(isl_ast_expr_get_ctx(ptr));
  5958. }
  5959. inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_and &obj)
  5960. {
  5961. if (!obj.get())
  5962. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5963. auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
  5964. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5965. char *str = isl_ast_expr_to_str(obj.get());
  5966. if (!str)
  5967. exception::throw_last_error(saved_ctx);
  5968. os << str;
  5969. free(str);
  5970. return os;
  5971. }
  5972. // implementations for isl::ast_expr_op_and_then
  5973. ast_expr_op_and_then::ast_expr_op_and_then(__isl_take isl_ast_expr *ptr)
  5974. : ast_expr_op(ptr) {}
  5975. ast_expr_op_and_then::ast_expr_op_and_then()
  5976. : ast_expr_op() {}
  5977. ast_expr_op_and_then::ast_expr_op_and_then(const ast_expr_op_and_then &obj)
  5978. : ast_expr_op(obj)
  5979. {
  5980. }
  5981. ast_expr_op_and_then &ast_expr_op_and_then::operator=(ast_expr_op_and_then obj) {
  5982. std::swap(this->ptr, obj.ptr);
  5983. return *this;
  5984. }
  5985. isl::ctx ast_expr_op_and_then::ctx() const {
  5986. return isl::ctx(isl_ast_expr_get_ctx(ptr));
  5987. }
  5988. inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_and_then &obj)
  5989. {
  5990. if (!obj.get())
  5991. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  5992. auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
  5993. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  5994. char *str = isl_ast_expr_to_str(obj.get());
  5995. if (!str)
  5996. exception::throw_last_error(saved_ctx);
  5997. os << str;
  5998. free(str);
  5999. return os;
  6000. }
  6001. // implementations for isl::ast_expr_op_call
  6002. ast_expr_op_call::ast_expr_op_call(__isl_take isl_ast_expr *ptr)
  6003. : ast_expr_op(ptr) {}
  6004. ast_expr_op_call::ast_expr_op_call()
  6005. : ast_expr_op() {}
  6006. ast_expr_op_call::ast_expr_op_call(const ast_expr_op_call &obj)
  6007. : ast_expr_op(obj)
  6008. {
  6009. }
  6010. ast_expr_op_call &ast_expr_op_call::operator=(ast_expr_op_call obj) {
  6011. std::swap(this->ptr, obj.ptr);
  6012. return *this;
  6013. }
  6014. isl::ctx ast_expr_op_call::ctx() const {
  6015. return isl::ctx(isl_ast_expr_get_ctx(ptr));
  6016. }
  6017. inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_call &obj)
  6018. {
  6019. if (!obj.get())
  6020. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6021. auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
  6022. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6023. char *str = isl_ast_expr_to_str(obj.get());
  6024. if (!str)
  6025. exception::throw_last_error(saved_ctx);
  6026. os << str;
  6027. free(str);
  6028. return os;
  6029. }
  6030. // implementations for isl::ast_expr_op_cond
  6031. ast_expr_op_cond::ast_expr_op_cond(__isl_take isl_ast_expr *ptr)
  6032. : ast_expr_op(ptr) {}
  6033. ast_expr_op_cond::ast_expr_op_cond()
  6034. : ast_expr_op() {}
  6035. ast_expr_op_cond::ast_expr_op_cond(const ast_expr_op_cond &obj)
  6036. : ast_expr_op(obj)
  6037. {
  6038. }
  6039. ast_expr_op_cond &ast_expr_op_cond::operator=(ast_expr_op_cond obj) {
  6040. std::swap(this->ptr, obj.ptr);
  6041. return *this;
  6042. }
  6043. isl::ctx ast_expr_op_cond::ctx() const {
  6044. return isl::ctx(isl_ast_expr_get_ctx(ptr));
  6045. }
  6046. inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_cond &obj)
  6047. {
  6048. if (!obj.get())
  6049. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6050. auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
  6051. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6052. char *str = isl_ast_expr_to_str(obj.get());
  6053. if (!str)
  6054. exception::throw_last_error(saved_ctx);
  6055. os << str;
  6056. free(str);
  6057. return os;
  6058. }
  6059. // implementations for isl::ast_expr_op_div
  6060. ast_expr_op_div::ast_expr_op_div(__isl_take isl_ast_expr *ptr)
  6061. : ast_expr_op(ptr) {}
  6062. ast_expr_op_div::ast_expr_op_div()
  6063. : ast_expr_op() {}
  6064. ast_expr_op_div::ast_expr_op_div(const ast_expr_op_div &obj)
  6065. : ast_expr_op(obj)
  6066. {
  6067. }
  6068. ast_expr_op_div &ast_expr_op_div::operator=(ast_expr_op_div obj) {
  6069. std::swap(this->ptr, obj.ptr);
  6070. return *this;
  6071. }
  6072. isl::ctx ast_expr_op_div::ctx() const {
  6073. return isl::ctx(isl_ast_expr_get_ctx(ptr));
  6074. }
  6075. inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_div &obj)
  6076. {
  6077. if (!obj.get())
  6078. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6079. auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
  6080. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6081. char *str = isl_ast_expr_to_str(obj.get());
  6082. if (!str)
  6083. exception::throw_last_error(saved_ctx);
  6084. os << str;
  6085. free(str);
  6086. return os;
  6087. }
  6088. // implementations for isl::ast_expr_op_eq
  6089. ast_expr_op_eq::ast_expr_op_eq(__isl_take isl_ast_expr *ptr)
  6090. : ast_expr_op(ptr) {}
  6091. ast_expr_op_eq::ast_expr_op_eq()
  6092. : ast_expr_op() {}
  6093. ast_expr_op_eq::ast_expr_op_eq(const ast_expr_op_eq &obj)
  6094. : ast_expr_op(obj)
  6095. {
  6096. }
  6097. ast_expr_op_eq &ast_expr_op_eq::operator=(ast_expr_op_eq obj) {
  6098. std::swap(this->ptr, obj.ptr);
  6099. return *this;
  6100. }
  6101. isl::ctx ast_expr_op_eq::ctx() const {
  6102. return isl::ctx(isl_ast_expr_get_ctx(ptr));
  6103. }
  6104. inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_eq &obj)
  6105. {
  6106. if (!obj.get())
  6107. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6108. auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
  6109. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6110. char *str = isl_ast_expr_to_str(obj.get());
  6111. if (!str)
  6112. exception::throw_last_error(saved_ctx);
  6113. os << str;
  6114. free(str);
  6115. return os;
  6116. }
  6117. // implementations for isl::ast_expr_op_fdiv_q
  6118. ast_expr_op_fdiv_q::ast_expr_op_fdiv_q(__isl_take isl_ast_expr *ptr)
  6119. : ast_expr_op(ptr) {}
  6120. ast_expr_op_fdiv_q::ast_expr_op_fdiv_q()
  6121. : ast_expr_op() {}
  6122. ast_expr_op_fdiv_q::ast_expr_op_fdiv_q(const ast_expr_op_fdiv_q &obj)
  6123. : ast_expr_op(obj)
  6124. {
  6125. }
  6126. ast_expr_op_fdiv_q &ast_expr_op_fdiv_q::operator=(ast_expr_op_fdiv_q obj) {
  6127. std::swap(this->ptr, obj.ptr);
  6128. return *this;
  6129. }
  6130. isl::ctx ast_expr_op_fdiv_q::ctx() const {
  6131. return isl::ctx(isl_ast_expr_get_ctx(ptr));
  6132. }
  6133. inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_fdiv_q &obj)
  6134. {
  6135. if (!obj.get())
  6136. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6137. auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
  6138. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6139. char *str = isl_ast_expr_to_str(obj.get());
  6140. if (!str)
  6141. exception::throw_last_error(saved_ctx);
  6142. os << str;
  6143. free(str);
  6144. return os;
  6145. }
  6146. // implementations for isl::ast_expr_op_ge
  6147. ast_expr_op_ge::ast_expr_op_ge(__isl_take isl_ast_expr *ptr)
  6148. : ast_expr_op(ptr) {}
  6149. ast_expr_op_ge::ast_expr_op_ge()
  6150. : ast_expr_op() {}
  6151. ast_expr_op_ge::ast_expr_op_ge(const ast_expr_op_ge &obj)
  6152. : ast_expr_op(obj)
  6153. {
  6154. }
  6155. ast_expr_op_ge &ast_expr_op_ge::operator=(ast_expr_op_ge obj) {
  6156. std::swap(this->ptr, obj.ptr);
  6157. return *this;
  6158. }
  6159. isl::ctx ast_expr_op_ge::ctx() const {
  6160. return isl::ctx(isl_ast_expr_get_ctx(ptr));
  6161. }
  6162. inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_ge &obj)
  6163. {
  6164. if (!obj.get())
  6165. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6166. auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
  6167. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6168. char *str = isl_ast_expr_to_str(obj.get());
  6169. if (!str)
  6170. exception::throw_last_error(saved_ctx);
  6171. os << str;
  6172. free(str);
  6173. return os;
  6174. }
  6175. // implementations for isl::ast_expr_op_gt
  6176. ast_expr_op_gt::ast_expr_op_gt(__isl_take isl_ast_expr *ptr)
  6177. : ast_expr_op(ptr) {}
  6178. ast_expr_op_gt::ast_expr_op_gt()
  6179. : ast_expr_op() {}
  6180. ast_expr_op_gt::ast_expr_op_gt(const ast_expr_op_gt &obj)
  6181. : ast_expr_op(obj)
  6182. {
  6183. }
  6184. ast_expr_op_gt &ast_expr_op_gt::operator=(ast_expr_op_gt obj) {
  6185. std::swap(this->ptr, obj.ptr);
  6186. return *this;
  6187. }
  6188. isl::ctx ast_expr_op_gt::ctx() const {
  6189. return isl::ctx(isl_ast_expr_get_ctx(ptr));
  6190. }
  6191. inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_gt &obj)
  6192. {
  6193. if (!obj.get())
  6194. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6195. auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
  6196. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6197. char *str = isl_ast_expr_to_str(obj.get());
  6198. if (!str)
  6199. exception::throw_last_error(saved_ctx);
  6200. os << str;
  6201. free(str);
  6202. return os;
  6203. }
  6204. // implementations for isl::ast_expr_op_le
  6205. ast_expr_op_le::ast_expr_op_le(__isl_take isl_ast_expr *ptr)
  6206. : ast_expr_op(ptr) {}
  6207. ast_expr_op_le::ast_expr_op_le()
  6208. : ast_expr_op() {}
  6209. ast_expr_op_le::ast_expr_op_le(const ast_expr_op_le &obj)
  6210. : ast_expr_op(obj)
  6211. {
  6212. }
  6213. ast_expr_op_le &ast_expr_op_le::operator=(ast_expr_op_le obj) {
  6214. std::swap(this->ptr, obj.ptr);
  6215. return *this;
  6216. }
  6217. isl::ctx ast_expr_op_le::ctx() const {
  6218. return isl::ctx(isl_ast_expr_get_ctx(ptr));
  6219. }
  6220. inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_le &obj)
  6221. {
  6222. if (!obj.get())
  6223. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6224. auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
  6225. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6226. char *str = isl_ast_expr_to_str(obj.get());
  6227. if (!str)
  6228. exception::throw_last_error(saved_ctx);
  6229. os << str;
  6230. free(str);
  6231. return os;
  6232. }
  6233. // implementations for isl::ast_expr_op_lt
  6234. ast_expr_op_lt::ast_expr_op_lt(__isl_take isl_ast_expr *ptr)
  6235. : ast_expr_op(ptr) {}
  6236. ast_expr_op_lt::ast_expr_op_lt()
  6237. : ast_expr_op() {}
  6238. ast_expr_op_lt::ast_expr_op_lt(const ast_expr_op_lt &obj)
  6239. : ast_expr_op(obj)
  6240. {
  6241. }
  6242. ast_expr_op_lt &ast_expr_op_lt::operator=(ast_expr_op_lt obj) {
  6243. std::swap(this->ptr, obj.ptr);
  6244. return *this;
  6245. }
  6246. isl::ctx ast_expr_op_lt::ctx() const {
  6247. return isl::ctx(isl_ast_expr_get_ctx(ptr));
  6248. }
  6249. inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_lt &obj)
  6250. {
  6251. if (!obj.get())
  6252. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6253. auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
  6254. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6255. char *str = isl_ast_expr_to_str(obj.get());
  6256. if (!str)
  6257. exception::throw_last_error(saved_ctx);
  6258. os << str;
  6259. free(str);
  6260. return os;
  6261. }
  6262. // implementations for isl::ast_expr_op_max
  6263. ast_expr_op_max::ast_expr_op_max(__isl_take isl_ast_expr *ptr)
  6264. : ast_expr_op(ptr) {}
  6265. ast_expr_op_max::ast_expr_op_max()
  6266. : ast_expr_op() {}
  6267. ast_expr_op_max::ast_expr_op_max(const ast_expr_op_max &obj)
  6268. : ast_expr_op(obj)
  6269. {
  6270. }
  6271. ast_expr_op_max &ast_expr_op_max::operator=(ast_expr_op_max obj) {
  6272. std::swap(this->ptr, obj.ptr);
  6273. return *this;
  6274. }
  6275. isl::ctx ast_expr_op_max::ctx() const {
  6276. return isl::ctx(isl_ast_expr_get_ctx(ptr));
  6277. }
  6278. inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_max &obj)
  6279. {
  6280. if (!obj.get())
  6281. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6282. auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
  6283. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6284. char *str = isl_ast_expr_to_str(obj.get());
  6285. if (!str)
  6286. exception::throw_last_error(saved_ctx);
  6287. os << str;
  6288. free(str);
  6289. return os;
  6290. }
  6291. // implementations for isl::ast_expr_op_member
  6292. ast_expr_op_member::ast_expr_op_member(__isl_take isl_ast_expr *ptr)
  6293. : ast_expr_op(ptr) {}
  6294. ast_expr_op_member::ast_expr_op_member()
  6295. : ast_expr_op() {}
  6296. ast_expr_op_member::ast_expr_op_member(const ast_expr_op_member &obj)
  6297. : ast_expr_op(obj)
  6298. {
  6299. }
  6300. ast_expr_op_member &ast_expr_op_member::operator=(ast_expr_op_member obj) {
  6301. std::swap(this->ptr, obj.ptr);
  6302. return *this;
  6303. }
  6304. isl::ctx ast_expr_op_member::ctx() const {
  6305. return isl::ctx(isl_ast_expr_get_ctx(ptr));
  6306. }
  6307. inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_member &obj)
  6308. {
  6309. if (!obj.get())
  6310. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6311. auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
  6312. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6313. char *str = isl_ast_expr_to_str(obj.get());
  6314. if (!str)
  6315. exception::throw_last_error(saved_ctx);
  6316. os << str;
  6317. free(str);
  6318. return os;
  6319. }
  6320. // implementations for isl::ast_expr_op_min
  6321. ast_expr_op_min::ast_expr_op_min(__isl_take isl_ast_expr *ptr)
  6322. : ast_expr_op(ptr) {}
  6323. ast_expr_op_min::ast_expr_op_min()
  6324. : ast_expr_op() {}
  6325. ast_expr_op_min::ast_expr_op_min(const ast_expr_op_min &obj)
  6326. : ast_expr_op(obj)
  6327. {
  6328. }
  6329. ast_expr_op_min &ast_expr_op_min::operator=(ast_expr_op_min obj) {
  6330. std::swap(this->ptr, obj.ptr);
  6331. return *this;
  6332. }
  6333. isl::ctx ast_expr_op_min::ctx() const {
  6334. return isl::ctx(isl_ast_expr_get_ctx(ptr));
  6335. }
  6336. inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_min &obj)
  6337. {
  6338. if (!obj.get())
  6339. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6340. auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
  6341. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6342. char *str = isl_ast_expr_to_str(obj.get());
  6343. if (!str)
  6344. exception::throw_last_error(saved_ctx);
  6345. os << str;
  6346. free(str);
  6347. return os;
  6348. }
  6349. // implementations for isl::ast_expr_op_minus
  6350. ast_expr_op_minus::ast_expr_op_minus(__isl_take isl_ast_expr *ptr)
  6351. : ast_expr_op(ptr) {}
  6352. ast_expr_op_minus::ast_expr_op_minus()
  6353. : ast_expr_op() {}
  6354. ast_expr_op_minus::ast_expr_op_minus(const ast_expr_op_minus &obj)
  6355. : ast_expr_op(obj)
  6356. {
  6357. }
  6358. ast_expr_op_minus &ast_expr_op_minus::operator=(ast_expr_op_minus obj) {
  6359. std::swap(this->ptr, obj.ptr);
  6360. return *this;
  6361. }
  6362. isl::ctx ast_expr_op_minus::ctx() const {
  6363. return isl::ctx(isl_ast_expr_get_ctx(ptr));
  6364. }
  6365. inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_minus &obj)
  6366. {
  6367. if (!obj.get())
  6368. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6369. auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
  6370. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6371. char *str = isl_ast_expr_to_str(obj.get());
  6372. if (!str)
  6373. exception::throw_last_error(saved_ctx);
  6374. os << str;
  6375. free(str);
  6376. return os;
  6377. }
  6378. // implementations for isl::ast_expr_op_mul
  6379. ast_expr_op_mul::ast_expr_op_mul(__isl_take isl_ast_expr *ptr)
  6380. : ast_expr_op(ptr) {}
  6381. ast_expr_op_mul::ast_expr_op_mul()
  6382. : ast_expr_op() {}
  6383. ast_expr_op_mul::ast_expr_op_mul(const ast_expr_op_mul &obj)
  6384. : ast_expr_op(obj)
  6385. {
  6386. }
  6387. ast_expr_op_mul &ast_expr_op_mul::operator=(ast_expr_op_mul obj) {
  6388. std::swap(this->ptr, obj.ptr);
  6389. return *this;
  6390. }
  6391. isl::ctx ast_expr_op_mul::ctx() const {
  6392. return isl::ctx(isl_ast_expr_get_ctx(ptr));
  6393. }
  6394. inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_mul &obj)
  6395. {
  6396. if (!obj.get())
  6397. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6398. auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
  6399. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6400. char *str = isl_ast_expr_to_str(obj.get());
  6401. if (!str)
  6402. exception::throw_last_error(saved_ctx);
  6403. os << str;
  6404. free(str);
  6405. return os;
  6406. }
  6407. // implementations for isl::ast_expr_op_or
  6408. ast_expr_op_or::ast_expr_op_or(__isl_take isl_ast_expr *ptr)
  6409. : ast_expr_op(ptr) {}
  6410. ast_expr_op_or::ast_expr_op_or()
  6411. : ast_expr_op() {}
  6412. ast_expr_op_or::ast_expr_op_or(const ast_expr_op_or &obj)
  6413. : ast_expr_op(obj)
  6414. {
  6415. }
  6416. ast_expr_op_or &ast_expr_op_or::operator=(ast_expr_op_or obj) {
  6417. std::swap(this->ptr, obj.ptr);
  6418. return *this;
  6419. }
  6420. isl::ctx ast_expr_op_or::ctx() const {
  6421. return isl::ctx(isl_ast_expr_get_ctx(ptr));
  6422. }
  6423. inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_or &obj)
  6424. {
  6425. if (!obj.get())
  6426. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6427. auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
  6428. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6429. char *str = isl_ast_expr_to_str(obj.get());
  6430. if (!str)
  6431. exception::throw_last_error(saved_ctx);
  6432. os << str;
  6433. free(str);
  6434. return os;
  6435. }
  6436. // implementations for isl::ast_expr_op_or_else
  6437. ast_expr_op_or_else::ast_expr_op_or_else(__isl_take isl_ast_expr *ptr)
  6438. : ast_expr_op(ptr) {}
  6439. ast_expr_op_or_else::ast_expr_op_or_else()
  6440. : ast_expr_op() {}
  6441. ast_expr_op_or_else::ast_expr_op_or_else(const ast_expr_op_or_else &obj)
  6442. : ast_expr_op(obj)
  6443. {
  6444. }
  6445. ast_expr_op_or_else &ast_expr_op_or_else::operator=(ast_expr_op_or_else obj) {
  6446. std::swap(this->ptr, obj.ptr);
  6447. return *this;
  6448. }
  6449. isl::ctx ast_expr_op_or_else::ctx() const {
  6450. return isl::ctx(isl_ast_expr_get_ctx(ptr));
  6451. }
  6452. inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_or_else &obj)
  6453. {
  6454. if (!obj.get())
  6455. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6456. auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
  6457. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6458. char *str = isl_ast_expr_to_str(obj.get());
  6459. if (!str)
  6460. exception::throw_last_error(saved_ctx);
  6461. os << str;
  6462. free(str);
  6463. return os;
  6464. }
  6465. // implementations for isl::ast_expr_op_pdiv_q
  6466. ast_expr_op_pdiv_q::ast_expr_op_pdiv_q(__isl_take isl_ast_expr *ptr)
  6467. : ast_expr_op(ptr) {}
  6468. ast_expr_op_pdiv_q::ast_expr_op_pdiv_q()
  6469. : ast_expr_op() {}
  6470. ast_expr_op_pdiv_q::ast_expr_op_pdiv_q(const ast_expr_op_pdiv_q &obj)
  6471. : ast_expr_op(obj)
  6472. {
  6473. }
  6474. ast_expr_op_pdiv_q &ast_expr_op_pdiv_q::operator=(ast_expr_op_pdiv_q obj) {
  6475. std::swap(this->ptr, obj.ptr);
  6476. return *this;
  6477. }
  6478. isl::ctx ast_expr_op_pdiv_q::ctx() const {
  6479. return isl::ctx(isl_ast_expr_get_ctx(ptr));
  6480. }
  6481. inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_pdiv_q &obj)
  6482. {
  6483. if (!obj.get())
  6484. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6485. auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
  6486. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6487. char *str = isl_ast_expr_to_str(obj.get());
  6488. if (!str)
  6489. exception::throw_last_error(saved_ctx);
  6490. os << str;
  6491. free(str);
  6492. return os;
  6493. }
  6494. // implementations for isl::ast_expr_op_pdiv_r
  6495. ast_expr_op_pdiv_r::ast_expr_op_pdiv_r(__isl_take isl_ast_expr *ptr)
  6496. : ast_expr_op(ptr) {}
  6497. ast_expr_op_pdiv_r::ast_expr_op_pdiv_r()
  6498. : ast_expr_op() {}
  6499. ast_expr_op_pdiv_r::ast_expr_op_pdiv_r(const ast_expr_op_pdiv_r &obj)
  6500. : ast_expr_op(obj)
  6501. {
  6502. }
  6503. ast_expr_op_pdiv_r &ast_expr_op_pdiv_r::operator=(ast_expr_op_pdiv_r obj) {
  6504. std::swap(this->ptr, obj.ptr);
  6505. return *this;
  6506. }
  6507. isl::ctx ast_expr_op_pdiv_r::ctx() const {
  6508. return isl::ctx(isl_ast_expr_get_ctx(ptr));
  6509. }
  6510. inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_pdiv_r &obj)
  6511. {
  6512. if (!obj.get())
  6513. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6514. auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
  6515. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6516. char *str = isl_ast_expr_to_str(obj.get());
  6517. if (!str)
  6518. exception::throw_last_error(saved_ctx);
  6519. os << str;
  6520. free(str);
  6521. return os;
  6522. }
  6523. // implementations for isl::ast_expr_op_select
  6524. ast_expr_op_select::ast_expr_op_select(__isl_take isl_ast_expr *ptr)
  6525. : ast_expr_op(ptr) {}
  6526. ast_expr_op_select::ast_expr_op_select()
  6527. : ast_expr_op() {}
  6528. ast_expr_op_select::ast_expr_op_select(const ast_expr_op_select &obj)
  6529. : ast_expr_op(obj)
  6530. {
  6531. }
  6532. ast_expr_op_select &ast_expr_op_select::operator=(ast_expr_op_select obj) {
  6533. std::swap(this->ptr, obj.ptr);
  6534. return *this;
  6535. }
  6536. isl::ctx ast_expr_op_select::ctx() const {
  6537. return isl::ctx(isl_ast_expr_get_ctx(ptr));
  6538. }
  6539. inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_select &obj)
  6540. {
  6541. if (!obj.get())
  6542. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6543. auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
  6544. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6545. char *str = isl_ast_expr_to_str(obj.get());
  6546. if (!str)
  6547. exception::throw_last_error(saved_ctx);
  6548. os << str;
  6549. free(str);
  6550. return os;
  6551. }
  6552. // implementations for isl::ast_expr_op_sub
  6553. ast_expr_op_sub::ast_expr_op_sub(__isl_take isl_ast_expr *ptr)
  6554. : ast_expr_op(ptr) {}
  6555. ast_expr_op_sub::ast_expr_op_sub()
  6556. : ast_expr_op() {}
  6557. ast_expr_op_sub::ast_expr_op_sub(const ast_expr_op_sub &obj)
  6558. : ast_expr_op(obj)
  6559. {
  6560. }
  6561. ast_expr_op_sub &ast_expr_op_sub::operator=(ast_expr_op_sub obj) {
  6562. std::swap(this->ptr, obj.ptr);
  6563. return *this;
  6564. }
  6565. isl::ctx ast_expr_op_sub::ctx() const {
  6566. return isl::ctx(isl_ast_expr_get_ctx(ptr));
  6567. }
  6568. inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_sub &obj)
  6569. {
  6570. if (!obj.get())
  6571. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6572. auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
  6573. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6574. char *str = isl_ast_expr_to_str(obj.get());
  6575. if (!str)
  6576. exception::throw_last_error(saved_ctx);
  6577. os << str;
  6578. free(str);
  6579. return os;
  6580. }
  6581. // implementations for isl::ast_expr_op_zdiv_r
  6582. ast_expr_op_zdiv_r::ast_expr_op_zdiv_r(__isl_take isl_ast_expr *ptr)
  6583. : ast_expr_op(ptr) {}
  6584. ast_expr_op_zdiv_r::ast_expr_op_zdiv_r()
  6585. : ast_expr_op() {}
  6586. ast_expr_op_zdiv_r::ast_expr_op_zdiv_r(const ast_expr_op_zdiv_r &obj)
  6587. : ast_expr_op(obj)
  6588. {
  6589. }
  6590. ast_expr_op_zdiv_r &ast_expr_op_zdiv_r::operator=(ast_expr_op_zdiv_r obj) {
  6591. std::swap(this->ptr, obj.ptr);
  6592. return *this;
  6593. }
  6594. isl::ctx ast_expr_op_zdiv_r::ctx() const {
  6595. return isl::ctx(isl_ast_expr_get_ctx(ptr));
  6596. }
  6597. inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_zdiv_r &obj)
  6598. {
  6599. if (!obj.get())
  6600. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6601. auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
  6602. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6603. char *str = isl_ast_expr_to_str(obj.get());
  6604. if (!str)
  6605. exception::throw_last_error(saved_ctx);
  6606. os << str;
  6607. free(str);
  6608. return os;
  6609. }
  6610. // implementations for isl::ast_node
  6611. ast_node manage(__isl_take isl_ast_node *ptr) {
  6612. if (!ptr)
  6613. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6614. return ast_node(ptr);
  6615. }
  6616. ast_node manage_copy(__isl_keep isl_ast_node *ptr) {
  6617. if (!ptr)
  6618. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6619. auto saved_ctx = isl_ast_node_get_ctx(ptr);
  6620. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6621. ptr = isl_ast_node_copy(ptr);
  6622. if (!ptr)
  6623. exception::throw_last_error(saved_ctx);
  6624. return ast_node(ptr);
  6625. }
  6626. ast_node::ast_node(__isl_take isl_ast_node *ptr)
  6627. : ptr(ptr) {}
  6628. ast_node::ast_node()
  6629. : ptr(nullptr) {}
  6630. ast_node::ast_node(const ast_node &obj)
  6631. : ptr(nullptr)
  6632. {
  6633. if (!obj.ptr)
  6634. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6635. auto saved_ctx = isl_ast_node_get_ctx(obj.ptr);
  6636. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6637. ptr = obj.copy();
  6638. if (!ptr)
  6639. exception::throw_last_error(saved_ctx);
  6640. }
  6641. ast_node &ast_node::operator=(ast_node obj) {
  6642. std::swap(this->ptr, obj.ptr);
  6643. return *this;
  6644. }
  6645. ast_node::~ast_node() {
  6646. if (ptr)
  6647. isl_ast_node_free(ptr);
  6648. }
  6649. __isl_give isl_ast_node *ast_node::copy() const & {
  6650. return isl_ast_node_copy(ptr);
  6651. }
  6652. __isl_keep isl_ast_node *ast_node::get() const {
  6653. return ptr;
  6654. }
  6655. __isl_give isl_ast_node *ast_node::release() {
  6656. isl_ast_node *tmp = ptr;
  6657. ptr = nullptr;
  6658. return tmp;
  6659. }
  6660. bool ast_node::is_null() const {
  6661. return ptr == nullptr;
  6662. }
  6663. template <typename T, typename>
  6664. bool ast_node::isa_type(T subtype) const
  6665. {
  6666. if (is_null())
  6667. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6668. return isl_ast_node_get_type(get()) == subtype;
  6669. }
  6670. template <class T>
  6671. bool ast_node::isa() const
  6672. {
  6673. return isa_type<decltype(T::type)>(T::type);
  6674. }
  6675. template <class T>
  6676. T ast_node::as() const
  6677. {
  6678. if (!isa<T>())
  6679. exception::throw_invalid("not an object of the requested subtype", __FILE__, __LINE__);
  6680. return T(copy());
  6681. }
  6682. isl::ctx ast_node::ctx() const {
  6683. return isl::ctx(isl_ast_node_get_ctx(ptr));
  6684. }
  6685. std::string ast_node::to_C_str() const
  6686. {
  6687. if (!ptr)
  6688. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6689. auto saved_ctx = ctx();
  6690. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6691. auto res = isl_ast_node_to_C_str(get());
  6692. std::string tmp(res);
  6693. free(res);
  6694. return tmp;
  6695. }
  6696. isl::ast_node_list ast_node::to_list() const
  6697. {
  6698. if (!ptr)
  6699. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6700. auto saved_ctx = ctx();
  6701. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6702. auto res = isl_ast_node_to_list(copy());
  6703. if (!res)
  6704. exception::throw_last_error(saved_ctx);
  6705. return manage(res);
  6706. }
  6707. inline std::ostream &operator<<(std::ostream &os, const ast_node &obj)
  6708. {
  6709. if (!obj.get())
  6710. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6711. auto saved_ctx = isl_ast_node_get_ctx(obj.get());
  6712. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6713. char *str = isl_ast_node_to_str(obj.get());
  6714. if (!str)
  6715. exception::throw_last_error(saved_ctx);
  6716. os << str;
  6717. free(str);
  6718. return os;
  6719. }
  6720. // implementations for isl::ast_node_block
  6721. ast_node_block::ast_node_block(__isl_take isl_ast_node *ptr)
  6722. : ast_node(ptr) {}
  6723. ast_node_block::ast_node_block()
  6724. : ast_node() {}
  6725. ast_node_block::ast_node_block(const ast_node_block &obj)
  6726. : ast_node(obj)
  6727. {
  6728. }
  6729. ast_node_block &ast_node_block::operator=(ast_node_block obj) {
  6730. std::swap(this->ptr, obj.ptr);
  6731. return *this;
  6732. }
  6733. isl::ctx ast_node_block::ctx() const {
  6734. return isl::ctx(isl_ast_node_get_ctx(ptr));
  6735. }
  6736. isl::ast_node_list ast_node_block::children() const
  6737. {
  6738. if (!ptr)
  6739. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6740. auto saved_ctx = ctx();
  6741. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6742. auto res = isl_ast_node_block_get_children(get());
  6743. if (!res)
  6744. exception::throw_last_error(saved_ctx);
  6745. return manage(res);
  6746. }
  6747. isl::ast_node_list ast_node_block::get_children() const
  6748. {
  6749. return children();
  6750. }
  6751. inline std::ostream &operator<<(std::ostream &os, const ast_node_block &obj)
  6752. {
  6753. if (!obj.get())
  6754. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6755. auto saved_ctx = isl_ast_node_get_ctx(obj.get());
  6756. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6757. char *str = isl_ast_node_to_str(obj.get());
  6758. if (!str)
  6759. exception::throw_last_error(saved_ctx);
  6760. os << str;
  6761. free(str);
  6762. return os;
  6763. }
  6764. // implementations for isl::ast_node_for
  6765. ast_node_for::ast_node_for(__isl_take isl_ast_node *ptr)
  6766. : ast_node(ptr) {}
  6767. ast_node_for::ast_node_for()
  6768. : ast_node() {}
  6769. ast_node_for::ast_node_for(const ast_node_for &obj)
  6770. : ast_node(obj)
  6771. {
  6772. }
  6773. ast_node_for &ast_node_for::operator=(ast_node_for obj) {
  6774. std::swap(this->ptr, obj.ptr);
  6775. return *this;
  6776. }
  6777. isl::ctx ast_node_for::ctx() const {
  6778. return isl::ctx(isl_ast_node_get_ctx(ptr));
  6779. }
  6780. isl::ast_node ast_node_for::body() const
  6781. {
  6782. if (!ptr)
  6783. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6784. auto saved_ctx = ctx();
  6785. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6786. auto res = isl_ast_node_for_get_body(get());
  6787. if (!res)
  6788. exception::throw_last_error(saved_ctx);
  6789. return manage(res);
  6790. }
  6791. isl::ast_node ast_node_for::get_body() const
  6792. {
  6793. return body();
  6794. }
  6795. isl::ast_expr ast_node_for::cond() const
  6796. {
  6797. if (!ptr)
  6798. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6799. auto saved_ctx = ctx();
  6800. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6801. auto res = isl_ast_node_for_get_cond(get());
  6802. if (!res)
  6803. exception::throw_last_error(saved_ctx);
  6804. return manage(res);
  6805. }
  6806. isl::ast_expr ast_node_for::get_cond() const
  6807. {
  6808. return cond();
  6809. }
  6810. isl::ast_expr ast_node_for::inc() const
  6811. {
  6812. if (!ptr)
  6813. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6814. auto saved_ctx = ctx();
  6815. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6816. auto res = isl_ast_node_for_get_inc(get());
  6817. if (!res)
  6818. exception::throw_last_error(saved_ctx);
  6819. return manage(res);
  6820. }
  6821. isl::ast_expr ast_node_for::get_inc() const
  6822. {
  6823. return inc();
  6824. }
  6825. isl::ast_expr ast_node_for::init() const
  6826. {
  6827. if (!ptr)
  6828. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6829. auto saved_ctx = ctx();
  6830. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6831. auto res = isl_ast_node_for_get_init(get());
  6832. if (!res)
  6833. exception::throw_last_error(saved_ctx);
  6834. return manage(res);
  6835. }
  6836. isl::ast_expr ast_node_for::get_init() const
  6837. {
  6838. return init();
  6839. }
  6840. bool ast_node_for::is_degenerate() const
  6841. {
  6842. if (!ptr)
  6843. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6844. auto saved_ctx = ctx();
  6845. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6846. auto res = isl_ast_node_for_is_degenerate(get());
  6847. if (res < 0)
  6848. exception::throw_last_error(saved_ctx);
  6849. return res;
  6850. }
  6851. isl::ast_expr ast_node_for::iterator() const
  6852. {
  6853. if (!ptr)
  6854. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6855. auto saved_ctx = ctx();
  6856. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6857. auto res = isl_ast_node_for_get_iterator(get());
  6858. if (!res)
  6859. exception::throw_last_error(saved_ctx);
  6860. return manage(res);
  6861. }
  6862. isl::ast_expr ast_node_for::get_iterator() const
  6863. {
  6864. return iterator();
  6865. }
  6866. inline std::ostream &operator<<(std::ostream &os, const ast_node_for &obj)
  6867. {
  6868. if (!obj.get())
  6869. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6870. auto saved_ctx = isl_ast_node_get_ctx(obj.get());
  6871. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6872. char *str = isl_ast_node_to_str(obj.get());
  6873. if (!str)
  6874. exception::throw_last_error(saved_ctx);
  6875. os << str;
  6876. free(str);
  6877. return os;
  6878. }
  6879. // implementations for isl::ast_node_if
  6880. ast_node_if::ast_node_if(__isl_take isl_ast_node *ptr)
  6881. : ast_node(ptr) {}
  6882. ast_node_if::ast_node_if()
  6883. : ast_node() {}
  6884. ast_node_if::ast_node_if(const ast_node_if &obj)
  6885. : ast_node(obj)
  6886. {
  6887. }
  6888. ast_node_if &ast_node_if::operator=(ast_node_if obj) {
  6889. std::swap(this->ptr, obj.ptr);
  6890. return *this;
  6891. }
  6892. isl::ctx ast_node_if::ctx() const {
  6893. return isl::ctx(isl_ast_node_get_ctx(ptr));
  6894. }
  6895. isl::ast_expr ast_node_if::cond() const
  6896. {
  6897. if (!ptr)
  6898. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6899. auto saved_ctx = ctx();
  6900. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6901. auto res = isl_ast_node_if_get_cond(get());
  6902. if (!res)
  6903. exception::throw_last_error(saved_ctx);
  6904. return manage(res);
  6905. }
  6906. isl::ast_expr ast_node_if::get_cond() const
  6907. {
  6908. return cond();
  6909. }
  6910. isl::ast_node ast_node_if::else_node() const
  6911. {
  6912. if (!ptr)
  6913. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6914. auto saved_ctx = ctx();
  6915. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6916. auto res = isl_ast_node_if_get_else_node(get());
  6917. if (!res)
  6918. exception::throw_last_error(saved_ctx);
  6919. return manage(res);
  6920. }
  6921. isl::ast_node ast_node_if::get_else_node() const
  6922. {
  6923. return else_node();
  6924. }
  6925. bool ast_node_if::has_else_node() const
  6926. {
  6927. if (!ptr)
  6928. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6929. auto saved_ctx = ctx();
  6930. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6931. auto res = isl_ast_node_if_has_else_node(get());
  6932. if (res < 0)
  6933. exception::throw_last_error(saved_ctx);
  6934. return res;
  6935. }
  6936. isl::ast_node ast_node_if::then_node() const
  6937. {
  6938. if (!ptr)
  6939. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6940. auto saved_ctx = ctx();
  6941. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6942. auto res = isl_ast_node_if_get_then_node(get());
  6943. if (!res)
  6944. exception::throw_last_error(saved_ctx);
  6945. return manage(res);
  6946. }
  6947. isl::ast_node ast_node_if::get_then_node() const
  6948. {
  6949. return then_node();
  6950. }
  6951. inline std::ostream &operator<<(std::ostream &os, const ast_node_if &obj)
  6952. {
  6953. if (!obj.get())
  6954. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6955. auto saved_ctx = isl_ast_node_get_ctx(obj.get());
  6956. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6957. char *str = isl_ast_node_to_str(obj.get());
  6958. if (!str)
  6959. exception::throw_last_error(saved_ctx);
  6960. os << str;
  6961. free(str);
  6962. return os;
  6963. }
  6964. // implementations for isl::ast_node_list
  6965. ast_node_list manage(__isl_take isl_ast_node_list *ptr) {
  6966. if (!ptr)
  6967. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6968. return ast_node_list(ptr);
  6969. }
  6970. ast_node_list manage_copy(__isl_keep isl_ast_node_list *ptr) {
  6971. if (!ptr)
  6972. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6973. auto saved_ctx = isl_ast_node_list_get_ctx(ptr);
  6974. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6975. ptr = isl_ast_node_list_copy(ptr);
  6976. if (!ptr)
  6977. exception::throw_last_error(saved_ctx);
  6978. return ast_node_list(ptr);
  6979. }
  6980. ast_node_list::ast_node_list(__isl_take isl_ast_node_list *ptr)
  6981. : ptr(ptr) {}
  6982. ast_node_list::ast_node_list()
  6983. : ptr(nullptr) {}
  6984. ast_node_list::ast_node_list(const ast_node_list &obj)
  6985. : ptr(nullptr)
  6986. {
  6987. if (!obj.ptr)
  6988. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  6989. auto saved_ctx = isl_ast_node_list_get_ctx(obj.ptr);
  6990. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6991. ptr = obj.copy();
  6992. if (!ptr)
  6993. exception::throw_last_error(saved_ctx);
  6994. }
  6995. ast_node_list::ast_node_list(isl::ctx ctx, int n)
  6996. {
  6997. auto saved_ctx = ctx;
  6998. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  6999. auto res = isl_ast_node_list_alloc(ctx.release(), n);
  7000. if (!res)
  7001. exception::throw_last_error(saved_ctx);
  7002. ptr = res;
  7003. }
  7004. ast_node_list::ast_node_list(isl::ast_node el)
  7005. {
  7006. if (el.is_null())
  7007. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7008. auto saved_ctx = el.ctx();
  7009. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7010. auto res = isl_ast_node_list_from_ast_node(el.release());
  7011. if (!res)
  7012. exception::throw_last_error(saved_ctx);
  7013. ptr = res;
  7014. }
  7015. ast_node_list &ast_node_list::operator=(ast_node_list obj) {
  7016. std::swap(this->ptr, obj.ptr);
  7017. return *this;
  7018. }
  7019. ast_node_list::~ast_node_list() {
  7020. if (ptr)
  7021. isl_ast_node_list_free(ptr);
  7022. }
  7023. __isl_give isl_ast_node_list *ast_node_list::copy() const & {
  7024. return isl_ast_node_list_copy(ptr);
  7025. }
  7026. __isl_keep isl_ast_node_list *ast_node_list::get() const {
  7027. return ptr;
  7028. }
  7029. __isl_give isl_ast_node_list *ast_node_list::release() {
  7030. isl_ast_node_list *tmp = ptr;
  7031. ptr = nullptr;
  7032. return tmp;
  7033. }
  7034. bool ast_node_list::is_null() const {
  7035. return ptr == nullptr;
  7036. }
  7037. isl::ctx ast_node_list::ctx() const {
  7038. return isl::ctx(isl_ast_node_list_get_ctx(ptr));
  7039. }
  7040. isl::ast_node_list ast_node_list::add(isl::ast_node el) const
  7041. {
  7042. if (!ptr || el.is_null())
  7043. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7044. auto saved_ctx = ctx();
  7045. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7046. auto res = isl_ast_node_list_add(copy(), el.release());
  7047. if (!res)
  7048. exception::throw_last_error(saved_ctx);
  7049. return manage(res);
  7050. }
  7051. isl::ast_node ast_node_list::at(int index) const
  7052. {
  7053. if (!ptr)
  7054. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7055. auto saved_ctx = ctx();
  7056. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7057. auto res = isl_ast_node_list_get_at(get(), index);
  7058. if (!res)
  7059. exception::throw_last_error(saved_ctx);
  7060. return manage(res);
  7061. }
  7062. isl::ast_node ast_node_list::get_at(int index) const
  7063. {
  7064. return at(index);
  7065. }
  7066. isl::ast_node_list ast_node_list::clear() const
  7067. {
  7068. if (!ptr)
  7069. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7070. auto saved_ctx = ctx();
  7071. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7072. auto res = isl_ast_node_list_clear(copy());
  7073. if (!res)
  7074. exception::throw_last_error(saved_ctx);
  7075. return manage(res);
  7076. }
  7077. isl::ast_node_list ast_node_list::concat(isl::ast_node_list list2) const
  7078. {
  7079. if (!ptr || list2.is_null())
  7080. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7081. auto saved_ctx = ctx();
  7082. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7083. auto res = isl_ast_node_list_concat(copy(), list2.release());
  7084. if (!res)
  7085. exception::throw_last_error(saved_ctx);
  7086. return manage(res);
  7087. }
  7088. isl::ast_node_list ast_node_list::drop(unsigned int first, unsigned int n) const
  7089. {
  7090. if (!ptr)
  7091. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7092. auto saved_ctx = ctx();
  7093. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7094. auto res = isl_ast_node_list_drop(copy(), first, n);
  7095. if (!res)
  7096. exception::throw_last_error(saved_ctx);
  7097. return manage(res);
  7098. }
  7099. void ast_node_list::foreach(const std::function<void(isl::ast_node)> &fn) const
  7100. {
  7101. if (!ptr)
  7102. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7103. auto saved_ctx = ctx();
  7104. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7105. struct fn_data {
  7106. std::function<void(isl::ast_node)> func;
  7107. std::exception_ptr eptr;
  7108. } fn_data = { fn };
  7109. auto fn_lambda = [](isl_ast_node *arg_0, void *arg_1) -> isl_stat {
  7110. auto *data = static_cast<struct fn_data *>(arg_1);
  7111. ISL_CPP_TRY {
  7112. (data->func)(manage(arg_0));
  7113. return isl_stat_ok;
  7114. } ISL_CPP_CATCH_ALL {
  7115. data->eptr = std::current_exception();
  7116. return isl_stat_error;
  7117. }
  7118. };
  7119. auto res = isl_ast_node_list_foreach(get(), fn_lambda, &fn_data);
  7120. if (fn_data.eptr)
  7121. std::rethrow_exception(fn_data.eptr);
  7122. if (res < 0)
  7123. exception::throw_last_error(saved_ctx);
  7124. return;
  7125. }
  7126. void ast_node_list::foreach_scc(const std::function<bool(isl::ast_node, isl::ast_node)> &follows, const std::function<void(isl::ast_node_list)> &fn) const
  7127. {
  7128. if (!ptr)
  7129. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7130. auto saved_ctx = ctx();
  7131. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7132. struct follows_data {
  7133. std::function<bool(isl::ast_node, isl::ast_node)> func;
  7134. std::exception_ptr eptr;
  7135. } follows_data = { follows };
  7136. auto follows_lambda = [](isl_ast_node *arg_0, isl_ast_node *arg_1, void *arg_2) -> isl_bool {
  7137. auto *data = static_cast<struct follows_data *>(arg_2);
  7138. ISL_CPP_TRY {
  7139. auto ret = (data->func)(manage_copy(arg_0), manage_copy(arg_1));
  7140. return ret ? isl_bool_true : isl_bool_false;
  7141. } ISL_CPP_CATCH_ALL {
  7142. data->eptr = std::current_exception();
  7143. return isl_bool_error;
  7144. }
  7145. };
  7146. struct fn_data {
  7147. std::function<void(isl::ast_node_list)> func;
  7148. std::exception_ptr eptr;
  7149. } fn_data = { fn };
  7150. auto fn_lambda = [](isl_ast_node_list *arg_0, void *arg_1) -> isl_stat {
  7151. auto *data = static_cast<struct fn_data *>(arg_1);
  7152. ISL_CPP_TRY {
  7153. (data->func)(manage(arg_0));
  7154. return isl_stat_ok;
  7155. } ISL_CPP_CATCH_ALL {
  7156. data->eptr = std::current_exception();
  7157. return isl_stat_error;
  7158. }
  7159. };
  7160. auto res = isl_ast_node_list_foreach_scc(get(), follows_lambda, &follows_data, fn_lambda, &fn_data);
  7161. if (follows_data.eptr)
  7162. std::rethrow_exception(follows_data.eptr);
  7163. if (fn_data.eptr)
  7164. std::rethrow_exception(fn_data.eptr);
  7165. if (res < 0)
  7166. exception::throw_last_error(saved_ctx);
  7167. return;
  7168. }
  7169. isl::ast_node_list ast_node_list::insert(unsigned int pos, isl::ast_node el) const
  7170. {
  7171. if (!ptr || el.is_null())
  7172. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7173. auto saved_ctx = ctx();
  7174. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7175. auto res = isl_ast_node_list_insert(copy(), pos, el.release());
  7176. if (!res)
  7177. exception::throw_last_error(saved_ctx);
  7178. return manage(res);
  7179. }
  7180. unsigned ast_node_list::size() const
  7181. {
  7182. if (!ptr)
  7183. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7184. auto saved_ctx = ctx();
  7185. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7186. auto res = isl_ast_node_list_size(get());
  7187. if (res < 0)
  7188. exception::throw_last_error(saved_ctx);
  7189. return res;
  7190. }
  7191. inline std::ostream &operator<<(std::ostream &os, const ast_node_list &obj)
  7192. {
  7193. if (!obj.get())
  7194. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7195. auto saved_ctx = isl_ast_node_list_get_ctx(obj.get());
  7196. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7197. char *str = isl_ast_node_list_to_str(obj.get());
  7198. if (!str)
  7199. exception::throw_last_error(saved_ctx);
  7200. os << str;
  7201. free(str);
  7202. return os;
  7203. }
  7204. // implementations for isl::ast_node_mark
  7205. ast_node_mark::ast_node_mark(__isl_take isl_ast_node *ptr)
  7206. : ast_node(ptr) {}
  7207. ast_node_mark::ast_node_mark()
  7208. : ast_node() {}
  7209. ast_node_mark::ast_node_mark(const ast_node_mark &obj)
  7210. : ast_node(obj)
  7211. {
  7212. }
  7213. ast_node_mark &ast_node_mark::operator=(ast_node_mark obj) {
  7214. std::swap(this->ptr, obj.ptr);
  7215. return *this;
  7216. }
  7217. isl::ctx ast_node_mark::ctx() const {
  7218. return isl::ctx(isl_ast_node_get_ctx(ptr));
  7219. }
  7220. isl::id ast_node_mark::id() const
  7221. {
  7222. if (!ptr)
  7223. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7224. auto saved_ctx = ctx();
  7225. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7226. auto res = isl_ast_node_mark_get_id(get());
  7227. if (!res)
  7228. exception::throw_last_error(saved_ctx);
  7229. return manage(res);
  7230. }
  7231. isl::id ast_node_mark::get_id() const
  7232. {
  7233. return id();
  7234. }
  7235. isl::ast_node ast_node_mark::node() const
  7236. {
  7237. if (!ptr)
  7238. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7239. auto saved_ctx = ctx();
  7240. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7241. auto res = isl_ast_node_mark_get_node(get());
  7242. if (!res)
  7243. exception::throw_last_error(saved_ctx);
  7244. return manage(res);
  7245. }
  7246. isl::ast_node ast_node_mark::get_node() const
  7247. {
  7248. return node();
  7249. }
  7250. inline std::ostream &operator<<(std::ostream &os, const ast_node_mark &obj)
  7251. {
  7252. if (!obj.get())
  7253. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7254. auto saved_ctx = isl_ast_node_get_ctx(obj.get());
  7255. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7256. char *str = isl_ast_node_to_str(obj.get());
  7257. if (!str)
  7258. exception::throw_last_error(saved_ctx);
  7259. os << str;
  7260. free(str);
  7261. return os;
  7262. }
  7263. // implementations for isl::ast_node_user
  7264. ast_node_user::ast_node_user(__isl_take isl_ast_node *ptr)
  7265. : ast_node(ptr) {}
  7266. ast_node_user::ast_node_user()
  7267. : ast_node() {}
  7268. ast_node_user::ast_node_user(const ast_node_user &obj)
  7269. : ast_node(obj)
  7270. {
  7271. }
  7272. ast_node_user &ast_node_user::operator=(ast_node_user obj) {
  7273. std::swap(this->ptr, obj.ptr);
  7274. return *this;
  7275. }
  7276. isl::ctx ast_node_user::ctx() const {
  7277. return isl::ctx(isl_ast_node_get_ctx(ptr));
  7278. }
  7279. isl::ast_expr ast_node_user::expr() const
  7280. {
  7281. if (!ptr)
  7282. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7283. auto saved_ctx = ctx();
  7284. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7285. auto res = isl_ast_node_user_get_expr(get());
  7286. if (!res)
  7287. exception::throw_last_error(saved_ctx);
  7288. return manage(res);
  7289. }
  7290. isl::ast_expr ast_node_user::get_expr() const
  7291. {
  7292. return expr();
  7293. }
  7294. inline std::ostream &operator<<(std::ostream &os, const ast_node_user &obj)
  7295. {
  7296. if (!obj.get())
  7297. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7298. auto saved_ctx = isl_ast_node_get_ctx(obj.get());
  7299. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7300. char *str = isl_ast_node_to_str(obj.get());
  7301. if (!str)
  7302. exception::throw_last_error(saved_ctx);
  7303. os << str;
  7304. free(str);
  7305. return os;
  7306. }
  7307. // implementations for isl::basic_map
  7308. basic_map manage(__isl_take isl_basic_map *ptr) {
  7309. if (!ptr)
  7310. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7311. return basic_map(ptr);
  7312. }
  7313. basic_map manage_copy(__isl_keep isl_basic_map *ptr) {
  7314. if (!ptr)
  7315. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7316. auto saved_ctx = isl_basic_map_get_ctx(ptr);
  7317. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7318. ptr = isl_basic_map_copy(ptr);
  7319. if (!ptr)
  7320. exception::throw_last_error(saved_ctx);
  7321. return basic_map(ptr);
  7322. }
  7323. basic_map::basic_map(__isl_take isl_basic_map *ptr)
  7324. : ptr(ptr) {}
  7325. basic_map::basic_map()
  7326. : ptr(nullptr) {}
  7327. basic_map::basic_map(const basic_map &obj)
  7328. : ptr(nullptr)
  7329. {
  7330. if (!obj.ptr)
  7331. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7332. auto saved_ctx = isl_basic_map_get_ctx(obj.ptr);
  7333. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7334. ptr = obj.copy();
  7335. if (!ptr)
  7336. exception::throw_last_error(saved_ctx);
  7337. }
  7338. basic_map::basic_map(isl::ctx ctx, const std::string &str)
  7339. {
  7340. auto saved_ctx = ctx;
  7341. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7342. auto res = isl_basic_map_read_from_str(ctx.release(), str.c_str());
  7343. if (!res)
  7344. exception::throw_last_error(saved_ctx);
  7345. ptr = res;
  7346. }
  7347. basic_map &basic_map::operator=(basic_map obj) {
  7348. std::swap(this->ptr, obj.ptr);
  7349. return *this;
  7350. }
  7351. basic_map::~basic_map() {
  7352. if (ptr)
  7353. isl_basic_map_free(ptr);
  7354. }
  7355. __isl_give isl_basic_map *basic_map::copy() const & {
  7356. return isl_basic_map_copy(ptr);
  7357. }
  7358. __isl_keep isl_basic_map *basic_map::get() const {
  7359. return ptr;
  7360. }
  7361. __isl_give isl_basic_map *basic_map::release() {
  7362. isl_basic_map *tmp = ptr;
  7363. ptr = nullptr;
  7364. return tmp;
  7365. }
  7366. bool basic_map::is_null() const {
  7367. return ptr == nullptr;
  7368. }
  7369. isl::ctx basic_map::ctx() const {
  7370. return isl::ctx(isl_basic_map_get_ctx(ptr));
  7371. }
  7372. isl::basic_map basic_map::affine_hull() const
  7373. {
  7374. if (!ptr)
  7375. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7376. auto saved_ctx = ctx();
  7377. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7378. auto res = isl_basic_map_affine_hull(copy());
  7379. if (!res)
  7380. exception::throw_last_error(saved_ctx);
  7381. return manage(res);
  7382. }
  7383. isl::basic_map basic_map::apply_domain(isl::basic_map bmap2) const
  7384. {
  7385. if (!ptr || bmap2.is_null())
  7386. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7387. auto saved_ctx = ctx();
  7388. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7389. auto res = isl_basic_map_apply_domain(copy(), bmap2.release());
  7390. if (!res)
  7391. exception::throw_last_error(saved_ctx);
  7392. return manage(res);
  7393. }
  7394. isl::map basic_map::apply_domain(const isl::map &map2) const
  7395. {
  7396. if (!ptr)
  7397. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7398. return isl::map(*this).apply_domain(map2);
  7399. }
  7400. isl::union_map basic_map::apply_domain(const isl::union_map &umap2) const
  7401. {
  7402. if (!ptr)
  7403. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7404. return isl::map(*this).apply_domain(umap2);
  7405. }
  7406. isl::basic_map basic_map::apply_range(isl::basic_map bmap2) const
  7407. {
  7408. if (!ptr || bmap2.is_null())
  7409. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7410. auto saved_ctx = ctx();
  7411. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7412. auto res = isl_basic_map_apply_range(copy(), bmap2.release());
  7413. if (!res)
  7414. exception::throw_last_error(saved_ctx);
  7415. return manage(res);
  7416. }
  7417. isl::map basic_map::apply_range(const isl::map &map2) const
  7418. {
  7419. if (!ptr)
  7420. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7421. return isl::map(*this).apply_range(map2);
  7422. }
  7423. isl::union_map basic_map::apply_range(const isl::union_map &umap2) const
  7424. {
  7425. if (!ptr)
  7426. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7427. return isl::map(*this).apply_range(umap2);
  7428. }
  7429. isl::map basic_map::as_map() const
  7430. {
  7431. if (!ptr)
  7432. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7433. return isl::map(*this).as_map();
  7434. }
  7435. isl::multi_union_pw_aff basic_map::as_multi_union_pw_aff() const
  7436. {
  7437. if (!ptr)
  7438. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7439. return isl::map(*this).as_multi_union_pw_aff();
  7440. }
  7441. isl::pw_multi_aff basic_map::as_pw_multi_aff() const
  7442. {
  7443. if (!ptr)
  7444. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7445. return isl::map(*this).as_pw_multi_aff();
  7446. }
  7447. isl::union_pw_multi_aff basic_map::as_union_pw_multi_aff() const
  7448. {
  7449. if (!ptr)
  7450. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7451. return isl::map(*this).as_union_pw_multi_aff();
  7452. }
  7453. isl::set basic_map::bind_domain(const isl::multi_id &tuple) const
  7454. {
  7455. if (!ptr)
  7456. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7457. return isl::map(*this).bind_domain(tuple);
  7458. }
  7459. isl::set basic_map::bind_range(const isl::multi_id &tuple) const
  7460. {
  7461. if (!ptr)
  7462. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7463. return isl::map(*this).bind_range(tuple);
  7464. }
  7465. isl::map basic_map::coalesce() const
  7466. {
  7467. if (!ptr)
  7468. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7469. return isl::map(*this).coalesce();
  7470. }
  7471. isl::map basic_map::complement() const
  7472. {
  7473. if (!ptr)
  7474. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7475. return isl::map(*this).complement();
  7476. }
  7477. isl::union_map basic_map::compute_divs() const
  7478. {
  7479. if (!ptr)
  7480. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7481. return isl::map(*this).compute_divs();
  7482. }
  7483. isl::map basic_map::curry() const
  7484. {
  7485. if (!ptr)
  7486. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7487. return isl::map(*this).curry();
  7488. }
  7489. isl::basic_set basic_map::deltas() const
  7490. {
  7491. if (!ptr)
  7492. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7493. auto saved_ctx = ctx();
  7494. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7495. auto res = isl_basic_map_deltas(copy());
  7496. if (!res)
  7497. exception::throw_last_error(saved_ctx);
  7498. return manage(res);
  7499. }
  7500. isl::basic_map basic_map::detect_equalities() const
  7501. {
  7502. if (!ptr)
  7503. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7504. auto saved_ctx = ctx();
  7505. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7506. auto res = isl_basic_map_detect_equalities(copy());
  7507. if (!res)
  7508. exception::throw_last_error(saved_ctx);
  7509. return manage(res);
  7510. }
  7511. isl::set basic_map::domain() const
  7512. {
  7513. if (!ptr)
  7514. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7515. return isl::map(*this).domain();
  7516. }
  7517. isl::map basic_map::domain_factor_domain() const
  7518. {
  7519. if (!ptr)
  7520. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7521. return isl::map(*this).domain_factor_domain();
  7522. }
  7523. isl::map basic_map::domain_factor_range() const
  7524. {
  7525. if (!ptr)
  7526. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7527. return isl::map(*this).domain_factor_range();
  7528. }
  7529. isl::union_map basic_map::domain_map() const
  7530. {
  7531. if (!ptr)
  7532. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7533. return isl::map(*this).domain_map();
  7534. }
  7535. isl::union_pw_multi_aff basic_map::domain_map_union_pw_multi_aff() const
  7536. {
  7537. if (!ptr)
  7538. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7539. return isl::map(*this).domain_map_union_pw_multi_aff();
  7540. }
  7541. isl::map basic_map::domain_product(const isl::map &map2) const
  7542. {
  7543. if (!ptr)
  7544. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7545. return isl::map(*this).domain_product(map2);
  7546. }
  7547. isl::union_map basic_map::domain_product(const isl::union_map &umap2) const
  7548. {
  7549. if (!ptr)
  7550. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7551. return isl::map(*this).domain_product(umap2);
  7552. }
  7553. unsigned basic_map::domain_tuple_dim() const
  7554. {
  7555. if (!ptr)
  7556. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7557. return isl::map(*this).domain_tuple_dim();
  7558. }
  7559. isl::id basic_map::domain_tuple_id() const
  7560. {
  7561. if (!ptr)
  7562. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7563. return isl::map(*this).domain_tuple_id();
  7564. }
  7565. isl::map basic_map::eq_at(const isl::multi_pw_aff &mpa) const
  7566. {
  7567. if (!ptr)
  7568. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7569. return isl::map(*this).eq_at(mpa);
  7570. }
  7571. isl::union_map basic_map::eq_at(const isl::multi_union_pw_aff &mupa) const
  7572. {
  7573. if (!ptr)
  7574. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7575. return isl::map(*this).eq_at(mupa);
  7576. }
  7577. bool basic_map::every_map(const std::function<bool(isl::map)> &test) const
  7578. {
  7579. if (!ptr)
  7580. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7581. return isl::map(*this).every_map(test);
  7582. }
  7583. isl::map basic_map::extract_map(const isl::space &space) const
  7584. {
  7585. if (!ptr)
  7586. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7587. return isl::map(*this).extract_map(space);
  7588. }
  7589. isl::map basic_map::factor_domain() const
  7590. {
  7591. if (!ptr)
  7592. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7593. return isl::map(*this).factor_domain();
  7594. }
  7595. isl::map basic_map::factor_range() const
  7596. {
  7597. if (!ptr)
  7598. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7599. return isl::map(*this).factor_range();
  7600. }
  7601. isl::union_map basic_map::fixed_power(const isl::val &exp) const
  7602. {
  7603. if (!ptr)
  7604. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7605. return isl::map(*this).fixed_power(exp);
  7606. }
  7607. isl::union_map basic_map::fixed_power(long exp) const
  7608. {
  7609. if (!ptr)
  7610. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7611. return this->fixed_power(isl::val(ctx(), exp));
  7612. }
  7613. isl::basic_map basic_map::flatten() const
  7614. {
  7615. if (!ptr)
  7616. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7617. auto saved_ctx = ctx();
  7618. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7619. auto res = isl_basic_map_flatten(copy());
  7620. if (!res)
  7621. exception::throw_last_error(saved_ctx);
  7622. return manage(res);
  7623. }
  7624. isl::basic_map basic_map::flatten_domain() const
  7625. {
  7626. if (!ptr)
  7627. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7628. auto saved_ctx = ctx();
  7629. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7630. auto res = isl_basic_map_flatten_domain(copy());
  7631. if (!res)
  7632. exception::throw_last_error(saved_ctx);
  7633. return manage(res);
  7634. }
  7635. isl::basic_map basic_map::flatten_range() const
  7636. {
  7637. if (!ptr)
  7638. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7639. auto saved_ctx = ctx();
  7640. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7641. auto res = isl_basic_map_flatten_range(copy());
  7642. if (!res)
  7643. exception::throw_last_error(saved_ctx);
  7644. return manage(res);
  7645. }
  7646. void basic_map::foreach_basic_map(const std::function<void(isl::basic_map)> &fn) const
  7647. {
  7648. if (!ptr)
  7649. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7650. return isl::map(*this).foreach_basic_map(fn);
  7651. }
  7652. void basic_map::foreach_map(const std::function<void(isl::map)> &fn) const
  7653. {
  7654. if (!ptr)
  7655. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7656. return isl::map(*this).foreach_map(fn);
  7657. }
  7658. isl::basic_map basic_map::gist(isl::basic_map context) const
  7659. {
  7660. if (!ptr || context.is_null())
  7661. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7662. auto saved_ctx = ctx();
  7663. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7664. auto res = isl_basic_map_gist(copy(), context.release());
  7665. if (!res)
  7666. exception::throw_last_error(saved_ctx);
  7667. return manage(res);
  7668. }
  7669. isl::map basic_map::gist(const isl::map &context) const
  7670. {
  7671. if (!ptr)
  7672. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7673. return isl::map(*this).gist(context);
  7674. }
  7675. isl::union_map basic_map::gist(const isl::union_map &context) const
  7676. {
  7677. if (!ptr)
  7678. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7679. return isl::map(*this).gist(context);
  7680. }
  7681. isl::map basic_map::gist_domain(const isl::set &context) const
  7682. {
  7683. if (!ptr)
  7684. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7685. return isl::map(*this).gist_domain(context);
  7686. }
  7687. isl::union_map basic_map::gist_domain(const isl::union_set &uset) const
  7688. {
  7689. if (!ptr)
  7690. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7691. return isl::map(*this).gist_domain(uset);
  7692. }
  7693. isl::map basic_map::gist_params(const isl::set &context) const
  7694. {
  7695. if (!ptr)
  7696. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7697. return isl::map(*this).gist_params(context);
  7698. }
  7699. isl::union_map basic_map::gist_range(const isl::union_set &uset) const
  7700. {
  7701. if (!ptr)
  7702. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7703. return isl::map(*this).gist_range(uset);
  7704. }
  7705. bool basic_map::has_domain_tuple_id() const
  7706. {
  7707. if (!ptr)
  7708. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7709. return isl::map(*this).has_domain_tuple_id();
  7710. }
  7711. bool basic_map::has_range_tuple_id() const
  7712. {
  7713. if (!ptr)
  7714. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7715. return isl::map(*this).has_range_tuple_id();
  7716. }
  7717. isl::basic_map basic_map::intersect(isl::basic_map bmap2) const
  7718. {
  7719. if (!ptr || bmap2.is_null())
  7720. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7721. auto saved_ctx = ctx();
  7722. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7723. auto res = isl_basic_map_intersect(copy(), bmap2.release());
  7724. if (!res)
  7725. exception::throw_last_error(saved_ctx);
  7726. return manage(res);
  7727. }
  7728. isl::map basic_map::intersect(const isl::map &map2) const
  7729. {
  7730. if (!ptr)
  7731. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7732. return isl::map(*this).intersect(map2);
  7733. }
  7734. isl::union_map basic_map::intersect(const isl::union_map &umap2) const
  7735. {
  7736. if (!ptr)
  7737. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7738. return isl::map(*this).intersect(umap2);
  7739. }
  7740. isl::basic_map basic_map::intersect_domain(isl::basic_set bset) const
  7741. {
  7742. if (!ptr || bset.is_null())
  7743. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7744. auto saved_ctx = ctx();
  7745. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7746. auto res = isl_basic_map_intersect_domain(copy(), bset.release());
  7747. if (!res)
  7748. exception::throw_last_error(saved_ctx);
  7749. return manage(res);
  7750. }
  7751. isl::map basic_map::intersect_domain(const isl::set &set) const
  7752. {
  7753. if (!ptr)
  7754. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7755. return isl::map(*this).intersect_domain(set);
  7756. }
  7757. isl::union_map basic_map::intersect_domain(const isl::space &space) const
  7758. {
  7759. if (!ptr)
  7760. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7761. return isl::map(*this).intersect_domain(space);
  7762. }
  7763. isl::union_map basic_map::intersect_domain(const isl::union_set &uset) const
  7764. {
  7765. if (!ptr)
  7766. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7767. return isl::map(*this).intersect_domain(uset);
  7768. }
  7769. isl::basic_map basic_map::intersect_domain(const isl::point &bset) const
  7770. {
  7771. if (!ptr)
  7772. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7773. return this->intersect_domain(isl::basic_set(bset));
  7774. }
  7775. isl::map basic_map::intersect_domain_factor_domain(const isl::map &factor) const
  7776. {
  7777. if (!ptr)
  7778. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7779. return isl::map(*this).intersect_domain_factor_domain(factor);
  7780. }
  7781. isl::union_map basic_map::intersect_domain_factor_domain(const isl::union_map &factor) const
  7782. {
  7783. if (!ptr)
  7784. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7785. return isl::map(*this).intersect_domain_factor_domain(factor);
  7786. }
  7787. isl::map basic_map::intersect_domain_factor_range(const isl::map &factor) const
  7788. {
  7789. if (!ptr)
  7790. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7791. return isl::map(*this).intersect_domain_factor_range(factor);
  7792. }
  7793. isl::union_map basic_map::intersect_domain_factor_range(const isl::union_map &factor) const
  7794. {
  7795. if (!ptr)
  7796. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7797. return isl::map(*this).intersect_domain_factor_range(factor);
  7798. }
  7799. isl::map basic_map::intersect_domain_wrapped_domain(const isl::set &domain) const
  7800. {
  7801. if (!ptr)
  7802. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7803. return isl::map(*this).intersect_domain_wrapped_domain(domain);
  7804. }
  7805. isl::union_map basic_map::intersect_domain_wrapped_domain(const isl::union_set &domain) const
  7806. {
  7807. if (!ptr)
  7808. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7809. return isl::map(*this).intersect_domain_wrapped_domain(domain);
  7810. }
  7811. isl::map basic_map::intersect_params(const isl::set &params) const
  7812. {
  7813. if (!ptr)
  7814. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7815. return isl::map(*this).intersect_params(params);
  7816. }
  7817. isl::basic_map basic_map::intersect_range(isl::basic_set bset) const
  7818. {
  7819. if (!ptr || bset.is_null())
  7820. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7821. auto saved_ctx = ctx();
  7822. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7823. auto res = isl_basic_map_intersect_range(copy(), bset.release());
  7824. if (!res)
  7825. exception::throw_last_error(saved_ctx);
  7826. return manage(res);
  7827. }
  7828. isl::map basic_map::intersect_range(const isl::set &set) const
  7829. {
  7830. if (!ptr)
  7831. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7832. return isl::map(*this).intersect_range(set);
  7833. }
  7834. isl::union_map basic_map::intersect_range(const isl::space &space) const
  7835. {
  7836. if (!ptr)
  7837. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7838. return isl::map(*this).intersect_range(space);
  7839. }
  7840. isl::union_map basic_map::intersect_range(const isl::union_set &uset) const
  7841. {
  7842. if (!ptr)
  7843. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7844. return isl::map(*this).intersect_range(uset);
  7845. }
  7846. isl::basic_map basic_map::intersect_range(const isl::point &bset) const
  7847. {
  7848. if (!ptr)
  7849. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7850. return this->intersect_range(isl::basic_set(bset));
  7851. }
  7852. isl::map basic_map::intersect_range_factor_domain(const isl::map &factor) const
  7853. {
  7854. if (!ptr)
  7855. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7856. return isl::map(*this).intersect_range_factor_domain(factor);
  7857. }
  7858. isl::union_map basic_map::intersect_range_factor_domain(const isl::union_map &factor) const
  7859. {
  7860. if (!ptr)
  7861. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7862. return isl::map(*this).intersect_range_factor_domain(factor);
  7863. }
  7864. isl::map basic_map::intersect_range_factor_range(const isl::map &factor) const
  7865. {
  7866. if (!ptr)
  7867. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7868. return isl::map(*this).intersect_range_factor_range(factor);
  7869. }
  7870. isl::union_map basic_map::intersect_range_factor_range(const isl::union_map &factor) const
  7871. {
  7872. if (!ptr)
  7873. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7874. return isl::map(*this).intersect_range_factor_range(factor);
  7875. }
  7876. isl::map basic_map::intersect_range_wrapped_domain(const isl::set &domain) const
  7877. {
  7878. if (!ptr)
  7879. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7880. return isl::map(*this).intersect_range_wrapped_domain(domain);
  7881. }
  7882. isl::union_map basic_map::intersect_range_wrapped_domain(const isl::union_set &domain) const
  7883. {
  7884. if (!ptr)
  7885. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7886. return isl::map(*this).intersect_range_wrapped_domain(domain);
  7887. }
  7888. bool basic_map::is_bijective() const
  7889. {
  7890. if (!ptr)
  7891. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7892. return isl::map(*this).is_bijective();
  7893. }
  7894. bool basic_map::is_disjoint(const isl::map &map2) const
  7895. {
  7896. if (!ptr)
  7897. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7898. return isl::map(*this).is_disjoint(map2);
  7899. }
  7900. bool basic_map::is_disjoint(const isl::union_map &umap2) const
  7901. {
  7902. if (!ptr)
  7903. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7904. return isl::map(*this).is_disjoint(umap2);
  7905. }
  7906. bool basic_map::is_empty() const
  7907. {
  7908. if (!ptr)
  7909. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7910. auto saved_ctx = ctx();
  7911. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7912. auto res = isl_basic_map_is_empty(get());
  7913. if (res < 0)
  7914. exception::throw_last_error(saved_ctx);
  7915. return res;
  7916. }
  7917. bool basic_map::is_equal(const isl::basic_map &bmap2) const
  7918. {
  7919. if (!ptr || bmap2.is_null())
  7920. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7921. auto saved_ctx = ctx();
  7922. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7923. auto res = isl_basic_map_is_equal(get(), bmap2.get());
  7924. if (res < 0)
  7925. exception::throw_last_error(saved_ctx);
  7926. return res;
  7927. }
  7928. bool basic_map::is_equal(const isl::map &map2) const
  7929. {
  7930. if (!ptr)
  7931. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7932. return isl::map(*this).is_equal(map2);
  7933. }
  7934. bool basic_map::is_equal(const isl::union_map &umap2) const
  7935. {
  7936. if (!ptr)
  7937. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7938. return isl::map(*this).is_equal(umap2);
  7939. }
  7940. bool basic_map::is_injective() const
  7941. {
  7942. if (!ptr)
  7943. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7944. return isl::map(*this).is_injective();
  7945. }
  7946. bool basic_map::is_single_valued() const
  7947. {
  7948. if (!ptr)
  7949. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7950. return isl::map(*this).is_single_valued();
  7951. }
  7952. bool basic_map::is_strict_subset(const isl::map &map2) const
  7953. {
  7954. if (!ptr)
  7955. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7956. return isl::map(*this).is_strict_subset(map2);
  7957. }
  7958. bool basic_map::is_strict_subset(const isl::union_map &umap2) const
  7959. {
  7960. if (!ptr)
  7961. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7962. return isl::map(*this).is_strict_subset(umap2);
  7963. }
  7964. bool basic_map::is_subset(const isl::basic_map &bmap2) const
  7965. {
  7966. if (!ptr || bmap2.is_null())
  7967. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7968. auto saved_ctx = ctx();
  7969. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  7970. auto res = isl_basic_map_is_subset(get(), bmap2.get());
  7971. if (res < 0)
  7972. exception::throw_last_error(saved_ctx);
  7973. return res;
  7974. }
  7975. bool basic_map::is_subset(const isl::map &map2) const
  7976. {
  7977. if (!ptr)
  7978. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7979. return isl::map(*this).is_subset(map2);
  7980. }
  7981. bool basic_map::is_subset(const isl::union_map &umap2) const
  7982. {
  7983. if (!ptr)
  7984. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7985. return isl::map(*this).is_subset(umap2);
  7986. }
  7987. bool basic_map::isa_map() const
  7988. {
  7989. if (!ptr)
  7990. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7991. return isl::map(*this).isa_map();
  7992. }
  7993. isl::map basic_map::lex_ge_at(const isl::multi_pw_aff &mpa) const
  7994. {
  7995. if (!ptr)
  7996. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  7997. return isl::map(*this).lex_ge_at(mpa);
  7998. }
  7999. isl::map basic_map::lex_gt_at(const isl::multi_pw_aff &mpa) const
  8000. {
  8001. if (!ptr)
  8002. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8003. return isl::map(*this).lex_gt_at(mpa);
  8004. }
  8005. isl::map basic_map::lex_le_at(const isl::multi_pw_aff &mpa) const
  8006. {
  8007. if (!ptr)
  8008. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8009. return isl::map(*this).lex_le_at(mpa);
  8010. }
  8011. isl::map basic_map::lex_lt_at(const isl::multi_pw_aff &mpa) const
  8012. {
  8013. if (!ptr)
  8014. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8015. return isl::map(*this).lex_lt_at(mpa);
  8016. }
  8017. isl::map basic_map::lexmax() const
  8018. {
  8019. if (!ptr)
  8020. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8021. auto saved_ctx = ctx();
  8022. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  8023. auto res = isl_basic_map_lexmax(copy());
  8024. if (!res)
  8025. exception::throw_last_error(saved_ctx);
  8026. return manage(res);
  8027. }
  8028. isl::pw_multi_aff basic_map::lexmax_pw_multi_aff() const
  8029. {
  8030. if (!ptr)
  8031. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8032. return isl::map(*this).lexmax_pw_multi_aff();
  8033. }
  8034. isl::map basic_map::lexmin() const
  8035. {
  8036. if (!ptr)
  8037. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8038. auto saved_ctx = ctx();
  8039. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  8040. auto res = isl_basic_map_lexmin(copy());
  8041. if (!res)
  8042. exception::throw_last_error(saved_ctx);
  8043. return manage(res);
  8044. }
  8045. isl::pw_multi_aff basic_map::lexmin_pw_multi_aff() const
  8046. {
  8047. if (!ptr)
  8048. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8049. return isl::map(*this).lexmin_pw_multi_aff();
  8050. }
  8051. isl::map basic_map::lower_bound(const isl::multi_pw_aff &lower) const
  8052. {
  8053. if (!ptr)
  8054. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8055. return isl::map(*this).lower_bound(lower);
  8056. }
  8057. isl::map_list basic_map::map_list() const
  8058. {
  8059. if (!ptr)
  8060. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8061. return isl::map(*this).map_list();
  8062. }
  8063. isl::multi_pw_aff basic_map::max_multi_pw_aff() const
  8064. {
  8065. if (!ptr)
  8066. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8067. return isl::map(*this).max_multi_pw_aff();
  8068. }
  8069. isl::multi_pw_aff basic_map::min_multi_pw_aff() const
  8070. {
  8071. if (!ptr)
  8072. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8073. return isl::map(*this).min_multi_pw_aff();
  8074. }
  8075. unsigned basic_map::n_basic_map() const
  8076. {
  8077. if (!ptr)
  8078. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8079. return isl::map(*this).n_basic_map();
  8080. }
  8081. isl::basic_map basic_map::polyhedral_hull() const
  8082. {
  8083. if (!ptr)
  8084. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8085. return isl::map(*this).polyhedral_hull();
  8086. }
  8087. isl::map basic_map::preimage_domain(const isl::multi_aff &ma) const
  8088. {
  8089. if (!ptr)
  8090. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8091. return isl::map(*this).preimage_domain(ma);
  8092. }
  8093. isl::map basic_map::preimage_domain(const isl::multi_pw_aff &mpa) const
  8094. {
  8095. if (!ptr)
  8096. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8097. return isl::map(*this).preimage_domain(mpa);
  8098. }
  8099. isl::map basic_map::preimage_domain(const isl::pw_multi_aff &pma) const
  8100. {
  8101. if (!ptr)
  8102. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8103. return isl::map(*this).preimage_domain(pma);
  8104. }
  8105. isl::union_map basic_map::preimage_domain(const isl::union_pw_multi_aff &upma) const
  8106. {
  8107. if (!ptr)
  8108. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8109. return isl::map(*this).preimage_domain(upma);
  8110. }
  8111. isl::map basic_map::preimage_range(const isl::multi_aff &ma) const
  8112. {
  8113. if (!ptr)
  8114. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8115. return isl::map(*this).preimage_range(ma);
  8116. }
  8117. isl::map basic_map::preimage_range(const isl::pw_multi_aff &pma) const
  8118. {
  8119. if (!ptr)
  8120. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8121. return isl::map(*this).preimage_range(pma);
  8122. }
  8123. isl::union_map basic_map::preimage_range(const isl::union_pw_multi_aff &upma) const
  8124. {
  8125. if (!ptr)
  8126. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8127. return isl::map(*this).preimage_range(upma);
  8128. }
  8129. isl::map basic_map::product(const isl::map &map2) const
  8130. {
  8131. if (!ptr)
  8132. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8133. return isl::map(*this).product(map2);
  8134. }
  8135. isl::union_map basic_map::product(const isl::union_map &umap2) const
  8136. {
  8137. if (!ptr)
  8138. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8139. return isl::map(*this).product(umap2);
  8140. }
  8141. isl::map basic_map::project_out_all_params() const
  8142. {
  8143. if (!ptr)
  8144. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8145. return isl::map(*this).project_out_all_params();
  8146. }
  8147. isl::set basic_map::range() const
  8148. {
  8149. if (!ptr)
  8150. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8151. return isl::map(*this).range();
  8152. }
  8153. isl::map basic_map::range_factor_domain() const
  8154. {
  8155. if (!ptr)
  8156. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8157. return isl::map(*this).range_factor_domain();
  8158. }
  8159. isl::map basic_map::range_factor_range() const
  8160. {
  8161. if (!ptr)
  8162. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8163. return isl::map(*this).range_factor_range();
  8164. }
  8165. isl::fixed_box basic_map::range_lattice_tile() const
  8166. {
  8167. if (!ptr)
  8168. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8169. return isl::map(*this).range_lattice_tile();
  8170. }
  8171. isl::union_map basic_map::range_map() const
  8172. {
  8173. if (!ptr)
  8174. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8175. return isl::map(*this).range_map();
  8176. }
  8177. isl::map basic_map::range_product(const isl::map &map2) const
  8178. {
  8179. if (!ptr)
  8180. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8181. return isl::map(*this).range_product(map2);
  8182. }
  8183. isl::union_map basic_map::range_product(const isl::union_map &umap2) const
  8184. {
  8185. if (!ptr)
  8186. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8187. return isl::map(*this).range_product(umap2);
  8188. }
  8189. isl::map basic_map::range_reverse() const
  8190. {
  8191. if (!ptr)
  8192. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8193. return isl::map(*this).range_reverse();
  8194. }
  8195. isl::fixed_box basic_map::range_simple_fixed_box_hull() const
  8196. {
  8197. if (!ptr)
  8198. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8199. return isl::map(*this).range_simple_fixed_box_hull();
  8200. }
  8201. unsigned basic_map::range_tuple_dim() const
  8202. {
  8203. if (!ptr)
  8204. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8205. return isl::map(*this).range_tuple_dim();
  8206. }
  8207. isl::id basic_map::range_tuple_id() const
  8208. {
  8209. if (!ptr)
  8210. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8211. return isl::map(*this).range_tuple_id();
  8212. }
  8213. isl::basic_map basic_map::reverse() const
  8214. {
  8215. if (!ptr)
  8216. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8217. auto saved_ctx = ctx();
  8218. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  8219. auto res = isl_basic_map_reverse(copy());
  8220. if (!res)
  8221. exception::throw_last_error(saved_ctx);
  8222. return manage(res);
  8223. }
  8224. isl::basic_map basic_map::sample() const
  8225. {
  8226. if (!ptr)
  8227. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8228. auto saved_ctx = ctx();
  8229. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  8230. auto res = isl_basic_map_sample(copy());
  8231. if (!res)
  8232. exception::throw_last_error(saved_ctx);
  8233. return manage(res);
  8234. }
  8235. isl::map basic_map::set_domain_tuple(const isl::id &id) const
  8236. {
  8237. if (!ptr)
  8238. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8239. return isl::map(*this).set_domain_tuple(id);
  8240. }
  8241. isl::map basic_map::set_domain_tuple(const std::string &id) const
  8242. {
  8243. if (!ptr)
  8244. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8245. return this->set_domain_tuple(isl::id(ctx(), id));
  8246. }
  8247. isl::map basic_map::set_range_tuple(const isl::id &id) const
  8248. {
  8249. if (!ptr)
  8250. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8251. return isl::map(*this).set_range_tuple(id);
  8252. }
  8253. isl::map basic_map::set_range_tuple(const std::string &id) const
  8254. {
  8255. if (!ptr)
  8256. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8257. return this->set_range_tuple(isl::id(ctx(), id));
  8258. }
  8259. isl::space basic_map::space() const
  8260. {
  8261. if (!ptr)
  8262. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8263. return isl::map(*this).space();
  8264. }
  8265. isl::map basic_map::subtract(const isl::map &map2) const
  8266. {
  8267. if (!ptr)
  8268. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8269. return isl::map(*this).subtract(map2);
  8270. }
  8271. isl::union_map basic_map::subtract(const isl::union_map &umap2) const
  8272. {
  8273. if (!ptr)
  8274. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8275. return isl::map(*this).subtract(umap2);
  8276. }
  8277. isl::union_map basic_map::subtract_domain(const isl::union_set &dom) const
  8278. {
  8279. if (!ptr)
  8280. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8281. return isl::map(*this).subtract_domain(dom);
  8282. }
  8283. isl::union_map basic_map::subtract_range(const isl::union_set &dom) const
  8284. {
  8285. if (!ptr)
  8286. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8287. return isl::map(*this).subtract_range(dom);
  8288. }
  8289. isl::map_list basic_map::to_list() const
  8290. {
  8291. if (!ptr)
  8292. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8293. return isl::map(*this).to_list();
  8294. }
  8295. isl::union_map basic_map::to_union_map() const
  8296. {
  8297. if (!ptr)
  8298. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8299. return isl::map(*this).to_union_map();
  8300. }
  8301. isl::map basic_map::uncurry() const
  8302. {
  8303. if (!ptr)
  8304. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8305. return isl::map(*this).uncurry();
  8306. }
  8307. isl::map basic_map::unite(isl::basic_map bmap2) const
  8308. {
  8309. if (!ptr || bmap2.is_null())
  8310. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8311. auto saved_ctx = ctx();
  8312. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  8313. auto res = isl_basic_map_union(copy(), bmap2.release());
  8314. if (!res)
  8315. exception::throw_last_error(saved_ctx);
  8316. return manage(res);
  8317. }
  8318. isl::map basic_map::unite(const isl::map &map2) const
  8319. {
  8320. if (!ptr)
  8321. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8322. return isl::map(*this).unite(map2);
  8323. }
  8324. isl::union_map basic_map::unite(const isl::union_map &umap2) const
  8325. {
  8326. if (!ptr)
  8327. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8328. return isl::map(*this).unite(umap2);
  8329. }
  8330. isl::basic_map basic_map::unshifted_simple_hull() const
  8331. {
  8332. if (!ptr)
  8333. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8334. return isl::map(*this).unshifted_simple_hull();
  8335. }
  8336. isl::map basic_map::upper_bound(const isl::multi_pw_aff &upper) const
  8337. {
  8338. if (!ptr)
  8339. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8340. return isl::map(*this).upper_bound(upper);
  8341. }
  8342. isl::set basic_map::wrap() const
  8343. {
  8344. if (!ptr)
  8345. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8346. return isl::map(*this).wrap();
  8347. }
  8348. isl::map basic_map::zip() const
  8349. {
  8350. if (!ptr)
  8351. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8352. return isl::map(*this).zip();
  8353. }
  8354. inline std::ostream &operator<<(std::ostream &os, const basic_map &obj)
  8355. {
  8356. if (!obj.get())
  8357. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8358. auto saved_ctx = isl_basic_map_get_ctx(obj.get());
  8359. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  8360. char *str = isl_basic_map_to_str(obj.get());
  8361. if (!str)
  8362. exception::throw_last_error(saved_ctx);
  8363. os << str;
  8364. free(str);
  8365. return os;
  8366. }
  8367. // implementations for isl::basic_set
  8368. basic_set manage(__isl_take isl_basic_set *ptr) {
  8369. if (!ptr)
  8370. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8371. return basic_set(ptr);
  8372. }
  8373. basic_set manage_copy(__isl_keep isl_basic_set *ptr) {
  8374. if (!ptr)
  8375. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8376. auto saved_ctx = isl_basic_set_get_ctx(ptr);
  8377. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  8378. ptr = isl_basic_set_copy(ptr);
  8379. if (!ptr)
  8380. exception::throw_last_error(saved_ctx);
  8381. return basic_set(ptr);
  8382. }
  8383. basic_set::basic_set(__isl_take isl_basic_set *ptr)
  8384. : ptr(ptr) {}
  8385. basic_set::basic_set()
  8386. : ptr(nullptr) {}
  8387. basic_set::basic_set(const basic_set &obj)
  8388. : ptr(nullptr)
  8389. {
  8390. if (!obj.ptr)
  8391. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8392. auto saved_ctx = isl_basic_set_get_ctx(obj.ptr);
  8393. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  8394. ptr = obj.copy();
  8395. if (!ptr)
  8396. exception::throw_last_error(saved_ctx);
  8397. }
  8398. basic_set::basic_set(isl::point pnt)
  8399. {
  8400. if (pnt.is_null())
  8401. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8402. auto saved_ctx = pnt.ctx();
  8403. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  8404. auto res = isl_basic_set_from_point(pnt.release());
  8405. if (!res)
  8406. exception::throw_last_error(saved_ctx);
  8407. ptr = res;
  8408. }
  8409. basic_set::basic_set(isl::ctx ctx, const std::string &str)
  8410. {
  8411. auto saved_ctx = ctx;
  8412. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  8413. auto res = isl_basic_set_read_from_str(ctx.release(), str.c_str());
  8414. if (!res)
  8415. exception::throw_last_error(saved_ctx);
  8416. ptr = res;
  8417. }
  8418. basic_set &basic_set::operator=(basic_set obj) {
  8419. std::swap(this->ptr, obj.ptr);
  8420. return *this;
  8421. }
  8422. basic_set::~basic_set() {
  8423. if (ptr)
  8424. isl_basic_set_free(ptr);
  8425. }
  8426. __isl_give isl_basic_set *basic_set::copy() const & {
  8427. return isl_basic_set_copy(ptr);
  8428. }
  8429. __isl_keep isl_basic_set *basic_set::get() const {
  8430. return ptr;
  8431. }
  8432. __isl_give isl_basic_set *basic_set::release() {
  8433. isl_basic_set *tmp = ptr;
  8434. ptr = nullptr;
  8435. return tmp;
  8436. }
  8437. bool basic_set::is_null() const {
  8438. return ptr == nullptr;
  8439. }
  8440. isl::ctx basic_set::ctx() const {
  8441. return isl::ctx(isl_basic_set_get_ctx(ptr));
  8442. }
  8443. isl::basic_set basic_set::affine_hull() const
  8444. {
  8445. if (!ptr)
  8446. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8447. auto saved_ctx = ctx();
  8448. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  8449. auto res = isl_basic_set_affine_hull(copy());
  8450. if (!res)
  8451. exception::throw_last_error(saved_ctx);
  8452. return manage(res);
  8453. }
  8454. isl::basic_set basic_set::apply(isl::basic_map bmap) const
  8455. {
  8456. if (!ptr || bmap.is_null())
  8457. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8458. auto saved_ctx = ctx();
  8459. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  8460. auto res = isl_basic_set_apply(copy(), bmap.release());
  8461. if (!res)
  8462. exception::throw_last_error(saved_ctx);
  8463. return manage(res);
  8464. }
  8465. isl::set basic_set::apply(const isl::map &map) const
  8466. {
  8467. if (!ptr)
  8468. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8469. return isl::set(*this).apply(map);
  8470. }
  8471. isl::union_set basic_set::apply(const isl::union_map &umap) const
  8472. {
  8473. if (!ptr)
  8474. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8475. return isl::set(*this).apply(umap);
  8476. }
  8477. isl::pw_multi_aff basic_set::as_pw_multi_aff() const
  8478. {
  8479. if (!ptr)
  8480. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8481. return isl::set(*this).as_pw_multi_aff();
  8482. }
  8483. isl::set basic_set::as_set() const
  8484. {
  8485. if (!ptr)
  8486. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8487. return isl::set(*this).as_set();
  8488. }
  8489. isl::set basic_set::bind(const isl::multi_id &tuple) const
  8490. {
  8491. if (!ptr)
  8492. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8493. return isl::set(*this).bind(tuple);
  8494. }
  8495. isl::set basic_set::coalesce() const
  8496. {
  8497. if (!ptr)
  8498. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8499. return isl::set(*this).coalesce();
  8500. }
  8501. isl::set basic_set::complement() const
  8502. {
  8503. if (!ptr)
  8504. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8505. return isl::set(*this).complement();
  8506. }
  8507. isl::union_set basic_set::compute_divs() const
  8508. {
  8509. if (!ptr)
  8510. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8511. return isl::set(*this).compute_divs();
  8512. }
  8513. isl::basic_set basic_set::detect_equalities() const
  8514. {
  8515. if (!ptr)
  8516. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8517. auto saved_ctx = ctx();
  8518. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  8519. auto res = isl_basic_set_detect_equalities(copy());
  8520. if (!res)
  8521. exception::throw_last_error(saved_ctx);
  8522. return manage(res);
  8523. }
  8524. isl::val basic_set::dim_max_val(int pos) const
  8525. {
  8526. if (!ptr)
  8527. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8528. auto saved_ctx = ctx();
  8529. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  8530. auto res = isl_basic_set_dim_max_val(copy(), pos);
  8531. if (!res)
  8532. exception::throw_last_error(saved_ctx);
  8533. return manage(res);
  8534. }
  8535. isl::val basic_set::dim_min_val(int pos) const
  8536. {
  8537. if (!ptr)
  8538. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8539. return isl::set(*this).dim_min_val(pos);
  8540. }
  8541. bool basic_set::every_set(const std::function<bool(isl::set)> &test) const
  8542. {
  8543. if (!ptr)
  8544. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8545. return isl::set(*this).every_set(test);
  8546. }
  8547. isl::set basic_set::extract_set(const isl::space &space) const
  8548. {
  8549. if (!ptr)
  8550. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8551. return isl::set(*this).extract_set(space);
  8552. }
  8553. isl::basic_set basic_set::flatten() const
  8554. {
  8555. if (!ptr)
  8556. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8557. auto saved_ctx = ctx();
  8558. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  8559. auto res = isl_basic_set_flatten(copy());
  8560. if (!res)
  8561. exception::throw_last_error(saved_ctx);
  8562. return manage(res);
  8563. }
  8564. void basic_set::foreach_basic_set(const std::function<void(isl::basic_set)> &fn) const
  8565. {
  8566. if (!ptr)
  8567. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8568. return isl::set(*this).foreach_basic_set(fn);
  8569. }
  8570. void basic_set::foreach_point(const std::function<void(isl::point)> &fn) const
  8571. {
  8572. if (!ptr)
  8573. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8574. return isl::set(*this).foreach_point(fn);
  8575. }
  8576. void basic_set::foreach_set(const std::function<void(isl::set)> &fn) const
  8577. {
  8578. if (!ptr)
  8579. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8580. return isl::set(*this).foreach_set(fn);
  8581. }
  8582. isl::basic_set basic_set::gist(isl::basic_set context) const
  8583. {
  8584. if (!ptr || context.is_null())
  8585. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8586. auto saved_ctx = ctx();
  8587. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  8588. auto res = isl_basic_set_gist(copy(), context.release());
  8589. if (!res)
  8590. exception::throw_last_error(saved_ctx);
  8591. return manage(res);
  8592. }
  8593. isl::set basic_set::gist(const isl::set &context) const
  8594. {
  8595. if (!ptr)
  8596. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8597. return isl::set(*this).gist(context);
  8598. }
  8599. isl::union_set basic_set::gist(const isl::union_set &context) const
  8600. {
  8601. if (!ptr)
  8602. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8603. return isl::set(*this).gist(context);
  8604. }
  8605. isl::basic_set basic_set::gist(const isl::point &context) const
  8606. {
  8607. if (!ptr)
  8608. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8609. return this->gist(isl::basic_set(context));
  8610. }
  8611. isl::set basic_set::gist_params(const isl::set &context) const
  8612. {
  8613. if (!ptr)
  8614. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8615. return isl::set(*this).gist_params(context);
  8616. }
  8617. isl::map basic_set::identity() const
  8618. {
  8619. if (!ptr)
  8620. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8621. return isl::set(*this).identity();
  8622. }
  8623. isl::pw_aff basic_set::indicator_function() const
  8624. {
  8625. if (!ptr)
  8626. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8627. return isl::set(*this).indicator_function();
  8628. }
  8629. isl::map basic_set::insert_domain(const isl::space &domain) const
  8630. {
  8631. if (!ptr)
  8632. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8633. return isl::set(*this).insert_domain(domain);
  8634. }
  8635. isl::basic_set basic_set::intersect(isl::basic_set bset2) const
  8636. {
  8637. if (!ptr || bset2.is_null())
  8638. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8639. auto saved_ctx = ctx();
  8640. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  8641. auto res = isl_basic_set_intersect(copy(), bset2.release());
  8642. if (!res)
  8643. exception::throw_last_error(saved_ctx);
  8644. return manage(res);
  8645. }
  8646. isl::set basic_set::intersect(const isl::set &set2) const
  8647. {
  8648. if (!ptr)
  8649. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8650. return isl::set(*this).intersect(set2);
  8651. }
  8652. isl::union_set basic_set::intersect(const isl::union_set &uset2) const
  8653. {
  8654. if (!ptr)
  8655. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8656. return isl::set(*this).intersect(uset2);
  8657. }
  8658. isl::basic_set basic_set::intersect(const isl::point &bset2) const
  8659. {
  8660. if (!ptr)
  8661. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8662. return this->intersect(isl::basic_set(bset2));
  8663. }
  8664. isl::basic_set basic_set::intersect_params(isl::basic_set bset2) const
  8665. {
  8666. if (!ptr || bset2.is_null())
  8667. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8668. auto saved_ctx = ctx();
  8669. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  8670. auto res = isl_basic_set_intersect_params(copy(), bset2.release());
  8671. if (!res)
  8672. exception::throw_last_error(saved_ctx);
  8673. return manage(res);
  8674. }
  8675. isl::set basic_set::intersect_params(const isl::set &params) const
  8676. {
  8677. if (!ptr)
  8678. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8679. return isl::set(*this).intersect_params(params);
  8680. }
  8681. isl::basic_set basic_set::intersect_params(const isl::point &bset2) const
  8682. {
  8683. if (!ptr)
  8684. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8685. return this->intersect_params(isl::basic_set(bset2));
  8686. }
  8687. bool basic_set::involves_locals() const
  8688. {
  8689. if (!ptr)
  8690. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8691. return isl::set(*this).involves_locals();
  8692. }
  8693. bool basic_set::is_disjoint(const isl::set &set2) const
  8694. {
  8695. if (!ptr)
  8696. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8697. return isl::set(*this).is_disjoint(set2);
  8698. }
  8699. bool basic_set::is_disjoint(const isl::union_set &uset2) const
  8700. {
  8701. if (!ptr)
  8702. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8703. return isl::set(*this).is_disjoint(uset2);
  8704. }
  8705. bool basic_set::is_empty() const
  8706. {
  8707. if (!ptr)
  8708. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8709. auto saved_ctx = ctx();
  8710. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  8711. auto res = isl_basic_set_is_empty(get());
  8712. if (res < 0)
  8713. exception::throw_last_error(saved_ctx);
  8714. return res;
  8715. }
  8716. bool basic_set::is_equal(const isl::basic_set &bset2) const
  8717. {
  8718. if (!ptr || bset2.is_null())
  8719. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8720. auto saved_ctx = ctx();
  8721. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  8722. auto res = isl_basic_set_is_equal(get(), bset2.get());
  8723. if (res < 0)
  8724. exception::throw_last_error(saved_ctx);
  8725. return res;
  8726. }
  8727. bool basic_set::is_equal(const isl::set &set2) const
  8728. {
  8729. if (!ptr)
  8730. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8731. return isl::set(*this).is_equal(set2);
  8732. }
  8733. bool basic_set::is_equal(const isl::union_set &uset2) const
  8734. {
  8735. if (!ptr)
  8736. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8737. return isl::set(*this).is_equal(uset2);
  8738. }
  8739. bool basic_set::is_equal(const isl::point &bset2) const
  8740. {
  8741. if (!ptr)
  8742. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8743. return this->is_equal(isl::basic_set(bset2));
  8744. }
  8745. bool basic_set::is_singleton() const
  8746. {
  8747. if (!ptr)
  8748. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8749. return isl::set(*this).is_singleton();
  8750. }
  8751. bool basic_set::is_strict_subset(const isl::set &set2) const
  8752. {
  8753. if (!ptr)
  8754. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8755. return isl::set(*this).is_strict_subset(set2);
  8756. }
  8757. bool basic_set::is_strict_subset(const isl::union_set &uset2) const
  8758. {
  8759. if (!ptr)
  8760. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8761. return isl::set(*this).is_strict_subset(uset2);
  8762. }
  8763. bool basic_set::is_subset(const isl::basic_set &bset2) const
  8764. {
  8765. if (!ptr || bset2.is_null())
  8766. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8767. auto saved_ctx = ctx();
  8768. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  8769. auto res = isl_basic_set_is_subset(get(), bset2.get());
  8770. if (res < 0)
  8771. exception::throw_last_error(saved_ctx);
  8772. return res;
  8773. }
  8774. bool basic_set::is_subset(const isl::set &set2) const
  8775. {
  8776. if (!ptr)
  8777. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8778. return isl::set(*this).is_subset(set2);
  8779. }
  8780. bool basic_set::is_subset(const isl::union_set &uset2) const
  8781. {
  8782. if (!ptr)
  8783. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8784. return isl::set(*this).is_subset(uset2);
  8785. }
  8786. bool basic_set::is_subset(const isl::point &bset2) const
  8787. {
  8788. if (!ptr)
  8789. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8790. return this->is_subset(isl::basic_set(bset2));
  8791. }
  8792. bool basic_set::is_wrapping() const
  8793. {
  8794. if (!ptr)
  8795. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8796. auto saved_ctx = ctx();
  8797. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  8798. auto res = isl_basic_set_is_wrapping(get());
  8799. if (res < 0)
  8800. exception::throw_last_error(saved_ctx);
  8801. return res;
  8802. }
  8803. bool basic_set::isa_set() const
  8804. {
  8805. if (!ptr)
  8806. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8807. return isl::set(*this).isa_set();
  8808. }
  8809. isl::fixed_box basic_set::lattice_tile() const
  8810. {
  8811. if (!ptr)
  8812. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8813. return isl::set(*this).lattice_tile();
  8814. }
  8815. isl::set basic_set::lexmax() const
  8816. {
  8817. if (!ptr)
  8818. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8819. auto saved_ctx = ctx();
  8820. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  8821. auto res = isl_basic_set_lexmax(copy());
  8822. if (!res)
  8823. exception::throw_last_error(saved_ctx);
  8824. return manage(res);
  8825. }
  8826. isl::pw_multi_aff basic_set::lexmax_pw_multi_aff() const
  8827. {
  8828. if (!ptr)
  8829. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8830. return isl::set(*this).lexmax_pw_multi_aff();
  8831. }
  8832. isl::set basic_set::lexmin() const
  8833. {
  8834. if (!ptr)
  8835. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8836. auto saved_ctx = ctx();
  8837. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  8838. auto res = isl_basic_set_lexmin(copy());
  8839. if (!res)
  8840. exception::throw_last_error(saved_ctx);
  8841. return manage(res);
  8842. }
  8843. isl::pw_multi_aff basic_set::lexmin_pw_multi_aff() const
  8844. {
  8845. if (!ptr)
  8846. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8847. return isl::set(*this).lexmin_pw_multi_aff();
  8848. }
  8849. isl::set basic_set::lower_bound(const isl::multi_pw_aff &lower) const
  8850. {
  8851. if (!ptr)
  8852. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8853. return isl::set(*this).lower_bound(lower);
  8854. }
  8855. isl::set basic_set::lower_bound(const isl::multi_val &lower) const
  8856. {
  8857. if (!ptr)
  8858. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8859. return isl::set(*this).lower_bound(lower);
  8860. }
  8861. isl::multi_pw_aff basic_set::max_multi_pw_aff() const
  8862. {
  8863. if (!ptr)
  8864. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8865. return isl::set(*this).max_multi_pw_aff();
  8866. }
  8867. isl::val basic_set::max_val(const isl::aff &obj) const
  8868. {
  8869. if (!ptr)
  8870. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8871. return isl::set(*this).max_val(obj);
  8872. }
  8873. isl::multi_pw_aff basic_set::min_multi_pw_aff() const
  8874. {
  8875. if (!ptr)
  8876. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8877. return isl::set(*this).min_multi_pw_aff();
  8878. }
  8879. isl::val basic_set::min_val(const isl::aff &obj) const
  8880. {
  8881. if (!ptr)
  8882. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8883. return isl::set(*this).min_val(obj);
  8884. }
  8885. unsigned basic_set::n_basic_set() const
  8886. {
  8887. if (!ptr)
  8888. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8889. return isl::set(*this).n_basic_set();
  8890. }
  8891. isl::pw_aff basic_set::param_pw_aff_on_domain(const isl::id &id) const
  8892. {
  8893. if (!ptr)
  8894. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8895. return isl::set(*this).param_pw_aff_on_domain(id);
  8896. }
  8897. isl::pw_aff basic_set::param_pw_aff_on_domain(const std::string &id) const
  8898. {
  8899. if (!ptr)
  8900. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8901. return this->param_pw_aff_on_domain(isl::id(ctx(), id));
  8902. }
  8903. isl::basic_set basic_set::params() const
  8904. {
  8905. if (!ptr)
  8906. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8907. auto saved_ctx = ctx();
  8908. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  8909. auto res = isl_basic_set_params(copy());
  8910. if (!res)
  8911. exception::throw_last_error(saved_ctx);
  8912. return manage(res);
  8913. }
  8914. isl::multi_val basic_set::plain_multi_val_if_fixed() const
  8915. {
  8916. if (!ptr)
  8917. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8918. return isl::set(*this).plain_multi_val_if_fixed();
  8919. }
  8920. isl::basic_set basic_set::polyhedral_hull() const
  8921. {
  8922. if (!ptr)
  8923. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8924. return isl::set(*this).polyhedral_hull();
  8925. }
  8926. isl::set basic_set::preimage(const isl::multi_aff &ma) const
  8927. {
  8928. if (!ptr)
  8929. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8930. return isl::set(*this).preimage(ma);
  8931. }
  8932. isl::set basic_set::preimage(const isl::multi_pw_aff &mpa) const
  8933. {
  8934. if (!ptr)
  8935. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8936. return isl::set(*this).preimage(mpa);
  8937. }
  8938. isl::set basic_set::preimage(const isl::pw_multi_aff &pma) const
  8939. {
  8940. if (!ptr)
  8941. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8942. return isl::set(*this).preimage(pma);
  8943. }
  8944. isl::union_set basic_set::preimage(const isl::union_pw_multi_aff &upma) const
  8945. {
  8946. if (!ptr)
  8947. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8948. return isl::set(*this).preimage(upma);
  8949. }
  8950. isl::set basic_set::product(const isl::set &set2) const
  8951. {
  8952. if (!ptr)
  8953. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8954. return isl::set(*this).product(set2);
  8955. }
  8956. isl::set basic_set::project_out_all_params() const
  8957. {
  8958. if (!ptr)
  8959. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8960. return isl::set(*this).project_out_all_params();
  8961. }
  8962. isl::set basic_set::project_out_param(const isl::id &id) const
  8963. {
  8964. if (!ptr)
  8965. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8966. return isl::set(*this).project_out_param(id);
  8967. }
  8968. isl::set basic_set::project_out_param(const std::string &id) const
  8969. {
  8970. if (!ptr)
  8971. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8972. return this->project_out_param(isl::id(ctx(), id));
  8973. }
  8974. isl::set basic_set::project_out_param(const isl::id_list &list) const
  8975. {
  8976. if (!ptr)
  8977. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8978. return isl::set(*this).project_out_param(list);
  8979. }
  8980. isl::pw_aff basic_set::pw_aff_on_domain(const isl::val &v) const
  8981. {
  8982. if (!ptr)
  8983. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8984. return isl::set(*this).pw_aff_on_domain(v);
  8985. }
  8986. isl::pw_aff basic_set::pw_aff_on_domain(long v) const
  8987. {
  8988. if (!ptr)
  8989. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8990. return this->pw_aff_on_domain(isl::val(ctx(), v));
  8991. }
  8992. isl::pw_multi_aff basic_set::pw_multi_aff_on_domain(const isl::multi_val &mv) const
  8993. {
  8994. if (!ptr)
  8995. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  8996. return isl::set(*this).pw_multi_aff_on_domain(mv);
  8997. }
  8998. isl::basic_set basic_set::sample() const
  8999. {
  9000. if (!ptr)
  9001. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9002. auto saved_ctx = ctx();
  9003. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9004. auto res = isl_basic_set_sample(copy());
  9005. if (!res)
  9006. exception::throw_last_error(saved_ctx);
  9007. return manage(res);
  9008. }
  9009. isl::point basic_set::sample_point() const
  9010. {
  9011. if (!ptr)
  9012. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9013. auto saved_ctx = ctx();
  9014. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9015. auto res = isl_basic_set_sample_point(copy());
  9016. if (!res)
  9017. exception::throw_last_error(saved_ctx);
  9018. return manage(res);
  9019. }
  9020. isl::set_list basic_set::set_list() const
  9021. {
  9022. if (!ptr)
  9023. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9024. return isl::set(*this).set_list();
  9025. }
  9026. isl::fixed_box basic_set::simple_fixed_box_hull() const
  9027. {
  9028. if (!ptr)
  9029. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9030. return isl::set(*this).simple_fixed_box_hull();
  9031. }
  9032. isl::space basic_set::space() const
  9033. {
  9034. if (!ptr)
  9035. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9036. return isl::set(*this).space();
  9037. }
  9038. isl::val basic_set::stride(int pos) const
  9039. {
  9040. if (!ptr)
  9041. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9042. return isl::set(*this).stride(pos);
  9043. }
  9044. isl::set basic_set::subtract(const isl::set &set2) const
  9045. {
  9046. if (!ptr)
  9047. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9048. return isl::set(*this).subtract(set2);
  9049. }
  9050. isl::union_set basic_set::subtract(const isl::union_set &uset2) const
  9051. {
  9052. if (!ptr)
  9053. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9054. return isl::set(*this).subtract(uset2);
  9055. }
  9056. isl::set_list basic_set::to_list() const
  9057. {
  9058. if (!ptr)
  9059. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9060. return isl::set(*this).to_list();
  9061. }
  9062. isl::set basic_set::to_set() const
  9063. {
  9064. if (!ptr)
  9065. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9066. auto saved_ctx = ctx();
  9067. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9068. auto res = isl_basic_set_to_set(copy());
  9069. if (!res)
  9070. exception::throw_last_error(saved_ctx);
  9071. return manage(res);
  9072. }
  9073. isl::union_set basic_set::to_union_set() const
  9074. {
  9075. if (!ptr)
  9076. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9077. return isl::set(*this).to_union_set();
  9078. }
  9079. isl::map basic_set::translation() const
  9080. {
  9081. if (!ptr)
  9082. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9083. return isl::set(*this).translation();
  9084. }
  9085. unsigned basic_set::tuple_dim() const
  9086. {
  9087. if (!ptr)
  9088. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9089. return isl::set(*this).tuple_dim();
  9090. }
  9091. isl::set basic_set::unbind_params(const isl::multi_id &tuple) const
  9092. {
  9093. if (!ptr)
  9094. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9095. return isl::set(*this).unbind_params(tuple);
  9096. }
  9097. isl::map basic_set::unbind_params_insert_domain(const isl::multi_id &domain) const
  9098. {
  9099. if (!ptr)
  9100. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9101. return isl::set(*this).unbind_params_insert_domain(domain);
  9102. }
  9103. isl::set basic_set::unite(isl::basic_set bset2) const
  9104. {
  9105. if (!ptr || bset2.is_null())
  9106. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9107. auto saved_ctx = ctx();
  9108. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9109. auto res = isl_basic_set_union(copy(), bset2.release());
  9110. if (!res)
  9111. exception::throw_last_error(saved_ctx);
  9112. return manage(res);
  9113. }
  9114. isl::set basic_set::unite(const isl::set &set2) const
  9115. {
  9116. if (!ptr)
  9117. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9118. return isl::set(*this).unite(set2);
  9119. }
  9120. isl::union_set basic_set::unite(const isl::union_set &uset2) const
  9121. {
  9122. if (!ptr)
  9123. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9124. return isl::set(*this).unite(uset2);
  9125. }
  9126. isl::set basic_set::unite(const isl::point &bset2) const
  9127. {
  9128. if (!ptr)
  9129. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9130. return this->unite(isl::basic_set(bset2));
  9131. }
  9132. isl::basic_set basic_set::unshifted_simple_hull() const
  9133. {
  9134. if (!ptr)
  9135. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9136. return isl::set(*this).unshifted_simple_hull();
  9137. }
  9138. isl::map basic_set::unwrap() const
  9139. {
  9140. if (!ptr)
  9141. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9142. return isl::set(*this).unwrap();
  9143. }
  9144. isl::set basic_set::upper_bound(const isl::multi_pw_aff &upper) const
  9145. {
  9146. if (!ptr)
  9147. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9148. return isl::set(*this).upper_bound(upper);
  9149. }
  9150. isl::set basic_set::upper_bound(const isl::multi_val &upper) const
  9151. {
  9152. if (!ptr)
  9153. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9154. return isl::set(*this).upper_bound(upper);
  9155. }
  9156. inline std::ostream &operator<<(std::ostream &os, const basic_set &obj)
  9157. {
  9158. if (!obj.get())
  9159. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9160. auto saved_ctx = isl_basic_set_get_ctx(obj.get());
  9161. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9162. char *str = isl_basic_set_to_str(obj.get());
  9163. if (!str)
  9164. exception::throw_last_error(saved_ctx);
  9165. os << str;
  9166. free(str);
  9167. return os;
  9168. }
  9169. // implementations for isl::fixed_box
  9170. fixed_box manage(__isl_take isl_fixed_box *ptr) {
  9171. if (!ptr)
  9172. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9173. return fixed_box(ptr);
  9174. }
  9175. fixed_box manage_copy(__isl_keep isl_fixed_box *ptr) {
  9176. if (!ptr)
  9177. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9178. auto saved_ctx = isl_fixed_box_get_ctx(ptr);
  9179. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9180. ptr = isl_fixed_box_copy(ptr);
  9181. if (!ptr)
  9182. exception::throw_last_error(saved_ctx);
  9183. return fixed_box(ptr);
  9184. }
  9185. fixed_box::fixed_box(__isl_take isl_fixed_box *ptr)
  9186. : ptr(ptr) {}
  9187. fixed_box::fixed_box()
  9188. : ptr(nullptr) {}
  9189. fixed_box::fixed_box(const fixed_box &obj)
  9190. : ptr(nullptr)
  9191. {
  9192. if (!obj.ptr)
  9193. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9194. auto saved_ctx = isl_fixed_box_get_ctx(obj.ptr);
  9195. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9196. ptr = obj.copy();
  9197. if (!ptr)
  9198. exception::throw_last_error(saved_ctx);
  9199. }
  9200. fixed_box &fixed_box::operator=(fixed_box obj) {
  9201. std::swap(this->ptr, obj.ptr);
  9202. return *this;
  9203. }
  9204. fixed_box::~fixed_box() {
  9205. if (ptr)
  9206. isl_fixed_box_free(ptr);
  9207. }
  9208. __isl_give isl_fixed_box *fixed_box::copy() const & {
  9209. return isl_fixed_box_copy(ptr);
  9210. }
  9211. __isl_keep isl_fixed_box *fixed_box::get() const {
  9212. return ptr;
  9213. }
  9214. __isl_give isl_fixed_box *fixed_box::release() {
  9215. isl_fixed_box *tmp = ptr;
  9216. ptr = nullptr;
  9217. return tmp;
  9218. }
  9219. bool fixed_box::is_null() const {
  9220. return ptr == nullptr;
  9221. }
  9222. isl::ctx fixed_box::ctx() const {
  9223. return isl::ctx(isl_fixed_box_get_ctx(ptr));
  9224. }
  9225. bool fixed_box::is_valid() const
  9226. {
  9227. if (!ptr)
  9228. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9229. auto saved_ctx = ctx();
  9230. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9231. auto res = isl_fixed_box_is_valid(get());
  9232. if (res < 0)
  9233. exception::throw_last_error(saved_ctx);
  9234. return res;
  9235. }
  9236. isl::multi_aff fixed_box::offset() const
  9237. {
  9238. if (!ptr)
  9239. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9240. auto saved_ctx = ctx();
  9241. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9242. auto res = isl_fixed_box_get_offset(get());
  9243. if (!res)
  9244. exception::throw_last_error(saved_ctx);
  9245. return manage(res);
  9246. }
  9247. isl::multi_aff fixed_box::get_offset() const
  9248. {
  9249. return offset();
  9250. }
  9251. isl::multi_val fixed_box::size() const
  9252. {
  9253. if (!ptr)
  9254. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9255. auto saved_ctx = ctx();
  9256. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9257. auto res = isl_fixed_box_get_size(get());
  9258. if (!res)
  9259. exception::throw_last_error(saved_ctx);
  9260. return manage(res);
  9261. }
  9262. isl::multi_val fixed_box::get_size() const
  9263. {
  9264. return size();
  9265. }
  9266. isl::space fixed_box::space() const
  9267. {
  9268. if (!ptr)
  9269. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9270. auto saved_ctx = ctx();
  9271. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9272. auto res = isl_fixed_box_get_space(get());
  9273. if (!res)
  9274. exception::throw_last_error(saved_ctx);
  9275. return manage(res);
  9276. }
  9277. isl::space fixed_box::get_space() const
  9278. {
  9279. return space();
  9280. }
  9281. inline std::ostream &operator<<(std::ostream &os, const fixed_box &obj)
  9282. {
  9283. if (!obj.get())
  9284. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9285. auto saved_ctx = isl_fixed_box_get_ctx(obj.get());
  9286. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9287. char *str = isl_fixed_box_to_str(obj.get());
  9288. if (!str)
  9289. exception::throw_last_error(saved_ctx);
  9290. os << str;
  9291. free(str);
  9292. return os;
  9293. }
  9294. // implementations for isl::id
  9295. id manage(__isl_take isl_id *ptr) {
  9296. if (!ptr)
  9297. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9298. return id(ptr);
  9299. }
  9300. id manage_copy(__isl_keep isl_id *ptr) {
  9301. if (!ptr)
  9302. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9303. auto saved_ctx = isl_id_get_ctx(ptr);
  9304. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9305. ptr = isl_id_copy(ptr);
  9306. if (!ptr)
  9307. exception::throw_last_error(saved_ctx);
  9308. return id(ptr);
  9309. }
  9310. id::id(__isl_take isl_id *ptr)
  9311. : ptr(ptr) {}
  9312. id::id()
  9313. : ptr(nullptr) {}
  9314. id::id(const id &obj)
  9315. : ptr(nullptr)
  9316. {
  9317. if (!obj.ptr)
  9318. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9319. auto saved_ctx = isl_id_get_ctx(obj.ptr);
  9320. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9321. ptr = obj.copy();
  9322. if (!ptr)
  9323. exception::throw_last_error(saved_ctx);
  9324. }
  9325. id::id(isl::ctx ctx, const std::string &str)
  9326. {
  9327. auto saved_ctx = ctx;
  9328. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9329. auto res = isl_id_read_from_str(ctx.release(), str.c_str());
  9330. if (!res)
  9331. exception::throw_last_error(saved_ctx);
  9332. ptr = res;
  9333. }
  9334. id &id::operator=(id obj) {
  9335. std::swap(this->ptr, obj.ptr);
  9336. return *this;
  9337. }
  9338. id::~id() {
  9339. if (ptr)
  9340. isl_id_free(ptr);
  9341. }
  9342. __isl_give isl_id *id::copy() const & {
  9343. return isl_id_copy(ptr);
  9344. }
  9345. __isl_keep isl_id *id::get() const {
  9346. return ptr;
  9347. }
  9348. __isl_give isl_id *id::release() {
  9349. isl_id *tmp = ptr;
  9350. ptr = nullptr;
  9351. return tmp;
  9352. }
  9353. bool id::is_null() const {
  9354. return ptr == nullptr;
  9355. }
  9356. isl::ctx id::ctx() const {
  9357. return isl::ctx(isl_id_get_ctx(ptr));
  9358. }
  9359. std::string id::name() const
  9360. {
  9361. if (!ptr)
  9362. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9363. auto saved_ctx = ctx();
  9364. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9365. auto res = isl_id_get_name(get());
  9366. std::string tmp(res);
  9367. return tmp;
  9368. }
  9369. std::string id::get_name() const
  9370. {
  9371. return name();
  9372. }
  9373. isl::id_list id::to_list() const
  9374. {
  9375. if (!ptr)
  9376. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9377. auto saved_ctx = ctx();
  9378. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9379. auto res = isl_id_to_list(copy());
  9380. if (!res)
  9381. exception::throw_last_error(saved_ctx);
  9382. return manage(res);
  9383. }
  9384. #if __cplusplus >= 201703L
  9385. id::id(isl::ctx ctx, const std::string &str, const std::any &any)
  9386. {
  9387. auto saved_ctx = ctx;
  9388. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9389. std::any *p = new std::any(any);
  9390. auto res = isl_id_alloc(ctx.get(), str.c_str(), p);
  9391. res = isl_id_set_free_user(res, &ctx::free_user);
  9392. if (!res) {
  9393. delete p;
  9394. exception::throw_last_error(saved_ctx);
  9395. }
  9396. ptr = res;
  9397. }
  9398. template <class T>
  9399. std::optional<T> id::try_user() const
  9400. {
  9401. if (!ptr)
  9402. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9403. std::any *p = (std::any *) isl_id_get_user(ptr);
  9404. if (!p)
  9405. return std::nullopt;
  9406. if (isl_id_get_free_user(ptr) != &ctx::free_user)
  9407. return std::nullopt;
  9408. T *res = std::any_cast<T>(p);
  9409. if (!res)
  9410. return std::nullopt;
  9411. return *res;
  9412. }
  9413. template <class T>
  9414. T id::user() const
  9415. {
  9416. if (!ptr)
  9417. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9418. std::any *p = (std::any *) isl_id_get_user(ptr);
  9419. if (!p)
  9420. exception::throw_invalid("no user pointer", __FILE__, __LINE__);
  9421. if (isl_id_get_free_user(ptr) != &ctx::free_user)
  9422. exception::throw_invalid("user pointer not attached by C++ interface", __FILE__, __LINE__);
  9423. T *res = std::any_cast<T>(p);
  9424. if (!res)
  9425. exception::throw_invalid("user pointer not of given type", __FILE__, __LINE__);
  9426. return *res;
  9427. }
  9428. #endif
  9429. inline std::ostream &operator<<(std::ostream &os, const id &obj)
  9430. {
  9431. if (!obj.get())
  9432. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9433. auto saved_ctx = isl_id_get_ctx(obj.get());
  9434. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9435. char *str = isl_id_to_str(obj.get());
  9436. if (!str)
  9437. exception::throw_last_error(saved_ctx);
  9438. os << str;
  9439. free(str);
  9440. return os;
  9441. }
  9442. // implementations for isl::id_list
  9443. id_list manage(__isl_take isl_id_list *ptr) {
  9444. if (!ptr)
  9445. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9446. return id_list(ptr);
  9447. }
  9448. id_list manage_copy(__isl_keep isl_id_list *ptr) {
  9449. if (!ptr)
  9450. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9451. auto saved_ctx = isl_id_list_get_ctx(ptr);
  9452. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9453. ptr = isl_id_list_copy(ptr);
  9454. if (!ptr)
  9455. exception::throw_last_error(saved_ctx);
  9456. return id_list(ptr);
  9457. }
  9458. id_list::id_list(__isl_take isl_id_list *ptr)
  9459. : ptr(ptr) {}
  9460. id_list::id_list()
  9461. : ptr(nullptr) {}
  9462. id_list::id_list(const id_list &obj)
  9463. : ptr(nullptr)
  9464. {
  9465. if (!obj.ptr)
  9466. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9467. auto saved_ctx = isl_id_list_get_ctx(obj.ptr);
  9468. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9469. ptr = obj.copy();
  9470. if (!ptr)
  9471. exception::throw_last_error(saved_ctx);
  9472. }
  9473. id_list::id_list(isl::ctx ctx, int n)
  9474. {
  9475. auto saved_ctx = ctx;
  9476. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9477. auto res = isl_id_list_alloc(ctx.release(), n);
  9478. if (!res)
  9479. exception::throw_last_error(saved_ctx);
  9480. ptr = res;
  9481. }
  9482. id_list::id_list(isl::id el)
  9483. {
  9484. if (el.is_null())
  9485. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9486. auto saved_ctx = el.ctx();
  9487. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9488. auto res = isl_id_list_from_id(el.release());
  9489. if (!res)
  9490. exception::throw_last_error(saved_ctx);
  9491. ptr = res;
  9492. }
  9493. id_list::id_list(isl::ctx ctx, const std::string &str)
  9494. {
  9495. auto saved_ctx = ctx;
  9496. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9497. auto res = isl_id_list_read_from_str(ctx.release(), str.c_str());
  9498. if (!res)
  9499. exception::throw_last_error(saved_ctx);
  9500. ptr = res;
  9501. }
  9502. id_list &id_list::operator=(id_list obj) {
  9503. std::swap(this->ptr, obj.ptr);
  9504. return *this;
  9505. }
  9506. id_list::~id_list() {
  9507. if (ptr)
  9508. isl_id_list_free(ptr);
  9509. }
  9510. __isl_give isl_id_list *id_list::copy() const & {
  9511. return isl_id_list_copy(ptr);
  9512. }
  9513. __isl_keep isl_id_list *id_list::get() const {
  9514. return ptr;
  9515. }
  9516. __isl_give isl_id_list *id_list::release() {
  9517. isl_id_list *tmp = ptr;
  9518. ptr = nullptr;
  9519. return tmp;
  9520. }
  9521. bool id_list::is_null() const {
  9522. return ptr == nullptr;
  9523. }
  9524. isl::ctx id_list::ctx() const {
  9525. return isl::ctx(isl_id_list_get_ctx(ptr));
  9526. }
  9527. isl::id_list id_list::add(isl::id el) const
  9528. {
  9529. if (!ptr || el.is_null())
  9530. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9531. auto saved_ctx = ctx();
  9532. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9533. auto res = isl_id_list_add(copy(), el.release());
  9534. if (!res)
  9535. exception::throw_last_error(saved_ctx);
  9536. return manage(res);
  9537. }
  9538. isl::id_list id_list::add(const std::string &el) const
  9539. {
  9540. if (!ptr)
  9541. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9542. return this->add(isl::id(ctx(), el));
  9543. }
  9544. isl::id id_list::at(int index) const
  9545. {
  9546. if (!ptr)
  9547. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9548. auto saved_ctx = ctx();
  9549. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9550. auto res = isl_id_list_get_at(get(), index);
  9551. if (!res)
  9552. exception::throw_last_error(saved_ctx);
  9553. return manage(res);
  9554. }
  9555. isl::id id_list::get_at(int index) const
  9556. {
  9557. return at(index);
  9558. }
  9559. isl::id_list id_list::clear() const
  9560. {
  9561. if (!ptr)
  9562. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9563. auto saved_ctx = ctx();
  9564. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9565. auto res = isl_id_list_clear(copy());
  9566. if (!res)
  9567. exception::throw_last_error(saved_ctx);
  9568. return manage(res);
  9569. }
  9570. isl::id_list id_list::concat(isl::id_list list2) const
  9571. {
  9572. if (!ptr || list2.is_null())
  9573. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9574. auto saved_ctx = ctx();
  9575. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9576. auto res = isl_id_list_concat(copy(), list2.release());
  9577. if (!res)
  9578. exception::throw_last_error(saved_ctx);
  9579. return manage(res);
  9580. }
  9581. isl::id_list id_list::drop(unsigned int first, unsigned int n) const
  9582. {
  9583. if (!ptr)
  9584. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9585. auto saved_ctx = ctx();
  9586. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9587. auto res = isl_id_list_drop(copy(), first, n);
  9588. if (!res)
  9589. exception::throw_last_error(saved_ctx);
  9590. return manage(res);
  9591. }
  9592. void id_list::foreach(const std::function<void(isl::id)> &fn) const
  9593. {
  9594. if (!ptr)
  9595. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9596. auto saved_ctx = ctx();
  9597. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9598. struct fn_data {
  9599. std::function<void(isl::id)> func;
  9600. std::exception_ptr eptr;
  9601. } fn_data = { fn };
  9602. auto fn_lambda = [](isl_id *arg_0, void *arg_1) -> isl_stat {
  9603. auto *data = static_cast<struct fn_data *>(arg_1);
  9604. ISL_CPP_TRY {
  9605. (data->func)(manage(arg_0));
  9606. return isl_stat_ok;
  9607. } ISL_CPP_CATCH_ALL {
  9608. data->eptr = std::current_exception();
  9609. return isl_stat_error;
  9610. }
  9611. };
  9612. auto res = isl_id_list_foreach(get(), fn_lambda, &fn_data);
  9613. if (fn_data.eptr)
  9614. std::rethrow_exception(fn_data.eptr);
  9615. if (res < 0)
  9616. exception::throw_last_error(saved_ctx);
  9617. return;
  9618. }
  9619. void id_list::foreach_scc(const std::function<bool(isl::id, isl::id)> &follows, const std::function<void(isl::id_list)> &fn) const
  9620. {
  9621. if (!ptr)
  9622. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9623. auto saved_ctx = ctx();
  9624. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9625. struct follows_data {
  9626. std::function<bool(isl::id, isl::id)> func;
  9627. std::exception_ptr eptr;
  9628. } follows_data = { follows };
  9629. auto follows_lambda = [](isl_id *arg_0, isl_id *arg_1, void *arg_2) -> isl_bool {
  9630. auto *data = static_cast<struct follows_data *>(arg_2);
  9631. ISL_CPP_TRY {
  9632. auto ret = (data->func)(manage_copy(arg_0), manage_copy(arg_1));
  9633. return ret ? isl_bool_true : isl_bool_false;
  9634. } ISL_CPP_CATCH_ALL {
  9635. data->eptr = std::current_exception();
  9636. return isl_bool_error;
  9637. }
  9638. };
  9639. struct fn_data {
  9640. std::function<void(isl::id_list)> func;
  9641. std::exception_ptr eptr;
  9642. } fn_data = { fn };
  9643. auto fn_lambda = [](isl_id_list *arg_0, void *arg_1) -> isl_stat {
  9644. auto *data = static_cast<struct fn_data *>(arg_1);
  9645. ISL_CPP_TRY {
  9646. (data->func)(manage(arg_0));
  9647. return isl_stat_ok;
  9648. } ISL_CPP_CATCH_ALL {
  9649. data->eptr = std::current_exception();
  9650. return isl_stat_error;
  9651. }
  9652. };
  9653. auto res = isl_id_list_foreach_scc(get(), follows_lambda, &follows_data, fn_lambda, &fn_data);
  9654. if (follows_data.eptr)
  9655. std::rethrow_exception(follows_data.eptr);
  9656. if (fn_data.eptr)
  9657. std::rethrow_exception(fn_data.eptr);
  9658. if (res < 0)
  9659. exception::throw_last_error(saved_ctx);
  9660. return;
  9661. }
  9662. isl::id_list id_list::insert(unsigned int pos, isl::id el) const
  9663. {
  9664. if (!ptr || el.is_null())
  9665. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9666. auto saved_ctx = ctx();
  9667. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9668. auto res = isl_id_list_insert(copy(), pos, el.release());
  9669. if (!res)
  9670. exception::throw_last_error(saved_ctx);
  9671. return manage(res);
  9672. }
  9673. isl::id_list id_list::insert(unsigned int pos, const std::string &el) const
  9674. {
  9675. if (!ptr)
  9676. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9677. return this->insert(pos, isl::id(ctx(), el));
  9678. }
  9679. unsigned id_list::size() const
  9680. {
  9681. if (!ptr)
  9682. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9683. auto saved_ctx = ctx();
  9684. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9685. auto res = isl_id_list_size(get());
  9686. if (res < 0)
  9687. exception::throw_last_error(saved_ctx);
  9688. return res;
  9689. }
  9690. inline std::ostream &operator<<(std::ostream &os, const id_list &obj)
  9691. {
  9692. if (!obj.get())
  9693. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9694. auto saved_ctx = isl_id_list_get_ctx(obj.get());
  9695. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9696. char *str = isl_id_list_to_str(obj.get());
  9697. if (!str)
  9698. exception::throw_last_error(saved_ctx);
  9699. os << str;
  9700. free(str);
  9701. return os;
  9702. }
  9703. // implementations for isl::map
  9704. map manage(__isl_take isl_map *ptr) {
  9705. if (!ptr)
  9706. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9707. return map(ptr);
  9708. }
  9709. map manage_copy(__isl_keep isl_map *ptr) {
  9710. if (!ptr)
  9711. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9712. auto saved_ctx = isl_map_get_ctx(ptr);
  9713. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9714. ptr = isl_map_copy(ptr);
  9715. if (!ptr)
  9716. exception::throw_last_error(saved_ctx);
  9717. return map(ptr);
  9718. }
  9719. map::map(__isl_take isl_map *ptr)
  9720. : ptr(ptr) {}
  9721. map::map()
  9722. : ptr(nullptr) {}
  9723. map::map(const map &obj)
  9724. : ptr(nullptr)
  9725. {
  9726. if (!obj.ptr)
  9727. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9728. auto saved_ctx = isl_map_get_ctx(obj.ptr);
  9729. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9730. ptr = obj.copy();
  9731. if (!ptr)
  9732. exception::throw_last_error(saved_ctx);
  9733. }
  9734. map::map(isl::basic_map bmap)
  9735. {
  9736. if (bmap.is_null())
  9737. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9738. auto saved_ctx = bmap.ctx();
  9739. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9740. auto res = isl_map_from_basic_map(bmap.release());
  9741. if (!res)
  9742. exception::throw_last_error(saved_ctx);
  9743. ptr = res;
  9744. }
  9745. map::map(isl::ctx ctx, const std::string &str)
  9746. {
  9747. auto saved_ctx = ctx;
  9748. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9749. auto res = isl_map_read_from_str(ctx.release(), str.c_str());
  9750. if (!res)
  9751. exception::throw_last_error(saved_ctx);
  9752. ptr = res;
  9753. }
  9754. map &map::operator=(map obj) {
  9755. std::swap(this->ptr, obj.ptr);
  9756. return *this;
  9757. }
  9758. map::~map() {
  9759. if (ptr)
  9760. isl_map_free(ptr);
  9761. }
  9762. __isl_give isl_map *map::copy() const & {
  9763. return isl_map_copy(ptr);
  9764. }
  9765. __isl_keep isl_map *map::get() const {
  9766. return ptr;
  9767. }
  9768. __isl_give isl_map *map::release() {
  9769. isl_map *tmp = ptr;
  9770. ptr = nullptr;
  9771. return tmp;
  9772. }
  9773. bool map::is_null() const {
  9774. return ptr == nullptr;
  9775. }
  9776. isl::ctx map::ctx() const {
  9777. return isl::ctx(isl_map_get_ctx(ptr));
  9778. }
  9779. isl::basic_map map::affine_hull() const
  9780. {
  9781. if (!ptr)
  9782. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9783. auto saved_ctx = ctx();
  9784. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9785. auto res = isl_map_affine_hull(copy());
  9786. if (!res)
  9787. exception::throw_last_error(saved_ctx);
  9788. return manage(res);
  9789. }
  9790. isl::map map::apply_domain(isl::map map2) const
  9791. {
  9792. if (!ptr || map2.is_null())
  9793. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9794. auto saved_ctx = ctx();
  9795. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9796. auto res = isl_map_apply_domain(copy(), map2.release());
  9797. if (!res)
  9798. exception::throw_last_error(saved_ctx);
  9799. return manage(res);
  9800. }
  9801. isl::union_map map::apply_domain(const isl::union_map &umap2) const
  9802. {
  9803. if (!ptr)
  9804. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9805. return isl::union_map(*this).apply_domain(umap2);
  9806. }
  9807. isl::map map::apply_domain(const isl::basic_map &map2) const
  9808. {
  9809. if (!ptr)
  9810. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9811. return this->apply_domain(isl::map(map2));
  9812. }
  9813. isl::map map::apply_range(isl::map map2) const
  9814. {
  9815. if (!ptr || map2.is_null())
  9816. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9817. auto saved_ctx = ctx();
  9818. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9819. auto res = isl_map_apply_range(copy(), map2.release());
  9820. if (!res)
  9821. exception::throw_last_error(saved_ctx);
  9822. return manage(res);
  9823. }
  9824. isl::union_map map::apply_range(const isl::union_map &umap2) const
  9825. {
  9826. if (!ptr)
  9827. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9828. return isl::union_map(*this).apply_range(umap2);
  9829. }
  9830. isl::map map::apply_range(const isl::basic_map &map2) const
  9831. {
  9832. if (!ptr)
  9833. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9834. return this->apply_range(isl::map(map2));
  9835. }
  9836. isl::map map::as_map() const
  9837. {
  9838. if (!ptr)
  9839. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9840. return isl::union_map(*this).as_map();
  9841. }
  9842. isl::multi_union_pw_aff map::as_multi_union_pw_aff() const
  9843. {
  9844. if (!ptr)
  9845. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9846. return isl::union_map(*this).as_multi_union_pw_aff();
  9847. }
  9848. isl::pw_multi_aff map::as_pw_multi_aff() const
  9849. {
  9850. if (!ptr)
  9851. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9852. auto saved_ctx = ctx();
  9853. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9854. auto res = isl_map_as_pw_multi_aff(copy());
  9855. if (!res)
  9856. exception::throw_last_error(saved_ctx);
  9857. return manage(res);
  9858. }
  9859. isl::union_pw_multi_aff map::as_union_pw_multi_aff() const
  9860. {
  9861. if (!ptr)
  9862. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9863. return isl::union_map(*this).as_union_pw_multi_aff();
  9864. }
  9865. isl::set map::bind_domain(isl::multi_id tuple) const
  9866. {
  9867. if (!ptr || tuple.is_null())
  9868. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9869. auto saved_ctx = ctx();
  9870. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9871. auto res = isl_map_bind_domain(copy(), tuple.release());
  9872. if (!res)
  9873. exception::throw_last_error(saved_ctx);
  9874. return manage(res);
  9875. }
  9876. isl::set map::bind_range(isl::multi_id tuple) const
  9877. {
  9878. if (!ptr || tuple.is_null())
  9879. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9880. auto saved_ctx = ctx();
  9881. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9882. auto res = isl_map_bind_range(copy(), tuple.release());
  9883. if (!res)
  9884. exception::throw_last_error(saved_ctx);
  9885. return manage(res);
  9886. }
  9887. isl::map map::coalesce() const
  9888. {
  9889. if (!ptr)
  9890. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9891. auto saved_ctx = ctx();
  9892. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9893. auto res = isl_map_coalesce(copy());
  9894. if (!res)
  9895. exception::throw_last_error(saved_ctx);
  9896. return manage(res);
  9897. }
  9898. isl::map map::complement() const
  9899. {
  9900. if (!ptr)
  9901. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9902. auto saved_ctx = ctx();
  9903. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9904. auto res = isl_map_complement(copy());
  9905. if (!res)
  9906. exception::throw_last_error(saved_ctx);
  9907. return manage(res);
  9908. }
  9909. isl::union_map map::compute_divs() const
  9910. {
  9911. if (!ptr)
  9912. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9913. return isl::union_map(*this).compute_divs();
  9914. }
  9915. isl::map map::curry() const
  9916. {
  9917. if (!ptr)
  9918. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9919. auto saved_ctx = ctx();
  9920. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9921. auto res = isl_map_curry(copy());
  9922. if (!res)
  9923. exception::throw_last_error(saved_ctx);
  9924. return manage(res);
  9925. }
  9926. isl::set map::deltas() const
  9927. {
  9928. if (!ptr)
  9929. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9930. auto saved_ctx = ctx();
  9931. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9932. auto res = isl_map_deltas(copy());
  9933. if (!res)
  9934. exception::throw_last_error(saved_ctx);
  9935. return manage(res);
  9936. }
  9937. isl::map map::detect_equalities() const
  9938. {
  9939. if (!ptr)
  9940. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9941. auto saved_ctx = ctx();
  9942. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9943. auto res = isl_map_detect_equalities(copy());
  9944. if (!res)
  9945. exception::throw_last_error(saved_ctx);
  9946. return manage(res);
  9947. }
  9948. isl::set map::domain() const
  9949. {
  9950. if (!ptr)
  9951. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9952. auto saved_ctx = ctx();
  9953. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9954. auto res = isl_map_domain(copy());
  9955. if (!res)
  9956. exception::throw_last_error(saved_ctx);
  9957. return manage(res);
  9958. }
  9959. isl::map map::domain_factor_domain() const
  9960. {
  9961. if (!ptr)
  9962. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9963. auto saved_ctx = ctx();
  9964. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9965. auto res = isl_map_domain_factor_domain(copy());
  9966. if (!res)
  9967. exception::throw_last_error(saved_ctx);
  9968. return manage(res);
  9969. }
  9970. isl::map map::domain_factor_range() const
  9971. {
  9972. if (!ptr)
  9973. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9974. auto saved_ctx = ctx();
  9975. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9976. auto res = isl_map_domain_factor_range(copy());
  9977. if (!res)
  9978. exception::throw_last_error(saved_ctx);
  9979. return manage(res);
  9980. }
  9981. isl::union_map map::domain_map() const
  9982. {
  9983. if (!ptr)
  9984. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9985. return isl::union_map(*this).domain_map();
  9986. }
  9987. isl::union_pw_multi_aff map::domain_map_union_pw_multi_aff() const
  9988. {
  9989. if (!ptr)
  9990. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9991. return isl::union_map(*this).domain_map_union_pw_multi_aff();
  9992. }
  9993. isl::map map::domain_product(isl::map map2) const
  9994. {
  9995. if (!ptr || map2.is_null())
  9996. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  9997. auto saved_ctx = ctx();
  9998. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  9999. auto res = isl_map_domain_product(copy(), map2.release());
  10000. if (!res)
  10001. exception::throw_last_error(saved_ctx);
  10002. return manage(res);
  10003. }
  10004. isl::union_map map::domain_product(const isl::union_map &umap2) const
  10005. {
  10006. if (!ptr)
  10007. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10008. return isl::union_map(*this).domain_product(umap2);
  10009. }
  10010. isl::map map::domain_product(const isl::basic_map &map2) const
  10011. {
  10012. if (!ptr)
  10013. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10014. return this->domain_product(isl::map(map2));
  10015. }
  10016. unsigned map::domain_tuple_dim() const
  10017. {
  10018. if (!ptr)
  10019. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10020. auto saved_ctx = ctx();
  10021. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10022. auto res = isl_map_domain_tuple_dim(get());
  10023. if (res < 0)
  10024. exception::throw_last_error(saved_ctx);
  10025. return res;
  10026. }
  10027. isl::id map::domain_tuple_id() const
  10028. {
  10029. if (!ptr)
  10030. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10031. auto saved_ctx = ctx();
  10032. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10033. auto res = isl_map_get_domain_tuple_id(get());
  10034. if (!res)
  10035. exception::throw_last_error(saved_ctx);
  10036. return manage(res);
  10037. }
  10038. isl::id map::get_domain_tuple_id() const
  10039. {
  10040. return domain_tuple_id();
  10041. }
  10042. isl::map map::empty(isl::space space)
  10043. {
  10044. if (space.is_null())
  10045. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10046. auto saved_ctx = space.ctx();
  10047. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10048. auto res = isl_map_empty(space.release());
  10049. if (!res)
  10050. exception::throw_last_error(saved_ctx);
  10051. return manage(res);
  10052. }
  10053. isl::map map::eq_at(isl::multi_pw_aff mpa) const
  10054. {
  10055. if (!ptr || mpa.is_null())
  10056. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10057. auto saved_ctx = ctx();
  10058. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10059. auto res = isl_map_eq_at_multi_pw_aff(copy(), mpa.release());
  10060. if (!res)
  10061. exception::throw_last_error(saved_ctx);
  10062. return manage(res);
  10063. }
  10064. isl::union_map map::eq_at(const isl::multi_union_pw_aff &mupa) const
  10065. {
  10066. if (!ptr)
  10067. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10068. return isl::union_map(*this).eq_at(mupa);
  10069. }
  10070. isl::map map::eq_at(const isl::aff &mpa) const
  10071. {
  10072. if (!ptr)
  10073. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10074. return this->eq_at(isl::multi_pw_aff(mpa));
  10075. }
  10076. isl::map map::eq_at(const isl::multi_aff &mpa) const
  10077. {
  10078. if (!ptr)
  10079. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10080. return this->eq_at(isl::multi_pw_aff(mpa));
  10081. }
  10082. isl::map map::eq_at(const isl::pw_aff &mpa) const
  10083. {
  10084. if (!ptr)
  10085. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10086. return this->eq_at(isl::multi_pw_aff(mpa));
  10087. }
  10088. isl::map map::eq_at(const isl::pw_multi_aff &mpa) const
  10089. {
  10090. if (!ptr)
  10091. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10092. return this->eq_at(isl::multi_pw_aff(mpa));
  10093. }
  10094. bool map::every_map(const std::function<bool(isl::map)> &test) const
  10095. {
  10096. if (!ptr)
  10097. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10098. return isl::union_map(*this).every_map(test);
  10099. }
  10100. isl::map map::extract_map(const isl::space &space) const
  10101. {
  10102. if (!ptr)
  10103. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10104. return isl::union_map(*this).extract_map(space);
  10105. }
  10106. isl::map map::factor_domain() const
  10107. {
  10108. if (!ptr)
  10109. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10110. auto saved_ctx = ctx();
  10111. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10112. auto res = isl_map_factor_domain(copy());
  10113. if (!res)
  10114. exception::throw_last_error(saved_ctx);
  10115. return manage(res);
  10116. }
  10117. isl::map map::factor_range() const
  10118. {
  10119. if (!ptr)
  10120. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10121. auto saved_ctx = ctx();
  10122. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10123. auto res = isl_map_factor_range(copy());
  10124. if (!res)
  10125. exception::throw_last_error(saved_ctx);
  10126. return manage(res);
  10127. }
  10128. isl::union_map map::fixed_power(const isl::val &exp) const
  10129. {
  10130. if (!ptr)
  10131. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10132. return isl::union_map(*this).fixed_power(exp);
  10133. }
  10134. isl::union_map map::fixed_power(long exp) const
  10135. {
  10136. if (!ptr)
  10137. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10138. return this->fixed_power(isl::val(ctx(), exp));
  10139. }
  10140. isl::map map::flatten() const
  10141. {
  10142. if (!ptr)
  10143. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10144. auto saved_ctx = ctx();
  10145. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10146. auto res = isl_map_flatten(copy());
  10147. if (!res)
  10148. exception::throw_last_error(saved_ctx);
  10149. return manage(res);
  10150. }
  10151. isl::map map::flatten_domain() const
  10152. {
  10153. if (!ptr)
  10154. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10155. auto saved_ctx = ctx();
  10156. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10157. auto res = isl_map_flatten_domain(copy());
  10158. if (!res)
  10159. exception::throw_last_error(saved_ctx);
  10160. return manage(res);
  10161. }
  10162. isl::map map::flatten_range() const
  10163. {
  10164. if (!ptr)
  10165. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10166. auto saved_ctx = ctx();
  10167. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10168. auto res = isl_map_flatten_range(copy());
  10169. if (!res)
  10170. exception::throw_last_error(saved_ctx);
  10171. return manage(res);
  10172. }
  10173. void map::foreach_basic_map(const std::function<void(isl::basic_map)> &fn) const
  10174. {
  10175. if (!ptr)
  10176. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10177. auto saved_ctx = ctx();
  10178. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10179. struct fn_data {
  10180. std::function<void(isl::basic_map)> func;
  10181. std::exception_ptr eptr;
  10182. } fn_data = { fn };
  10183. auto fn_lambda = [](isl_basic_map *arg_0, void *arg_1) -> isl_stat {
  10184. auto *data = static_cast<struct fn_data *>(arg_1);
  10185. ISL_CPP_TRY {
  10186. (data->func)(manage(arg_0));
  10187. return isl_stat_ok;
  10188. } ISL_CPP_CATCH_ALL {
  10189. data->eptr = std::current_exception();
  10190. return isl_stat_error;
  10191. }
  10192. };
  10193. auto res = isl_map_foreach_basic_map(get(), fn_lambda, &fn_data);
  10194. if (fn_data.eptr)
  10195. std::rethrow_exception(fn_data.eptr);
  10196. if (res < 0)
  10197. exception::throw_last_error(saved_ctx);
  10198. return;
  10199. }
  10200. void map::foreach_map(const std::function<void(isl::map)> &fn) const
  10201. {
  10202. if (!ptr)
  10203. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10204. return isl::union_map(*this).foreach_map(fn);
  10205. }
  10206. isl::map map::gist(isl::map context) const
  10207. {
  10208. if (!ptr || context.is_null())
  10209. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10210. auto saved_ctx = ctx();
  10211. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10212. auto res = isl_map_gist(copy(), context.release());
  10213. if (!res)
  10214. exception::throw_last_error(saved_ctx);
  10215. return manage(res);
  10216. }
  10217. isl::union_map map::gist(const isl::union_map &context) const
  10218. {
  10219. if (!ptr)
  10220. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10221. return isl::union_map(*this).gist(context);
  10222. }
  10223. isl::map map::gist(const isl::basic_map &context) const
  10224. {
  10225. if (!ptr)
  10226. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10227. return this->gist(isl::map(context));
  10228. }
  10229. isl::map map::gist_domain(isl::set context) const
  10230. {
  10231. if (!ptr || context.is_null())
  10232. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10233. auto saved_ctx = ctx();
  10234. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10235. auto res = isl_map_gist_domain(copy(), context.release());
  10236. if (!res)
  10237. exception::throw_last_error(saved_ctx);
  10238. return manage(res);
  10239. }
  10240. isl::union_map map::gist_domain(const isl::union_set &uset) const
  10241. {
  10242. if (!ptr)
  10243. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10244. return isl::union_map(*this).gist_domain(uset);
  10245. }
  10246. isl::map map::gist_domain(const isl::basic_set &context) const
  10247. {
  10248. if (!ptr)
  10249. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10250. return this->gist_domain(isl::set(context));
  10251. }
  10252. isl::map map::gist_domain(const isl::point &context) const
  10253. {
  10254. if (!ptr)
  10255. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10256. return this->gist_domain(isl::set(context));
  10257. }
  10258. isl::map map::gist_params(isl::set context) const
  10259. {
  10260. if (!ptr || context.is_null())
  10261. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10262. auto saved_ctx = ctx();
  10263. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10264. auto res = isl_map_gist_params(copy(), context.release());
  10265. if (!res)
  10266. exception::throw_last_error(saved_ctx);
  10267. return manage(res);
  10268. }
  10269. isl::union_map map::gist_range(const isl::union_set &uset) const
  10270. {
  10271. if (!ptr)
  10272. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10273. return isl::union_map(*this).gist_range(uset);
  10274. }
  10275. bool map::has_domain_tuple_id() const
  10276. {
  10277. if (!ptr)
  10278. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10279. auto saved_ctx = ctx();
  10280. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10281. auto res = isl_map_has_domain_tuple_id(get());
  10282. if (res < 0)
  10283. exception::throw_last_error(saved_ctx);
  10284. return res;
  10285. }
  10286. bool map::has_range_tuple_id() const
  10287. {
  10288. if (!ptr)
  10289. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10290. auto saved_ctx = ctx();
  10291. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10292. auto res = isl_map_has_range_tuple_id(get());
  10293. if (res < 0)
  10294. exception::throw_last_error(saved_ctx);
  10295. return res;
  10296. }
  10297. isl::map map::intersect(isl::map map2) const
  10298. {
  10299. if (!ptr || map2.is_null())
  10300. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10301. auto saved_ctx = ctx();
  10302. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10303. auto res = isl_map_intersect(copy(), map2.release());
  10304. if (!res)
  10305. exception::throw_last_error(saved_ctx);
  10306. return manage(res);
  10307. }
  10308. isl::union_map map::intersect(const isl::union_map &umap2) const
  10309. {
  10310. if (!ptr)
  10311. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10312. return isl::union_map(*this).intersect(umap2);
  10313. }
  10314. isl::map map::intersect(const isl::basic_map &map2) const
  10315. {
  10316. if (!ptr)
  10317. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10318. return this->intersect(isl::map(map2));
  10319. }
  10320. isl::map map::intersect_domain(isl::set set) const
  10321. {
  10322. if (!ptr || set.is_null())
  10323. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10324. auto saved_ctx = ctx();
  10325. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10326. auto res = isl_map_intersect_domain(copy(), set.release());
  10327. if (!res)
  10328. exception::throw_last_error(saved_ctx);
  10329. return manage(res);
  10330. }
  10331. isl::union_map map::intersect_domain(const isl::space &space) const
  10332. {
  10333. if (!ptr)
  10334. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10335. return isl::union_map(*this).intersect_domain(space);
  10336. }
  10337. isl::union_map map::intersect_domain(const isl::union_set &uset) const
  10338. {
  10339. if (!ptr)
  10340. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10341. return isl::union_map(*this).intersect_domain(uset);
  10342. }
  10343. isl::map map::intersect_domain(const isl::basic_set &set) const
  10344. {
  10345. if (!ptr)
  10346. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10347. return this->intersect_domain(isl::set(set));
  10348. }
  10349. isl::map map::intersect_domain(const isl::point &set) const
  10350. {
  10351. if (!ptr)
  10352. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10353. return this->intersect_domain(isl::set(set));
  10354. }
  10355. isl::map map::intersect_domain_factor_domain(isl::map factor) const
  10356. {
  10357. if (!ptr || factor.is_null())
  10358. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10359. auto saved_ctx = ctx();
  10360. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10361. auto res = isl_map_intersect_domain_factor_domain(copy(), factor.release());
  10362. if (!res)
  10363. exception::throw_last_error(saved_ctx);
  10364. return manage(res);
  10365. }
  10366. isl::union_map map::intersect_domain_factor_domain(const isl::union_map &factor) const
  10367. {
  10368. if (!ptr)
  10369. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10370. return isl::union_map(*this).intersect_domain_factor_domain(factor);
  10371. }
  10372. isl::map map::intersect_domain_factor_domain(const isl::basic_map &factor) const
  10373. {
  10374. if (!ptr)
  10375. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10376. return this->intersect_domain_factor_domain(isl::map(factor));
  10377. }
  10378. isl::map map::intersect_domain_factor_range(isl::map factor) const
  10379. {
  10380. if (!ptr || factor.is_null())
  10381. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10382. auto saved_ctx = ctx();
  10383. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10384. auto res = isl_map_intersect_domain_factor_range(copy(), factor.release());
  10385. if (!res)
  10386. exception::throw_last_error(saved_ctx);
  10387. return manage(res);
  10388. }
  10389. isl::union_map map::intersect_domain_factor_range(const isl::union_map &factor) const
  10390. {
  10391. if (!ptr)
  10392. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10393. return isl::union_map(*this).intersect_domain_factor_range(factor);
  10394. }
  10395. isl::map map::intersect_domain_factor_range(const isl::basic_map &factor) const
  10396. {
  10397. if (!ptr)
  10398. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10399. return this->intersect_domain_factor_range(isl::map(factor));
  10400. }
  10401. isl::map map::intersect_domain_wrapped_domain(isl::set domain) const
  10402. {
  10403. if (!ptr || domain.is_null())
  10404. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10405. auto saved_ctx = ctx();
  10406. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10407. auto res = isl_map_intersect_domain_wrapped_domain(copy(), domain.release());
  10408. if (!res)
  10409. exception::throw_last_error(saved_ctx);
  10410. return manage(res);
  10411. }
  10412. isl::union_map map::intersect_domain_wrapped_domain(const isl::union_set &domain) const
  10413. {
  10414. if (!ptr)
  10415. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10416. return isl::union_map(*this).intersect_domain_wrapped_domain(domain);
  10417. }
  10418. isl::map map::intersect_domain_wrapped_domain(const isl::basic_set &domain) const
  10419. {
  10420. if (!ptr)
  10421. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10422. return this->intersect_domain_wrapped_domain(isl::set(domain));
  10423. }
  10424. isl::map map::intersect_domain_wrapped_domain(const isl::point &domain) const
  10425. {
  10426. if (!ptr)
  10427. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10428. return this->intersect_domain_wrapped_domain(isl::set(domain));
  10429. }
  10430. isl::map map::intersect_params(isl::set params) const
  10431. {
  10432. if (!ptr || params.is_null())
  10433. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10434. auto saved_ctx = ctx();
  10435. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10436. auto res = isl_map_intersect_params(copy(), params.release());
  10437. if (!res)
  10438. exception::throw_last_error(saved_ctx);
  10439. return manage(res);
  10440. }
  10441. isl::map map::intersect_range(isl::set set) const
  10442. {
  10443. if (!ptr || set.is_null())
  10444. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10445. auto saved_ctx = ctx();
  10446. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10447. auto res = isl_map_intersect_range(copy(), set.release());
  10448. if (!res)
  10449. exception::throw_last_error(saved_ctx);
  10450. return manage(res);
  10451. }
  10452. isl::union_map map::intersect_range(const isl::space &space) const
  10453. {
  10454. if (!ptr)
  10455. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10456. return isl::union_map(*this).intersect_range(space);
  10457. }
  10458. isl::union_map map::intersect_range(const isl::union_set &uset) const
  10459. {
  10460. if (!ptr)
  10461. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10462. return isl::union_map(*this).intersect_range(uset);
  10463. }
  10464. isl::map map::intersect_range(const isl::basic_set &set) const
  10465. {
  10466. if (!ptr)
  10467. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10468. return this->intersect_range(isl::set(set));
  10469. }
  10470. isl::map map::intersect_range(const isl::point &set) const
  10471. {
  10472. if (!ptr)
  10473. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10474. return this->intersect_range(isl::set(set));
  10475. }
  10476. isl::map map::intersect_range_factor_domain(isl::map factor) const
  10477. {
  10478. if (!ptr || factor.is_null())
  10479. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10480. auto saved_ctx = ctx();
  10481. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10482. auto res = isl_map_intersect_range_factor_domain(copy(), factor.release());
  10483. if (!res)
  10484. exception::throw_last_error(saved_ctx);
  10485. return manage(res);
  10486. }
  10487. isl::union_map map::intersect_range_factor_domain(const isl::union_map &factor) const
  10488. {
  10489. if (!ptr)
  10490. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10491. return isl::union_map(*this).intersect_range_factor_domain(factor);
  10492. }
  10493. isl::map map::intersect_range_factor_domain(const isl::basic_map &factor) const
  10494. {
  10495. if (!ptr)
  10496. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10497. return this->intersect_range_factor_domain(isl::map(factor));
  10498. }
  10499. isl::map map::intersect_range_factor_range(isl::map factor) const
  10500. {
  10501. if (!ptr || factor.is_null())
  10502. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10503. auto saved_ctx = ctx();
  10504. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10505. auto res = isl_map_intersect_range_factor_range(copy(), factor.release());
  10506. if (!res)
  10507. exception::throw_last_error(saved_ctx);
  10508. return manage(res);
  10509. }
  10510. isl::union_map map::intersect_range_factor_range(const isl::union_map &factor) const
  10511. {
  10512. if (!ptr)
  10513. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10514. return isl::union_map(*this).intersect_range_factor_range(factor);
  10515. }
  10516. isl::map map::intersect_range_factor_range(const isl::basic_map &factor) const
  10517. {
  10518. if (!ptr)
  10519. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10520. return this->intersect_range_factor_range(isl::map(factor));
  10521. }
  10522. isl::map map::intersect_range_wrapped_domain(isl::set domain) const
  10523. {
  10524. if (!ptr || domain.is_null())
  10525. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10526. auto saved_ctx = ctx();
  10527. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10528. auto res = isl_map_intersect_range_wrapped_domain(copy(), domain.release());
  10529. if (!res)
  10530. exception::throw_last_error(saved_ctx);
  10531. return manage(res);
  10532. }
  10533. isl::union_map map::intersect_range_wrapped_domain(const isl::union_set &domain) const
  10534. {
  10535. if (!ptr)
  10536. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10537. return isl::union_map(*this).intersect_range_wrapped_domain(domain);
  10538. }
  10539. isl::map map::intersect_range_wrapped_domain(const isl::basic_set &domain) const
  10540. {
  10541. if (!ptr)
  10542. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10543. return this->intersect_range_wrapped_domain(isl::set(domain));
  10544. }
  10545. isl::map map::intersect_range_wrapped_domain(const isl::point &domain) const
  10546. {
  10547. if (!ptr)
  10548. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10549. return this->intersect_range_wrapped_domain(isl::set(domain));
  10550. }
  10551. bool map::is_bijective() const
  10552. {
  10553. if (!ptr)
  10554. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10555. auto saved_ctx = ctx();
  10556. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10557. auto res = isl_map_is_bijective(get());
  10558. if (res < 0)
  10559. exception::throw_last_error(saved_ctx);
  10560. return res;
  10561. }
  10562. bool map::is_disjoint(const isl::map &map2) const
  10563. {
  10564. if (!ptr || map2.is_null())
  10565. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10566. auto saved_ctx = ctx();
  10567. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10568. auto res = isl_map_is_disjoint(get(), map2.get());
  10569. if (res < 0)
  10570. exception::throw_last_error(saved_ctx);
  10571. return res;
  10572. }
  10573. bool map::is_disjoint(const isl::union_map &umap2) const
  10574. {
  10575. if (!ptr)
  10576. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10577. return isl::union_map(*this).is_disjoint(umap2);
  10578. }
  10579. bool map::is_disjoint(const isl::basic_map &map2) const
  10580. {
  10581. if (!ptr)
  10582. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10583. return this->is_disjoint(isl::map(map2));
  10584. }
  10585. bool map::is_empty() const
  10586. {
  10587. if (!ptr)
  10588. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10589. auto saved_ctx = ctx();
  10590. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10591. auto res = isl_map_is_empty(get());
  10592. if (res < 0)
  10593. exception::throw_last_error(saved_ctx);
  10594. return res;
  10595. }
  10596. bool map::is_equal(const isl::map &map2) const
  10597. {
  10598. if (!ptr || map2.is_null())
  10599. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10600. auto saved_ctx = ctx();
  10601. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10602. auto res = isl_map_is_equal(get(), map2.get());
  10603. if (res < 0)
  10604. exception::throw_last_error(saved_ctx);
  10605. return res;
  10606. }
  10607. bool map::is_equal(const isl::union_map &umap2) const
  10608. {
  10609. if (!ptr)
  10610. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10611. return isl::union_map(*this).is_equal(umap2);
  10612. }
  10613. bool map::is_equal(const isl::basic_map &map2) const
  10614. {
  10615. if (!ptr)
  10616. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10617. return this->is_equal(isl::map(map2));
  10618. }
  10619. bool map::is_injective() const
  10620. {
  10621. if (!ptr)
  10622. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10623. auto saved_ctx = ctx();
  10624. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10625. auto res = isl_map_is_injective(get());
  10626. if (res < 0)
  10627. exception::throw_last_error(saved_ctx);
  10628. return res;
  10629. }
  10630. bool map::is_single_valued() const
  10631. {
  10632. if (!ptr)
  10633. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10634. auto saved_ctx = ctx();
  10635. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10636. auto res = isl_map_is_single_valued(get());
  10637. if (res < 0)
  10638. exception::throw_last_error(saved_ctx);
  10639. return res;
  10640. }
  10641. bool map::is_strict_subset(const isl::map &map2) const
  10642. {
  10643. if (!ptr || map2.is_null())
  10644. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10645. auto saved_ctx = ctx();
  10646. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10647. auto res = isl_map_is_strict_subset(get(), map2.get());
  10648. if (res < 0)
  10649. exception::throw_last_error(saved_ctx);
  10650. return res;
  10651. }
  10652. bool map::is_strict_subset(const isl::union_map &umap2) const
  10653. {
  10654. if (!ptr)
  10655. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10656. return isl::union_map(*this).is_strict_subset(umap2);
  10657. }
  10658. bool map::is_strict_subset(const isl::basic_map &map2) const
  10659. {
  10660. if (!ptr)
  10661. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10662. return this->is_strict_subset(isl::map(map2));
  10663. }
  10664. bool map::is_subset(const isl::map &map2) const
  10665. {
  10666. if (!ptr || map2.is_null())
  10667. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10668. auto saved_ctx = ctx();
  10669. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10670. auto res = isl_map_is_subset(get(), map2.get());
  10671. if (res < 0)
  10672. exception::throw_last_error(saved_ctx);
  10673. return res;
  10674. }
  10675. bool map::is_subset(const isl::union_map &umap2) const
  10676. {
  10677. if (!ptr)
  10678. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10679. return isl::union_map(*this).is_subset(umap2);
  10680. }
  10681. bool map::is_subset(const isl::basic_map &map2) const
  10682. {
  10683. if (!ptr)
  10684. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10685. return this->is_subset(isl::map(map2));
  10686. }
  10687. bool map::isa_map() const
  10688. {
  10689. if (!ptr)
  10690. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10691. return isl::union_map(*this).isa_map();
  10692. }
  10693. isl::map map::lex_ge_at(isl::multi_pw_aff mpa) const
  10694. {
  10695. if (!ptr || mpa.is_null())
  10696. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10697. auto saved_ctx = ctx();
  10698. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10699. auto res = isl_map_lex_ge_at_multi_pw_aff(copy(), mpa.release());
  10700. if (!res)
  10701. exception::throw_last_error(saved_ctx);
  10702. return manage(res);
  10703. }
  10704. isl::map map::lex_gt_at(isl::multi_pw_aff mpa) const
  10705. {
  10706. if (!ptr || mpa.is_null())
  10707. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10708. auto saved_ctx = ctx();
  10709. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10710. auto res = isl_map_lex_gt_at_multi_pw_aff(copy(), mpa.release());
  10711. if (!res)
  10712. exception::throw_last_error(saved_ctx);
  10713. return manage(res);
  10714. }
  10715. isl::map map::lex_le_at(isl::multi_pw_aff mpa) const
  10716. {
  10717. if (!ptr || mpa.is_null())
  10718. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10719. auto saved_ctx = ctx();
  10720. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10721. auto res = isl_map_lex_le_at_multi_pw_aff(copy(), mpa.release());
  10722. if (!res)
  10723. exception::throw_last_error(saved_ctx);
  10724. return manage(res);
  10725. }
  10726. isl::map map::lex_lt_at(isl::multi_pw_aff mpa) const
  10727. {
  10728. if (!ptr || mpa.is_null())
  10729. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10730. auto saved_ctx = ctx();
  10731. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10732. auto res = isl_map_lex_lt_at_multi_pw_aff(copy(), mpa.release());
  10733. if (!res)
  10734. exception::throw_last_error(saved_ctx);
  10735. return manage(res);
  10736. }
  10737. isl::map map::lexmax() const
  10738. {
  10739. if (!ptr)
  10740. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10741. auto saved_ctx = ctx();
  10742. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10743. auto res = isl_map_lexmax(copy());
  10744. if (!res)
  10745. exception::throw_last_error(saved_ctx);
  10746. return manage(res);
  10747. }
  10748. isl::pw_multi_aff map::lexmax_pw_multi_aff() const
  10749. {
  10750. if (!ptr)
  10751. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10752. auto saved_ctx = ctx();
  10753. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10754. auto res = isl_map_lexmax_pw_multi_aff(copy());
  10755. if (!res)
  10756. exception::throw_last_error(saved_ctx);
  10757. return manage(res);
  10758. }
  10759. isl::map map::lexmin() const
  10760. {
  10761. if (!ptr)
  10762. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10763. auto saved_ctx = ctx();
  10764. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10765. auto res = isl_map_lexmin(copy());
  10766. if (!res)
  10767. exception::throw_last_error(saved_ctx);
  10768. return manage(res);
  10769. }
  10770. isl::pw_multi_aff map::lexmin_pw_multi_aff() const
  10771. {
  10772. if (!ptr)
  10773. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10774. auto saved_ctx = ctx();
  10775. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10776. auto res = isl_map_lexmin_pw_multi_aff(copy());
  10777. if (!res)
  10778. exception::throw_last_error(saved_ctx);
  10779. return manage(res);
  10780. }
  10781. isl::map map::lower_bound(isl::multi_pw_aff lower) const
  10782. {
  10783. if (!ptr || lower.is_null())
  10784. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10785. auto saved_ctx = ctx();
  10786. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10787. auto res = isl_map_lower_bound_multi_pw_aff(copy(), lower.release());
  10788. if (!res)
  10789. exception::throw_last_error(saved_ctx);
  10790. return manage(res);
  10791. }
  10792. isl::map_list map::map_list() const
  10793. {
  10794. if (!ptr)
  10795. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10796. return isl::union_map(*this).map_list();
  10797. }
  10798. isl::multi_pw_aff map::max_multi_pw_aff() const
  10799. {
  10800. if (!ptr)
  10801. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10802. auto saved_ctx = ctx();
  10803. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10804. auto res = isl_map_max_multi_pw_aff(copy());
  10805. if (!res)
  10806. exception::throw_last_error(saved_ctx);
  10807. return manage(res);
  10808. }
  10809. isl::multi_pw_aff map::min_multi_pw_aff() const
  10810. {
  10811. if (!ptr)
  10812. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10813. auto saved_ctx = ctx();
  10814. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10815. auto res = isl_map_min_multi_pw_aff(copy());
  10816. if (!res)
  10817. exception::throw_last_error(saved_ctx);
  10818. return manage(res);
  10819. }
  10820. unsigned map::n_basic_map() const
  10821. {
  10822. if (!ptr)
  10823. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10824. auto saved_ctx = ctx();
  10825. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10826. auto res = isl_map_n_basic_map(get());
  10827. if (res < 0)
  10828. exception::throw_last_error(saved_ctx);
  10829. return res;
  10830. }
  10831. isl::basic_map map::polyhedral_hull() const
  10832. {
  10833. if (!ptr)
  10834. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10835. auto saved_ctx = ctx();
  10836. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10837. auto res = isl_map_polyhedral_hull(copy());
  10838. if (!res)
  10839. exception::throw_last_error(saved_ctx);
  10840. return manage(res);
  10841. }
  10842. isl::map map::preimage_domain(isl::multi_aff ma) const
  10843. {
  10844. if (!ptr || ma.is_null())
  10845. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10846. auto saved_ctx = ctx();
  10847. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10848. auto res = isl_map_preimage_domain_multi_aff(copy(), ma.release());
  10849. if (!res)
  10850. exception::throw_last_error(saved_ctx);
  10851. return manage(res);
  10852. }
  10853. isl::map map::preimage_domain(isl::multi_pw_aff mpa) const
  10854. {
  10855. if (!ptr || mpa.is_null())
  10856. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10857. auto saved_ctx = ctx();
  10858. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10859. auto res = isl_map_preimage_domain_multi_pw_aff(copy(), mpa.release());
  10860. if (!res)
  10861. exception::throw_last_error(saved_ctx);
  10862. return manage(res);
  10863. }
  10864. isl::map map::preimage_domain(isl::pw_multi_aff pma) const
  10865. {
  10866. if (!ptr || pma.is_null())
  10867. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10868. auto saved_ctx = ctx();
  10869. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10870. auto res = isl_map_preimage_domain_pw_multi_aff(copy(), pma.release());
  10871. if (!res)
  10872. exception::throw_last_error(saved_ctx);
  10873. return manage(res);
  10874. }
  10875. isl::union_map map::preimage_domain(const isl::union_pw_multi_aff &upma) const
  10876. {
  10877. if (!ptr)
  10878. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10879. return isl::union_map(*this).preimage_domain(upma);
  10880. }
  10881. isl::map map::preimage_range(isl::multi_aff ma) const
  10882. {
  10883. if (!ptr || ma.is_null())
  10884. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10885. auto saved_ctx = ctx();
  10886. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10887. auto res = isl_map_preimage_range_multi_aff(copy(), ma.release());
  10888. if (!res)
  10889. exception::throw_last_error(saved_ctx);
  10890. return manage(res);
  10891. }
  10892. isl::map map::preimage_range(isl::pw_multi_aff pma) const
  10893. {
  10894. if (!ptr || pma.is_null())
  10895. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10896. auto saved_ctx = ctx();
  10897. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10898. auto res = isl_map_preimage_range_pw_multi_aff(copy(), pma.release());
  10899. if (!res)
  10900. exception::throw_last_error(saved_ctx);
  10901. return manage(res);
  10902. }
  10903. isl::union_map map::preimage_range(const isl::union_pw_multi_aff &upma) const
  10904. {
  10905. if (!ptr)
  10906. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10907. return isl::union_map(*this).preimage_range(upma);
  10908. }
  10909. isl::map map::product(isl::map map2) const
  10910. {
  10911. if (!ptr || map2.is_null())
  10912. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10913. auto saved_ctx = ctx();
  10914. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10915. auto res = isl_map_product(copy(), map2.release());
  10916. if (!res)
  10917. exception::throw_last_error(saved_ctx);
  10918. return manage(res);
  10919. }
  10920. isl::union_map map::product(const isl::union_map &umap2) const
  10921. {
  10922. if (!ptr)
  10923. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10924. return isl::union_map(*this).product(umap2);
  10925. }
  10926. isl::map map::product(const isl::basic_map &map2) const
  10927. {
  10928. if (!ptr)
  10929. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10930. return this->product(isl::map(map2));
  10931. }
  10932. isl::map map::project_out_all_params() const
  10933. {
  10934. if (!ptr)
  10935. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10936. auto saved_ctx = ctx();
  10937. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10938. auto res = isl_map_project_out_all_params(copy());
  10939. if (!res)
  10940. exception::throw_last_error(saved_ctx);
  10941. return manage(res);
  10942. }
  10943. isl::set map::range() const
  10944. {
  10945. if (!ptr)
  10946. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10947. auto saved_ctx = ctx();
  10948. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10949. auto res = isl_map_range(copy());
  10950. if (!res)
  10951. exception::throw_last_error(saved_ctx);
  10952. return manage(res);
  10953. }
  10954. isl::map map::range_factor_domain() const
  10955. {
  10956. if (!ptr)
  10957. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10958. auto saved_ctx = ctx();
  10959. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10960. auto res = isl_map_range_factor_domain(copy());
  10961. if (!res)
  10962. exception::throw_last_error(saved_ctx);
  10963. return manage(res);
  10964. }
  10965. isl::map map::range_factor_range() const
  10966. {
  10967. if (!ptr)
  10968. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10969. auto saved_ctx = ctx();
  10970. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10971. auto res = isl_map_range_factor_range(copy());
  10972. if (!res)
  10973. exception::throw_last_error(saved_ctx);
  10974. return manage(res);
  10975. }
  10976. isl::fixed_box map::range_lattice_tile() const
  10977. {
  10978. if (!ptr)
  10979. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10980. auto saved_ctx = ctx();
  10981. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  10982. auto res = isl_map_get_range_lattice_tile(get());
  10983. if (!res)
  10984. exception::throw_last_error(saved_ctx);
  10985. return manage(res);
  10986. }
  10987. isl::fixed_box map::get_range_lattice_tile() const
  10988. {
  10989. return range_lattice_tile();
  10990. }
  10991. isl::union_map map::range_map() const
  10992. {
  10993. if (!ptr)
  10994. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  10995. return isl::union_map(*this).range_map();
  10996. }
  10997. isl::map map::range_product(isl::map map2) const
  10998. {
  10999. if (!ptr || map2.is_null())
  11000. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11001. auto saved_ctx = ctx();
  11002. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11003. auto res = isl_map_range_product(copy(), map2.release());
  11004. if (!res)
  11005. exception::throw_last_error(saved_ctx);
  11006. return manage(res);
  11007. }
  11008. isl::union_map map::range_product(const isl::union_map &umap2) const
  11009. {
  11010. if (!ptr)
  11011. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11012. return isl::union_map(*this).range_product(umap2);
  11013. }
  11014. isl::map map::range_product(const isl::basic_map &map2) const
  11015. {
  11016. if (!ptr)
  11017. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11018. return this->range_product(isl::map(map2));
  11019. }
  11020. isl::map map::range_reverse() const
  11021. {
  11022. if (!ptr)
  11023. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11024. auto saved_ctx = ctx();
  11025. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11026. auto res = isl_map_range_reverse(copy());
  11027. if (!res)
  11028. exception::throw_last_error(saved_ctx);
  11029. return manage(res);
  11030. }
  11031. isl::fixed_box map::range_simple_fixed_box_hull() const
  11032. {
  11033. if (!ptr)
  11034. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11035. auto saved_ctx = ctx();
  11036. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11037. auto res = isl_map_get_range_simple_fixed_box_hull(get());
  11038. if (!res)
  11039. exception::throw_last_error(saved_ctx);
  11040. return manage(res);
  11041. }
  11042. isl::fixed_box map::get_range_simple_fixed_box_hull() const
  11043. {
  11044. return range_simple_fixed_box_hull();
  11045. }
  11046. unsigned map::range_tuple_dim() const
  11047. {
  11048. if (!ptr)
  11049. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11050. auto saved_ctx = ctx();
  11051. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11052. auto res = isl_map_range_tuple_dim(get());
  11053. if (res < 0)
  11054. exception::throw_last_error(saved_ctx);
  11055. return res;
  11056. }
  11057. isl::id map::range_tuple_id() const
  11058. {
  11059. if (!ptr)
  11060. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11061. auto saved_ctx = ctx();
  11062. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11063. auto res = isl_map_get_range_tuple_id(get());
  11064. if (!res)
  11065. exception::throw_last_error(saved_ctx);
  11066. return manage(res);
  11067. }
  11068. isl::id map::get_range_tuple_id() const
  11069. {
  11070. return range_tuple_id();
  11071. }
  11072. isl::map map::reverse() const
  11073. {
  11074. if (!ptr)
  11075. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11076. auto saved_ctx = ctx();
  11077. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11078. auto res = isl_map_reverse(copy());
  11079. if (!res)
  11080. exception::throw_last_error(saved_ctx);
  11081. return manage(res);
  11082. }
  11083. isl::basic_map map::sample() const
  11084. {
  11085. if (!ptr)
  11086. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11087. auto saved_ctx = ctx();
  11088. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11089. auto res = isl_map_sample(copy());
  11090. if (!res)
  11091. exception::throw_last_error(saved_ctx);
  11092. return manage(res);
  11093. }
  11094. isl::map map::set_domain_tuple(isl::id id) const
  11095. {
  11096. if (!ptr || id.is_null())
  11097. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11098. auto saved_ctx = ctx();
  11099. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11100. auto res = isl_map_set_domain_tuple_id(copy(), id.release());
  11101. if (!res)
  11102. exception::throw_last_error(saved_ctx);
  11103. return manage(res);
  11104. }
  11105. isl::map map::set_domain_tuple(const std::string &id) const
  11106. {
  11107. if (!ptr)
  11108. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11109. return this->set_domain_tuple(isl::id(ctx(), id));
  11110. }
  11111. isl::map map::set_range_tuple(isl::id id) const
  11112. {
  11113. if (!ptr || id.is_null())
  11114. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11115. auto saved_ctx = ctx();
  11116. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11117. auto res = isl_map_set_range_tuple_id(copy(), id.release());
  11118. if (!res)
  11119. exception::throw_last_error(saved_ctx);
  11120. return manage(res);
  11121. }
  11122. isl::map map::set_range_tuple(const std::string &id) const
  11123. {
  11124. if (!ptr)
  11125. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11126. return this->set_range_tuple(isl::id(ctx(), id));
  11127. }
  11128. isl::space map::space() const
  11129. {
  11130. if (!ptr)
  11131. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11132. auto saved_ctx = ctx();
  11133. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11134. auto res = isl_map_get_space(get());
  11135. if (!res)
  11136. exception::throw_last_error(saved_ctx);
  11137. return manage(res);
  11138. }
  11139. isl::space map::get_space() const
  11140. {
  11141. return space();
  11142. }
  11143. isl::map map::subtract(isl::map map2) const
  11144. {
  11145. if (!ptr || map2.is_null())
  11146. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11147. auto saved_ctx = ctx();
  11148. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11149. auto res = isl_map_subtract(copy(), map2.release());
  11150. if (!res)
  11151. exception::throw_last_error(saved_ctx);
  11152. return manage(res);
  11153. }
  11154. isl::union_map map::subtract(const isl::union_map &umap2) const
  11155. {
  11156. if (!ptr)
  11157. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11158. return isl::union_map(*this).subtract(umap2);
  11159. }
  11160. isl::map map::subtract(const isl::basic_map &map2) const
  11161. {
  11162. if (!ptr)
  11163. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11164. return this->subtract(isl::map(map2));
  11165. }
  11166. isl::union_map map::subtract_domain(const isl::union_set &dom) const
  11167. {
  11168. if (!ptr)
  11169. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11170. return isl::union_map(*this).subtract_domain(dom);
  11171. }
  11172. isl::union_map map::subtract_range(const isl::union_set &dom) const
  11173. {
  11174. if (!ptr)
  11175. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11176. return isl::union_map(*this).subtract_range(dom);
  11177. }
  11178. isl::map_list map::to_list() const
  11179. {
  11180. if (!ptr)
  11181. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11182. auto saved_ctx = ctx();
  11183. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11184. auto res = isl_map_to_list(copy());
  11185. if (!res)
  11186. exception::throw_last_error(saved_ctx);
  11187. return manage(res);
  11188. }
  11189. isl::union_map map::to_union_map() const
  11190. {
  11191. if (!ptr)
  11192. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11193. auto saved_ctx = ctx();
  11194. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11195. auto res = isl_map_to_union_map(copy());
  11196. if (!res)
  11197. exception::throw_last_error(saved_ctx);
  11198. return manage(res);
  11199. }
  11200. isl::map map::uncurry() const
  11201. {
  11202. if (!ptr)
  11203. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11204. auto saved_ctx = ctx();
  11205. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11206. auto res = isl_map_uncurry(copy());
  11207. if (!res)
  11208. exception::throw_last_error(saved_ctx);
  11209. return manage(res);
  11210. }
  11211. isl::map map::unite(isl::map map2) const
  11212. {
  11213. if (!ptr || map2.is_null())
  11214. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11215. auto saved_ctx = ctx();
  11216. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11217. auto res = isl_map_union(copy(), map2.release());
  11218. if (!res)
  11219. exception::throw_last_error(saved_ctx);
  11220. return manage(res);
  11221. }
  11222. isl::union_map map::unite(const isl::union_map &umap2) const
  11223. {
  11224. if (!ptr)
  11225. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11226. return isl::union_map(*this).unite(umap2);
  11227. }
  11228. isl::map map::unite(const isl::basic_map &map2) const
  11229. {
  11230. if (!ptr)
  11231. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11232. return this->unite(isl::map(map2));
  11233. }
  11234. isl::map map::universe(isl::space space)
  11235. {
  11236. if (space.is_null())
  11237. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11238. auto saved_ctx = space.ctx();
  11239. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11240. auto res = isl_map_universe(space.release());
  11241. if (!res)
  11242. exception::throw_last_error(saved_ctx);
  11243. return manage(res);
  11244. }
  11245. isl::basic_map map::unshifted_simple_hull() const
  11246. {
  11247. if (!ptr)
  11248. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11249. auto saved_ctx = ctx();
  11250. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11251. auto res = isl_map_unshifted_simple_hull(copy());
  11252. if (!res)
  11253. exception::throw_last_error(saved_ctx);
  11254. return manage(res);
  11255. }
  11256. isl::map map::upper_bound(isl::multi_pw_aff upper) const
  11257. {
  11258. if (!ptr || upper.is_null())
  11259. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11260. auto saved_ctx = ctx();
  11261. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11262. auto res = isl_map_upper_bound_multi_pw_aff(copy(), upper.release());
  11263. if (!res)
  11264. exception::throw_last_error(saved_ctx);
  11265. return manage(res);
  11266. }
  11267. isl::set map::wrap() const
  11268. {
  11269. if (!ptr)
  11270. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11271. auto saved_ctx = ctx();
  11272. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11273. auto res = isl_map_wrap(copy());
  11274. if (!res)
  11275. exception::throw_last_error(saved_ctx);
  11276. return manage(res);
  11277. }
  11278. isl::map map::zip() const
  11279. {
  11280. if (!ptr)
  11281. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11282. auto saved_ctx = ctx();
  11283. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11284. auto res = isl_map_zip(copy());
  11285. if (!res)
  11286. exception::throw_last_error(saved_ctx);
  11287. return manage(res);
  11288. }
  11289. inline std::ostream &operator<<(std::ostream &os, const map &obj)
  11290. {
  11291. if (!obj.get())
  11292. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11293. auto saved_ctx = isl_map_get_ctx(obj.get());
  11294. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11295. char *str = isl_map_to_str(obj.get());
  11296. if (!str)
  11297. exception::throw_last_error(saved_ctx);
  11298. os << str;
  11299. free(str);
  11300. return os;
  11301. }
  11302. // implementations for isl::map_list
  11303. map_list manage(__isl_take isl_map_list *ptr) {
  11304. if (!ptr)
  11305. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11306. return map_list(ptr);
  11307. }
  11308. map_list manage_copy(__isl_keep isl_map_list *ptr) {
  11309. if (!ptr)
  11310. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11311. auto saved_ctx = isl_map_list_get_ctx(ptr);
  11312. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11313. ptr = isl_map_list_copy(ptr);
  11314. if (!ptr)
  11315. exception::throw_last_error(saved_ctx);
  11316. return map_list(ptr);
  11317. }
  11318. map_list::map_list(__isl_take isl_map_list *ptr)
  11319. : ptr(ptr) {}
  11320. map_list::map_list()
  11321. : ptr(nullptr) {}
  11322. map_list::map_list(const map_list &obj)
  11323. : ptr(nullptr)
  11324. {
  11325. if (!obj.ptr)
  11326. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11327. auto saved_ctx = isl_map_list_get_ctx(obj.ptr);
  11328. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11329. ptr = obj.copy();
  11330. if (!ptr)
  11331. exception::throw_last_error(saved_ctx);
  11332. }
  11333. map_list::map_list(isl::ctx ctx, int n)
  11334. {
  11335. auto saved_ctx = ctx;
  11336. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11337. auto res = isl_map_list_alloc(ctx.release(), n);
  11338. if (!res)
  11339. exception::throw_last_error(saved_ctx);
  11340. ptr = res;
  11341. }
  11342. map_list::map_list(isl::map el)
  11343. {
  11344. if (el.is_null())
  11345. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11346. auto saved_ctx = el.ctx();
  11347. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11348. auto res = isl_map_list_from_map(el.release());
  11349. if (!res)
  11350. exception::throw_last_error(saved_ctx);
  11351. ptr = res;
  11352. }
  11353. map_list::map_list(isl::ctx ctx, const std::string &str)
  11354. {
  11355. auto saved_ctx = ctx;
  11356. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11357. auto res = isl_map_list_read_from_str(ctx.release(), str.c_str());
  11358. if (!res)
  11359. exception::throw_last_error(saved_ctx);
  11360. ptr = res;
  11361. }
  11362. map_list &map_list::operator=(map_list obj) {
  11363. std::swap(this->ptr, obj.ptr);
  11364. return *this;
  11365. }
  11366. map_list::~map_list() {
  11367. if (ptr)
  11368. isl_map_list_free(ptr);
  11369. }
  11370. __isl_give isl_map_list *map_list::copy() const & {
  11371. return isl_map_list_copy(ptr);
  11372. }
  11373. __isl_keep isl_map_list *map_list::get() const {
  11374. return ptr;
  11375. }
  11376. __isl_give isl_map_list *map_list::release() {
  11377. isl_map_list *tmp = ptr;
  11378. ptr = nullptr;
  11379. return tmp;
  11380. }
  11381. bool map_list::is_null() const {
  11382. return ptr == nullptr;
  11383. }
  11384. isl::ctx map_list::ctx() const {
  11385. return isl::ctx(isl_map_list_get_ctx(ptr));
  11386. }
  11387. isl::map_list map_list::add(isl::map el) const
  11388. {
  11389. if (!ptr || el.is_null())
  11390. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11391. auto saved_ctx = ctx();
  11392. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11393. auto res = isl_map_list_add(copy(), el.release());
  11394. if (!res)
  11395. exception::throw_last_error(saved_ctx);
  11396. return manage(res);
  11397. }
  11398. isl::map map_list::at(int index) const
  11399. {
  11400. if (!ptr)
  11401. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11402. auto saved_ctx = ctx();
  11403. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11404. auto res = isl_map_list_get_at(get(), index);
  11405. if (!res)
  11406. exception::throw_last_error(saved_ctx);
  11407. return manage(res);
  11408. }
  11409. isl::map map_list::get_at(int index) const
  11410. {
  11411. return at(index);
  11412. }
  11413. isl::map_list map_list::clear() const
  11414. {
  11415. if (!ptr)
  11416. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11417. auto saved_ctx = ctx();
  11418. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11419. auto res = isl_map_list_clear(copy());
  11420. if (!res)
  11421. exception::throw_last_error(saved_ctx);
  11422. return manage(res);
  11423. }
  11424. isl::map_list map_list::concat(isl::map_list list2) const
  11425. {
  11426. if (!ptr || list2.is_null())
  11427. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11428. auto saved_ctx = ctx();
  11429. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11430. auto res = isl_map_list_concat(copy(), list2.release());
  11431. if (!res)
  11432. exception::throw_last_error(saved_ctx);
  11433. return manage(res);
  11434. }
  11435. isl::map_list map_list::drop(unsigned int first, unsigned int n) const
  11436. {
  11437. if (!ptr)
  11438. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11439. auto saved_ctx = ctx();
  11440. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11441. auto res = isl_map_list_drop(copy(), first, n);
  11442. if (!res)
  11443. exception::throw_last_error(saved_ctx);
  11444. return manage(res);
  11445. }
  11446. void map_list::foreach(const std::function<void(isl::map)> &fn) const
  11447. {
  11448. if (!ptr)
  11449. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11450. auto saved_ctx = ctx();
  11451. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11452. struct fn_data {
  11453. std::function<void(isl::map)> func;
  11454. std::exception_ptr eptr;
  11455. } fn_data = { fn };
  11456. auto fn_lambda = [](isl_map *arg_0, void *arg_1) -> isl_stat {
  11457. auto *data = static_cast<struct fn_data *>(arg_1);
  11458. ISL_CPP_TRY {
  11459. (data->func)(manage(arg_0));
  11460. return isl_stat_ok;
  11461. } ISL_CPP_CATCH_ALL {
  11462. data->eptr = std::current_exception();
  11463. return isl_stat_error;
  11464. }
  11465. };
  11466. auto res = isl_map_list_foreach(get(), fn_lambda, &fn_data);
  11467. if (fn_data.eptr)
  11468. std::rethrow_exception(fn_data.eptr);
  11469. if (res < 0)
  11470. exception::throw_last_error(saved_ctx);
  11471. return;
  11472. }
  11473. void map_list::foreach_scc(const std::function<bool(isl::map, isl::map)> &follows, const std::function<void(isl::map_list)> &fn) const
  11474. {
  11475. if (!ptr)
  11476. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11477. auto saved_ctx = ctx();
  11478. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11479. struct follows_data {
  11480. std::function<bool(isl::map, isl::map)> func;
  11481. std::exception_ptr eptr;
  11482. } follows_data = { follows };
  11483. auto follows_lambda = [](isl_map *arg_0, isl_map *arg_1, void *arg_2) -> isl_bool {
  11484. auto *data = static_cast<struct follows_data *>(arg_2);
  11485. ISL_CPP_TRY {
  11486. auto ret = (data->func)(manage_copy(arg_0), manage_copy(arg_1));
  11487. return ret ? isl_bool_true : isl_bool_false;
  11488. } ISL_CPP_CATCH_ALL {
  11489. data->eptr = std::current_exception();
  11490. return isl_bool_error;
  11491. }
  11492. };
  11493. struct fn_data {
  11494. std::function<void(isl::map_list)> func;
  11495. std::exception_ptr eptr;
  11496. } fn_data = { fn };
  11497. auto fn_lambda = [](isl_map_list *arg_0, void *arg_1) -> isl_stat {
  11498. auto *data = static_cast<struct fn_data *>(arg_1);
  11499. ISL_CPP_TRY {
  11500. (data->func)(manage(arg_0));
  11501. return isl_stat_ok;
  11502. } ISL_CPP_CATCH_ALL {
  11503. data->eptr = std::current_exception();
  11504. return isl_stat_error;
  11505. }
  11506. };
  11507. auto res = isl_map_list_foreach_scc(get(), follows_lambda, &follows_data, fn_lambda, &fn_data);
  11508. if (follows_data.eptr)
  11509. std::rethrow_exception(follows_data.eptr);
  11510. if (fn_data.eptr)
  11511. std::rethrow_exception(fn_data.eptr);
  11512. if (res < 0)
  11513. exception::throw_last_error(saved_ctx);
  11514. return;
  11515. }
  11516. isl::map_list map_list::insert(unsigned int pos, isl::map el) const
  11517. {
  11518. if (!ptr || el.is_null())
  11519. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11520. auto saved_ctx = ctx();
  11521. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11522. auto res = isl_map_list_insert(copy(), pos, el.release());
  11523. if (!res)
  11524. exception::throw_last_error(saved_ctx);
  11525. return manage(res);
  11526. }
  11527. unsigned map_list::size() const
  11528. {
  11529. if (!ptr)
  11530. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11531. auto saved_ctx = ctx();
  11532. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11533. auto res = isl_map_list_size(get());
  11534. if (res < 0)
  11535. exception::throw_last_error(saved_ctx);
  11536. return res;
  11537. }
  11538. inline std::ostream &operator<<(std::ostream &os, const map_list &obj)
  11539. {
  11540. if (!obj.get())
  11541. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11542. auto saved_ctx = isl_map_list_get_ctx(obj.get());
  11543. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11544. char *str = isl_map_list_to_str(obj.get());
  11545. if (!str)
  11546. exception::throw_last_error(saved_ctx);
  11547. os << str;
  11548. free(str);
  11549. return os;
  11550. }
  11551. // implementations for isl::multi_aff
  11552. multi_aff manage(__isl_take isl_multi_aff *ptr) {
  11553. if (!ptr)
  11554. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11555. return multi_aff(ptr);
  11556. }
  11557. multi_aff manage_copy(__isl_keep isl_multi_aff *ptr) {
  11558. if (!ptr)
  11559. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11560. auto saved_ctx = isl_multi_aff_get_ctx(ptr);
  11561. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11562. ptr = isl_multi_aff_copy(ptr);
  11563. if (!ptr)
  11564. exception::throw_last_error(saved_ctx);
  11565. return multi_aff(ptr);
  11566. }
  11567. multi_aff::multi_aff(__isl_take isl_multi_aff *ptr)
  11568. : ptr(ptr) {}
  11569. multi_aff::multi_aff()
  11570. : ptr(nullptr) {}
  11571. multi_aff::multi_aff(const multi_aff &obj)
  11572. : ptr(nullptr)
  11573. {
  11574. if (!obj.ptr)
  11575. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11576. auto saved_ctx = isl_multi_aff_get_ctx(obj.ptr);
  11577. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11578. ptr = obj.copy();
  11579. if (!ptr)
  11580. exception::throw_last_error(saved_ctx);
  11581. }
  11582. multi_aff::multi_aff(isl::aff aff)
  11583. {
  11584. if (aff.is_null())
  11585. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11586. auto saved_ctx = aff.ctx();
  11587. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11588. auto res = isl_multi_aff_from_aff(aff.release());
  11589. if (!res)
  11590. exception::throw_last_error(saved_ctx);
  11591. ptr = res;
  11592. }
  11593. multi_aff::multi_aff(isl::space space, isl::aff_list list)
  11594. {
  11595. if (space.is_null() || list.is_null())
  11596. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11597. auto saved_ctx = space.ctx();
  11598. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11599. auto res = isl_multi_aff_from_aff_list(space.release(), list.release());
  11600. if (!res)
  11601. exception::throw_last_error(saved_ctx);
  11602. ptr = res;
  11603. }
  11604. multi_aff::multi_aff(isl::ctx ctx, const std::string &str)
  11605. {
  11606. auto saved_ctx = ctx;
  11607. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11608. auto res = isl_multi_aff_read_from_str(ctx.release(), str.c_str());
  11609. if (!res)
  11610. exception::throw_last_error(saved_ctx);
  11611. ptr = res;
  11612. }
  11613. multi_aff &multi_aff::operator=(multi_aff obj) {
  11614. std::swap(this->ptr, obj.ptr);
  11615. return *this;
  11616. }
  11617. multi_aff::~multi_aff() {
  11618. if (ptr)
  11619. isl_multi_aff_free(ptr);
  11620. }
  11621. __isl_give isl_multi_aff *multi_aff::copy() const & {
  11622. return isl_multi_aff_copy(ptr);
  11623. }
  11624. __isl_keep isl_multi_aff *multi_aff::get() const {
  11625. return ptr;
  11626. }
  11627. __isl_give isl_multi_aff *multi_aff::release() {
  11628. isl_multi_aff *tmp = ptr;
  11629. ptr = nullptr;
  11630. return tmp;
  11631. }
  11632. bool multi_aff::is_null() const {
  11633. return ptr == nullptr;
  11634. }
  11635. isl::ctx multi_aff::ctx() const {
  11636. return isl::ctx(isl_multi_aff_get_ctx(ptr));
  11637. }
  11638. isl::multi_aff multi_aff::add(isl::multi_aff multi2) const
  11639. {
  11640. if (!ptr || multi2.is_null())
  11641. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11642. auto saved_ctx = ctx();
  11643. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11644. auto res = isl_multi_aff_add(copy(), multi2.release());
  11645. if (!res)
  11646. exception::throw_last_error(saved_ctx);
  11647. return manage(res);
  11648. }
  11649. isl::multi_pw_aff multi_aff::add(const isl::multi_pw_aff &multi2) const
  11650. {
  11651. if (!ptr)
  11652. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11653. return isl::pw_multi_aff(*this).add(multi2);
  11654. }
  11655. isl::multi_union_pw_aff multi_aff::add(const isl::multi_union_pw_aff &multi2) const
  11656. {
  11657. if (!ptr)
  11658. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11659. return isl::pw_multi_aff(*this).add(multi2);
  11660. }
  11661. isl::pw_multi_aff multi_aff::add(const isl::pw_multi_aff &pma2) const
  11662. {
  11663. if (!ptr)
  11664. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11665. return isl::pw_multi_aff(*this).add(pma2);
  11666. }
  11667. isl::union_pw_multi_aff multi_aff::add(const isl::union_pw_multi_aff &upma2) const
  11668. {
  11669. if (!ptr)
  11670. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11671. return isl::pw_multi_aff(*this).add(upma2);
  11672. }
  11673. isl::multi_aff multi_aff::add(const isl::aff &multi2) const
  11674. {
  11675. if (!ptr)
  11676. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11677. return this->add(isl::multi_aff(multi2));
  11678. }
  11679. isl::multi_aff multi_aff::add_constant(isl::multi_val mv) const
  11680. {
  11681. if (!ptr || mv.is_null())
  11682. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11683. auto saved_ctx = ctx();
  11684. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11685. auto res = isl_multi_aff_add_constant_multi_val(copy(), mv.release());
  11686. if (!res)
  11687. exception::throw_last_error(saved_ctx);
  11688. return manage(res);
  11689. }
  11690. isl::multi_aff multi_aff::add_constant(isl::val v) const
  11691. {
  11692. if (!ptr || v.is_null())
  11693. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11694. auto saved_ctx = ctx();
  11695. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11696. auto res = isl_multi_aff_add_constant_val(copy(), v.release());
  11697. if (!res)
  11698. exception::throw_last_error(saved_ctx);
  11699. return manage(res);
  11700. }
  11701. isl::multi_aff multi_aff::add_constant(long v) const
  11702. {
  11703. if (!ptr)
  11704. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11705. return this->add_constant(isl::val(ctx(), v));
  11706. }
  11707. isl::union_pw_multi_aff multi_aff::apply(const isl::union_pw_multi_aff &upma2) const
  11708. {
  11709. if (!ptr)
  11710. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11711. return isl::pw_multi_aff(*this).apply(upma2);
  11712. }
  11713. isl::map multi_aff::as_map() const
  11714. {
  11715. if (!ptr)
  11716. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11717. auto saved_ctx = ctx();
  11718. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11719. auto res = isl_multi_aff_as_map(copy());
  11720. if (!res)
  11721. exception::throw_last_error(saved_ctx);
  11722. return manage(res);
  11723. }
  11724. isl::multi_aff multi_aff::as_multi_aff() const
  11725. {
  11726. if (!ptr)
  11727. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11728. return isl::pw_multi_aff(*this).as_multi_aff();
  11729. }
  11730. isl::multi_union_pw_aff multi_aff::as_multi_union_pw_aff() const
  11731. {
  11732. if (!ptr)
  11733. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11734. return isl::pw_multi_aff(*this).as_multi_union_pw_aff();
  11735. }
  11736. isl::pw_multi_aff multi_aff::as_pw_multi_aff() const
  11737. {
  11738. if (!ptr)
  11739. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11740. return isl::pw_multi_aff(*this).as_pw_multi_aff();
  11741. }
  11742. isl::set multi_aff::as_set() const
  11743. {
  11744. if (!ptr)
  11745. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11746. auto saved_ctx = ctx();
  11747. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11748. auto res = isl_multi_aff_as_set(copy());
  11749. if (!res)
  11750. exception::throw_last_error(saved_ctx);
  11751. return manage(res);
  11752. }
  11753. isl::union_map multi_aff::as_union_map() const
  11754. {
  11755. if (!ptr)
  11756. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11757. return isl::pw_multi_aff(*this).as_union_map();
  11758. }
  11759. isl::aff multi_aff::at(int pos) const
  11760. {
  11761. if (!ptr)
  11762. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11763. auto saved_ctx = ctx();
  11764. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11765. auto res = isl_multi_aff_get_at(get(), pos);
  11766. if (!res)
  11767. exception::throw_last_error(saved_ctx);
  11768. return manage(res);
  11769. }
  11770. isl::aff multi_aff::get_at(int pos) const
  11771. {
  11772. return at(pos);
  11773. }
  11774. isl::basic_set multi_aff::bind(isl::multi_id tuple) const
  11775. {
  11776. if (!ptr || tuple.is_null())
  11777. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11778. auto saved_ctx = ctx();
  11779. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11780. auto res = isl_multi_aff_bind(copy(), tuple.release());
  11781. if (!res)
  11782. exception::throw_last_error(saved_ctx);
  11783. return manage(res);
  11784. }
  11785. isl::multi_aff multi_aff::bind_domain(isl::multi_id tuple) const
  11786. {
  11787. if (!ptr || tuple.is_null())
  11788. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11789. auto saved_ctx = ctx();
  11790. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11791. auto res = isl_multi_aff_bind_domain(copy(), tuple.release());
  11792. if (!res)
  11793. exception::throw_last_error(saved_ctx);
  11794. return manage(res);
  11795. }
  11796. isl::multi_aff multi_aff::bind_domain_wrapped_domain(isl::multi_id tuple) const
  11797. {
  11798. if (!ptr || tuple.is_null())
  11799. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11800. auto saved_ctx = ctx();
  11801. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11802. auto res = isl_multi_aff_bind_domain_wrapped_domain(copy(), tuple.release());
  11803. if (!res)
  11804. exception::throw_last_error(saved_ctx);
  11805. return manage(res);
  11806. }
  11807. isl::pw_multi_aff multi_aff::coalesce() const
  11808. {
  11809. if (!ptr)
  11810. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11811. return isl::pw_multi_aff(*this).coalesce();
  11812. }
  11813. isl::multi_val multi_aff::constant_multi_val() const
  11814. {
  11815. if (!ptr)
  11816. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11817. auto saved_ctx = ctx();
  11818. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11819. auto res = isl_multi_aff_get_constant_multi_val(get());
  11820. if (!res)
  11821. exception::throw_last_error(saved_ctx);
  11822. return manage(res);
  11823. }
  11824. isl::multi_val multi_aff::get_constant_multi_val() const
  11825. {
  11826. return constant_multi_val();
  11827. }
  11828. isl::set multi_aff::domain() const
  11829. {
  11830. if (!ptr)
  11831. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11832. return isl::pw_multi_aff(*this).domain();
  11833. }
  11834. isl::multi_aff multi_aff::domain_map(isl::space space)
  11835. {
  11836. if (space.is_null())
  11837. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11838. auto saved_ctx = space.ctx();
  11839. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11840. auto res = isl_multi_aff_domain_map(space.release());
  11841. if (!res)
  11842. exception::throw_last_error(saved_ctx);
  11843. return manage(res);
  11844. }
  11845. isl::pw_multi_aff multi_aff::extract_pw_multi_aff(const isl::space &space) const
  11846. {
  11847. if (!ptr)
  11848. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11849. return isl::pw_multi_aff(*this).extract_pw_multi_aff(space);
  11850. }
  11851. isl::multi_aff multi_aff::flat_range_product(isl::multi_aff multi2) const
  11852. {
  11853. if (!ptr || multi2.is_null())
  11854. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11855. auto saved_ctx = ctx();
  11856. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11857. auto res = isl_multi_aff_flat_range_product(copy(), multi2.release());
  11858. if (!res)
  11859. exception::throw_last_error(saved_ctx);
  11860. return manage(res);
  11861. }
  11862. isl::multi_pw_aff multi_aff::flat_range_product(const isl::multi_pw_aff &multi2) const
  11863. {
  11864. if (!ptr)
  11865. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11866. return isl::pw_multi_aff(*this).flat_range_product(multi2);
  11867. }
  11868. isl::multi_union_pw_aff multi_aff::flat_range_product(const isl::multi_union_pw_aff &multi2) const
  11869. {
  11870. if (!ptr)
  11871. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11872. return isl::pw_multi_aff(*this).flat_range_product(multi2);
  11873. }
  11874. isl::pw_multi_aff multi_aff::flat_range_product(const isl::pw_multi_aff &pma2) const
  11875. {
  11876. if (!ptr)
  11877. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11878. return isl::pw_multi_aff(*this).flat_range_product(pma2);
  11879. }
  11880. isl::union_pw_multi_aff multi_aff::flat_range_product(const isl::union_pw_multi_aff &upma2) const
  11881. {
  11882. if (!ptr)
  11883. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11884. return isl::pw_multi_aff(*this).flat_range_product(upma2);
  11885. }
  11886. isl::multi_aff multi_aff::flat_range_product(const isl::aff &multi2) const
  11887. {
  11888. if (!ptr)
  11889. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11890. return this->flat_range_product(isl::multi_aff(multi2));
  11891. }
  11892. isl::multi_aff multi_aff::floor() const
  11893. {
  11894. if (!ptr)
  11895. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11896. auto saved_ctx = ctx();
  11897. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11898. auto res = isl_multi_aff_floor(copy());
  11899. if (!res)
  11900. exception::throw_last_error(saved_ctx);
  11901. return manage(res);
  11902. }
  11903. void multi_aff::foreach_piece(const std::function<void(isl::set, isl::multi_aff)> &fn) const
  11904. {
  11905. if (!ptr)
  11906. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11907. return isl::pw_multi_aff(*this).foreach_piece(fn);
  11908. }
  11909. isl::multi_aff multi_aff::gist(isl::set context) const
  11910. {
  11911. if (!ptr || context.is_null())
  11912. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11913. auto saved_ctx = ctx();
  11914. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11915. auto res = isl_multi_aff_gist(copy(), context.release());
  11916. if (!res)
  11917. exception::throw_last_error(saved_ctx);
  11918. return manage(res);
  11919. }
  11920. isl::union_pw_multi_aff multi_aff::gist(const isl::union_set &context) const
  11921. {
  11922. if (!ptr)
  11923. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11924. return isl::pw_multi_aff(*this).gist(context);
  11925. }
  11926. isl::multi_aff multi_aff::gist(const isl::basic_set &context) const
  11927. {
  11928. if (!ptr)
  11929. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11930. return this->gist(isl::set(context));
  11931. }
  11932. isl::multi_aff multi_aff::gist(const isl::point &context) const
  11933. {
  11934. if (!ptr)
  11935. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11936. return this->gist(isl::set(context));
  11937. }
  11938. isl::multi_aff multi_aff::gist_params(isl::set context) const
  11939. {
  11940. if (!ptr || context.is_null())
  11941. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11942. auto saved_ctx = ctx();
  11943. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11944. auto res = isl_multi_aff_gist_params(copy(), context.release());
  11945. if (!res)
  11946. exception::throw_last_error(saved_ctx);
  11947. return manage(res);
  11948. }
  11949. bool multi_aff::has_range_tuple_id() const
  11950. {
  11951. if (!ptr)
  11952. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11953. auto saved_ctx = ctx();
  11954. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11955. auto res = isl_multi_aff_has_range_tuple_id(get());
  11956. if (res < 0)
  11957. exception::throw_last_error(saved_ctx);
  11958. return res;
  11959. }
  11960. isl::multi_aff multi_aff::identity() const
  11961. {
  11962. if (!ptr)
  11963. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11964. auto saved_ctx = ctx();
  11965. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11966. auto res = isl_multi_aff_identity_multi_aff(copy());
  11967. if (!res)
  11968. exception::throw_last_error(saved_ctx);
  11969. return manage(res);
  11970. }
  11971. isl::multi_aff multi_aff::identity_on_domain(isl::space space)
  11972. {
  11973. if (space.is_null())
  11974. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11975. auto saved_ctx = space.ctx();
  11976. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11977. auto res = isl_multi_aff_identity_on_domain_space(space.release());
  11978. if (!res)
  11979. exception::throw_last_error(saved_ctx);
  11980. return manage(res);
  11981. }
  11982. isl::multi_aff multi_aff::insert_domain(isl::space domain) const
  11983. {
  11984. if (!ptr || domain.is_null())
  11985. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11986. auto saved_ctx = ctx();
  11987. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  11988. auto res = isl_multi_aff_insert_domain(copy(), domain.release());
  11989. if (!res)
  11990. exception::throw_last_error(saved_ctx);
  11991. return manage(res);
  11992. }
  11993. isl::pw_multi_aff multi_aff::intersect_domain(const isl::set &set) const
  11994. {
  11995. if (!ptr)
  11996. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  11997. return isl::pw_multi_aff(*this).intersect_domain(set);
  11998. }
  11999. isl::union_pw_multi_aff multi_aff::intersect_domain(const isl::space &space) const
  12000. {
  12001. if (!ptr)
  12002. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12003. return isl::pw_multi_aff(*this).intersect_domain(space);
  12004. }
  12005. isl::union_pw_multi_aff multi_aff::intersect_domain(const isl::union_set &uset) const
  12006. {
  12007. if (!ptr)
  12008. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12009. return isl::pw_multi_aff(*this).intersect_domain(uset);
  12010. }
  12011. isl::union_pw_multi_aff multi_aff::intersect_domain_wrapped_domain(const isl::union_set &uset) const
  12012. {
  12013. if (!ptr)
  12014. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12015. return isl::pw_multi_aff(*this).intersect_domain_wrapped_domain(uset);
  12016. }
  12017. isl::union_pw_multi_aff multi_aff::intersect_domain_wrapped_range(const isl::union_set &uset) const
  12018. {
  12019. if (!ptr)
  12020. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12021. return isl::pw_multi_aff(*this).intersect_domain_wrapped_range(uset);
  12022. }
  12023. isl::pw_multi_aff multi_aff::intersect_params(const isl::set &set) const
  12024. {
  12025. if (!ptr)
  12026. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12027. return isl::pw_multi_aff(*this).intersect_params(set);
  12028. }
  12029. bool multi_aff::involves_locals() const
  12030. {
  12031. if (!ptr)
  12032. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12033. auto saved_ctx = ctx();
  12034. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12035. auto res = isl_multi_aff_involves_locals(get());
  12036. if (res < 0)
  12037. exception::throw_last_error(saved_ctx);
  12038. return res;
  12039. }
  12040. bool multi_aff::involves_nan() const
  12041. {
  12042. if (!ptr)
  12043. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12044. auto saved_ctx = ctx();
  12045. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12046. auto res = isl_multi_aff_involves_nan(get());
  12047. if (res < 0)
  12048. exception::throw_last_error(saved_ctx);
  12049. return res;
  12050. }
  12051. bool multi_aff::involves_param(const isl::id &id) const
  12052. {
  12053. if (!ptr)
  12054. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12055. return isl::pw_multi_aff(*this).involves_param(id);
  12056. }
  12057. bool multi_aff::involves_param(const std::string &id) const
  12058. {
  12059. if (!ptr)
  12060. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12061. return this->involves_param(isl::id(ctx(), id));
  12062. }
  12063. bool multi_aff::involves_param(const isl::id_list &list) const
  12064. {
  12065. if (!ptr)
  12066. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12067. return isl::pw_multi_aff(*this).involves_param(list);
  12068. }
  12069. bool multi_aff::isa_multi_aff() const
  12070. {
  12071. if (!ptr)
  12072. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12073. return isl::pw_multi_aff(*this).isa_multi_aff();
  12074. }
  12075. bool multi_aff::isa_pw_multi_aff() const
  12076. {
  12077. if (!ptr)
  12078. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12079. return isl::pw_multi_aff(*this).isa_pw_multi_aff();
  12080. }
  12081. isl::aff_list multi_aff::list() const
  12082. {
  12083. if (!ptr)
  12084. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12085. auto saved_ctx = ctx();
  12086. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12087. auto res = isl_multi_aff_get_list(get());
  12088. if (!res)
  12089. exception::throw_last_error(saved_ctx);
  12090. return manage(res);
  12091. }
  12092. isl::aff_list multi_aff::get_list() const
  12093. {
  12094. return list();
  12095. }
  12096. isl::multi_pw_aff multi_aff::max(const isl::multi_pw_aff &multi2) const
  12097. {
  12098. if (!ptr)
  12099. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12100. return isl::pw_multi_aff(*this).max(multi2);
  12101. }
  12102. isl::multi_val multi_aff::max_multi_val() const
  12103. {
  12104. if (!ptr)
  12105. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12106. return isl::pw_multi_aff(*this).max_multi_val();
  12107. }
  12108. isl::multi_pw_aff multi_aff::min(const isl::multi_pw_aff &multi2) const
  12109. {
  12110. if (!ptr)
  12111. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12112. return isl::pw_multi_aff(*this).min(multi2);
  12113. }
  12114. isl::multi_val multi_aff::min_multi_val() const
  12115. {
  12116. if (!ptr)
  12117. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12118. return isl::pw_multi_aff(*this).min_multi_val();
  12119. }
  12120. isl::multi_aff multi_aff::multi_val_on_domain(isl::space space, isl::multi_val mv)
  12121. {
  12122. if (space.is_null() || mv.is_null())
  12123. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12124. auto saved_ctx = space.ctx();
  12125. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12126. auto res = isl_multi_aff_multi_val_on_domain_space(space.release(), mv.release());
  12127. if (!res)
  12128. exception::throw_last_error(saved_ctx);
  12129. return manage(res);
  12130. }
  12131. unsigned multi_aff::n_piece() const
  12132. {
  12133. if (!ptr)
  12134. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12135. return isl::pw_multi_aff(*this).n_piece();
  12136. }
  12137. isl::multi_aff multi_aff::neg() const
  12138. {
  12139. if (!ptr)
  12140. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12141. auto saved_ctx = ctx();
  12142. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12143. auto res = isl_multi_aff_neg(copy());
  12144. if (!res)
  12145. exception::throw_last_error(saved_ctx);
  12146. return manage(res);
  12147. }
  12148. bool multi_aff::plain_is_empty() const
  12149. {
  12150. if (!ptr)
  12151. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12152. return isl::pw_multi_aff(*this).plain_is_empty();
  12153. }
  12154. bool multi_aff::plain_is_equal(const isl::multi_aff &multi2) const
  12155. {
  12156. if (!ptr || multi2.is_null())
  12157. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12158. auto saved_ctx = ctx();
  12159. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12160. auto res = isl_multi_aff_plain_is_equal(get(), multi2.get());
  12161. if (res < 0)
  12162. exception::throw_last_error(saved_ctx);
  12163. return res;
  12164. }
  12165. bool multi_aff::plain_is_equal(const isl::multi_pw_aff &multi2) const
  12166. {
  12167. if (!ptr)
  12168. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12169. return isl::pw_multi_aff(*this).plain_is_equal(multi2);
  12170. }
  12171. bool multi_aff::plain_is_equal(const isl::multi_union_pw_aff &multi2) const
  12172. {
  12173. if (!ptr)
  12174. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12175. return isl::pw_multi_aff(*this).plain_is_equal(multi2);
  12176. }
  12177. bool multi_aff::plain_is_equal(const isl::aff &multi2) const
  12178. {
  12179. if (!ptr)
  12180. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12181. return this->plain_is_equal(isl::multi_aff(multi2));
  12182. }
  12183. isl::pw_multi_aff multi_aff::preimage_domain_wrapped_domain(const isl::pw_multi_aff &pma2) const
  12184. {
  12185. if (!ptr)
  12186. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12187. return isl::pw_multi_aff(*this).preimage_domain_wrapped_domain(pma2);
  12188. }
  12189. isl::union_pw_multi_aff multi_aff::preimage_domain_wrapped_domain(const isl::union_pw_multi_aff &upma2) const
  12190. {
  12191. if (!ptr)
  12192. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12193. return isl::pw_multi_aff(*this).preimage_domain_wrapped_domain(upma2);
  12194. }
  12195. isl::multi_aff multi_aff::product(isl::multi_aff multi2) const
  12196. {
  12197. if (!ptr || multi2.is_null())
  12198. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12199. auto saved_ctx = ctx();
  12200. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12201. auto res = isl_multi_aff_product(copy(), multi2.release());
  12202. if (!res)
  12203. exception::throw_last_error(saved_ctx);
  12204. return manage(res);
  12205. }
  12206. isl::multi_pw_aff multi_aff::product(const isl::multi_pw_aff &multi2) const
  12207. {
  12208. if (!ptr)
  12209. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12210. return isl::pw_multi_aff(*this).product(multi2);
  12211. }
  12212. isl::pw_multi_aff multi_aff::product(const isl::pw_multi_aff &pma2) const
  12213. {
  12214. if (!ptr)
  12215. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12216. return isl::pw_multi_aff(*this).product(pma2);
  12217. }
  12218. isl::multi_aff multi_aff::product(const isl::aff &multi2) const
  12219. {
  12220. if (!ptr)
  12221. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12222. return this->product(isl::multi_aff(multi2));
  12223. }
  12224. isl::multi_aff multi_aff::pullback(isl::multi_aff ma2) const
  12225. {
  12226. if (!ptr || ma2.is_null())
  12227. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12228. auto saved_ctx = ctx();
  12229. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12230. auto res = isl_multi_aff_pullback_multi_aff(copy(), ma2.release());
  12231. if (!res)
  12232. exception::throw_last_error(saved_ctx);
  12233. return manage(res);
  12234. }
  12235. isl::multi_pw_aff multi_aff::pullback(const isl::multi_pw_aff &mpa2) const
  12236. {
  12237. if (!ptr)
  12238. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12239. return isl::pw_multi_aff(*this).pullback(mpa2);
  12240. }
  12241. isl::pw_multi_aff multi_aff::pullback(const isl::pw_multi_aff &pma2) const
  12242. {
  12243. if (!ptr)
  12244. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12245. return isl::pw_multi_aff(*this).pullback(pma2);
  12246. }
  12247. isl::union_pw_multi_aff multi_aff::pullback(const isl::union_pw_multi_aff &upma2) const
  12248. {
  12249. if (!ptr)
  12250. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12251. return isl::pw_multi_aff(*this).pullback(upma2);
  12252. }
  12253. isl::multi_aff multi_aff::pullback(const isl::aff &ma2) const
  12254. {
  12255. if (!ptr)
  12256. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12257. return this->pullback(isl::multi_aff(ma2));
  12258. }
  12259. isl::pw_multi_aff_list multi_aff::pw_multi_aff_list() const
  12260. {
  12261. if (!ptr)
  12262. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12263. return isl::pw_multi_aff(*this).pw_multi_aff_list();
  12264. }
  12265. isl::pw_multi_aff multi_aff::range_factor_domain() const
  12266. {
  12267. if (!ptr)
  12268. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12269. return isl::pw_multi_aff(*this).range_factor_domain();
  12270. }
  12271. isl::pw_multi_aff multi_aff::range_factor_range() const
  12272. {
  12273. if (!ptr)
  12274. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12275. return isl::pw_multi_aff(*this).range_factor_range();
  12276. }
  12277. isl::multi_aff multi_aff::range_map(isl::space space)
  12278. {
  12279. if (space.is_null())
  12280. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12281. auto saved_ctx = space.ctx();
  12282. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12283. auto res = isl_multi_aff_range_map(space.release());
  12284. if (!res)
  12285. exception::throw_last_error(saved_ctx);
  12286. return manage(res);
  12287. }
  12288. isl::multi_aff multi_aff::range_product(isl::multi_aff multi2) const
  12289. {
  12290. if (!ptr || multi2.is_null())
  12291. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12292. auto saved_ctx = ctx();
  12293. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12294. auto res = isl_multi_aff_range_product(copy(), multi2.release());
  12295. if (!res)
  12296. exception::throw_last_error(saved_ctx);
  12297. return manage(res);
  12298. }
  12299. isl::multi_pw_aff multi_aff::range_product(const isl::multi_pw_aff &multi2) const
  12300. {
  12301. if (!ptr)
  12302. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12303. return isl::pw_multi_aff(*this).range_product(multi2);
  12304. }
  12305. isl::multi_union_pw_aff multi_aff::range_product(const isl::multi_union_pw_aff &multi2) const
  12306. {
  12307. if (!ptr)
  12308. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12309. return isl::pw_multi_aff(*this).range_product(multi2);
  12310. }
  12311. isl::pw_multi_aff multi_aff::range_product(const isl::pw_multi_aff &pma2) const
  12312. {
  12313. if (!ptr)
  12314. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12315. return isl::pw_multi_aff(*this).range_product(pma2);
  12316. }
  12317. isl::union_pw_multi_aff multi_aff::range_product(const isl::union_pw_multi_aff &upma2) const
  12318. {
  12319. if (!ptr)
  12320. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12321. return isl::pw_multi_aff(*this).range_product(upma2);
  12322. }
  12323. isl::multi_aff multi_aff::range_product(const isl::aff &multi2) const
  12324. {
  12325. if (!ptr)
  12326. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12327. return this->range_product(isl::multi_aff(multi2));
  12328. }
  12329. isl::id multi_aff::range_tuple_id() const
  12330. {
  12331. if (!ptr)
  12332. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12333. auto saved_ctx = ctx();
  12334. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12335. auto res = isl_multi_aff_get_range_tuple_id(get());
  12336. if (!res)
  12337. exception::throw_last_error(saved_ctx);
  12338. return manage(res);
  12339. }
  12340. isl::id multi_aff::get_range_tuple_id() const
  12341. {
  12342. return range_tuple_id();
  12343. }
  12344. isl::multi_aff multi_aff::reset_range_tuple_id() const
  12345. {
  12346. if (!ptr)
  12347. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12348. auto saved_ctx = ctx();
  12349. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12350. auto res = isl_multi_aff_reset_range_tuple_id(copy());
  12351. if (!res)
  12352. exception::throw_last_error(saved_ctx);
  12353. return manage(res);
  12354. }
  12355. isl::multi_aff multi_aff::scale(isl::multi_val mv) const
  12356. {
  12357. if (!ptr || mv.is_null())
  12358. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12359. auto saved_ctx = ctx();
  12360. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12361. auto res = isl_multi_aff_scale_multi_val(copy(), mv.release());
  12362. if (!res)
  12363. exception::throw_last_error(saved_ctx);
  12364. return manage(res);
  12365. }
  12366. isl::multi_aff multi_aff::scale(isl::val v) const
  12367. {
  12368. if (!ptr || v.is_null())
  12369. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12370. auto saved_ctx = ctx();
  12371. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12372. auto res = isl_multi_aff_scale_val(copy(), v.release());
  12373. if (!res)
  12374. exception::throw_last_error(saved_ctx);
  12375. return manage(res);
  12376. }
  12377. isl::multi_aff multi_aff::scale(long v) const
  12378. {
  12379. if (!ptr)
  12380. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12381. return this->scale(isl::val(ctx(), v));
  12382. }
  12383. isl::multi_aff multi_aff::scale_down(isl::multi_val mv) const
  12384. {
  12385. if (!ptr || mv.is_null())
  12386. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12387. auto saved_ctx = ctx();
  12388. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12389. auto res = isl_multi_aff_scale_down_multi_val(copy(), mv.release());
  12390. if (!res)
  12391. exception::throw_last_error(saved_ctx);
  12392. return manage(res);
  12393. }
  12394. isl::multi_aff multi_aff::scale_down(isl::val v) const
  12395. {
  12396. if (!ptr || v.is_null())
  12397. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12398. auto saved_ctx = ctx();
  12399. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12400. auto res = isl_multi_aff_scale_down_val(copy(), v.release());
  12401. if (!res)
  12402. exception::throw_last_error(saved_ctx);
  12403. return manage(res);
  12404. }
  12405. isl::multi_aff multi_aff::scale_down(long v) const
  12406. {
  12407. if (!ptr)
  12408. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12409. return this->scale_down(isl::val(ctx(), v));
  12410. }
  12411. isl::multi_aff multi_aff::set_at(int pos, isl::aff el) const
  12412. {
  12413. if (!ptr || el.is_null())
  12414. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12415. auto saved_ctx = ctx();
  12416. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12417. auto res = isl_multi_aff_set_at(copy(), pos, el.release());
  12418. if (!res)
  12419. exception::throw_last_error(saved_ctx);
  12420. return manage(res);
  12421. }
  12422. isl::multi_pw_aff multi_aff::set_at(int pos, const isl::pw_aff &el) const
  12423. {
  12424. if (!ptr)
  12425. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12426. return isl::pw_multi_aff(*this).set_at(pos, el);
  12427. }
  12428. isl::multi_union_pw_aff multi_aff::set_at(int pos, const isl::union_pw_aff &el) const
  12429. {
  12430. if (!ptr)
  12431. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12432. return isl::pw_multi_aff(*this).set_at(pos, el);
  12433. }
  12434. isl::multi_aff multi_aff::set_range_tuple(isl::id id) const
  12435. {
  12436. if (!ptr || id.is_null())
  12437. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12438. auto saved_ctx = ctx();
  12439. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12440. auto res = isl_multi_aff_set_range_tuple_id(copy(), id.release());
  12441. if (!res)
  12442. exception::throw_last_error(saved_ctx);
  12443. return manage(res);
  12444. }
  12445. isl::multi_aff multi_aff::set_range_tuple(const std::string &id) const
  12446. {
  12447. if (!ptr)
  12448. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12449. return this->set_range_tuple(isl::id(ctx(), id));
  12450. }
  12451. unsigned multi_aff::size() const
  12452. {
  12453. if (!ptr)
  12454. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12455. auto saved_ctx = ctx();
  12456. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12457. auto res = isl_multi_aff_size(get());
  12458. if (res < 0)
  12459. exception::throw_last_error(saved_ctx);
  12460. return res;
  12461. }
  12462. isl::space multi_aff::space() const
  12463. {
  12464. if (!ptr)
  12465. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12466. auto saved_ctx = ctx();
  12467. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12468. auto res = isl_multi_aff_get_space(get());
  12469. if (!res)
  12470. exception::throw_last_error(saved_ctx);
  12471. return manage(res);
  12472. }
  12473. isl::space multi_aff::get_space() const
  12474. {
  12475. return space();
  12476. }
  12477. isl::multi_aff multi_aff::sub(isl::multi_aff multi2) const
  12478. {
  12479. if (!ptr || multi2.is_null())
  12480. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12481. auto saved_ctx = ctx();
  12482. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12483. auto res = isl_multi_aff_sub(copy(), multi2.release());
  12484. if (!res)
  12485. exception::throw_last_error(saved_ctx);
  12486. return manage(res);
  12487. }
  12488. isl::multi_pw_aff multi_aff::sub(const isl::multi_pw_aff &multi2) const
  12489. {
  12490. if (!ptr)
  12491. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12492. return isl::pw_multi_aff(*this).sub(multi2);
  12493. }
  12494. isl::multi_union_pw_aff multi_aff::sub(const isl::multi_union_pw_aff &multi2) const
  12495. {
  12496. if (!ptr)
  12497. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12498. return isl::pw_multi_aff(*this).sub(multi2);
  12499. }
  12500. isl::pw_multi_aff multi_aff::sub(const isl::pw_multi_aff &pma2) const
  12501. {
  12502. if (!ptr)
  12503. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12504. return isl::pw_multi_aff(*this).sub(pma2);
  12505. }
  12506. isl::union_pw_multi_aff multi_aff::sub(const isl::union_pw_multi_aff &upma2) const
  12507. {
  12508. if (!ptr)
  12509. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12510. return isl::pw_multi_aff(*this).sub(upma2);
  12511. }
  12512. isl::multi_aff multi_aff::sub(const isl::aff &multi2) const
  12513. {
  12514. if (!ptr)
  12515. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12516. return this->sub(isl::multi_aff(multi2));
  12517. }
  12518. isl::pw_multi_aff multi_aff::subtract_domain(const isl::set &set) const
  12519. {
  12520. if (!ptr)
  12521. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12522. return isl::pw_multi_aff(*this).subtract_domain(set);
  12523. }
  12524. isl::union_pw_multi_aff multi_aff::subtract_domain(const isl::space &space) const
  12525. {
  12526. if (!ptr)
  12527. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12528. return isl::pw_multi_aff(*this).subtract_domain(space);
  12529. }
  12530. isl::union_pw_multi_aff multi_aff::subtract_domain(const isl::union_set &uset) const
  12531. {
  12532. if (!ptr)
  12533. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12534. return isl::pw_multi_aff(*this).subtract_domain(uset);
  12535. }
  12536. isl::pw_multi_aff_list multi_aff::to_list() const
  12537. {
  12538. if (!ptr)
  12539. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12540. return isl::pw_multi_aff(*this).to_list();
  12541. }
  12542. isl::multi_pw_aff multi_aff::to_multi_pw_aff() const
  12543. {
  12544. if (!ptr)
  12545. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12546. auto saved_ctx = ctx();
  12547. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12548. auto res = isl_multi_aff_to_multi_pw_aff(copy());
  12549. if (!res)
  12550. exception::throw_last_error(saved_ctx);
  12551. return manage(res);
  12552. }
  12553. isl::multi_union_pw_aff multi_aff::to_multi_union_pw_aff() const
  12554. {
  12555. if (!ptr)
  12556. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12557. auto saved_ctx = ctx();
  12558. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12559. auto res = isl_multi_aff_to_multi_union_pw_aff(copy());
  12560. if (!res)
  12561. exception::throw_last_error(saved_ctx);
  12562. return manage(res);
  12563. }
  12564. isl::pw_multi_aff multi_aff::to_pw_multi_aff() const
  12565. {
  12566. if (!ptr)
  12567. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12568. auto saved_ctx = ctx();
  12569. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12570. auto res = isl_multi_aff_to_pw_multi_aff(copy());
  12571. if (!res)
  12572. exception::throw_last_error(saved_ctx);
  12573. return manage(res);
  12574. }
  12575. isl::union_pw_multi_aff multi_aff::to_union_pw_multi_aff() const
  12576. {
  12577. if (!ptr)
  12578. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12579. return isl::pw_multi_aff(*this).to_union_pw_multi_aff();
  12580. }
  12581. isl::multi_aff multi_aff::unbind_params_insert_domain(isl::multi_id domain) const
  12582. {
  12583. if (!ptr || domain.is_null())
  12584. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12585. auto saved_ctx = ctx();
  12586. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12587. auto res = isl_multi_aff_unbind_params_insert_domain(copy(), domain.release());
  12588. if (!res)
  12589. exception::throw_last_error(saved_ctx);
  12590. return manage(res);
  12591. }
  12592. isl::multi_pw_aff multi_aff::union_add(const isl::multi_pw_aff &mpa2) const
  12593. {
  12594. if (!ptr)
  12595. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12596. return isl::pw_multi_aff(*this).union_add(mpa2);
  12597. }
  12598. isl::multi_union_pw_aff multi_aff::union_add(const isl::multi_union_pw_aff &mupa2) const
  12599. {
  12600. if (!ptr)
  12601. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12602. return isl::pw_multi_aff(*this).union_add(mupa2);
  12603. }
  12604. isl::pw_multi_aff multi_aff::union_add(const isl::pw_multi_aff &pma2) const
  12605. {
  12606. if (!ptr)
  12607. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12608. return isl::pw_multi_aff(*this).union_add(pma2);
  12609. }
  12610. isl::union_pw_multi_aff multi_aff::union_add(const isl::union_pw_multi_aff &upma2) const
  12611. {
  12612. if (!ptr)
  12613. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12614. return isl::pw_multi_aff(*this).union_add(upma2);
  12615. }
  12616. isl::multi_aff multi_aff::zero(isl::space space)
  12617. {
  12618. if (space.is_null())
  12619. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12620. auto saved_ctx = space.ctx();
  12621. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12622. auto res = isl_multi_aff_zero(space.release());
  12623. if (!res)
  12624. exception::throw_last_error(saved_ctx);
  12625. return manage(res);
  12626. }
  12627. inline std::ostream &operator<<(std::ostream &os, const multi_aff &obj)
  12628. {
  12629. if (!obj.get())
  12630. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12631. auto saved_ctx = isl_multi_aff_get_ctx(obj.get());
  12632. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12633. char *str = isl_multi_aff_to_str(obj.get());
  12634. if (!str)
  12635. exception::throw_last_error(saved_ctx);
  12636. os << str;
  12637. free(str);
  12638. return os;
  12639. }
  12640. // implementations for isl::multi_id
  12641. multi_id manage(__isl_take isl_multi_id *ptr) {
  12642. if (!ptr)
  12643. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12644. return multi_id(ptr);
  12645. }
  12646. multi_id manage_copy(__isl_keep isl_multi_id *ptr) {
  12647. if (!ptr)
  12648. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12649. auto saved_ctx = isl_multi_id_get_ctx(ptr);
  12650. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12651. ptr = isl_multi_id_copy(ptr);
  12652. if (!ptr)
  12653. exception::throw_last_error(saved_ctx);
  12654. return multi_id(ptr);
  12655. }
  12656. multi_id::multi_id(__isl_take isl_multi_id *ptr)
  12657. : ptr(ptr) {}
  12658. multi_id::multi_id()
  12659. : ptr(nullptr) {}
  12660. multi_id::multi_id(const multi_id &obj)
  12661. : ptr(nullptr)
  12662. {
  12663. if (!obj.ptr)
  12664. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12665. auto saved_ctx = isl_multi_id_get_ctx(obj.ptr);
  12666. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12667. ptr = obj.copy();
  12668. if (!ptr)
  12669. exception::throw_last_error(saved_ctx);
  12670. }
  12671. multi_id::multi_id(isl::space space, isl::id_list list)
  12672. {
  12673. if (space.is_null() || list.is_null())
  12674. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12675. auto saved_ctx = space.ctx();
  12676. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12677. auto res = isl_multi_id_from_id_list(space.release(), list.release());
  12678. if (!res)
  12679. exception::throw_last_error(saved_ctx);
  12680. ptr = res;
  12681. }
  12682. multi_id::multi_id(isl::ctx ctx, const std::string &str)
  12683. {
  12684. auto saved_ctx = ctx;
  12685. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12686. auto res = isl_multi_id_read_from_str(ctx.release(), str.c_str());
  12687. if (!res)
  12688. exception::throw_last_error(saved_ctx);
  12689. ptr = res;
  12690. }
  12691. multi_id &multi_id::operator=(multi_id obj) {
  12692. std::swap(this->ptr, obj.ptr);
  12693. return *this;
  12694. }
  12695. multi_id::~multi_id() {
  12696. if (ptr)
  12697. isl_multi_id_free(ptr);
  12698. }
  12699. __isl_give isl_multi_id *multi_id::copy() const & {
  12700. return isl_multi_id_copy(ptr);
  12701. }
  12702. __isl_keep isl_multi_id *multi_id::get() const {
  12703. return ptr;
  12704. }
  12705. __isl_give isl_multi_id *multi_id::release() {
  12706. isl_multi_id *tmp = ptr;
  12707. ptr = nullptr;
  12708. return tmp;
  12709. }
  12710. bool multi_id::is_null() const {
  12711. return ptr == nullptr;
  12712. }
  12713. isl::ctx multi_id::ctx() const {
  12714. return isl::ctx(isl_multi_id_get_ctx(ptr));
  12715. }
  12716. isl::id multi_id::at(int pos) const
  12717. {
  12718. if (!ptr)
  12719. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12720. auto saved_ctx = ctx();
  12721. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12722. auto res = isl_multi_id_get_at(get(), pos);
  12723. if (!res)
  12724. exception::throw_last_error(saved_ctx);
  12725. return manage(res);
  12726. }
  12727. isl::id multi_id::get_at(int pos) const
  12728. {
  12729. return at(pos);
  12730. }
  12731. isl::multi_id multi_id::flat_range_product(isl::multi_id multi2) const
  12732. {
  12733. if (!ptr || multi2.is_null())
  12734. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12735. auto saved_ctx = ctx();
  12736. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12737. auto res = isl_multi_id_flat_range_product(copy(), multi2.release());
  12738. if (!res)
  12739. exception::throw_last_error(saved_ctx);
  12740. return manage(res);
  12741. }
  12742. isl::id_list multi_id::list() const
  12743. {
  12744. if (!ptr)
  12745. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12746. auto saved_ctx = ctx();
  12747. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12748. auto res = isl_multi_id_get_list(get());
  12749. if (!res)
  12750. exception::throw_last_error(saved_ctx);
  12751. return manage(res);
  12752. }
  12753. isl::id_list multi_id::get_list() const
  12754. {
  12755. return list();
  12756. }
  12757. bool multi_id::plain_is_equal(const isl::multi_id &multi2) const
  12758. {
  12759. if (!ptr || multi2.is_null())
  12760. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12761. auto saved_ctx = ctx();
  12762. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12763. auto res = isl_multi_id_plain_is_equal(get(), multi2.get());
  12764. if (res < 0)
  12765. exception::throw_last_error(saved_ctx);
  12766. return res;
  12767. }
  12768. isl::multi_id multi_id::range_product(isl::multi_id multi2) const
  12769. {
  12770. if (!ptr || multi2.is_null())
  12771. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12772. auto saved_ctx = ctx();
  12773. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12774. auto res = isl_multi_id_range_product(copy(), multi2.release());
  12775. if (!res)
  12776. exception::throw_last_error(saved_ctx);
  12777. return manage(res);
  12778. }
  12779. isl::multi_id multi_id::set_at(int pos, isl::id el) const
  12780. {
  12781. if (!ptr || el.is_null())
  12782. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12783. auto saved_ctx = ctx();
  12784. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12785. auto res = isl_multi_id_set_at(copy(), pos, el.release());
  12786. if (!res)
  12787. exception::throw_last_error(saved_ctx);
  12788. return manage(res);
  12789. }
  12790. isl::multi_id multi_id::set_at(int pos, const std::string &el) const
  12791. {
  12792. if (!ptr)
  12793. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12794. return this->set_at(pos, isl::id(ctx(), el));
  12795. }
  12796. unsigned multi_id::size() const
  12797. {
  12798. if (!ptr)
  12799. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12800. auto saved_ctx = ctx();
  12801. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12802. auto res = isl_multi_id_size(get());
  12803. if (res < 0)
  12804. exception::throw_last_error(saved_ctx);
  12805. return res;
  12806. }
  12807. isl::space multi_id::space() const
  12808. {
  12809. if (!ptr)
  12810. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12811. auto saved_ctx = ctx();
  12812. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12813. auto res = isl_multi_id_get_space(get());
  12814. if (!res)
  12815. exception::throw_last_error(saved_ctx);
  12816. return manage(res);
  12817. }
  12818. isl::space multi_id::get_space() const
  12819. {
  12820. return space();
  12821. }
  12822. inline std::ostream &operator<<(std::ostream &os, const multi_id &obj)
  12823. {
  12824. if (!obj.get())
  12825. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12826. auto saved_ctx = isl_multi_id_get_ctx(obj.get());
  12827. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12828. char *str = isl_multi_id_to_str(obj.get());
  12829. if (!str)
  12830. exception::throw_last_error(saved_ctx);
  12831. os << str;
  12832. free(str);
  12833. return os;
  12834. }
  12835. // implementations for isl::multi_pw_aff
  12836. multi_pw_aff manage(__isl_take isl_multi_pw_aff *ptr) {
  12837. if (!ptr)
  12838. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12839. return multi_pw_aff(ptr);
  12840. }
  12841. multi_pw_aff manage_copy(__isl_keep isl_multi_pw_aff *ptr) {
  12842. if (!ptr)
  12843. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12844. auto saved_ctx = isl_multi_pw_aff_get_ctx(ptr);
  12845. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12846. ptr = isl_multi_pw_aff_copy(ptr);
  12847. if (!ptr)
  12848. exception::throw_last_error(saved_ctx);
  12849. return multi_pw_aff(ptr);
  12850. }
  12851. multi_pw_aff::multi_pw_aff(__isl_take isl_multi_pw_aff *ptr)
  12852. : ptr(ptr) {}
  12853. multi_pw_aff::multi_pw_aff()
  12854. : ptr(nullptr) {}
  12855. multi_pw_aff::multi_pw_aff(const multi_pw_aff &obj)
  12856. : ptr(nullptr)
  12857. {
  12858. if (!obj.ptr)
  12859. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12860. auto saved_ctx = isl_multi_pw_aff_get_ctx(obj.ptr);
  12861. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12862. ptr = obj.copy();
  12863. if (!ptr)
  12864. exception::throw_last_error(saved_ctx);
  12865. }
  12866. multi_pw_aff::multi_pw_aff(isl::aff aff)
  12867. {
  12868. if (aff.is_null())
  12869. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12870. auto saved_ctx = aff.ctx();
  12871. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12872. auto res = isl_multi_pw_aff_from_aff(aff.release());
  12873. if (!res)
  12874. exception::throw_last_error(saved_ctx);
  12875. ptr = res;
  12876. }
  12877. multi_pw_aff::multi_pw_aff(isl::multi_aff ma)
  12878. {
  12879. if (ma.is_null())
  12880. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12881. auto saved_ctx = ma.ctx();
  12882. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12883. auto res = isl_multi_pw_aff_from_multi_aff(ma.release());
  12884. if (!res)
  12885. exception::throw_last_error(saved_ctx);
  12886. ptr = res;
  12887. }
  12888. multi_pw_aff::multi_pw_aff(isl::pw_aff pa)
  12889. {
  12890. if (pa.is_null())
  12891. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12892. auto saved_ctx = pa.ctx();
  12893. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12894. auto res = isl_multi_pw_aff_from_pw_aff(pa.release());
  12895. if (!res)
  12896. exception::throw_last_error(saved_ctx);
  12897. ptr = res;
  12898. }
  12899. multi_pw_aff::multi_pw_aff(isl::space space, isl::pw_aff_list list)
  12900. {
  12901. if (space.is_null() || list.is_null())
  12902. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12903. auto saved_ctx = space.ctx();
  12904. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12905. auto res = isl_multi_pw_aff_from_pw_aff_list(space.release(), list.release());
  12906. if (!res)
  12907. exception::throw_last_error(saved_ctx);
  12908. ptr = res;
  12909. }
  12910. multi_pw_aff::multi_pw_aff(isl::pw_multi_aff pma)
  12911. {
  12912. if (pma.is_null())
  12913. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12914. auto saved_ctx = pma.ctx();
  12915. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12916. auto res = isl_multi_pw_aff_from_pw_multi_aff(pma.release());
  12917. if (!res)
  12918. exception::throw_last_error(saved_ctx);
  12919. ptr = res;
  12920. }
  12921. multi_pw_aff::multi_pw_aff(isl::ctx ctx, const std::string &str)
  12922. {
  12923. auto saved_ctx = ctx;
  12924. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12925. auto res = isl_multi_pw_aff_read_from_str(ctx.release(), str.c_str());
  12926. if (!res)
  12927. exception::throw_last_error(saved_ctx);
  12928. ptr = res;
  12929. }
  12930. multi_pw_aff &multi_pw_aff::operator=(multi_pw_aff obj) {
  12931. std::swap(this->ptr, obj.ptr);
  12932. return *this;
  12933. }
  12934. multi_pw_aff::~multi_pw_aff() {
  12935. if (ptr)
  12936. isl_multi_pw_aff_free(ptr);
  12937. }
  12938. __isl_give isl_multi_pw_aff *multi_pw_aff::copy() const & {
  12939. return isl_multi_pw_aff_copy(ptr);
  12940. }
  12941. __isl_keep isl_multi_pw_aff *multi_pw_aff::get() const {
  12942. return ptr;
  12943. }
  12944. __isl_give isl_multi_pw_aff *multi_pw_aff::release() {
  12945. isl_multi_pw_aff *tmp = ptr;
  12946. ptr = nullptr;
  12947. return tmp;
  12948. }
  12949. bool multi_pw_aff::is_null() const {
  12950. return ptr == nullptr;
  12951. }
  12952. isl::ctx multi_pw_aff::ctx() const {
  12953. return isl::ctx(isl_multi_pw_aff_get_ctx(ptr));
  12954. }
  12955. isl::multi_pw_aff multi_pw_aff::add(isl::multi_pw_aff multi2) const
  12956. {
  12957. if (!ptr || multi2.is_null())
  12958. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12959. auto saved_ctx = ctx();
  12960. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  12961. auto res = isl_multi_pw_aff_add(copy(), multi2.release());
  12962. if (!res)
  12963. exception::throw_last_error(saved_ctx);
  12964. return manage(res);
  12965. }
  12966. isl::multi_union_pw_aff multi_pw_aff::add(const isl::multi_union_pw_aff &multi2) const
  12967. {
  12968. if (!ptr)
  12969. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12970. return isl::multi_union_pw_aff(*this).add(multi2);
  12971. }
  12972. isl::multi_pw_aff multi_pw_aff::add(const isl::aff &multi2) const
  12973. {
  12974. if (!ptr)
  12975. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12976. return this->add(isl::multi_pw_aff(multi2));
  12977. }
  12978. isl::multi_pw_aff multi_pw_aff::add(const isl::multi_aff &multi2) const
  12979. {
  12980. if (!ptr)
  12981. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12982. return this->add(isl::multi_pw_aff(multi2));
  12983. }
  12984. isl::multi_pw_aff multi_pw_aff::add(const isl::pw_aff &multi2) const
  12985. {
  12986. if (!ptr)
  12987. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12988. return this->add(isl::multi_pw_aff(multi2));
  12989. }
  12990. isl::multi_pw_aff multi_pw_aff::add(const isl::pw_multi_aff &multi2) const
  12991. {
  12992. if (!ptr)
  12993. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  12994. return this->add(isl::multi_pw_aff(multi2));
  12995. }
  12996. isl::multi_pw_aff multi_pw_aff::add_constant(isl::multi_val mv) const
  12997. {
  12998. if (!ptr || mv.is_null())
  12999. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13000. auto saved_ctx = ctx();
  13001. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13002. auto res = isl_multi_pw_aff_add_constant_multi_val(copy(), mv.release());
  13003. if (!res)
  13004. exception::throw_last_error(saved_ctx);
  13005. return manage(res);
  13006. }
  13007. isl::multi_pw_aff multi_pw_aff::add_constant(isl::val v) const
  13008. {
  13009. if (!ptr || v.is_null())
  13010. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13011. auto saved_ctx = ctx();
  13012. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13013. auto res = isl_multi_pw_aff_add_constant_val(copy(), v.release());
  13014. if (!res)
  13015. exception::throw_last_error(saved_ctx);
  13016. return manage(res);
  13017. }
  13018. isl::multi_pw_aff multi_pw_aff::add_constant(long v) const
  13019. {
  13020. if (!ptr)
  13021. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13022. return this->add_constant(isl::val(ctx(), v));
  13023. }
  13024. isl::map multi_pw_aff::as_map() const
  13025. {
  13026. if (!ptr)
  13027. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13028. auto saved_ctx = ctx();
  13029. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13030. auto res = isl_multi_pw_aff_as_map(copy());
  13031. if (!res)
  13032. exception::throw_last_error(saved_ctx);
  13033. return manage(res);
  13034. }
  13035. isl::multi_aff multi_pw_aff::as_multi_aff() const
  13036. {
  13037. if (!ptr)
  13038. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13039. auto saved_ctx = ctx();
  13040. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13041. auto res = isl_multi_pw_aff_as_multi_aff(copy());
  13042. if (!res)
  13043. exception::throw_last_error(saved_ctx);
  13044. return manage(res);
  13045. }
  13046. isl::set multi_pw_aff::as_set() const
  13047. {
  13048. if (!ptr)
  13049. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13050. auto saved_ctx = ctx();
  13051. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13052. auto res = isl_multi_pw_aff_as_set(copy());
  13053. if (!res)
  13054. exception::throw_last_error(saved_ctx);
  13055. return manage(res);
  13056. }
  13057. isl::pw_aff multi_pw_aff::at(int pos) const
  13058. {
  13059. if (!ptr)
  13060. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13061. auto saved_ctx = ctx();
  13062. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13063. auto res = isl_multi_pw_aff_get_at(get(), pos);
  13064. if (!res)
  13065. exception::throw_last_error(saved_ctx);
  13066. return manage(res);
  13067. }
  13068. isl::pw_aff multi_pw_aff::get_at(int pos) const
  13069. {
  13070. return at(pos);
  13071. }
  13072. isl::set multi_pw_aff::bind(isl::multi_id tuple) const
  13073. {
  13074. if (!ptr || tuple.is_null())
  13075. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13076. auto saved_ctx = ctx();
  13077. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13078. auto res = isl_multi_pw_aff_bind(copy(), tuple.release());
  13079. if (!res)
  13080. exception::throw_last_error(saved_ctx);
  13081. return manage(res);
  13082. }
  13083. isl::multi_pw_aff multi_pw_aff::bind_domain(isl::multi_id tuple) const
  13084. {
  13085. if (!ptr || tuple.is_null())
  13086. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13087. auto saved_ctx = ctx();
  13088. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13089. auto res = isl_multi_pw_aff_bind_domain(copy(), tuple.release());
  13090. if (!res)
  13091. exception::throw_last_error(saved_ctx);
  13092. return manage(res);
  13093. }
  13094. isl::multi_pw_aff multi_pw_aff::bind_domain_wrapped_domain(isl::multi_id tuple) const
  13095. {
  13096. if (!ptr || tuple.is_null())
  13097. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13098. auto saved_ctx = ctx();
  13099. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13100. auto res = isl_multi_pw_aff_bind_domain_wrapped_domain(copy(), tuple.release());
  13101. if (!res)
  13102. exception::throw_last_error(saved_ctx);
  13103. return manage(res);
  13104. }
  13105. isl::multi_pw_aff multi_pw_aff::coalesce() const
  13106. {
  13107. if (!ptr)
  13108. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13109. auto saved_ctx = ctx();
  13110. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13111. auto res = isl_multi_pw_aff_coalesce(copy());
  13112. if (!res)
  13113. exception::throw_last_error(saved_ctx);
  13114. return manage(res);
  13115. }
  13116. isl::set multi_pw_aff::domain() const
  13117. {
  13118. if (!ptr)
  13119. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13120. auto saved_ctx = ctx();
  13121. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13122. auto res = isl_multi_pw_aff_domain(copy());
  13123. if (!res)
  13124. exception::throw_last_error(saved_ctx);
  13125. return manage(res);
  13126. }
  13127. isl::multi_pw_aff multi_pw_aff::flat_range_product(isl::multi_pw_aff multi2) const
  13128. {
  13129. if (!ptr || multi2.is_null())
  13130. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13131. auto saved_ctx = ctx();
  13132. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13133. auto res = isl_multi_pw_aff_flat_range_product(copy(), multi2.release());
  13134. if (!res)
  13135. exception::throw_last_error(saved_ctx);
  13136. return manage(res);
  13137. }
  13138. isl::multi_union_pw_aff multi_pw_aff::flat_range_product(const isl::multi_union_pw_aff &multi2) const
  13139. {
  13140. if (!ptr)
  13141. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13142. return isl::multi_union_pw_aff(*this).flat_range_product(multi2);
  13143. }
  13144. isl::multi_pw_aff multi_pw_aff::flat_range_product(const isl::aff &multi2) const
  13145. {
  13146. if (!ptr)
  13147. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13148. return this->flat_range_product(isl::multi_pw_aff(multi2));
  13149. }
  13150. isl::multi_pw_aff multi_pw_aff::flat_range_product(const isl::multi_aff &multi2) const
  13151. {
  13152. if (!ptr)
  13153. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13154. return this->flat_range_product(isl::multi_pw_aff(multi2));
  13155. }
  13156. isl::multi_pw_aff multi_pw_aff::flat_range_product(const isl::pw_aff &multi2) const
  13157. {
  13158. if (!ptr)
  13159. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13160. return this->flat_range_product(isl::multi_pw_aff(multi2));
  13161. }
  13162. isl::multi_pw_aff multi_pw_aff::flat_range_product(const isl::pw_multi_aff &multi2) const
  13163. {
  13164. if (!ptr)
  13165. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13166. return this->flat_range_product(isl::multi_pw_aff(multi2));
  13167. }
  13168. isl::multi_pw_aff multi_pw_aff::gist(isl::set set) const
  13169. {
  13170. if (!ptr || set.is_null())
  13171. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13172. auto saved_ctx = ctx();
  13173. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13174. auto res = isl_multi_pw_aff_gist(copy(), set.release());
  13175. if (!res)
  13176. exception::throw_last_error(saved_ctx);
  13177. return manage(res);
  13178. }
  13179. isl::multi_union_pw_aff multi_pw_aff::gist(const isl::union_set &context) const
  13180. {
  13181. if (!ptr)
  13182. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13183. return isl::multi_union_pw_aff(*this).gist(context);
  13184. }
  13185. isl::multi_pw_aff multi_pw_aff::gist(const isl::basic_set &set) const
  13186. {
  13187. if (!ptr)
  13188. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13189. return this->gist(isl::set(set));
  13190. }
  13191. isl::multi_pw_aff multi_pw_aff::gist(const isl::point &set) const
  13192. {
  13193. if (!ptr)
  13194. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13195. return this->gist(isl::set(set));
  13196. }
  13197. bool multi_pw_aff::has_range_tuple_id() const
  13198. {
  13199. if (!ptr)
  13200. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13201. auto saved_ctx = ctx();
  13202. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13203. auto res = isl_multi_pw_aff_has_range_tuple_id(get());
  13204. if (res < 0)
  13205. exception::throw_last_error(saved_ctx);
  13206. return res;
  13207. }
  13208. isl::multi_pw_aff multi_pw_aff::identity() const
  13209. {
  13210. if (!ptr)
  13211. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13212. auto saved_ctx = ctx();
  13213. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13214. auto res = isl_multi_pw_aff_identity_multi_pw_aff(copy());
  13215. if (!res)
  13216. exception::throw_last_error(saved_ctx);
  13217. return manage(res);
  13218. }
  13219. isl::multi_pw_aff multi_pw_aff::identity_on_domain(isl::space space)
  13220. {
  13221. if (space.is_null())
  13222. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13223. auto saved_ctx = space.ctx();
  13224. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13225. auto res = isl_multi_pw_aff_identity_on_domain_space(space.release());
  13226. if (!res)
  13227. exception::throw_last_error(saved_ctx);
  13228. return manage(res);
  13229. }
  13230. isl::multi_pw_aff multi_pw_aff::insert_domain(isl::space domain) const
  13231. {
  13232. if (!ptr || domain.is_null())
  13233. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13234. auto saved_ctx = ctx();
  13235. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13236. auto res = isl_multi_pw_aff_insert_domain(copy(), domain.release());
  13237. if (!res)
  13238. exception::throw_last_error(saved_ctx);
  13239. return manage(res);
  13240. }
  13241. isl::multi_pw_aff multi_pw_aff::intersect_domain(isl::set domain) const
  13242. {
  13243. if (!ptr || domain.is_null())
  13244. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13245. auto saved_ctx = ctx();
  13246. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13247. auto res = isl_multi_pw_aff_intersect_domain(copy(), domain.release());
  13248. if (!res)
  13249. exception::throw_last_error(saved_ctx);
  13250. return manage(res);
  13251. }
  13252. isl::multi_union_pw_aff multi_pw_aff::intersect_domain(const isl::union_set &uset) const
  13253. {
  13254. if (!ptr)
  13255. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13256. return isl::multi_union_pw_aff(*this).intersect_domain(uset);
  13257. }
  13258. isl::multi_pw_aff multi_pw_aff::intersect_domain(const isl::basic_set &domain) const
  13259. {
  13260. if (!ptr)
  13261. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13262. return this->intersect_domain(isl::set(domain));
  13263. }
  13264. isl::multi_pw_aff multi_pw_aff::intersect_domain(const isl::point &domain) const
  13265. {
  13266. if (!ptr)
  13267. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13268. return this->intersect_domain(isl::set(domain));
  13269. }
  13270. isl::multi_pw_aff multi_pw_aff::intersect_params(isl::set set) const
  13271. {
  13272. if (!ptr || set.is_null())
  13273. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13274. auto saved_ctx = ctx();
  13275. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13276. auto res = isl_multi_pw_aff_intersect_params(copy(), set.release());
  13277. if (!res)
  13278. exception::throw_last_error(saved_ctx);
  13279. return manage(res);
  13280. }
  13281. bool multi_pw_aff::involves_nan() const
  13282. {
  13283. if (!ptr)
  13284. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13285. auto saved_ctx = ctx();
  13286. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13287. auto res = isl_multi_pw_aff_involves_nan(get());
  13288. if (res < 0)
  13289. exception::throw_last_error(saved_ctx);
  13290. return res;
  13291. }
  13292. bool multi_pw_aff::involves_param(const isl::id &id) const
  13293. {
  13294. if (!ptr || id.is_null())
  13295. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13296. auto saved_ctx = ctx();
  13297. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13298. auto res = isl_multi_pw_aff_involves_param_id(get(), id.get());
  13299. if (res < 0)
  13300. exception::throw_last_error(saved_ctx);
  13301. return res;
  13302. }
  13303. bool multi_pw_aff::involves_param(const std::string &id) const
  13304. {
  13305. if (!ptr)
  13306. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13307. return this->involves_param(isl::id(ctx(), id));
  13308. }
  13309. bool multi_pw_aff::involves_param(const isl::id_list &list) const
  13310. {
  13311. if (!ptr || list.is_null())
  13312. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13313. auto saved_ctx = ctx();
  13314. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13315. auto res = isl_multi_pw_aff_involves_param_id_list(get(), list.get());
  13316. if (res < 0)
  13317. exception::throw_last_error(saved_ctx);
  13318. return res;
  13319. }
  13320. bool multi_pw_aff::isa_multi_aff() const
  13321. {
  13322. if (!ptr)
  13323. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13324. auto saved_ctx = ctx();
  13325. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13326. auto res = isl_multi_pw_aff_isa_multi_aff(get());
  13327. if (res < 0)
  13328. exception::throw_last_error(saved_ctx);
  13329. return res;
  13330. }
  13331. isl::pw_aff_list multi_pw_aff::list() const
  13332. {
  13333. if (!ptr)
  13334. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13335. auto saved_ctx = ctx();
  13336. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13337. auto res = isl_multi_pw_aff_get_list(get());
  13338. if (!res)
  13339. exception::throw_last_error(saved_ctx);
  13340. return manage(res);
  13341. }
  13342. isl::pw_aff_list multi_pw_aff::get_list() const
  13343. {
  13344. return list();
  13345. }
  13346. isl::multi_pw_aff multi_pw_aff::max(isl::multi_pw_aff multi2) const
  13347. {
  13348. if (!ptr || multi2.is_null())
  13349. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13350. auto saved_ctx = ctx();
  13351. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13352. auto res = isl_multi_pw_aff_max(copy(), multi2.release());
  13353. if (!res)
  13354. exception::throw_last_error(saved_ctx);
  13355. return manage(res);
  13356. }
  13357. isl::multi_val multi_pw_aff::max_multi_val() const
  13358. {
  13359. if (!ptr)
  13360. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13361. auto saved_ctx = ctx();
  13362. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13363. auto res = isl_multi_pw_aff_max_multi_val(copy());
  13364. if (!res)
  13365. exception::throw_last_error(saved_ctx);
  13366. return manage(res);
  13367. }
  13368. isl::multi_pw_aff multi_pw_aff::min(isl::multi_pw_aff multi2) const
  13369. {
  13370. if (!ptr || multi2.is_null())
  13371. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13372. auto saved_ctx = ctx();
  13373. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13374. auto res = isl_multi_pw_aff_min(copy(), multi2.release());
  13375. if (!res)
  13376. exception::throw_last_error(saved_ctx);
  13377. return manage(res);
  13378. }
  13379. isl::multi_val multi_pw_aff::min_multi_val() const
  13380. {
  13381. if (!ptr)
  13382. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13383. auto saved_ctx = ctx();
  13384. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13385. auto res = isl_multi_pw_aff_min_multi_val(copy());
  13386. if (!res)
  13387. exception::throw_last_error(saved_ctx);
  13388. return manage(res);
  13389. }
  13390. isl::multi_pw_aff multi_pw_aff::neg() const
  13391. {
  13392. if (!ptr)
  13393. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13394. auto saved_ctx = ctx();
  13395. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13396. auto res = isl_multi_pw_aff_neg(copy());
  13397. if (!res)
  13398. exception::throw_last_error(saved_ctx);
  13399. return manage(res);
  13400. }
  13401. bool multi_pw_aff::plain_is_equal(const isl::multi_pw_aff &multi2) const
  13402. {
  13403. if (!ptr || multi2.is_null())
  13404. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13405. auto saved_ctx = ctx();
  13406. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13407. auto res = isl_multi_pw_aff_plain_is_equal(get(), multi2.get());
  13408. if (res < 0)
  13409. exception::throw_last_error(saved_ctx);
  13410. return res;
  13411. }
  13412. bool multi_pw_aff::plain_is_equal(const isl::multi_union_pw_aff &multi2) const
  13413. {
  13414. if (!ptr)
  13415. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13416. return isl::multi_union_pw_aff(*this).plain_is_equal(multi2);
  13417. }
  13418. bool multi_pw_aff::plain_is_equal(const isl::aff &multi2) const
  13419. {
  13420. if (!ptr)
  13421. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13422. return this->plain_is_equal(isl::multi_pw_aff(multi2));
  13423. }
  13424. bool multi_pw_aff::plain_is_equal(const isl::multi_aff &multi2) const
  13425. {
  13426. if (!ptr)
  13427. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13428. return this->plain_is_equal(isl::multi_pw_aff(multi2));
  13429. }
  13430. bool multi_pw_aff::plain_is_equal(const isl::pw_aff &multi2) const
  13431. {
  13432. if (!ptr)
  13433. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13434. return this->plain_is_equal(isl::multi_pw_aff(multi2));
  13435. }
  13436. bool multi_pw_aff::plain_is_equal(const isl::pw_multi_aff &multi2) const
  13437. {
  13438. if (!ptr)
  13439. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13440. return this->plain_is_equal(isl::multi_pw_aff(multi2));
  13441. }
  13442. isl::multi_pw_aff multi_pw_aff::product(isl::multi_pw_aff multi2) const
  13443. {
  13444. if (!ptr || multi2.is_null())
  13445. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13446. auto saved_ctx = ctx();
  13447. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13448. auto res = isl_multi_pw_aff_product(copy(), multi2.release());
  13449. if (!res)
  13450. exception::throw_last_error(saved_ctx);
  13451. return manage(res);
  13452. }
  13453. isl::multi_pw_aff multi_pw_aff::pullback(isl::multi_aff ma) const
  13454. {
  13455. if (!ptr || ma.is_null())
  13456. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13457. auto saved_ctx = ctx();
  13458. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13459. auto res = isl_multi_pw_aff_pullback_multi_aff(copy(), ma.release());
  13460. if (!res)
  13461. exception::throw_last_error(saved_ctx);
  13462. return manage(res);
  13463. }
  13464. isl::multi_pw_aff multi_pw_aff::pullback(isl::multi_pw_aff mpa2) const
  13465. {
  13466. if (!ptr || mpa2.is_null())
  13467. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13468. auto saved_ctx = ctx();
  13469. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13470. auto res = isl_multi_pw_aff_pullback_multi_pw_aff(copy(), mpa2.release());
  13471. if (!res)
  13472. exception::throw_last_error(saved_ctx);
  13473. return manage(res);
  13474. }
  13475. isl::multi_pw_aff multi_pw_aff::pullback(isl::pw_multi_aff pma) const
  13476. {
  13477. if (!ptr || pma.is_null())
  13478. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13479. auto saved_ctx = ctx();
  13480. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13481. auto res = isl_multi_pw_aff_pullback_pw_multi_aff(copy(), pma.release());
  13482. if (!res)
  13483. exception::throw_last_error(saved_ctx);
  13484. return manage(res);
  13485. }
  13486. isl::multi_union_pw_aff multi_pw_aff::pullback(const isl::union_pw_multi_aff &upma) const
  13487. {
  13488. if (!ptr)
  13489. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13490. return isl::multi_union_pw_aff(*this).pullback(upma);
  13491. }
  13492. isl::multi_pw_aff multi_pw_aff::range_product(isl::multi_pw_aff multi2) const
  13493. {
  13494. if (!ptr || multi2.is_null())
  13495. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13496. auto saved_ctx = ctx();
  13497. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13498. auto res = isl_multi_pw_aff_range_product(copy(), multi2.release());
  13499. if (!res)
  13500. exception::throw_last_error(saved_ctx);
  13501. return manage(res);
  13502. }
  13503. isl::multi_union_pw_aff multi_pw_aff::range_product(const isl::multi_union_pw_aff &multi2) const
  13504. {
  13505. if (!ptr)
  13506. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13507. return isl::multi_union_pw_aff(*this).range_product(multi2);
  13508. }
  13509. isl::multi_pw_aff multi_pw_aff::range_product(const isl::aff &multi2) const
  13510. {
  13511. if (!ptr)
  13512. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13513. return this->range_product(isl::multi_pw_aff(multi2));
  13514. }
  13515. isl::multi_pw_aff multi_pw_aff::range_product(const isl::multi_aff &multi2) const
  13516. {
  13517. if (!ptr)
  13518. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13519. return this->range_product(isl::multi_pw_aff(multi2));
  13520. }
  13521. isl::multi_pw_aff multi_pw_aff::range_product(const isl::pw_aff &multi2) const
  13522. {
  13523. if (!ptr)
  13524. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13525. return this->range_product(isl::multi_pw_aff(multi2));
  13526. }
  13527. isl::multi_pw_aff multi_pw_aff::range_product(const isl::pw_multi_aff &multi2) const
  13528. {
  13529. if (!ptr)
  13530. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13531. return this->range_product(isl::multi_pw_aff(multi2));
  13532. }
  13533. isl::id multi_pw_aff::range_tuple_id() const
  13534. {
  13535. if (!ptr)
  13536. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13537. auto saved_ctx = ctx();
  13538. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13539. auto res = isl_multi_pw_aff_get_range_tuple_id(get());
  13540. if (!res)
  13541. exception::throw_last_error(saved_ctx);
  13542. return manage(res);
  13543. }
  13544. isl::id multi_pw_aff::get_range_tuple_id() const
  13545. {
  13546. return range_tuple_id();
  13547. }
  13548. isl::multi_pw_aff multi_pw_aff::reset_range_tuple_id() const
  13549. {
  13550. if (!ptr)
  13551. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13552. auto saved_ctx = ctx();
  13553. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13554. auto res = isl_multi_pw_aff_reset_range_tuple_id(copy());
  13555. if (!res)
  13556. exception::throw_last_error(saved_ctx);
  13557. return manage(res);
  13558. }
  13559. isl::multi_pw_aff multi_pw_aff::scale(isl::multi_val mv) const
  13560. {
  13561. if (!ptr || mv.is_null())
  13562. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13563. auto saved_ctx = ctx();
  13564. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13565. auto res = isl_multi_pw_aff_scale_multi_val(copy(), mv.release());
  13566. if (!res)
  13567. exception::throw_last_error(saved_ctx);
  13568. return manage(res);
  13569. }
  13570. isl::multi_pw_aff multi_pw_aff::scale(isl::val v) const
  13571. {
  13572. if (!ptr || v.is_null())
  13573. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13574. auto saved_ctx = ctx();
  13575. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13576. auto res = isl_multi_pw_aff_scale_val(copy(), v.release());
  13577. if (!res)
  13578. exception::throw_last_error(saved_ctx);
  13579. return manage(res);
  13580. }
  13581. isl::multi_pw_aff multi_pw_aff::scale(long v) const
  13582. {
  13583. if (!ptr)
  13584. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13585. return this->scale(isl::val(ctx(), v));
  13586. }
  13587. isl::multi_pw_aff multi_pw_aff::scale_down(isl::multi_val mv) const
  13588. {
  13589. if (!ptr || mv.is_null())
  13590. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13591. auto saved_ctx = ctx();
  13592. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13593. auto res = isl_multi_pw_aff_scale_down_multi_val(copy(), mv.release());
  13594. if (!res)
  13595. exception::throw_last_error(saved_ctx);
  13596. return manage(res);
  13597. }
  13598. isl::multi_pw_aff multi_pw_aff::scale_down(isl::val v) const
  13599. {
  13600. if (!ptr || v.is_null())
  13601. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13602. auto saved_ctx = ctx();
  13603. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13604. auto res = isl_multi_pw_aff_scale_down_val(copy(), v.release());
  13605. if (!res)
  13606. exception::throw_last_error(saved_ctx);
  13607. return manage(res);
  13608. }
  13609. isl::multi_pw_aff multi_pw_aff::scale_down(long v) const
  13610. {
  13611. if (!ptr)
  13612. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13613. return this->scale_down(isl::val(ctx(), v));
  13614. }
  13615. isl::multi_pw_aff multi_pw_aff::set_at(int pos, isl::pw_aff el) const
  13616. {
  13617. if (!ptr || el.is_null())
  13618. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13619. auto saved_ctx = ctx();
  13620. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13621. auto res = isl_multi_pw_aff_set_at(copy(), pos, el.release());
  13622. if (!res)
  13623. exception::throw_last_error(saved_ctx);
  13624. return manage(res);
  13625. }
  13626. isl::multi_union_pw_aff multi_pw_aff::set_at(int pos, const isl::union_pw_aff &el) const
  13627. {
  13628. if (!ptr)
  13629. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13630. return isl::multi_union_pw_aff(*this).set_at(pos, el);
  13631. }
  13632. isl::multi_pw_aff multi_pw_aff::set_range_tuple(isl::id id) const
  13633. {
  13634. if (!ptr || id.is_null())
  13635. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13636. auto saved_ctx = ctx();
  13637. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13638. auto res = isl_multi_pw_aff_set_range_tuple_id(copy(), id.release());
  13639. if (!res)
  13640. exception::throw_last_error(saved_ctx);
  13641. return manage(res);
  13642. }
  13643. isl::multi_pw_aff multi_pw_aff::set_range_tuple(const std::string &id) const
  13644. {
  13645. if (!ptr)
  13646. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13647. return this->set_range_tuple(isl::id(ctx(), id));
  13648. }
  13649. unsigned multi_pw_aff::size() const
  13650. {
  13651. if (!ptr)
  13652. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13653. auto saved_ctx = ctx();
  13654. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13655. auto res = isl_multi_pw_aff_size(get());
  13656. if (res < 0)
  13657. exception::throw_last_error(saved_ctx);
  13658. return res;
  13659. }
  13660. isl::space multi_pw_aff::space() const
  13661. {
  13662. if (!ptr)
  13663. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13664. auto saved_ctx = ctx();
  13665. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13666. auto res = isl_multi_pw_aff_get_space(get());
  13667. if (!res)
  13668. exception::throw_last_error(saved_ctx);
  13669. return manage(res);
  13670. }
  13671. isl::space multi_pw_aff::get_space() const
  13672. {
  13673. return space();
  13674. }
  13675. isl::multi_pw_aff multi_pw_aff::sub(isl::multi_pw_aff multi2) const
  13676. {
  13677. if (!ptr || multi2.is_null())
  13678. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13679. auto saved_ctx = ctx();
  13680. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13681. auto res = isl_multi_pw_aff_sub(copy(), multi2.release());
  13682. if (!res)
  13683. exception::throw_last_error(saved_ctx);
  13684. return manage(res);
  13685. }
  13686. isl::multi_union_pw_aff multi_pw_aff::sub(const isl::multi_union_pw_aff &multi2) const
  13687. {
  13688. if (!ptr)
  13689. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13690. return isl::multi_union_pw_aff(*this).sub(multi2);
  13691. }
  13692. isl::multi_pw_aff multi_pw_aff::sub(const isl::aff &multi2) const
  13693. {
  13694. if (!ptr)
  13695. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13696. return this->sub(isl::multi_pw_aff(multi2));
  13697. }
  13698. isl::multi_pw_aff multi_pw_aff::sub(const isl::multi_aff &multi2) const
  13699. {
  13700. if (!ptr)
  13701. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13702. return this->sub(isl::multi_pw_aff(multi2));
  13703. }
  13704. isl::multi_pw_aff multi_pw_aff::sub(const isl::pw_aff &multi2) const
  13705. {
  13706. if (!ptr)
  13707. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13708. return this->sub(isl::multi_pw_aff(multi2));
  13709. }
  13710. isl::multi_pw_aff multi_pw_aff::sub(const isl::pw_multi_aff &multi2) const
  13711. {
  13712. if (!ptr)
  13713. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13714. return this->sub(isl::multi_pw_aff(multi2));
  13715. }
  13716. isl::multi_pw_aff multi_pw_aff::unbind_params_insert_domain(isl::multi_id domain) const
  13717. {
  13718. if (!ptr || domain.is_null())
  13719. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13720. auto saved_ctx = ctx();
  13721. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13722. auto res = isl_multi_pw_aff_unbind_params_insert_domain(copy(), domain.release());
  13723. if (!res)
  13724. exception::throw_last_error(saved_ctx);
  13725. return manage(res);
  13726. }
  13727. isl::multi_pw_aff multi_pw_aff::union_add(isl::multi_pw_aff mpa2) const
  13728. {
  13729. if (!ptr || mpa2.is_null())
  13730. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13731. auto saved_ctx = ctx();
  13732. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13733. auto res = isl_multi_pw_aff_union_add(copy(), mpa2.release());
  13734. if (!res)
  13735. exception::throw_last_error(saved_ctx);
  13736. return manage(res);
  13737. }
  13738. isl::multi_union_pw_aff multi_pw_aff::union_add(const isl::multi_union_pw_aff &mupa2) const
  13739. {
  13740. if (!ptr)
  13741. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13742. return isl::multi_union_pw_aff(*this).union_add(mupa2);
  13743. }
  13744. isl::multi_pw_aff multi_pw_aff::union_add(const isl::aff &mpa2) const
  13745. {
  13746. if (!ptr)
  13747. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13748. return this->union_add(isl::multi_pw_aff(mpa2));
  13749. }
  13750. isl::multi_pw_aff multi_pw_aff::union_add(const isl::multi_aff &mpa2) const
  13751. {
  13752. if (!ptr)
  13753. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13754. return this->union_add(isl::multi_pw_aff(mpa2));
  13755. }
  13756. isl::multi_pw_aff multi_pw_aff::union_add(const isl::pw_aff &mpa2) const
  13757. {
  13758. if (!ptr)
  13759. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13760. return this->union_add(isl::multi_pw_aff(mpa2));
  13761. }
  13762. isl::multi_pw_aff multi_pw_aff::union_add(const isl::pw_multi_aff &mpa2) const
  13763. {
  13764. if (!ptr)
  13765. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13766. return this->union_add(isl::multi_pw_aff(mpa2));
  13767. }
  13768. isl::multi_pw_aff multi_pw_aff::zero(isl::space space)
  13769. {
  13770. if (space.is_null())
  13771. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13772. auto saved_ctx = space.ctx();
  13773. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13774. auto res = isl_multi_pw_aff_zero(space.release());
  13775. if (!res)
  13776. exception::throw_last_error(saved_ctx);
  13777. return manage(res);
  13778. }
  13779. inline std::ostream &operator<<(std::ostream &os, const multi_pw_aff &obj)
  13780. {
  13781. if (!obj.get())
  13782. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13783. auto saved_ctx = isl_multi_pw_aff_get_ctx(obj.get());
  13784. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13785. char *str = isl_multi_pw_aff_to_str(obj.get());
  13786. if (!str)
  13787. exception::throw_last_error(saved_ctx);
  13788. os << str;
  13789. free(str);
  13790. return os;
  13791. }
  13792. // implementations for isl::multi_union_pw_aff
  13793. multi_union_pw_aff manage(__isl_take isl_multi_union_pw_aff *ptr) {
  13794. if (!ptr)
  13795. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13796. return multi_union_pw_aff(ptr);
  13797. }
  13798. multi_union_pw_aff manage_copy(__isl_keep isl_multi_union_pw_aff *ptr) {
  13799. if (!ptr)
  13800. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13801. auto saved_ctx = isl_multi_union_pw_aff_get_ctx(ptr);
  13802. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13803. ptr = isl_multi_union_pw_aff_copy(ptr);
  13804. if (!ptr)
  13805. exception::throw_last_error(saved_ctx);
  13806. return multi_union_pw_aff(ptr);
  13807. }
  13808. multi_union_pw_aff::multi_union_pw_aff(__isl_take isl_multi_union_pw_aff *ptr)
  13809. : ptr(ptr) {}
  13810. multi_union_pw_aff::multi_union_pw_aff()
  13811. : ptr(nullptr) {}
  13812. multi_union_pw_aff::multi_union_pw_aff(const multi_union_pw_aff &obj)
  13813. : ptr(nullptr)
  13814. {
  13815. if (!obj.ptr)
  13816. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13817. auto saved_ctx = isl_multi_union_pw_aff_get_ctx(obj.ptr);
  13818. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13819. ptr = obj.copy();
  13820. if (!ptr)
  13821. exception::throw_last_error(saved_ctx);
  13822. }
  13823. multi_union_pw_aff::multi_union_pw_aff(isl::multi_pw_aff mpa)
  13824. {
  13825. if (mpa.is_null())
  13826. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13827. auto saved_ctx = mpa.ctx();
  13828. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13829. auto res = isl_multi_union_pw_aff_from_multi_pw_aff(mpa.release());
  13830. if (!res)
  13831. exception::throw_last_error(saved_ctx);
  13832. ptr = res;
  13833. }
  13834. multi_union_pw_aff::multi_union_pw_aff(isl::union_pw_aff upa)
  13835. {
  13836. if (upa.is_null())
  13837. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13838. auto saved_ctx = upa.ctx();
  13839. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13840. auto res = isl_multi_union_pw_aff_from_union_pw_aff(upa.release());
  13841. if (!res)
  13842. exception::throw_last_error(saved_ctx);
  13843. ptr = res;
  13844. }
  13845. multi_union_pw_aff::multi_union_pw_aff(isl::space space, isl::union_pw_aff_list list)
  13846. {
  13847. if (space.is_null() || list.is_null())
  13848. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13849. auto saved_ctx = space.ctx();
  13850. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13851. auto res = isl_multi_union_pw_aff_from_union_pw_aff_list(space.release(), list.release());
  13852. if (!res)
  13853. exception::throw_last_error(saved_ctx);
  13854. ptr = res;
  13855. }
  13856. multi_union_pw_aff::multi_union_pw_aff(isl::ctx ctx, const std::string &str)
  13857. {
  13858. auto saved_ctx = ctx;
  13859. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13860. auto res = isl_multi_union_pw_aff_read_from_str(ctx.release(), str.c_str());
  13861. if (!res)
  13862. exception::throw_last_error(saved_ctx);
  13863. ptr = res;
  13864. }
  13865. multi_union_pw_aff &multi_union_pw_aff::operator=(multi_union_pw_aff obj) {
  13866. std::swap(this->ptr, obj.ptr);
  13867. return *this;
  13868. }
  13869. multi_union_pw_aff::~multi_union_pw_aff() {
  13870. if (ptr)
  13871. isl_multi_union_pw_aff_free(ptr);
  13872. }
  13873. __isl_give isl_multi_union_pw_aff *multi_union_pw_aff::copy() const & {
  13874. return isl_multi_union_pw_aff_copy(ptr);
  13875. }
  13876. __isl_keep isl_multi_union_pw_aff *multi_union_pw_aff::get() const {
  13877. return ptr;
  13878. }
  13879. __isl_give isl_multi_union_pw_aff *multi_union_pw_aff::release() {
  13880. isl_multi_union_pw_aff *tmp = ptr;
  13881. ptr = nullptr;
  13882. return tmp;
  13883. }
  13884. bool multi_union_pw_aff::is_null() const {
  13885. return ptr == nullptr;
  13886. }
  13887. isl::ctx multi_union_pw_aff::ctx() const {
  13888. return isl::ctx(isl_multi_union_pw_aff_get_ctx(ptr));
  13889. }
  13890. isl::multi_union_pw_aff multi_union_pw_aff::add(isl::multi_union_pw_aff multi2) const
  13891. {
  13892. if (!ptr || multi2.is_null())
  13893. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13894. auto saved_ctx = ctx();
  13895. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13896. auto res = isl_multi_union_pw_aff_add(copy(), multi2.release());
  13897. if (!res)
  13898. exception::throw_last_error(saved_ctx);
  13899. return manage(res);
  13900. }
  13901. isl::union_pw_aff multi_union_pw_aff::at(int pos) const
  13902. {
  13903. if (!ptr)
  13904. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13905. auto saved_ctx = ctx();
  13906. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13907. auto res = isl_multi_union_pw_aff_get_at(get(), pos);
  13908. if (!res)
  13909. exception::throw_last_error(saved_ctx);
  13910. return manage(res);
  13911. }
  13912. isl::union_pw_aff multi_union_pw_aff::get_at(int pos) const
  13913. {
  13914. return at(pos);
  13915. }
  13916. isl::union_set multi_union_pw_aff::bind(isl::multi_id tuple) const
  13917. {
  13918. if (!ptr || tuple.is_null())
  13919. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13920. auto saved_ctx = ctx();
  13921. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13922. auto res = isl_multi_union_pw_aff_bind(copy(), tuple.release());
  13923. if (!res)
  13924. exception::throw_last_error(saved_ctx);
  13925. return manage(res);
  13926. }
  13927. isl::multi_union_pw_aff multi_union_pw_aff::coalesce() const
  13928. {
  13929. if (!ptr)
  13930. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13931. auto saved_ctx = ctx();
  13932. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13933. auto res = isl_multi_union_pw_aff_coalesce(copy());
  13934. if (!res)
  13935. exception::throw_last_error(saved_ctx);
  13936. return manage(res);
  13937. }
  13938. isl::union_set multi_union_pw_aff::domain() const
  13939. {
  13940. if (!ptr)
  13941. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13942. auto saved_ctx = ctx();
  13943. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13944. auto res = isl_multi_union_pw_aff_domain(copy());
  13945. if (!res)
  13946. exception::throw_last_error(saved_ctx);
  13947. return manage(res);
  13948. }
  13949. isl::multi_union_pw_aff multi_union_pw_aff::flat_range_product(isl::multi_union_pw_aff multi2) const
  13950. {
  13951. if (!ptr || multi2.is_null())
  13952. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13953. auto saved_ctx = ctx();
  13954. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13955. auto res = isl_multi_union_pw_aff_flat_range_product(copy(), multi2.release());
  13956. if (!res)
  13957. exception::throw_last_error(saved_ctx);
  13958. return manage(res);
  13959. }
  13960. isl::multi_union_pw_aff multi_union_pw_aff::gist(isl::union_set context) const
  13961. {
  13962. if (!ptr || context.is_null())
  13963. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13964. auto saved_ctx = ctx();
  13965. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13966. auto res = isl_multi_union_pw_aff_gist(copy(), context.release());
  13967. if (!res)
  13968. exception::throw_last_error(saved_ctx);
  13969. return manage(res);
  13970. }
  13971. bool multi_union_pw_aff::has_range_tuple_id() const
  13972. {
  13973. if (!ptr)
  13974. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13975. auto saved_ctx = ctx();
  13976. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13977. auto res = isl_multi_union_pw_aff_has_range_tuple_id(get());
  13978. if (res < 0)
  13979. exception::throw_last_error(saved_ctx);
  13980. return res;
  13981. }
  13982. isl::multi_union_pw_aff multi_union_pw_aff::intersect_domain(isl::union_set uset) const
  13983. {
  13984. if (!ptr || uset.is_null())
  13985. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13986. auto saved_ctx = ctx();
  13987. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13988. auto res = isl_multi_union_pw_aff_intersect_domain(copy(), uset.release());
  13989. if (!res)
  13990. exception::throw_last_error(saved_ctx);
  13991. return manage(res);
  13992. }
  13993. isl::multi_union_pw_aff multi_union_pw_aff::intersect_params(isl::set params) const
  13994. {
  13995. if (!ptr || params.is_null())
  13996. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  13997. auto saved_ctx = ctx();
  13998. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  13999. auto res = isl_multi_union_pw_aff_intersect_params(copy(), params.release());
  14000. if (!res)
  14001. exception::throw_last_error(saved_ctx);
  14002. return manage(res);
  14003. }
  14004. bool multi_union_pw_aff::involves_nan() const
  14005. {
  14006. if (!ptr)
  14007. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14008. auto saved_ctx = ctx();
  14009. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14010. auto res = isl_multi_union_pw_aff_involves_nan(get());
  14011. if (res < 0)
  14012. exception::throw_last_error(saved_ctx);
  14013. return res;
  14014. }
  14015. isl::union_pw_aff_list multi_union_pw_aff::list() const
  14016. {
  14017. if (!ptr)
  14018. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14019. auto saved_ctx = ctx();
  14020. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14021. auto res = isl_multi_union_pw_aff_get_list(get());
  14022. if (!res)
  14023. exception::throw_last_error(saved_ctx);
  14024. return manage(res);
  14025. }
  14026. isl::union_pw_aff_list multi_union_pw_aff::get_list() const
  14027. {
  14028. return list();
  14029. }
  14030. isl::multi_union_pw_aff multi_union_pw_aff::neg() const
  14031. {
  14032. if (!ptr)
  14033. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14034. auto saved_ctx = ctx();
  14035. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14036. auto res = isl_multi_union_pw_aff_neg(copy());
  14037. if (!res)
  14038. exception::throw_last_error(saved_ctx);
  14039. return manage(res);
  14040. }
  14041. bool multi_union_pw_aff::plain_is_equal(const isl::multi_union_pw_aff &multi2) const
  14042. {
  14043. if (!ptr || multi2.is_null())
  14044. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14045. auto saved_ctx = ctx();
  14046. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14047. auto res = isl_multi_union_pw_aff_plain_is_equal(get(), multi2.get());
  14048. if (res < 0)
  14049. exception::throw_last_error(saved_ctx);
  14050. return res;
  14051. }
  14052. isl::multi_union_pw_aff multi_union_pw_aff::pullback(isl::union_pw_multi_aff upma) const
  14053. {
  14054. if (!ptr || upma.is_null())
  14055. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14056. auto saved_ctx = ctx();
  14057. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14058. auto res = isl_multi_union_pw_aff_pullback_union_pw_multi_aff(copy(), upma.release());
  14059. if (!res)
  14060. exception::throw_last_error(saved_ctx);
  14061. return manage(res);
  14062. }
  14063. isl::multi_union_pw_aff multi_union_pw_aff::range_product(isl::multi_union_pw_aff multi2) const
  14064. {
  14065. if (!ptr || multi2.is_null())
  14066. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14067. auto saved_ctx = ctx();
  14068. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14069. auto res = isl_multi_union_pw_aff_range_product(copy(), multi2.release());
  14070. if (!res)
  14071. exception::throw_last_error(saved_ctx);
  14072. return manage(res);
  14073. }
  14074. isl::id multi_union_pw_aff::range_tuple_id() const
  14075. {
  14076. if (!ptr)
  14077. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14078. auto saved_ctx = ctx();
  14079. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14080. auto res = isl_multi_union_pw_aff_get_range_tuple_id(get());
  14081. if (!res)
  14082. exception::throw_last_error(saved_ctx);
  14083. return manage(res);
  14084. }
  14085. isl::id multi_union_pw_aff::get_range_tuple_id() const
  14086. {
  14087. return range_tuple_id();
  14088. }
  14089. isl::multi_union_pw_aff multi_union_pw_aff::reset_range_tuple_id() const
  14090. {
  14091. if (!ptr)
  14092. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14093. auto saved_ctx = ctx();
  14094. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14095. auto res = isl_multi_union_pw_aff_reset_range_tuple_id(copy());
  14096. if (!res)
  14097. exception::throw_last_error(saved_ctx);
  14098. return manage(res);
  14099. }
  14100. isl::multi_union_pw_aff multi_union_pw_aff::scale(isl::multi_val mv) const
  14101. {
  14102. if (!ptr || mv.is_null())
  14103. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14104. auto saved_ctx = ctx();
  14105. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14106. auto res = isl_multi_union_pw_aff_scale_multi_val(copy(), mv.release());
  14107. if (!res)
  14108. exception::throw_last_error(saved_ctx);
  14109. return manage(res);
  14110. }
  14111. isl::multi_union_pw_aff multi_union_pw_aff::scale(isl::val v) const
  14112. {
  14113. if (!ptr || v.is_null())
  14114. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14115. auto saved_ctx = ctx();
  14116. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14117. auto res = isl_multi_union_pw_aff_scale_val(copy(), v.release());
  14118. if (!res)
  14119. exception::throw_last_error(saved_ctx);
  14120. return manage(res);
  14121. }
  14122. isl::multi_union_pw_aff multi_union_pw_aff::scale(long v) const
  14123. {
  14124. if (!ptr)
  14125. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14126. return this->scale(isl::val(ctx(), v));
  14127. }
  14128. isl::multi_union_pw_aff multi_union_pw_aff::scale_down(isl::multi_val mv) const
  14129. {
  14130. if (!ptr || mv.is_null())
  14131. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14132. auto saved_ctx = ctx();
  14133. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14134. auto res = isl_multi_union_pw_aff_scale_down_multi_val(copy(), mv.release());
  14135. if (!res)
  14136. exception::throw_last_error(saved_ctx);
  14137. return manage(res);
  14138. }
  14139. isl::multi_union_pw_aff multi_union_pw_aff::scale_down(isl::val v) const
  14140. {
  14141. if (!ptr || v.is_null())
  14142. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14143. auto saved_ctx = ctx();
  14144. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14145. auto res = isl_multi_union_pw_aff_scale_down_val(copy(), v.release());
  14146. if (!res)
  14147. exception::throw_last_error(saved_ctx);
  14148. return manage(res);
  14149. }
  14150. isl::multi_union_pw_aff multi_union_pw_aff::scale_down(long v) const
  14151. {
  14152. if (!ptr)
  14153. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14154. return this->scale_down(isl::val(ctx(), v));
  14155. }
  14156. isl::multi_union_pw_aff multi_union_pw_aff::set_at(int pos, isl::union_pw_aff el) const
  14157. {
  14158. if (!ptr || el.is_null())
  14159. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14160. auto saved_ctx = ctx();
  14161. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14162. auto res = isl_multi_union_pw_aff_set_at(copy(), pos, el.release());
  14163. if (!res)
  14164. exception::throw_last_error(saved_ctx);
  14165. return manage(res);
  14166. }
  14167. isl::multi_union_pw_aff multi_union_pw_aff::set_range_tuple(isl::id id) const
  14168. {
  14169. if (!ptr || id.is_null())
  14170. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14171. auto saved_ctx = ctx();
  14172. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14173. auto res = isl_multi_union_pw_aff_set_range_tuple_id(copy(), id.release());
  14174. if (!res)
  14175. exception::throw_last_error(saved_ctx);
  14176. return manage(res);
  14177. }
  14178. isl::multi_union_pw_aff multi_union_pw_aff::set_range_tuple(const std::string &id) const
  14179. {
  14180. if (!ptr)
  14181. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14182. return this->set_range_tuple(isl::id(ctx(), id));
  14183. }
  14184. unsigned multi_union_pw_aff::size() const
  14185. {
  14186. if (!ptr)
  14187. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14188. auto saved_ctx = ctx();
  14189. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14190. auto res = isl_multi_union_pw_aff_size(get());
  14191. if (res < 0)
  14192. exception::throw_last_error(saved_ctx);
  14193. return res;
  14194. }
  14195. isl::space multi_union_pw_aff::space() const
  14196. {
  14197. if (!ptr)
  14198. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14199. auto saved_ctx = ctx();
  14200. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14201. auto res = isl_multi_union_pw_aff_get_space(get());
  14202. if (!res)
  14203. exception::throw_last_error(saved_ctx);
  14204. return manage(res);
  14205. }
  14206. isl::space multi_union_pw_aff::get_space() const
  14207. {
  14208. return space();
  14209. }
  14210. isl::multi_union_pw_aff multi_union_pw_aff::sub(isl::multi_union_pw_aff multi2) const
  14211. {
  14212. if (!ptr || multi2.is_null())
  14213. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14214. auto saved_ctx = ctx();
  14215. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14216. auto res = isl_multi_union_pw_aff_sub(copy(), multi2.release());
  14217. if (!res)
  14218. exception::throw_last_error(saved_ctx);
  14219. return manage(res);
  14220. }
  14221. isl::multi_union_pw_aff multi_union_pw_aff::union_add(isl::multi_union_pw_aff mupa2) const
  14222. {
  14223. if (!ptr || mupa2.is_null())
  14224. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14225. auto saved_ctx = ctx();
  14226. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14227. auto res = isl_multi_union_pw_aff_union_add(copy(), mupa2.release());
  14228. if (!res)
  14229. exception::throw_last_error(saved_ctx);
  14230. return manage(res);
  14231. }
  14232. isl::multi_union_pw_aff multi_union_pw_aff::zero(isl::space space)
  14233. {
  14234. if (space.is_null())
  14235. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14236. auto saved_ctx = space.ctx();
  14237. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14238. auto res = isl_multi_union_pw_aff_zero(space.release());
  14239. if (!res)
  14240. exception::throw_last_error(saved_ctx);
  14241. return manage(res);
  14242. }
  14243. inline std::ostream &operator<<(std::ostream &os, const multi_union_pw_aff &obj)
  14244. {
  14245. if (!obj.get())
  14246. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14247. auto saved_ctx = isl_multi_union_pw_aff_get_ctx(obj.get());
  14248. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14249. char *str = isl_multi_union_pw_aff_to_str(obj.get());
  14250. if (!str)
  14251. exception::throw_last_error(saved_ctx);
  14252. os << str;
  14253. free(str);
  14254. return os;
  14255. }
  14256. // implementations for isl::multi_val
  14257. multi_val manage(__isl_take isl_multi_val *ptr) {
  14258. if (!ptr)
  14259. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14260. return multi_val(ptr);
  14261. }
  14262. multi_val manage_copy(__isl_keep isl_multi_val *ptr) {
  14263. if (!ptr)
  14264. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14265. auto saved_ctx = isl_multi_val_get_ctx(ptr);
  14266. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14267. ptr = isl_multi_val_copy(ptr);
  14268. if (!ptr)
  14269. exception::throw_last_error(saved_ctx);
  14270. return multi_val(ptr);
  14271. }
  14272. multi_val::multi_val(__isl_take isl_multi_val *ptr)
  14273. : ptr(ptr) {}
  14274. multi_val::multi_val()
  14275. : ptr(nullptr) {}
  14276. multi_val::multi_val(const multi_val &obj)
  14277. : ptr(nullptr)
  14278. {
  14279. if (!obj.ptr)
  14280. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14281. auto saved_ctx = isl_multi_val_get_ctx(obj.ptr);
  14282. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14283. ptr = obj.copy();
  14284. if (!ptr)
  14285. exception::throw_last_error(saved_ctx);
  14286. }
  14287. multi_val::multi_val(isl::space space, isl::val_list list)
  14288. {
  14289. if (space.is_null() || list.is_null())
  14290. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14291. auto saved_ctx = space.ctx();
  14292. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14293. auto res = isl_multi_val_from_val_list(space.release(), list.release());
  14294. if (!res)
  14295. exception::throw_last_error(saved_ctx);
  14296. ptr = res;
  14297. }
  14298. multi_val::multi_val(isl::ctx ctx, const std::string &str)
  14299. {
  14300. auto saved_ctx = ctx;
  14301. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14302. auto res = isl_multi_val_read_from_str(ctx.release(), str.c_str());
  14303. if (!res)
  14304. exception::throw_last_error(saved_ctx);
  14305. ptr = res;
  14306. }
  14307. multi_val &multi_val::operator=(multi_val obj) {
  14308. std::swap(this->ptr, obj.ptr);
  14309. return *this;
  14310. }
  14311. multi_val::~multi_val() {
  14312. if (ptr)
  14313. isl_multi_val_free(ptr);
  14314. }
  14315. __isl_give isl_multi_val *multi_val::copy() const & {
  14316. return isl_multi_val_copy(ptr);
  14317. }
  14318. __isl_keep isl_multi_val *multi_val::get() const {
  14319. return ptr;
  14320. }
  14321. __isl_give isl_multi_val *multi_val::release() {
  14322. isl_multi_val *tmp = ptr;
  14323. ptr = nullptr;
  14324. return tmp;
  14325. }
  14326. bool multi_val::is_null() const {
  14327. return ptr == nullptr;
  14328. }
  14329. isl::ctx multi_val::ctx() const {
  14330. return isl::ctx(isl_multi_val_get_ctx(ptr));
  14331. }
  14332. isl::multi_val multi_val::add(isl::multi_val multi2) const
  14333. {
  14334. if (!ptr || multi2.is_null())
  14335. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14336. auto saved_ctx = ctx();
  14337. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14338. auto res = isl_multi_val_add(copy(), multi2.release());
  14339. if (!res)
  14340. exception::throw_last_error(saved_ctx);
  14341. return manage(res);
  14342. }
  14343. isl::multi_val multi_val::add(isl::val v) const
  14344. {
  14345. if (!ptr || v.is_null())
  14346. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14347. auto saved_ctx = ctx();
  14348. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14349. auto res = isl_multi_val_add_val(copy(), v.release());
  14350. if (!res)
  14351. exception::throw_last_error(saved_ctx);
  14352. return manage(res);
  14353. }
  14354. isl::multi_val multi_val::add(long v) const
  14355. {
  14356. if (!ptr)
  14357. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14358. return this->add(isl::val(ctx(), v));
  14359. }
  14360. isl::val multi_val::at(int pos) const
  14361. {
  14362. if (!ptr)
  14363. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14364. auto saved_ctx = ctx();
  14365. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14366. auto res = isl_multi_val_get_at(get(), pos);
  14367. if (!res)
  14368. exception::throw_last_error(saved_ctx);
  14369. return manage(res);
  14370. }
  14371. isl::val multi_val::get_at(int pos) const
  14372. {
  14373. return at(pos);
  14374. }
  14375. isl::multi_val multi_val::flat_range_product(isl::multi_val multi2) const
  14376. {
  14377. if (!ptr || multi2.is_null())
  14378. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14379. auto saved_ctx = ctx();
  14380. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14381. auto res = isl_multi_val_flat_range_product(copy(), multi2.release());
  14382. if (!res)
  14383. exception::throw_last_error(saved_ctx);
  14384. return manage(res);
  14385. }
  14386. bool multi_val::has_range_tuple_id() const
  14387. {
  14388. if (!ptr)
  14389. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14390. auto saved_ctx = ctx();
  14391. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14392. auto res = isl_multi_val_has_range_tuple_id(get());
  14393. if (res < 0)
  14394. exception::throw_last_error(saved_ctx);
  14395. return res;
  14396. }
  14397. bool multi_val::involves_nan() const
  14398. {
  14399. if (!ptr)
  14400. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14401. auto saved_ctx = ctx();
  14402. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14403. auto res = isl_multi_val_involves_nan(get());
  14404. if (res < 0)
  14405. exception::throw_last_error(saved_ctx);
  14406. return res;
  14407. }
  14408. isl::val_list multi_val::list() const
  14409. {
  14410. if (!ptr)
  14411. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14412. auto saved_ctx = ctx();
  14413. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14414. auto res = isl_multi_val_get_list(get());
  14415. if (!res)
  14416. exception::throw_last_error(saved_ctx);
  14417. return manage(res);
  14418. }
  14419. isl::val_list multi_val::get_list() const
  14420. {
  14421. return list();
  14422. }
  14423. isl::multi_val multi_val::max(isl::multi_val multi2) const
  14424. {
  14425. if (!ptr || multi2.is_null())
  14426. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14427. auto saved_ctx = ctx();
  14428. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14429. auto res = isl_multi_val_max(copy(), multi2.release());
  14430. if (!res)
  14431. exception::throw_last_error(saved_ctx);
  14432. return manage(res);
  14433. }
  14434. isl::multi_val multi_val::min(isl::multi_val multi2) const
  14435. {
  14436. if (!ptr || multi2.is_null())
  14437. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14438. auto saved_ctx = ctx();
  14439. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14440. auto res = isl_multi_val_min(copy(), multi2.release());
  14441. if (!res)
  14442. exception::throw_last_error(saved_ctx);
  14443. return manage(res);
  14444. }
  14445. isl::multi_val multi_val::neg() const
  14446. {
  14447. if (!ptr)
  14448. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14449. auto saved_ctx = ctx();
  14450. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14451. auto res = isl_multi_val_neg(copy());
  14452. if (!res)
  14453. exception::throw_last_error(saved_ctx);
  14454. return manage(res);
  14455. }
  14456. bool multi_val::plain_is_equal(const isl::multi_val &multi2) const
  14457. {
  14458. if (!ptr || multi2.is_null())
  14459. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14460. auto saved_ctx = ctx();
  14461. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14462. auto res = isl_multi_val_plain_is_equal(get(), multi2.get());
  14463. if (res < 0)
  14464. exception::throw_last_error(saved_ctx);
  14465. return res;
  14466. }
  14467. isl::multi_val multi_val::product(isl::multi_val multi2) const
  14468. {
  14469. if (!ptr || multi2.is_null())
  14470. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14471. auto saved_ctx = ctx();
  14472. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14473. auto res = isl_multi_val_product(copy(), multi2.release());
  14474. if (!res)
  14475. exception::throw_last_error(saved_ctx);
  14476. return manage(res);
  14477. }
  14478. isl::multi_val multi_val::range_product(isl::multi_val multi2) const
  14479. {
  14480. if (!ptr || multi2.is_null())
  14481. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14482. auto saved_ctx = ctx();
  14483. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14484. auto res = isl_multi_val_range_product(copy(), multi2.release());
  14485. if (!res)
  14486. exception::throw_last_error(saved_ctx);
  14487. return manage(res);
  14488. }
  14489. isl::id multi_val::range_tuple_id() const
  14490. {
  14491. if (!ptr)
  14492. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14493. auto saved_ctx = ctx();
  14494. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14495. auto res = isl_multi_val_get_range_tuple_id(get());
  14496. if (!res)
  14497. exception::throw_last_error(saved_ctx);
  14498. return manage(res);
  14499. }
  14500. isl::id multi_val::get_range_tuple_id() const
  14501. {
  14502. return range_tuple_id();
  14503. }
  14504. isl::multi_val multi_val::reset_range_tuple_id() const
  14505. {
  14506. if (!ptr)
  14507. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14508. auto saved_ctx = ctx();
  14509. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14510. auto res = isl_multi_val_reset_range_tuple_id(copy());
  14511. if (!res)
  14512. exception::throw_last_error(saved_ctx);
  14513. return manage(res);
  14514. }
  14515. isl::multi_val multi_val::scale(isl::multi_val mv) const
  14516. {
  14517. if (!ptr || mv.is_null())
  14518. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14519. auto saved_ctx = ctx();
  14520. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14521. auto res = isl_multi_val_scale_multi_val(copy(), mv.release());
  14522. if (!res)
  14523. exception::throw_last_error(saved_ctx);
  14524. return manage(res);
  14525. }
  14526. isl::multi_val multi_val::scale(isl::val v) const
  14527. {
  14528. if (!ptr || v.is_null())
  14529. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14530. auto saved_ctx = ctx();
  14531. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14532. auto res = isl_multi_val_scale_val(copy(), v.release());
  14533. if (!res)
  14534. exception::throw_last_error(saved_ctx);
  14535. return manage(res);
  14536. }
  14537. isl::multi_val multi_val::scale(long v) const
  14538. {
  14539. if (!ptr)
  14540. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14541. return this->scale(isl::val(ctx(), v));
  14542. }
  14543. isl::multi_val multi_val::scale_down(isl::multi_val mv) const
  14544. {
  14545. if (!ptr || mv.is_null())
  14546. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14547. auto saved_ctx = ctx();
  14548. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14549. auto res = isl_multi_val_scale_down_multi_val(copy(), mv.release());
  14550. if (!res)
  14551. exception::throw_last_error(saved_ctx);
  14552. return manage(res);
  14553. }
  14554. isl::multi_val multi_val::scale_down(isl::val v) const
  14555. {
  14556. if (!ptr || v.is_null())
  14557. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14558. auto saved_ctx = ctx();
  14559. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14560. auto res = isl_multi_val_scale_down_val(copy(), v.release());
  14561. if (!res)
  14562. exception::throw_last_error(saved_ctx);
  14563. return manage(res);
  14564. }
  14565. isl::multi_val multi_val::scale_down(long v) const
  14566. {
  14567. if (!ptr)
  14568. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14569. return this->scale_down(isl::val(ctx(), v));
  14570. }
  14571. isl::multi_val multi_val::set_at(int pos, isl::val el) const
  14572. {
  14573. if (!ptr || el.is_null())
  14574. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14575. auto saved_ctx = ctx();
  14576. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14577. auto res = isl_multi_val_set_at(copy(), pos, el.release());
  14578. if (!res)
  14579. exception::throw_last_error(saved_ctx);
  14580. return manage(res);
  14581. }
  14582. isl::multi_val multi_val::set_at(int pos, long el) const
  14583. {
  14584. if (!ptr)
  14585. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14586. return this->set_at(pos, isl::val(ctx(), el));
  14587. }
  14588. isl::multi_val multi_val::set_range_tuple(isl::id id) const
  14589. {
  14590. if (!ptr || id.is_null())
  14591. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14592. auto saved_ctx = ctx();
  14593. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14594. auto res = isl_multi_val_set_range_tuple_id(copy(), id.release());
  14595. if (!res)
  14596. exception::throw_last_error(saved_ctx);
  14597. return manage(res);
  14598. }
  14599. isl::multi_val multi_val::set_range_tuple(const std::string &id) const
  14600. {
  14601. if (!ptr)
  14602. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14603. return this->set_range_tuple(isl::id(ctx(), id));
  14604. }
  14605. unsigned multi_val::size() const
  14606. {
  14607. if (!ptr)
  14608. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14609. auto saved_ctx = ctx();
  14610. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14611. auto res = isl_multi_val_size(get());
  14612. if (res < 0)
  14613. exception::throw_last_error(saved_ctx);
  14614. return res;
  14615. }
  14616. isl::space multi_val::space() const
  14617. {
  14618. if (!ptr)
  14619. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14620. auto saved_ctx = ctx();
  14621. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14622. auto res = isl_multi_val_get_space(get());
  14623. if (!res)
  14624. exception::throw_last_error(saved_ctx);
  14625. return manage(res);
  14626. }
  14627. isl::space multi_val::get_space() const
  14628. {
  14629. return space();
  14630. }
  14631. isl::multi_val multi_val::sub(isl::multi_val multi2) const
  14632. {
  14633. if (!ptr || multi2.is_null())
  14634. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14635. auto saved_ctx = ctx();
  14636. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14637. auto res = isl_multi_val_sub(copy(), multi2.release());
  14638. if (!res)
  14639. exception::throw_last_error(saved_ctx);
  14640. return manage(res);
  14641. }
  14642. isl::multi_val multi_val::zero(isl::space space)
  14643. {
  14644. if (space.is_null())
  14645. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14646. auto saved_ctx = space.ctx();
  14647. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14648. auto res = isl_multi_val_zero(space.release());
  14649. if (!res)
  14650. exception::throw_last_error(saved_ctx);
  14651. return manage(res);
  14652. }
  14653. inline std::ostream &operator<<(std::ostream &os, const multi_val &obj)
  14654. {
  14655. if (!obj.get())
  14656. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14657. auto saved_ctx = isl_multi_val_get_ctx(obj.get());
  14658. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14659. char *str = isl_multi_val_to_str(obj.get());
  14660. if (!str)
  14661. exception::throw_last_error(saved_ctx);
  14662. os << str;
  14663. free(str);
  14664. return os;
  14665. }
  14666. // implementations for isl::point
  14667. point manage(__isl_take isl_point *ptr) {
  14668. if (!ptr)
  14669. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14670. return point(ptr);
  14671. }
  14672. point manage_copy(__isl_keep isl_point *ptr) {
  14673. if (!ptr)
  14674. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14675. auto saved_ctx = isl_point_get_ctx(ptr);
  14676. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14677. ptr = isl_point_copy(ptr);
  14678. if (!ptr)
  14679. exception::throw_last_error(saved_ctx);
  14680. return point(ptr);
  14681. }
  14682. point::point(__isl_take isl_point *ptr)
  14683. : ptr(ptr) {}
  14684. point::point()
  14685. : ptr(nullptr) {}
  14686. point::point(const point &obj)
  14687. : ptr(nullptr)
  14688. {
  14689. if (!obj.ptr)
  14690. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14691. auto saved_ctx = isl_point_get_ctx(obj.ptr);
  14692. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  14693. ptr = obj.copy();
  14694. if (!ptr)
  14695. exception::throw_last_error(saved_ctx);
  14696. }
  14697. point &point::operator=(point obj) {
  14698. std::swap(this->ptr, obj.ptr);
  14699. return *this;
  14700. }
  14701. point::~point() {
  14702. if (ptr)
  14703. isl_point_free(ptr);
  14704. }
  14705. __isl_give isl_point *point::copy() const & {
  14706. return isl_point_copy(ptr);
  14707. }
  14708. __isl_keep isl_point *point::get() const {
  14709. return ptr;
  14710. }
  14711. __isl_give isl_point *point::release() {
  14712. isl_point *tmp = ptr;
  14713. ptr = nullptr;
  14714. return tmp;
  14715. }
  14716. bool point::is_null() const {
  14717. return ptr == nullptr;
  14718. }
  14719. isl::ctx point::ctx() const {
  14720. return isl::ctx(isl_point_get_ctx(ptr));
  14721. }
  14722. isl::basic_set point::affine_hull() const
  14723. {
  14724. if (!ptr)
  14725. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14726. return isl::basic_set(*this).affine_hull();
  14727. }
  14728. isl::basic_set point::apply(const isl::basic_map &bmap) const
  14729. {
  14730. if (!ptr)
  14731. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14732. return isl::basic_set(*this).apply(bmap);
  14733. }
  14734. isl::set point::apply(const isl::map &map) const
  14735. {
  14736. if (!ptr)
  14737. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14738. return isl::basic_set(*this).apply(map);
  14739. }
  14740. isl::union_set point::apply(const isl::union_map &umap) const
  14741. {
  14742. if (!ptr)
  14743. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14744. return isl::basic_set(*this).apply(umap);
  14745. }
  14746. isl::pw_multi_aff point::as_pw_multi_aff() const
  14747. {
  14748. if (!ptr)
  14749. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14750. return isl::basic_set(*this).as_pw_multi_aff();
  14751. }
  14752. isl::set point::as_set() const
  14753. {
  14754. if (!ptr)
  14755. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14756. return isl::basic_set(*this).as_set();
  14757. }
  14758. isl::set point::bind(const isl::multi_id &tuple) const
  14759. {
  14760. if (!ptr)
  14761. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14762. return isl::basic_set(*this).bind(tuple);
  14763. }
  14764. isl::set point::coalesce() const
  14765. {
  14766. if (!ptr)
  14767. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14768. return isl::basic_set(*this).coalesce();
  14769. }
  14770. isl::set point::complement() const
  14771. {
  14772. if (!ptr)
  14773. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14774. return isl::basic_set(*this).complement();
  14775. }
  14776. isl::union_set point::compute_divs() const
  14777. {
  14778. if (!ptr)
  14779. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14780. return isl::basic_set(*this).compute_divs();
  14781. }
  14782. isl::basic_set point::detect_equalities() const
  14783. {
  14784. if (!ptr)
  14785. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14786. return isl::basic_set(*this).detect_equalities();
  14787. }
  14788. isl::val point::dim_max_val(int pos) const
  14789. {
  14790. if (!ptr)
  14791. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14792. return isl::basic_set(*this).dim_max_val(pos);
  14793. }
  14794. isl::val point::dim_min_val(int pos) const
  14795. {
  14796. if (!ptr)
  14797. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14798. return isl::basic_set(*this).dim_min_val(pos);
  14799. }
  14800. bool point::every_set(const std::function<bool(isl::set)> &test) const
  14801. {
  14802. if (!ptr)
  14803. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14804. return isl::basic_set(*this).every_set(test);
  14805. }
  14806. isl::set point::extract_set(const isl::space &space) const
  14807. {
  14808. if (!ptr)
  14809. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14810. return isl::basic_set(*this).extract_set(space);
  14811. }
  14812. isl::basic_set point::flatten() const
  14813. {
  14814. if (!ptr)
  14815. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14816. return isl::basic_set(*this).flatten();
  14817. }
  14818. void point::foreach_basic_set(const std::function<void(isl::basic_set)> &fn) const
  14819. {
  14820. if (!ptr)
  14821. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14822. return isl::basic_set(*this).foreach_basic_set(fn);
  14823. }
  14824. void point::foreach_point(const std::function<void(isl::point)> &fn) const
  14825. {
  14826. if (!ptr)
  14827. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14828. return isl::basic_set(*this).foreach_point(fn);
  14829. }
  14830. void point::foreach_set(const std::function<void(isl::set)> &fn) const
  14831. {
  14832. if (!ptr)
  14833. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14834. return isl::basic_set(*this).foreach_set(fn);
  14835. }
  14836. isl::basic_set point::gist(const isl::basic_set &context) const
  14837. {
  14838. if (!ptr)
  14839. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14840. return isl::basic_set(*this).gist(context);
  14841. }
  14842. isl::set point::gist(const isl::set &context) const
  14843. {
  14844. if (!ptr)
  14845. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14846. return isl::basic_set(*this).gist(context);
  14847. }
  14848. isl::union_set point::gist(const isl::union_set &context) const
  14849. {
  14850. if (!ptr)
  14851. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14852. return isl::basic_set(*this).gist(context);
  14853. }
  14854. isl::set point::gist_params(const isl::set &context) const
  14855. {
  14856. if (!ptr)
  14857. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14858. return isl::basic_set(*this).gist_params(context);
  14859. }
  14860. isl::map point::identity() const
  14861. {
  14862. if (!ptr)
  14863. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14864. return isl::basic_set(*this).identity();
  14865. }
  14866. isl::pw_aff point::indicator_function() const
  14867. {
  14868. if (!ptr)
  14869. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14870. return isl::basic_set(*this).indicator_function();
  14871. }
  14872. isl::map point::insert_domain(const isl::space &domain) const
  14873. {
  14874. if (!ptr)
  14875. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14876. return isl::basic_set(*this).insert_domain(domain);
  14877. }
  14878. isl::basic_set point::intersect(const isl::basic_set &bset2) const
  14879. {
  14880. if (!ptr)
  14881. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14882. return isl::basic_set(*this).intersect(bset2);
  14883. }
  14884. isl::set point::intersect(const isl::set &set2) const
  14885. {
  14886. if (!ptr)
  14887. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14888. return isl::basic_set(*this).intersect(set2);
  14889. }
  14890. isl::union_set point::intersect(const isl::union_set &uset2) const
  14891. {
  14892. if (!ptr)
  14893. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14894. return isl::basic_set(*this).intersect(uset2);
  14895. }
  14896. isl::basic_set point::intersect_params(const isl::basic_set &bset2) const
  14897. {
  14898. if (!ptr)
  14899. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14900. return isl::basic_set(*this).intersect_params(bset2);
  14901. }
  14902. isl::set point::intersect_params(const isl::set &params) const
  14903. {
  14904. if (!ptr)
  14905. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14906. return isl::basic_set(*this).intersect_params(params);
  14907. }
  14908. bool point::involves_locals() const
  14909. {
  14910. if (!ptr)
  14911. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14912. return isl::basic_set(*this).involves_locals();
  14913. }
  14914. bool point::is_disjoint(const isl::set &set2) const
  14915. {
  14916. if (!ptr)
  14917. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14918. return isl::basic_set(*this).is_disjoint(set2);
  14919. }
  14920. bool point::is_disjoint(const isl::union_set &uset2) const
  14921. {
  14922. if (!ptr)
  14923. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14924. return isl::basic_set(*this).is_disjoint(uset2);
  14925. }
  14926. bool point::is_empty() const
  14927. {
  14928. if (!ptr)
  14929. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14930. return isl::basic_set(*this).is_empty();
  14931. }
  14932. bool point::is_equal(const isl::basic_set &bset2) const
  14933. {
  14934. if (!ptr)
  14935. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14936. return isl::basic_set(*this).is_equal(bset2);
  14937. }
  14938. bool point::is_equal(const isl::set &set2) const
  14939. {
  14940. if (!ptr)
  14941. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14942. return isl::basic_set(*this).is_equal(set2);
  14943. }
  14944. bool point::is_equal(const isl::union_set &uset2) const
  14945. {
  14946. if (!ptr)
  14947. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14948. return isl::basic_set(*this).is_equal(uset2);
  14949. }
  14950. bool point::is_singleton() const
  14951. {
  14952. if (!ptr)
  14953. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14954. return isl::basic_set(*this).is_singleton();
  14955. }
  14956. bool point::is_strict_subset(const isl::set &set2) const
  14957. {
  14958. if (!ptr)
  14959. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14960. return isl::basic_set(*this).is_strict_subset(set2);
  14961. }
  14962. bool point::is_strict_subset(const isl::union_set &uset2) const
  14963. {
  14964. if (!ptr)
  14965. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14966. return isl::basic_set(*this).is_strict_subset(uset2);
  14967. }
  14968. bool point::is_subset(const isl::basic_set &bset2) const
  14969. {
  14970. if (!ptr)
  14971. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14972. return isl::basic_set(*this).is_subset(bset2);
  14973. }
  14974. bool point::is_subset(const isl::set &set2) const
  14975. {
  14976. if (!ptr)
  14977. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14978. return isl::basic_set(*this).is_subset(set2);
  14979. }
  14980. bool point::is_subset(const isl::union_set &uset2) const
  14981. {
  14982. if (!ptr)
  14983. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14984. return isl::basic_set(*this).is_subset(uset2);
  14985. }
  14986. bool point::is_wrapping() const
  14987. {
  14988. if (!ptr)
  14989. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14990. return isl::basic_set(*this).is_wrapping();
  14991. }
  14992. bool point::isa_set() const
  14993. {
  14994. if (!ptr)
  14995. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  14996. return isl::basic_set(*this).isa_set();
  14997. }
  14998. isl::fixed_box point::lattice_tile() const
  14999. {
  15000. if (!ptr)
  15001. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15002. return isl::basic_set(*this).lattice_tile();
  15003. }
  15004. isl::set point::lexmax() const
  15005. {
  15006. if (!ptr)
  15007. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15008. return isl::basic_set(*this).lexmax();
  15009. }
  15010. isl::pw_multi_aff point::lexmax_pw_multi_aff() const
  15011. {
  15012. if (!ptr)
  15013. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15014. return isl::basic_set(*this).lexmax_pw_multi_aff();
  15015. }
  15016. isl::set point::lexmin() const
  15017. {
  15018. if (!ptr)
  15019. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15020. return isl::basic_set(*this).lexmin();
  15021. }
  15022. isl::pw_multi_aff point::lexmin_pw_multi_aff() const
  15023. {
  15024. if (!ptr)
  15025. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15026. return isl::basic_set(*this).lexmin_pw_multi_aff();
  15027. }
  15028. isl::set point::lower_bound(const isl::multi_pw_aff &lower) const
  15029. {
  15030. if (!ptr)
  15031. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15032. return isl::basic_set(*this).lower_bound(lower);
  15033. }
  15034. isl::set point::lower_bound(const isl::multi_val &lower) const
  15035. {
  15036. if (!ptr)
  15037. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15038. return isl::basic_set(*this).lower_bound(lower);
  15039. }
  15040. isl::multi_pw_aff point::max_multi_pw_aff() const
  15041. {
  15042. if (!ptr)
  15043. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15044. return isl::basic_set(*this).max_multi_pw_aff();
  15045. }
  15046. isl::val point::max_val(const isl::aff &obj) const
  15047. {
  15048. if (!ptr)
  15049. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15050. return isl::basic_set(*this).max_val(obj);
  15051. }
  15052. isl::multi_pw_aff point::min_multi_pw_aff() const
  15053. {
  15054. if (!ptr)
  15055. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15056. return isl::basic_set(*this).min_multi_pw_aff();
  15057. }
  15058. isl::val point::min_val(const isl::aff &obj) const
  15059. {
  15060. if (!ptr)
  15061. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15062. return isl::basic_set(*this).min_val(obj);
  15063. }
  15064. isl::multi_val point::multi_val() const
  15065. {
  15066. if (!ptr)
  15067. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15068. auto saved_ctx = ctx();
  15069. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15070. auto res = isl_point_get_multi_val(get());
  15071. if (!res)
  15072. exception::throw_last_error(saved_ctx);
  15073. return manage(res);
  15074. }
  15075. isl::multi_val point::get_multi_val() const
  15076. {
  15077. return multi_val();
  15078. }
  15079. unsigned point::n_basic_set() const
  15080. {
  15081. if (!ptr)
  15082. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15083. return isl::basic_set(*this).n_basic_set();
  15084. }
  15085. isl::pw_aff point::param_pw_aff_on_domain(const isl::id &id) const
  15086. {
  15087. if (!ptr)
  15088. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15089. return isl::basic_set(*this).param_pw_aff_on_domain(id);
  15090. }
  15091. isl::pw_aff point::param_pw_aff_on_domain(const std::string &id) const
  15092. {
  15093. if (!ptr)
  15094. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15095. return this->param_pw_aff_on_domain(isl::id(ctx(), id));
  15096. }
  15097. isl::basic_set point::params() const
  15098. {
  15099. if (!ptr)
  15100. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15101. return isl::basic_set(*this).params();
  15102. }
  15103. isl::multi_val point::plain_multi_val_if_fixed() const
  15104. {
  15105. if (!ptr)
  15106. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15107. return isl::basic_set(*this).plain_multi_val_if_fixed();
  15108. }
  15109. isl::basic_set point::polyhedral_hull() const
  15110. {
  15111. if (!ptr)
  15112. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15113. return isl::basic_set(*this).polyhedral_hull();
  15114. }
  15115. isl::set point::preimage(const isl::multi_aff &ma) const
  15116. {
  15117. if (!ptr)
  15118. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15119. return isl::basic_set(*this).preimage(ma);
  15120. }
  15121. isl::set point::preimage(const isl::multi_pw_aff &mpa) const
  15122. {
  15123. if (!ptr)
  15124. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15125. return isl::basic_set(*this).preimage(mpa);
  15126. }
  15127. isl::set point::preimage(const isl::pw_multi_aff &pma) const
  15128. {
  15129. if (!ptr)
  15130. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15131. return isl::basic_set(*this).preimage(pma);
  15132. }
  15133. isl::union_set point::preimage(const isl::union_pw_multi_aff &upma) const
  15134. {
  15135. if (!ptr)
  15136. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15137. return isl::basic_set(*this).preimage(upma);
  15138. }
  15139. isl::set point::product(const isl::set &set2) const
  15140. {
  15141. if (!ptr)
  15142. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15143. return isl::basic_set(*this).product(set2);
  15144. }
  15145. isl::set point::project_out_all_params() const
  15146. {
  15147. if (!ptr)
  15148. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15149. return isl::basic_set(*this).project_out_all_params();
  15150. }
  15151. isl::set point::project_out_param(const isl::id &id) const
  15152. {
  15153. if (!ptr)
  15154. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15155. return isl::basic_set(*this).project_out_param(id);
  15156. }
  15157. isl::set point::project_out_param(const std::string &id) const
  15158. {
  15159. if (!ptr)
  15160. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15161. return this->project_out_param(isl::id(ctx(), id));
  15162. }
  15163. isl::set point::project_out_param(const isl::id_list &list) const
  15164. {
  15165. if (!ptr)
  15166. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15167. return isl::basic_set(*this).project_out_param(list);
  15168. }
  15169. isl::pw_aff point::pw_aff_on_domain(const isl::val &v) const
  15170. {
  15171. if (!ptr)
  15172. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15173. return isl::basic_set(*this).pw_aff_on_domain(v);
  15174. }
  15175. isl::pw_aff point::pw_aff_on_domain(long v) const
  15176. {
  15177. if (!ptr)
  15178. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15179. return this->pw_aff_on_domain(isl::val(ctx(), v));
  15180. }
  15181. isl::pw_multi_aff point::pw_multi_aff_on_domain(const isl::multi_val &mv) const
  15182. {
  15183. if (!ptr)
  15184. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15185. return isl::basic_set(*this).pw_multi_aff_on_domain(mv);
  15186. }
  15187. isl::basic_set point::sample() const
  15188. {
  15189. if (!ptr)
  15190. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15191. return isl::basic_set(*this).sample();
  15192. }
  15193. isl::point point::sample_point() const
  15194. {
  15195. if (!ptr)
  15196. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15197. return isl::basic_set(*this).sample_point();
  15198. }
  15199. isl::set_list point::set_list() const
  15200. {
  15201. if (!ptr)
  15202. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15203. return isl::basic_set(*this).set_list();
  15204. }
  15205. isl::fixed_box point::simple_fixed_box_hull() const
  15206. {
  15207. if (!ptr)
  15208. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15209. return isl::basic_set(*this).simple_fixed_box_hull();
  15210. }
  15211. isl::space point::space() const
  15212. {
  15213. if (!ptr)
  15214. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15215. return isl::basic_set(*this).space();
  15216. }
  15217. isl::val point::stride(int pos) const
  15218. {
  15219. if (!ptr)
  15220. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15221. return isl::basic_set(*this).stride(pos);
  15222. }
  15223. isl::set point::subtract(const isl::set &set2) const
  15224. {
  15225. if (!ptr)
  15226. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15227. return isl::basic_set(*this).subtract(set2);
  15228. }
  15229. isl::union_set point::subtract(const isl::union_set &uset2) const
  15230. {
  15231. if (!ptr)
  15232. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15233. return isl::basic_set(*this).subtract(uset2);
  15234. }
  15235. isl::set_list point::to_list() const
  15236. {
  15237. if (!ptr)
  15238. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15239. return isl::basic_set(*this).to_list();
  15240. }
  15241. isl::set point::to_set() const
  15242. {
  15243. if (!ptr)
  15244. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15245. auto saved_ctx = ctx();
  15246. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15247. auto res = isl_point_to_set(copy());
  15248. if (!res)
  15249. exception::throw_last_error(saved_ctx);
  15250. return manage(res);
  15251. }
  15252. isl::union_set point::to_union_set() const
  15253. {
  15254. if (!ptr)
  15255. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15256. return isl::basic_set(*this).to_union_set();
  15257. }
  15258. isl::map point::translation() const
  15259. {
  15260. if (!ptr)
  15261. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15262. return isl::basic_set(*this).translation();
  15263. }
  15264. unsigned point::tuple_dim() const
  15265. {
  15266. if (!ptr)
  15267. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15268. return isl::basic_set(*this).tuple_dim();
  15269. }
  15270. isl::set point::unbind_params(const isl::multi_id &tuple) const
  15271. {
  15272. if (!ptr)
  15273. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15274. return isl::basic_set(*this).unbind_params(tuple);
  15275. }
  15276. isl::map point::unbind_params_insert_domain(const isl::multi_id &domain) const
  15277. {
  15278. if (!ptr)
  15279. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15280. return isl::basic_set(*this).unbind_params_insert_domain(domain);
  15281. }
  15282. isl::set point::unite(const isl::basic_set &bset2) const
  15283. {
  15284. if (!ptr)
  15285. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15286. return isl::basic_set(*this).unite(bset2);
  15287. }
  15288. isl::set point::unite(const isl::set &set2) const
  15289. {
  15290. if (!ptr)
  15291. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15292. return isl::basic_set(*this).unite(set2);
  15293. }
  15294. isl::union_set point::unite(const isl::union_set &uset2) const
  15295. {
  15296. if (!ptr)
  15297. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15298. return isl::basic_set(*this).unite(uset2);
  15299. }
  15300. isl::basic_set point::unshifted_simple_hull() const
  15301. {
  15302. if (!ptr)
  15303. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15304. return isl::basic_set(*this).unshifted_simple_hull();
  15305. }
  15306. isl::map point::unwrap() const
  15307. {
  15308. if (!ptr)
  15309. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15310. return isl::basic_set(*this).unwrap();
  15311. }
  15312. isl::set point::upper_bound(const isl::multi_pw_aff &upper) const
  15313. {
  15314. if (!ptr)
  15315. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15316. return isl::basic_set(*this).upper_bound(upper);
  15317. }
  15318. isl::set point::upper_bound(const isl::multi_val &upper) const
  15319. {
  15320. if (!ptr)
  15321. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15322. return isl::basic_set(*this).upper_bound(upper);
  15323. }
  15324. inline std::ostream &operator<<(std::ostream &os, const point &obj)
  15325. {
  15326. if (!obj.get())
  15327. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15328. auto saved_ctx = isl_point_get_ctx(obj.get());
  15329. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15330. char *str = isl_point_to_str(obj.get());
  15331. if (!str)
  15332. exception::throw_last_error(saved_ctx);
  15333. os << str;
  15334. free(str);
  15335. return os;
  15336. }
  15337. // implementations for isl::pw_aff
  15338. pw_aff manage(__isl_take isl_pw_aff *ptr) {
  15339. if (!ptr)
  15340. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15341. return pw_aff(ptr);
  15342. }
  15343. pw_aff manage_copy(__isl_keep isl_pw_aff *ptr) {
  15344. if (!ptr)
  15345. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15346. auto saved_ctx = isl_pw_aff_get_ctx(ptr);
  15347. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15348. ptr = isl_pw_aff_copy(ptr);
  15349. if (!ptr)
  15350. exception::throw_last_error(saved_ctx);
  15351. return pw_aff(ptr);
  15352. }
  15353. pw_aff::pw_aff(__isl_take isl_pw_aff *ptr)
  15354. : ptr(ptr) {}
  15355. pw_aff::pw_aff()
  15356. : ptr(nullptr) {}
  15357. pw_aff::pw_aff(const pw_aff &obj)
  15358. : ptr(nullptr)
  15359. {
  15360. if (!obj.ptr)
  15361. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15362. auto saved_ctx = isl_pw_aff_get_ctx(obj.ptr);
  15363. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15364. ptr = obj.copy();
  15365. if (!ptr)
  15366. exception::throw_last_error(saved_ctx);
  15367. }
  15368. pw_aff::pw_aff(isl::aff aff)
  15369. {
  15370. if (aff.is_null())
  15371. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15372. auto saved_ctx = aff.ctx();
  15373. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15374. auto res = isl_pw_aff_from_aff(aff.release());
  15375. if (!res)
  15376. exception::throw_last_error(saved_ctx);
  15377. ptr = res;
  15378. }
  15379. pw_aff::pw_aff(isl::ctx ctx, const std::string &str)
  15380. {
  15381. auto saved_ctx = ctx;
  15382. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15383. auto res = isl_pw_aff_read_from_str(ctx.release(), str.c_str());
  15384. if (!res)
  15385. exception::throw_last_error(saved_ctx);
  15386. ptr = res;
  15387. }
  15388. pw_aff &pw_aff::operator=(pw_aff obj) {
  15389. std::swap(this->ptr, obj.ptr);
  15390. return *this;
  15391. }
  15392. pw_aff::~pw_aff() {
  15393. if (ptr)
  15394. isl_pw_aff_free(ptr);
  15395. }
  15396. __isl_give isl_pw_aff *pw_aff::copy() const & {
  15397. return isl_pw_aff_copy(ptr);
  15398. }
  15399. __isl_keep isl_pw_aff *pw_aff::get() const {
  15400. return ptr;
  15401. }
  15402. __isl_give isl_pw_aff *pw_aff::release() {
  15403. isl_pw_aff *tmp = ptr;
  15404. ptr = nullptr;
  15405. return tmp;
  15406. }
  15407. bool pw_aff::is_null() const {
  15408. return ptr == nullptr;
  15409. }
  15410. isl::ctx pw_aff::ctx() const {
  15411. return isl::ctx(isl_pw_aff_get_ctx(ptr));
  15412. }
  15413. isl::multi_pw_aff pw_aff::add(const isl::multi_pw_aff &multi2) const
  15414. {
  15415. if (!ptr)
  15416. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15417. return isl::pw_multi_aff(*this).add(multi2);
  15418. }
  15419. isl::multi_union_pw_aff pw_aff::add(const isl::multi_union_pw_aff &multi2) const
  15420. {
  15421. if (!ptr)
  15422. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15423. return isl::union_pw_aff(*this).add(multi2);
  15424. }
  15425. isl::pw_aff pw_aff::add(isl::pw_aff pwaff2) const
  15426. {
  15427. if (!ptr || pwaff2.is_null())
  15428. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15429. auto saved_ctx = ctx();
  15430. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15431. auto res = isl_pw_aff_add(copy(), pwaff2.release());
  15432. if (!res)
  15433. exception::throw_last_error(saved_ctx);
  15434. return manage(res);
  15435. }
  15436. isl::pw_multi_aff pw_aff::add(const isl::pw_multi_aff &pma2) const
  15437. {
  15438. if (!ptr)
  15439. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15440. return isl::pw_multi_aff(*this).add(pma2);
  15441. }
  15442. isl::union_pw_aff pw_aff::add(const isl::union_pw_aff &upa2) const
  15443. {
  15444. if (!ptr)
  15445. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15446. return isl::union_pw_aff(*this).add(upa2);
  15447. }
  15448. isl::union_pw_multi_aff pw_aff::add(const isl::union_pw_multi_aff &upma2) const
  15449. {
  15450. if (!ptr)
  15451. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15452. return isl::union_pw_aff(*this).add(upma2);
  15453. }
  15454. isl::pw_aff pw_aff::add(const isl::aff &pwaff2) const
  15455. {
  15456. if (!ptr)
  15457. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15458. return this->add(isl::pw_aff(pwaff2));
  15459. }
  15460. isl::pw_aff pw_aff::add_constant(isl::val v) const
  15461. {
  15462. if (!ptr || v.is_null())
  15463. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15464. auto saved_ctx = ctx();
  15465. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15466. auto res = isl_pw_aff_add_constant_val(copy(), v.release());
  15467. if (!res)
  15468. exception::throw_last_error(saved_ctx);
  15469. return manage(res);
  15470. }
  15471. isl::pw_aff pw_aff::add_constant(long v) const
  15472. {
  15473. if (!ptr)
  15474. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15475. return this->add_constant(isl::val(ctx(), v));
  15476. }
  15477. isl::pw_multi_aff pw_aff::add_constant(const isl::multi_val &mv) const
  15478. {
  15479. if (!ptr)
  15480. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15481. return isl::pw_multi_aff(*this).add_constant(mv);
  15482. }
  15483. isl::union_pw_multi_aff pw_aff::apply(const isl::union_pw_multi_aff &upma2) const
  15484. {
  15485. if (!ptr)
  15486. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15487. return isl::union_pw_aff(*this).apply(upma2);
  15488. }
  15489. isl::aff pw_aff::as_aff() const
  15490. {
  15491. if (!ptr)
  15492. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15493. auto saved_ctx = ctx();
  15494. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15495. auto res = isl_pw_aff_as_aff(copy());
  15496. if (!res)
  15497. exception::throw_last_error(saved_ctx);
  15498. return manage(res);
  15499. }
  15500. isl::map pw_aff::as_map() const
  15501. {
  15502. if (!ptr)
  15503. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15504. auto saved_ctx = ctx();
  15505. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15506. auto res = isl_pw_aff_as_map(copy());
  15507. if (!res)
  15508. exception::throw_last_error(saved_ctx);
  15509. return manage(res);
  15510. }
  15511. isl::multi_aff pw_aff::as_multi_aff() const
  15512. {
  15513. if (!ptr)
  15514. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15515. return isl::pw_multi_aff(*this).as_multi_aff();
  15516. }
  15517. isl::multi_union_pw_aff pw_aff::as_multi_union_pw_aff() const
  15518. {
  15519. if (!ptr)
  15520. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15521. return isl::union_pw_aff(*this).as_multi_union_pw_aff();
  15522. }
  15523. isl::pw_multi_aff pw_aff::as_pw_multi_aff() const
  15524. {
  15525. if (!ptr)
  15526. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15527. return isl::union_pw_aff(*this).as_pw_multi_aff();
  15528. }
  15529. isl::set pw_aff::as_set() const
  15530. {
  15531. if (!ptr)
  15532. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15533. return isl::pw_multi_aff(*this).as_set();
  15534. }
  15535. isl::union_map pw_aff::as_union_map() const
  15536. {
  15537. if (!ptr)
  15538. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15539. return isl::union_pw_aff(*this).as_union_map();
  15540. }
  15541. isl::pw_aff pw_aff::at(int pos) const
  15542. {
  15543. if (!ptr)
  15544. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15545. return isl::pw_multi_aff(*this).at(pos);
  15546. }
  15547. isl::set pw_aff::bind(const isl::multi_id &tuple) const
  15548. {
  15549. if (!ptr)
  15550. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15551. return isl::multi_pw_aff(*this).bind(tuple);
  15552. }
  15553. isl::set pw_aff::bind(isl::id id) const
  15554. {
  15555. if (!ptr || id.is_null())
  15556. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15557. auto saved_ctx = ctx();
  15558. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15559. auto res = isl_pw_aff_bind_id(copy(), id.release());
  15560. if (!res)
  15561. exception::throw_last_error(saved_ctx);
  15562. return manage(res);
  15563. }
  15564. isl::set pw_aff::bind(const std::string &id) const
  15565. {
  15566. if (!ptr)
  15567. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15568. return this->bind(isl::id(ctx(), id));
  15569. }
  15570. isl::pw_aff pw_aff::bind_domain(isl::multi_id tuple) const
  15571. {
  15572. if (!ptr || tuple.is_null())
  15573. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15574. auto saved_ctx = ctx();
  15575. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15576. auto res = isl_pw_aff_bind_domain(copy(), tuple.release());
  15577. if (!res)
  15578. exception::throw_last_error(saved_ctx);
  15579. return manage(res);
  15580. }
  15581. isl::pw_aff pw_aff::bind_domain_wrapped_domain(isl::multi_id tuple) const
  15582. {
  15583. if (!ptr || tuple.is_null())
  15584. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15585. auto saved_ctx = ctx();
  15586. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15587. auto res = isl_pw_aff_bind_domain_wrapped_domain(copy(), tuple.release());
  15588. if (!res)
  15589. exception::throw_last_error(saved_ctx);
  15590. return manage(res);
  15591. }
  15592. isl::pw_aff pw_aff::ceil() const
  15593. {
  15594. if (!ptr)
  15595. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15596. auto saved_ctx = ctx();
  15597. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15598. auto res = isl_pw_aff_ceil(copy());
  15599. if (!res)
  15600. exception::throw_last_error(saved_ctx);
  15601. return manage(res);
  15602. }
  15603. isl::pw_aff pw_aff::coalesce() const
  15604. {
  15605. if (!ptr)
  15606. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15607. auto saved_ctx = ctx();
  15608. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15609. auto res = isl_pw_aff_coalesce(copy());
  15610. if (!res)
  15611. exception::throw_last_error(saved_ctx);
  15612. return manage(res);
  15613. }
  15614. isl::pw_aff pw_aff::cond(isl::pw_aff pwaff_true, isl::pw_aff pwaff_false) const
  15615. {
  15616. if (!ptr || pwaff_true.is_null() || pwaff_false.is_null())
  15617. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15618. auto saved_ctx = ctx();
  15619. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15620. auto res = isl_pw_aff_cond(copy(), pwaff_true.release(), pwaff_false.release());
  15621. if (!res)
  15622. exception::throw_last_error(saved_ctx);
  15623. return manage(res);
  15624. }
  15625. isl::pw_aff pw_aff::div(isl::pw_aff pa2) const
  15626. {
  15627. if (!ptr || pa2.is_null())
  15628. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15629. auto saved_ctx = ctx();
  15630. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15631. auto res = isl_pw_aff_div(copy(), pa2.release());
  15632. if (!res)
  15633. exception::throw_last_error(saved_ctx);
  15634. return manage(res);
  15635. }
  15636. isl::set pw_aff::domain() const
  15637. {
  15638. if (!ptr)
  15639. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15640. auto saved_ctx = ctx();
  15641. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15642. auto res = isl_pw_aff_domain(copy());
  15643. if (!res)
  15644. exception::throw_last_error(saved_ctx);
  15645. return manage(res);
  15646. }
  15647. isl::set pw_aff::eq_set(isl::pw_aff pwaff2) const
  15648. {
  15649. if (!ptr || pwaff2.is_null())
  15650. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15651. auto saved_ctx = ctx();
  15652. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15653. auto res = isl_pw_aff_eq_set(copy(), pwaff2.release());
  15654. if (!res)
  15655. exception::throw_last_error(saved_ctx);
  15656. return manage(res);
  15657. }
  15658. isl::val pw_aff::eval(isl::point pnt) const
  15659. {
  15660. if (!ptr || pnt.is_null())
  15661. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15662. auto saved_ctx = ctx();
  15663. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15664. auto res = isl_pw_aff_eval(copy(), pnt.release());
  15665. if (!res)
  15666. exception::throw_last_error(saved_ctx);
  15667. return manage(res);
  15668. }
  15669. isl::pw_multi_aff pw_aff::extract_pw_multi_aff(const isl::space &space) const
  15670. {
  15671. if (!ptr)
  15672. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15673. return isl::union_pw_aff(*this).extract_pw_multi_aff(space);
  15674. }
  15675. isl::multi_pw_aff pw_aff::flat_range_product(const isl::multi_pw_aff &multi2) const
  15676. {
  15677. if (!ptr)
  15678. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15679. return isl::pw_multi_aff(*this).flat_range_product(multi2);
  15680. }
  15681. isl::multi_union_pw_aff pw_aff::flat_range_product(const isl::multi_union_pw_aff &multi2) const
  15682. {
  15683. if (!ptr)
  15684. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15685. return isl::union_pw_aff(*this).flat_range_product(multi2);
  15686. }
  15687. isl::pw_multi_aff pw_aff::flat_range_product(const isl::pw_multi_aff &pma2) const
  15688. {
  15689. if (!ptr)
  15690. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15691. return isl::pw_multi_aff(*this).flat_range_product(pma2);
  15692. }
  15693. isl::union_pw_multi_aff pw_aff::flat_range_product(const isl::union_pw_multi_aff &upma2) const
  15694. {
  15695. if (!ptr)
  15696. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15697. return isl::union_pw_aff(*this).flat_range_product(upma2);
  15698. }
  15699. isl::pw_aff pw_aff::floor() const
  15700. {
  15701. if (!ptr)
  15702. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15703. auto saved_ctx = ctx();
  15704. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15705. auto res = isl_pw_aff_floor(copy());
  15706. if (!res)
  15707. exception::throw_last_error(saved_ctx);
  15708. return manage(res);
  15709. }
  15710. void pw_aff::foreach_piece(const std::function<void(isl::set, isl::multi_aff)> &fn) const
  15711. {
  15712. if (!ptr)
  15713. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15714. return isl::pw_multi_aff(*this).foreach_piece(fn);
  15715. }
  15716. isl::set pw_aff::ge_set(isl::pw_aff pwaff2) const
  15717. {
  15718. if (!ptr || pwaff2.is_null())
  15719. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15720. auto saved_ctx = ctx();
  15721. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15722. auto res = isl_pw_aff_ge_set(copy(), pwaff2.release());
  15723. if (!res)
  15724. exception::throw_last_error(saved_ctx);
  15725. return manage(res);
  15726. }
  15727. isl::pw_aff pw_aff::gist(isl::set context) const
  15728. {
  15729. if (!ptr || context.is_null())
  15730. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15731. auto saved_ctx = ctx();
  15732. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15733. auto res = isl_pw_aff_gist(copy(), context.release());
  15734. if (!res)
  15735. exception::throw_last_error(saved_ctx);
  15736. return manage(res);
  15737. }
  15738. isl::union_pw_aff pw_aff::gist(const isl::union_set &context) const
  15739. {
  15740. if (!ptr)
  15741. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15742. return isl::union_pw_aff(*this).gist(context);
  15743. }
  15744. isl::pw_aff pw_aff::gist(const isl::basic_set &context) const
  15745. {
  15746. if (!ptr)
  15747. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15748. return this->gist(isl::set(context));
  15749. }
  15750. isl::pw_aff pw_aff::gist(const isl::point &context) const
  15751. {
  15752. if (!ptr)
  15753. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15754. return this->gist(isl::set(context));
  15755. }
  15756. isl::pw_aff pw_aff::gist_params(isl::set context) const
  15757. {
  15758. if (!ptr || context.is_null())
  15759. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15760. auto saved_ctx = ctx();
  15761. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15762. auto res = isl_pw_aff_gist_params(copy(), context.release());
  15763. if (!res)
  15764. exception::throw_last_error(saved_ctx);
  15765. return manage(res);
  15766. }
  15767. isl::set pw_aff::gt_set(isl::pw_aff pwaff2) const
  15768. {
  15769. if (!ptr || pwaff2.is_null())
  15770. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15771. auto saved_ctx = ctx();
  15772. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15773. auto res = isl_pw_aff_gt_set(copy(), pwaff2.release());
  15774. if (!res)
  15775. exception::throw_last_error(saved_ctx);
  15776. return manage(res);
  15777. }
  15778. bool pw_aff::has_range_tuple_id() const
  15779. {
  15780. if (!ptr)
  15781. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15782. return isl::pw_multi_aff(*this).has_range_tuple_id();
  15783. }
  15784. isl::multi_pw_aff pw_aff::identity() const
  15785. {
  15786. if (!ptr)
  15787. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15788. return isl::pw_multi_aff(*this).identity();
  15789. }
  15790. isl::pw_aff pw_aff::insert_domain(isl::space domain) const
  15791. {
  15792. if (!ptr || domain.is_null())
  15793. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15794. auto saved_ctx = ctx();
  15795. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15796. auto res = isl_pw_aff_insert_domain(copy(), domain.release());
  15797. if (!res)
  15798. exception::throw_last_error(saved_ctx);
  15799. return manage(res);
  15800. }
  15801. isl::pw_aff pw_aff::intersect_domain(isl::set set) const
  15802. {
  15803. if (!ptr || set.is_null())
  15804. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15805. auto saved_ctx = ctx();
  15806. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15807. auto res = isl_pw_aff_intersect_domain(copy(), set.release());
  15808. if (!res)
  15809. exception::throw_last_error(saved_ctx);
  15810. return manage(res);
  15811. }
  15812. isl::union_pw_aff pw_aff::intersect_domain(const isl::space &space) const
  15813. {
  15814. if (!ptr)
  15815. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15816. return isl::union_pw_aff(*this).intersect_domain(space);
  15817. }
  15818. isl::union_pw_aff pw_aff::intersect_domain(const isl::union_set &uset) const
  15819. {
  15820. if (!ptr)
  15821. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15822. return isl::union_pw_aff(*this).intersect_domain(uset);
  15823. }
  15824. isl::pw_aff pw_aff::intersect_domain(const isl::basic_set &set) const
  15825. {
  15826. if (!ptr)
  15827. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15828. return this->intersect_domain(isl::set(set));
  15829. }
  15830. isl::pw_aff pw_aff::intersect_domain(const isl::point &set) const
  15831. {
  15832. if (!ptr)
  15833. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15834. return this->intersect_domain(isl::set(set));
  15835. }
  15836. isl::union_pw_aff pw_aff::intersect_domain_wrapped_domain(const isl::union_set &uset) const
  15837. {
  15838. if (!ptr)
  15839. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15840. return isl::union_pw_aff(*this).intersect_domain_wrapped_domain(uset);
  15841. }
  15842. isl::union_pw_aff pw_aff::intersect_domain_wrapped_range(const isl::union_set &uset) const
  15843. {
  15844. if (!ptr)
  15845. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15846. return isl::union_pw_aff(*this).intersect_domain_wrapped_range(uset);
  15847. }
  15848. isl::pw_aff pw_aff::intersect_params(isl::set set) const
  15849. {
  15850. if (!ptr || set.is_null())
  15851. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15852. auto saved_ctx = ctx();
  15853. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15854. auto res = isl_pw_aff_intersect_params(copy(), set.release());
  15855. if (!res)
  15856. exception::throw_last_error(saved_ctx);
  15857. return manage(res);
  15858. }
  15859. bool pw_aff::involves_locals() const
  15860. {
  15861. if (!ptr)
  15862. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15863. return isl::pw_multi_aff(*this).involves_locals();
  15864. }
  15865. bool pw_aff::involves_nan() const
  15866. {
  15867. if (!ptr)
  15868. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15869. return isl::multi_pw_aff(*this).involves_nan();
  15870. }
  15871. bool pw_aff::involves_param(const isl::id &id) const
  15872. {
  15873. if (!ptr)
  15874. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15875. return isl::pw_multi_aff(*this).involves_param(id);
  15876. }
  15877. bool pw_aff::involves_param(const std::string &id) const
  15878. {
  15879. if (!ptr)
  15880. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15881. return this->involves_param(isl::id(ctx(), id));
  15882. }
  15883. bool pw_aff::involves_param(const isl::id_list &list) const
  15884. {
  15885. if (!ptr)
  15886. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15887. return isl::pw_multi_aff(*this).involves_param(list);
  15888. }
  15889. bool pw_aff::isa_aff() const
  15890. {
  15891. if (!ptr)
  15892. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15893. auto saved_ctx = ctx();
  15894. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15895. auto res = isl_pw_aff_isa_aff(get());
  15896. if (res < 0)
  15897. exception::throw_last_error(saved_ctx);
  15898. return res;
  15899. }
  15900. bool pw_aff::isa_multi_aff() const
  15901. {
  15902. if (!ptr)
  15903. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15904. return isl::pw_multi_aff(*this).isa_multi_aff();
  15905. }
  15906. bool pw_aff::isa_pw_multi_aff() const
  15907. {
  15908. if (!ptr)
  15909. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15910. return isl::union_pw_aff(*this).isa_pw_multi_aff();
  15911. }
  15912. isl::set pw_aff::le_set(isl::pw_aff pwaff2) const
  15913. {
  15914. if (!ptr || pwaff2.is_null())
  15915. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15916. auto saved_ctx = ctx();
  15917. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15918. auto res = isl_pw_aff_le_set(copy(), pwaff2.release());
  15919. if (!res)
  15920. exception::throw_last_error(saved_ctx);
  15921. return manage(res);
  15922. }
  15923. isl::pw_aff_list pw_aff::list() const
  15924. {
  15925. if (!ptr)
  15926. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15927. return isl::multi_pw_aff(*this).list();
  15928. }
  15929. isl::set pw_aff::lt_set(isl::pw_aff pwaff2) const
  15930. {
  15931. if (!ptr || pwaff2.is_null())
  15932. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15933. auto saved_ctx = ctx();
  15934. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15935. auto res = isl_pw_aff_lt_set(copy(), pwaff2.release());
  15936. if (!res)
  15937. exception::throw_last_error(saved_ctx);
  15938. return manage(res);
  15939. }
  15940. isl::multi_pw_aff pw_aff::max(const isl::multi_pw_aff &multi2) const
  15941. {
  15942. if (!ptr)
  15943. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15944. return isl::pw_multi_aff(*this).max(multi2);
  15945. }
  15946. isl::pw_aff pw_aff::max(isl::pw_aff pwaff2) const
  15947. {
  15948. if (!ptr || pwaff2.is_null())
  15949. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15950. auto saved_ctx = ctx();
  15951. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15952. auto res = isl_pw_aff_max(copy(), pwaff2.release());
  15953. if (!res)
  15954. exception::throw_last_error(saved_ctx);
  15955. return manage(res);
  15956. }
  15957. isl::pw_aff pw_aff::max(const isl::aff &pwaff2) const
  15958. {
  15959. if (!ptr)
  15960. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15961. return this->max(isl::pw_aff(pwaff2));
  15962. }
  15963. isl::multi_val pw_aff::max_multi_val() const
  15964. {
  15965. if (!ptr)
  15966. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15967. return isl::pw_multi_aff(*this).max_multi_val();
  15968. }
  15969. isl::val pw_aff::max_val() const
  15970. {
  15971. if (!ptr)
  15972. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15973. auto saved_ctx = ctx();
  15974. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15975. auto res = isl_pw_aff_max_val(copy());
  15976. if (!res)
  15977. exception::throw_last_error(saved_ctx);
  15978. return manage(res);
  15979. }
  15980. isl::multi_pw_aff pw_aff::min(const isl::multi_pw_aff &multi2) const
  15981. {
  15982. if (!ptr)
  15983. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15984. return isl::pw_multi_aff(*this).min(multi2);
  15985. }
  15986. isl::pw_aff pw_aff::min(isl::pw_aff pwaff2) const
  15987. {
  15988. if (!ptr || pwaff2.is_null())
  15989. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  15990. auto saved_ctx = ctx();
  15991. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  15992. auto res = isl_pw_aff_min(copy(), pwaff2.release());
  15993. if (!res)
  15994. exception::throw_last_error(saved_ctx);
  15995. return manage(res);
  15996. }
  15997. isl::pw_aff pw_aff::min(const isl::aff &pwaff2) const
  15998. {
  15999. if (!ptr)
  16000. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16001. return this->min(isl::pw_aff(pwaff2));
  16002. }
  16003. isl::multi_val pw_aff::min_multi_val() const
  16004. {
  16005. if (!ptr)
  16006. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16007. return isl::pw_multi_aff(*this).min_multi_val();
  16008. }
  16009. isl::val pw_aff::min_val() const
  16010. {
  16011. if (!ptr)
  16012. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16013. auto saved_ctx = ctx();
  16014. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16015. auto res = isl_pw_aff_min_val(copy());
  16016. if (!res)
  16017. exception::throw_last_error(saved_ctx);
  16018. return manage(res);
  16019. }
  16020. isl::pw_aff pw_aff::mod(isl::val mod) const
  16021. {
  16022. if (!ptr || mod.is_null())
  16023. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16024. auto saved_ctx = ctx();
  16025. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16026. auto res = isl_pw_aff_mod_val(copy(), mod.release());
  16027. if (!res)
  16028. exception::throw_last_error(saved_ctx);
  16029. return manage(res);
  16030. }
  16031. isl::pw_aff pw_aff::mod(long mod) const
  16032. {
  16033. if (!ptr)
  16034. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16035. return this->mod(isl::val(ctx(), mod));
  16036. }
  16037. isl::pw_aff pw_aff::mul(isl::pw_aff pwaff2) const
  16038. {
  16039. if (!ptr || pwaff2.is_null())
  16040. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16041. auto saved_ctx = ctx();
  16042. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16043. auto res = isl_pw_aff_mul(copy(), pwaff2.release());
  16044. if (!res)
  16045. exception::throw_last_error(saved_ctx);
  16046. return manage(res);
  16047. }
  16048. unsigned pw_aff::n_piece() const
  16049. {
  16050. if (!ptr)
  16051. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16052. return isl::pw_multi_aff(*this).n_piece();
  16053. }
  16054. isl::set pw_aff::ne_set(isl::pw_aff pwaff2) const
  16055. {
  16056. if (!ptr || pwaff2.is_null())
  16057. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16058. auto saved_ctx = ctx();
  16059. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16060. auto res = isl_pw_aff_ne_set(copy(), pwaff2.release());
  16061. if (!res)
  16062. exception::throw_last_error(saved_ctx);
  16063. return manage(res);
  16064. }
  16065. isl::pw_aff pw_aff::neg() const
  16066. {
  16067. if (!ptr)
  16068. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16069. auto saved_ctx = ctx();
  16070. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16071. auto res = isl_pw_aff_neg(copy());
  16072. if (!res)
  16073. exception::throw_last_error(saved_ctx);
  16074. return manage(res);
  16075. }
  16076. isl::pw_aff pw_aff::param_on_domain(isl::set domain, isl::id id)
  16077. {
  16078. if (domain.is_null() || id.is_null())
  16079. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16080. auto saved_ctx = domain.ctx();
  16081. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16082. auto res = isl_pw_aff_param_on_domain_id(domain.release(), id.release());
  16083. if (!res)
  16084. exception::throw_last_error(saved_ctx);
  16085. return manage(res);
  16086. }
  16087. bool pw_aff::plain_is_empty() const
  16088. {
  16089. if (!ptr)
  16090. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16091. return isl::union_pw_aff(*this).plain_is_empty();
  16092. }
  16093. bool pw_aff::plain_is_equal(const isl::multi_pw_aff &multi2) const
  16094. {
  16095. if (!ptr)
  16096. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16097. return isl::pw_multi_aff(*this).plain_is_equal(multi2);
  16098. }
  16099. bool pw_aff::plain_is_equal(const isl::multi_union_pw_aff &multi2) const
  16100. {
  16101. if (!ptr)
  16102. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16103. return isl::union_pw_aff(*this).plain_is_equal(multi2);
  16104. }
  16105. isl::pw_multi_aff pw_aff::preimage_domain_wrapped_domain(const isl::pw_multi_aff &pma2) const
  16106. {
  16107. if (!ptr)
  16108. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16109. return isl::pw_multi_aff(*this).preimage_domain_wrapped_domain(pma2);
  16110. }
  16111. isl::union_pw_multi_aff pw_aff::preimage_domain_wrapped_domain(const isl::union_pw_multi_aff &upma2) const
  16112. {
  16113. if (!ptr)
  16114. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16115. return isl::union_pw_aff(*this).preimage_domain_wrapped_domain(upma2);
  16116. }
  16117. isl::multi_pw_aff pw_aff::product(const isl::multi_pw_aff &multi2) const
  16118. {
  16119. if (!ptr)
  16120. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16121. return isl::pw_multi_aff(*this).product(multi2);
  16122. }
  16123. isl::pw_multi_aff pw_aff::product(const isl::pw_multi_aff &pma2) const
  16124. {
  16125. if (!ptr)
  16126. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16127. return isl::pw_multi_aff(*this).product(pma2);
  16128. }
  16129. isl::pw_aff pw_aff::pullback(isl::multi_aff ma) const
  16130. {
  16131. if (!ptr || ma.is_null())
  16132. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16133. auto saved_ctx = ctx();
  16134. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16135. auto res = isl_pw_aff_pullback_multi_aff(copy(), ma.release());
  16136. if (!res)
  16137. exception::throw_last_error(saved_ctx);
  16138. return manage(res);
  16139. }
  16140. isl::pw_aff pw_aff::pullback(isl::multi_pw_aff mpa) const
  16141. {
  16142. if (!ptr || mpa.is_null())
  16143. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16144. auto saved_ctx = ctx();
  16145. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16146. auto res = isl_pw_aff_pullback_multi_pw_aff(copy(), mpa.release());
  16147. if (!res)
  16148. exception::throw_last_error(saved_ctx);
  16149. return manage(res);
  16150. }
  16151. isl::pw_aff pw_aff::pullback(isl::pw_multi_aff pma) const
  16152. {
  16153. if (!ptr || pma.is_null())
  16154. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16155. auto saved_ctx = ctx();
  16156. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16157. auto res = isl_pw_aff_pullback_pw_multi_aff(copy(), pma.release());
  16158. if (!res)
  16159. exception::throw_last_error(saved_ctx);
  16160. return manage(res);
  16161. }
  16162. isl::union_pw_aff pw_aff::pullback(const isl::union_pw_multi_aff &upma) const
  16163. {
  16164. if (!ptr)
  16165. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16166. return isl::union_pw_aff(*this).pullback(upma);
  16167. }
  16168. isl::pw_multi_aff_list pw_aff::pw_multi_aff_list() const
  16169. {
  16170. if (!ptr)
  16171. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16172. return isl::union_pw_aff(*this).pw_multi_aff_list();
  16173. }
  16174. isl::pw_multi_aff pw_aff::range_factor_domain() const
  16175. {
  16176. if (!ptr)
  16177. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16178. return isl::pw_multi_aff(*this).range_factor_domain();
  16179. }
  16180. isl::pw_multi_aff pw_aff::range_factor_range() const
  16181. {
  16182. if (!ptr)
  16183. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16184. return isl::pw_multi_aff(*this).range_factor_range();
  16185. }
  16186. isl::multi_pw_aff pw_aff::range_product(const isl::multi_pw_aff &multi2) const
  16187. {
  16188. if (!ptr)
  16189. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16190. return isl::pw_multi_aff(*this).range_product(multi2);
  16191. }
  16192. isl::multi_union_pw_aff pw_aff::range_product(const isl::multi_union_pw_aff &multi2) const
  16193. {
  16194. if (!ptr)
  16195. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16196. return isl::union_pw_aff(*this).range_product(multi2);
  16197. }
  16198. isl::pw_multi_aff pw_aff::range_product(const isl::pw_multi_aff &pma2) const
  16199. {
  16200. if (!ptr)
  16201. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16202. return isl::pw_multi_aff(*this).range_product(pma2);
  16203. }
  16204. isl::union_pw_multi_aff pw_aff::range_product(const isl::union_pw_multi_aff &upma2) const
  16205. {
  16206. if (!ptr)
  16207. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16208. return isl::union_pw_aff(*this).range_product(upma2);
  16209. }
  16210. isl::id pw_aff::range_tuple_id() const
  16211. {
  16212. if (!ptr)
  16213. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16214. return isl::pw_multi_aff(*this).range_tuple_id();
  16215. }
  16216. isl::multi_pw_aff pw_aff::reset_range_tuple_id() const
  16217. {
  16218. if (!ptr)
  16219. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16220. return isl::multi_pw_aff(*this).reset_range_tuple_id();
  16221. }
  16222. isl::pw_aff pw_aff::scale(isl::val v) const
  16223. {
  16224. if (!ptr || v.is_null())
  16225. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16226. auto saved_ctx = ctx();
  16227. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16228. auto res = isl_pw_aff_scale_val(copy(), v.release());
  16229. if (!res)
  16230. exception::throw_last_error(saved_ctx);
  16231. return manage(res);
  16232. }
  16233. isl::pw_aff pw_aff::scale(long v) const
  16234. {
  16235. if (!ptr)
  16236. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16237. return this->scale(isl::val(ctx(), v));
  16238. }
  16239. isl::pw_multi_aff pw_aff::scale(const isl::multi_val &mv) const
  16240. {
  16241. if (!ptr)
  16242. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16243. return isl::pw_multi_aff(*this).scale(mv);
  16244. }
  16245. isl::pw_aff pw_aff::scale_down(isl::val f) const
  16246. {
  16247. if (!ptr || f.is_null())
  16248. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16249. auto saved_ctx = ctx();
  16250. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16251. auto res = isl_pw_aff_scale_down_val(copy(), f.release());
  16252. if (!res)
  16253. exception::throw_last_error(saved_ctx);
  16254. return manage(res);
  16255. }
  16256. isl::pw_aff pw_aff::scale_down(long f) const
  16257. {
  16258. if (!ptr)
  16259. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16260. return this->scale_down(isl::val(ctx(), f));
  16261. }
  16262. isl::pw_multi_aff pw_aff::scale_down(const isl::multi_val &mv) const
  16263. {
  16264. if (!ptr)
  16265. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16266. return isl::pw_multi_aff(*this).scale_down(mv);
  16267. }
  16268. isl::multi_pw_aff pw_aff::set_at(int pos, const isl::pw_aff &el) const
  16269. {
  16270. if (!ptr)
  16271. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16272. return isl::pw_multi_aff(*this).set_at(pos, el);
  16273. }
  16274. isl::multi_union_pw_aff pw_aff::set_at(int pos, const isl::union_pw_aff &el) const
  16275. {
  16276. if (!ptr)
  16277. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16278. return isl::union_pw_aff(*this).set_at(pos, el);
  16279. }
  16280. isl::pw_multi_aff pw_aff::set_range_tuple(const isl::id &id) const
  16281. {
  16282. if (!ptr)
  16283. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16284. return isl::pw_multi_aff(*this).set_range_tuple(id);
  16285. }
  16286. isl::pw_multi_aff pw_aff::set_range_tuple(const std::string &id) const
  16287. {
  16288. if (!ptr)
  16289. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16290. return this->set_range_tuple(isl::id(ctx(), id));
  16291. }
  16292. unsigned pw_aff::size() const
  16293. {
  16294. if (!ptr)
  16295. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16296. return isl::multi_pw_aff(*this).size();
  16297. }
  16298. isl::space pw_aff::space() const
  16299. {
  16300. if (!ptr)
  16301. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16302. auto saved_ctx = ctx();
  16303. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16304. auto res = isl_pw_aff_get_space(get());
  16305. if (!res)
  16306. exception::throw_last_error(saved_ctx);
  16307. return manage(res);
  16308. }
  16309. isl::space pw_aff::get_space() const
  16310. {
  16311. return space();
  16312. }
  16313. isl::multi_pw_aff pw_aff::sub(const isl::multi_pw_aff &multi2) const
  16314. {
  16315. if (!ptr)
  16316. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16317. return isl::pw_multi_aff(*this).sub(multi2);
  16318. }
  16319. isl::multi_union_pw_aff pw_aff::sub(const isl::multi_union_pw_aff &multi2) const
  16320. {
  16321. if (!ptr)
  16322. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16323. return isl::union_pw_aff(*this).sub(multi2);
  16324. }
  16325. isl::pw_aff pw_aff::sub(isl::pw_aff pwaff2) const
  16326. {
  16327. if (!ptr || pwaff2.is_null())
  16328. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16329. auto saved_ctx = ctx();
  16330. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16331. auto res = isl_pw_aff_sub(copy(), pwaff2.release());
  16332. if (!res)
  16333. exception::throw_last_error(saved_ctx);
  16334. return manage(res);
  16335. }
  16336. isl::pw_multi_aff pw_aff::sub(const isl::pw_multi_aff &pma2) const
  16337. {
  16338. if (!ptr)
  16339. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16340. return isl::pw_multi_aff(*this).sub(pma2);
  16341. }
  16342. isl::union_pw_aff pw_aff::sub(const isl::union_pw_aff &upa2) const
  16343. {
  16344. if (!ptr)
  16345. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16346. return isl::union_pw_aff(*this).sub(upa2);
  16347. }
  16348. isl::union_pw_multi_aff pw_aff::sub(const isl::union_pw_multi_aff &upma2) const
  16349. {
  16350. if (!ptr)
  16351. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16352. return isl::union_pw_aff(*this).sub(upma2);
  16353. }
  16354. isl::pw_aff pw_aff::sub(const isl::aff &pwaff2) const
  16355. {
  16356. if (!ptr)
  16357. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16358. return this->sub(isl::pw_aff(pwaff2));
  16359. }
  16360. isl::pw_aff pw_aff::subtract_domain(isl::set set) const
  16361. {
  16362. if (!ptr || set.is_null())
  16363. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16364. auto saved_ctx = ctx();
  16365. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16366. auto res = isl_pw_aff_subtract_domain(copy(), set.release());
  16367. if (!res)
  16368. exception::throw_last_error(saved_ctx);
  16369. return manage(res);
  16370. }
  16371. isl::union_pw_aff pw_aff::subtract_domain(const isl::space &space) const
  16372. {
  16373. if (!ptr)
  16374. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16375. return isl::union_pw_aff(*this).subtract_domain(space);
  16376. }
  16377. isl::union_pw_aff pw_aff::subtract_domain(const isl::union_set &uset) const
  16378. {
  16379. if (!ptr)
  16380. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16381. return isl::union_pw_aff(*this).subtract_domain(uset);
  16382. }
  16383. isl::pw_aff pw_aff::subtract_domain(const isl::basic_set &set) const
  16384. {
  16385. if (!ptr)
  16386. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16387. return this->subtract_domain(isl::set(set));
  16388. }
  16389. isl::pw_aff pw_aff::subtract_domain(const isl::point &set) const
  16390. {
  16391. if (!ptr)
  16392. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16393. return this->subtract_domain(isl::set(set));
  16394. }
  16395. isl::pw_aff pw_aff::tdiv_q(isl::pw_aff pa2) const
  16396. {
  16397. if (!ptr || pa2.is_null())
  16398. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16399. auto saved_ctx = ctx();
  16400. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16401. auto res = isl_pw_aff_tdiv_q(copy(), pa2.release());
  16402. if (!res)
  16403. exception::throw_last_error(saved_ctx);
  16404. return manage(res);
  16405. }
  16406. isl::pw_aff pw_aff::tdiv_r(isl::pw_aff pa2) const
  16407. {
  16408. if (!ptr || pa2.is_null())
  16409. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16410. auto saved_ctx = ctx();
  16411. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16412. auto res = isl_pw_aff_tdiv_r(copy(), pa2.release());
  16413. if (!res)
  16414. exception::throw_last_error(saved_ctx);
  16415. return manage(res);
  16416. }
  16417. isl::pw_aff_list pw_aff::to_list() const
  16418. {
  16419. if (!ptr)
  16420. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16421. auto saved_ctx = ctx();
  16422. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16423. auto res = isl_pw_aff_to_list(copy());
  16424. if (!res)
  16425. exception::throw_last_error(saved_ctx);
  16426. return manage(res);
  16427. }
  16428. isl::multi_pw_aff pw_aff::to_multi_pw_aff() const
  16429. {
  16430. if (!ptr)
  16431. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16432. return isl::pw_multi_aff(*this).to_multi_pw_aff();
  16433. }
  16434. isl::union_pw_aff pw_aff::to_union_pw_aff() const
  16435. {
  16436. if (!ptr)
  16437. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16438. auto saved_ctx = ctx();
  16439. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16440. auto res = isl_pw_aff_to_union_pw_aff(copy());
  16441. if (!res)
  16442. exception::throw_last_error(saved_ctx);
  16443. return manage(res);
  16444. }
  16445. isl::union_pw_multi_aff pw_aff::to_union_pw_multi_aff() const
  16446. {
  16447. if (!ptr)
  16448. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16449. return isl::pw_multi_aff(*this).to_union_pw_multi_aff();
  16450. }
  16451. isl::multi_pw_aff pw_aff::unbind_params_insert_domain(const isl::multi_id &domain) const
  16452. {
  16453. if (!ptr)
  16454. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16455. return isl::pw_multi_aff(*this).unbind_params_insert_domain(domain);
  16456. }
  16457. isl::multi_pw_aff pw_aff::union_add(const isl::multi_pw_aff &mpa2) const
  16458. {
  16459. if (!ptr)
  16460. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16461. return isl::pw_multi_aff(*this).union_add(mpa2);
  16462. }
  16463. isl::multi_union_pw_aff pw_aff::union_add(const isl::multi_union_pw_aff &mupa2) const
  16464. {
  16465. if (!ptr)
  16466. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16467. return isl::union_pw_aff(*this).union_add(mupa2);
  16468. }
  16469. isl::pw_aff pw_aff::union_add(isl::pw_aff pwaff2) const
  16470. {
  16471. if (!ptr || pwaff2.is_null())
  16472. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16473. auto saved_ctx = ctx();
  16474. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16475. auto res = isl_pw_aff_union_add(copy(), pwaff2.release());
  16476. if (!res)
  16477. exception::throw_last_error(saved_ctx);
  16478. return manage(res);
  16479. }
  16480. isl::pw_multi_aff pw_aff::union_add(const isl::pw_multi_aff &pma2) const
  16481. {
  16482. if (!ptr)
  16483. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16484. return isl::pw_multi_aff(*this).union_add(pma2);
  16485. }
  16486. isl::union_pw_aff pw_aff::union_add(const isl::union_pw_aff &upa2) const
  16487. {
  16488. if (!ptr)
  16489. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16490. return isl::union_pw_aff(*this).union_add(upa2);
  16491. }
  16492. isl::union_pw_multi_aff pw_aff::union_add(const isl::union_pw_multi_aff &upma2) const
  16493. {
  16494. if (!ptr)
  16495. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16496. return isl::union_pw_aff(*this).union_add(upma2);
  16497. }
  16498. isl::pw_aff pw_aff::union_add(const isl::aff &pwaff2) const
  16499. {
  16500. if (!ptr)
  16501. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16502. return this->union_add(isl::pw_aff(pwaff2));
  16503. }
  16504. inline std::ostream &operator<<(std::ostream &os, const pw_aff &obj)
  16505. {
  16506. if (!obj.get())
  16507. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16508. auto saved_ctx = isl_pw_aff_get_ctx(obj.get());
  16509. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16510. char *str = isl_pw_aff_to_str(obj.get());
  16511. if (!str)
  16512. exception::throw_last_error(saved_ctx);
  16513. os << str;
  16514. free(str);
  16515. return os;
  16516. }
  16517. // implementations for isl::pw_aff_list
  16518. pw_aff_list manage(__isl_take isl_pw_aff_list *ptr) {
  16519. if (!ptr)
  16520. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16521. return pw_aff_list(ptr);
  16522. }
  16523. pw_aff_list manage_copy(__isl_keep isl_pw_aff_list *ptr) {
  16524. if (!ptr)
  16525. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16526. auto saved_ctx = isl_pw_aff_list_get_ctx(ptr);
  16527. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16528. ptr = isl_pw_aff_list_copy(ptr);
  16529. if (!ptr)
  16530. exception::throw_last_error(saved_ctx);
  16531. return pw_aff_list(ptr);
  16532. }
  16533. pw_aff_list::pw_aff_list(__isl_take isl_pw_aff_list *ptr)
  16534. : ptr(ptr) {}
  16535. pw_aff_list::pw_aff_list()
  16536. : ptr(nullptr) {}
  16537. pw_aff_list::pw_aff_list(const pw_aff_list &obj)
  16538. : ptr(nullptr)
  16539. {
  16540. if (!obj.ptr)
  16541. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16542. auto saved_ctx = isl_pw_aff_list_get_ctx(obj.ptr);
  16543. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16544. ptr = obj.copy();
  16545. if (!ptr)
  16546. exception::throw_last_error(saved_ctx);
  16547. }
  16548. pw_aff_list::pw_aff_list(isl::ctx ctx, int n)
  16549. {
  16550. auto saved_ctx = ctx;
  16551. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16552. auto res = isl_pw_aff_list_alloc(ctx.release(), n);
  16553. if (!res)
  16554. exception::throw_last_error(saved_ctx);
  16555. ptr = res;
  16556. }
  16557. pw_aff_list::pw_aff_list(isl::pw_aff el)
  16558. {
  16559. if (el.is_null())
  16560. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16561. auto saved_ctx = el.ctx();
  16562. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16563. auto res = isl_pw_aff_list_from_pw_aff(el.release());
  16564. if (!res)
  16565. exception::throw_last_error(saved_ctx);
  16566. ptr = res;
  16567. }
  16568. pw_aff_list::pw_aff_list(isl::ctx ctx, const std::string &str)
  16569. {
  16570. auto saved_ctx = ctx;
  16571. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16572. auto res = isl_pw_aff_list_read_from_str(ctx.release(), str.c_str());
  16573. if (!res)
  16574. exception::throw_last_error(saved_ctx);
  16575. ptr = res;
  16576. }
  16577. pw_aff_list &pw_aff_list::operator=(pw_aff_list obj) {
  16578. std::swap(this->ptr, obj.ptr);
  16579. return *this;
  16580. }
  16581. pw_aff_list::~pw_aff_list() {
  16582. if (ptr)
  16583. isl_pw_aff_list_free(ptr);
  16584. }
  16585. __isl_give isl_pw_aff_list *pw_aff_list::copy() const & {
  16586. return isl_pw_aff_list_copy(ptr);
  16587. }
  16588. __isl_keep isl_pw_aff_list *pw_aff_list::get() const {
  16589. return ptr;
  16590. }
  16591. __isl_give isl_pw_aff_list *pw_aff_list::release() {
  16592. isl_pw_aff_list *tmp = ptr;
  16593. ptr = nullptr;
  16594. return tmp;
  16595. }
  16596. bool pw_aff_list::is_null() const {
  16597. return ptr == nullptr;
  16598. }
  16599. isl::ctx pw_aff_list::ctx() const {
  16600. return isl::ctx(isl_pw_aff_list_get_ctx(ptr));
  16601. }
  16602. isl::pw_aff_list pw_aff_list::add(isl::pw_aff el) const
  16603. {
  16604. if (!ptr || el.is_null())
  16605. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16606. auto saved_ctx = ctx();
  16607. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16608. auto res = isl_pw_aff_list_add(copy(), el.release());
  16609. if (!res)
  16610. exception::throw_last_error(saved_ctx);
  16611. return manage(res);
  16612. }
  16613. isl::pw_aff pw_aff_list::at(int index) const
  16614. {
  16615. if (!ptr)
  16616. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16617. auto saved_ctx = ctx();
  16618. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16619. auto res = isl_pw_aff_list_get_at(get(), index);
  16620. if (!res)
  16621. exception::throw_last_error(saved_ctx);
  16622. return manage(res);
  16623. }
  16624. isl::pw_aff pw_aff_list::get_at(int index) const
  16625. {
  16626. return at(index);
  16627. }
  16628. isl::pw_aff_list pw_aff_list::clear() const
  16629. {
  16630. if (!ptr)
  16631. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16632. auto saved_ctx = ctx();
  16633. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16634. auto res = isl_pw_aff_list_clear(copy());
  16635. if (!res)
  16636. exception::throw_last_error(saved_ctx);
  16637. return manage(res);
  16638. }
  16639. isl::pw_aff_list pw_aff_list::concat(isl::pw_aff_list list2) const
  16640. {
  16641. if (!ptr || list2.is_null())
  16642. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16643. auto saved_ctx = ctx();
  16644. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16645. auto res = isl_pw_aff_list_concat(copy(), list2.release());
  16646. if (!res)
  16647. exception::throw_last_error(saved_ctx);
  16648. return manage(res);
  16649. }
  16650. isl::pw_aff_list pw_aff_list::drop(unsigned int first, unsigned int n) const
  16651. {
  16652. if (!ptr)
  16653. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16654. auto saved_ctx = ctx();
  16655. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16656. auto res = isl_pw_aff_list_drop(copy(), first, n);
  16657. if (!res)
  16658. exception::throw_last_error(saved_ctx);
  16659. return manage(res);
  16660. }
  16661. void pw_aff_list::foreach(const std::function<void(isl::pw_aff)> &fn) const
  16662. {
  16663. if (!ptr)
  16664. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16665. auto saved_ctx = ctx();
  16666. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16667. struct fn_data {
  16668. std::function<void(isl::pw_aff)> func;
  16669. std::exception_ptr eptr;
  16670. } fn_data = { fn };
  16671. auto fn_lambda = [](isl_pw_aff *arg_0, void *arg_1) -> isl_stat {
  16672. auto *data = static_cast<struct fn_data *>(arg_1);
  16673. ISL_CPP_TRY {
  16674. (data->func)(manage(arg_0));
  16675. return isl_stat_ok;
  16676. } ISL_CPP_CATCH_ALL {
  16677. data->eptr = std::current_exception();
  16678. return isl_stat_error;
  16679. }
  16680. };
  16681. auto res = isl_pw_aff_list_foreach(get(), fn_lambda, &fn_data);
  16682. if (fn_data.eptr)
  16683. std::rethrow_exception(fn_data.eptr);
  16684. if (res < 0)
  16685. exception::throw_last_error(saved_ctx);
  16686. return;
  16687. }
  16688. void pw_aff_list::foreach_scc(const std::function<bool(isl::pw_aff, isl::pw_aff)> &follows, const std::function<void(isl::pw_aff_list)> &fn) const
  16689. {
  16690. if (!ptr)
  16691. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16692. auto saved_ctx = ctx();
  16693. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16694. struct follows_data {
  16695. std::function<bool(isl::pw_aff, isl::pw_aff)> func;
  16696. std::exception_ptr eptr;
  16697. } follows_data = { follows };
  16698. auto follows_lambda = [](isl_pw_aff *arg_0, isl_pw_aff *arg_1, void *arg_2) -> isl_bool {
  16699. auto *data = static_cast<struct follows_data *>(arg_2);
  16700. ISL_CPP_TRY {
  16701. auto ret = (data->func)(manage_copy(arg_0), manage_copy(arg_1));
  16702. return ret ? isl_bool_true : isl_bool_false;
  16703. } ISL_CPP_CATCH_ALL {
  16704. data->eptr = std::current_exception();
  16705. return isl_bool_error;
  16706. }
  16707. };
  16708. struct fn_data {
  16709. std::function<void(isl::pw_aff_list)> func;
  16710. std::exception_ptr eptr;
  16711. } fn_data = { fn };
  16712. auto fn_lambda = [](isl_pw_aff_list *arg_0, void *arg_1) -> isl_stat {
  16713. auto *data = static_cast<struct fn_data *>(arg_1);
  16714. ISL_CPP_TRY {
  16715. (data->func)(manage(arg_0));
  16716. return isl_stat_ok;
  16717. } ISL_CPP_CATCH_ALL {
  16718. data->eptr = std::current_exception();
  16719. return isl_stat_error;
  16720. }
  16721. };
  16722. auto res = isl_pw_aff_list_foreach_scc(get(), follows_lambda, &follows_data, fn_lambda, &fn_data);
  16723. if (follows_data.eptr)
  16724. std::rethrow_exception(follows_data.eptr);
  16725. if (fn_data.eptr)
  16726. std::rethrow_exception(fn_data.eptr);
  16727. if (res < 0)
  16728. exception::throw_last_error(saved_ctx);
  16729. return;
  16730. }
  16731. isl::pw_aff_list pw_aff_list::insert(unsigned int pos, isl::pw_aff el) const
  16732. {
  16733. if (!ptr || el.is_null())
  16734. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16735. auto saved_ctx = ctx();
  16736. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16737. auto res = isl_pw_aff_list_insert(copy(), pos, el.release());
  16738. if (!res)
  16739. exception::throw_last_error(saved_ctx);
  16740. return manage(res);
  16741. }
  16742. unsigned pw_aff_list::size() const
  16743. {
  16744. if (!ptr)
  16745. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16746. auto saved_ctx = ctx();
  16747. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16748. auto res = isl_pw_aff_list_size(get());
  16749. if (res < 0)
  16750. exception::throw_last_error(saved_ctx);
  16751. return res;
  16752. }
  16753. inline std::ostream &operator<<(std::ostream &os, const pw_aff_list &obj)
  16754. {
  16755. if (!obj.get())
  16756. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16757. auto saved_ctx = isl_pw_aff_list_get_ctx(obj.get());
  16758. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16759. char *str = isl_pw_aff_list_to_str(obj.get());
  16760. if (!str)
  16761. exception::throw_last_error(saved_ctx);
  16762. os << str;
  16763. free(str);
  16764. return os;
  16765. }
  16766. // implementations for isl::pw_multi_aff
  16767. pw_multi_aff manage(__isl_take isl_pw_multi_aff *ptr) {
  16768. if (!ptr)
  16769. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16770. return pw_multi_aff(ptr);
  16771. }
  16772. pw_multi_aff manage_copy(__isl_keep isl_pw_multi_aff *ptr) {
  16773. if (!ptr)
  16774. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16775. auto saved_ctx = isl_pw_multi_aff_get_ctx(ptr);
  16776. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16777. ptr = isl_pw_multi_aff_copy(ptr);
  16778. if (!ptr)
  16779. exception::throw_last_error(saved_ctx);
  16780. return pw_multi_aff(ptr);
  16781. }
  16782. pw_multi_aff::pw_multi_aff(__isl_take isl_pw_multi_aff *ptr)
  16783. : ptr(ptr) {}
  16784. pw_multi_aff::pw_multi_aff()
  16785. : ptr(nullptr) {}
  16786. pw_multi_aff::pw_multi_aff(const pw_multi_aff &obj)
  16787. : ptr(nullptr)
  16788. {
  16789. if (!obj.ptr)
  16790. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16791. auto saved_ctx = isl_pw_multi_aff_get_ctx(obj.ptr);
  16792. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16793. ptr = obj.copy();
  16794. if (!ptr)
  16795. exception::throw_last_error(saved_ctx);
  16796. }
  16797. pw_multi_aff::pw_multi_aff(isl::multi_aff ma)
  16798. {
  16799. if (ma.is_null())
  16800. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16801. auto saved_ctx = ma.ctx();
  16802. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16803. auto res = isl_pw_multi_aff_from_multi_aff(ma.release());
  16804. if (!res)
  16805. exception::throw_last_error(saved_ctx);
  16806. ptr = res;
  16807. }
  16808. pw_multi_aff::pw_multi_aff(isl::pw_aff pa)
  16809. {
  16810. if (pa.is_null())
  16811. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16812. auto saved_ctx = pa.ctx();
  16813. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16814. auto res = isl_pw_multi_aff_from_pw_aff(pa.release());
  16815. if (!res)
  16816. exception::throw_last_error(saved_ctx);
  16817. ptr = res;
  16818. }
  16819. pw_multi_aff::pw_multi_aff(isl::ctx ctx, const std::string &str)
  16820. {
  16821. auto saved_ctx = ctx;
  16822. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16823. auto res = isl_pw_multi_aff_read_from_str(ctx.release(), str.c_str());
  16824. if (!res)
  16825. exception::throw_last_error(saved_ctx);
  16826. ptr = res;
  16827. }
  16828. pw_multi_aff &pw_multi_aff::operator=(pw_multi_aff obj) {
  16829. std::swap(this->ptr, obj.ptr);
  16830. return *this;
  16831. }
  16832. pw_multi_aff::~pw_multi_aff() {
  16833. if (ptr)
  16834. isl_pw_multi_aff_free(ptr);
  16835. }
  16836. __isl_give isl_pw_multi_aff *pw_multi_aff::copy() const & {
  16837. return isl_pw_multi_aff_copy(ptr);
  16838. }
  16839. __isl_keep isl_pw_multi_aff *pw_multi_aff::get() const {
  16840. return ptr;
  16841. }
  16842. __isl_give isl_pw_multi_aff *pw_multi_aff::release() {
  16843. isl_pw_multi_aff *tmp = ptr;
  16844. ptr = nullptr;
  16845. return tmp;
  16846. }
  16847. bool pw_multi_aff::is_null() const {
  16848. return ptr == nullptr;
  16849. }
  16850. isl::ctx pw_multi_aff::ctx() const {
  16851. return isl::ctx(isl_pw_multi_aff_get_ctx(ptr));
  16852. }
  16853. isl::multi_pw_aff pw_multi_aff::add(const isl::multi_pw_aff &multi2) const
  16854. {
  16855. if (!ptr)
  16856. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16857. return isl::multi_pw_aff(*this).add(multi2);
  16858. }
  16859. isl::multi_union_pw_aff pw_multi_aff::add(const isl::multi_union_pw_aff &multi2) const
  16860. {
  16861. if (!ptr)
  16862. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16863. return isl::multi_pw_aff(*this).add(multi2);
  16864. }
  16865. isl::pw_multi_aff pw_multi_aff::add(isl::pw_multi_aff pma2) const
  16866. {
  16867. if (!ptr || pma2.is_null())
  16868. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16869. auto saved_ctx = ctx();
  16870. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16871. auto res = isl_pw_multi_aff_add(copy(), pma2.release());
  16872. if (!res)
  16873. exception::throw_last_error(saved_ctx);
  16874. return manage(res);
  16875. }
  16876. isl::union_pw_multi_aff pw_multi_aff::add(const isl::union_pw_multi_aff &upma2) const
  16877. {
  16878. if (!ptr)
  16879. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16880. return isl::union_pw_multi_aff(*this).add(upma2);
  16881. }
  16882. isl::pw_multi_aff pw_multi_aff::add(const isl::multi_aff &pma2) const
  16883. {
  16884. if (!ptr)
  16885. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16886. return this->add(isl::pw_multi_aff(pma2));
  16887. }
  16888. isl::pw_multi_aff pw_multi_aff::add(const isl::pw_aff &pma2) const
  16889. {
  16890. if (!ptr)
  16891. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16892. return this->add(isl::pw_multi_aff(pma2));
  16893. }
  16894. isl::pw_multi_aff pw_multi_aff::add_constant(isl::multi_val mv) const
  16895. {
  16896. if (!ptr || mv.is_null())
  16897. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16898. auto saved_ctx = ctx();
  16899. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16900. auto res = isl_pw_multi_aff_add_constant_multi_val(copy(), mv.release());
  16901. if (!res)
  16902. exception::throw_last_error(saved_ctx);
  16903. return manage(res);
  16904. }
  16905. isl::pw_multi_aff pw_multi_aff::add_constant(isl::val v) const
  16906. {
  16907. if (!ptr || v.is_null())
  16908. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16909. auto saved_ctx = ctx();
  16910. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16911. auto res = isl_pw_multi_aff_add_constant_val(copy(), v.release());
  16912. if (!res)
  16913. exception::throw_last_error(saved_ctx);
  16914. return manage(res);
  16915. }
  16916. isl::pw_multi_aff pw_multi_aff::add_constant(long v) const
  16917. {
  16918. if (!ptr)
  16919. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16920. return this->add_constant(isl::val(ctx(), v));
  16921. }
  16922. isl::union_pw_multi_aff pw_multi_aff::apply(const isl::union_pw_multi_aff &upma2) const
  16923. {
  16924. if (!ptr)
  16925. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16926. return isl::union_pw_multi_aff(*this).apply(upma2);
  16927. }
  16928. isl::map pw_multi_aff::as_map() const
  16929. {
  16930. if (!ptr)
  16931. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16932. auto saved_ctx = ctx();
  16933. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16934. auto res = isl_pw_multi_aff_as_map(copy());
  16935. if (!res)
  16936. exception::throw_last_error(saved_ctx);
  16937. return manage(res);
  16938. }
  16939. isl::multi_aff pw_multi_aff::as_multi_aff() const
  16940. {
  16941. if (!ptr)
  16942. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16943. auto saved_ctx = ctx();
  16944. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16945. auto res = isl_pw_multi_aff_as_multi_aff(copy());
  16946. if (!res)
  16947. exception::throw_last_error(saved_ctx);
  16948. return manage(res);
  16949. }
  16950. isl::multi_union_pw_aff pw_multi_aff::as_multi_union_pw_aff() const
  16951. {
  16952. if (!ptr)
  16953. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16954. return isl::union_pw_multi_aff(*this).as_multi_union_pw_aff();
  16955. }
  16956. isl::pw_multi_aff pw_multi_aff::as_pw_multi_aff() const
  16957. {
  16958. if (!ptr)
  16959. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16960. return isl::union_pw_multi_aff(*this).as_pw_multi_aff();
  16961. }
  16962. isl::set pw_multi_aff::as_set() const
  16963. {
  16964. if (!ptr)
  16965. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16966. auto saved_ctx = ctx();
  16967. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16968. auto res = isl_pw_multi_aff_as_set(copy());
  16969. if (!res)
  16970. exception::throw_last_error(saved_ctx);
  16971. return manage(res);
  16972. }
  16973. isl::union_map pw_multi_aff::as_union_map() const
  16974. {
  16975. if (!ptr)
  16976. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16977. return isl::union_pw_multi_aff(*this).as_union_map();
  16978. }
  16979. isl::pw_aff pw_multi_aff::at(int pos) const
  16980. {
  16981. if (!ptr)
  16982. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16983. auto saved_ctx = ctx();
  16984. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  16985. auto res = isl_pw_multi_aff_get_at(get(), pos);
  16986. if (!res)
  16987. exception::throw_last_error(saved_ctx);
  16988. return manage(res);
  16989. }
  16990. isl::pw_aff pw_multi_aff::get_at(int pos) const
  16991. {
  16992. return at(pos);
  16993. }
  16994. isl::set pw_multi_aff::bind(const isl::multi_id &tuple) const
  16995. {
  16996. if (!ptr)
  16997. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  16998. return isl::multi_pw_aff(*this).bind(tuple);
  16999. }
  17000. isl::pw_multi_aff pw_multi_aff::bind_domain(isl::multi_id tuple) const
  17001. {
  17002. if (!ptr || tuple.is_null())
  17003. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17004. auto saved_ctx = ctx();
  17005. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17006. auto res = isl_pw_multi_aff_bind_domain(copy(), tuple.release());
  17007. if (!res)
  17008. exception::throw_last_error(saved_ctx);
  17009. return manage(res);
  17010. }
  17011. isl::pw_multi_aff pw_multi_aff::bind_domain_wrapped_domain(isl::multi_id tuple) const
  17012. {
  17013. if (!ptr || tuple.is_null())
  17014. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17015. auto saved_ctx = ctx();
  17016. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17017. auto res = isl_pw_multi_aff_bind_domain_wrapped_domain(copy(), tuple.release());
  17018. if (!res)
  17019. exception::throw_last_error(saved_ctx);
  17020. return manage(res);
  17021. }
  17022. isl::pw_multi_aff pw_multi_aff::coalesce() const
  17023. {
  17024. if (!ptr)
  17025. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17026. auto saved_ctx = ctx();
  17027. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17028. auto res = isl_pw_multi_aff_coalesce(copy());
  17029. if (!res)
  17030. exception::throw_last_error(saved_ctx);
  17031. return manage(res);
  17032. }
  17033. isl::set pw_multi_aff::domain() const
  17034. {
  17035. if (!ptr)
  17036. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17037. auto saved_ctx = ctx();
  17038. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17039. auto res = isl_pw_multi_aff_domain(copy());
  17040. if (!res)
  17041. exception::throw_last_error(saved_ctx);
  17042. return manage(res);
  17043. }
  17044. isl::pw_multi_aff pw_multi_aff::domain_map(isl::space space)
  17045. {
  17046. if (space.is_null())
  17047. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17048. auto saved_ctx = space.ctx();
  17049. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17050. auto res = isl_pw_multi_aff_domain_map(space.release());
  17051. if (!res)
  17052. exception::throw_last_error(saved_ctx);
  17053. return manage(res);
  17054. }
  17055. isl::pw_multi_aff pw_multi_aff::extract_pw_multi_aff(const isl::space &space) const
  17056. {
  17057. if (!ptr)
  17058. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17059. return isl::union_pw_multi_aff(*this).extract_pw_multi_aff(space);
  17060. }
  17061. isl::multi_pw_aff pw_multi_aff::flat_range_product(const isl::multi_pw_aff &multi2) const
  17062. {
  17063. if (!ptr)
  17064. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17065. return isl::multi_pw_aff(*this).flat_range_product(multi2);
  17066. }
  17067. isl::multi_union_pw_aff pw_multi_aff::flat_range_product(const isl::multi_union_pw_aff &multi2) const
  17068. {
  17069. if (!ptr)
  17070. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17071. return isl::multi_pw_aff(*this).flat_range_product(multi2);
  17072. }
  17073. isl::pw_multi_aff pw_multi_aff::flat_range_product(isl::pw_multi_aff pma2) const
  17074. {
  17075. if (!ptr || pma2.is_null())
  17076. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17077. auto saved_ctx = ctx();
  17078. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17079. auto res = isl_pw_multi_aff_flat_range_product(copy(), pma2.release());
  17080. if (!res)
  17081. exception::throw_last_error(saved_ctx);
  17082. return manage(res);
  17083. }
  17084. isl::union_pw_multi_aff pw_multi_aff::flat_range_product(const isl::union_pw_multi_aff &upma2) const
  17085. {
  17086. if (!ptr)
  17087. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17088. return isl::union_pw_multi_aff(*this).flat_range_product(upma2);
  17089. }
  17090. isl::pw_multi_aff pw_multi_aff::flat_range_product(const isl::multi_aff &pma2) const
  17091. {
  17092. if (!ptr)
  17093. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17094. return this->flat_range_product(isl::pw_multi_aff(pma2));
  17095. }
  17096. isl::pw_multi_aff pw_multi_aff::flat_range_product(const isl::pw_aff &pma2) const
  17097. {
  17098. if (!ptr)
  17099. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17100. return this->flat_range_product(isl::pw_multi_aff(pma2));
  17101. }
  17102. void pw_multi_aff::foreach_piece(const std::function<void(isl::set, isl::multi_aff)> &fn) const
  17103. {
  17104. if (!ptr)
  17105. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17106. auto saved_ctx = ctx();
  17107. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17108. struct fn_data {
  17109. std::function<void(isl::set, isl::multi_aff)> func;
  17110. std::exception_ptr eptr;
  17111. } fn_data = { fn };
  17112. auto fn_lambda = [](isl_set *arg_0, isl_multi_aff *arg_1, void *arg_2) -> isl_stat {
  17113. auto *data = static_cast<struct fn_data *>(arg_2);
  17114. ISL_CPP_TRY {
  17115. (data->func)(manage(arg_0), manage(arg_1));
  17116. return isl_stat_ok;
  17117. } ISL_CPP_CATCH_ALL {
  17118. data->eptr = std::current_exception();
  17119. return isl_stat_error;
  17120. }
  17121. };
  17122. auto res = isl_pw_multi_aff_foreach_piece(get(), fn_lambda, &fn_data);
  17123. if (fn_data.eptr)
  17124. std::rethrow_exception(fn_data.eptr);
  17125. if (res < 0)
  17126. exception::throw_last_error(saved_ctx);
  17127. return;
  17128. }
  17129. isl::pw_multi_aff pw_multi_aff::gist(isl::set set) const
  17130. {
  17131. if (!ptr || set.is_null())
  17132. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17133. auto saved_ctx = ctx();
  17134. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17135. auto res = isl_pw_multi_aff_gist(copy(), set.release());
  17136. if (!res)
  17137. exception::throw_last_error(saved_ctx);
  17138. return manage(res);
  17139. }
  17140. isl::union_pw_multi_aff pw_multi_aff::gist(const isl::union_set &context) const
  17141. {
  17142. if (!ptr)
  17143. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17144. return isl::union_pw_multi_aff(*this).gist(context);
  17145. }
  17146. isl::pw_multi_aff pw_multi_aff::gist(const isl::basic_set &set) const
  17147. {
  17148. if (!ptr)
  17149. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17150. return this->gist(isl::set(set));
  17151. }
  17152. isl::pw_multi_aff pw_multi_aff::gist(const isl::point &set) const
  17153. {
  17154. if (!ptr)
  17155. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17156. return this->gist(isl::set(set));
  17157. }
  17158. isl::pw_multi_aff pw_multi_aff::gist_params(isl::set set) const
  17159. {
  17160. if (!ptr || set.is_null())
  17161. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17162. auto saved_ctx = ctx();
  17163. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17164. auto res = isl_pw_multi_aff_gist_params(copy(), set.release());
  17165. if (!res)
  17166. exception::throw_last_error(saved_ctx);
  17167. return manage(res);
  17168. }
  17169. bool pw_multi_aff::has_range_tuple_id() const
  17170. {
  17171. if (!ptr)
  17172. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17173. auto saved_ctx = ctx();
  17174. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17175. auto res = isl_pw_multi_aff_has_range_tuple_id(get());
  17176. if (res < 0)
  17177. exception::throw_last_error(saved_ctx);
  17178. return res;
  17179. }
  17180. isl::multi_pw_aff pw_multi_aff::identity() const
  17181. {
  17182. if (!ptr)
  17183. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17184. return isl::multi_pw_aff(*this).identity();
  17185. }
  17186. isl::pw_multi_aff pw_multi_aff::identity_on_domain(isl::space space)
  17187. {
  17188. if (space.is_null())
  17189. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17190. auto saved_ctx = space.ctx();
  17191. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17192. auto res = isl_pw_multi_aff_identity_on_domain_space(space.release());
  17193. if (!res)
  17194. exception::throw_last_error(saved_ctx);
  17195. return manage(res);
  17196. }
  17197. isl::pw_multi_aff pw_multi_aff::insert_domain(isl::space domain) const
  17198. {
  17199. if (!ptr || domain.is_null())
  17200. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17201. auto saved_ctx = ctx();
  17202. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17203. auto res = isl_pw_multi_aff_insert_domain(copy(), domain.release());
  17204. if (!res)
  17205. exception::throw_last_error(saved_ctx);
  17206. return manage(res);
  17207. }
  17208. isl::pw_multi_aff pw_multi_aff::intersect_domain(isl::set set) const
  17209. {
  17210. if (!ptr || set.is_null())
  17211. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17212. auto saved_ctx = ctx();
  17213. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17214. auto res = isl_pw_multi_aff_intersect_domain(copy(), set.release());
  17215. if (!res)
  17216. exception::throw_last_error(saved_ctx);
  17217. return manage(res);
  17218. }
  17219. isl::union_pw_multi_aff pw_multi_aff::intersect_domain(const isl::space &space) const
  17220. {
  17221. if (!ptr)
  17222. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17223. return isl::union_pw_multi_aff(*this).intersect_domain(space);
  17224. }
  17225. isl::union_pw_multi_aff pw_multi_aff::intersect_domain(const isl::union_set &uset) const
  17226. {
  17227. if (!ptr)
  17228. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17229. return isl::union_pw_multi_aff(*this).intersect_domain(uset);
  17230. }
  17231. isl::pw_multi_aff pw_multi_aff::intersect_domain(const isl::basic_set &set) const
  17232. {
  17233. if (!ptr)
  17234. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17235. return this->intersect_domain(isl::set(set));
  17236. }
  17237. isl::pw_multi_aff pw_multi_aff::intersect_domain(const isl::point &set) const
  17238. {
  17239. if (!ptr)
  17240. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17241. return this->intersect_domain(isl::set(set));
  17242. }
  17243. isl::union_pw_multi_aff pw_multi_aff::intersect_domain_wrapped_domain(const isl::union_set &uset) const
  17244. {
  17245. if (!ptr)
  17246. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17247. return isl::union_pw_multi_aff(*this).intersect_domain_wrapped_domain(uset);
  17248. }
  17249. isl::union_pw_multi_aff pw_multi_aff::intersect_domain_wrapped_range(const isl::union_set &uset) const
  17250. {
  17251. if (!ptr)
  17252. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17253. return isl::union_pw_multi_aff(*this).intersect_domain_wrapped_range(uset);
  17254. }
  17255. isl::pw_multi_aff pw_multi_aff::intersect_params(isl::set set) const
  17256. {
  17257. if (!ptr || set.is_null())
  17258. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17259. auto saved_ctx = ctx();
  17260. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17261. auto res = isl_pw_multi_aff_intersect_params(copy(), set.release());
  17262. if (!res)
  17263. exception::throw_last_error(saved_ctx);
  17264. return manage(res);
  17265. }
  17266. bool pw_multi_aff::involves_locals() const
  17267. {
  17268. if (!ptr)
  17269. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17270. auto saved_ctx = ctx();
  17271. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17272. auto res = isl_pw_multi_aff_involves_locals(get());
  17273. if (res < 0)
  17274. exception::throw_last_error(saved_ctx);
  17275. return res;
  17276. }
  17277. bool pw_multi_aff::involves_nan() const
  17278. {
  17279. if (!ptr)
  17280. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17281. return isl::multi_pw_aff(*this).involves_nan();
  17282. }
  17283. bool pw_multi_aff::involves_param(const isl::id &id) const
  17284. {
  17285. if (!ptr)
  17286. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17287. return isl::multi_pw_aff(*this).involves_param(id);
  17288. }
  17289. bool pw_multi_aff::involves_param(const std::string &id) const
  17290. {
  17291. if (!ptr)
  17292. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17293. return this->involves_param(isl::id(ctx(), id));
  17294. }
  17295. bool pw_multi_aff::involves_param(const isl::id_list &list) const
  17296. {
  17297. if (!ptr)
  17298. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17299. return isl::multi_pw_aff(*this).involves_param(list);
  17300. }
  17301. bool pw_multi_aff::isa_multi_aff() const
  17302. {
  17303. if (!ptr)
  17304. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17305. auto saved_ctx = ctx();
  17306. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17307. auto res = isl_pw_multi_aff_isa_multi_aff(get());
  17308. if (res < 0)
  17309. exception::throw_last_error(saved_ctx);
  17310. return res;
  17311. }
  17312. bool pw_multi_aff::isa_pw_multi_aff() const
  17313. {
  17314. if (!ptr)
  17315. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17316. return isl::union_pw_multi_aff(*this).isa_pw_multi_aff();
  17317. }
  17318. isl::pw_aff_list pw_multi_aff::list() const
  17319. {
  17320. if (!ptr)
  17321. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17322. return isl::multi_pw_aff(*this).list();
  17323. }
  17324. isl::multi_pw_aff pw_multi_aff::max(const isl::multi_pw_aff &multi2) const
  17325. {
  17326. if (!ptr)
  17327. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17328. return isl::multi_pw_aff(*this).max(multi2);
  17329. }
  17330. isl::multi_val pw_multi_aff::max_multi_val() const
  17331. {
  17332. if (!ptr)
  17333. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17334. auto saved_ctx = ctx();
  17335. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17336. auto res = isl_pw_multi_aff_max_multi_val(copy());
  17337. if (!res)
  17338. exception::throw_last_error(saved_ctx);
  17339. return manage(res);
  17340. }
  17341. isl::multi_pw_aff pw_multi_aff::min(const isl::multi_pw_aff &multi2) const
  17342. {
  17343. if (!ptr)
  17344. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17345. return isl::multi_pw_aff(*this).min(multi2);
  17346. }
  17347. isl::multi_val pw_multi_aff::min_multi_val() const
  17348. {
  17349. if (!ptr)
  17350. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17351. auto saved_ctx = ctx();
  17352. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17353. auto res = isl_pw_multi_aff_min_multi_val(copy());
  17354. if (!res)
  17355. exception::throw_last_error(saved_ctx);
  17356. return manage(res);
  17357. }
  17358. isl::pw_multi_aff pw_multi_aff::multi_val_on_domain(isl::set domain, isl::multi_val mv)
  17359. {
  17360. if (domain.is_null() || mv.is_null())
  17361. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17362. auto saved_ctx = domain.ctx();
  17363. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17364. auto res = isl_pw_multi_aff_multi_val_on_domain(domain.release(), mv.release());
  17365. if (!res)
  17366. exception::throw_last_error(saved_ctx);
  17367. return manage(res);
  17368. }
  17369. unsigned pw_multi_aff::n_piece() const
  17370. {
  17371. if (!ptr)
  17372. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17373. auto saved_ctx = ctx();
  17374. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17375. auto res = isl_pw_multi_aff_n_piece(get());
  17376. if (res < 0)
  17377. exception::throw_last_error(saved_ctx);
  17378. return res;
  17379. }
  17380. isl::multi_pw_aff pw_multi_aff::neg() const
  17381. {
  17382. if (!ptr)
  17383. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17384. return isl::multi_pw_aff(*this).neg();
  17385. }
  17386. bool pw_multi_aff::plain_is_empty() const
  17387. {
  17388. if (!ptr)
  17389. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17390. return isl::union_pw_multi_aff(*this).plain_is_empty();
  17391. }
  17392. bool pw_multi_aff::plain_is_equal(const isl::multi_pw_aff &multi2) const
  17393. {
  17394. if (!ptr)
  17395. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17396. return isl::multi_pw_aff(*this).plain_is_equal(multi2);
  17397. }
  17398. bool pw_multi_aff::plain_is_equal(const isl::multi_union_pw_aff &multi2) const
  17399. {
  17400. if (!ptr)
  17401. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17402. return isl::multi_pw_aff(*this).plain_is_equal(multi2);
  17403. }
  17404. isl::pw_multi_aff pw_multi_aff::preimage_domain_wrapped_domain(isl::pw_multi_aff pma2) const
  17405. {
  17406. if (!ptr || pma2.is_null())
  17407. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17408. auto saved_ctx = ctx();
  17409. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17410. auto res = isl_pw_multi_aff_preimage_domain_wrapped_domain_pw_multi_aff(copy(), pma2.release());
  17411. if (!res)
  17412. exception::throw_last_error(saved_ctx);
  17413. return manage(res);
  17414. }
  17415. isl::union_pw_multi_aff pw_multi_aff::preimage_domain_wrapped_domain(const isl::union_pw_multi_aff &upma2) const
  17416. {
  17417. if (!ptr)
  17418. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17419. return isl::union_pw_multi_aff(*this).preimage_domain_wrapped_domain(upma2);
  17420. }
  17421. isl::pw_multi_aff pw_multi_aff::preimage_domain_wrapped_domain(const isl::multi_aff &pma2) const
  17422. {
  17423. if (!ptr)
  17424. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17425. return this->preimage_domain_wrapped_domain(isl::pw_multi_aff(pma2));
  17426. }
  17427. isl::pw_multi_aff pw_multi_aff::preimage_domain_wrapped_domain(const isl::pw_aff &pma2) const
  17428. {
  17429. if (!ptr)
  17430. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17431. return this->preimage_domain_wrapped_domain(isl::pw_multi_aff(pma2));
  17432. }
  17433. isl::multi_pw_aff pw_multi_aff::product(const isl::multi_pw_aff &multi2) const
  17434. {
  17435. if (!ptr)
  17436. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17437. return isl::multi_pw_aff(*this).product(multi2);
  17438. }
  17439. isl::pw_multi_aff pw_multi_aff::product(isl::pw_multi_aff pma2) const
  17440. {
  17441. if (!ptr || pma2.is_null())
  17442. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17443. auto saved_ctx = ctx();
  17444. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17445. auto res = isl_pw_multi_aff_product(copy(), pma2.release());
  17446. if (!res)
  17447. exception::throw_last_error(saved_ctx);
  17448. return manage(res);
  17449. }
  17450. isl::pw_multi_aff pw_multi_aff::product(const isl::multi_aff &pma2) const
  17451. {
  17452. if (!ptr)
  17453. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17454. return this->product(isl::pw_multi_aff(pma2));
  17455. }
  17456. isl::pw_multi_aff pw_multi_aff::product(const isl::pw_aff &pma2) const
  17457. {
  17458. if (!ptr)
  17459. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17460. return this->product(isl::pw_multi_aff(pma2));
  17461. }
  17462. isl::multi_pw_aff pw_multi_aff::pullback(const isl::multi_pw_aff &mpa2) const
  17463. {
  17464. if (!ptr)
  17465. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17466. return isl::multi_pw_aff(*this).pullback(mpa2);
  17467. }
  17468. isl::pw_multi_aff pw_multi_aff::pullback(isl::multi_aff ma) const
  17469. {
  17470. if (!ptr || ma.is_null())
  17471. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17472. auto saved_ctx = ctx();
  17473. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17474. auto res = isl_pw_multi_aff_pullback_multi_aff(copy(), ma.release());
  17475. if (!res)
  17476. exception::throw_last_error(saved_ctx);
  17477. return manage(res);
  17478. }
  17479. isl::pw_multi_aff pw_multi_aff::pullback(isl::pw_multi_aff pma2) const
  17480. {
  17481. if (!ptr || pma2.is_null())
  17482. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17483. auto saved_ctx = ctx();
  17484. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17485. auto res = isl_pw_multi_aff_pullback_pw_multi_aff(copy(), pma2.release());
  17486. if (!res)
  17487. exception::throw_last_error(saved_ctx);
  17488. return manage(res);
  17489. }
  17490. isl::union_pw_multi_aff pw_multi_aff::pullback(const isl::union_pw_multi_aff &upma2) const
  17491. {
  17492. if (!ptr)
  17493. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17494. return isl::union_pw_multi_aff(*this).pullback(upma2);
  17495. }
  17496. isl::pw_multi_aff_list pw_multi_aff::pw_multi_aff_list() const
  17497. {
  17498. if (!ptr)
  17499. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17500. return isl::union_pw_multi_aff(*this).pw_multi_aff_list();
  17501. }
  17502. isl::pw_multi_aff pw_multi_aff::range_factor_domain() const
  17503. {
  17504. if (!ptr)
  17505. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17506. auto saved_ctx = ctx();
  17507. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17508. auto res = isl_pw_multi_aff_range_factor_domain(copy());
  17509. if (!res)
  17510. exception::throw_last_error(saved_ctx);
  17511. return manage(res);
  17512. }
  17513. isl::pw_multi_aff pw_multi_aff::range_factor_range() const
  17514. {
  17515. if (!ptr)
  17516. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17517. auto saved_ctx = ctx();
  17518. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17519. auto res = isl_pw_multi_aff_range_factor_range(copy());
  17520. if (!res)
  17521. exception::throw_last_error(saved_ctx);
  17522. return manage(res);
  17523. }
  17524. isl::pw_multi_aff pw_multi_aff::range_map(isl::space space)
  17525. {
  17526. if (space.is_null())
  17527. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17528. auto saved_ctx = space.ctx();
  17529. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17530. auto res = isl_pw_multi_aff_range_map(space.release());
  17531. if (!res)
  17532. exception::throw_last_error(saved_ctx);
  17533. return manage(res);
  17534. }
  17535. isl::multi_pw_aff pw_multi_aff::range_product(const isl::multi_pw_aff &multi2) const
  17536. {
  17537. if (!ptr)
  17538. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17539. return isl::multi_pw_aff(*this).range_product(multi2);
  17540. }
  17541. isl::multi_union_pw_aff pw_multi_aff::range_product(const isl::multi_union_pw_aff &multi2) const
  17542. {
  17543. if (!ptr)
  17544. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17545. return isl::multi_pw_aff(*this).range_product(multi2);
  17546. }
  17547. isl::pw_multi_aff pw_multi_aff::range_product(isl::pw_multi_aff pma2) const
  17548. {
  17549. if (!ptr || pma2.is_null())
  17550. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17551. auto saved_ctx = ctx();
  17552. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17553. auto res = isl_pw_multi_aff_range_product(copy(), pma2.release());
  17554. if (!res)
  17555. exception::throw_last_error(saved_ctx);
  17556. return manage(res);
  17557. }
  17558. isl::union_pw_multi_aff pw_multi_aff::range_product(const isl::union_pw_multi_aff &upma2) const
  17559. {
  17560. if (!ptr)
  17561. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17562. return isl::union_pw_multi_aff(*this).range_product(upma2);
  17563. }
  17564. isl::pw_multi_aff pw_multi_aff::range_product(const isl::multi_aff &pma2) const
  17565. {
  17566. if (!ptr)
  17567. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17568. return this->range_product(isl::pw_multi_aff(pma2));
  17569. }
  17570. isl::pw_multi_aff pw_multi_aff::range_product(const isl::pw_aff &pma2) const
  17571. {
  17572. if (!ptr)
  17573. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17574. return this->range_product(isl::pw_multi_aff(pma2));
  17575. }
  17576. isl::id pw_multi_aff::range_tuple_id() const
  17577. {
  17578. if (!ptr)
  17579. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17580. auto saved_ctx = ctx();
  17581. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17582. auto res = isl_pw_multi_aff_get_range_tuple_id(get());
  17583. if (!res)
  17584. exception::throw_last_error(saved_ctx);
  17585. return manage(res);
  17586. }
  17587. isl::id pw_multi_aff::get_range_tuple_id() const
  17588. {
  17589. return range_tuple_id();
  17590. }
  17591. isl::multi_pw_aff pw_multi_aff::reset_range_tuple_id() const
  17592. {
  17593. if (!ptr)
  17594. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17595. return isl::multi_pw_aff(*this).reset_range_tuple_id();
  17596. }
  17597. isl::pw_multi_aff pw_multi_aff::scale(isl::multi_val mv) const
  17598. {
  17599. if (!ptr || mv.is_null())
  17600. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17601. auto saved_ctx = ctx();
  17602. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17603. auto res = isl_pw_multi_aff_scale_multi_val(copy(), mv.release());
  17604. if (!res)
  17605. exception::throw_last_error(saved_ctx);
  17606. return manage(res);
  17607. }
  17608. isl::pw_multi_aff pw_multi_aff::scale(isl::val v) const
  17609. {
  17610. if (!ptr || v.is_null())
  17611. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17612. auto saved_ctx = ctx();
  17613. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17614. auto res = isl_pw_multi_aff_scale_val(copy(), v.release());
  17615. if (!res)
  17616. exception::throw_last_error(saved_ctx);
  17617. return manage(res);
  17618. }
  17619. isl::pw_multi_aff pw_multi_aff::scale(long v) const
  17620. {
  17621. if (!ptr)
  17622. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17623. return this->scale(isl::val(ctx(), v));
  17624. }
  17625. isl::pw_multi_aff pw_multi_aff::scale_down(isl::multi_val mv) const
  17626. {
  17627. if (!ptr || mv.is_null())
  17628. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17629. auto saved_ctx = ctx();
  17630. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17631. auto res = isl_pw_multi_aff_scale_down_multi_val(copy(), mv.release());
  17632. if (!res)
  17633. exception::throw_last_error(saved_ctx);
  17634. return manage(res);
  17635. }
  17636. isl::pw_multi_aff pw_multi_aff::scale_down(isl::val v) const
  17637. {
  17638. if (!ptr || v.is_null())
  17639. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17640. auto saved_ctx = ctx();
  17641. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17642. auto res = isl_pw_multi_aff_scale_down_val(copy(), v.release());
  17643. if (!res)
  17644. exception::throw_last_error(saved_ctx);
  17645. return manage(res);
  17646. }
  17647. isl::pw_multi_aff pw_multi_aff::scale_down(long v) const
  17648. {
  17649. if (!ptr)
  17650. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17651. return this->scale_down(isl::val(ctx(), v));
  17652. }
  17653. isl::multi_pw_aff pw_multi_aff::set_at(int pos, const isl::pw_aff &el) const
  17654. {
  17655. if (!ptr)
  17656. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17657. return isl::multi_pw_aff(*this).set_at(pos, el);
  17658. }
  17659. isl::multi_union_pw_aff pw_multi_aff::set_at(int pos, const isl::union_pw_aff &el) const
  17660. {
  17661. if (!ptr)
  17662. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17663. return isl::multi_pw_aff(*this).set_at(pos, el);
  17664. }
  17665. isl::pw_multi_aff pw_multi_aff::set_range_tuple(isl::id id) const
  17666. {
  17667. if (!ptr || id.is_null())
  17668. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17669. auto saved_ctx = ctx();
  17670. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17671. auto res = isl_pw_multi_aff_set_range_tuple_id(copy(), id.release());
  17672. if (!res)
  17673. exception::throw_last_error(saved_ctx);
  17674. return manage(res);
  17675. }
  17676. isl::pw_multi_aff pw_multi_aff::set_range_tuple(const std::string &id) const
  17677. {
  17678. if (!ptr)
  17679. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17680. return this->set_range_tuple(isl::id(ctx(), id));
  17681. }
  17682. unsigned pw_multi_aff::size() const
  17683. {
  17684. if (!ptr)
  17685. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17686. return isl::multi_pw_aff(*this).size();
  17687. }
  17688. isl::space pw_multi_aff::space() const
  17689. {
  17690. if (!ptr)
  17691. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17692. auto saved_ctx = ctx();
  17693. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17694. auto res = isl_pw_multi_aff_get_space(get());
  17695. if (!res)
  17696. exception::throw_last_error(saved_ctx);
  17697. return manage(res);
  17698. }
  17699. isl::space pw_multi_aff::get_space() const
  17700. {
  17701. return space();
  17702. }
  17703. isl::multi_pw_aff pw_multi_aff::sub(const isl::multi_pw_aff &multi2) const
  17704. {
  17705. if (!ptr)
  17706. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17707. return isl::multi_pw_aff(*this).sub(multi2);
  17708. }
  17709. isl::multi_union_pw_aff pw_multi_aff::sub(const isl::multi_union_pw_aff &multi2) const
  17710. {
  17711. if (!ptr)
  17712. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17713. return isl::multi_pw_aff(*this).sub(multi2);
  17714. }
  17715. isl::pw_multi_aff pw_multi_aff::sub(isl::pw_multi_aff pma2) const
  17716. {
  17717. if (!ptr || pma2.is_null())
  17718. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17719. auto saved_ctx = ctx();
  17720. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17721. auto res = isl_pw_multi_aff_sub(copy(), pma2.release());
  17722. if (!res)
  17723. exception::throw_last_error(saved_ctx);
  17724. return manage(res);
  17725. }
  17726. isl::union_pw_multi_aff pw_multi_aff::sub(const isl::union_pw_multi_aff &upma2) const
  17727. {
  17728. if (!ptr)
  17729. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17730. return isl::union_pw_multi_aff(*this).sub(upma2);
  17731. }
  17732. isl::pw_multi_aff pw_multi_aff::sub(const isl::multi_aff &pma2) const
  17733. {
  17734. if (!ptr)
  17735. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17736. return this->sub(isl::pw_multi_aff(pma2));
  17737. }
  17738. isl::pw_multi_aff pw_multi_aff::sub(const isl::pw_aff &pma2) const
  17739. {
  17740. if (!ptr)
  17741. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17742. return this->sub(isl::pw_multi_aff(pma2));
  17743. }
  17744. isl::pw_multi_aff pw_multi_aff::subtract_domain(isl::set set) const
  17745. {
  17746. if (!ptr || set.is_null())
  17747. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17748. auto saved_ctx = ctx();
  17749. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17750. auto res = isl_pw_multi_aff_subtract_domain(copy(), set.release());
  17751. if (!res)
  17752. exception::throw_last_error(saved_ctx);
  17753. return manage(res);
  17754. }
  17755. isl::union_pw_multi_aff pw_multi_aff::subtract_domain(const isl::space &space) const
  17756. {
  17757. if (!ptr)
  17758. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17759. return isl::union_pw_multi_aff(*this).subtract_domain(space);
  17760. }
  17761. isl::union_pw_multi_aff pw_multi_aff::subtract_domain(const isl::union_set &uset) const
  17762. {
  17763. if (!ptr)
  17764. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17765. return isl::union_pw_multi_aff(*this).subtract_domain(uset);
  17766. }
  17767. isl::pw_multi_aff pw_multi_aff::subtract_domain(const isl::basic_set &set) const
  17768. {
  17769. if (!ptr)
  17770. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17771. return this->subtract_domain(isl::set(set));
  17772. }
  17773. isl::pw_multi_aff pw_multi_aff::subtract_domain(const isl::point &set) const
  17774. {
  17775. if (!ptr)
  17776. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17777. return this->subtract_domain(isl::set(set));
  17778. }
  17779. isl::pw_multi_aff_list pw_multi_aff::to_list() const
  17780. {
  17781. if (!ptr)
  17782. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17783. auto saved_ctx = ctx();
  17784. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17785. auto res = isl_pw_multi_aff_to_list(copy());
  17786. if (!res)
  17787. exception::throw_last_error(saved_ctx);
  17788. return manage(res);
  17789. }
  17790. isl::multi_pw_aff pw_multi_aff::to_multi_pw_aff() const
  17791. {
  17792. if (!ptr)
  17793. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17794. auto saved_ctx = ctx();
  17795. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17796. auto res = isl_pw_multi_aff_to_multi_pw_aff(copy());
  17797. if (!res)
  17798. exception::throw_last_error(saved_ctx);
  17799. return manage(res);
  17800. }
  17801. isl::union_pw_multi_aff pw_multi_aff::to_union_pw_multi_aff() const
  17802. {
  17803. if (!ptr)
  17804. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17805. auto saved_ctx = ctx();
  17806. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17807. auto res = isl_pw_multi_aff_to_union_pw_multi_aff(copy());
  17808. if (!res)
  17809. exception::throw_last_error(saved_ctx);
  17810. return manage(res);
  17811. }
  17812. isl::multi_pw_aff pw_multi_aff::unbind_params_insert_domain(const isl::multi_id &domain) const
  17813. {
  17814. if (!ptr)
  17815. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17816. return isl::multi_pw_aff(*this).unbind_params_insert_domain(domain);
  17817. }
  17818. isl::multi_pw_aff pw_multi_aff::union_add(const isl::multi_pw_aff &mpa2) const
  17819. {
  17820. if (!ptr)
  17821. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17822. return isl::multi_pw_aff(*this).union_add(mpa2);
  17823. }
  17824. isl::multi_union_pw_aff pw_multi_aff::union_add(const isl::multi_union_pw_aff &mupa2) const
  17825. {
  17826. if (!ptr)
  17827. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17828. return isl::multi_pw_aff(*this).union_add(mupa2);
  17829. }
  17830. isl::pw_multi_aff pw_multi_aff::union_add(isl::pw_multi_aff pma2) const
  17831. {
  17832. if (!ptr || pma2.is_null())
  17833. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17834. auto saved_ctx = ctx();
  17835. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17836. auto res = isl_pw_multi_aff_union_add(copy(), pma2.release());
  17837. if (!res)
  17838. exception::throw_last_error(saved_ctx);
  17839. return manage(res);
  17840. }
  17841. isl::union_pw_multi_aff pw_multi_aff::union_add(const isl::union_pw_multi_aff &upma2) const
  17842. {
  17843. if (!ptr)
  17844. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17845. return isl::union_pw_multi_aff(*this).union_add(upma2);
  17846. }
  17847. isl::pw_multi_aff pw_multi_aff::union_add(const isl::multi_aff &pma2) const
  17848. {
  17849. if (!ptr)
  17850. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17851. return this->union_add(isl::pw_multi_aff(pma2));
  17852. }
  17853. isl::pw_multi_aff pw_multi_aff::union_add(const isl::pw_aff &pma2) const
  17854. {
  17855. if (!ptr)
  17856. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17857. return this->union_add(isl::pw_multi_aff(pma2));
  17858. }
  17859. isl::pw_multi_aff pw_multi_aff::zero(isl::space space)
  17860. {
  17861. if (space.is_null())
  17862. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17863. auto saved_ctx = space.ctx();
  17864. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17865. auto res = isl_pw_multi_aff_zero(space.release());
  17866. if (!res)
  17867. exception::throw_last_error(saved_ctx);
  17868. return manage(res);
  17869. }
  17870. inline std::ostream &operator<<(std::ostream &os, const pw_multi_aff &obj)
  17871. {
  17872. if (!obj.get())
  17873. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17874. auto saved_ctx = isl_pw_multi_aff_get_ctx(obj.get());
  17875. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17876. char *str = isl_pw_multi_aff_to_str(obj.get());
  17877. if (!str)
  17878. exception::throw_last_error(saved_ctx);
  17879. os << str;
  17880. free(str);
  17881. return os;
  17882. }
  17883. // implementations for isl::pw_multi_aff_list
  17884. pw_multi_aff_list manage(__isl_take isl_pw_multi_aff_list *ptr) {
  17885. if (!ptr)
  17886. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17887. return pw_multi_aff_list(ptr);
  17888. }
  17889. pw_multi_aff_list manage_copy(__isl_keep isl_pw_multi_aff_list *ptr) {
  17890. if (!ptr)
  17891. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17892. auto saved_ctx = isl_pw_multi_aff_list_get_ctx(ptr);
  17893. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17894. ptr = isl_pw_multi_aff_list_copy(ptr);
  17895. if (!ptr)
  17896. exception::throw_last_error(saved_ctx);
  17897. return pw_multi_aff_list(ptr);
  17898. }
  17899. pw_multi_aff_list::pw_multi_aff_list(__isl_take isl_pw_multi_aff_list *ptr)
  17900. : ptr(ptr) {}
  17901. pw_multi_aff_list::pw_multi_aff_list()
  17902. : ptr(nullptr) {}
  17903. pw_multi_aff_list::pw_multi_aff_list(const pw_multi_aff_list &obj)
  17904. : ptr(nullptr)
  17905. {
  17906. if (!obj.ptr)
  17907. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17908. auto saved_ctx = isl_pw_multi_aff_list_get_ctx(obj.ptr);
  17909. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17910. ptr = obj.copy();
  17911. if (!ptr)
  17912. exception::throw_last_error(saved_ctx);
  17913. }
  17914. pw_multi_aff_list::pw_multi_aff_list(isl::ctx ctx, int n)
  17915. {
  17916. auto saved_ctx = ctx;
  17917. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17918. auto res = isl_pw_multi_aff_list_alloc(ctx.release(), n);
  17919. if (!res)
  17920. exception::throw_last_error(saved_ctx);
  17921. ptr = res;
  17922. }
  17923. pw_multi_aff_list::pw_multi_aff_list(isl::pw_multi_aff el)
  17924. {
  17925. if (el.is_null())
  17926. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17927. auto saved_ctx = el.ctx();
  17928. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17929. auto res = isl_pw_multi_aff_list_from_pw_multi_aff(el.release());
  17930. if (!res)
  17931. exception::throw_last_error(saved_ctx);
  17932. ptr = res;
  17933. }
  17934. pw_multi_aff_list::pw_multi_aff_list(isl::ctx ctx, const std::string &str)
  17935. {
  17936. auto saved_ctx = ctx;
  17937. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17938. auto res = isl_pw_multi_aff_list_read_from_str(ctx.release(), str.c_str());
  17939. if (!res)
  17940. exception::throw_last_error(saved_ctx);
  17941. ptr = res;
  17942. }
  17943. pw_multi_aff_list &pw_multi_aff_list::operator=(pw_multi_aff_list obj) {
  17944. std::swap(this->ptr, obj.ptr);
  17945. return *this;
  17946. }
  17947. pw_multi_aff_list::~pw_multi_aff_list() {
  17948. if (ptr)
  17949. isl_pw_multi_aff_list_free(ptr);
  17950. }
  17951. __isl_give isl_pw_multi_aff_list *pw_multi_aff_list::copy() const & {
  17952. return isl_pw_multi_aff_list_copy(ptr);
  17953. }
  17954. __isl_keep isl_pw_multi_aff_list *pw_multi_aff_list::get() const {
  17955. return ptr;
  17956. }
  17957. __isl_give isl_pw_multi_aff_list *pw_multi_aff_list::release() {
  17958. isl_pw_multi_aff_list *tmp = ptr;
  17959. ptr = nullptr;
  17960. return tmp;
  17961. }
  17962. bool pw_multi_aff_list::is_null() const {
  17963. return ptr == nullptr;
  17964. }
  17965. isl::ctx pw_multi_aff_list::ctx() const {
  17966. return isl::ctx(isl_pw_multi_aff_list_get_ctx(ptr));
  17967. }
  17968. isl::pw_multi_aff_list pw_multi_aff_list::add(isl::pw_multi_aff el) const
  17969. {
  17970. if (!ptr || el.is_null())
  17971. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17972. auto saved_ctx = ctx();
  17973. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17974. auto res = isl_pw_multi_aff_list_add(copy(), el.release());
  17975. if (!res)
  17976. exception::throw_last_error(saved_ctx);
  17977. return manage(res);
  17978. }
  17979. isl::pw_multi_aff pw_multi_aff_list::at(int index) const
  17980. {
  17981. if (!ptr)
  17982. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17983. auto saved_ctx = ctx();
  17984. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  17985. auto res = isl_pw_multi_aff_list_get_at(get(), index);
  17986. if (!res)
  17987. exception::throw_last_error(saved_ctx);
  17988. return manage(res);
  17989. }
  17990. isl::pw_multi_aff pw_multi_aff_list::get_at(int index) const
  17991. {
  17992. return at(index);
  17993. }
  17994. isl::pw_multi_aff_list pw_multi_aff_list::clear() const
  17995. {
  17996. if (!ptr)
  17997. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  17998. auto saved_ctx = ctx();
  17999. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18000. auto res = isl_pw_multi_aff_list_clear(copy());
  18001. if (!res)
  18002. exception::throw_last_error(saved_ctx);
  18003. return manage(res);
  18004. }
  18005. isl::pw_multi_aff_list pw_multi_aff_list::concat(isl::pw_multi_aff_list list2) const
  18006. {
  18007. if (!ptr || list2.is_null())
  18008. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18009. auto saved_ctx = ctx();
  18010. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18011. auto res = isl_pw_multi_aff_list_concat(copy(), list2.release());
  18012. if (!res)
  18013. exception::throw_last_error(saved_ctx);
  18014. return manage(res);
  18015. }
  18016. isl::pw_multi_aff_list pw_multi_aff_list::drop(unsigned int first, unsigned int n) const
  18017. {
  18018. if (!ptr)
  18019. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18020. auto saved_ctx = ctx();
  18021. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18022. auto res = isl_pw_multi_aff_list_drop(copy(), first, n);
  18023. if (!res)
  18024. exception::throw_last_error(saved_ctx);
  18025. return manage(res);
  18026. }
  18027. void pw_multi_aff_list::foreach(const std::function<void(isl::pw_multi_aff)> &fn) const
  18028. {
  18029. if (!ptr)
  18030. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18031. auto saved_ctx = ctx();
  18032. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18033. struct fn_data {
  18034. std::function<void(isl::pw_multi_aff)> func;
  18035. std::exception_ptr eptr;
  18036. } fn_data = { fn };
  18037. auto fn_lambda = [](isl_pw_multi_aff *arg_0, void *arg_1) -> isl_stat {
  18038. auto *data = static_cast<struct fn_data *>(arg_1);
  18039. ISL_CPP_TRY {
  18040. (data->func)(manage(arg_0));
  18041. return isl_stat_ok;
  18042. } ISL_CPP_CATCH_ALL {
  18043. data->eptr = std::current_exception();
  18044. return isl_stat_error;
  18045. }
  18046. };
  18047. auto res = isl_pw_multi_aff_list_foreach(get(), fn_lambda, &fn_data);
  18048. if (fn_data.eptr)
  18049. std::rethrow_exception(fn_data.eptr);
  18050. if (res < 0)
  18051. exception::throw_last_error(saved_ctx);
  18052. return;
  18053. }
  18054. void pw_multi_aff_list::foreach_scc(const std::function<bool(isl::pw_multi_aff, isl::pw_multi_aff)> &follows, const std::function<void(isl::pw_multi_aff_list)> &fn) const
  18055. {
  18056. if (!ptr)
  18057. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18058. auto saved_ctx = ctx();
  18059. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18060. struct follows_data {
  18061. std::function<bool(isl::pw_multi_aff, isl::pw_multi_aff)> func;
  18062. std::exception_ptr eptr;
  18063. } follows_data = { follows };
  18064. auto follows_lambda = [](isl_pw_multi_aff *arg_0, isl_pw_multi_aff *arg_1, void *arg_2) -> isl_bool {
  18065. auto *data = static_cast<struct follows_data *>(arg_2);
  18066. ISL_CPP_TRY {
  18067. auto ret = (data->func)(manage_copy(arg_0), manage_copy(arg_1));
  18068. return ret ? isl_bool_true : isl_bool_false;
  18069. } ISL_CPP_CATCH_ALL {
  18070. data->eptr = std::current_exception();
  18071. return isl_bool_error;
  18072. }
  18073. };
  18074. struct fn_data {
  18075. std::function<void(isl::pw_multi_aff_list)> func;
  18076. std::exception_ptr eptr;
  18077. } fn_data = { fn };
  18078. auto fn_lambda = [](isl_pw_multi_aff_list *arg_0, void *arg_1) -> isl_stat {
  18079. auto *data = static_cast<struct fn_data *>(arg_1);
  18080. ISL_CPP_TRY {
  18081. (data->func)(manage(arg_0));
  18082. return isl_stat_ok;
  18083. } ISL_CPP_CATCH_ALL {
  18084. data->eptr = std::current_exception();
  18085. return isl_stat_error;
  18086. }
  18087. };
  18088. auto res = isl_pw_multi_aff_list_foreach_scc(get(), follows_lambda, &follows_data, fn_lambda, &fn_data);
  18089. if (follows_data.eptr)
  18090. std::rethrow_exception(follows_data.eptr);
  18091. if (fn_data.eptr)
  18092. std::rethrow_exception(fn_data.eptr);
  18093. if (res < 0)
  18094. exception::throw_last_error(saved_ctx);
  18095. return;
  18096. }
  18097. isl::pw_multi_aff_list pw_multi_aff_list::insert(unsigned int pos, isl::pw_multi_aff el) const
  18098. {
  18099. if (!ptr || el.is_null())
  18100. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18101. auto saved_ctx = ctx();
  18102. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18103. auto res = isl_pw_multi_aff_list_insert(copy(), pos, el.release());
  18104. if (!res)
  18105. exception::throw_last_error(saved_ctx);
  18106. return manage(res);
  18107. }
  18108. unsigned pw_multi_aff_list::size() const
  18109. {
  18110. if (!ptr)
  18111. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18112. auto saved_ctx = ctx();
  18113. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18114. auto res = isl_pw_multi_aff_list_size(get());
  18115. if (res < 0)
  18116. exception::throw_last_error(saved_ctx);
  18117. return res;
  18118. }
  18119. inline std::ostream &operator<<(std::ostream &os, const pw_multi_aff_list &obj)
  18120. {
  18121. if (!obj.get())
  18122. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18123. auto saved_ctx = isl_pw_multi_aff_list_get_ctx(obj.get());
  18124. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18125. char *str = isl_pw_multi_aff_list_to_str(obj.get());
  18126. if (!str)
  18127. exception::throw_last_error(saved_ctx);
  18128. os << str;
  18129. free(str);
  18130. return os;
  18131. }
  18132. // implementations for isl::schedule
  18133. schedule manage(__isl_take isl_schedule *ptr) {
  18134. if (!ptr)
  18135. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18136. return schedule(ptr);
  18137. }
  18138. schedule manage_copy(__isl_keep isl_schedule *ptr) {
  18139. if (!ptr)
  18140. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18141. auto saved_ctx = isl_schedule_get_ctx(ptr);
  18142. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18143. ptr = isl_schedule_copy(ptr);
  18144. if (!ptr)
  18145. exception::throw_last_error(saved_ctx);
  18146. return schedule(ptr);
  18147. }
  18148. schedule::schedule(__isl_take isl_schedule *ptr)
  18149. : ptr(ptr) {}
  18150. schedule::schedule()
  18151. : ptr(nullptr) {}
  18152. schedule::schedule(const schedule &obj)
  18153. : ptr(nullptr)
  18154. {
  18155. if (!obj.ptr)
  18156. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18157. auto saved_ctx = isl_schedule_get_ctx(obj.ptr);
  18158. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18159. ptr = obj.copy();
  18160. if (!ptr)
  18161. exception::throw_last_error(saved_ctx);
  18162. }
  18163. schedule::schedule(isl::ctx ctx, const std::string &str)
  18164. {
  18165. auto saved_ctx = ctx;
  18166. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18167. auto res = isl_schedule_read_from_str(ctx.release(), str.c_str());
  18168. if (!res)
  18169. exception::throw_last_error(saved_ctx);
  18170. ptr = res;
  18171. }
  18172. schedule &schedule::operator=(schedule obj) {
  18173. std::swap(this->ptr, obj.ptr);
  18174. return *this;
  18175. }
  18176. schedule::~schedule() {
  18177. if (ptr)
  18178. isl_schedule_free(ptr);
  18179. }
  18180. __isl_give isl_schedule *schedule::copy() const & {
  18181. return isl_schedule_copy(ptr);
  18182. }
  18183. __isl_keep isl_schedule *schedule::get() const {
  18184. return ptr;
  18185. }
  18186. __isl_give isl_schedule *schedule::release() {
  18187. isl_schedule *tmp = ptr;
  18188. ptr = nullptr;
  18189. return tmp;
  18190. }
  18191. bool schedule::is_null() const {
  18192. return ptr == nullptr;
  18193. }
  18194. isl::ctx schedule::ctx() const {
  18195. return isl::ctx(isl_schedule_get_ctx(ptr));
  18196. }
  18197. isl::union_set schedule::domain() const
  18198. {
  18199. if (!ptr)
  18200. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18201. auto saved_ctx = ctx();
  18202. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18203. auto res = isl_schedule_get_domain(get());
  18204. if (!res)
  18205. exception::throw_last_error(saved_ctx);
  18206. return manage(res);
  18207. }
  18208. isl::union_set schedule::get_domain() const
  18209. {
  18210. return domain();
  18211. }
  18212. isl::schedule schedule::from_domain(isl::union_set domain)
  18213. {
  18214. if (domain.is_null())
  18215. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18216. auto saved_ctx = domain.ctx();
  18217. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18218. auto res = isl_schedule_from_domain(domain.release());
  18219. if (!res)
  18220. exception::throw_last_error(saved_ctx);
  18221. return manage(res);
  18222. }
  18223. isl::union_map schedule::map() const
  18224. {
  18225. if (!ptr)
  18226. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18227. auto saved_ctx = ctx();
  18228. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18229. auto res = isl_schedule_get_map(get());
  18230. if (!res)
  18231. exception::throw_last_error(saved_ctx);
  18232. return manage(res);
  18233. }
  18234. isl::union_map schedule::get_map() const
  18235. {
  18236. return map();
  18237. }
  18238. isl::schedule schedule::pullback(isl::union_pw_multi_aff upma) const
  18239. {
  18240. if (!ptr || upma.is_null())
  18241. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18242. auto saved_ctx = ctx();
  18243. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18244. auto res = isl_schedule_pullback_union_pw_multi_aff(copy(), upma.release());
  18245. if (!res)
  18246. exception::throw_last_error(saved_ctx);
  18247. return manage(res);
  18248. }
  18249. isl::schedule_node schedule::root() const
  18250. {
  18251. if (!ptr)
  18252. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18253. auto saved_ctx = ctx();
  18254. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18255. auto res = isl_schedule_get_root(get());
  18256. if (!res)
  18257. exception::throw_last_error(saved_ctx);
  18258. return manage(res);
  18259. }
  18260. isl::schedule_node schedule::get_root() const
  18261. {
  18262. return root();
  18263. }
  18264. inline std::ostream &operator<<(std::ostream &os, const schedule &obj)
  18265. {
  18266. if (!obj.get())
  18267. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18268. auto saved_ctx = isl_schedule_get_ctx(obj.get());
  18269. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18270. char *str = isl_schedule_to_str(obj.get());
  18271. if (!str)
  18272. exception::throw_last_error(saved_ctx);
  18273. os << str;
  18274. free(str);
  18275. return os;
  18276. }
  18277. // implementations for isl::schedule_constraints
  18278. schedule_constraints manage(__isl_take isl_schedule_constraints *ptr) {
  18279. if (!ptr)
  18280. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18281. return schedule_constraints(ptr);
  18282. }
  18283. schedule_constraints manage_copy(__isl_keep isl_schedule_constraints *ptr) {
  18284. if (!ptr)
  18285. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18286. auto saved_ctx = isl_schedule_constraints_get_ctx(ptr);
  18287. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18288. ptr = isl_schedule_constraints_copy(ptr);
  18289. if (!ptr)
  18290. exception::throw_last_error(saved_ctx);
  18291. return schedule_constraints(ptr);
  18292. }
  18293. schedule_constraints::schedule_constraints(__isl_take isl_schedule_constraints *ptr)
  18294. : ptr(ptr) {}
  18295. schedule_constraints::schedule_constraints()
  18296. : ptr(nullptr) {}
  18297. schedule_constraints::schedule_constraints(const schedule_constraints &obj)
  18298. : ptr(nullptr)
  18299. {
  18300. if (!obj.ptr)
  18301. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18302. auto saved_ctx = isl_schedule_constraints_get_ctx(obj.ptr);
  18303. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18304. ptr = obj.copy();
  18305. if (!ptr)
  18306. exception::throw_last_error(saved_ctx);
  18307. }
  18308. schedule_constraints::schedule_constraints(isl::ctx ctx, const std::string &str)
  18309. {
  18310. auto saved_ctx = ctx;
  18311. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18312. auto res = isl_schedule_constraints_read_from_str(ctx.release(), str.c_str());
  18313. if (!res)
  18314. exception::throw_last_error(saved_ctx);
  18315. ptr = res;
  18316. }
  18317. schedule_constraints &schedule_constraints::operator=(schedule_constraints obj) {
  18318. std::swap(this->ptr, obj.ptr);
  18319. return *this;
  18320. }
  18321. schedule_constraints::~schedule_constraints() {
  18322. if (ptr)
  18323. isl_schedule_constraints_free(ptr);
  18324. }
  18325. __isl_give isl_schedule_constraints *schedule_constraints::copy() const & {
  18326. return isl_schedule_constraints_copy(ptr);
  18327. }
  18328. __isl_keep isl_schedule_constraints *schedule_constraints::get() const {
  18329. return ptr;
  18330. }
  18331. __isl_give isl_schedule_constraints *schedule_constraints::release() {
  18332. isl_schedule_constraints *tmp = ptr;
  18333. ptr = nullptr;
  18334. return tmp;
  18335. }
  18336. bool schedule_constraints::is_null() const {
  18337. return ptr == nullptr;
  18338. }
  18339. isl::ctx schedule_constraints::ctx() const {
  18340. return isl::ctx(isl_schedule_constraints_get_ctx(ptr));
  18341. }
  18342. isl::union_map schedule_constraints::coincidence() const
  18343. {
  18344. if (!ptr)
  18345. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18346. auto saved_ctx = ctx();
  18347. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18348. auto res = isl_schedule_constraints_get_coincidence(get());
  18349. if (!res)
  18350. exception::throw_last_error(saved_ctx);
  18351. return manage(res);
  18352. }
  18353. isl::union_map schedule_constraints::get_coincidence() const
  18354. {
  18355. return coincidence();
  18356. }
  18357. isl::schedule schedule_constraints::compute_schedule() const
  18358. {
  18359. if (!ptr)
  18360. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18361. auto saved_ctx = ctx();
  18362. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18363. auto res = isl_schedule_constraints_compute_schedule(copy());
  18364. if (!res)
  18365. exception::throw_last_error(saved_ctx);
  18366. return manage(res);
  18367. }
  18368. isl::union_map schedule_constraints::conditional_validity() const
  18369. {
  18370. if (!ptr)
  18371. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18372. auto saved_ctx = ctx();
  18373. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18374. auto res = isl_schedule_constraints_get_conditional_validity(get());
  18375. if (!res)
  18376. exception::throw_last_error(saved_ctx);
  18377. return manage(res);
  18378. }
  18379. isl::union_map schedule_constraints::get_conditional_validity() const
  18380. {
  18381. return conditional_validity();
  18382. }
  18383. isl::union_map schedule_constraints::conditional_validity_condition() const
  18384. {
  18385. if (!ptr)
  18386. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18387. auto saved_ctx = ctx();
  18388. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18389. auto res = isl_schedule_constraints_get_conditional_validity_condition(get());
  18390. if (!res)
  18391. exception::throw_last_error(saved_ctx);
  18392. return manage(res);
  18393. }
  18394. isl::union_map schedule_constraints::get_conditional_validity_condition() const
  18395. {
  18396. return conditional_validity_condition();
  18397. }
  18398. isl::set schedule_constraints::context() const
  18399. {
  18400. if (!ptr)
  18401. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18402. auto saved_ctx = ctx();
  18403. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18404. auto res = isl_schedule_constraints_get_context(get());
  18405. if (!res)
  18406. exception::throw_last_error(saved_ctx);
  18407. return manage(res);
  18408. }
  18409. isl::set schedule_constraints::get_context() const
  18410. {
  18411. return context();
  18412. }
  18413. isl::union_set schedule_constraints::domain() const
  18414. {
  18415. if (!ptr)
  18416. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18417. auto saved_ctx = ctx();
  18418. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18419. auto res = isl_schedule_constraints_get_domain(get());
  18420. if (!res)
  18421. exception::throw_last_error(saved_ctx);
  18422. return manage(res);
  18423. }
  18424. isl::union_set schedule_constraints::get_domain() const
  18425. {
  18426. return domain();
  18427. }
  18428. isl::schedule_constraints schedule_constraints::on_domain(isl::union_set domain)
  18429. {
  18430. if (domain.is_null())
  18431. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18432. auto saved_ctx = domain.ctx();
  18433. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18434. auto res = isl_schedule_constraints_on_domain(domain.release());
  18435. if (!res)
  18436. exception::throw_last_error(saved_ctx);
  18437. return manage(res);
  18438. }
  18439. isl::union_map schedule_constraints::proximity() const
  18440. {
  18441. if (!ptr)
  18442. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18443. auto saved_ctx = ctx();
  18444. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18445. auto res = isl_schedule_constraints_get_proximity(get());
  18446. if (!res)
  18447. exception::throw_last_error(saved_ctx);
  18448. return manage(res);
  18449. }
  18450. isl::union_map schedule_constraints::get_proximity() const
  18451. {
  18452. return proximity();
  18453. }
  18454. isl::schedule_constraints schedule_constraints::set_coincidence(isl::union_map coincidence) const
  18455. {
  18456. if (!ptr || coincidence.is_null())
  18457. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18458. auto saved_ctx = ctx();
  18459. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18460. auto res = isl_schedule_constraints_set_coincidence(copy(), coincidence.release());
  18461. if (!res)
  18462. exception::throw_last_error(saved_ctx);
  18463. return manage(res);
  18464. }
  18465. isl::schedule_constraints schedule_constraints::set_conditional_validity(isl::union_map condition, isl::union_map validity) const
  18466. {
  18467. if (!ptr || condition.is_null() || validity.is_null())
  18468. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18469. auto saved_ctx = ctx();
  18470. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18471. auto res = isl_schedule_constraints_set_conditional_validity(copy(), condition.release(), validity.release());
  18472. if (!res)
  18473. exception::throw_last_error(saved_ctx);
  18474. return manage(res);
  18475. }
  18476. isl::schedule_constraints schedule_constraints::set_context(isl::set context) const
  18477. {
  18478. if (!ptr || context.is_null())
  18479. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18480. auto saved_ctx = ctx();
  18481. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18482. auto res = isl_schedule_constraints_set_context(copy(), context.release());
  18483. if (!res)
  18484. exception::throw_last_error(saved_ctx);
  18485. return manage(res);
  18486. }
  18487. isl::schedule_constraints schedule_constraints::set_proximity(isl::union_map proximity) const
  18488. {
  18489. if (!ptr || proximity.is_null())
  18490. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18491. auto saved_ctx = ctx();
  18492. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18493. auto res = isl_schedule_constraints_set_proximity(copy(), proximity.release());
  18494. if (!res)
  18495. exception::throw_last_error(saved_ctx);
  18496. return manage(res);
  18497. }
  18498. isl::schedule_constraints schedule_constraints::set_validity(isl::union_map validity) const
  18499. {
  18500. if (!ptr || validity.is_null())
  18501. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18502. auto saved_ctx = ctx();
  18503. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18504. auto res = isl_schedule_constraints_set_validity(copy(), validity.release());
  18505. if (!res)
  18506. exception::throw_last_error(saved_ctx);
  18507. return manage(res);
  18508. }
  18509. isl::union_map schedule_constraints::validity() const
  18510. {
  18511. if (!ptr)
  18512. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18513. auto saved_ctx = ctx();
  18514. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18515. auto res = isl_schedule_constraints_get_validity(get());
  18516. if (!res)
  18517. exception::throw_last_error(saved_ctx);
  18518. return manage(res);
  18519. }
  18520. isl::union_map schedule_constraints::get_validity() const
  18521. {
  18522. return validity();
  18523. }
  18524. inline std::ostream &operator<<(std::ostream &os, const schedule_constraints &obj)
  18525. {
  18526. if (!obj.get())
  18527. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18528. auto saved_ctx = isl_schedule_constraints_get_ctx(obj.get());
  18529. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18530. char *str = isl_schedule_constraints_to_str(obj.get());
  18531. if (!str)
  18532. exception::throw_last_error(saved_ctx);
  18533. os << str;
  18534. free(str);
  18535. return os;
  18536. }
  18537. // implementations for isl::schedule_node
  18538. schedule_node manage(__isl_take isl_schedule_node *ptr) {
  18539. if (!ptr)
  18540. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18541. return schedule_node(ptr);
  18542. }
  18543. schedule_node manage_copy(__isl_keep isl_schedule_node *ptr) {
  18544. if (!ptr)
  18545. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18546. auto saved_ctx = isl_schedule_node_get_ctx(ptr);
  18547. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18548. ptr = isl_schedule_node_copy(ptr);
  18549. if (!ptr)
  18550. exception::throw_last_error(saved_ctx);
  18551. return schedule_node(ptr);
  18552. }
  18553. schedule_node::schedule_node(__isl_take isl_schedule_node *ptr)
  18554. : ptr(ptr) {}
  18555. schedule_node::schedule_node()
  18556. : ptr(nullptr) {}
  18557. schedule_node::schedule_node(const schedule_node &obj)
  18558. : ptr(nullptr)
  18559. {
  18560. if (!obj.ptr)
  18561. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18562. auto saved_ctx = isl_schedule_node_get_ctx(obj.ptr);
  18563. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18564. ptr = obj.copy();
  18565. if (!ptr)
  18566. exception::throw_last_error(saved_ctx);
  18567. }
  18568. schedule_node &schedule_node::operator=(schedule_node obj) {
  18569. std::swap(this->ptr, obj.ptr);
  18570. return *this;
  18571. }
  18572. schedule_node::~schedule_node() {
  18573. if (ptr)
  18574. isl_schedule_node_free(ptr);
  18575. }
  18576. __isl_give isl_schedule_node *schedule_node::copy() const & {
  18577. return isl_schedule_node_copy(ptr);
  18578. }
  18579. __isl_keep isl_schedule_node *schedule_node::get() const {
  18580. return ptr;
  18581. }
  18582. __isl_give isl_schedule_node *schedule_node::release() {
  18583. isl_schedule_node *tmp = ptr;
  18584. ptr = nullptr;
  18585. return tmp;
  18586. }
  18587. bool schedule_node::is_null() const {
  18588. return ptr == nullptr;
  18589. }
  18590. template <typename T, typename>
  18591. bool schedule_node::isa_type(T subtype) const
  18592. {
  18593. if (is_null())
  18594. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18595. return isl_schedule_node_get_type(get()) == subtype;
  18596. }
  18597. template <class T>
  18598. bool schedule_node::isa() const
  18599. {
  18600. return isa_type<decltype(T::type)>(T::type);
  18601. }
  18602. template <class T>
  18603. T schedule_node::as() const
  18604. {
  18605. if (!isa<T>())
  18606. exception::throw_invalid("not an object of the requested subtype", __FILE__, __LINE__);
  18607. return T(copy());
  18608. }
  18609. isl::ctx schedule_node::ctx() const {
  18610. return isl::ctx(isl_schedule_node_get_ctx(ptr));
  18611. }
  18612. isl::schedule_node schedule_node::ancestor(int generation) const
  18613. {
  18614. if (!ptr)
  18615. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18616. auto saved_ctx = ctx();
  18617. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18618. auto res = isl_schedule_node_ancestor(copy(), generation);
  18619. if (!res)
  18620. exception::throw_last_error(saved_ctx);
  18621. return manage(res);
  18622. }
  18623. unsigned schedule_node::ancestor_child_position(const isl::schedule_node &ancestor) const
  18624. {
  18625. if (!ptr || ancestor.is_null())
  18626. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18627. auto saved_ctx = ctx();
  18628. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18629. auto res = isl_schedule_node_get_ancestor_child_position(get(), ancestor.get());
  18630. if (res < 0)
  18631. exception::throw_last_error(saved_ctx);
  18632. return res;
  18633. }
  18634. unsigned schedule_node::get_ancestor_child_position(const isl::schedule_node &ancestor) const
  18635. {
  18636. return ancestor_child_position(ancestor);
  18637. }
  18638. isl::schedule_node schedule_node::child(int pos) const
  18639. {
  18640. if (!ptr)
  18641. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18642. auto saved_ctx = ctx();
  18643. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18644. auto res = isl_schedule_node_child(copy(), pos);
  18645. if (!res)
  18646. exception::throw_last_error(saved_ctx);
  18647. return manage(res);
  18648. }
  18649. unsigned schedule_node::child_position() const
  18650. {
  18651. if (!ptr)
  18652. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18653. auto saved_ctx = ctx();
  18654. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18655. auto res = isl_schedule_node_get_child_position(get());
  18656. if (res < 0)
  18657. exception::throw_last_error(saved_ctx);
  18658. return res;
  18659. }
  18660. unsigned schedule_node::get_child_position() const
  18661. {
  18662. return child_position();
  18663. }
  18664. bool schedule_node::every_descendant(const std::function<bool(isl::schedule_node)> &test) const
  18665. {
  18666. if (!ptr)
  18667. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18668. auto saved_ctx = ctx();
  18669. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18670. struct test_data {
  18671. std::function<bool(isl::schedule_node)> func;
  18672. std::exception_ptr eptr;
  18673. } test_data = { test };
  18674. auto test_lambda = [](isl_schedule_node *arg_0, void *arg_1) -> isl_bool {
  18675. auto *data = static_cast<struct test_data *>(arg_1);
  18676. ISL_CPP_TRY {
  18677. auto ret = (data->func)(manage_copy(arg_0));
  18678. return ret ? isl_bool_true : isl_bool_false;
  18679. } ISL_CPP_CATCH_ALL {
  18680. data->eptr = std::current_exception();
  18681. return isl_bool_error;
  18682. }
  18683. };
  18684. auto res = isl_schedule_node_every_descendant(get(), test_lambda, &test_data);
  18685. if (test_data.eptr)
  18686. std::rethrow_exception(test_data.eptr);
  18687. if (res < 0)
  18688. exception::throw_last_error(saved_ctx);
  18689. return res;
  18690. }
  18691. isl::schedule_node schedule_node::first_child() const
  18692. {
  18693. if (!ptr)
  18694. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18695. auto saved_ctx = ctx();
  18696. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18697. auto res = isl_schedule_node_first_child(copy());
  18698. if (!res)
  18699. exception::throw_last_error(saved_ctx);
  18700. return manage(res);
  18701. }
  18702. void schedule_node::foreach_ancestor_top_down(const std::function<void(isl::schedule_node)> &fn) const
  18703. {
  18704. if (!ptr)
  18705. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18706. auto saved_ctx = ctx();
  18707. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18708. struct fn_data {
  18709. std::function<void(isl::schedule_node)> func;
  18710. std::exception_ptr eptr;
  18711. } fn_data = { fn };
  18712. auto fn_lambda = [](isl_schedule_node *arg_0, void *arg_1) -> isl_stat {
  18713. auto *data = static_cast<struct fn_data *>(arg_1);
  18714. ISL_CPP_TRY {
  18715. (data->func)(manage_copy(arg_0));
  18716. return isl_stat_ok;
  18717. } ISL_CPP_CATCH_ALL {
  18718. data->eptr = std::current_exception();
  18719. return isl_stat_error;
  18720. }
  18721. };
  18722. auto res = isl_schedule_node_foreach_ancestor_top_down(get(), fn_lambda, &fn_data);
  18723. if (fn_data.eptr)
  18724. std::rethrow_exception(fn_data.eptr);
  18725. if (res < 0)
  18726. exception::throw_last_error(saved_ctx);
  18727. return;
  18728. }
  18729. void schedule_node::foreach_descendant_top_down(const std::function<bool(isl::schedule_node)> &fn) const
  18730. {
  18731. if (!ptr)
  18732. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18733. auto saved_ctx = ctx();
  18734. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18735. struct fn_data {
  18736. std::function<bool(isl::schedule_node)> func;
  18737. std::exception_ptr eptr;
  18738. } fn_data = { fn };
  18739. auto fn_lambda = [](isl_schedule_node *arg_0, void *arg_1) -> isl_bool {
  18740. auto *data = static_cast<struct fn_data *>(arg_1);
  18741. ISL_CPP_TRY {
  18742. auto ret = (data->func)(manage_copy(arg_0));
  18743. return ret ? isl_bool_true : isl_bool_false;
  18744. } ISL_CPP_CATCH_ALL {
  18745. data->eptr = std::current_exception();
  18746. return isl_bool_error;
  18747. }
  18748. };
  18749. auto res = isl_schedule_node_foreach_descendant_top_down(get(), fn_lambda, &fn_data);
  18750. if (fn_data.eptr)
  18751. std::rethrow_exception(fn_data.eptr);
  18752. if (res < 0)
  18753. exception::throw_last_error(saved_ctx);
  18754. return;
  18755. }
  18756. isl::schedule_node schedule_node::from_domain(isl::union_set domain)
  18757. {
  18758. if (domain.is_null())
  18759. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18760. auto saved_ctx = domain.ctx();
  18761. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18762. auto res = isl_schedule_node_from_domain(domain.release());
  18763. if (!res)
  18764. exception::throw_last_error(saved_ctx);
  18765. return manage(res);
  18766. }
  18767. isl::schedule_node schedule_node::from_extension(isl::union_map extension)
  18768. {
  18769. if (extension.is_null())
  18770. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18771. auto saved_ctx = extension.ctx();
  18772. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18773. auto res = isl_schedule_node_from_extension(extension.release());
  18774. if (!res)
  18775. exception::throw_last_error(saved_ctx);
  18776. return manage(res);
  18777. }
  18778. isl::schedule_node schedule_node::graft_after(isl::schedule_node graft) const
  18779. {
  18780. if (!ptr || graft.is_null())
  18781. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18782. auto saved_ctx = ctx();
  18783. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18784. auto res = isl_schedule_node_graft_after(copy(), graft.release());
  18785. if (!res)
  18786. exception::throw_last_error(saved_ctx);
  18787. return manage(res);
  18788. }
  18789. isl::schedule_node schedule_node::graft_before(isl::schedule_node graft) const
  18790. {
  18791. if (!ptr || graft.is_null())
  18792. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18793. auto saved_ctx = ctx();
  18794. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18795. auto res = isl_schedule_node_graft_before(copy(), graft.release());
  18796. if (!res)
  18797. exception::throw_last_error(saved_ctx);
  18798. return manage(res);
  18799. }
  18800. bool schedule_node::has_children() const
  18801. {
  18802. if (!ptr)
  18803. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18804. auto saved_ctx = ctx();
  18805. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18806. auto res = isl_schedule_node_has_children(get());
  18807. if (res < 0)
  18808. exception::throw_last_error(saved_ctx);
  18809. return res;
  18810. }
  18811. bool schedule_node::has_next_sibling() const
  18812. {
  18813. if (!ptr)
  18814. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18815. auto saved_ctx = ctx();
  18816. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18817. auto res = isl_schedule_node_has_next_sibling(get());
  18818. if (res < 0)
  18819. exception::throw_last_error(saved_ctx);
  18820. return res;
  18821. }
  18822. bool schedule_node::has_parent() const
  18823. {
  18824. if (!ptr)
  18825. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18826. auto saved_ctx = ctx();
  18827. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18828. auto res = isl_schedule_node_has_parent(get());
  18829. if (res < 0)
  18830. exception::throw_last_error(saved_ctx);
  18831. return res;
  18832. }
  18833. bool schedule_node::has_previous_sibling() const
  18834. {
  18835. if (!ptr)
  18836. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18837. auto saved_ctx = ctx();
  18838. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18839. auto res = isl_schedule_node_has_previous_sibling(get());
  18840. if (res < 0)
  18841. exception::throw_last_error(saved_ctx);
  18842. return res;
  18843. }
  18844. isl::schedule_node schedule_node::insert_context(isl::set context) const
  18845. {
  18846. if (!ptr || context.is_null())
  18847. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18848. auto saved_ctx = ctx();
  18849. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18850. auto res = isl_schedule_node_insert_context(copy(), context.release());
  18851. if (!res)
  18852. exception::throw_last_error(saved_ctx);
  18853. return manage(res);
  18854. }
  18855. isl::schedule_node schedule_node::insert_filter(isl::union_set filter) const
  18856. {
  18857. if (!ptr || filter.is_null())
  18858. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18859. auto saved_ctx = ctx();
  18860. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18861. auto res = isl_schedule_node_insert_filter(copy(), filter.release());
  18862. if (!res)
  18863. exception::throw_last_error(saved_ctx);
  18864. return manage(res);
  18865. }
  18866. isl::schedule_node schedule_node::insert_guard(isl::set context) const
  18867. {
  18868. if (!ptr || context.is_null())
  18869. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18870. auto saved_ctx = ctx();
  18871. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18872. auto res = isl_schedule_node_insert_guard(copy(), context.release());
  18873. if (!res)
  18874. exception::throw_last_error(saved_ctx);
  18875. return manage(res);
  18876. }
  18877. isl::schedule_node schedule_node::insert_mark(isl::id mark) const
  18878. {
  18879. if (!ptr || mark.is_null())
  18880. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18881. auto saved_ctx = ctx();
  18882. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18883. auto res = isl_schedule_node_insert_mark(copy(), mark.release());
  18884. if (!res)
  18885. exception::throw_last_error(saved_ctx);
  18886. return manage(res);
  18887. }
  18888. isl::schedule_node schedule_node::insert_mark(const std::string &mark) const
  18889. {
  18890. if (!ptr)
  18891. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18892. return this->insert_mark(isl::id(ctx(), mark));
  18893. }
  18894. isl::schedule_node schedule_node::insert_partial_schedule(isl::multi_union_pw_aff schedule) const
  18895. {
  18896. if (!ptr || schedule.is_null())
  18897. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18898. auto saved_ctx = ctx();
  18899. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18900. auto res = isl_schedule_node_insert_partial_schedule(copy(), schedule.release());
  18901. if (!res)
  18902. exception::throw_last_error(saved_ctx);
  18903. return manage(res);
  18904. }
  18905. isl::schedule_node schedule_node::insert_sequence(isl::union_set_list filters) const
  18906. {
  18907. if (!ptr || filters.is_null())
  18908. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18909. auto saved_ctx = ctx();
  18910. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18911. auto res = isl_schedule_node_insert_sequence(copy(), filters.release());
  18912. if (!res)
  18913. exception::throw_last_error(saved_ctx);
  18914. return manage(res);
  18915. }
  18916. isl::schedule_node schedule_node::insert_set(isl::union_set_list filters) const
  18917. {
  18918. if (!ptr || filters.is_null())
  18919. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18920. auto saved_ctx = ctx();
  18921. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18922. auto res = isl_schedule_node_insert_set(copy(), filters.release());
  18923. if (!res)
  18924. exception::throw_last_error(saved_ctx);
  18925. return manage(res);
  18926. }
  18927. bool schedule_node::is_equal(const isl::schedule_node &node2) const
  18928. {
  18929. if (!ptr || node2.is_null())
  18930. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18931. auto saved_ctx = ctx();
  18932. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18933. auto res = isl_schedule_node_is_equal(get(), node2.get());
  18934. if (res < 0)
  18935. exception::throw_last_error(saved_ctx);
  18936. return res;
  18937. }
  18938. bool schedule_node::is_subtree_anchored() const
  18939. {
  18940. if (!ptr)
  18941. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18942. auto saved_ctx = ctx();
  18943. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18944. auto res = isl_schedule_node_is_subtree_anchored(get());
  18945. if (res < 0)
  18946. exception::throw_last_error(saved_ctx);
  18947. return res;
  18948. }
  18949. isl::schedule_node schedule_node::map_descendant_bottom_up(const std::function<isl::schedule_node(isl::schedule_node)> &fn) const
  18950. {
  18951. if (!ptr)
  18952. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18953. auto saved_ctx = ctx();
  18954. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18955. struct fn_data {
  18956. std::function<isl::schedule_node(isl::schedule_node)> func;
  18957. std::exception_ptr eptr;
  18958. } fn_data = { fn };
  18959. auto fn_lambda = [](isl_schedule_node *arg_0, void *arg_1) -> isl_schedule_node * {
  18960. auto *data = static_cast<struct fn_data *>(arg_1);
  18961. ISL_CPP_TRY {
  18962. auto ret = (data->func)(manage(arg_0));
  18963. return ret.release();
  18964. } ISL_CPP_CATCH_ALL {
  18965. data->eptr = std::current_exception();
  18966. return NULL;
  18967. }
  18968. };
  18969. auto res = isl_schedule_node_map_descendant_bottom_up(copy(), fn_lambda, &fn_data);
  18970. if (fn_data.eptr)
  18971. std::rethrow_exception(fn_data.eptr);
  18972. if (!res)
  18973. exception::throw_last_error(saved_ctx);
  18974. return manage(res);
  18975. }
  18976. unsigned schedule_node::n_children() const
  18977. {
  18978. if (!ptr)
  18979. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18980. auto saved_ctx = ctx();
  18981. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18982. auto res = isl_schedule_node_n_children(get());
  18983. if (res < 0)
  18984. exception::throw_last_error(saved_ctx);
  18985. return res;
  18986. }
  18987. isl::schedule_node schedule_node::next_sibling() const
  18988. {
  18989. if (!ptr)
  18990. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  18991. auto saved_ctx = ctx();
  18992. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  18993. auto res = isl_schedule_node_next_sibling(copy());
  18994. if (!res)
  18995. exception::throw_last_error(saved_ctx);
  18996. return manage(res);
  18997. }
  18998. isl::schedule_node schedule_node::order_after(isl::union_set filter) const
  18999. {
  19000. if (!ptr || filter.is_null())
  19001. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19002. auto saved_ctx = ctx();
  19003. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19004. auto res = isl_schedule_node_order_after(copy(), filter.release());
  19005. if (!res)
  19006. exception::throw_last_error(saved_ctx);
  19007. return manage(res);
  19008. }
  19009. isl::schedule_node schedule_node::order_before(isl::union_set filter) const
  19010. {
  19011. if (!ptr || filter.is_null())
  19012. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19013. auto saved_ctx = ctx();
  19014. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19015. auto res = isl_schedule_node_order_before(copy(), filter.release());
  19016. if (!res)
  19017. exception::throw_last_error(saved_ctx);
  19018. return manage(res);
  19019. }
  19020. isl::schedule_node schedule_node::parent() const
  19021. {
  19022. if (!ptr)
  19023. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19024. auto saved_ctx = ctx();
  19025. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19026. auto res = isl_schedule_node_parent(copy());
  19027. if (!res)
  19028. exception::throw_last_error(saved_ctx);
  19029. return manage(res);
  19030. }
  19031. isl::multi_union_pw_aff schedule_node::prefix_schedule_multi_union_pw_aff() const
  19032. {
  19033. if (!ptr)
  19034. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19035. auto saved_ctx = ctx();
  19036. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19037. auto res = isl_schedule_node_get_prefix_schedule_multi_union_pw_aff(get());
  19038. if (!res)
  19039. exception::throw_last_error(saved_ctx);
  19040. return manage(res);
  19041. }
  19042. isl::multi_union_pw_aff schedule_node::get_prefix_schedule_multi_union_pw_aff() const
  19043. {
  19044. return prefix_schedule_multi_union_pw_aff();
  19045. }
  19046. isl::union_map schedule_node::prefix_schedule_union_map() const
  19047. {
  19048. if (!ptr)
  19049. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19050. auto saved_ctx = ctx();
  19051. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19052. auto res = isl_schedule_node_get_prefix_schedule_union_map(get());
  19053. if (!res)
  19054. exception::throw_last_error(saved_ctx);
  19055. return manage(res);
  19056. }
  19057. isl::union_map schedule_node::get_prefix_schedule_union_map() const
  19058. {
  19059. return prefix_schedule_union_map();
  19060. }
  19061. isl::union_pw_multi_aff schedule_node::prefix_schedule_union_pw_multi_aff() const
  19062. {
  19063. if (!ptr)
  19064. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19065. auto saved_ctx = ctx();
  19066. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19067. auto res = isl_schedule_node_get_prefix_schedule_union_pw_multi_aff(get());
  19068. if (!res)
  19069. exception::throw_last_error(saved_ctx);
  19070. return manage(res);
  19071. }
  19072. isl::union_pw_multi_aff schedule_node::get_prefix_schedule_union_pw_multi_aff() const
  19073. {
  19074. return prefix_schedule_union_pw_multi_aff();
  19075. }
  19076. isl::schedule_node schedule_node::previous_sibling() const
  19077. {
  19078. if (!ptr)
  19079. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19080. auto saved_ctx = ctx();
  19081. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19082. auto res = isl_schedule_node_previous_sibling(copy());
  19083. if (!res)
  19084. exception::throw_last_error(saved_ctx);
  19085. return manage(res);
  19086. }
  19087. isl::schedule_node schedule_node::root() const
  19088. {
  19089. if (!ptr)
  19090. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19091. auto saved_ctx = ctx();
  19092. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19093. auto res = isl_schedule_node_root(copy());
  19094. if (!res)
  19095. exception::throw_last_error(saved_ctx);
  19096. return manage(res);
  19097. }
  19098. isl::schedule schedule_node::schedule() const
  19099. {
  19100. if (!ptr)
  19101. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19102. auto saved_ctx = ctx();
  19103. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19104. auto res = isl_schedule_node_get_schedule(get());
  19105. if (!res)
  19106. exception::throw_last_error(saved_ctx);
  19107. return manage(res);
  19108. }
  19109. isl::schedule schedule_node::get_schedule() const
  19110. {
  19111. return schedule();
  19112. }
  19113. isl::schedule_node schedule_node::shared_ancestor(const isl::schedule_node &node2) const
  19114. {
  19115. if (!ptr || node2.is_null())
  19116. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19117. auto saved_ctx = ctx();
  19118. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19119. auto res = isl_schedule_node_get_shared_ancestor(get(), node2.get());
  19120. if (!res)
  19121. exception::throw_last_error(saved_ctx);
  19122. return manage(res);
  19123. }
  19124. isl::schedule_node schedule_node::get_shared_ancestor(const isl::schedule_node &node2) const
  19125. {
  19126. return shared_ancestor(node2);
  19127. }
  19128. unsigned schedule_node::tree_depth() const
  19129. {
  19130. if (!ptr)
  19131. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19132. auto saved_ctx = ctx();
  19133. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19134. auto res = isl_schedule_node_get_tree_depth(get());
  19135. if (res < 0)
  19136. exception::throw_last_error(saved_ctx);
  19137. return res;
  19138. }
  19139. unsigned schedule_node::get_tree_depth() const
  19140. {
  19141. return tree_depth();
  19142. }
  19143. inline std::ostream &operator<<(std::ostream &os, const schedule_node &obj)
  19144. {
  19145. if (!obj.get())
  19146. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19147. auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
  19148. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19149. char *str = isl_schedule_node_to_str(obj.get());
  19150. if (!str)
  19151. exception::throw_last_error(saved_ctx);
  19152. os << str;
  19153. free(str);
  19154. return os;
  19155. }
  19156. // implementations for isl::schedule_node_band
  19157. schedule_node_band::schedule_node_band(__isl_take isl_schedule_node *ptr)
  19158. : schedule_node(ptr) {}
  19159. schedule_node_band::schedule_node_band()
  19160. : schedule_node() {}
  19161. schedule_node_band::schedule_node_band(const schedule_node_band &obj)
  19162. : schedule_node(obj)
  19163. {
  19164. }
  19165. schedule_node_band &schedule_node_band::operator=(schedule_node_band obj) {
  19166. std::swap(this->ptr, obj.ptr);
  19167. return *this;
  19168. }
  19169. isl::ctx schedule_node_band::ctx() const {
  19170. return isl::ctx(isl_schedule_node_get_ctx(ptr));
  19171. }
  19172. isl::union_set schedule_node_band::ast_build_options() const
  19173. {
  19174. if (!ptr)
  19175. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19176. auto saved_ctx = ctx();
  19177. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19178. auto res = isl_schedule_node_band_get_ast_build_options(get());
  19179. if (!res)
  19180. exception::throw_last_error(saved_ctx);
  19181. return manage(res);
  19182. }
  19183. isl::union_set schedule_node_band::get_ast_build_options() const
  19184. {
  19185. return ast_build_options();
  19186. }
  19187. isl::set schedule_node_band::ast_isolate_option() const
  19188. {
  19189. if (!ptr)
  19190. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19191. auto saved_ctx = ctx();
  19192. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19193. auto res = isl_schedule_node_band_get_ast_isolate_option(get());
  19194. if (!res)
  19195. exception::throw_last_error(saved_ctx);
  19196. return manage(res);
  19197. }
  19198. isl::set schedule_node_band::get_ast_isolate_option() const
  19199. {
  19200. return ast_isolate_option();
  19201. }
  19202. bool schedule_node_band::member_get_coincident(int pos) const
  19203. {
  19204. if (!ptr)
  19205. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19206. auto saved_ctx = ctx();
  19207. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19208. auto res = isl_schedule_node_band_member_get_coincident(get(), pos);
  19209. if (res < 0)
  19210. exception::throw_last_error(saved_ctx);
  19211. return res;
  19212. }
  19213. schedule_node_band schedule_node_band::member_set_coincident(int pos, int coincident) const
  19214. {
  19215. if (!ptr)
  19216. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19217. auto saved_ctx = ctx();
  19218. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19219. auto res = isl_schedule_node_band_member_set_coincident(copy(), pos, coincident);
  19220. if (!res)
  19221. exception::throw_last_error(saved_ctx);
  19222. return manage(res).as<schedule_node_band>();
  19223. }
  19224. schedule_node_band schedule_node_band::mod(isl::multi_val mv) const
  19225. {
  19226. if (!ptr || mv.is_null())
  19227. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19228. auto saved_ctx = ctx();
  19229. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19230. auto res = isl_schedule_node_band_mod(copy(), mv.release());
  19231. if (!res)
  19232. exception::throw_last_error(saved_ctx);
  19233. return manage(res).as<schedule_node_band>();
  19234. }
  19235. unsigned schedule_node_band::n_member() const
  19236. {
  19237. if (!ptr)
  19238. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19239. auto saved_ctx = ctx();
  19240. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19241. auto res = isl_schedule_node_band_n_member(get());
  19242. if (res < 0)
  19243. exception::throw_last_error(saved_ctx);
  19244. return res;
  19245. }
  19246. isl::multi_union_pw_aff schedule_node_band::partial_schedule() const
  19247. {
  19248. if (!ptr)
  19249. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19250. auto saved_ctx = ctx();
  19251. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19252. auto res = isl_schedule_node_band_get_partial_schedule(get());
  19253. if (!res)
  19254. exception::throw_last_error(saved_ctx);
  19255. return manage(res);
  19256. }
  19257. isl::multi_union_pw_aff schedule_node_band::get_partial_schedule() const
  19258. {
  19259. return partial_schedule();
  19260. }
  19261. bool schedule_node_band::permutable() const
  19262. {
  19263. if (!ptr)
  19264. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19265. auto saved_ctx = ctx();
  19266. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19267. auto res = isl_schedule_node_band_get_permutable(get());
  19268. if (res < 0)
  19269. exception::throw_last_error(saved_ctx);
  19270. return res;
  19271. }
  19272. bool schedule_node_band::get_permutable() const
  19273. {
  19274. return permutable();
  19275. }
  19276. schedule_node_band schedule_node_band::scale(isl::multi_val mv) const
  19277. {
  19278. if (!ptr || mv.is_null())
  19279. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19280. auto saved_ctx = ctx();
  19281. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19282. auto res = isl_schedule_node_band_scale(copy(), mv.release());
  19283. if (!res)
  19284. exception::throw_last_error(saved_ctx);
  19285. return manage(res).as<schedule_node_band>();
  19286. }
  19287. schedule_node_band schedule_node_band::scale_down(isl::multi_val mv) const
  19288. {
  19289. if (!ptr || mv.is_null())
  19290. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19291. auto saved_ctx = ctx();
  19292. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19293. auto res = isl_schedule_node_band_scale_down(copy(), mv.release());
  19294. if (!res)
  19295. exception::throw_last_error(saved_ctx);
  19296. return manage(res).as<schedule_node_band>();
  19297. }
  19298. schedule_node_band schedule_node_band::set_ast_build_options(isl::union_set options) const
  19299. {
  19300. if (!ptr || options.is_null())
  19301. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19302. auto saved_ctx = ctx();
  19303. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19304. auto res = isl_schedule_node_band_set_ast_build_options(copy(), options.release());
  19305. if (!res)
  19306. exception::throw_last_error(saved_ctx);
  19307. return manage(res).as<schedule_node_band>();
  19308. }
  19309. schedule_node_band schedule_node_band::set_permutable(int permutable) const
  19310. {
  19311. if (!ptr)
  19312. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19313. auto saved_ctx = ctx();
  19314. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19315. auto res = isl_schedule_node_band_set_permutable(copy(), permutable);
  19316. if (!res)
  19317. exception::throw_last_error(saved_ctx);
  19318. return manage(res).as<schedule_node_band>();
  19319. }
  19320. schedule_node_band schedule_node_band::shift(isl::multi_union_pw_aff shift) const
  19321. {
  19322. if (!ptr || shift.is_null())
  19323. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19324. auto saved_ctx = ctx();
  19325. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19326. auto res = isl_schedule_node_band_shift(copy(), shift.release());
  19327. if (!res)
  19328. exception::throw_last_error(saved_ctx);
  19329. return manage(res).as<schedule_node_band>();
  19330. }
  19331. schedule_node_band schedule_node_band::split(int pos) const
  19332. {
  19333. if (!ptr)
  19334. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19335. auto saved_ctx = ctx();
  19336. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19337. auto res = isl_schedule_node_band_split(copy(), pos);
  19338. if (!res)
  19339. exception::throw_last_error(saved_ctx);
  19340. return manage(res).as<schedule_node_band>();
  19341. }
  19342. schedule_node_band schedule_node_band::tile(isl::multi_val sizes) const
  19343. {
  19344. if (!ptr || sizes.is_null())
  19345. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19346. auto saved_ctx = ctx();
  19347. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19348. auto res = isl_schedule_node_band_tile(copy(), sizes.release());
  19349. if (!res)
  19350. exception::throw_last_error(saved_ctx);
  19351. return manage(res).as<schedule_node_band>();
  19352. }
  19353. schedule_node_band schedule_node_band::member_set_ast_loop_default(int pos) const
  19354. {
  19355. if (!ptr)
  19356. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19357. auto saved_ctx = ctx();
  19358. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19359. auto res = isl_schedule_node_band_member_set_ast_loop_type(copy(), pos, isl_ast_loop_default);
  19360. if (!res)
  19361. exception::throw_last_error(saved_ctx);
  19362. return manage(res).as<schedule_node_band>();
  19363. }
  19364. schedule_node_band schedule_node_band::member_set_ast_loop_atomic(int pos) const
  19365. {
  19366. if (!ptr)
  19367. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19368. auto saved_ctx = ctx();
  19369. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19370. auto res = isl_schedule_node_band_member_set_ast_loop_type(copy(), pos, isl_ast_loop_atomic);
  19371. if (!res)
  19372. exception::throw_last_error(saved_ctx);
  19373. return manage(res).as<schedule_node_band>();
  19374. }
  19375. schedule_node_band schedule_node_band::member_set_ast_loop_unroll(int pos) const
  19376. {
  19377. if (!ptr)
  19378. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19379. auto saved_ctx = ctx();
  19380. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19381. auto res = isl_schedule_node_band_member_set_ast_loop_type(copy(), pos, isl_ast_loop_unroll);
  19382. if (!res)
  19383. exception::throw_last_error(saved_ctx);
  19384. return manage(res).as<schedule_node_band>();
  19385. }
  19386. schedule_node_band schedule_node_band::member_set_ast_loop_separate(int pos) const
  19387. {
  19388. if (!ptr)
  19389. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19390. auto saved_ctx = ctx();
  19391. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19392. auto res = isl_schedule_node_band_member_set_ast_loop_type(copy(), pos, isl_ast_loop_separate);
  19393. if (!res)
  19394. exception::throw_last_error(saved_ctx);
  19395. return manage(res).as<schedule_node_band>();
  19396. }
  19397. inline std::ostream &operator<<(std::ostream &os, const schedule_node_band &obj)
  19398. {
  19399. if (!obj.get())
  19400. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19401. auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
  19402. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19403. char *str = isl_schedule_node_to_str(obj.get());
  19404. if (!str)
  19405. exception::throw_last_error(saved_ctx);
  19406. os << str;
  19407. free(str);
  19408. return os;
  19409. }
  19410. // implementations for isl::schedule_node_context
  19411. schedule_node_context::schedule_node_context(__isl_take isl_schedule_node *ptr)
  19412. : schedule_node(ptr) {}
  19413. schedule_node_context::schedule_node_context()
  19414. : schedule_node() {}
  19415. schedule_node_context::schedule_node_context(const schedule_node_context &obj)
  19416. : schedule_node(obj)
  19417. {
  19418. }
  19419. schedule_node_context &schedule_node_context::operator=(schedule_node_context obj) {
  19420. std::swap(this->ptr, obj.ptr);
  19421. return *this;
  19422. }
  19423. isl::ctx schedule_node_context::ctx() const {
  19424. return isl::ctx(isl_schedule_node_get_ctx(ptr));
  19425. }
  19426. isl::set schedule_node_context::context() const
  19427. {
  19428. if (!ptr)
  19429. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19430. auto saved_ctx = ctx();
  19431. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19432. auto res = isl_schedule_node_context_get_context(get());
  19433. if (!res)
  19434. exception::throw_last_error(saved_ctx);
  19435. return manage(res);
  19436. }
  19437. isl::set schedule_node_context::get_context() const
  19438. {
  19439. return context();
  19440. }
  19441. inline std::ostream &operator<<(std::ostream &os, const schedule_node_context &obj)
  19442. {
  19443. if (!obj.get())
  19444. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19445. auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
  19446. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19447. char *str = isl_schedule_node_to_str(obj.get());
  19448. if (!str)
  19449. exception::throw_last_error(saved_ctx);
  19450. os << str;
  19451. free(str);
  19452. return os;
  19453. }
  19454. // implementations for isl::schedule_node_domain
  19455. schedule_node_domain::schedule_node_domain(__isl_take isl_schedule_node *ptr)
  19456. : schedule_node(ptr) {}
  19457. schedule_node_domain::schedule_node_domain()
  19458. : schedule_node() {}
  19459. schedule_node_domain::schedule_node_domain(const schedule_node_domain &obj)
  19460. : schedule_node(obj)
  19461. {
  19462. }
  19463. schedule_node_domain &schedule_node_domain::operator=(schedule_node_domain obj) {
  19464. std::swap(this->ptr, obj.ptr);
  19465. return *this;
  19466. }
  19467. isl::ctx schedule_node_domain::ctx() const {
  19468. return isl::ctx(isl_schedule_node_get_ctx(ptr));
  19469. }
  19470. isl::union_set schedule_node_domain::domain() const
  19471. {
  19472. if (!ptr)
  19473. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19474. auto saved_ctx = ctx();
  19475. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19476. auto res = isl_schedule_node_domain_get_domain(get());
  19477. if (!res)
  19478. exception::throw_last_error(saved_ctx);
  19479. return manage(res);
  19480. }
  19481. isl::union_set schedule_node_domain::get_domain() const
  19482. {
  19483. return domain();
  19484. }
  19485. inline std::ostream &operator<<(std::ostream &os, const schedule_node_domain &obj)
  19486. {
  19487. if (!obj.get())
  19488. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19489. auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
  19490. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19491. char *str = isl_schedule_node_to_str(obj.get());
  19492. if (!str)
  19493. exception::throw_last_error(saved_ctx);
  19494. os << str;
  19495. free(str);
  19496. return os;
  19497. }
  19498. // implementations for isl::schedule_node_expansion
  19499. schedule_node_expansion::schedule_node_expansion(__isl_take isl_schedule_node *ptr)
  19500. : schedule_node(ptr) {}
  19501. schedule_node_expansion::schedule_node_expansion()
  19502. : schedule_node() {}
  19503. schedule_node_expansion::schedule_node_expansion(const schedule_node_expansion &obj)
  19504. : schedule_node(obj)
  19505. {
  19506. }
  19507. schedule_node_expansion &schedule_node_expansion::operator=(schedule_node_expansion obj) {
  19508. std::swap(this->ptr, obj.ptr);
  19509. return *this;
  19510. }
  19511. isl::ctx schedule_node_expansion::ctx() const {
  19512. return isl::ctx(isl_schedule_node_get_ctx(ptr));
  19513. }
  19514. isl::union_pw_multi_aff schedule_node_expansion::contraction() const
  19515. {
  19516. if (!ptr)
  19517. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19518. auto saved_ctx = ctx();
  19519. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19520. auto res = isl_schedule_node_expansion_get_contraction(get());
  19521. if (!res)
  19522. exception::throw_last_error(saved_ctx);
  19523. return manage(res);
  19524. }
  19525. isl::union_pw_multi_aff schedule_node_expansion::get_contraction() const
  19526. {
  19527. return contraction();
  19528. }
  19529. isl::union_map schedule_node_expansion::expansion() const
  19530. {
  19531. if (!ptr)
  19532. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19533. auto saved_ctx = ctx();
  19534. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19535. auto res = isl_schedule_node_expansion_get_expansion(get());
  19536. if (!res)
  19537. exception::throw_last_error(saved_ctx);
  19538. return manage(res);
  19539. }
  19540. isl::union_map schedule_node_expansion::get_expansion() const
  19541. {
  19542. return expansion();
  19543. }
  19544. inline std::ostream &operator<<(std::ostream &os, const schedule_node_expansion &obj)
  19545. {
  19546. if (!obj.get())
  19547. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19548. auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
  19549. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19550. char *str = isl_schedule_node_to_str(obj.get());
  19551. if (!str)
  19552. exception::throw_last_error(saved_ctx);
  19553. os << str;
  19554. free(str);
  19555. return os;
  19556. }
  19557. // implementations for isl::schedule_node_extension
  19558. schedule_node_extension::schedule_node_extension(__isl_take isl_schedule_node *ptr)
  19559. : schedule_node(ptr) {}
  19560. schedule_node_extension::schedule_node_extension()
  19561. : schedule_node() {}
  19562. schedule_node_extension::schedule_node_extension(const schedule_node_extension &obj)
  19563. : schedule_node(obj)
  19564. {
  19565. }
  19566. schedule_node_extension &schedule_node_extension::operator=(schedule_node_extension obj) {
  19567. std::swap(this->ptr, obj.ptr);
  19568. return *this;
  19569. }
  19570. isl::ctx schedule_node_extension::ctx() const {
  19571. return isl::ctx(isl_schedule_node_get_ctx(ptr));
  19572. }
  19573. isl::union_map schedule_node_extension::extension() const
  19574. {
  19575. if (!ptr)
  19576. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19577. auto saved_ctx = ctx();
  19578. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19579. auto res = isl_schedule_node_extension_get_extension(get());
  19580. if (!res)
  19581. exception::throw_last_error(saved_ctx);
  19582. return manage(res);
  19583. }
  19584. isl::union_map schedule_node_extension::get_extension() const
  19585. {
  19586. return extension();
  19587. }
  19588. inline std::ostream &operator<<(std::ostream &os, const schedule_node_extension &obj)
  19589. {
  19590. if (!obj.get())
  19591. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19592. auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
  19593. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19594. char *str = isl_schedule_node_to_str(obj.get());
  19595. if (!str)
  19596. exception::throw_last_error(saved_ctx);
  19597. os << str;
  19598. free(str);
  19599. return os;
  19600. }
  19601. // implementations for isl::schedule_node_filter
  19602. schedule_node_filter::schedule_node_filter(__isl_take isl_schedule_node *ptr)
  19603. : schedule_node(ptr) {}
  19604. schedule_node_filter::schedule_node_filter()
  19605. : schedule_node() {}
  19606. schedule_node_filter::schedule_node_filter(const schedule_node_filter &obj)
  19607. : schedule_node(obj)
  19608. {
  19609. }
  19610. schedule_node_filter &schedule_node_filter::operator=(schedule_node_filter obj) {
  19611. std::swap(this->ptr, obj.ptr);
  19612. return *this;
  19613. }
  19614. isl::ctx schedule_node_filter::ctx() const {
  19615. return isl::ctx(isl_schedule_node_get_ctx(ptr));
  19616. }
  19617. isl::union_set schedule_node_filter::filter() const
  19618. {
  19619. if (!ptr)
  19620. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19621. auto saved_ctx = ctx();
  19622. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19623. auto res = isl_schedule_node_filter_get_filter(get());
  19624. if (!res)
  19625. exception::throw_last_error(saved_ctx);
  19626. return manage(res);
  19627. }
  19628. isl::union_set schedule_node_filter::get_filter() const
  19629. {
  19630. return filter();
  19631. }
  19632. inline std::ostream &operator<<(std::ostream &os, const schedule_node_filter &obj)
  19633. {
  19634. if (!obj.get())
  19635. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19636. auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
  19637. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19638. char *str = isl_schedule_node_to_str(obj.get());
  19639. if (!str)
  19640. exception::throw_last_error(saved_ctx);
  19641. os << str;
  19642. free(str);
  19643. return os;
  19644. }
  19645. // implementations for isl::schedule_node_guard
  19646. schedule_node_guard::schedule_node_guard(__isl_take isl_schedule_node *ptr)
  19647. : schedule_node(ptr) {}
  19648. schedule_node_guard::schedule_node_guard()
  19649. : schedule_node() {}
  19650. schedule_node_guard::schedule_node_guard(const schedule_node_guard &obj)
  19651. : schedule_node(obj)
  19652. {
  19653. }
  19654. schedule_node_guard &schedule_node_guard::operator=(schedule_node_guard obj) {
  19655. std::swap(this->ptr, obj.ptr);
  19656. return *this;
  19657. }
  19658. isl::ctx schedule_node_guard::ctx() const {
  19659. return isl::ctx(isl_schedule_node_get_ctx(ptr));
  19660. }
  19661. isl::set schedule_node_guard::guard() const
  19662. {
  19663. if (!ptr)
  19664. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19665. auto saved_ctx = ctx();
  19666. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19667. auto res = isl_schedule_node_guard_get_guard(get());
  19668. if (!res)
  19669. exception::throw_last_error(saved_ctx);
  19670. return manage(res);
  19671. }
  19672. isl::set schedule_node_guard::get_guard() const
  19673. {
  19674. return guard();
  19675. }
  19676. inline std::ostream &operator<<(std::ostream &os, const schedule_node_guard &obj)
  19677. {
  19678. if (!obj.get())
  19679. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19680. auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
  19681. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19682. char *str = isl_schedule_node_to_str(obj.get());
  19683. if (!str)
  19684. exception::throw_last_error(saved_ctx);
  19685. os << str;
  19686. free(str);
  19687. return os;
  19688. }
  19689. // implementations for isl::schedule_node_leaf
  19690. schedule_node_leaf::schedule_node_leaf(__isl_take isl_schedule_node *ptr)
  19691. : schedule_node(ptr) {}
  19692. schedule_node_leaf::schedule_node_leaf()
  19693. : schedule_node() {}
  19694. schedule_node_leaf::schedule_node_leaf(const schedule_node_leaf &obj)
  19695. : schedule_node(obj)
  19696. {
  19697. }
  19698. schedule_node_leaf &schedule_node_leaf::operator=(schedule_node_leaf obj) {
  19699. std::swap(this->ptr, obj.ptr);
  19700. return *this;
  19701. }
  19702. isl::ctx schedule_node_leaf::ctx() const {
  19703. return isl::ctx(isl_schedule_node_get_ctx(ptr));
  19704. }
  19705. inline std::ostream &operator<<(std::ostream &os, const schedule_node_leaf &obj)
  19706. {
  19707. if (!obj.get())
  19708. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19709. auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
  19710. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19711. char *str = isl_schedule_node_to_str(obj.get());
  19712. if (!str)
  19713. exception::throw_last_error(saved_ctx);
  19714. os << str;
  19715. free(str);
  19716. return os;
  19717. }
  19718. // implementations for isl::schedule_node_mark
  19719. schedule_node_mark::schedule_node_mark(__isl_take isl_schedule_node *ptr)
  19720. : schedule_node(ptr) {}
  19721. schedule_node_mark::schedule_node_mark()
  19722. : schedule_node() {}
  19723. schedule_node_mark::schedule_node_mark(const schedule_node_mark &obj)
  19724. : schedule_node(obj)
  19725. {
  19726. }
  19727. schedule_node_mark &schedule_node_mark::operator=(schedule_node_mark obj) {
  19728. std::swap(this->ptr, obj.ptr);
  19729. return *this;
  19730. }
  19731. isl::ctx schedule_node_mark::ctx() const {
  19732. return isl::ctx(isl_schedule_node_get_ctx(ptr));
  19733. }
  19734. inline std::ostream &operator<<(std::ostream &os, const schedule_node_mark &obj)
  19735. {
  19736. if (!obj.get())
  19737. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19738. auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
  19739. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19740. char *str = isl_schedule_node_to_str(obj.get());
  19741. if (!str)
  19742. exception::throw_last_error(saved_ctx);
  19743. os << str;
  19744. free(str);
  19745. return os;
  19746. }
  19747. // implementations for isl::schedule_node_sequence
  19748. schedule_node_sequence::schedule_node_sequence(__isl_take isl_schedule_node *ptr)
  19749. : schedule_node(ptr) {}
  19750. schedule_node_sequence::schedule_node_sequence()
  19751. : schedule_node() {}
  19752. schedule_node_sequence::schedule_node_sequence(const schedule_node_sequence &obj)
  19753. : schedule_node(obj)
  19754. {
  19755. }
  19756. schedule_node_sequence &schedule_node_sequence::operator=(schedule_node_sequence obj) {
  19757. std::swap(this->ptr, obj.ptr);
  19758. return *this;
  19759. }
  19760. isl::ctx schedule_node_sequence::ctx() const {
  19761. return isl::ctx(isl_schedule_node_get_ctx(ptr));
  19762. }
  19763. inline std::ostream &operator<<(std::ostream &os, const schedule_node_sequence &obj)
  19764. {
  19765. if (!obj.get())
  19766. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19767. auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
  19768. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19769. char *str = isl_schedule_node_to_str(obj.get());
  19770. if (!str)
  19771. exception::throw_last_error(saved_ctx);
  19772. os << str;
  19773. free(str);
  19774. return os;
  19775. }
  19776. // implementations for isl::schedule_node_set
  19777. schedule_node_set::schedule_node_set(__isl_take isl_schedule_node *ptr)
  19778. : schedule_node(ptr) {}
  19779. schedule_node_set::schedule_node_set()
  19780. : schedule_node() {}
  19781. schedule_node_set::schedule_node_set(const schedule_node_set &obj)
  19782. : schedule_node(obj)
  19783. {
  19784. }
  19785. schedule_node_set &schedule_node_set::operator=(schedule_node_set obj) {
  19786. std::swap(this->ptr, obj.ptr);
  19787. return *this;
  19788. }
  19789. isl::ctx schedule_node_set::ctx() const {
  19790. return isl::ctx(isl_schedule_node_get_ctx(ptr));
  19791. }
  19792. inline std::ostream &operator<<(std::ostream &os, const schedule_node_set &obj)
  19793. {
  19794. if (!obj.get())
  19795. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19796. auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
  19797. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19798. char *str = isl_schedule_node_to_str(obj.get());
  19799. if (!str)
  19800. exception::throw_last_error(saved_ctx);
  19801. os << str;
  19802. free(str);
  19803. return os;
  19804. }
  19805. // implementations for isl::set
  19806. set manage(__isl_take isl_set *ptr) {
  19807. if (!ptr)
  19808. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19809. return set(ptr);
  19810. }
  19811. set manage_copy(__isl_keep isl_set *ptr) {
  19812. if (!ptr)
  19813. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19814. auto saved_ctx = isl_set_get_ctx(ptr);
  19815. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19816. ptr = isl_set_copy(ptr);
  19817. if (!ptr)
  19818. exception::throw_last_error(saved_ctx);
  19819. return set(ptr);
  19820. }
  19821. set::set(__isl_take isl_set *ptr)
  19822. : ptr(ptr) {}
  19823. set::set()
  19824. : ptr(nullptr) {}
  19825. set::set(const set &obj)
  19826. : ptr(nullptr)
  19827. {
  19828. if (!obj.ptr)
  19829. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19830. auto saved_ctx = isl_set_get_ctx(obj.ptr);
  19831. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19832. ptr = obj.copy();
  19833. if (!ptr)
  19834. exception::throw_last_error(saved_ctx);
  19835. }
  19836. set::set(isl::basic_set bset)
  19837. {
  19838. if (bset.is_null())
  19839. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19840. auto saved_ctx = bset.ctx();
  19841. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19842. auto res = isl_set_from_basic_set(bset.release());
  19843. if (!res)
  19844. exception::throw_last_error(saved_ctx);
  19845. ptr = res;
  19846. }
  19847. set::set(isl::point pnt)
  19848. {
  19849. if (pnt.is_null())
  19850. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19851. auto saved_ctx = pnt.ctx();
  19852. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19853. auto res = isl_set_from_point(pnt.release());
  19854. if (!res)
  19855. exception::throw_last_error(saved_ctx);
  19856. ptr = res;
  19857. }
  19858. set::set(isl::ctx ctx, const std::string &str)
  19859. {
  19860. auto saved_ctx = ctx;
  19861. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19862. auto res = isl_set_read_from_str(ctx.release(), str.c_str());
  19863. if (!res)
  19864. exception::throw_last_error(saved_ctx);
  19865. ptr = res;
  19866. }
  19867. set &set::operator=(set obj) {
  19868. std::swap(this->ptr, obj.ptr);
  19869. return *this;
  19870. }
  19871. set::~set() {
  19872. if (ptr)
  19873. isl_set_free(ptr);
  19874. }
  19875. __isl_give isl_set *set::copy() const & {
  19876. return isl_set_copy(ptr);
  19877. }
  19878. __isl_keep isl_set *set::get() const {
  19879. return ptr;
  19880. }
  19881. __isl_give isl_set *set::release() {
  19882. isl_set *tmp = ptr;
  19883. ptr = nullptr;
  19884. return tmp;
  19885. }
  19886. bool set::is_null() const {
  19887. return ptr == nullptr;
  19888. }
  19889. isl::ctx set::ctx() const {
  19890. return isl::ctx(isl_set_get_ctx(ptr));
  19891. }
  19892. isl::basic_set set::affine_hull() const
  19893. {
  19894. if (!ptr)
  19895. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19896. auto saved_ctx = ctx();
  19897. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19898. auto res = isl_set_affine_hull(copy());
  19899. if (!res)
  19900. exception::throw_last_error(saved_ctx);
  19901. return manage(res);
  19902. }
  19903. isl::set set::apply(isl::map map) const
  19904. {
  19905. if (!ptr || map.is_null())
  19906. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19907. auto saved_ctx = ctx();
  19908. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19909. auto res = isl_set_apply(copy(), map.release());
  19910. if (!res)
  19911. exception::throw_last_error(saved_ctx);
  19912. return manage(res);
  19913. }
  19914. isl::union_set set::apply(const isl::union_map &umap) const
  19915. {
  19916. if (!ptr)
  19917. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19918. return isl::union_set(*this).apply(umap);
  19919. }
  19920. isl::set set::apply(const isl::basic_map &map) const
  19921. {
  19922. if (!ptr)
  19923. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19924. return this->apply(isl::map(map));
  19925. }
  19926. isl::pw_multi_aff set::as_pw_multi_aff() const
  19927. {
  19928. if (!ptr)
  19929. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19930. auto saved_ctx = ctx();
  19931. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19932. auto res = isl_set_as_pw_multi_aff(copy());
  19933. if (!res)
  19934. exception::throw_last_error(saved_ctx);
  19935. return manage(res);
  19936. }
  19937. isl::set set::as_set() const
  19938. {
  19939. if (!ptr)
  19940. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19941. return isl::union_set(*this).as_set();
  19942. }
  19943. isl::set set::bind(isl::multi_id tuple) const
  19944. {
  19945. if (!ptr || tuple.is_null())
  19946. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19947. auto saved_ctx = ctx();
  19948. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19949. auto res = isl_set_bind(copy(), tuple.release());
  19950. if (!res)
  19951. exception::throw_last_error(saved_ctx);
  19952. return manage(res);
  19953. }
  19954. isl::set set::coalesce() const
  19955. {
  19956. if (!ptr)
  19957. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19958. auto saved_ctx = ctx();
  19959. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19960. auto res = isl_set_coalesce(copy());
  19961. if (!res)
  19962. exception::throw_last_error(saved_ctx);
  19963. return manage(res);
  19964. }
  19965. isl::set set::complement() const
  19966. {
  19967. if (!ptr)
  19968. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19969. auto saved_ctx = ctx();
  19970. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19971. auto res = isl_set_complement(copy());
  19972. if (!res)
  19973. exception::throw_last_error(saved_ctx);
  19974. return manage(res);
  19975. }
  19976. isl::union_set set::compute_divs() const
  19977. {
  19978. if (!ptr)
  19979. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19980. return isl::union_set(*this).compute_divs();
  19981. }
  19982. isl::set set::detect_equalities() const
  19983. {
  19984. if (!ptr)
  19985. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19986. auto saved_ctx = ctx();
  19987. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19988. auto res = isl_set_detect_equalities(copy());
  19989. if (!res)
  19990. exception::throw_last_error(saved_ctx);
  19991. return manage(res);
  19992. }
  19993. isl::val set::dim_max_val(int pos) const
  19994. {
  19995. if (!ptr)
  19996. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  19997. auto saved_ctx = ctx();
  19998. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  19999. auto res = isl_set_dim_max_val(copy(), pos);
  20000. if (!res)
  20001. exception::throw_last_error(saved_ctx);
  20002. return manage(res);
  20003. }
  20004. isl::val set::dim_min_val(int pos) const
  20005. {
  20006. if (!ptr)
  20007. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20008. auto saved_ctx = ctx();
  20009. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20010. auto res = isl_set_dim_min_val(copy(), pos);
  20011. if (!res)
  20012. exception::throw_last_error(saved_ctx);
  20013. return manage(res);
  20014. }
  20015. isl::set set::empty(isl::space space)
  20016. {
  20017. if (space.is_null())
  20018. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20019. auto saved_ctx = space.ctx();
  20020. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20021. auto res = isl_set_empty(space.release());
  20022. if (!res)
  20023. exception::throw_last_error(saved_ctx);
  20024. return manage(res);
  20025. }
  20026. bool set::every_set(const std::function<bool(isl::set)> &test) const
  20027. {
  20028. if (!ptr)
  20029. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20030. return isl::union_set(*this).every_set(test);
  20031. }
  20032. isl::set set::extract_set(const isl::space &space) const
  20033. {
  20034. if (!ptr)
  20035. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20036. return isl::union_set(*this).extract_set(space);
  20037. }
  20038. isl::set set::flatten() const
  20039. {
  20040. if (!ptr)
  20041. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20042. auto saved_ctx = ctx();
  20043. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20044. auto res = isl_set_flatten(copy());
  20045. if (!res)
  20046. exception::throw_last_error(saved_ctx);
  20047. return manage(res);
  20048. }
  20049. void set::foreach_basic_set(const std::function<void(isl::basic_set)> &fn) const
  20050. {
  20051. if (!ptr)
  20052. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20053. auto saved_ctx = ctx();
  20054. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20055. struct fn_data {
  20056. std::function<void(isl::basic_set)> func;
  20057. std::exception_ptr eptr;
  20058. } fn_data = { fn };
  20059. auto fn_lambda = [](isl_basic_set *arg_0, void *arg_1) -> isl_stat {
  20060. auto *data = static_cast<struct fn_data *>(arg_1);
  20061. ISL_CPP_TRY {
  20062. (data->func)(manage(arg_0));
  20063. return isl_stat_ok;
  20064. } ISL_CPP_CATCH_ALL {
  20065. data->eptr = std::current_exception();
  20066. return isl_stat_error;
  20067. }
  20068. };
  20069. auto res = isl_set_foreach_basic_set(get(), fn_lambda, &fn_data);
  20070. if (fn_data.eptr)
  20071. std::rethrow_exception(fn_data.eptr);
  20072. if (res < 0)
  20073. exception::throw_last_error(saved_ctx);
  20074. return;
  20075. }
  20076. void set::foreach_point(const std::function<void(isl::point)> &fn) const
  20077. {
  20078. if (!ptr)
  20079. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20080. auto saved_ctx = ctx();
  20081. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20082. struct fn_data {
  20083. std::function<void(isl::point)> func;
  20084. std::exception_ptr eptr;
  20085. } fn_data = { fn };
  20086. auto fn_lambda = [](isl_point *arg_0, void *arg_1) -> isl_stat {
  20087. auto *data = static_cast<struct fn_data *>(arg_1);
  20088. ISL_CPP_TRY {
  20089. (data->func)(manage(arg_0));
  20090. return isl_stat_ok;
  20091. } ISL_CPP_CATCH_ALL {
  20092. data->eptr = std::current_exception();
  20093. return isl_stat_error;
  20094. }
  20095. };
  20096. auto res = isl_set_foreach_point(get(), fn_lambda, &fn_data);
  20097. if (fn_data.eptr)
  20098. std::rethrow_exception(fn_data.eptr);
  20099. if (res < 0)
  20100. exception::throw_last_error(saved_ctx);
  20101. return;
  20102. }
  20103. void set::foreach_set(const std::function<void(isl::set)> &fn) const
  20104. {
  20105. if (!ptr)
  20106. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20107. return isl::union_set(*this).foreach_set(fn);
  20108. }
  20109. isl::set set::gist(isl::set context) const
  20110. {
  20111. if (!ptr || context.is_null())
  20112. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20113. auto saved_ctx = ctx();
  20114. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20115. auto res = isl_set_gist(copy(), context.release());
  20116. if (!res)
  20117. exception::throw_last_error(saved_ctx);
  20118. return manage(res);
  20119. }
  20120. isl::union_set set::gist(const isl::union_set &context) const
  20121. {
  20122. if (!ptr)
  20123. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20124. return isl::union_set(*this).gist(context);
  20125. }
  20126. isl::set set::gist(const isl::basic_set &context) const
  20127. {
  20128. if (!ptr)
  20129. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20130. return this->gist(isl::set(context));
  20131. }
  20132. isl::set set::gist(const isl::point &context) const
  20133. {
  20134. if (!ptr)
  20135. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20136. return this->gist(isl::set(context));
  20137. }
  20138. isl::set set::gist_params(isl::set context) const
  20139. {
  20140. if (!ptr || context.is_null())
  20141. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20142. auto saved_ctx = ctx();
  20143. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20144. auto res = isl_set_gist_params(copy(), context.release());
  20145. if (!res)
  20146. exception::throw_last_error(saved_ctx);
  20147. return manage(res);
  20148. }
  20149. isl::map set::identity() const
  20150. {
  20151. if (!ptr)
  20152. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20153. auto saved_ctx = ctx();
  20154. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20155. auto res = isl_set_identity(copy());
  20156. if (!res)
  20157. exception::throw_last_error(saved_ctx);
  20158. return manage(res);
  20159. }
  20160. isl::pw_aff set::indicator_function() const
  20161. {
  20162. if (!ptr)
  20163. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20164. auto saved_ctx = ctx();
  20165. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20166. auto res = isl_set_indicator_function(copy());
  20167. if (!res)
  20168. exception::throw_last_error(saved_ctx);
  20169. return manage(res);
  20170. }
  20171. isl::map set::insert_domain(isl::space domain) const
  20172. {
  20173. if (!ptr || domain.is_null())
  20174. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20175. auto saved_ctx = ctx();
  20176. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20177. auto res = isl_set_insert_domain(copy(), domain.release());
  20178. if (!res)
  20179. exception::throw_last_error(saved_ctx);
  20180. return manage(res);
  20181. }
  20182. isl::set set::intersect(isl::set set2) const
  20183. {
  20184. if (!ptr || set2.is_null())
  20185. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20186. auto saved_ctx = ctx();
  20187. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20188. auto res = isl_set_intersect(copy(), set2.release());
  20189. if (!res)
  20190. exception::throw_last_error(saved_ctx);
  20191. return manage(res);
  20192. }
  20193. isl::union_set set::intersect(const isl::union_set &uset2) const
  20194. {
  20195. if (!ptr)
  20196. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20197. return isl::union_set(*this).intersect(uset2);
  20198. }
  20199. isl::set set::intersect(const isl::basic_set &set2) const
  20200. {
  20201. if (!ptr)
  20202. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20203. return this->intersect(isl::set(set2));
  20204. }
  20205. isl::set set::intersect(const isl::point &set2) const
  20206. {
  20207. if (!ptr)
  20208. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20209. return this->intersect(isl::set(set2));
  20210. }
  20211. isl::set set::intersect_params(isl::set params) const
  20212. {
  20213. if (!ptr || params.is_null())
  20214. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20215. auto saved_ctx = ctx();
  20216. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20217. auto res = isl_set_intersect_params(copy(), params.release());
  20218. if (!res)
  20219. exception::throw_last_error(saved_ctx);
  20220. return manage(res);
  20221. }
  20222. bool set::involves_locals() const
  20223. {
  20224. if (!ptr)
  20225. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20226. auto saved_ctx = ctx();
  20227. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20228. auto res = isl_set_involves_locals(get());
  20229. if (res < 0)
  20230. exception::throw_last_error(saved_ctx);
  20231. return res;
  20232. }
  20233. bool set::is_disjoint(const isl::set &set2) const
  20234. {
  20235. if (!ptr || set2.is_null())
  20236. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20237. auto saved_ctx = ctx();
  20238. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20239. auto res = isl_set_is_disjoint(get(), set2.get());
  20240. if (res < 0)
  20241. exception::throw_last_error(saved_ctx);
  20242. return res;
  20243. }
  20244. bool set::is_disjoint(const isl::union_set &uset2) const
  20245. {
  20246. if (!ptr)
  20247. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20248. return isl::union_set(*this).is_disjoint(uset2);
  20249. }
  20250. bool set::is_disjoint(const isl::basic_set &set2) const
  20251. {
  20252. if (!ptr)
  20253. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20254. return this->is_disjoint(isl::set(set2));
  20255. }
  20256. bool set::is_disjoint(const isl::point &set2) const
  20257. {
  20258. if (!ptr)
  20259. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20260. return this->is_disjoint(isl::set(set2));
  20261. }
  20262. bool set::is_empty() const
  20263. {
  20264. if (!ptr)
  20265. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20266. auto saved_ctx = ctx();
  20267. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20268. auto res = isl_set_is_empty(get());
  20269. if (res < 0)
  20270. exception::throw_last_error(saved_ctx);
  20271. return res;
  20272. }
  20273. bool set::is_equal(const isl::set &set2) const
  20274. {
  20275. if (!ptr || set2.is_null())
  20276. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20277. auto saved_ctx = ctx();
  20278. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20279. auto res = isl_set_is_equal(get(), set2.get());
  20280. if (res < 0)
  20281. exception::throw_last_error(saved_ctx);
  20282. return res;
  20283. }
  20284. bool set::is_equal(const isl::union_set &uset2) const
  20285. {
  20286. if (!ptr)
  20287. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20288. return isl::union_set(*this).is_equal(uset2);
  20289. }
  20290. bool set::is_equal(const isl::basic_set &set2) const
  20291. {
  20292. if (!ptr)
  20293. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20294. return this->is_equal(isl::set(set2));
  20295. }
  20296. bool set::is_equal(const isl::point &set2) const
  20297. {
  20298. if (!ptr)
  20299. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20300. return this->is_equal(isl::set(set2));
  20301. }
  20302. bool set::is_singleton() const
  20303. {
  20304. if (!ptr)
  20305. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20306. auto saved_ctx = ctx();
  20307. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20308. auto res = isl_set_is_singleton(get());
  20309. if (res < 0)
  20310. exception::throw_last_error(saved_ctx);
  20311. return res;
  20312. }
  20313. bool set::is_strict_subset(const isl::set &set2) const
  20314. {
  20315. if (!ptr || set2.is_null())
  20316. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20317. auto saved_ctx = ctx();
  20318. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20319. auto res = isl_set_is_strict_subset(get(), set2.get());
  20320. if (res < 0)
  20321. exception::throw_last_error(saved_ctx);
  20322. return res;
  20323. }
  20324. bool set::is_strict_subset(const isl::union_set &uset2) const
  20325. {
  20326. if (!ptr)
  20327. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20328. return isl::union_set(*this).is_strict_subset(uset2);
  20329. }
  20330. bool set::is_strict_subset(const isl::basic_set &set2) const
  20331. {
  20332. if (!ptr)
  20333. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20334. return this->is_strict_subset(isl::set(set2));
  20335. }
  20336. bool set::is_strict_subset(const isl::point &set2) const
  20337. {
  20338. if (!ptr)
  20339. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20340. return this->is_strict_subset(isl::set(set2));
  20341. }
  20342. bool set::is_subset(const isl::set &set2) const
  20343. {
  20344. if (!ptr || set2.is_null())
  20345. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20346. auto saved_ctx = ctx();
  20347. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20348. auto res = isl_set_is_subset(get(), set2.get());
  20349. if (res < 0)
  20350. exception::throw_last_error(saved_ctx);
  20351. return res;
  20352. }
  20353. bool set::is_subset(const isl::union_set &uset2) const
  20354. {
  20355. if (!ptr)
  20356. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20357. return isl::union_set(*this).is_subset(uset2);
  20358. }
  20359. bool set::is_subset(const isl::basic_set &set2) const
  20360. {
  20361. if (!ptr)
  20362. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20363. return this->is_subset(isl::set(set2));
  20364. }
  20365. bool set::is_subset(const isl::point &set2) const
  20366. {
  20367. if (!ptr)
  20368. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20369. return this->is_subset(isl::set(set2));
  20370. }
  20371. bool set::is_wrapping() const
  20372. {
  20373. if (!ptr)
  20374. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20375. auto saved_ctx = ctx();
  20376. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20377. auto res = isl_set_is_wrapping(get());
  20378. if (res < 0)
  20379. exception::throw_last_error(saved_ctx);
  20380. return res;
  20381. }
  20382. bool set::isa_set() const
  20383. {
  20384. if (!ptr)
  20385. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20386. return isl::union_set(*this).isa_set();
  20387. }
  20388. isl::fixed_box set::lattice_tile() const
  20389. {
  20390. if (!ptr)
  20391. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20392. auto saved_ctx = ctx();
  20393. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20394. auto res = isl_set_get_lattice_tile(get());
  20395. if (!res)
  20396. exception::throw_last_error(saved_ctx);
  20397. return manage(res);
  20398. }
  20399. isl::fixed_box set::get_lattice_tile() const
  20400. {
  20401. return lattice_tile();
  20402. }
  20403. isl::set set::lexmax() const
  20404. {
  20405. if (!ptr)
  20406. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20407. auto saved_ctx = ctx();
  20408. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20409. auto res = isl_set_lexmax(copy());
  20410. if (!res)
  20411. exception::throw_last_error(saved_ctx);
  20412. return manage(res);
  20413. }
  20414. isl::pw_multi_aff set::lexmax_pw_multi_aff() const
  20415. {
  20416. if (!ptr)
  20417. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20418. auto saved_ctx = ctx();
  20419. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20420. auto res = isl_set_lexmax_pw_multi_aff(copy());
  20421. if (!res)
  20422. exception::throw_last_error(saved_ctx);
  20423. return manage(res);
  20424. }
  20425. isl::set set::lexmin() const
  20426. {
  20427. if (!ptr)
  20428. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20429. auto saved_ctx = ctx();
  20430. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20431. auto res = isl_set_lexmin(copy());
  20432. if (!res)
  20433. exception::throw_last_error(saved_ctx);
  20434. return manage(res);
  20435. }
  20436. isl::pw_multi_aff set::lexmin_pw_multi_aff() const
  20437. {
  20438. if (!ptr)
  20439. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20440. auto saved_ctx = ctx();
  20441. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20442. auto res = isl_set_lexmin_pw_multi_aff(copy());
  20443. if (!res)
  20444. exception::throw_last_error(saved_ctx);
  20445. return manage(res);
  20446. }
  20447. isl::set set::lower_bound(isl::multi_pw_aff lower) const
  20448. {
  20449. if (!ptr || lower.is_null())
  20450. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20451. auto saved_ctx = ctx();
  20452. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20453. auto res = isl_set_lower_bound_multi_pw_aff(copy(), lower.release());
  20454. if (!res)
  20455. exception::throw_last_error(saved_ctx);
  20456. return manage(res);
  20457. }
  20458. isl::set set::lower_bound(isl::multi_val lower) const
  20459. {
  20460. if (!ptr || lower.is_null())
  20461. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20462. auto saved_ctx = ctx();
  20463. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20464. auto res = isl_set_lower_bound_multi_val(copy(), lower.release());
  20465. if (!res)
  20466. exception::throw_last_error(saved_ctx);
  20467. return manage(res);
  20468. }
  20469. isl::multi_pw_aff set::max_multi_pw_aff() const
  20470. {
  20471. if (!ptr)
  20472. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20473. auto saved_ctx = ctx();
  20474. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20475. auto res = isl_set_max_multi_pw_aff(copy());
  20476. if (!res)
  20477. exception::throw_last_error(saved_ctx);
  20478. return manage(res);
  20479. }
  20480. isl::val set::max_val(const isl::aff &obj) const
  20481. {
  20482. if (!ptr || obj.is_null())
  20483. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20484. auto saved_ctx = ctx();
  20485. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20486. auto res = isl_set_max_val(get(), obj.get());
  20487. if (!res)
  20488. exception::throw_last_error(saved_ctx);
  20489. return manage(res);
  20490. }
  20491. isl::multi_pw_aff set::min_multi_pw_aff() const
  20492. {
  20493. if (!ptr)
  20494. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20495. auto saved_ctx = ctx();
  20496. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20497. auto res = isl_set_min_multi_pw_aff(copy());
  20498. if (!res)
  20499. exception::throw_last_error(saved_ctx);
  20500. return manage(res);
  20501. }
  20502. isl::val set::min_val(const isl::aff &obj) const
  20503. {
  20504. if (!ptr || obj.is_null())
  20505. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20506. auto saved_ctx = ctx();
  20507. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20508. auto res = isl_set_min_val(get(), obj.get());
  20509. if (!res)
  20510. exception::throw_last_error(saved_ctx);
  20511. return manage(res);
  20512. }
  20513. unsigned set::n_basic_set() const
  20514. {
  20515. if (!ptr)
  20516. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20517. auto saved_ctx = ctx();
  20518. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20519. auto res = isl_set_n_basic_set(get());
  20520. if (res < 0)
  20521. exception::throw_last_error(saved_ctx);
  20522. return res;
  20523. }
  20524. isl::pw_aff set::param_pw_aff_on_domain(isl::id id) const
  20525. {
  20526. if (!ptr || id.is_null())
  20527. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20528. auto saved_ctx = ctx();
  20529. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20530. auto res = isl_set_param_pw_aff_on_domain_id(copy(), id.release());
  20531. if (!res)
  20532. exception::throw_last_error(saved_ctx);
  20533. return manage(res);
  20534. }
  20535. isl::pw_aff set::param_pw_aff_on_domain(const std::string &id) const
  20536. {
  20537. if (!ptr)
  20538. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20539. return this->param_pw_aff_on_domain(isl::id(ctx(), id));
  20540. }
  20541. isl::set set::params() const
  20542. {
  20543. if (!ptr)
  20544. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20545. auto saved_ctx = ctx();
  20546. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20547. auto res = isl_set_params(copy());
  20548. if (!res)
  20549. exception::throw_last_error(saved_ctx);
  20550. return manage(res);
  20551. }
  20552. isl::multi_val set::plain_multi_val_if_fixed() const
  20553. {
  20554. if (!ptr)
  20555. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20556. auto saved_ctx = ctx();
  20557. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20558. auto res = isl_set_get_plain_multi_val_if_fixed(get());
  20559. if (!res)
  20560. exception::throw_last_error(saved_ctx);
  20561. return manage(res);
  20562. }
  20563. isl::multi_val set::get_plain_multi_val_if_fixed() const
  20564. {
  20565. return plain_multi_val_if_fixed();
  20566. }
  20567. isl::basic_set set::polyhedral_hull() const
  20568. {
  20569. if (!ptr)
  20570. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20571. auto saved_ctx = ctx();
  20572. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20573. auto res = isl_set_polyhedral_hull(copy());
  20574. if (!res)
  20575. exception::throw_last_error(saved_ctx);
  20576. return manage(res);
  20577. }
  20578. isl::set set::preimage(isl::multi_aff ma) const
  20579. {
  20580. if (!ptr || ma.is_null())
  20581. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20582. auto saved_ctx = ctx();
  20583. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20584. auto res = isl_set_preimage_multi_aff(copy(), ma.release());
  20585. if (!res)
  20586. exception::throw_last_error(saved_ctx);
  20587. return manage(res);
  20588. }
  20589. isl::set set::preimage(isl::multi_pw_aff mpa) const
  20590. {
  20591. if (!ptr || mpa.is_null())
  20592. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20593. auto saved_ctx = ctx();
  20594. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20595. auto res = isl_set_preimage_multi_pw_aff(copy(), mpa.release());
  20596. if (!res)
  20597. exception::throw_last_error(saved_ctx);
  20598. return manage(res);
  20599. }
  20600. isl::set set::preimage(isl::pw_multi_aff pma) const
  20601. {
  20602. if (!ptr || pma.is_null())
  20603. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20604. auto saved_ctx = ctx();
  20605. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20606. auto res = isl_set_preimage_pw_multi_aff(copy(), pma.release());
  20607. if (!res)
  20608. exception::throw_last_error(saved_ctx);
  20609. return manage(res);
  20610. }
  20611. isl::union_set set::preimage(const isl::union_pw_multi_aff &upma) const
  20612. {
  20613. if (!ptr)
  20614. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20615. return isl::union_set(*this).preimage(upma);
  20616. }
  20617. isl::set set::product(isl::set set2) const
  20618. {
  20619. if (!ptr || set2.is_null())
  20620. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20621. auto saved_ctx = ctx();
  20622. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20623. auto res = isl_set_product(copy(), set2.release());
  20624. if (!res)
  20625. exception::throw_last_error(saved_ctx);
  20626. return manage(res);
  20627. }
  20628. isl::set set::project_out_all_params() const
  20629. {
  20630. if (!ptr)
  20631. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20632. auto saved_ctx = ctx();
  20633. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20634. auto res = isl_set_project_out_all_params(copy());
  20635. if (!res)
  20636. exception::throw_last_error(saved_ctx);
  20637. return manage(res);
  20638. }
  20639. isl::set set::project_out_param(isl::id id) const
  20640. {
  20641. if (!ptr || id.is_null())
  20642. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20643. auto saved_ctx = ctx();
  20644. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20645. auto res = isl_set_project_out_param_id(copy(), id.release());
  20646. if (!res)
  20647. exception::throw_last_error(saved_ctx);
  20648. return manage(res);
  20649. }
  20650. isl::set set::project_out_param(const std::string &id) const
  20651. {
  20652. if (!ptr)
  20653. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20654. return this->project_out_param(isl::id(ctx(), id));
  20655. }
  20656. isl::set set::project_out_param(isl::id_list list) const
  20657. {
  20658. if (!ptr || list.is_null())
  20659. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20660. auto saved_ctx = ctx();
  20661. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20662. auto res = isl_set_project_out_param_id_list(copy(), list.release());
  20663. if (!res)
  20664. exception::throw_last_error(saved_ctx);
  20665. return manage(res);
  20666. }
  20667. isl::pw_aff set::pw_aff_on_domain(isl::val v) const
  20668. {
  20669. if (!ptr || v.is_null())
  20670. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20671. auto saved_ctx = ctx();
  20672. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20673. auto res = isl_set_pw_aff_on_domain_val(copy(), v.release());
  20674. if (!res)
  20675. exception::throw_last_error(saved_ctx);
  20676. return manage(res);
  20677. }
  20678. isl::pw_aff set::pw_aff_on_domain(long v) const
  20679. {
  20680. if (!ptr)
  20681. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20682. return this->pw_aff_on_domain(isl::val(ctx(), v));
  20683. }
  20684. isl::pw_multi_aff set::pw_multi_aff_on_domain(isl::multi_val mv) const
  20685. {
  20686. if (!ptr || mv.is_null())
  20687. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20688. auto saved_ctx = ctx();
  20689. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20690. auto res = isl_set_pw_multi_aff_on_domain_multi_val(copy(), mv.release());
  20691. if (!res)
  20692. exception::throw_last_error(saved_ctx);
  20693. return manage(res);
  20694. }
  20695. isl::basic_set set::sample() const
  20696. {
  20697. if (!ptr)
  20698. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20699. auto saved_ctx = ctx();
  20700. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20701. auto res = isl_set_sample(copy());
  20702. if (!res)
  20703. exception::throw_last_error(saved_ctx);
  20704. return manage(res);
  20705. }
  20706. isl::point set::sample_point() const
  20707. {
  20708. if (!ptr)
  20709. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20710. auto saved_ctx = ctx();
  20711. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20712. auto res = isl_set_sample_point(copy());
  20713. if (!res)
  20714. exception::throw_last_error(saved_ctx);
  20715. return manage(res);
  20716. }
  20717. isl::set_list set::set_list() const
  20718. {
  20719. if (!ptr)
  20720. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20721. return isl::union_set(*this).set_list();
  20722. }
  20723. isl::fixed_box set::simple_fixed_box_hull() const
  20724. {
  20725. if (!ptr)
  20726. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20727. auto saved_ctx = ctx();
  20728. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20729. auto res = isl_set_get_simple_fixed_box_hull(get());
  20730. if (!res)
  20731. exception::throw_last_error(saved_ctx);
  20732. return manage(res);
  20733. }
  20734. isl::fixed_box set::get_simple_fixed_box_hull() const
  20735. {
  20736. return simple_fixed_box_hull();
  20737. }
  20738. isl::space set::space() const
  20739. {
  20740. if (!ptr)
  20741. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20742. auto saved_ctx = ctx();
  20743. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20744. auto res = isl_set_get_space(get());
  20745. if (!res)
  20746. exception::throw_last_error(saved_ctx);
  20747. return manage(res);
  20748. }
  20749. isl::space set::get_space() const
  20750. {
  20751. return space();
  20752. }
  20753. isl::val set::stride(int pos) const
  20754. {
  20755. if (!ptr)
  20756. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20757. auto saved_ctx = ctx();
  20758. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20759. auto res = isl_set_get_stride(get(), pos);
  20760. if (!res)
  20761. exception::throw_last_error(saved_ctx);
  20762. return manage(res);
  20763. }
  20764. isl::val set::get_stride(int pos) const
  20765. {
  20766. return stride(pos);
  20767. }
  20768. isl::set set::subtract(isl::set set2) const
  20769. {
  20770. if (!ptr || set2.is_null())
  20771. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20772. auto saved_ctx = ctx();
  20773. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20774. auto res = isl_set_subtract(copy(), set2.release());
  20775. if (!res)
  20776. exception::throw_last_error(saved_ctx);
  20777. return manage(res);
  20778. }
  20779. isl::union_set set::subtract(const isl::union_set &uset2) const
  20780. {
  20781. if (!ptr)
  20782. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20783. return isl::union_set(*this).subtract(uset2);
  20784. }
  20785. isl::set set::subtract(const isl::basic_set &set2) const
  20786. {
  20787. if (!ptr)
  20788. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20789. return this->subtract(isl::set(set2));
  20790. }
  20791. isl::set set::subtract(const isl::point &set2) const
  20792. {
  20793. if (!ptr)
  20794. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20795. return this->subtract(isl::set(set2));
  20796. }
  20797. isl::set_list set::to_list() const
  20798. {
  20799. if (!ptr)
  20800. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20801. auto saved_ctx = ctx();
  20802. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20803. auto res = isl_set_to_list(copy());
  20804. if (!res)
  20805. exception::throw_last_error(saved_ctx);
  20806. return manage(res);
  20807. }
  20808. isl::union_set set::to_union_set() const
  20809. {
  20810. if (!ptr)
  20811. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20812. auto saved_ctx = ctx();
  20813. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20814. auto res = isl_set_to_union_set(copy());
  20815. if (!res)
  20816. exception::throw_last_error(saved_ctx);
  20817. return manage(res);
  20818. }
  20819. isl::map set::translation() const
  20820. {
  20821. if (!ptr)
  20822. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20823. auto saved_ctx = ctx();
  20824. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20825. auto res = isl_set_translation(copy());
  20826. if (!res)
  20827. exception::throw_last_error(saved_ctx);
  20828. return manage(res);
  20829. }
  20830. unsigned set::tuple_dim() const
  20831. {
  20832. if (!ptr)
  20833. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20834. auto saved_ctx = ctx();
  20835. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20836. auto res = isl_set_tuple_dim(get());
  20837. if (res < 0)
  20838. exception::throw_last_error(saved_ctx);
  20839. return res;
  20840. }
  20841. isl::set set::unbind_params(isl::multi_id tuple) const
  20842. {
  20843. if (!ptr || tuple.is_null())
  20844. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20845. auto saved_ctx = ctx();
  20846. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20847. auto res = isl_set_unbind_params(copy(), tuple.release());
  20848. if (!res)
  20849. exception::throw_last_error(saved_ctx);
  20850. return manage(res);
  20851. }
  20852. isl::map set::unbind_params_insert_domain(isl::multi_id domain) const
  20853. {
  20854. if (!ptr || domain.is_null())
  20855. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20856. auto saved_ctx = ctx();
  20857. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20858. auto res = isl_set_unbind_params_insert_domain(copy(), domain.release());
  20859. if (!res)
  20860. exception::throw_last_error(saved_ctx);
  20861. return manage(res);
  20862. }
  20863. isl::set set::unite(isl::set set2) const
  20864. {
  20865. if (!ptr || set2.is_null())
  20866. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20867. auto saved_ctx = ctx();
  20868. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20869. auto res = isl_set_union(copy(), set2.release());
  20870. if (!res)
  20871. exception::throw_last_error(saved_ctx);
  20872. return manage(res);
  20873. }
  20874. isl::union_set set::unite(const isl::union_set &uset2) const
  20875. {
  20876. if (!ptr)
  20877. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20878. return isl::union_set(*this).unite(uset2);
  20879. }
  20880. isl::set set::unite(const isl::basic_set &set2) const
  20881. {
  20882. if (!ptr)
  20883. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20884. return this->unite(isl::set(set2));
  20885. }
  20886. isl::set set::unite(const isl::point &set2) const
  20887. {
  20888. if (!ptr)
  20889. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20890. return this->unite(isl::set(set2));
  20891. }
  20892. isl::set set::universe(isl::space space)
  20893. {
  20894. if (space.is_null())
  20895. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20896. auto saved_ctx = space.ctx();
  20897. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20898. auto res = isl_set_universe(space.release());
  20899. if (!res)
  20900. exception::throw_last_error(saved_ctx);
  20901. return manage(res);
  20902. }
  20903. isl::basic_set set::unshifted_simple_hull() const
  20904. {
  20905. if (!ptr)
  20906. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20907. auto saved_ctx = ctx();
  20908. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20909. auto res = isl_set_unshifted_simple_hull(copy());
  20910. if (!res)
  20911. exception::throw_last_error(saved_ctx);
  20912. return manage(res);
  20913. }
  20914. isl::map set::unwrap() const
  20915. {
  20916. if (!ptr)
  20917. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20918. auto saved_ctx = ctx();
  20919. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20920. auto res = isl_set_unwrap(copy());
  20921. if (!res)
  20922. exception::throw_last_error(saved_ctx);
  20923. return manage(res);
  20924. }
  20925. isl::set set::upper_bound(isl::multi_pw_aff upper) const
  20926. {
  20927. if (!ptr || upper.is_null())
  20928. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20929. auto saved_ctx = ctx();
  20930. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20931. auto res = isl_set_upper_bound_multi_pw_aff(copy(), upper.release());
  20932. if (!res)
  20933. exception::throw_last_error(saved_ctx);
  20934. return manage(res);
  20935. }
  20936. isl::set set::upper_bound(isl::multi_val upper) const
  20937. {
  20938. if (!ptr || upper.is_null())
  20939. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20940. auto saved_ctx = ctx();
  20941. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20942. auto res = isl_set_upper_bound_multi_val(copy(), upper.release());
  20943. if (!res)
  20944. exception::throw_last_error(saved_ctx);
  20945. return manage(res);
  20946. }
  20947. inline std::ostream &operator<<(std::ostream &os, const set &obj)
  20948. {
  20949. if (!obj.get())
  20950. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20951. auto saved_ctx = isl_set_get_ctx(obj.get());
  20952. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20953. char *str = isl_set_to_str(obj.get());
  20954. if (!str)
  20955. exception::throw_last_error(saved_ctx);
  20956. os << str;
  20957. free(str);
  20958. return os;
  20959. }
  20960. // implementations for isl::set_list
  20961. set_list manage(__isl_take isl_set_list *ptr) {
  20962. if (!ptr)
  20963. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20964. return set_list(ptr);
  20965. }
  20966. set_list manage_copy(__isl_keep isl_set_list *ptr) {
  20967. if (!ptr)
  20968. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20969. auto saved_ctx = isl_set_list_get_ctx(ptr);
  20970. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20971. ptr = isl_set_list_copy(ptr);
  20972. if (!ptr)
  20973. exception::throw_last_error(saved_ctx);
  20974. return set_list(ptr);
  20975. }
  20976. set_list::set_list(__isl_take isl_set_list *ptr)
  20977. : ptr(ptr) {}
  20978. set_list::set_list()
  20979. : ptr(nullptr) {}
  20980. set_list::set_list(const set_list &obj)
  20981. : ptr(nullptr)
  20982. {
  20983. if (!obj.ptr)
  20984. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  20985. auto saved_ctx = isl_set_list_get_ctx(obj.ptr);
  20986. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20987. ptr = obj.copy();
  20988. if (!ptr)
  20989. exception::throw_last_error(saved_ctx);
  20990. }
  20991. set_list::set_list(isl::ctx ctx, int n)
  20992. {
  20993. auto saved_ctx = ctx;
  20994. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  20995. auto res = isl_set_list_alloc(ctx.release(), n);
  20996. if (!res)
  20997. exception::throw_last_error(saved_ctx);
  20998. ptr = res;
  20999. }
  21000. set_list::set_list(isl::set el)
  21001. {
  21002. if (el.is_null())
  21003. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21004. auto saved_ctx = el.ctx();
  21005. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21006. auto res = isl_set_list_from_set(el.release());
  21007. if (!res)
  21008. exception::throw_last_error(saved_ctx);
  21009. ptr = res;
  21010. }
  21011. set_list::set_list(isl::ctx ctx, const std::string &str)
  21012. {
  21013. auto saved_ctx = ctx;
  21014. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21015. auto res = isl_set_list_read_from_str(ctx.release(), str.c_str());
  21016. if (!res)
  21017. exception::throw_last_error(saved_ctx);
  21018. ptr = res;
  21019. }
  21020. set_list &set_list::operator=(set_list obj) {
  21021. std::swap(this->ptr, obj.ptr);
  21022. return *this;
  21023. }
  21024. set_list::~set_list() {
  21025. if (ptr)
  21026. isl_set_list_free(ptr);
  21027. }
  21028. __isl_give isl_set_list *set_list::copy() const & {
  21029. return isl_set_list_copy(ptr);
  21030. }
  21031. __isl_keep isl_set_list *set_list::get() const {
  21032. return ptr;
  21033. }
  21034. __isl_give isl_set_list *set_list::release() {
  21035. isl_set_list *tmp = ptr;
  21036. ptr = nullptr;
  21037. return tmp;
  21038. }
  21039. bool set_list::is_null() const {
  21040. return ptr == nullptr;
  21041. }
  21042. isl::ctx set_list::ctx() const {
  21043. return isl::ctx(isl_set_list_get_ctx(ptr));
  21044. }
  21045. isl::set_list set_list::add(isl::set el) const
  21046. {
  21047. if (!ptr || el.is_null())
  21048. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21049. auto saved_ctx = ctx();
  21050. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21051. auto res = isl_set_list_add(copy(), el.release());
  21052. if (!res)
  21053. exception::throw_last_error(saved_ctx);
  21054. return manage(res);
  21055. }
  21056. isl::set set_list::at(int index) const
  21057. {
  21058. if (!ptr)
  21059. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21060. auto saved_ctx = ctx();
  21061. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21062. auto res = isl_set_list_get_at(get(), index);
  21063. if (!res)
  21064. exception::throw_last_error(saved_ctx);
  21065. return manage(res);
  21066. }
  21067. isl::set set_list::get_at(int index) const
  21068. {
  21069. return at(index);
  21070. }
  21071. isl::set_list set_list::clear() const
  21072. {
  21073. if (!ptr)
  21074. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21075. auto saved_ctx = ctx();
  21076. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21077. auto res = isl_set_list_clear(copy());
  21078. if (!res)
  21079. exception::throw_last_error(saved_ctx);
  21080. return manage(res);
  21081. }
  21082. isl::set_list set_list::concat(isl::set_list list2) const
  21083. {
  21084. if (!ptr || list2.is_null())
  21085. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21086. auto saved_ctx = ctx();
  21087. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21088. auto res = isl_set_list_concat(copy(), list2.release());
  21089. if (!res)
  21090. exception::throw_last_error(saved_ctx);
  21091. return manage(res);
  21092. }
  21093. isl::set_list set_list::drop(unsigned int first, unsigned int n) const
  21094. {
  21095. if (!ptr)
  21096. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21097. auto saved_ctx = ctx();
  21098. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21099. auto res = isl_set_list_drop(copy(), first, n);
  21100. if (!res)
  21101. exception::throw_last_error(saved_ctx);
  21102. return manage(res);
  21103. }
  21104. void set_list::foreach(const std::function<void(isl::set)> &fn) const
  21105. {
  21106. if (!ptr)
  21107. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21108. auto saved_ctx = ctx();
  21109. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21110. struct fn_data {
  21111. std::function<void(isl::set)> func;
  21112. std::exception_ptr eptr;
  21113. } fn_data = { fn };
  21114. auto fn_lambda = [](isl_set *arg_0, void *arg_1) -> isl_stat {
  21115. auto *data = static_cast<struct fn_data *>(arg_1);
  21116. ISL_CPP_TRY {
  21117. (data->func)(manage(arg_0));
  21118. return isl_stat_ok;
  21119. } ISL_CPP_CATCH_ALL {
  21120. data->eptr = std::current_exception();
  21121. return isl_stat_error;
  21122. }
  21123. };
  21124. auto res = isl_set_list_foreach(get(), fn_lambda, &fn_data);
  21125. if (fn_data.eptr)
  21126. std::rethrow_exception(fn_data.eptr);
  21127. if (res < 0)
  21128. exception::throw_last_error(saved_ctx);
  21129. return;
  21130. }
  21131. void set_list::foreach_scc(const std::function<bool(isl::set, isl::set)> &follows, const std::function<void(isl::set_list)> &fn) const
  21132. {
  21133. if (!ptr)
  21134. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21135. auto saved_ctx = ctx();
  21136. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21137. struct follows_data {
  21138. std::function<bool(isl::set, isl::set)> func;
  21139. std::exception_ptr eptr;
  21140. } follows_data = { follows };
  21141. auto follows_lambda = [](isl_set *arg_0, isl_set *arg_1, void *arg_2) -> isl_bool {
  21142. auto *data = static_cast<struct follows_data *>(arg_2);
  21143. ISL_CPP_TRY {
  21144. auto ret = (data->func)(manage_copy(arg_0), manage_copy(arg_1));
  21145. return ret ? isl_bool_true : isl_bool_false;
  21146. } ISL_CPP_CATCH_ALL {
  21147. data->eptr = std::current_exception();
  21148. return isl_bool_error;
  21149. }
  21150. };
  21151. struct fn_data {
  21152. std::function<void(isl::set_list)> func;
  21153. std::exception_ptr eptr;
  21154. } fn_data = { fn };
  21155. auto fn_lambda = [](isl_set_list *arg_0, void *arg_1) -> isl_stat {
  21156. auto *data = static_cast<struct fn_data *>(arg_1);
  21157. ISL_CPP_TRY {
  21158. (data->func)(manage(arg_0));
  21159. return isl_stat_ok;
  21160. } ISL_CPP_CATCH_ALL {
  21161. data->eptr = std::current_exception();
  21162. return isl_stat_error;
  21163. }
  21164. };
  21165. auto res = isl_set_list_foreach_scc(get(), follows_lambda, &follows_data, fn_lambda, &fn_data);
  21166. if (follows_data.eptr)
  21167. std::rethrow_exception(follows_data.eptr);
  21168. if (fn_data.eptr)
  21169. std::rethrow_exception(fn_data.eptr);
  21170. if (res < 0)
  21171. exception::throw_last_error(saved_ctx);
  21172. return;
  21173. }
  21174. isl::set_list set_list::insert(unsigned int pos, isl::set el) const
  21175. {
  21176. if (!ptr || el.is_null())
  21177. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21178. auto saved_ctx = ctx();
  21179. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21180. auto res = isl_set_list_insert(copy(), pos, el.release());
  21181. if (!res)
  21182. exception::throw_last_error(saved_ctx);
  21183. return manage(res);
  21184. }
  21185. unsigned set_list::size() const
  21186. {
  21187. if (!ptr)
  21188. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21189. auto saved_ctx = ctx();
  21190. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21191. auto res = isl_set_list_size(get());
  21192. if (res < 0)
  21193. exception::throw_last_error(saved_ctx);
  21194. return res;
  21195. }
  21196. inline std::ostream &operator<<(std::ostream &os, const set_list &obj)
  21197. {
  21198. if (!obj.get())
  21199. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21200. auto saved_ctx = isl_set_list_get_ctx(obj.get());
  21201. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21202. char *str = isl_set_list_to_str(obj.get());
  21203. if (!str)
  21204. exception::throw_last_error(saved_ctx);
  21205. os << str;
  21206. free(str);
  21207. return os;
  21208. }
  21209. // implementations for isl::space
  21210. space manage(__isl_take isl_space *ptr) {
  21211. if (!ptr)
  21212. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21213. return space(ptr);
  21214. }
  21215. space manage_copy(__isl_keep isl_space *ptr) {
  21216. if (!ptr)
  21217. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21218. auto saved_ctx = isl_space_get_ctx(ptr);
  21219. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21220. ptr = isl_space_copy(ptr);
  21221. if (!ptr)
  21222. exception::throw_last_error(saved_ctx);
  21223. return space(ptr);
  21224. }
  21225. space::space(__isl_take isl_space *ptr)
  21226. : ptr(ptr) {}
  21227. space::space()
  21228. : ptr(nullptr) {}
  21229. space::space(const space &obj)
  21230. : ptr(nullptr)
  21231. {
  21232. if (!obj.ptr)
  21233. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21234. auto saved_ctx = isl_space_get_ctx(obj.ptr);
  21235. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21236. ptr = obj.copy();
  21237. if (!ptr)
  21238. exception::throw_last_error(saved_ctx);
  21239. }
  21240. space::space(isl::ctx ctx, const std::string &str)
  21241. {
  21242. auto saved_ctx = ctx;
  21243. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21244. auto res = isl_space_read_from_str(ctx.release(), str.c_str());
  21245. if (!res)
  21246. exception::throw_last_error(saved_ctx);
  21247. ptr = res;
  21248. }
  21249. space &space::operator=(space obj) {
  21250. std::swap(this->ptr, obj.ptr);
  21251. return *this;
  21252. }
  21253. space::~space() {
  21254. if (ptr)
  21255. isl_space_free(ptr);
  21256. }
  21257. __isl_give isl_space *space::copy() const & {
  21258. return isl_space_copy(ptr);
  21259. }
  21260. __isl_keep isl_space *space::get() const {
  21261. return ptr;
  21262. }
  21263. __isl_give isl_space *space::release() {
  21264. isl_space *tmp = ptr;
  21265. ptr = nullptr;
  21266. return tmp;
  21267. }
  21268. bool space::is_null() const {
  21269. return ptr == nullptr;
  21270. }
  21271. isl::ctx space::ctx() const {
  21272. return isl::ctx(isl_space_get_ctx(ptr));
  21273. }
  21274. isl::space space::add_named_tuple(isl::id tuple_id, unsigned int dim) const
  21275. {
  21276. if (!ptr || tuple_id.is_null())
  21277. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21278. auto saved_ctx = ctx();
  21279. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21280. auto res = isl_space_add_named_tuple_id_ui(copy(), tuple_id.release(), dim);
  21281. if (!res)
  21282. exception::throw_last_error(saved_ctx);
  21283. return manage(res);
  21284. }
  21285. isl::space space::add_named_tuple(const std::string &tuple_id, unsigned int dim) const
  21286. {
  21287. if (!ptr)
  21288. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21289. return this->add_named_tuple(isl::id(ctx(), tuple_id), dim);
  21290. }
  21291. isl::space space::add_param(isl::id id) const
  21292. {
  21293. if (!ptr || id.is_null())
  21294. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21295. auto saved_ctx = ctx();
  21296. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21297. auto res = isl_space_add_param_id(copy(), id.release());
  21298. if (!res)
  21299. exception::throw_last_error(saved_ctx);
  21300. return manage(res);
  21301. }
  21302. isl::space space::add_param(const std::string &id) const
  21303. {
  21304. if (!ptr)
  21305. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21306. return this->add_param(isl::id(ctx(), id));
  21307. }
  21308. isl::space space::add_unnamed_tuple(unsigned int dim) const
  21309. {
  21310. if (!ptr)
  21311. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21312. auto saved_ctx = ctx();
  21313. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21314. auto res = isl_space_add_unnamed_tuple_ui(copy(), dim);
  21315. if (!res)
  21316. exception::throw_last_error(saved_ctx);
  21317. return manage(res);
  21318. }
  21319. isl::space space::curry() const
  21320. {
  21321. if (!ptr)
  21322. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21323. auto saved_ctx = ctx();
  21324. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21325. auto res = isl_space_curry(copy());
  21326. if (!res)
  21327. exception::throw_last_error(saved_ctx);
  21328. return manage(res);
  21329. }
  21330. isl::space space::domain() const
  21331. {
  21332. if (!ptr)
  21333. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21334. auto saved_ctx = ctx();
  21335. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21336. auto res = isl_space_domain(copy());
  21337. if (!res)
  21338. exception::throw_last_error(saved_ctx);
  21339. return manage(res);
  21340. }
  21341. isl::multi_aff space::domain_map_multi_aff() const
  21342. {
  21343. if (!ptr)
  21344. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21345. auto saved_ctx = ctx();
  21346. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21347. auto res = isl_space_domain_map_multi_aff(copy());
  21348. if (!res)
  21349. exception::throw_last_error(saved_ctx);
  21350. return manage(res);
  21351. }
  21352. isl::pw_multi_aff space::domain_map_pw_multi_aff() const
  21353. {
  21354. if (!ptr)
  21355. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21356. auto saved_ctx = ctx();
  21357. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21358. auto res = isl_space_domain_map_pw_multi_aff(copy());
  21359. if (!res)
  21360. exception::throw_last_error(saved_ctx);
  21361. return manage(res);
  21362. }
  21363. isl::id space::domain_tuple_id() const
  21364. {
  21365. if (!ptr)
  21366. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21367. auto saved_ctx = ctx();
  21368. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21369. auto res = isl_space_get_domain_tuple_id(get());
  21370. if (!res)
  21371. exception::throw_last_error(saved_ctx);
  21372. return manage(res);
  21373. }
  21374. isl::id space::get_domain_tuple_id() const
  21375. {
  21376. return domain_tuple_id();
  21377. }
  21378. isl::space space::flatten_domain() const
  21379. {
  21380. if (!ptr)
  21381. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21382. auto saved_ctx = ctx();
  21383. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21384. auto res = isl_space_flatten_domain(copy());
  21385. if (!res)
  21386. exception::throw_last_error(saved_ctx);
  21387. return manage(res);
  21388. }
  21389. isl::space space::flatten_range() const
  21390. {
  21391. if (!ptr)
  21392. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21393. auto saved_ctx = ctx();
  21394. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21395. auto res = isl_space_flatten_range(copy());
  21396. if (!res)
  21397. exception::throw_last_error(saved_ctx);
  21398. return manage(res);
  21399. }
  21400. bool space::has_domain_tuple_id() const
  21401. {
  21402. if (!ptr)
  21403. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21404. auto saved_ctx = ctx();
  21405. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21406. auto res = isl_space_has_domain_tuple_id(get());
  21407. if (res < 0)
  21408. exception::throw_last_error(saved_ctx);
  21409. return res;
  21410. }
  21411. bool space::has_range_tuple_id() const
  21412. {
  21413. if (!ptr)
  21414. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21415. auto saved_ctx = ctx();
  21416. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21417. auto res = isl_space_has_range_tuple_id(get());
  21418. if (res < 0)
  21419. exception::throw_last_error(saved_ctx);
  21420. return res;
  21421. }
  21422. isl::multi_aff space::identity_multi_aff_on_domain() const
  21423. {
  21424. if (!ptr)
  21425. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21426. auto saved_ctx = ctx();
  21427. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21428. auto res = isl_space_identity_multi_aff_on_domain(copy());
  21429. if (!res)
  21430. exception::throw_last_error(saved_ctx);
  21431. return manage(res);
  21432. }
  21433. isl::multi_pw_aff space::identity_multi_pw_aff_on_domain() const
  21434. {
  21435. if (!ptr)
  21436. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21437. auto saved_ctx = ctx();
  21438. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21439. auto res = isl_space_identity_multi_pw_aff_on_domain(copy());
  21440. if (!res)
  21441. exception::throw_last_error(saved_ctx);
  21442. return manage(res);
  21443. }
  21444. isl::pw_multi_aff space::identity_pw_multi_aff_on_domain() const
  21445. {
  21446. if (!ptr)
  21447. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21448. auto saved_ctx = ctx();
  21449. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21450. auto res = isl_space_identity_pw_multi_aff_on_domain(copy());
  21451. if (!res)
  21452. exception::throw_last_error(saved_ctx);
  21453. return manage(res);
  21454. }
  21455. bool space::is_equal(const isl::space &space2) const
  21456. {
  21457. if (!ptr || space2.is_null())
  21458. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21459. auto saved_ctx = ctx();
  21460. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21461. auto res = isl_space_is_equal(get(), space2.get());
  21462. if (res < 0)
  21463. exception::throw_last_error(saved_ctx);
  21464. return res;
  21465. }
  21466. bool space::is_wrapping() const
  21467. {
  21468. if (!ptr)
  21469. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21470. auto saved_ctx = ctx();
  21471. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21472. auto res = isl_space_is_wrapping(get());
  21473. if (res < 0)
  21474. exception::throw_last_error(saved_ctx);
  21475. return res;
  21476. }
  21477. isl::space space::map_from_set() const
  21478. {
  21479. if (!ptr)
  21480. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21481. auto saved_ctx = ctx();
  21482. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21483. auto res = isl_space_map_from_set(copy());
  21484. if (!res)
  21485. exception::throw_last_error(saved_ctx);
  21486. return manage(res);
  21487. }
  21488. isl::multi_aff space::multi_aff(isl::aff_list list) const
  21489. {
  21490. if (!ptr || list.is_null())
  21491. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21492. auto saved_ctx = ctx();
  21493. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21494. auto res = isl_space_multi_aff(copy(), list.release());
  21495. if (!res)
  21496. exception::throw_last_error(saved_ctx);
  21497. return manage(res);
  21498. }
  21499. isl::multi_aff space::multi_aff_on_domain(isl::multi_val mv) const
  21500. {
  21501. if (!ptr || mv.is_null())
  21502. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21503. auto saved_ctx = ctx();
  21504. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21505. auto res = isl_space_multi_aff_on_domain_multi_val(copy(), mv.release());
  21506. if (!res)
  21507. exception::throw_last_error(saved_ctx);
  21508. return manage(res);
  21509. }
  21510. isl::multi_id space::multi_id(isl::id_list list) const
  21511. {
  21512. if (!ptr || list.is_null())
  21513. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21514. auto saved_ctx = ctx();
  21515. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21516. auto res = isl_space_multi_id(copy(), list.release());
  21517. if (!res)
  21518. exception::throw_last_error(saved_ctx);
  21519. return manage(res);
  21520. }
  21521. isl::multi_pw_aff space::multi_pw_aff(isl::pw_aff_list list) const
  21522. {
  21523. if (!ptr || list.is_null())
  21524. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21525. auto saved_ctx = ctx();
  21526. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21527. auto res = isl_space_multi_pw_aff(copy(), list.release());
  21528. if (!res)
  21529. exception::throw_last_error(saved_ctx);
  21530. return manage(res);
  21531. }
  21532. isl::multi_union_pw_aff space::multi_union_pw_aff(isl::union_pw_aff_list list) const
  21533. {
  21534. if (!ptr || list.is_null())
  21535. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21536. auto saved_ctx = ctx();
  21537. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21538. auto res = isl_space_multi_union_pw_aff(copy(), list.release());
  21539. if (!res)
  21540. exception::throw_last_error(saved_ctx);
  21541. return manage(res);
  21542. }
  21543. isl::multi_val space::multi_val(isl::val_list list) const
  21544. {
  21545. if (!ptr || list.is_null())
  21546. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21547. auto saved_ctx = ctx();
  21548. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21549. auto res = isl_space_multi_val(copy(), list.release());
  21550. if (!res)
  21551. exception::throw_last_error(saved_ctx);
  21552. return manage(res);
  21553. }
  21554. isl::aff space::param_aff_on_domain(isl::id id) const
  21555. {
  21556. if (!ptr || id.is_null())
  21557. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21558. auto saved_ctx = ctx();
  21559. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21560. auto res = isl_space_param_aff_on_domain_id(copy(), id.release());
  21561. if (!res)
  21562. exception::throw_last_error(saved_ctx);
  21563. return manage(res);
  21564. }
  21565. isl::aff space::param_aff_on_domain(const std::string &id) const
  21566. {
  21567. if (!ptr)
  21568. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21569. return this->param_aff_on_domain(isl::id(ctx(), id));
  21570. }
  21571. isl::space space::params() const
  21572. {
  21573. if (!ptr)
  21574. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21575. auto saved_ctx = ctx();
  21576. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21577. auto res = isl_space_params(copy());
  21578. if (!res)
  21579. exception::throw_last_error(saved_ctx);
  21580. return manage(res);
  21581. }
  21582. isl::space space::product(isl::space right) const
  21583. {
  21584. if (!ptr || right.is_null())
  21585. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21586. auto saved_ctx = ctx();
  21587. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21588. auto res = isl_space_product(copy(), right.release());
  21589. if (!res)
  21590. exception::throw_last_error(saved_ctx);
  21591. return manage(res);
  21592. }
  21593. isl::space space::range() const
  21594. {
  21595. if (!ptr)
  21596. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21597. auto saved_ctx = ctx();
  21598. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21599. auto res = isl_space_range(copy());
  21600. if (!res)
  21601. exception::throw_last_error(saved_ctx);
  21602. return manage(res);
  21603. }
  21604. isl::multi_aff space::range_map_multi_aff() const
  21605. {
  21606. if (!ptr)
  21607. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21608. auto saved_ctx = ctx();
  21609. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21610. auto res = isl_space_range_map_multi_aff(copy());
  21611. if (!res)
  21612. exception::throw_last_error(saved_ctx);
  21613. return manage(res);
  21614. }
  21615. isl::pw_multi_aff space::range_map_pw_multi_aff() const
  21616. {
  21617. if (!ptr)
  21618. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21619. auto saved_ctx = ctx();
  21620. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21621. auto res = isl_space_range_map_pw_multi_aff(copy());
  21622. if (!res)
  21623. exception::throw_last_error(saved_ctx);
  21624. return manage(res);
  21625. }
  21626. isl::space space::range_reverse() const
  21627. {
  21628. if (!ptr)
  21629. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21630. auto saved_ctx = ctx();
  21631. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21632. auto res = isl_space_range_reverse(copy());
  21633. if (!res)
  21634. exception::throw_last_error(saved_ctx);
  21635. return manage(res);
  21636. }
  21637. isl::id space::range_tuple_id() const
  21638. {
  21639. if (!ptr)
  21640. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21641. auto saved_ctx = ctx();
  21642. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21643. auto res = isl_space_get_range_tuple_id(get());
  21644. if (!res)
  21645. exception::throw_last_error(saved_ctx);
  21646. return manage(res);
  21647. }
  21648. isl::id space::get_range_tuple_id() const
  21649. {
  21650. return range_tuple_id();
  21651. }
  21652. isl::space space::reverse() const
  21653. {
  21654. if (!ptr)
  21655. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21656. auto saved_ctx = ctx();
  21657. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21658. auto res = isl_space_reverse(copy());
  21659. if (!res)
  21660. exception::throw_last_error(saved_ctx);
  21661. return manage(res);
  21662. }
  21663. isl::space space::set_domain_tuple(isl::id id) const
  21664. {
  21665. if (!ptr || id.is_null())
  21666. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21667. auto saved_ctx = ctx();
  21668. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21669. auto res = isl_space_set_domain_tuple_id(copy(), id.release());
  21670. if (!res)
  21671. exception::throw_last_error(saved_ctx);
  21672. return manage(res);
  21673. }
  21674. isl::space space::set_domain_tuple(const std::string &id) const
  21675. {
  21676. if (!ptr)
  21677. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21678. return this->set_domain_tuple(isl::id(ctx(), id));
  21679. }
  21680. isl::space space::set_range_tuple(isl::id id) const
  21681. {
  21682. if (!ptr || id.is_null())
  21683. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21684. auto saved_ctx = ctx();
  21685. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21686. auto res = isl_space_set_range_tuple_id(copy(), id.release());
  21687. if (!res)
  21688. exception::throw_last_error(saved_ctx);
  21689. return manage(res);
  21690. }
  21691. isl::space space::set_range_tuple(const std::string &id) const
  21692. {
  21693. if (!ptr)
  21694. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21695. return this->set_range_tuple(isl::id(ctx(), id));
  21696. }
  21697. isl::space space::uncurry() const
  21698. {
  21699. if (!ptr)
  21700. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21701. auto saved_ctx = ctx();
  21702. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21703. auto res = isl_space_uncurry(copy());
  21704. if (!res)
  21705. exception::throw_last_error(saved_ctx);
  21706. return manage(res);
  21707. }
  21708. isl::space space::unit(isl::ctx ctx)
  21709. {
  21710. auto saved_ctx = ctx;
  21711. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21712. auto res = isl_space_unit(ctx.release());
  21713. if (!res)
  21714. exception::throw_last_error(saved_ctx);
  21715. return manage(res);
  21716. }
  21717. isl::map space::universe_map() const
  21718. {
  21719. if (!ptr)
  21720. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21721. auto saved_ctx = ctx();
  21722. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21723. auto res = isl_space_universe_map(copy());
  21724. if (!res)
  21725. exception::throw_last_error(saved_ctx);
  21726. return manage(res);
  21727. }
  21728. isl::set space::universe_set() const
  21729. {
  21730. if (!ptr)
  21731. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21732. auto saved_ctx = ctx();
  21733. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21734. auto res = isl_space_universe_set(copy());
  21735. if (!res)
  21736. exception::throw_last_error(saved_ctx);
  21737. return manage(res);
  21738. }
  21739. isl::space space::unwrap() const
  21740. {
  21741. if (!ptr)
  21742. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21743. auto saved_ctx = ctx();
  21744. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21745. auto res = isl_space_unwrap(copy());
  21746. if (!res)
  21747. exception::throw_last_error(saved_ctx);
  21748. return manage(res);
  21749. }
  21750. isl::space space::wrap() const
  21751. {
  21752. if (!ptr)
  21753. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21754. auto saved_ctx = ctx();
  21755. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21756. auto res = isl_space_wrap(copy());
  21757. if (!res)
  21758. exception::throw_last_error(saved_ctx);
  21759. return manage(res);
  21760. }
  21761. isl::aff space::zero_aff_on_domain() const
  21762. {
  21763. if (!ptr)
  21764. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21765. auto saved_ctx = ctx();
  21766. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21767. auto res = isl_space_zero_aff_on_domain(copy());
  21768. if (!res)
  21769. exception::throw_last_error(saved_ctx);
  21770. return manage(res);
  21771. }
  21772. isl::multi_aff space::zero_multi_aff() const
  21773. {
  21774. if (!ptr)
  21775. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21776. auto saved_ctx = ctx();
  21777. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21778. auto res = isl_space_zero_multi_aff(copy());
  21779. if (!res)
  21780. exception::throw_last_error(saved_ctx);
  21781. return manage(res);
  21782. }
  21783. isl::multi_pw_aff space::zero_multi_pw_aff() const
  21784. {
  21785. if (!ptr)
  21786. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21787. auto saved_ctx = ctx();
  21788. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21789. auto res = isl_space_zero_multi_pw_aff(copy());
  21790. if (!res)
  21791. exception::throw_last_error(saved_ctx);
  21792. return manage(res);
  21793. }
  21794. isl::multi_union_pw_aff space::zero_multi_union_pw_aff() const
  21795. {
  21796. if (!ptr)
  21797. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21798. auto saved_ctx = ctx();
  21799. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21800. auto res = isl_space_zero_multi_union_pw_aff(copy());
  21801. if (!res)
  21802. exception::throw_last_error(saved_ctx);
  21803. return manage(res);
  21804. }
  21805. isl::multi_val space::zero_multi_val() const
  21806. {
  21807. if (!ptr)
  21808. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21809. auto saved_ctx = ctx();
  21810. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21811. auto res = isl_space_zero_multi_val(copy());
  21812. if (!res)
  21813. exception::throw_last_error(saved_ctx);
  21814. return manage(res);
  21815. }
  21816. inline std::ostream &operator<<(std::ostream &os, const space &obj)
  21817. {
  21818. if (!obj.get())
  21819. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21820. auto saved_ctx = isl_space_get_ctx(obj.get());
  21821. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21822. char *str = isl_space_to_str(obj.get());
  21823. if (!str)
  21824. exception::throw_last_error(saved_ctx);
  21825. os << str;
  21826. free(str);
  21827. return os;
  21828. }
  21829. // implementations for isl::union_access_info
  21830. union_access_info manage(__isl_take isl_union_access_info *ptr) {
  21831. if (!ptr)
  21832. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21833. return union_access_info(ptr);
  21834. }
  21835. union_access_info manage_copy(__isl_keep isl_union_access_info *ptr) {
  21836. if (!ptr)
  21837. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21838. auto saved_ctx = isl_union_access_info_get_ctx(ptr);
  21839. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21840. ptr = isl_union_access_info_copy(ptr);
  21841. if (!ptr)
  21842. exception::throw_last_error(saved_ctx);
  21843. return union_access_info(ptr);
  21844. }
  21845. union_access_info::union_access_info(__isl_take isl_union_access_info *ptr)
  21846. : ptr(ptr) {}
  21847. union_access_info::union_access_info()
  21848. : ptr(nullptr) {}
  21849. union_access_info::union_access_info(const union_access_info &obj)
  21850. : ptr(nullptr)
  21851. {
  21852. if (!obj.ptr)
  21853. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21854. auto saved_ctx = isl_union_access_info_get_ctx(obj.ptr);
  21855. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21856. ptr = obj.copy();
  21857. if (!ptr)
  21858. exception::throw_last_error(saved_ctx);
  21859. }
  21860. union_access_info::union_access_info(isl::union_map sink)
  21861. {
  21862. if (sink.is_null())
  21863. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21864. auto saved_ctx = sink.ctx();
  21865. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21866. auto res = isl_union_access_info_from_sink(sink.release());
  21867. if (!res)
  21868. exception::throw_last_error(saved_ctx);
  21869. ptr = res;
  21870. }
  21871. union_access_info &union_access_info::operator=(union_access_info obj) {
  21872. std::swap(this->ptr, obj.ptr);
  21873. return *this;
  21874. }
  21875. union_access_info::~union_access_info() {
  21876. if (ptr)
  21877. isl_union_access_info_free(ptr);
  21878. }
  21879. __isl_give isl_union_access_info *union_access_info::copy() const & {
  21880. return isl_union_access_info_copy(ptr);
  21881. }
  21882. __isl_keep isl_union_access_info *union_access_info::get() const {
  21883. return ptr;
  21884. }
  21885. __isl_give isl_union_access_info *union_access_info::release() {
  21886. isl_union_access_info *tmp = ptr;
  21887. ptr = nullptr;
  21888. return tmp;
  21889. }
  21890. bool union_access_info::is_null() const {
  21891. return ptr == nullptr;
  21892. }
  21893. isl::ctx union_access_info::ctx() const {
  21894. return isl::ctx(isl_union_access_info_get_ctx(ptr));
  21895. }
  21896. isl::union_flow union_access_info::compute_flow() const
  21897. {
  21898. if (!ptr)
  21899. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21900. auto saved_ctx = ctx();
  21901. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21902. auto res = isl_union_access_info_compute_flow(copy());
  21903. if (!res)
  21904. exception::throw_last_error(saved_ctx);
  21905. return manage(res);
  21906. }
  21907. isl::union_access_info union_access_info::set_kill(isl::union_map kill) const
  21908. {
  21909. if (!ptr || kill.is_null())
  21910. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21911. auto saved_ctx = ctx();
  21912. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21913. auto res = isl_union_access_info_set_kill(copy(), kill.release());
  21914. if (!res)
  21915. exception::throw_last_error(saved_ctx);
  21916. return manage(res);
  21917. }
  21918. isl::union_access_info union_access_info::set_may_source(isl::union_map may_source) const
  21919. {
  21920. if (!ptr || may_source.is_null())
  21921. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21922. auto saved_ctx = ctx();
  21923. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21924. auto res = isl_union_access_info_set_may_source(copy(), may_source.release());
  21925. if (!res)
  21926. exception::throw_last_error(saved_ctx);
  21927. return manage(res);
  21928. }
  21929. isl::union_access_info union_access_info::set_must_source(isl::union_map must_source) const
  21930. {
  21931. if (!ptr || must_source.is_null())
  21932. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21933. auto saved_ctx = ctx();
  21934. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21935. auto res = isl_union_access_info_set_must_source(copy(), must_source.release());
  21936. if (!res)
  21937. exception::throw_last_error(saved_ctx);
  21938. return manage(res);
  21939. }
  21940. isl::union_access_info union_access_info::set_schedule(isl::schedule schedule) const
  21941. {
  21942. if (!ptr || schedule.is_null())
  21943. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21944. auto saved_ctx = ctx();
  21945. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21946. auto res = isl_union_access_info_set_schedule(copy(), schedule.release());
  21947. if (!res)
  21948. exception::throw_last_error(saved_ctx);
  21949. return manage(res);
  21950. }
  21951. isl::union_access_info union_access_info::set_schedule_map(isl::union_map schedule_map) const
  21952. {
  21953. if (!ptr || schedule_map.is_null())
  21954. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21955. auto saved_ctx = ctx();
  21956. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21957. auto res = isl_union_access_info_set_schedule_map(copy(), schedule_map.release());
  21958. if (!res)
  21959. exception::throw_last_error(saved_ctx);
  21960. return manage(res);
  21961. }
  21962. inline std::ostream &operator<<(std::ostream &os, const union_access_info &obj)
  21963. {
  21964. if (!obj.get())
  21965. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21966. auto saved_ctx = isl_union_access_info_get_ctx(obj.get());
  21967. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21968. char *str = isl_union_access_info_to_str(obj.get());
  21969. if (!str)
  21970. exception::throw_last_error(saved_ctx);
  21971. os << str;
  21972. free(str);
  21973. return os;
  21974. }
  21975. // implementations for isl::union_flow
  21976. union_flow manage(__isl_take isl_union_flow *ptr) {
  21977. if (!ptr)
  21978. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21979. return union_flow(ptr);
  21980. }
  21981. union_flow manage_copy(__isl_keep isl_union_flow *ptr) {
  21982. if (!ptr)
  21983. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  21984. auto saved_ctx = isl_union_flow_get_ctx(ptr);
  21985. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  21986. ptr = isl_union_flow_copy(ptr);
  21987. if (!ptr)
  21988. exception::throw_last_error(saved_ctx);
  21989. return union_flow(ptr);
  21990. }
  21991. union_flow::union_flow(__isl_take isl_union_flow *ptr)
  21992. : ptr(ptr) {}
  21993. union_flow::union_flow()
  21994. : ptr(nullptr) {}
  21995. union_flow::union_flow(const union_flow &obj)
  21996. : ptr(nullptr)
  21997. {
  21998. if (!obj.ptr)
  21999. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22000. auto saved_ctx = isl_union_flow_get_ctx(obj.ptr);
  22001. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22002. ptr = obj.copy();
  22003. if (!ptr)
  22004. exception::throw_last_error(saved_ctx);
  22005. }
  22006. union_flow &union_flow::operator=(union_flow obj) {
  22007. std::swap(this->ptr, obj.ptr);
  22008. return *this;
  22009. }
  22010. union_flow::~union_flow() {
  22011. if (ptr)
  22012. isl_union_flow_free(ptr);
  22013. }
  22014. __isl_give isl_union_flow *union_flow::copy() const & {
  22015. return isl_union_flow_copy(ptr);
  22016. }
  22017. __isl_keep isl_union_flow *union_flow::get() const {
  22018. return ptr;
  22019. }
  22020. __isl_give isl_union_flow *union_flow::release() {
  22021. isl_union_flow *tmp = ptr;
  22022. ptr = nullptr;
  22023. return tmp;
  22024. }
  22025. bool union_flow::is_null() const {
  22026. return ptr == nullptr;
  22027. }
  22028. isl::ctx union_flow::ctx() const {
  22029. return isl::ctx(isl_union_flow_get_ctx(ptr));
  22030. }
  22031. isl::union_map union_flow::full_may_dependence() const
  22032. {
  22033. if (!ptr)
  22034. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22035. auto saved_ctx = ctx();
  22036. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22037. auto res = isl_union_flow_get_full_may_dependence(get());
  22038. if (!res)
  22039. exception::throw_last_error(saved_ctx);
  22040. return manage(res);
  22041. }
  22042. isl::union_map union_flow::get_full_may_dependence() const
  22043. {
  22044. return full_may_dependence();
  22045. }
  22046. isl::union_map union_flow::full_must_dependence() const
  22047. {
  22048. if (!ptr)
  22049. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22050. auto saved_ctx = ctx();
  22051. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22052. auto res = isl_union_flow_get_full_must_dependence(get());
  22053. if (!res)
  22054. exception::throw_last_error(saved_ctx);
  22055. return manage(res);
  22056. }
  22057. isl::union_map union_flow::get_full_must_dependence() const
  22058. {
  22059. return full_must_dependence();
  22060. }
  22061. isl::union_map union_flow::may_dependence() const
  22062. {
  22063. if (!ptr)
  22064. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22065. auto saved_ctx = ctx();
  22066. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22067. auto res = isl_union_flow_get_may_dependence(get());
  22068. if (!res)
  22069. exception::throw_last_error(saved_ctx);
  22070. return manage(res);
  22071. }
  22072. isl::union_map union_flow::get_may_dependence() const
  22073. {
  22074. return may_dependence();
  22075. }
  22076. isl::union_map union_flow::may_no_source() const
  22077. {
  22078. if (!ptr)
  22079. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22080. auto saved_ctx = ctx();
  22081. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22082. auto res = isl_union_flow_get_may_no_source(get());
  22083. if (!res)
  22084. exception::throw_last_error(saved_ctx);
  22085. return manage(res);
  22086. }
  22087. isl::union_map union_flow::get_may_no_source() const
  22088. {
  22089. return may_no_source();
  22090. }
  22091. isl::union_map union_flow::must_dependence() const
  22092. {
  22093. if (!ptr)
  22094. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22095. auto saved_ctx = ctx();
  22096. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22097. auto res = isl_union_flow_get_must_dependence(get());
  22098. if (!res)
  22099. exception::throw_last_error(saved_ctx);
  22100. return manage(res);
  22101. }
  22102. isl::union_map union_flow::get_must_dependence() const
  22103. {
  22104. return must_dependence();
  22105. }
  22106. isl::union_map union_flow::must_no_source() const
  22107. {
  22108. if (!ptr)
  22109. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22110. auto saved_ctx = ctx();
  22111. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22112. auto res = isl_union_flow_get_must_no_source(get());
  22113. if (!res)
  22114. exception::throw_last_error(saved_ctx);
  22115. return manage(res);
  22116. }
  22117. isl::union_map union_flow::get_must_no_source() const
  22118. {
  22119. return must_no_source();
  22120. }
  22121. inline std::ostream &operator<<(std::ostream &os, const union_flow &obj)
  22122. {
  22123. if (!obj.get())
  22124. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22125. auto saved_ctx = isl_union_flow_get_ctx(obj.get());
  22126. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22127. char *str = isl_union_flow_to_str(obj.get());
  22128. if (!str)
  22129. exception::throw_last_error(saved_ctx);
  22130. os << str;
  22131. free(str);
  22132. return os;
  22133. }
  22134. // implementations for isl::union_map
  22135. union_map manage(__isl_take isl_union_map *ptr) {
  22136. if (!ptr)
  22137. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22138. return union_map(ptr);
  22139. }
  22140. union_map manage_copy(__isl_keep isl_union_map *ptr) {
  22141. if (!ptr)
  22142. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22143. auto saved_ctx = isl_union_map_get_ctx(ptr);
  22144. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22145. ptr = isl_union_map_copy(ptr);
  22146. if (!ptr)
  22147. exception::throw_last_error(saved_ctx);
  22148. return union_map(ptr);
  22149. }
  22150. union_map::union_map(__isl_take isl_union_map *ptr)
  22151. : ptr(ptr) {}
  22152. union_map::union_map()
  22153. : ptr(nullptr) {}
  22154. union_map::union_map(const union_map &obj)
  22155. : ptr(nullptr)
  22156. {
  22157. if (!obj.ptr)
  22158. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22159. auto saved_ctx = isl_union_map_get_ctx(obj.ptr);
  22160. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22161. ptr = obj.copy();
  22162. if (!ptr)
  22163. exception::throw_last_error(saved_ctx);
  22164. }
  22165. union_map::union_map(isl::basic_map bmap)
  22166. {
  22167. if (bmap.is_null())
  22168. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22169. auto saved_ctx = bmap.ctx();
  22170. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22171. auto res = isl_union_map_from_basic_map(bmap.release());
  22172. if (!res)
  22173. exception::throw_last_error(saved_ctx);
  22174. ptr = res;
  22175. }
  22176. union_map::union_map(isl::map map)
  22177. {
  22178. if (map.is_null())
  22179. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22180. auto saved_ctx = map.ctx();
  22181. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22182. auto res = isl_union_map_from_map(map.release());
  22183. if (!res)
  22184. exception::throw_last_error(saved_ctx);
  22185. ptr = res;
  22186. }
  22187. union_map::union_map(isl::ctx ctx, const std::string &str)
  22188. {
  22189. auto saved_ctx = ctx;
  22190. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22191. auto res = isl_union_map_read_from_str(ctx.release(), str.c_str());
  22192. if (!res)
  22193. exception::throw_last_error(saved_ctx);
  22194. ptr = res;
  22195. }
  22196. union_map &union_map::operator=(union_map obj) {
  22197. std::swap(this->ptr, obj.ptr);
  22198. return *this;
  22199. }
  22200. union_map::~union_map() {
  22201. if (ptr)
  22202. isl_union_map_free(ptr);
  22203. }
  22204. __isl_give isl_union_map *union_map::copy() const & {
  22205. return isl_union_map_copy(ptr);
  22206. }
  22207. __isl_keep isl_union_map *union_map::get() const {
  22208. return ptr;
  22209. }
  22210. __isl_give isl_union_map *union_map::release() {
  22211. isl_union_map *tmp = ptr;
  22212. ptr = nullptr;
  22213. return tmp;
  22214. }
  22215. bool union_map::is_null() const {
  22216. return ptr == nullptr;
  22217. }
  22218. isl::ctx union_map::ctx() const {
  22219. return isl::ctx(isl_union_map_get_ctx(ptr));
  22220. }
  22221. isl::union_map union_map::affine_hull() const
  22222. {
  22223. if (!ptr)
  22224. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22225. auto saved_ctx = ctx();
  22226. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22227. auto res = isl_union_map_affine_hull(copy());
  22228. if (!res)
  22229. exception::throw_last_error(saved_ctx);
  22230. return manage(res);
  22231. }
  22232. isl::union_map union_map::apply_domain(isl::union_map umap2) const
  22233. {
  22234. if (!ptr || umap2.is_null())
  22235. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22236. auto saved_ctx = ctx();
  22237. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22238. auto res = isl_union_map_apply_domain(copy(), umap2.release());
  22239. if (!res)
  22240. exception::throw_last_error(saved_ctx);
  22241. return manage(res);
  22242. }
  22243. isl::union_map union_map::apply_range(isl::union_map umap2) const
  22244. {
  22245. if (!ptr || umap2.is_null())
  22246. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22247. auto saved_ctx = ctx();
  22248. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22249. auto res = isl_union_map_apply_range(copy(), umap2.release());
  22250. if (!res)
  22251. exception::throw_last_error(saved_ctx);
  22252. return manage(res);
  22253. }
  22254. isl::map union_map::as_map() const
  22255. {
  22256. if (!ptr)
  22257. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22258. auto saved_ctx = ctx();
  22259. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22260. auto res = isl_union_map_as_map(copy());
  22261. if (!res)
  22262. exception::throw_last_error(saved_ctx);
  22263. return manage(res);
  22264. }
  22265. isl::multi_union_pw_aff union_map::as_multi_union_pw_aff() const
  22266. {
  22267. if (!ptr)
  22268. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22269. auto saved_ctx = ctx();
  22270. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22271. auto res = isl_union_map_as_multi_union_pw_aff(copy());
  22272. if (!res)
  22273. exception::throw_last_error(saved_ctx);
  22274. return manage(res);
  22275. }
  22276. isl::union_pw_multi_aff union_map::as_union_pw_multi_aff() const
  22277. {
  22278. if (!ptr)
  22279. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22280. auto saved_ctx = ctx();
  22281. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22282. auto res = isl_union_map_as_union_pw_multi_aff(copy());
  22283. if (!res)
  22284. exception::throw_last_error(saved_ctx);
  22285. return manage(res);
  22286. }
  22287. isl::union_set union_map::bind_range(isl::multi_id tuple) const
  22288. {
  22289. if (!ptr || tuple.is_null())
  22290. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22291. auto saved_ctx = ctx();
  22292. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22293. auto res = isl_union_map_bind_range(copy(), tuple.release());
  22294. if (!res)
  22295. exception::throw_last_error(saved_ctx);
  22296. return manage(res);
  22297. }
  22298. isl::union_map union_map::coalesce() const
  22299. {
  22300. if (!ptr)
  22301. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22302. auto saved_ctx = ctx();
  22303. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22304. auto res = isl_union_map_coalesce(copy());
  22305. if (!res)
  22306. exception::throw_last_error(saved_ctx);
  22307. return manage(res);
  22308. }
  22309. isl::union_map union_map::compute_divs() const
  22310. {
  22311. if (!ptr)
  22312. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22313. auto saved_ctx = ctx();
  22314. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22315. auto res = isl_union_map_compute_divs(copy());
  22316. if (!res)
  22317. exception::throw_last_error(saved_ctx);
  22318. return manage(res);
  22319. }
  22320. isl::union_map union_map::curry() const
  22321. {
  22322. if (!ptr)
  22323. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22324. auto saved_ctx = ctx();
  22325. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22326. auto res = isl_union_map_curry(copy());
  22327. if (!res)
  22328. exception::throw_last_error(saved_ctx);
  22329. return manage(res);
  22330. }
  22331. isl::union_set union_map::deltas() const
  22332. {
  22333. if (!ptr)
  22334. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22335. auto saved_ctx = ctx();
  22336. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22337. auto res = isl_union_map_deltas(copy());
  22338. if (!res)
  22339. exception::throw_last_error(saved_ctx);
  22340. return manage(res);
  22341. }
  22342. isl::union_map union_map::detect_equalities() const
  22343. {
  22344. if (!ptr)
  22345. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22346. auto saved_ctx = ctx();
  22347. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22348. auto res = isl_union_map_detect_equalities(copy());
  22349. if (!res)
  22350. exception::throw_last_error(saved_ctx);
  22351. return manage(res);
  22352. }
  22353. isl::union_set union_map::domain() const
  22354. {
  22355. if (!ptr)
  22356. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22357. auto saved_ctx = ctx();
  22358. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22359. auto res = isl_union_map_domain(copy());
  22360. if (!res)
  22361. exception::throw_last_error(saved_ctx);
  22362. return manage(res);
  22363. }
  22364. isl::union_map union_map::domain_factor_domain() const
  22365. {
  22366. if (!ptr)
  22367. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22368. auto saved_ctx = ctx();
  22369. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22370. auto res = isl_union_map_domain_factor_domain(copy());
  22371. if (!res)
  22372. exception::throw_last_error(saved_ctx);
  22373. return manage(res);
  22374. }
  22375. isl::union_map union_map::domain_factor_range() const
  22376. {
  22377. if (!ptr)
  22378. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22379. auto saved_ctx = ctx();
  22380. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22381. auto res = isl_union_map_domain_factor_range(copy());
  22382. if (!res)
  22383. exception::throw_last_error(saved_ctx);
  22384. return manage(res);
  22385. }
  22386. isl::union_map union_map::domain_map() const
  22387. {
  22388. if (!ptr)
  22389. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22390. auto saved_ctx = ctx();
  22391. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22392. auto res = isl_union_map_domain_map(copy());
  22393. if (!res)
  22394. exception::throw_last_error(saved_ctx);
  22395. return manage(res);
  22396. }
  22397. isl::union_pw_multi_aff union_map::domain_map_union_pw_multi_aff() const
  22398. {
  22399. if (!ptr)
  22400. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22401. auto saved_ctx = ctx();
  22402. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22403. auto res = isl_union_map_domain_map_union_pw_multi_aff(copy());
  22404. if (!res)
  22405. exception::throw_last_error(saved_ctx);
  22406. return manage(res);
  22407. }
  22408. isl::union_map union_map::domain_product(isl::union_map umap2) const
  22409. {
  22410. if (!ptr || umap2.is_null())
  22411. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22412. auto saved_ctx = ctx();
  22413. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22414. auto res = isl_union_map_domain_product(copy(), umap2.release());
  22415. if (!res)
  22416. exception::throw_last_error(saved_ctx);
  22417. return manage(res);
  22418. }
  22419. isl::union_map union_map::empty(isl::ctx ctx)
  22420. {
  22421. auto saved_ctx = ctx;
  22422. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22423. auto res = isl_union_map_empty_ctx(ctx.release());
  22424. if (!res)
  22425. exception::throw_last_error(saved_ctx);
  22426. return manage(res);
  22427. }
  22428. isl::union_map union_map::eq_at(isl::multi_union_pw_aff mupa) const
  22429. {
  22430. if (!ptr || mupa.is_null())
  22431. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22432. auto saved_ctx = ctx();
  22433. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22434. auto res = isl_union_map_eq_at_multi_union_pw_aff(copy(), mupa.release());
  22435. if (!res)
  22436. exception::throw_last_error(saved_ctx);
  22437. return manage(res);
  22438. }
  22439. bool union_map::every_map(const std::function<bool(isl::map)> &test) const
  22440. {
  22441. if (!ptr)
  22442. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22443. auto saved_ctx = ctx();
  22444. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22445. struct test_data {
  22446. std::function<bool(isl::map)> func;
  22447. std::exception_ptr eptr;
  22448. } test_data = { test };
  22449. auto test_lambda = [](isl_map *arg_0, void *arg_1) -> isl_bool {
  22450. auto *data = static_cast<struct test_data *>(arg_1);
  22451. ISL_CPP_TRY {
  22452. auto ret = (data->func)(manage_copy(arg_0));
  22453. return ret ? isl_bool_true : isl_bool_false;
  22454. } ISL_CPP_CATCH_ALL {
  22455. data->eptr = std::current_exception();
  22456. return isl_bool_error;
  22457. }
  22458. };
  22459. auto res = isl_union_map_every_map(get(), test_lambda, &test_data);
  22460. if (test_data.eptr)
  22461. std::rethrow_exception(test_data.eptr);
  22462. if (res < 0)
  22463. exception::throw_last_error(saved_ctx);
  22464. return res;
  22465. }
  22466. isl::map union_map::extract_map(isl::space space) const
  22467. {
  22468. if (!ptr || space.is_null())
  22469. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22470. auto saved_ctx = ctx();
  22471. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22472. auto res = isl_union_map_extract_map(get(), space.release());
  22473. if (!res)
  22474. exception::throw_last_error(saved_ctx);
  22475. return manage(res);
  22476. }
  22477. isl::union_map union_map::factor_domain() const
  22478. {
  22479. if (!ptr)
  22480. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22481. auto saved_ctx = ctx();
  22482. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22483. auto res = isl_union_map_factor_domain(copy());
  22484. if (!res)
  22485. exception::throw_last_error(saved_ctx);
  22486. return manage(res);
  22487. }
  22488. isl::union_map union_map::factor_range() const
  22489. {
  22490. if (!ptr)
  22491. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22492. auto saved_ctx = ctx();
  22493. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22494. auto res = isl_union_map_factor_range(copy());
  22495. if (!res)
  22496. exception::throw_last_error(saved_ctx);
  22497. return manage(res);
  22498. }
  22499. isl::union_map union_map::fixed_power(isl::val exp) const
  22500. {
  22501. if (!ptr || exp.is_null())
  22502. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22503. auto saved_ctx = ctx();
  22504. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22505. auto res = isl_union_map_fixed_power_val(copy(), exp.release());
  22506. if (!res)
  22507. exception::throw_last_error(saved_ctx);
  22508. return manage(res);
  22509. }
  22510. isl::union_map union_map::fixed_power(long exp) const
  22511. {
  22512. if (!ptr)
  22513. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22514. return this->fixed_power(isl::val(ctx(), exp));
  22515. }
  22516. void union_map::foreach_map(const std::function<void(isl::map)> &fn) const
  22517. {
  22518. if (!ptr)
  22519. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22520. auto saved_ctx = ctx();
  22521. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22522. struct fn_data {
  22523. std::function<void(isl::map)> func;
  22524. std::exception_ptr eptr;
  22525. } fn_data = { fn };
  22526. auto fn_lambda = [](isl_map *arg_0, void *arg_1) -> isl_stat {
  22527. auto *data = static_cast<struct fn_data *>(arg_1);
  22528. ISL_CPP_TRY {
  22529. (data->func)(manage(arg_0));
  22530. return isl_stat_ok;
  22531. } ISL_CPP_CATCH_ALL {
  22532. data->eptr = std::current_exception();
  22533. return isl_stat_error;
  22534. }
  22535. };
  22536. auto res = isl_union_map_foreach_map(get(), fn_lambda, &fn_data);
  22537. if (fn_data.eptr)
  22538. std::rethrow_exception(fn_data.eptr);
  22539. if (res < 0)
  22540. exception::throw_last_error(saved_ctx);
  22541. return;
  22542. }
  22543. isl::union_map union_map::from(isl::multi_union_pw_aff mupa)
  22544. {
  22545. if (mupa.is_null())
  22546. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22547. auto saved_ctx = mupa.ctx();
  22548. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22549. auto res = isl_union_map_from_multi_union_pw_aff(mupa.release());
  22550. if (!res)
  22551. exception::throw_last_error(saved_ctx);
  22552. return manage(res);
  22553. }
  22554. isl::union_map union_map::from(isl::union_pw_multi_aff upma)
  22555. {
  22556. if (upma.is_null())
  22557. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22558. auto saved_ctx = upma.ctx();
  22559. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22560. auto res = isl_union_map_from_union_pw_multi_aff(upma.release());
  22561. if (!res)
  22562. exception::throw_last_error(saved_ctx);
  22563. return manage(res);
  22564. }
  22565. isl::union_map union_map::from_domain(isl::union_set uset)
  22566. {
  22567. if (uset.is_null())
  22568. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22569. auto saved_ctx = uset.ctx();
  22570. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22571. auto res = isl_union_map_from_domain(uset.release());
  22572. if (!res)
  22573. exception::throw_last_error(saved_ctx);
  22574. return manage(res);
  22575. }
  22576. isl::union_map union_map::from_domain_and_range(isl::union_set domain, isl::union_set range)
  22577. {
  22578. if (domain.is_null() || range.is_null())
  22579. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22580. auto saved_ctx = domain.ctx();
  22581. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22582. auto res = isl_union_map_from_domain_and_range(domain.release(), range.release());
  22583. if (!res)
  22584. exception::throw_last_error(saved_ctx);
  22585. return manage(res);
  22586. }
  22587. isl::union_map union_map::from_range(isl::union_set uset)
  22588. {
  22589. if (uset.is_null())
  22590. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22591. auto saved_ctx = uset.ctx();
  22592. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22593. auto res = isl_union_map_from_range(uset.release());
  22594. if (!res)
  22595. exception::throw_last_error(saved_ctx);
  22596. return manage(res);
  22597. }
  22598. isl::union_map union_map::gist(isl::union_map context) const
  22599. {
  22600. if (!ptr || context.is_null())
  22601. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22602. auto saved_ctx = ctx();
  22603. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22604. auto res = isl_union_map_gist(copy(), context.release());
  22605. if (!res)
  22606. exception::throw_last_error(saved_ctx);
  22607. return manage(res);
  22608. }
  22609. isl::union_map union_map::gist_domain(isl::union_set uset) const
  22610. {
  22611. if (!ptr || uset.is_null())
  22612. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22613. auto saved_ctx = ctx();
  22614. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22615. auto res = isl_union_map_gist_domain(copy(), uset.release());
  22616. if (!res)
  22617. exception::throw_last_error(saved_ctx);
  22618. return manage(res);
  22619. }
  22620. isl::union_map union_map::gist_params(isl::set set) const
  22621. {
  22622. if (!ptr || set.is_null())
  22623. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22624. auto saved_ctx = ctx();
  22625. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22626. auto res = isl_union_map_gist_params(copy(), set.release());
  22627. if (!res)
  22628. exception::throw_last_error(saved_ctx);
  22629. return manage(res);
  22630. }
  22631. isl::union_map union_map::gist_range(isl::union_set uset) const
  22632. {
  22633. if (!ptr || uset.is_null())
  22634. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22635. auto saved_ctx = ctx();
  22636. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22637. auto res = isl_union_map_gist_range(copy(), uset.release());
  22638. if (!res)
  22639. exception::throw_last_error(saved_ctx);
  22640. return manage(res);
  22641. }
  22642. isl::union_map union_map::intersect(isl::union_map umap2) const
  22643. {
  22644. if (!ptr || umap2.is_null())
  22645. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22646. auto saved_ctx = ctx();
  22647. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22648. auto res = isl_union_map_intersect(copy(), umap2.release());
  22649. if (!res)
  22650. exception::throw_last_error(saved_ctx);
  22651. return manage(res);
  22652. }
  22653. isl::union_map union_map::intersect_domain(isl::space space) const
  22654. {
  22655. if (!ptr || space.is_null())
  22656. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22657. auto saved_ctx = ctx();
  22658. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22659. auto res = isl_union_map_intersect_domain_space(copy(), space.release());
  22660. if (!res)
  22661. exception::throw_last_error(saved_ctx);
  22662. return manage(res);
  22663. }
  22664. isl::union_map union_map::intersect_domain(isl::union_set uset) const
  22665. {
  22666. if (!ptr || uset.is_null())
  22667. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22668. auto saved_ctx = ctx();
  22669. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22670. auto res = isl_union_map_intersect_domain_union_set(copy(), uset.release());
  22671. if (!res)
  22672. exception::throw_last_error(saved_ctx);
  22673. return manage(res);
  22674. }
  22675. isl::union_map union_map::intersect_domain_factor_domain(isl::union_map factor) const
  22676. {
  22677. if (!ptr || factor.is_null())
  22678. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22679. auto saved_ctx = ctx();
  22680. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22681. auto res = isl_union_map_intersect_domain_factor_domain(copy(), factor.release());
  22682. if (!res)
  22683. exception::throw_last_error(saved_ctx);
  22684. return manage(res);
  22685. }
  22686. isl::union_map union_map::intersect_domain_factor_range(isl::union_map factor) const
  22687. {
  22688. if (!ptr || factor.is_null())
  22689. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22690. auto saved_ctx = ctx();
  22691. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22692. auto res = isl_union_map_intersect_domain_factor_range(copy(), factor.release());
  22693. if (!res)
  22694. exception::throw_last_error(saved_ctx);
  22695. return manage(res);
  22696. }
  22697. isl::union_map union_map::intersect_domain_wrapped_domain(isl::union_set domain) const
  22698. {
  22699. if (!ptr || domain.is_null())
  22700. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22701. auto saved_ctx = ctx();
  22702. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22703. auto res = isl_union_map_intersect_domain_wrapped_domain_union_set(copy(), domain.release());
  22704. if (!res)
  22705. exception::throw_last_error(saved_ctx);
  22706. return manage(res);
  22707. }
  22708. isl::union_map union_map::intersect_params(isl::set set) const
  22709. {
  22710. if (!ptr || set.is_null())
  22711. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22712. auto saved_ctx = ctx();
  22713. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22714. auto res = isl_union_map_intersect_params(copy(), set.release());
  22715. if (!res)
  22716. exception::throw_last_error(saved_ctx);
  22717. return manage(res);
  22718. }
  22719. isl::union_map union_map::intersect_range(isl::space space) const
  22720. {
  22721. if (!ptr || space.is_null())
  22722. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22723. auto saved_ctx = ctx();
  22724. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22725. auto res = isl_union_map_intersect_range_space(copy(), space.release());
  22726. if (!res)
  22727. exception::throw_last_error(saved_ctx);
  22728. return manage(res);
  22729. }
  22730. isl::union_map union_map::intersect_range(isl::union_set uset) const
  22731. {
  22732. if (!ptr || uset.is_null())
  22733. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22734. auto saved_ctx = ctx();
  22735. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22736. auto res = isl_union_map_intersect_range_union_set(copy(), uset.release());
  22737. if (!res)
  22738. exception::throw_last_error(saved_ctx);
  22739. return manage(res);
  22740. }
  22741. isl::union_map union_map::intersect_range_factor_domain(isl::union_map factor) const
  22742. {
  22743. if (!ptr || factor.is_null())
  22744. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22745. auto saved_ctx = ctx();
  22746. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22747. auto res = isl_union_map_intersect_range_factor_domain(copy(), factor.release());
  22748. if (!res)
  22749. exception::throw_last_error(saved_ctx);
  22750. return manage(res);
  22751. }
  22752. isl::union_map union_map::intersect_range_factor_range(isl::union_map factor) const
  22753. {
  22754. if (!ptr || factor.is_null())
  22755. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22756. auto saved_ctx = ctx();
  22757. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22758. auto res = isl_union_map_intersect_range_factor_range(copy(), factor.release());
  22759. if (!res)
  22760. exception::throw_last_error(saved_ctx);
  22761. return manage(res);
  22762. }
  22763. isl::union_map union_map::intersect_range_wrapped_domain(isl::union_set domain) const
  22764. {
  22765. if (!ptr || domain.is_null())
  22766. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22767. auto saved_ctx = ctx();
  22768. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22769. auto res = isl_union_map_intersect_range_wrapped_domain_union_set(copy(), domain.release());
  22770. if (!res)
  22771. exception::throw_last_error(saved_ctx);
  22772. return manage(res);
  22773. }
  22774. bool union_map::is_bijective() const
  22775. {
  22776. if (!ptr)
  22777. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22778. auto saved_ctx = ctx();
  22779. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22780. auto res = isl_union_map_is_bijective(get());
  22781. if (res < 0)
  22782. exception::throw_last_error(saved_ctx);
  22783. return res;
  22784. }
  22785. bool union_map::is_disjoint(const isl::union_map &umap2) const
  22786. {
  22787. if (!ptr || umap2.is_null())
  22788. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22789. auto saved_ctx = ctx();
  22790. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22791. auto res = isl_union_map_is_disjoint(get(), umap2.get());
  22792. if (res < 0)
  22793. exception::throw_last_error(saved_ctx);
  22794. return res;
  22795. }
  22796. bool union_map::is_empty() const
  22797. {
  22798. if (!ptr)
  22799. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22800. auto saved_ctx = ctx();
  22801. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22802. auto res = isl_union_map_is_empty(get());
  22803. if (res < 0)
  22804. exception::throw_last_error(saved_ctx);
  22805. return res;
  22806. }
  22807. bool union_map::is_equal(const isl::union_map &umap2) const
  22808. {
  22809. if (!ptr || umap2.is_null())
  22810. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22811. auto saved_ctx = ctx();
  22812. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22813. auto res = isl_union_map_is_equal(get(), umap2.get());
  22814. if (res < 0)
  22815. exception::throw_last_error(saved_ctx);
  22816. return res;
  22817. }
  22818. bool union_map::is_injective() const
  22819. {
  22820. if (!ptr)
  22821. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22822. auto saved_ctx = ctx();
  22823. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22824. auto res = isl_union_map_is_injective(get());
  22825. if (res < 0)
  22826. exception::throw_last_error(saved_ctx);
  22827. return res;
  22828. }
  22829. bool union_map::is_single_valued() const
  22830. {
  22831. if (!ptr)
  22832. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22833. auto saved_ctx = ctx();
  22834. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22835. auto res = isl_union_map_is_single_valued(get());
  22836. if (res < 0)
  22837. exception::throw_last_error(saved_ctx);
  22838. return res;
  22839. }
  22840. bool union_map::is_strict_subset(const isl::union_map &umap2) const
  22841. {
  22842. if (!ptr || umap2.is_null())
  22843. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22844. auto saved_ctx = ctx();
  22845. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22846. auto res = isl_union_map_is_strict_subset(get(), umap2.get());
  22847. if (res < 0)
  22848. exception::throw_last_error(saved_ctx);
  22849. return res;
  22850. }
  22851. bool union_map::is_subset(const isl::union_map &umap2) const
  22852. {
  22853. if (!ptr || umap2.is_null())
  22854. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22855. auto saved_ctx = ctx();
  22856. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22857. auto res = isl_union_map_is_subset(get(), umap2.get());
  22858. if (res < 0)
  22859. exception::throw_last_error(saved_ctx);
  22860. return res;
  22861. }
  22862. bool union_map::isa_map() const
  22863. {
  22864. if (!ptr)
  22865. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22866. auto saved_ctx = ctx();
  22867. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22868. auto res = isl_union_map_isa_map(get());
  22869. if (res < 0)
  22870. exception::throw_last_error(saved_ctx);
  22871. return res;
  22872. }
  22873. isl::union_map union_map::lexmax() const
  22874. {
  22875. if (!ptr)
  22876. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22877. auto saved_ctx = ctx();
  22878. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22879. auto res = isl_union_map_lexmax(copy());
  22880. if (!res)
  22881. exception::throw_last_error(saved_ctx);
  22882. return manage(res);
  22883. }
  22884. isl::union_map union_map::lexmin() const
  22885. {
  22886. if (!ptr)
  22887. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22888. auto saved_ctx = ctx();
  22889. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22890. auto res = isl_union_map_lexmin(copy());
  22891. if (!res)
  22892. exception::throw_last_error(saved_ctx);
  22893. return manage(res);
  22894. }
  22895. isl::map_list union_map::map_list() const
  22896. {
  22897. if (!ptr)
  22898. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22899. auto saved_ctx = ctx();
  22900. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22901. auto res = isl_union_map_get_map_list(get());
  22902. if (!res)
  22903. exception::throw_last_error(saved_ctx);
  22904. return manage(res);
  22905. }
  22906. isl::map_list union_map::get_map_list() const
  22907. {
  22908. return map_list();
  22909. }
  22910. isl::union_map union_map::polyhedral_hull() const
  22911. {
  22912. if (!ptr)
  22913. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22914. auto saved_ctx = ctx();
  22915. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22916. auto res = isl_union_map_polyhedral_hull(copy());
  22917. if (!res)
  22918. exception::throw_last_error(saved_ctx);
  22919. return manage(res);
  22920. }
  22921. isl::union_map union_map::preimage_domain(isl::multi_aff ma) const
  22922. {
  22923. if (!ptr || ma.is_null())
  22924. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22925. auto saved_ctx = ctx();
  22926. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22927. auto res = isl_union_map_preimage_domain_multi_aff(copy(), ma.release());
  22928. if (!res)
  22929. exception::throw_last_error(saved_ctx);
  22930. return manage(res);
  22931. }
  22932. isl::union_map union_map::preimage_domain(isl::multi_pw_aff mpa) const
  22933. {
  22934. if (!ptr || mpa.is_null())
  22935. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22936. auto saved_ctx = ctx();
  22937. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22938. auto res = isl_union_map_preimage_domain_multi_pw_aff(copy(), mpa.release());
  22939. if (!res)
  22940. exception::throw_last_error(saved_ctx);
  22941. return manage(res);
  22942. }
  22943. isl::union_map union_map::preimage_domain(isl::pw_multi_aff pma) const
  22944. {
  22945. if (!ptr || pma.is_null())
  22946. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22947. auto saved_ctx = ctx();
  22948. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22949. auto res = isl_union_map_preimage_domain_pw_multi_aff(copy(), pma.release());
  22950. if (!res)
  22951. exception::throw_last_error(saved_ctx);
  22952. return manage(res);
  22953. }
  22954. isl::union_map union_map::preimage_domain(isl::union_pw_multi_aff upma) const
  22955. {
  22956. if (!ptr || upma.is_null())
  22957. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22958. auto saved_ctx = ctx();
  22959. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22960. auto res = isl_union_map_preimage_domain_union_pw_multi_aff(copy(), upma.release());
  22961. if (!res)
  22962. exception::throw_last_error(saved_ctx);
  22963. return manage(res);
  22964. }
  22965. isl::union_map union_map::preimage_range(isl::multi_aff ma) const
  22966. {
  22967. if (!ptr || ma.is_null())
  22968. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22969. auto saved_ctx = ctx();
  22970. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22971. auto res = isl_union_map_preimage_range_multi_aff(copy(), ma.release());
  22972. if (!res)
  22973. exception::throw_last_error(saved_ctx);
  22974. return manage(res);
  22975. }
  22976. isl::union_map union_map::preimage_range(isl::pw_multi_aff pma) const
  22977. {
  22978. if (!ptr || pma.is_null())
  22979. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22980. auto saved_ctx = ctx();
  22981. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22982. auto res = isl_union_map_preimage_range_pw_multi_aff(copy(), pma.release());
  22983. if (!res)
  22984. exception::throw_last_error(saved_ctx);
  22985. return manage(res);
  22986. }
  22987. isl::union_map union_map::preimage_range(isl::union_pw_multi_aff upma) const
  22988. {
  22989. if (!ptr || upma.is_null())
  22990. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  22991. auto saved_ctx = ctx();
  22992. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  22993. auto res = isl_union_map_preimage_range_union_pw_multi_aff(copy(), upma.release());
  22994. if (!res)
  22995. exception::throw_last_error(saved_ctx);
  22996. return manage(res);
  22997. }
  22998. isl::union_map union_map::product(isl::union_map umap2) const
  22999. {
  23000. if (!ptr || umap2.is_null())
  23001. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23002. auto saved_ctx = ctx();
  23003. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23004. auto res = isl_union_map_product(copy(), umap2.release());
  23005. if (!res)
  23006. exception::throw_last_error(saved_ctx);
  23007. return manage(res);
  23008. }
  23009. isl::union_map union_map::project_out_all_params() const
  23010. {
  23011. if (!ptr)
  23012. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23013. auto saved_ctx = ctx();
  23014. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23015. auto res = isl_union_map_project_out_all_params(copy());
  23016. if (!res)
  23017. exception::throw_last_error(saved_ctx);
  23018. return manage(res);
  23019. }
  23020. isl::union_set union_map::range() const
  23021. {
  23022. if (!ptr)
  23023. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23024. auto saved_ctx = ctx();
  23025. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23026. auto res = isl_union_map_range(copy());
  23027. if (!res)
  23028. exception::throw_last_error(saved_ctx);
  23029. return manage(res);
  23030. }
  23031. isl::union_map union_map::range_factor_domain() const
  23032. {
  23033. if (!ptr)
  23034. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23035. auto saved_ctx = ctx();
  23036. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23037. auto res = isl_union_map_range_factor_domain(copy());
  23038. if (!res)
  23039. exception::throw_last_error(saved_ctx);
  23040. return manage(res);
  23041. }
  23042. isl::union_map union_map::range_factor_range() const
  23043. {
  23044. if (!ptr)
  23045. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23046. auto saved_ctx = ctx();
  23047. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23048. auto res = isl_union_map_range_factor_range(copy());
  23049. if (!res)
  23050. exception::throw_last_error(saved_ctx);
  23051. return manage(res);
  23052. }
  23053. isl::union_map union_map::range_map() const
  23054. {
  23055. if (!ptr)
  23056. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23057. auto saved_ctx = ctx();
  23058. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23059. auto res = isl_union_map_range_map(copy());
  23060. if (!res)
  23061. exception::throw_last_error(saved_ctx);
  23062. return manage(res);
  23063. }
  23064. isl::union_map union_map::range_product(isl::union_map umap2) const
  23065. {
  23066. if (!ptr || umap2.is_null())
  23067. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23068. auto saved_ctx = ctx();
  23069. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23070. auto res = isl_union_map_range_product(copy(), umap2.release());
  23071. if (!res)
  23072. exception::throw_last_error(saved_ctx);
  23073. return manage(res);
  23074. }
  23075. isl::union_map union_map::range_reverse() const
  23076. {
  23077. if (!ptr)
  23078. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23079. auto saved_ctx = ctx();
  23080. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23081. auto res = isl_union_map_range_reverse(copy());
  23082. if (!res)
  23083. exception::throw_last_error(saved_ctx);
  23084. return manage(res);
  23085. }
  23086. isl::union_map union_map::reverse() const
  23087. {
  23088. if (!ptr)
  23089. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23090. auto saved_ctx = ctx();
  23091. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23092. auto res = isl_union_map_reverse(copy());
  23093. if (!res)
  23094. exception::throw_last_error(saved_ctx);
  23095. return manage(res);
  23096. }
  23097. isl::space union_map::space() const
  23098. {
  23099. if (!ptr)
  23100. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23101. auto saved_ctx = ctx();
  23102. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23103. auto res = isl_union_map_get_space(get());
  23104. if (!res)
  23105. exception::throw_last_error(saved_ctx);
  23106. return manage(res);
  23107. }
  23108. isl::space union_map::get_space() const
  23109. {
  23110. return space();
  23111. }
  23112. isl::union_map union_map::subtract(isl::union_map umap2) const
  23113. {
  23114. if (!ptr || umap2.is_null())
  23115. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23116. auto saved_ctx = ctx();
  23117. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23118. auto res = isl_union_map_subtract(copy(), umap2.release());
  23119. if (!res)
  23120. exception::throw_last_error(saved_ctx);
  23121. return manage(res);
  23122. }
  23123. isl::union_map union_map::subtract_domain(isl::union_set dom) const
  23124. {
  23125. if (!ptr || dom.is_null())
  23126. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23127. auto saved_ctx = ctx();
  23128. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23129. auto res = isl_union_map_subtract_domain(copy(), dom.release());
  23130. if (!res)
  23131. exception::throw_last_error(saved_ctx);
  23132. return manage(res);
  23133. }
  23134. isl::union_map union_map::subtract_range(isl::union_set dom) const
  23135. {
  23136. if (!ptr || dom.is_null())
  23137. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23138. auto saved_ctx = ctx();
  23139. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23140. auto res = isl_union_map_subtract_range(copy(), dom.release());
  23141. if (!res)
  23142. exception::throw_last_error(saved_ctx);
  23143. return manage(res);
  23144. }
  23145. isl::union_map union_map::uncurry() const
  23146. {
  23147. if (!ptr)
  23148. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23149. auto saved_ctx = ctx();
  23150. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23151. auto res = isl_union_map_uncurry(copy());
  23152. if (!res)
  23153. exception::throw_last_error(saved_ctx);
  23154. return manage(res);
  23155. }
  23156. isl::union_map union_map::unite(isl::union_map umap2) const
  23157. {
  23158. if (!ptr || umap2.is_null())
  23159. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23160. auto saved_ctx = ctx();
  23161. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23162. auto res = isl_union_map_union(copy(), umap2.release());
  23163. if (!res)
  23164. exception::throw_last_error(saved_ctx);
  23165. return manage(res);
  23166. }
  23167. isl::union_map union_map::universe() const
  23168. {
  23169. if (!ptr)
  23170. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23171. auto saved_ctx = ctx();
  23172. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23173. auto res = isl_union_map_universe(copy());
  23174. if (!res)
  23175. exception::throw_last_error(saved_ctx);
  23176. return manage(res);
  23177. }
  23178. isl::union_set union_map::wrap() const
  23179. {
  23180. if (!ptr)
  23181. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23182. auto saved_ctx = ctx();
  23183. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23184. auto res = isl_union_map_wrap(copy());
  23185. if (!res)
  23186. exception::throw_last_error(saved_ctx);
  23187. return manage(res);
  23188. }
  23189. isl::union_map union_map::zip() const
  23190. {
  23191. if (!ptr)
  23192. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23193. auto saved_ctx = ctx();
  23194. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23195. auto res = isl_union_map_zip(copy());
  23196. if (!res)
  23197. exception::throw_last_error(saved_ctx);
  23198. return manage(res);
  23199. }
  23200. inline std::ostream &operator<<(std::ostream &os, const union_map &obj)
  23201. {
  23202. if (!obj.get())
  23203. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23204. auto saved_ctx = isl_union_map_get_ctx(obj.get());
  23205. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23206. char *str = isl_union_map_to_str(obj.get());
  23207. if (!str)
  23208. exception::throw_last_error(saved_ctx);
  23209. os << str;
  23210. free(str);
  23211. return os;
  23212. }
  23213. // implementations for isl::union_pw_aff
  23214. union_pw_aff manage(__isl_take isl_union_pw_aff *ptr) {
  23215. if (!ptr)
  23216. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23217. return union_pw_aff(ptr);
  23218. }
  23219. union_pw_aff manage_copy(__isl_keep isl_union_pw_aff *ptr) {
  23220. if (!ptr)
  23221. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23222. auto saved_ctx = isl_union_pw_aff_get_ctx(ptr);
  23223. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23224. ptr = isl_union_pw_aff_copy(ptr);
  23225. if (!ptr)
  23226. exception::throw_last_error(saved_ctx);
  23227. return union_pw_aff(ptr);
  23228. }
  23229. union_pw_aff::union_pw_aff(__isl_take isl_union_pw_aff *ptr)
  23230. : ptr(ptr) {}
  23231. union_pw_aff::union_pw_aff()
  23232. : ptr(nullptr) {}
  23233. union_pw_aff::union_pw_aff(const union_pw_aff &obj)
  23234. : ptr(nullptr)
  23235. {
  23236. if (!obj.ptr)
  23237. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23238. auto saved_ctx = isl_union_pw_aff_get_ctx(obj.ptr);
  23239. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23240. ptr = obj.copy();
  23241. if (!ptr)
  23242. exception::throw_last_error(saved_ctx);
  23243. }
  23244. union_pw_aff::union_pw_aff(isl::aff aff)
  23245. {
  23246. if (aff.is_null())
  23247. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23248. auto saved_ctx = aff.ctx();
  23249. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23250. auto res = isl_union_pw_aff_from_aff(aff.release());
  23251. if (!res)
  23252. exception::throw_last_error(saved_ctx);
  23253. ptr = res;
  23254. }
  23255. union_pw_aff::union_pw_aff(isl::pw_aff pa)
  23256. {
  23257. if (pa.is_null())
  23258. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23259. auto saved_ctx = pa.ctx();
  23260. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23261. auto res = isl_union_pw_aff_from_pw_aff(pa.release());
  23262. if (!res)
  23263. exception::throw_last_error(saved_ctx);
  23264. ptr = res;
  23265. }
  23266. union_pw_aff::union_pw_aff(isl::ctx ctx, const std::string &str)
  23267. {
  23268. auto saved_ctx = ctx;
  23269. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23270. auto res = isl_union_pw_aff_read_from_str(ctx.release(), str.c_str());
  23271. if (!res)
  23272. exception::throw_last_error(saved_ctx);
  23273. ptr = res;
  23274. }
  23275. union_pw_aff &union_pw_aff::operator=(union_pw_aff obj) {
  23276. std::swap(this->ptr, obj.ptr);
  23277. return *this;
  23278. }
  23279. union_pw_aff::~union_pw_aff() {
  23280. if (ptr)
  23281. isl_union_pw_aff_free(ptr);
  23282. }
  23283. __isl_give isl_union_pw_aff *union_pw_aff::copy() const & {
  23284. return isl_union_pw_aff_copy(ptr);
  23285. }
  23286. __isl_keep isl_union_pw_aff *union_pw_aff::get() const {
  23287. return ptr;
  23288. }
  23289. __isl_give isl_union_pw_aff *union_pw_aff::release() {
  23290. isl_union_pw_aff *tmp = ptr;
  23291. ptr = nullptr;
  23292. return tmp;
  23293. }
  23294. bool union_pw_aff::is_null() const {
  23295. return ptr == nullptr;
  23296. }
  23297. isl::ctx union_pw_aff::ctx() const {
  23298. return isl::ctx(isl_union_pw_aff_get_ctx(ptr));
  23299. }
  23300. isl::multi_union_pw_aff union_pw_aff::add(const isl::multi_union_pw_aff &multi2) const
  23301. {
  23302. if (!ptr)
  23303. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23304. return isl::multi_union_pw_aff(*this).add(multi2);
  23305. }
  23306. isl::union_pw_aff union_pw_aff::add(isl::union_pw_aff upa2) const
  23307. {
  23308. if (!ptr || upa2.is_null())
  23309. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23310. auto saved_ctx = ctx();
  23311. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23312. auto res = isl_union_pw_aff_add(copy(), upa2.release());
  23313. if (!res)
  23314. exception::throw_last_error(saved_ctx);
  23315. return manage(res);
  23316. }
  23317. isl::union_pw_multi_aff union_pw_aff::add(const isl::union_pw_multi_aff &upma2) const
  23318. {
  23319. if (!ptr)
  23320. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23321. return isl::union_pw_multi_aff(*this).add(upma2);
  23322. }
  23323. isl::union_pw_aff union_pw_aff::add(const isl::aff &upa2) const
  23324. {
  23325. if (!ptr)
  23326. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23327. return this->add(isl::union_pw_aff(upa2));
  23328. }
  23329. isl::union_pw_aff union_pw_aff::add(const isl::pw_aff &upa2) const
  23330. {
  23331. if (!ptr)
  23332. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23333. return this->add(isl::union_pw_aff(upa2));
  23334. }
  23335. isl::union_pw_multi_aff union_pw_aff::apply(const isl::union_pw_multi_aff &upma2) const
  23336. {
  23337. if (!ptr)
  23338. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23339. return isl::union_pw_multi_aff(*this).apply(upma2);
  23340. }
  23341. isl::multi_union_pw_aff union_pw_aff::as_multi_union_pw_aff() const
  23342. {
  23343. if (!ptr)
  23344. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23345. return isl::union_pw_multi_aff(*this).as_multi_union_pw_aff();
  23346. }
  23347. isl::pw_multi_aff union_pw_aff::as_pw_multi_aff() const
  23348. {
  23349. if (!ptr)
  23350. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23351. return isl::union_pw_multi_aff(*this).as_pw_multi_aff();
  23352. }
  23353. isl::union_map union_pw_aff::as_union_map() const
  23354. {
  23355. if (!ptr)
  23356. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23357. return isl::union_pw_multi_aff(*this).as_union_map();
  23358. }
  23359. isl::union_pw_aff union_pw_aff::at(int pos) const
  23360. {
  23361. if (!ptr)
  23362. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23363. return isl::multi_union_pw_aff(*this).at(pos);
  23364. }
  23365. isl::union_set union_pw_aff::bind(const isl::multi_id &tuple) const
  23366. {
  23367. if (!ptr)
  23368. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23369. return isl::multi_union_pw_aff(*this).bind(tuple);
  23370. }
  23371. isl::union_set union_pw_aff::bind(isl::id id) const
  23372. {
  23373. if (!ptr || id.is_null())
  23374. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23375. auto saved_ctx = ctx();
  23376. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23377. auto res = isl_union_pw_aff_bind_id(copy(), id.release());
  23378. if (!res)
  23379. exception::throw_last_error(saved_ctx);
  23380. return manage(res);
  23381. }
  23382. isl::union_set union_pw_aff::bind(const std::string &id) const
  23383. {
  23384. if (!ptr)
  23385. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23386. return this->bind(isl::id(ctx(), id));
  23387. }
  23388. isl::union_pw_aff union_pw_aff::coalesce() const
  23389. {
  23390. if (!ptr)
  23391. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23392. auto saved_ctx = ctx();
  23393. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23394. auto res = isl_union_pw_aff_coalesce(copy());
  23395. if (!res)
  23396. exception::throw_last_error(saved_ctx);
  23397. return manage(res);
  23398. }
  23399. isl::union_set union_pw_aff::domain() const
  23400. {
  23401. if (!ptr)
  23402. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23403. auto saved_ctx = ctx();
  23404. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23405. auto res = isl_union_pw_aff_domain(copy());
  23406. if (!res)
  23407. exception::throw_last_error(saved_ctx);
  23408. return manage(res);
  23409. }
  23410. isl::pw_multi_aff union_pw_aff::extract_pw_multi_aff(const isl::space &space) const
  23411. {
  23412. if (!ptr)
  23413. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23414. return isl::union_pw_multi_aff(*this).extract_pw_multi_aff(space);
  23415. }
  23416. isl::multi_union_pw_aff union_pw_aff::flat_range_product(const isl::multi_union_pw_aff &multi2) const
  23417. {
  23418. if (!ptr)
  23419. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23420. return isl::multi_union_pw_aff(*this).flat_range_product(multi2);
  23421. }
  23422. isl::union_pw_multi_aff union_pw_aff::flat_range_product(const isl::union_pw_multi_aff &upma2) const
  23423. {
  23424. if (!ptr)
  23425. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23426. return isl::union_pw_multi_aff(*this).flat_range_product(upma2);
  23427. }
  23428. isl::union_pw_aff union_pw_aff::gist(isl::union_set context) const
  23429. {
  23430. if (!ptr || context.is_null())
  23431. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23432. auto saved_ctx = ctx();
  23433. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23434. auto res = isl_union_pw_aff_gist(copy(), context.release());
  23435. if (!res)
  23436. exception::throw_last_error(saved_ctx);
  23437. return manage(res);
  23438. }
  23439. bool union_pw_aff::has_range_tuple_id() const
  23440. {
  23441. if (!ptr)
  23442. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23443. return isl::multi_union_pw_aff(*this).has_range_tuple_id();
  23444. }
  23445. isl::union_pw_aff union_pw_aff::intersect_domain(isl::space space) const
  23446. {
  23447. if (!ptr || space.is_null())
  23448. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23449. auto saved_ctx = ctx();
  23450. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23451. auto res = isl_union_pw_aff_intersect_domain_space(copy(), space.release());
  23452. if (!res)
  23453. exception::throw_last_error(saved_ctx);
  23454. return manage(res);
  23455. }
  23456. isl::union_pw_aff union_pw_aff::intersect_domain(isl::union_set uset) const
  23457. {
  23458. if (!ptr || uset.is_null())
  23459. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23460. auto saved_ctx = ctx();
  23461. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23462. auto res = isl_union_pw_aff_intersect_domain_union_set(copy(), uset.release());
  23463. if (!res)
  23464. exception::throw_last_error(saved_ctx);
  23465. return manage(res);
  23466. }
  23467. isl::union_pw_aff union_pw_aff::intersect_domain_wrapped_domain(isl::union_set uset) const
  23468. {
  23469. if (!ptr || uset.is_null())
  23470. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23471. auto saved_ctx = ctx();
  23472. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23473. auto res = isl_union_pw_aff_intersect_domain_wrapped_domain(copy(), uset.release());
  23474. if (!res)
  23475. exception::throw_last_error(saved_ctx);
  23476. return manage(res);
  23477. }
  23478. isl::union_pw_aff union_pw_aff::intersect_domain_wrapped_range(isl::union_set uset) const
  23479. {
  23480. if (!ptr || uset.is_null())
  23481. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23482. auto saved_ctx = ctx();
  23483. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23484. auto res = isl_union_pw_aff_intersect_domain_wrapped_range(copy(), uset.release());
  23485. if (!res)
  23486. exception::throw_last_error(saved_ctx);
  23487. return manage(res);
  23488. }
  23489. isl::union_pw_aff union_pw_aff::intersect_params(isl::set set) const
  23490. {
  23491. if (!ptr || set.is_null())
  23492. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23493. auto saved_ctx = ctx();
  23494. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23495. auto res = isl_union_pw_aff_intersect_params(copy(), set.release());
  23496. if (!res)
  23497. exception::throw_last_error(saved_ctx);
  23498. return manage(res);
  23499. }
  23500. bool union_pw_aff::involves_locals() const
  23501. {
  23502. if (!ptr)
  23503. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23504. return isl::union_pw_multi_aff(*this).involves_locals();
  23505. }
  23506. bool union_pw_aff::involves_nan() const
  23507. {
  23508. if (!ptr)
  23509. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23510. return isl::multi_union_pw_aff(*this).involves_nan();
  23511. }
  23512. bool union_pw_aff::isa_pw_multi_aff() const
  23513. {
  23514. if (!ptr)
  23515. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23516. return isl::union_pw_multi_aff(*this).isa_pw_multi_aff();
  23517. }
  23518. isl::union_pw_aff_list union_pw_aff::list() const
  23519. {
  23520. if (!ptr)
  23521. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23522. return isl::multi_union_pw_aff(*this).list();
  23523. }
  23524. isl::multi_union_pw_aff union_pw_aff::neg() const
  23525. {
  23526. if (!ptr)
  23527. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23528. return isl::multi_union_pw_aff(*this).neg();
  23529. }
  23530. bool union_pw_aff::plain_is_empty() const
  23531. {
  23532. if (!ptr)
  23533. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23534. return isl::union_pw_multi_aff(*this).plain_is_empty();
  23535. }
  23536. bool union_pw_aff::plain_is_equal(const isl::multi_union_pw_aff &multi2) const
  23537. {
  23538. if (!ptr)
  23539. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23540. return isl::multi_union_pw_aff(*this).plain_is_equal(multi2);
  23541. }
  23542. isl::union_pw_multi_aff union_pw_aff::preimage_domain_wrapped_domain(const isl::union_pw_multi_aff &upma2) const
  23543. {
  23544. if (!ptr)
  23545. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23546. return isl::union_pw_multi_aff(*this).preimage_domain_wrapped_domain(upma2);
  23547. }
  23548. isl::union_pw_aff union_pw_aff::pullback(isl::union_pw_multi_aff upma) const
  23549. {
  23550. if (!ptr || upma.is_null())
  23551. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23552. auto saved_ctx = ctx();
  23553. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23554. auto res = isl_union_pw_aff_pullback_union_pw_multi_aff(copy(), upma.release());
  23555. if (!res)
  23556. exception::throw_last_error(saved_ctx);
  23557. return manage(res);
  23558. }
  23559. isl::pw_multi_aff_list union_pw_aff::pw_multi_aff_list() const
  23560. {
  23561. if (!ptr)
  23562. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23563. return isl::union_pw_multi_aff(*this).pw_multi_aff_list();
  23564. }
  23565. isl::union_pw_multi_aff union_pw_aff::range_factor_domain() const
  23566. {
  23567. if (!ptr)
  23568. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23569. return isl::union_pw_multi_aff(*this).range_factor_domain();
  23570. }
  23571. isl::union_pw_multi_aff union_pw_aff::range_factor_range() const
  23572. {
  23573. if (!ptr)
  23574. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23575. return isl::union_pw_multi_aff(*this).range_factor_range();
  23576. }
  23577. isl::multi_union_pw_aff union_pw_aff::range_product(const isl::multi_union_pw_aff &multi2) const
  23578. {
  23579. if (!ptr)
  23580. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23581. return isl::multi_union_pw_aff(*this).range_product(multi2);
  23582. }
  23583. isl::union_pw_multi_aff union_pw_aff::range_product(const isl::union_pw_multi_aff &upma2) const
  23584. {
  23585. if (!ptr)
  23586. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23587. return isl::union_pw_multi_aff(*this).range_product(upma2);
  23588. }
  23589. isl::id union_pw_aff::range_tuple_id() const
  23590. {
  23591. if (!ptr)
  23592. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23593. return isl::multi_union_pw_aff(*this).range_tuple_id();
  23594. }
  23595. isl::multi_union_pw_aff union_pw_aff::reset_range_tuple_id() const
  23596. {
  23597. if (!ptr)
  23598. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23599. return isl::multi_union_pw_aff(*this).reset_range_tuple_id();
  23600. }
  23601. isl::multi_union_pw_aff union_pw_aff::scale(const isl::multi_val &mv) const
  23602. {
  23603. if (!ptr)
  23604. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23605. return isl::multi_union_pw_aff(*this).scale(mv);
  23606. }
  23607. isl::multi_union_pw_aff union_pw_aff::scale(const isl::val &v) const
  23608. {
  23609. if (!ptr)
  23610. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23611. return isl::multi_union_pw_aff(*this).scale(v);
  23612. }
  23613. isl::multi_union_pw_aff union_pw_aff::scale(long v) const
  23614. {
  23615. if (!ptr)
  23616. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23617. return this->scale(isl::val(ctx(), v));
  23618. }
  23619. isl::multi_union_pw_aff union_pw_aff::scale_down(const isl::multi_val &mv) const
  23620. {
  23621. if (!ptr)
  23622. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23623. return isl::multi_union_pw_aff(*this).scale_down(mv);
  23624. }
  23625. isl::multi_union_pw_aff union_pw_aff::scale_down(const isl::val &v) const
  23626. {
  23627. if (!ptr)
  23628. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23629. return isl::multi_union_pw_aff(*this).scale_down(v);
  23630. }
  23631. isl::multi_union_pw_aff union_pw_aff::scale_down(long v) const
  23632. {
  23633. if (!ptr)
  23634. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23635. return this->scale_down(isl::val(ctx(), v));
  23636. }
  23637. isl::multi_union_pw_aff union_pw_aff::set_at(int pos, const isl::union_pw_aff &el) const
  23638. {
  23639. if (!ptr)
  23640. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23641. return isl::multi_union_pw_aff(*this).set_at(pos, el);
  23642. }
  23643. isl::multi_union_pw_aff union_pw_aff::set_range_tuple(const isl::id &id) const
  23644. {
  23645. if (!ptr)
  23646. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23647. return isl::multi_union_pw_aff(*this).set_range_tuple(id);
  23648. }
  23649. isl::multi_union_pw_aff union_pw_aff::set_range_tuple(const std::string &id) const
  23650. {
  23651. if (!ptr)
  23652. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23653. return this->set_range_tuple(isl::id(ctx(), id));
  23654. }
  23655. unsigned union_pw_aff::size() const
  23656. {
  23657. if (!ptr)
  23658. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23659. return isl::multi_union_pw_aff(*this).size();
  23660. }
  23661. isl::space union_pw_aff::space() const
  23662. {
  23663. if (!ptr)
  23664. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23665. auto saved_ctx = ctx();
  23666. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23667. auto res = isl_union_pw_aff_get_space(get());
  23668. if (!res)
  23669. exception::throw_last_error(saved_ctx);
  23670. return manage(res);
  23671. }
  23672. isl::space union_pw_aff::get_space() const
  23673. {
  23674. return space();
  23675. }
  23676. isl::multi_union_pw_aff union_pw_aff::sub(const isl::multi_union_pw_aff &multi2) const
  23677. {
  23678. if (!ptr)
  23679. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23680. return isl::multi_union_pw_aff(*this).sub(multi2);
  23681. }
  23682. isl::union_pw_aff union_pw_aff::sub(isl::union_pw_aff upa2) const
  23683. {
  23684. if (!ptr || upa2.is_null())
  23685. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23686. auto saved_ctx = ctx();
  23687. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23688. auto res = isl_union_pw_aff_sub(copy(), upa2.release());
  23689. if (!res)
  23690. exception::throw_last_error(saved_ctx);
  23691. return manage(res);
  23692. }
  23693. isl::union_pw_multi_aff union_pw_aff::sub(const isl::union_pw_multi_aff &upma2) const
  23694. {
  23695. if (!ptr)
  23696. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23697. return isl::union_pw_multi_aff(*this).sub(upma2);
  23698. }
  23699. isl::union_pw_aff union_pw_aff::sub(const isl::aff &upa2) const
  23700. {
  23701. if (!ptr)
  23702. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23703. return this->sub(isl::union_pw_aff(upa2));
  23704. }
  23705. isl::union_pw_aff union_pw_aff::sub(const isl::pw_aff &upa2) const
  23706. {
  23707. if (!ptr)
  23708. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23709. return this->sub(isl::union_pw_aff(upa2));
  23710. }
  23711. isl::union_pw_aff union_pw_aff::subtract_domain(isl::space space) const
  23712. {
  23713. if (!ptr || space.is_null())
  23714. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23715. auto saved_ctx = ctx();
  23716. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23717. auto res = isl_union_pw_aff_subtract_domain_space(copy(), space.release());
  23718. if (!res)
  23719. exception::throw_last_error(saved_ctx);
  23720. return manage(res);
  23721. }
  23722. isl::union_pw_aff union_pw_aff::subtract_domain(isl::union_set uset) const
  23723. {
  23724. if (!ptr || uset.is_null())
  23725. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23726. auto saved_ctx = ctx();
  23727. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23728. auto res = isl_union_pw_aff_subtract_domain_union_set(copy(), uset.release());
  23729. if (!res)
  23730. exception::throw_last_error(saved_ctx);
  23731. return manage(res);
  23732. }
  23733. isl::union_pw_aff_list union_pw_aff::to_list() const
  23734. {
  23735. if (!ptr)
  23736. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23737. auto saved_ctx = ctx();
  23738. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23739. auto res = isl_union_pw_aff_to_list(copy());
  23740. if (!res)
  23741. exception::throw_last_error(saved_ctx);
  23742. return manage(res);
  23743. }
  23744. isl::multi_union_pw_aff union_pw_aff::union_add(const isl::multi_union_pw_aff &mupa2) const
  23745. {
  23746. if (!ptr)
  23747. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23748. return isl::multi_union_pw_aff(*this).union_add(mupa2);
  23749. }
  23750. isl::union_pw_aff union_pw_aff::union_add(isl::union_pw_aff upa2) const
  23751. {
  23752. if (!ptr || upa2.is_null())
  23753. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23754. auto saved_ctx = ctx();
  23755. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23756. auto res = isl_union_pw_aff_union_add(copy(), upa2.release());
  23757. if (!res)
  23758. exception::throw_last_error(saved_ctx);
  23759. return manage(res);
  23760. }
  23761. isl::union_pw_multi_aff union_pw_aff::union_add(const isl::union_pw_multi_aff &upma2) const
  23762. {
  23763. if (!ptr)
  23764. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23765. return isl::union_pw_multi_aff(*this).union_add(upma2);
  23766. }
  23767. isl::union_pw_aff union_pw_aff::union_add(const isl::aff &upa2) const
  23768. {
  23769. if (!ptr)
  23770. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23771. return this->union_add(isl::union_pw_aff(upa2));
  23772. }
  23773. isl::union_pw_aff union_pw_aff::union_add(const isl::pw_aff &upa2) const
  23774. {
  23775. if (!ptr)
  23776. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23777. return this->union_add(isl::union_pw_aff(upa2));
  23778. }
  23779. inline std::ostream &operator<<(std::ostream &os, const union_pw_aff &obj)
  23780. {
  23781. if (!obj.get())
  23782. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23783. auto saved_ctx = isl_union_pw_aff_get_ctx(obj.get());
  23784. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23785. char *str = isl_union_pw_aff_to_str(obj.get());
  23786. if (!str)
  23787. exception::throw_last_error(saved_ctx);
  23788. os << str;
  23789. free(str);
  23790. return os;
  23791. }
  23792. // implementations for isl::union_pw_aff_list
  23793. union_pw_aff_list manage(__isl_take isl_union_pw_aff_list *ptr) {
  23794. if (!ptr)
  23795. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23796. return union_pw_aff_list(ptr);
  23797. }
  23798. union_pw_aff_list manage_copy(__isl_keep isl_union_pw_aff_list *ptr) {
  23799. if (!ptr)
  23800. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23801. auto saved_ctx = isl_union_pw_aff_list_get_ctx(ptr);
  23802. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23803. ptr = isl_union_pw_aff_list_copy(ptr);
  23804. if (!ptr)
  23805. exception::throw_last_error(saved_ctx);
  23806. return union_pw_aff_list(ptr);
  23807. }
  23808. union_pw_aff_list::union_pw_aff_list(__isl_take isl_union_pw_aff_list *ptr)
  23809. : ptr(ptr) {}
  23810. union_pw_aff_list::union_pw_aff_list()
  23811. : ptr(nullptr) {}
  23812. union_pw_aff_list::union_pw_aff_list(const union_pw_aff_list &obj)
  23813. : ptr(nullptr)
  23814. {
  23815. if (!obj.ptr)
  23816. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23817. auto saved_ctx = isl_union_pw_aff_list_get_ctx(obj.ptr);
  23818. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23819. ptr = obj.copy();
  23820. if (!ptr)
  23821. exception::throw_last_error(saved_ctx);
  23822. }
  23823. union_pw_aff_list::union_pw_aff_list(isl::ctx ctx, int n)
  23824. {
  23825. auto saved_ctx = ctx;
  23826. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23827. auto res = isl_union_pw_aff_list_alloc(ctx.release(), n);
  23828. if (!res)
  23829. exception::throw_last_error(saved_ctx);
  23830. ptr = res;
  23831. }
  23832. union_pw_aff_list::union_pw_aff_list(isl::union_pw_aff el)
  23833. {
  23834. if (el.is_null())
  23835. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23836. auto saved_ctx = el.ctx();
  23837. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23838. auto res = isl_union_pw_aff_list_from_union_pw_aff(el.release());
  23839. if (!res)
  23840. exception::throw_last_error(saved_ctx);
  23841. ptr = res;
  23842. }
  23843. union_pw_aff_list::union_pw_aff_list(isl::ctx ctx, const std::string &str)
  23844. {
  23845. auto saved_ctx = ctx;
  23846. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23847. auto res = isl_union_pw_aff_list_read_from_str(ctx.release(), str.c_str());
  23848. if (!res)
  23849. exception::throw_last_error(saved_ctx);
  23850. ptr = res;
  23851. }
  23852. union_pw_aff_list &union_pw_aff_list::operator=(union_pw_aff_list obj) {
  23853. std::swap(this->ptr, obj.ptr);
  23854. return *this;
  23855. }
  23856. union_pw_aff_list::~union_pw_aff_list() {
  23857. if (ptr)
  23858. isl_union_pw_aff_list_free(ptr);
  23859. }
  23860. __isl_give isl_union_pw_aff_list *union_pw_aff_list::copy() const & {
  23861. return isl_union_pw_aff_list_copy(ptr);
  23862. }
  23863. __isl_keep isl_union_pw_aff_list *union_pw_aff_list::get() const {
  23864. return ptr;
  23865. }
  23866. __isl_give isl_union_pw_aff_list *union_pw_aff_list::release() {
  23867. isl_union_pw_aff_list *tmp = ptr;
  23868. ptr = nullptr;
  23869. return tmp;
  23870. }
  23871. bool union_pw_aff_list::is_null() const {
  23872. return ptr == nullptr;
  23873. }
  23874. isl::ctx union_pw_aff_list::ctx() const {
  23875. return isl::ctx(isl_union_pw_aff_list_get_ctx(ptr));
  23876. }
  23877. isl::union_pw_aff_list union_pw_aff_list::add(isl::union_pw_aff el) const
  23878. {
  23879. if (!ptr || el.is_null())
  23880. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23881. auto saved_ctx = ctx();
  23882. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23883. auto res = isl_union_pw_aff_list_add(copy(), el.release());
  23884. if (!res)
  23885. exception::throw_last_error(saved_ctx);
  23886. return manage(res);
  23887. }
  23888. isl::union_pw_aff union_pw_aff_list::at(int index) const
  23889. {
  23890. if (!ptr)
  23891. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23892. auto saved_ctx = ctx();
  23893. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23894. auto res = isl_union_pw_aff_list_get_at(get(), index);
  23895. if (!res)
  23896. exception::throw_last_error(saved_ctx);
  23897. return manage(res);
  23898. }
  23899. isl::union_pw_aff union_pw_aff_list::get_at(int index) const
  23900. {
  23901. return at(index);
  23902. }
  23903. isl::union_pw_aff_list union_pw_aff_list::clear() const
  23904. {
  23905. if (!ptr)
  23906. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23907. auto saved_ctx = ctx();
  23908. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23909. auto res = isl_union_pw_aff_list_clear(copy());
  23910. if (!res)
  23911. exception::throw_last_error(saved_ctx);
  23912. return manage(res);
  23913. }
  23914. isl::union_pw_aff_list union_pw_aff_list::concat(isl::union_pw_aff_list list2) const
  23915. {
  23916. if (!ptr || list2.is_null())
  23917. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23918. auto saved_ctx = ctx();
  23919. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23920. auto res = isl_union_pw_aff_list_concat(copy(), list2.release());
  23921. if (!res)
  23922. exception::throw_last_error(saved_ctx);
  23923. return manage(res);
  23924. }
  23925. isl::union_pw_aff_list union_pw_aff_list::drop(unsigned int first, unsigned int n) const
  23926. {
  23927. if (!ptr)
  23928. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23929. auto saved_ctx = ctx();
  23930. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23931. auto res = isl_union_pw_aff_list_drop(copy(), first, n);
  23932. if (!res)
  23933. exception::throw_last_error(saved_ctx);
  23934. return manage(res);
  23935. }
  23936. void union_pw_aff_list::foreach(const std::function<void(isl::union_pw_aff)> &fn) const
  23937. {
  23938. if (!ptr)
  23939. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23940. auto saved_ctx = ctx();
  23941. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23942. struct fn_data {
  23943. std::function<void(isl::union_pw_aff)> func;
  23944. std::exception_ptr eptr;
  23945. } fn_data = { fn };
  23946. auto fn_lambda = [](isl_union_pw_aff *arg_0, void *arg_1) -> isl_stat {
  23947. auto *data = static_cast<struct fn_data *>(arg_1);
  23948. ISL_CPP_TRY {
  23949. (data->func)(manage(arg_0));
  23950. return isl_stat_ok;
  23951. } ISL_CPP_CATCH_ALL {
  23952. data->eptr = std::current_exception();
  23953. return isl_stat_error;
  23954. }
  23955. };
  23956. auto res = isl_union_pw_aff_list_foreach(get(), fn_lambda, &fn_data);
  23957. if (fn_data.eptr)
  23958. std::rethrow_exception(fn_data.eptr);
  23959. if (res < 0)
  23960. exception::throw_last_error(saved_ctx);
  23961. return;
  23962. }
  23963. void union_pw_aff_list::foreach_scc(const std::function<bool(isl::union_pw_aff, isl::union_pw_aff)> &follows, const std::function<void(isl::union_pw_aff_list)> &fn) const
  23964. {
  23965. if (!ptr)
  23966. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  23967. auto saved_ctx = ctx();
  23968. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  23969. struct follows_data {
  23970. std::function<bool(isl::union_pw_aff, isl::union_pw_aff)> func;
  23971. std::exception_ptr eptr;
  23972. } follows_data = { follows };
  23973. auto follows_lambda = [](isl_union_pw_aff *arg_0, isl_union_pw_aff *arg_1, void *arg_2) -> isl_bool {
  23974. auto *data = static_cast<struct follows_data *>(arg_2);
  23975. ISL_CPP_TRY {
  23976. auto ret = (data->func)(manage_copy(arg_0), manage_copy(arg_1));
  23977. return ret ? isl_bool_true : isl_bool_false;
  23978. } ISL_CPP_CATCH_ALL {
  23979. data->eptr = std::current_exception();
  23980. return isl_bool_error;
  23981. }
  23982. };
  23983. struct fn_data {
  23984. std::function<void(isl::union_pw_aff_list)> func;
  23985. std::exception_ptr eptr;
  23986. } fn_data = { fn };
  23987. auto fn_lambda = [](isl_union_pw_aff_list *arg_0, void *arg_1) -> isl_stat {
  23988. auto *data = static_cast<struct fn_data *>(arg_1);
  23989. ISL_CPP_TRY {
  23990. (data->func)(manage(arg_0));
  23991. return isl_stat_ok;
  23992. } ISL_CPP_CATCH_ALL {
  23993. data->eptr = std::current_exception();
  23994. return isl_stat_error;
  23995. }
  23996. };
  23997. auto res = isl_union_pw_aff_list_foreach_scc(get(), follows_lambda, &follows_data, fn_lambda, &fn_data);
  23998. if (follows_data.eptr)
  23999. std::rethrow_exception(follows_data.eptr);
  24000. if (fn_data.eptr)
  24001. std::rethrow_exception(fn_data.eptr);
  24002. if (res < 0)
  24003. exception::throw_last_error(saved_ctx);
  24004. return;
  24005. }
  24006. isl::union_pw_aff_list union_pw_aff_list::insert(unsigned int pos, isl::union_pw_aff el) const
  24007. {
  24008. if (!ptr || el.is_null())
  24009. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24010. auto saved_ctx = ctx();
  24011. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24012. auto res = isl_union_pw_aff_list_insert(copy(), pos, el.release());
  24013. if (!res)
  24014. exception::throw_last_error(saved_ctx);
  24015. return manage(res);
  24016. }
  24017. unsigned union_pw_aff_list::size() const
  24018. {
  24019. if (!ptr)
  24020. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24021. auto saved_ctx = ctx();
  24022. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24023. auto res = isl_union_pw_aff_list_size(get());
  24024. if (res < 0)
  24025. exception::throw_last_error(saved_ctx);
  24026. return res;
  24027. }
  24028. inline std::ostream &operator<<(std::ostream &os, const union_pw_aff_list &obj)
  24029. {
  24030. if (!obj.get())
  24031. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24032. auto saved_ctx = isl_union_pw_aff_list_get_ctx(obj.get());
  24033. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24034. char *str = isl_union_pw_aff_list_to_str(obj.get());
  24035. if (!str)
  24036. exception::throw_last_error(saved_ctx);
  24037. os << str;
  24038. free(str);
  24039. return os;
  24040. }
  24041. // implementations for isl::union_pw_multi_aff
  24042. union_pw_multi_aff manage(__isl_take isl_union_pw_multi_aff *ptr) {
  24043. if (!ptr)
  24044. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24045. return union_pw_multi_aff(ptr);
  24046. }
  24047. union_pw_multi_aff manage_copy(__isl_keep isl_union_pw_multi_aff *ptr) {
  24048. if (!ptr)
  24049. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24050. auto saved_ctx = isl_union_pw_multi_aff_get_ctx(ptr);
  24051. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24052. ptr = isl_union_pw_multi_aff_copy(ptr);
  24053. if (!ptr)
  24054. exception::throw_last_error(saved_ctx);
  24055. return union_pw_multi_aff(ptr);
  24056. }
  24057. union_pw_multi_aff::union_pw_multi_aff(__isl_take isl_union_pw_multi_aff *ptr)
  24058. : ptr(ptr) {}
  24059. union_pw_multi_aff::union_pw_multi_aff()
  24060. : ptr(nullptr) {}
  24061. union_pw_multi_aff::union_pw_multi_aff(const union_pw_multi_aff &obj)
  24062. : ptr(nullptr)
  24063. {
  24064. if (!obj.ptr)
  24065. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24066. auto saved_ctx = isl_union_pw_multi_aff_get_ctx(obj.ptr);
  24067. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24068. ptr = obj.copy();
  24069. if (!ptr)
  24070. exception::throw_last_error(saved_ctx);
  24071. }
  24072. union_pw_multi_aff::union_pw_multi_aff(isl::multi_aff ma)
  24073. {
  24074. if (ma.is_null())
  24075. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24076. auto saved_ctx = ma.ctx();
  24077. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24078. auto res = isl_union_pw_multi_aff_from_multi_aff(ma.release());
  24079. if (!res)
  24080. exception::throw_last_error(saved_ctx);
  24081. ptr = res;
  24082. }
  24083. union_pw_multi_aff::union_pw_multi_aff(isl::pw_multi_aff pma)
  24084. {
  24085. if (pma.is_null())
  24086. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24087. auto saved_ctx = pma.ctx();
  24088. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24089. auto res = isl_union_pw_multi_aff_from_pw_multi_aff(pma.release());
  24090. if (!res)
  24091. exception::throw_last_error(saved_ctx);
  24092. ptr = res;
  24093. }
  24094. union_pw_multi_aff::union_pw_multi_aff(isl::union_pw_aff upa)
  24095. {
  24096. if (upa.is_null())
  24097. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24098. auto saved_ctx = upa.ctx();
  24099. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24100. auto res = isl_union_pw_multi_aff_from_union_pw_aff(upa.release());
  24101. if (!res)
  24102. exception::throw_last_error(saved_ctx);
  24103. ptr = res;
  24104. }
  24105. union_pw_multi_aff::union_pw_multi_aff(isl::ctx ctx, const std::string &str)
  24106. {
  24107. auto saved_ctx = ctx;
  24108. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24109. auto res = isl_union_pw_multi_aff_read_from_str(ctx.release(), str.c_str());
  24110. if (!res)
  24111. exception::throw_last_error(saved_ctx);
  24112. ptr = res;
  24113. }
  24114. union_pw_multi_aff &union_pw_multi_aff::operator=(union_pw_multi_aff obj) {
  24115. std::swap(this->ptr, obj.ptr);
  24116. return *this;
  24117. }
  24118. union_pw_multi_aff::~union_pw_multi_aff() {
  24119. if (ptr)
  24120. isl_union_pw_multi_aff_free(ptr);
  24121. }
  24122. __isl_give isl_union_pw_multi_aff *union_pw_multi_aff::copy() const & {
  24123. return isl_union_pw_multi_aff_copy(ptr);
  24124. }
  24125. __isl_keep isl_union_pw_multi_aff *union_pw_multi_aff::get() const {
  24126. return ptr;
  24127. }
  24128. __isl_give isl_union_pw_multi_aff *union_pw_multi_aff::release() {
  24129. isl_union_pw_multi_aff *tmp = ptr;
  24130. ptr = nullptr;
  24131. return tmp;
  24132. }
  24133. bool union_pw_multi_aff::is_null() const {
  24134. return ptr == nullptr;
  24135. }
  24136. isl::ctx union_pw_multi_aff::ctx() const {
  24137. return isl::ctx(isl_union_pw_multi_aff_get_ctx(ptr));
  24138. }
  24139. isl::union_pw_multi_aff union_pw_multi_aff::add(isl::union_pw_multi_aff upma2) const
  24140. {
  24141. if (!ptr || upma2.is_null())
  24142. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24143. auto saved_ctx = ctx();
  24144. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24145. auto res = isl_union_pw_multi_aff_add(copy(), upma2.release());
  24146. if (!res)
  24147. exception::throw_last_error(saved_ctx);
  24148. return manage(res);
  24149. }
  24150. isl::union_pw_multi_aff union_pw_multi_aff::apply(isl::union_pw_multi_aff upma2) const
  24151. {
  24152. if (!ptr || upma2.is_null())
  24153. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24154. auto saved_ctx = ctx();
  24155. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24156. auto res = isl_union_pw_multi_aff_apply_union_pw_multi_aff(copy(), upma2.release());
  24157. if (!res)
  24158. exception::throw_last_error(saved_ctx);
  24159. return manage(res);
  24160. }
  24161. isl::multi_union_pw_aff union_pw_multi_aff::as_multi_union_pw_aff() const
  24162. {
  24163. if (!ptr)
  24164. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24165. auto saved_ctx = ctx();
  24166. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24167. auto res = isl_union_pw_multi_aff_as_multi_union_pw_aff(copy());
  24168. if (!res)
  24169. exception::throw_last_error(saved_ctx);
  24170. return manage(res);
  24171. }
  24172. isl::pw_multi_aff union_pw_multi_aff::as_pw_multi_aff() const
  24173. {
  24174. if (!ptr)
  24175. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24176. auto saved_ctx = ctx();
  24177. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24178. auto res = isl_union_pw_multi_aff_as_pw_multi_aff(copy());
  24179. if (!res)
  24180. exception::throw_last_error(saved_ctx);
  24181. return manage(res);
  24182. }
  24183. isl::union_map union_pw_multi_aff::as_union_map() const
  24184. {
  24185. if (!ptr)
  24186. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24187. auto saved_ctx = ctx();
  24188. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24189. auto res = isl_union_pw_multi_aff_as_union_map(copy());
  24190. if (!res)
  24191. exception::throw_last_error(saved_ctx);
  24192. return manage(res);
  24193. }
  24194. isl::union_pw_multi_aff union_pw_multi_aff::coalesce() const
  24195. {
  24196. if (!ptr)
  24197. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24198. auto saved_ctx = ctx();
  24199. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24200. auto res = isl_union_pw_multi_aff_coalesce(copy());
  24201. if (!res)
  24202. exception::throw_last_error(saved_ctx);
  24203. return manage(res);
  24204. }
  24205. isl::union_set union_pw_multi_aff::domain() const
  24206. {
  24207. if (!ptr)
  24208. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24209. auto saved_ctx = ctx();
  24210. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24211. auto res = isl_union_pw_multi_aff_domain(copy());
  24212. if (!res)
  24213. exception::throw_last_error(saved_ctx);
  24214. return manage(res);
  24215. }
  24216. isl::union_pw_multi_aff union_pw_multi_aff::empty(isl::ctx ctx)
  24217. {
  24218. auto saved_ctx = ctx;
  24219. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24220. auto res = isl_union_pw_multi_aff_empty_ctx(ctx.release());
  24221. if (!res)
  24222. exception::throw_last_error(saved_ctx);
  24223. return manage(res);
  24224. }
  24225. isl::pw_multi_aff union_pw_multi_aff::extract_pw_multi_aff(isl::space space) const
  24226. {
  24227. if (!ptr || space.is_null())
  24228. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24229. auto saved_ctx = ctx();
  24230. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24231. auto res = isl_union_pw_multi_aff_extract_pw_multi_aff(get(), space.release());
  24232. if (!res)
  24233. exception::throw_last_error(saved_ctx);
  24234. return manage(res);
  24235. }
  24236. isl::union_pw_multi_aff union_pw_multi_aff::flat_range_product(isl::union_pw_multi_aff upma2) const
  24237. {
  24238. if (!ptr || upma2.is_null())
  24239. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24240. auto saved_ctx = ctx();
  24241. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24242. auto res = isl_union_pw_multi_aff_flat_range_product(copy(), upma2.release());
  24243. if (!res)
  24244. exception::throw_last_error(saved_ctx);
  24245. return manage(res);
  24246. }
  24247. isl::union_pw_multi_aff union_pw_multi_aff::gist(isl::union_set context) const
  24248. {
  24249. if (!ptr || context.is_null())
  24250. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24251. auto saved_ctx = ctx();
  24252. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24253. auto res = isl_union_pw_multi_aff_gist(copy(), context.release());
  24254. if (!res)
  24255. exception::throw_last_error(saved_ctx);
  24256. return manage(res);
  24257. }
  24258. isl::union_pw_multi_aff union_pw_multi_aff::intersect_domain(isl::space space) const
  24259. {
  24260. if (!ptr || space.is_null())
  24261. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24262. auto saved_ctx = ctx();
  24263. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24264. auto res = isl_union_pw_multi_aff_intersect_domain_space(copy(), space.release());
  24265. if (!res)
  24266. exception::throw_last_error(saved_ctx);
  24267. return manage(res);
  24268. }
  24269. isl::union_pw_multi_aff union_pw_multi_aff::intersect_domain(isl::union_set uset) const
  24270. {
  24271. if (!ptr || uset.is_null())
  24272. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24273. auto saved_ctx = ctx();
  24274. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24275. auto res = isl_union_pw_multi_aff_intersect_domain_union_set(copy(), uset.release());
  24276. if (!res)
  24277. exception::throw_last_error(saved_ctx);
  24278. return manage(res);
  24279. }
  24280. isl::union_pw_multi_aff union_pw_multi_aff::intersect_domain_wrapped_domain(isl::union_set uset) const
  24281. {
  24282. if (!ptr || uset.is_null())
  24283. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24284. auto saved_ctx = ctx();
  24285. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24286. auto res = isl_union_pw_multi_aff_intersect_domain_wrapped_domain(copy(), uset.release());
  24287. if (!res)
  24288. exception::throw_last_error(saved_ctx);
  24289. return manage(res);
  24290. }
  24291. isl::union_pw_multi_aff union_pw_multi_aff::intersect_domain_wrapped_range(isl::union_set uset) const
  24292. {
  24293. if (!ptr || uset.is_null())
  24294. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24295. auto saved_ctx = ctx();
  24296. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24297. auto res = isl_union_pw_multi_aff_intersect_domain_wrapped_range(copy(), uset.release());
  24298. if (!res)
  24299. exception::throw_last_error(saved_ctx);
  24300. return manage(res);
  24301. }
  24302. isl::union_pw_multi_aff union_pw_multi_aff::intersect_params(isl::set set) const
  24303. {
  24304. if (!ptr || set.is_null())
  24305. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24306. auto saved_ctx = ctx();
  24307. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24308. auto res = isl_union_pw_multi_aff_intersect_params(copy(), set.release());
  24309. if (!res)
  24310. exception::throw_last_error(saved_ctx);
  24311. return manage(res);
  24312. }
  24313. bool union_pw_multi_aff::involves_locals() const
  24314. {
  24315. if (!ptr)
  24316. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24317. auto saved_ctx = ctx();
  24318. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24319. auto res = isl_union_pw_multi_aff_involves_locals(get());
  24320. if (res < 0)
  24321. exception::throw_last_error(saved_ctx);
  24322. return res;
  24323. }
  24324. bool union_pw_multi_aff::isa_pw_multi_aff() const
  24325. {
  24326. if (!ptr)
  24327. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24328. auto saved_ctx = ctx();
  24329. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24330. auto res = isl_union_pw_multi_aff_isa_pw_multi_aff(get());
  24331. if (res < 0)
  24332. exception::throw_last_error(saved_ctx);
  24333. return res;
  24334. }
  24335. bool union_pw_multi_aff::plain_is_empty() const
  24336. {
  24337. if (!ptr)
  24338. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24339. auto saved_ctx = ctx();
  24340. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24341. auto res = isl_union_pw_multi_aff_plain_is_empty(get());
  24342. if (res < 0)
  24343. exception::throw_last_error(saved_ctx);
  24344. return res;
  24345. }
  24346. isl::union_pw_multi_aff union_pw_multi_aff::preimage_domain_wrapped_domain(isl::union_pw_multi_aff upma2) const
  24347. {
  24348. if (!ptr || upma2.is_null())
  24349. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24350. auto saved_ctx = ctx();
  24351. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24352. auto res = isl_union_pw_multi_aff_preimage_domain_wrapped_domain_union_pw_multi_aff(copy(), upma2.release());
  24353. if (!res)
  24354. exception::throw_last_error(saved_ctx);
  24355. return manage(res);
  24356. }
  24357. isl::union_pw_multi_aff union_pw_multi_aff::pullback(isl::union_pw_multi_aff upma2) const
  24358. {
  24359. if (!ptr || upma2.is_null())
  24360. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24361. auto saved_ctx = ctx();
  24362. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24363. auto res = isl_union_pw_multi_aff_pullback_union_pw_multi_aff(copy(), upma2.release());
  24364. if (!res)
  24365. exception::throw_last_error(saved_ctx);
  24366. return manage(res);
  24367. }
  24368. isl::pw_multi_aff_list union_pw_multi_aff::pw_multi_aff_list() const
  24369. {
  24370. if (!ptr)
  24371. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24372. auto saved_ctx = ctx();
  24373. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24374. auto res = isl_union_pw_multi_aff_get_pw_multi_aff_list(get());
  24375. if (!res)
  24376. exception::throw_last_error(saved_ctx);
  24377. return manage(res);
  24378. }
  24379. isl::pw_multi_aff_list union_pw_multi_aff::get_pw_multi_aff_list() const
  24380. {
  24381. return pw_multi_aff_list();
  24382. }
  24383. isl::union_pw_multi_aff union_pw_multi_aff::range_factor_domain() const
  24384. {
  24385. if (!ptr)
  24386. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24387. auto saved_ctx = ctx();
  24388. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24389. auto res = isl_union_pw_multi_aff_range_factor_domain(copy());
  24390. if (!res)
  24391. exception::throw_last_error(saved_ctx);
  24392. return manage(res);
  24393. }
  24394. isl::union_pw_multi_aff union_pw_multi_aff::range_factor_range() const
  24395. {
  24396. if (!ptr)
  24397. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24398. auto saved_ctx = ctx();
  24399. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24400. auto res = isl_union_pw_multi_aff_range_factor_range(copy());
  24401. if (!res)
  24402. exception::throw_last_error(saved_ctx);
  24403. return manage(res);
  24404. }
  24405. isl::union_pw_multi_aff union_pw_multi_aff::range_product(isl::union_pw_multi_aff upma2) const
  24406. {
  24407. if (!ptr || upma2.is_null())
  24408. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24409. auto saved_ctx = ctx();
  24410. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24411. auto res = isl_union_pw_multi_aff_range_product(copy(), upma2.release());
  24412. if (!res)
  24413. exception::throw_last_error(saved_ctx);
  24414. return manage(res);
  24415. }
  24416. isl::space union_pw_multi_aff::space() const
  24417. {
  24418. if (!ptr)
  24419. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24420. auto saved_ctx = ctx();
  24421. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24422. auto res = isl_union_pw_multi_aff_get_space(get());
  24423. if (!res)
  24424. exception::throw_last_error(saved_ctx);
  24425. return manage(res);
  24426. }
  24427. isl::space union_pw_multi_aff::get_space() const
  24428. {
  24429. return space();
  24430. }
  24431. isl::union_pw_multi_aff union_pw_multi_aff::sub(isl::union_pw_multi_aff upma2) const
  24432. {
  24433. if (!ptr || upma2.is_null())
  24434. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24435. auto saved_ctx = ctx();
  24436. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24437. auto res = isl_union_pw_multi_aff_sub(copy(), upma2.release());
  24438. if (!res)
  24439. exception::throw_last_error(saved_ctx);
  24440. return manage(res);
  24441. }
  24442. isl::union_pw_multi_aff union_pw_multi_aff::subtract_domain(isl::space space) const
  24443. {
  24444. if (!ptr || space.is_null())
  24445. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24446. auto saved_ctx = ctx();
  24447. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24448. auto res = isl_union_pw_multi_aff_subtract_domain_space(copy(), space.release());
  24449. if (!res)
  24450. exception::throw_last_error(saved_ctx);
  24451. return manage(res);
  24452. }
  24453. isl::union_pw_multi_aff union_pw_multi_aff::subtract_domain(isl::union_set uset) const
  24454. {
  24455. if (!ptr || uset.is_null())
  24456. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24457. auto saved_ctx = ctx();
  24458. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24459. auto res = isl_union_pw_multi_aff_subtract_domain_union_set(copy(), uset.release());
  24460. if (!res)
  24461. exception::throw_last_error(saved_ctx);
  24462. return manage(res);
  24463. }
  24464. isl::union_pw_multi_aff union_pw_multi_aff::union_add(isl::union_pw_multi_aff upma2) const
  24465. {
  24466. if (!ptr || upma2.is_null())
  24467. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24468. auto saved_ctx = ctx();
  24469. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24470. auto res = isl_union_pw_multi_aff_union_add(copy(), upma2.release());
  24471. if (!res)
  24472. exception::throw_last_error(saved_ctx);
  24473. return manage(res);
  24474. }
  24475. inline std::ostream &operator<<(std::ostream &os, const union_pw_multi_aff &obj)
  24476. {
  24477. if (!obj.get())
  24478. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24479. auto saved_ctx = isl_union_pw_multi_aff_get_ctx(obj.get());
  24480. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24481. char *str = isl_union_pw_multi_aff_to_str(obj.get());
  24482. if (!str)
  24483. exception::throw_last_error(saved_ctx);
  24484. os << str;
  24485. free(str);
  24486. return os;
  24487. }
  24488. // implementations for isl::union_set
  24489. union_set manage(__isl_take isl_union_set *ptr) {
  24490. if (!ptr)
  24491. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24492. return union_set(ptr);
  24493. }
  24494. union_set manage_copy(__isl_keep isl_union_set *ptr) {
  24495. if (!ptr)
  24496. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24497. auto saved_ctx = isl_union_set_get_ctx(ptr);
  24498. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24499. ptr = isl_union_set_copy(ptr);
  24500. if (!ptr)
  24501. exception::throw_last_error(saved_ctx);
  24502. return union_set(ptr);
  24503. }
  24504. union_set::union_set(__isl_take isl_union_set *ptr)
  24505. : ptr(ptr) {}
  24506. union_set::union_set()
  24507. : ptr(nullptr) {}
  24508. union_set::union_set(const union_set &obj)
  24509. : ptr(nullptr)
  24510. {
  24511. if (!obj.ptr)
  24512. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24513. auto saved_ctx = isl_union_set_get_ctx(obj.ptr);
  24514. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24515. ptr = obj.copy();
  24516. if (!ptr)
  24517. exception::throw_last_error(saved_ctx);
  24518. }
  24519. union_set::union_set(isl::basic_set bset)
  24520. {
  24521. if (bset.is_null())
  24522. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24523. auto saved_ctx = bset.ctx();
  24524. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24525. auto res = isl_union_set_from_basic_set(bset.release());
  24526. if (!res)
  24527. exception::throw_last_error(saved_ctx);
  24528. ptr = res;
  24529. }
  24530. union_set::union_set(isl::point pnt)
  24531. {
  24532. if (pnt.is_null())
  24533. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24534. auto saved_ctx = pnt.ctx();
  24535. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24536. auto res = isl_union_set_from_point(pnt.release());
  24537. if (!res)
  24538. exception::throw_last_error(saved_ctx);
  24539. ptr = res;
  24540. }
  24541. union_set::union_set(isl::set set)
  24542. {
  24543. if (set.is_null())
  24544. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24545. auto saved_ctx = set.ctx();
  24546. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24547. auto res = isl_union_set_from_set(set.release());
  24548. if (!res)
  24549. exception::throw_last_error(saved_ctx);
  24550. ptr = res;
  24551. }
  24552. union_set::union_set(isl::ctx ctx, const std::string &str)
  24553. {
  24554. auto saved_ctx = ctx;
  24555. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24556. auto res = isl_union_set_read_from_str(ctx.release(), str.c_str());
  24557. if (!res)
  24558. exception::throw_last_error(saved_ctx);
  24559. ptr = res;
  24560. }
  24561. union_set &union_set::operator=(union_set obj) {
  24562. std::swap(this->ptr, obj.ptr);
  24563. return *this;
  24564. }
  24565. union_set::~union_set() {
  24566. if (ptr)
  24567. isl_union_set_free(ptr);
  24568. }
  24569. __isl_give isl_union_set *union_set::copy() const & {
  24570. return isl_union_set_copy(ptr);
  24571. }
  24572. __isl_keep isl_union_set *union_set::get() const {
  24573. return ptr;
  24574. }
  24575. __isl_give isl_union_set *union_set::release() {
  24576. isl_union_set *tmp = ptr;
  24577. ptr = nullptr;
  24578. return tmp;
  24579. }
  24580. bool union_set::is_null() const {
  24581. return ptr == nullptr;
  24582. }
  24583. isl::ctx union_set::ctx() const {
  24584. return isl::ctx(isl_union_set_get_ctx(ptr));
  24585. }
  24586. isl::union_set union_set::affine_hull() const
  24587. {
  24588. if (!ptr)
  24589. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24590. auto saved_ctx = ctx();
  24591. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24592. auto res = isl_union_set_affine_hull(copy());
  24593. if (!res)
  24594. exception::throw_last_error(saved_ctx);
  24595. return manage(res);
  24596. }
  24597. isl::union_set union_set::apply(isl::union_map umap) const
  24598. {
  24599. if (!ptr || umap.is_null())
  24600. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24601. auto saved_ctx = ctx();
  24602. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24603. auto res = isl_union_set_apply(copy(), umap.release());
  24604. if (!res)
  24605. exception::throw_last_error(saved_ctx);
  24606. return manage(res);
  24607. }
  24608. isl::set union_set::as_set() const
  24609. {
  24610. if (!ptr)
  24611. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24612. auto saved_ctx = ctx();
  24613. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24614. auto res = isl_union_set_as_set(copy());
  24615. if (!res)
  24616. exception::throw_last_error(saved_ctx);
  24617. return manage(res);
  24618. }
  24619. isl::union_set union_set::coalesce() const
  24620. {
  24621. if (!ptr)
  24622. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24623. auto saved_ctx = ctx();
  24624. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24625. auto res = isl_union_set_coalesce(copy());
  24626. if (!res)
  24627. exception::throw_last_error(saved_ctx);
  24628. return manage(res);
  24629. }
  24630. isl::union_set union_set::compute_divs() const
  24631. {
  24632. if (!ptr)
  24633. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24634. auto saved_ctx = ctx();
  24635. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24636. auto res = isl_union_set_compute_divs(copy());
  24637. if (!res)
  24638. exception::throw_last_error(saved_ctx);
  24639. return manage(res);
  24640. }
  24641. isl::union_set union_set::detect_equalities() const
  24642. {
  24643. if (!ptr)
  24644. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24645. auto saved_ctx = ctx();
  24646. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24647. auto res = isl_union_set_detect_equalities(copy());
  24648. if (!res)
  24649. exception::throw_last_error(saved_ctx);
  24650. return manage(res);
  24651. }
  24652. isl::union_set union_set::empty(isl::ctx ctx)
  24653. {
  24654. auto saved_ctx = ctx;
  24655. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24656. auto res = isl_union_set_empty_ctx(ctx.release());
  24657. if (!res)
  24658. exception::throw_last_error(saved_ctx);
  24659. return manage(res);
  24660. }
  24661. bool union_set::every_set(const std::function<bool(isl::set)> &test) const
  24662. {
  24663. if (!ptr)
  24664. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24665. auto saved_ctx = ctx();
  24666. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24667. struct test_data {
  24668. std::function<bool(isl::set)> func;
  24669. std::exception_ptr eptr;
  24670. } test_data = { test };
  24671. auto test_lambda = [](isl_set *arg_0, void *arg_1) -> isl_bool {
  24672. auto *data = static_cast<struct test_data *>(arg_1);
  24673. ISL_CPP_TRY {
  24674. auto ret = (data->func)(manage_copy(arg_0));
  24675. return ret ? isl_bool_true : isl_bool_false;
  24676. } ISL_CPP_CATCH_ALL {
  24677. data->eptr = std::current_exception();
  24678. return isl_bool_error;
  24679. }
  24680. };
  24681. auto res = isl_union_set_every_set(get(), test_lambda, &test_data);
  24682. if (test_data.eptr)
  24683. std::rethrow_exception(test_data.eptr);
  24684. if (res < 0)
  24685. exception::throw_last_error(saved_ctx);
  24686. return res;
  24687. }
  24688. isl::set union_set::extract_set(isl::space space) const
  24689. {
  24690. if (!ptr || space.is_null())
  24691. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24692. auto saved_ctx = ctx();
  24693. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24694. auto res = isl_union_set_extract_set(get(), space.release());
  24695. if (!res)
  24696. exception::throw_last_error(saved_ctx);
  24697. return manage(res);
  24698. }
  24699. void union_set::foreach_point(const std::function<void(isl::point)> &fn) const
  24700. {
  24701. if (!ptr)
  24702. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24703. auto saved_ctx = ctx();
  24704. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24705. struct fn_data {
  24706. std::function<void(isl::point)> func;
  24707. std::exception_ptr eptr;
  24708. } fn_data = { fn };
  24709. auto fn_lambda = [](isl_point *arg_0, void *arg_1) -> isl_stat {
  24710. auto *data = static_cast<struct fn_data *>(arg_1);
  24711. ISL_CPP_TRY {
  24712. (data->func)(manage(arg_0));
  24713. return isl_stat_ok;
  24714. } ISL_CPP_CATCH_ALL {
  24715. data->eptr = std::current_exception();
  24716. return isl_stat_error;
  24717. }
  24718. };
  24719. auto res = isl_union_set_foreach_point(get(), fn_lambda, &fn_data);
  24720. if (fn_data.eptr)
  24721. std::rethrow_exception(fn_data.eptr);
  24722. if (res < 0)
  24723. exception::throw_last_error(saved_ctx);
  24724. return;
  24725. }
  24726. void union_set::foreach_set(const std::function<void(isl::set)> &fn) const
  24727. {
  24728. if (!ptr)
  24729. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24730. auto saved_ctx = ctx();
  24731. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24732. struct fn_data {
  24733. std::function<void(isl::set)> func;
  24734. std::exception_ptr eptr;
  24735. } fn_data = { fn };
  24736. auto fn_lambda = [](isl_set *arg_0, void *arg_1) -> isl_stat {
  24737. auto *data = static_cast<struct fn_data *>(arg_1);
  24738. ISL_CPP_TRY {
  24739. (data->func)(manage(arg_0));
  24740. return isl_stat_ok;
  24741. } ISL_CPP_CATCH_ALL {
  24742. data->eptr = std::current_exception();
  24743. return isl_stat_error;
  24744. }
  24745. };
  24746. auto res = isl_union_set_foreach_set(get(), fn_lambda, &fn_data);
  24747. if (fn_data.eptr)
  24748. std::rethrow_exception(fn_data.eptr);
  24749. if (res < 0)
  24750. exception::throw_last_error(saved_ctx);
  24751. return;
  24752. }
  24753. isl::union_set union_set::gist(isl::union_set context) const
  24754. {
  24755. if (!ptr || context.is_null())
  24756. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24757. auto saved_ctx = ctx();
  24758. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24759. auto res = isl_union_set_gist(copy(), context.release());
  24760. if (!res)
  24761. exception::throw_last_error(saved_ctx);
  24762. return manage(res);
  24763. }
  24764. isl::union_set union_set::gist_params(isl::set set) const
  24765. {
  24766. if (!ptr || set.is_null())
  24767. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24768. auto saved_ctx = ctx();
  24769. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24770. auto res = isl_union_set_gist_params(copy(), set.release());
  24771. if (!res)
  24772. exception::throw_last_error(saved_ctx);
  24773. return manage(res);
  24774. }
  24775. isl::union_map union_set::identity() const
  24776. {
  24777. if (!ptr)
  24778. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24779. auto saved_ctx = ctx();
  24780. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24781. auto res = isl_union_set_identity(copy());
  24782. if (!res)
  24783. exception::throw_last_error(saved_ctx);
  24784. return manage(res);
  24785. }
  24786. isl::union_set union_set::intersect(isl::union_set uset2) const
  24787. {
  24788. if (!ptr || uset2.is_null())
  24789. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24790. auto saved_ctx = ctx();
  24791. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24792. auto res = isl_union_set_intersect(copy(), uset2.release());
  24793. if (!res)
  24794. exception::throw_last_error(saved_ctx);
  24795. return manage(res);
  24796. }
  24797. isl::union_set union_set::intersect_params(isl::set set) const
  24798. {
  24799. if (!ptr || set.is_null())
  24800. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24801. auto saved_ctx = ctx();
  24802. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24803. auto res = isl_union_set_intersect_params(copy(), set.release());
  24804. if (!res)
  24805. exception::throw_last_error(saved_ctx);
  24806. return manage(res);
  24807. }
  24808. bool union_set::is_disjoint(const isl::union_set &uset2) const
  24809. {
  24810. if (!ptr || uset2.is_null())
  24811. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24812. auto saved_ctx = ctx();
  24813. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24814. auto res = isl_union_set_is_disjoint(get(), uset2.get());
  24815. if (res < 0)
  24816. exception::throw_last_error(saved_ctx);
  24817. return res;
  24818. }
  24819. bool union_set::is_empty() const
  24820. {
  24821. if (!ptr)
  24822. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24823. auto saved_ctx = ctx();
  24824. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24825. auto res = isl_union_set_is_empty(get());
  24826. if (res < 0)
  24827. exception::throw_last_error(saved_ctx);
  24828. return res;
  24829. }
  24830. bool union_set::is_equal(const isl::union_set &uset2) const
  24831. {
  24832. if (!ptr || uset2.is_null())
  24833. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24834. auto saved_ctx = ctx();
  24835. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24836. auto res = isl_union_set_is_equal(get(), uset2.get());
  24837. if (res < 0)
  24838. exception::throw_last_error(saved_ctx);
  24839. return res;
  24840. }
  24841. bool union_set::is_strict_subset(const isl::union_set &uset2) const
  24842. {
  24843. if (!ptr || uset2.is_null())
  24844. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24845. auto saved_ctx = ctx();
  24846. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24847. auto res = isl_union_set_is_strict_subset(get(), uset2.get());
  24848. if (res < 0)
  24849. exception::throw_last_error(saved_ctx);
  24850. return res;
  24851. }
  24852. bool union_set::is_subset(const isl::union_set &uset2) const
  24853. {
  24854. if (!ptr || uset2.is_null())
  24855. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24856. auto saved_ctx = ctx();
  24857. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24858. auto res = isl_union_set_is_subset(get(), uset2.get());
  24859. if (res < 0)
  24860. exception::throw_last_error(saved_ctx);
  24861. return res;
  24862. }
  24863. bool union_set::isa_set() const
  24864. {
  24865. if (!ptr)
  24866. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24867. auto saved_ctx = ctx();
  24868. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24869. auto res = isl_union_set_isa_set(get());
  24870. if (res < 0)
  24871. exception::throw_last_error(saved_ctx);
  24872. return res;
  24873. }
  24874. isl::union_set union_set::lexmax() const
  24875. {
  24876. if (!ptr)
  24877. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24878. auto saved_ctx = ctx();
  24879. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24880. auto res = isl_union_set_lexmax(copy());
  24881. if (!res)
  24882. exception::throw_last_error(saved_ctx);
  24883. return manage(res);
  24884. }
  24885. isl::union_set union_set::lexmin() const
  24886. {
  24887. if (!ptr)
  24888. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24889. auto saved_ctx = ctx();
  24890. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24891. auto res = isl_union_set_lexmin(copy());
  24892. if (!res)
  24893. exception::throw_last_error(saved_ctx);
  24894. return manage(res);
  24895. }
  24896. isl::union_set union_set::polyhedral_hull() const
  24897. {
  24898. if (!ptr)
  24899. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24900. auto saved_ctx = ctx();
  24901. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24902. auto res = isl_union_set_polyhedral_hull(copy());
  24903. if (!res)
  24904. exception::throw_last_error(saved_ctx);
  24905. return manage(res);
  24906. }
  24907. isl::union_set union_set::preimage(isl::multi_aff ma) const
  24908. {
  24909. if (!ptr || ma.is_null())
  24910. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24911. auto saved_ctx = ctx();
  24912. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24913. auto res = isl_union_set_preimage_multi_aff(copy(), ma.release());
  24914. if (!res)
  24915. exception::throw_last_error(saved_ctx);
  24916. return manage(res);
  24917. }
  24918. isl::union_set union_set::preimage(isl::pw_multi_aff pma) const
  24919. {
  24920. if (!ptr || pma.is_null())
  24921. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24922. auto saved_ctx = ctx();
  24923. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24924. auto res = isl_union_set_preimage_pw_multi_aff(copy(), pma.release());
  24925. if (!res)
  24926. exception::throw_last_error(saved_ctx);
  24927. return manage(res);
  24928. }
  24929. isl::union_set union_set::preimage(isl::union_pw_multi_aff upma) const
  24930. {
  24931. if (!ptr || upma.is_null())
  24932. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24933. auto saved_ctx = ctx();
  24934. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24935. auto res = isl_union_set_preimage_union_pw_multi_aff(copy(), upma.release());
  24936. if (!res)
  24937. exception::throw_last_error(saved_ctx);
  24938. return manage(res);
  24939. }
  24940. isl::point union_set::sample_point() const
  24941. {
  24942. if (!ptr)
  24943. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24944. auto saved_ctx = ctx();
  24945. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24946. auto res = isl_union_set_sample_point(copy());
  24947. if (!res)
  24948. exception::throw_last_error(saved_ctx);
  24949. return manage(res);
  24950. }
  24951. isl::set_list union_set::set_list() const
  24952. {
  24953. if (!ptr)
  24954. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24955. auto saved_ctx = ctx();
  24956. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24957. auto res = isl_union_set_get_set_list(get());
  24958. if (!res)
  24959. exception::throw_last_error(saved_ctx);
  24960. return manage(res);
  24961. }
  24962. isl::set_list union_set::get_set_list() const
  24963. {
  24964. return set_list();
  24965. }
  24966. isl::space union_set::space() const
  24967. {
  24968. if (!ptr)
  24969. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24970. auto saved_ctx = ctx();
  24971. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24972. auto res = isl_union_set_get_space(get());
  24973. if (!res)
  24974. exception::throw_last_error(saved_ctx);
  24975. return manage(res);
  24976. }
  24977. isl::space union_set::get_space() const
  24978. {
  24979. return space();
  24980. }
  24981. isl::union_set union_set::subtract(isl::union_set uset2) const
  24982. {
  24983. if (!ptr || uset2.is_null())
  24984. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24985. auto saved_ctx = ctx();
  24986. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24987. auto res = isl_union_set_subtract(copy(), uset2.release());
  24988. if (!res)
  24989. exception::throw_last_error(saved_ctx);
  24990. return manage(res);
  24991. }
  24992. isl::union_set_list union_set::to_list() const
  24993. {
  24994. if (!ptr)
  24995. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  24996. auto saved_ctx = ctx();
  24997. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  24998. auto res = isl_union_set_to_list(copy());
  24999. if (!res)
  25000. exception::throw_last_error(saved_ctx);
  25001. return manage(res);
  25002. }
  25003. isl::union_set union_set::unite(isl::union_set uset2) const
  25004. {
  25005. if (!ptr || uset2.is_null())
  25006. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25007. auto saved_ctx = ctx();
  25008. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25009. auto res = isl_union_set_union(copy(), uset2.release());
  25010. if (!res)
  25011. exception::throw_last_error(saved_ctx);
  25012. return manage(res);
  25013. }
  25014. isl::union_set union_set::universe() const
  25015. {
  25016. if (!ptr)
  25017. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25018. auto saved_ctx = ctx();
  25019. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25020. auto res = isl_union_set_universe(copy());
  25021. if (!res)
  25022. exception::throw_last_error(saved_ctx);
  25023. return manage(res);
  25024. }
  25025. isl::union_map union_set::unwrap() const
  25026. {
  25027. if (!ptr)
  25028. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25029. auto saved_ctx = ctx();
  25030. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25031. auto res = isl_union_set_unwrap(copy());
  25032. if (!res)
  25033. exception::throw_last_error(saved_ctx);
  25034. return manage(res);
  25035. }
  25036. inline std::ostream &operator<<(std::ostream &os, const union_set &obj)
  25037. {
  25038. if (!obj.get())
  25039. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25040. auto saved_ctx = isl_union_set_get_ctx(obj.get());
  25041. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25042. char *str = isl_union_set_to_str(obj.get());
  25043. if (!str)
  25044. exception::throw_last_error(saved_ctx);
  25045. os << str;
  25046. free(str);
  25047. return os;
  25048. }
  25049. // implementations for isl::union_set_list
  25050. union_set_list manage(__isl_take isl_union_set_list *ptr) {
  25051. if (!ptr)
  25052. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25053. return union_set_list(ptr);
  25054. }
  25055. union_set_list manage_copy(__isl_keep isl_union_set_list *ptr) {
  25056. if (!ptr)
  25057. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25058. auto saved_ctx = isl_union_set_list_get_ctx(ptr);
  25059. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25060. ptr = isl_union_set_list_copy(ptr);
  25061. if (!ptr)
  25062. exception::throw_last_error(saved_ctx);
  25063. return union_set_list(ptr);
  25064. }
  25065. union_set_list::union_set_list(__isl_take isl_union_set_list *ptr)
  25066. : ptr(ptr) {}
  25067. union_set_list::union_set_list()
  25068. : ptr(nullptr) {}
  25069. union_set_list::union_set_list(const union_set_list &obj)
  25070. : ptr(nullptr)
  25071. {
  25072. if (!obj.ptr)
  25073. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25074. auto saved_ctx = isl_union_set_list_get_ctx(obj.ptr);
  25075. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25076. ptr = obj.copy();
  25077. if (!ptr)
  25078. exception::throw_last_error(saved_ctx);
  25079. }
  25080. union_set_list::union_set_list(isl::ctx ctx, int n)
  25081. {
  25082. auto saved_ctx = ctx;
  25083. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25084. auto res = isl_union_set_list_alloc(ctx.release(), n);
  25085. if (!res)
  25086. exception::throw_last_error(saved_ctx);
  25087. ptr = res;
  25088. }
  25089. union_set_list::union_set_list(isl::union_set el)
  25090. {
  25091. if (el.is_null())
  25092. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25093. auto saved_ctx = el.ctx();
  25094. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25095. auto res = isl_union_set_list_from_union_set(el.release());
  25096. if (!res)
  25097. exception::throw_last_error(saved_ctx);
  25098. ptr = res;
  25099. }
  25100. union_set_list::union_set_list(isl::ctx ctx, const std::string &str)
  25101. {
  25102. auto saved_ctx = ctx;
  25103. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25104. auto res = isl_union_set_list_read_from_str(ctx.release(), str.c_str());
  25105. if (!res)
  25106. exception::throw_last_error(saved_ctx);
  25107. ptr = res;
  25108. }
  25109. union_set_list &union_set_list::operator=(union_set_list obj) {
  25110. std::swap(this->ptr, obj.ptr);
  25111. return *this;
  25112. }
  25113. union_set_list::~union_set_list() {
  25114. if (ptr)
  25115. isl_union_set_list_free(ptr);
  25116. }
  25117. __isl_give isl_union_set_list *union_set_list::copy() const & {
  25118. return isl_union_set_list_copy(ptr);
  25119. }
  25120. __isl_keep isl_union_set_list *union_set_list::get() const {
  25121. return ptr;
  25122. }
  25123. __isl_give isl_union_set_list *union_set_list::release() {
  25124. isl_union_set_list *tmp = ptr;
  25125. ptr = nullptr;
  25126. return tmp;
  25127. }
  25128. bool union_set_list::is_null() const {
  25129. return ptr == nullptr;
  25130. }
  25131. isl::ctx union_set_list::ctx() const {
  25132. return isl::ctx(isl_union_set_list_get_ctx(ptr));
  25133. }
  25134. isl::union_set_list union_set_list::add(isl::union_set el) const
  25135. {
  25136. if (!ptr || el.is_null())
  25137. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25138. auto saved_ctx = ctx();
  25139. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25140. auto res = isl_union_set_list_add(copy(), el.release());
  25141. if (!res)
  25142. exception::throw_last_error(saved_ctx);
  25143. return manage(res);
  25144. }
  25145. isl::union_set union_set_list::at(int index) const
  25146. {
  25147. if (!ptr)
  25148. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25149. auto saved_ctx = ctx();
  25150. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25151. auto res = isl_union_set_list_get_at(get(), index);
  25152. if (!res)
  25153. exception::throw_last_error(saved_ctx);
  25154. return manage(res);
  25155. }
  25156. isl::union_set union_set_list::get_at(int index) const
  25157. {
  25158. return at(index);
  25159. }
  25160. isl::union_set_list union_set_list::clear() const
  25161. {
  25162. if (!ptr)
  25163. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25164. auto saved_ctx = ctx();
  25165. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25166. auto res = isl_union_set_list_clear(copy());
  25167. if (!res)
  25168. exception::throw_last_error(saved_ctx);
  25169. return manage(res);
  25170. }
  25171. isl::union_set_list union_set_list::concat(isl::union_set_list list2) const
  25172. {
  25173. if (!ptr || list2.is_null())
  25174. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25175. auto saved_ctx = ctx();
  25176. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25177. auto res = isl_union_set_list_concat(copy(), list2.release());
  25178. if (!res)
  25179. exception::throw_last_error(saved_ctx);
  25180. return manage(res);
  25181. }
  25182. isl::union_set_list union_set_list::drop(unsigned int first, unsigned int n) const
  25183. {
  25184. if (!ptr)
  25185. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25186. auto saved_ctx = ctx();
  25187. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25188. auto res = isl_union_set_list_drop(copy(), first, n);
  25189. if (!res)
  25190. exception::throw_last_error(saved_ctx);
  25191. return manage(res);
  25192. }
  25193. void union_set_list::foreach(const std::function<void(isl::union_set)> &fn) const
  25194. {
  25195. if (!ptr)
  25196. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25197. auto saved_ctx = ctx();
  25198. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25199. struct fn_data {
  25200. std::function<void(isl::union_set)> func;
  25201. std::exception_ptr eptr;
  25202. } fn_data = { fn };
  25203. auto fn_lambda = [](isl_union_set *arg_0, void *arg_1) -> isl_stat {
  25204. auto *data = static_cast<struct fn_data *>(arg_1);
  25205. ISL_CPP_TRY {
  25206. (data->func)(manage(arg_0));
  25207. return isl_stat_ok;
  25208. } ISL_CPP_CATCH_ALL {
  25209. data->eptr = std::current_exception();
  25210. return isl_stat_error;
  25211. }
  25212. };
  25213. auto res = isl_union_set_list_foreach(get(), fn_lambda, &fn_data);
  25214. if (fn_data.eptr)
  25215. std::rethrow_exception(fn_data.eptr);
  25216. if (res < 0)
  25217. exception::throw_last_error(saved_ctx);
  25218. return;
  25219. }
  25220. void union_set_list::foreach_scc(const std::function<bool(isl::union_set, isl::union_set)> &follows, const std::function<void(isl::union_set_list)> &fn) const
  25221. {
  25222. if (!ptr)
  25223. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25224. auto saved_ctx = ctx();
  25225. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25226. struct follows_data {
  25227. std::function<bool(isl::union_set, isl::union_set)> func;
  25228. std::exception_ptr eptr;
  25229. } follows_data = { follows };
  25230. auto follows_lambda = [](isl_union_set *arg_0, isl_union_set *arg_1, void *arg_2) -> isl_bool {
  25231. auto *data = static_cast<struct follows_data *>(arg_2);
  25232. ISL_CPP_TRY {
  25233. auto ret = (data->func)(manage_copy(arg_0), manage_copy(arg_1));
  25234. return ret ? isl_bool_true : isl_bool_false;
  25235. } ISL_CPP_CATCH_ALL {
  25236. data->eptr = std::current_exception();
  25237. return isl_bool_error;
  25238. }
  25239. };
  25240. struct fn_data {
  25241. std::function<void(isl::union_set_list)> func;
  25242. std::exception_ptr eptr;
  25243. } fn_data = { fn };
  25244. auto fn_lambda = [](isl_union_set_list *arg_0, void *arg_1) -> isl_stat {
  25245. auto *data = static_cast<struct fn_data *>(arg_1);
  25246. ISL_CPP_TRY {
  25247. (data->func)(manage(arg_0));
  25248. return isl_stat_ok;
  25249. } ISL_CPP_CATCH_ALL {
  25250. data->eptr = std::current_exception();
  25251. return isl_stat_error;
  25252. }
  25253. };
  25254. auto res = isl_union_set_list_foreach_scc(get(), follows_lambda, &follows_data, fn_lambda, &fn_data);
  25255. if (follows_data.eptr)
  25256. std::rethrow_exception(follows_data.eptr);
  25257. if (fn_data.eptr)
  25258. std::rethrow_exception(fn_data.eptr);
  25259. if (res < 0)
  25260. exception::throw_last_error(saved_ctx);
  25261. return;
  25262. }
  25263. isl::union_set_list union_set_list::insert(unsigned int pos, isl::union_set el) const
  25264. {
  25265. if (!ptr || el.is_null())
  25266. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25267. auto saved_ctx = ctx();
  25268. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25269. auto res = isl_union_set_list_insert(copy(), pos, el.release());
  25270. if (!res)
  25271. exception::throw_last_error(saved_ctx);
  25272. return manage(res);
  25273. }
  25274. unsigned union_set_list::size() const
  25275. {
  25276. if (!ptr)
  25277. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25278. auto saved_ctx = ctx();
  25279. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25280. auto res = isl_union_set_list_size(get());
  25281. if (res < 0)
  25282. exception::throw_last_error(saved_ctx);
  25283. return res;
  25284. }
  25285. inline std::ostream &operator<<(std::ostream &os, const union_set_list &obj)
  25286. {
  25287. if (!obj.get())
  25288. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25289. auto saved_ctx = isl_union_set_list_get_ctx(obj.get());
  25290. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25291. char *str = isl_union_set_list_to_str(obj.get());
  25292. if (!str)
  25293. exception::throw_last_error(saved_ctx);
  25294. os << str;
  25295. free(str);
  25296. return os;
  25297. }
  25298. // implementations for isl::val
  25299. val manage(__isl_take isl_val *ptr) {
  25300. if (!ptr)
  25301. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25302. return val(ptr);
  25303. }
  25304. val manage_copy(__isl_keep isl_val *ptr) {
  25305. if (!ptr)
  25306. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25307. auto saved_ctx = isl_val_get_ctx(ptr);
  25308. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25309. ptr = isl_val_copy(ptr);
  25310. if (!ptr)
  25311. exception::throw_last_error(saved_ctx);
  25312. return val(ptr);
  25313. }
  25314. val::val(__isl_take isl_val *ptr)
  25315. : ptr(ptr) {}
  25316. val::val()
  25317. : ptr(nullptr) {}
  25318. val::val(const val &obj)
  25319. : ptr(nullptr)
  25320. {
  25321. if (!obj.ptr)
  25322. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25323. auto saved_ctx = isl_val_get_ctx(obj.ptr);
  25324. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25325. ptr = obj.copy();
  25326. if (!ptr)
  25327. exception::throw_last_error(saved_ctx);
  25328. }
  25329. val::val(isl::ctx ctx, long i)
  25330. {
  25331. auto saved_ctx = ctx;
  25332. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25333. auto res = isl_val_int_from_si(ctx.release(), i);
  25334. if (!res)
  25335. exception::throw_last_error(saved_ctx);
  25336. ptr = res;
  25337. }
  25338. val::val(isl::ctx ctx, const std::string &str)
  25339. {
  25340. auto saved_ctx = ctx;
  25341. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25342. auto res = isl_val_read_from_str(ctx.release(), str.c_str());
  25343. if (!res)
  25344. exception::throw_last_error(saved_ctx);
  25345. ptr = res;
  25346. }
  25347. val &val::operator=(val obj) {
  25348. std::swap(this->ptr, obj.ptr);
  25349. return *this;
  25350. }
  25351. val::~val() {
  25352. if (ptr)
  25353. isl_val_free(ptr);
  25354. }
  25355. __isl_give isl_val *val::copy() const & {
  25356. return isl_val_copy(ptr);
  25357. }
  25358. __isl_keep isl_val *val::get() const {
  25359. return ptr;
  25360. }
  25361. __isl_give isl_val *val::release() {
  25362. isl_val *tmp = ptr;
  25363. ptr = nullptr;
  25364. return tmp;
  25365. }
  25366. bool val::is_null() const {
  25367. return ptr == nullptr;
  25368. }
  25369. isl::ctx val::ctx() const {
  25370. return isl::ctx(isl_val_get_ctx(ptr));
  25371. }
  25372. isl::val val::abs() const
  25373. {
  25374. if (!ptr)
  25375. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25376. auto saved_ctx = ctx();
  25377. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25378. auto res = isl_val_abs(copy());
  25379. if (!res)
  25380. exception::throw_last_error(saved_ctx);
  25381. return manage(res);
  25382. }
  25383. bool val::abs_eq(const isl::val &v2) const
  25384. {
  25385. if (!ptr || v2.is_null())
  25386. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25387. auto saved_ctx = ctx();
  25388. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25389. auto res = isl_val_abs_eq(get(), v2.get());
  25390. if (res < 0)
  25391. exception::throw_last_error(saved_ctx);
  25392. return res;
  25393. }
  25394. bool val::abs_eq(long v2) const
  25395. {
  25396. if (!ptr)
  25397. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25398. return this->abs_eq(isl::val(ctx(), v2));
  25399. }
  25400. isl::val val::add(isl::val v2) const
  25401. {
  25402. if (!ptr || v2.is_null())
  25403. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25404. auto saved_ctx = ctx();
  25405. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25406. auto res = isl_val_add(copy(), v2.release());
  25407. if (!res)
  25408. exception::throw_last_error(saved_ctx);
  25409. return manage(res);
  25410. }
  25411. isl::val val::add(long v2) const
  25412. {
  25413. if (!ptr)
  25414. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25415. return this->add(isl::val(ctx(), v2));
  25416. }
  25417. isl::val val::ceil() const
  25418. {
  25419. if (!ptr)
  25420. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25421. auto saved_ctx = ctx();
  25422. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25423. auto res = isl_val_ceil(copy());
  25424. if (!res)
  25425. exception::throw_last_error(saved_ctx);
  25426. return manage(res);
  25427. }
  25428. int val::cmp_si(long i) const
  25429. {
  25430. if (!ptr)
  25431. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25432. auto saved_ctx = ctx();
  25433. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25434. auto res = isl_val_cmp_si(get(), i);
  25435. return res;
  25436. }
  25437. long val::den_si() const
  25438. {
  25439. if (!ptr)
  25440. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25441. auto saved_ctx = ctx();
  25442. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25443. auto res = isl_val_get_den_si(get());
  25444. return res;
  25445. }
  25446. long val::get_den_si() const
  25447. {
  25448. return den_si();
  25449. }
  25450. isl::val val::div(isl::val v2) const
  25451. {
  25452. if (!ptr || v2.is_null())
  25453. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25454. auto saved_ctx = ctx();
  25455. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25456. auto res = isl_val_div(copy(), v2.release());
  25457. if (!res)
  25458. exception::throw_last_error(saved_ctx);
  25459. return manage(res);
  25460. }
  25461. isl::val val::div(long v2) const
  25462. {
  25463. if (!ptr)
  25464. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25465. return this->div(isl::val(ctx(), v2));
  25466. }
  25467. bool val::eq(const isl::val &v2) const
  25468. {
  25469. if (!ptr || v2.is_null())
  25470. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25471. auto saved_ctx = ctx();
  25472. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25473. auto res = isl_val_eq(get(), v2.get());
  25474. if (res < 0)
  25475. exception::throw_last_error(saved_ctx);
  25476. return res;
  25477. }
  25478. bool val::eq(long v2) const
  25479. {
  25480. if (!ptr)
  25481. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25482. return this->eq(isl::val(ctx(), v2));
  25483. }
  25484. isl::val val::floor() const
  25485. {
  25486. if (!ptr)
  25487. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25488. auto saved_ctx = ctx();
  25489. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25490. auto res = isl_val_floor(copy());
  25491. if (!res)
  25492. exception::throw_last_error(saved_ctx);
  25493. return manage(res);
  25494. }
  25495. isl::val val::gcd(isl::val v2) const
  25496. {
  25497. if (!ptr || v2.is_null())
  25498. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25499. auto saved_ctx = ctx();
  25500. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25501. auto res = isl_val_gcd(copy(), v2.release());
  25502. if (!res)
  25503. exception::throw_last_error(saved_ctx);
  25504. return manage(res);
  25505. }
  25506. isl::val val::gcd(long v2) const
  25507. {
  25508. if (!ptr)
  25509. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25510. return this->gcd(isl::val(ctx(), v2));
  25511. }
  25512. bool val::ge(const isl::val &v2) const
  25513. {
  25514. if (!ptr || v2.is_null())
  25515. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25516. auto saved_ctx = ctx();
  25517. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25518. auto res = isl_val_ge(get(), v2.get());
  25519. if (res < 0)
  25520. exception::throw_last_error(saved_ctx);
  25521. return res;
  25522. }
  25523. bool val::ge(long v2) const
  25524. {
  25525. if (!ptr)
  25526. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25527. return this->ge(isl::val(ctx(), v2));
  25528. }
  25529. bool val::gt(const isl::val &v2) const
  25530. {
  25531. if (!ptr || v2.is_null())
  25532. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25533. auto saved_ctx = ctx();
  25534. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25535. auto res = isl_val_gt(get(), v2.get());
  25536. if (res < 0)
  25537. exception::throw_last_error(saved_ctx);
  25538. return res;
  25539. }
  25540. bool val::gt(long v2) const
  25541. {
  25542. if (!ptr)
  25543. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25544. return this->gt(isl::val(ctx(), v2));
  25545. }
  25546. isl::val val::infty(isl::ctx ctx)
  25547. {
  25548. auto saved_ctx = ctx;
  25549. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25550. auto res = isl_val_infty(ctx.release());
  25551. if (!res)
  25552. exception::throw_last_error(saved_ctx);
  25553. return manage(res);
  25554. }
  25555. isl::val val::inv() const
  25556. {
  25557. if (!ptr)
  25558. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25559. auto saved_ctx = ctx();
  25560. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25561. auto res = isl_val_inv(copy());
  25562. if (!res)
  25563. exception::throw_last_error(saved_ctx);
  25564. return manage(res);
  25565. }
  25566. bool val::is_divisible_by(const isl::val &v2) const
  25567. {
  25568. if (!ptr || v2.is_null())
  25569. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25570. auto saved_ctx = ctx();
  25571. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25572. auto res = isl_val_is_divisible_by(get(), v2.get());
  25573. if (res < 0)
  25574. exception::throw_last_error(saved_ctx);
  25575. return res;
  25576. }
  25577. bool val::is_divisible_by(long v2) const
  25578. {
  25579. if (!ptr)
  25580. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25581. return this->is_divisible_by(isl::val(ctx(), v2));
  25582. }
  25583. bool val::is_infty() const
  25584. {
  25585. if (!ptr)
  25586. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25587. auto saved_ctx = ctx();
  25588. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25589. auto res = isl_val_is_infty(get());
  25590. if (res < 0)
  25591. exception::throw_last_error(saved_ctx);
  25592. return res;
  25593. }
  25594. bool val::is_int() const
  25595. {
  25596. if (!ptr)
  25597. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25598. auto saved_ctx = ctx();
  25599. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25600. auto res = isl_val_is_int(get());
  25601. if (res < 0)
  25602. exception::throw_last_error(saved_ctx);
  25603. return res;
  25604. }
  25605. bool val::is_nan() const
  25606. {
  25607. if (!ptr)
  25608. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25609. auto saved_ctx = ctx();
  25610. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25611. auto res = isl_val_is_nan(get());
  25612. if (res < 0)
  25613. exception::throw_last_error(saved_ctx);
  25614. return res;
  25615. }
  25616. bool val::is_neg() const
  25617. {
  25618. if (!ptr)
  25619. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25620. auto saved_ctx = ctx();
  25621. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25622. auto res = isl_val_is_neg(get());
  25623. if (res < 0)
  25624. exception::throw_last_error(saved_ctx);
  25625. return res;
  25626. }
  25627. bool val::is_neginfty() const
  25628. {
  25629. if (!ptr)
  25630. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25631. auto saved_ctx = ctx();
  25632. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25633. auto res = isl_val_is_neginfty(get());
  25634. if (res < 0)
  25635. exception::throw_last_error(saved_ctx);
  25636. return res;
  25637. }
  25638. bool val::is_negone() const
  25639. {
  25640. if (!ptr)
  25641. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25642. auto saved_ctx = ctx();
  25643. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25644. auto res = isl_val_is_negone(get());
  25645. if (res < 0)
  25646. exception::throw_last_error(saved_ctx);
  25647. return res;
  25648. }
  25649. bool val::is_nonneg() const
  25650. {
  25651. if (!ptr)
  25652. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25653. auto saved_ctx = ctx();
  25654. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25655. auto res = isl_val_is_nonneg(get());
  25656. if (res < 0)
  25657. exception::throw_last_error(saved_ctx);
  25658. return res;
  25659. }
  25660. bool val::is_nonpos() const
  25661. {
  25662. if (!ptr)
  25663. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25664. auto saved_ctx = ctx();
  25665. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25666. auto res = isl_val_is_nonpos(get());
  25667. if (res < 0)
  25668. exception::throw_last_error(saved_ctx);
  25669. return res;
  25670. }
  25671. bool val::is_one() const
  25672. {
  25673. if (!ptr)
  25674. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25675. auto saved_ctx = ctx();
  25676. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25677. auto res = isl_val_is_one(get());
  25678. if (res < 0)
  25679. exception::throw_last_error(saved_ctx);
  25680. return res;
  25681. }
  25682. bool val::is_pos() const
  25683. {
  25684. if (!ptr)
  25685. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25686. auto saved_ctx = ctx();
  25687. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25688. auto res = isl_val_is_pos(get());
  25689. if (res < 0)
  25690. exception::throw_last_error(saved_ctx);
  25691. return res;
  25692. }
  25693. bool val::is_rat() const
  25694. {
  25695. if (!ptr)
  25696. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25697. auto saved_ctx = ctx();
  25698. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25699. auto res = isl_val_is_rat(get());
  25700. if (res < 0)
  25701. exception::throw_last_error(saved_ctx);
  25702. return res;
  25703. }
  25704. bool val::is_zero() const
  25705. {
  25706. if (!ptr)
  25707. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25708. auto saved_ctx = ctx();
  25709. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25710. auto res = isl_val_is_zero(get());
  25711. if (res < 0)
  25712. exception::throw_last_error(saved_ctx);
  25713. return res;
  25714. }
  25715. bool val::le(const isl::val &v2) const
  25716. {
  25717. if (!ptr || v2.is_null())
  25718. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25719. auto saved_ctx = ctx();
  25720. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25721. auto res = isl_val_le(get(), v2.get());
  25722. if (res < 0)
  25723. exception::throw_last_error(saved_ctx);
  25724. return res;
  25725. }
  25726. bool val::le(long v2) const
  25727. {
  25728. if (!ptr)
  25729. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25730. return this->le(isl::val(ctx(), v2));
  25731. }
  25732. bool val::lt(const isl::val &v2) const
  25733. {
  25734. if (!ptr || v2.is_null())
  25735. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25736. auto saved_ctx = ctx();
  25737. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25738. auto res = isl_val_lt(get(), v2.get());
  25739. if (res < 0)
  25740. exception::throw_last_error(saved_ctx);
  25741. return res;
  25742. }
  25743. bool val::lt(long v2) const
  25744. {
  25745. if (!ptr)
  25746. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25747. return this->lt(isl::val(ctx(), v2));
  25748. }
  25749. isl::val val::max(isl::val v2) const
  25750. {
  25751. if (!ptr || v2.is_null())
  25752. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25753. auto saved_ctx = ctx();
  25754. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25755. auto res = isl_val_max(copy(), v2.release());
  25756. if (!res)
  25757. exception::throw_last_error(saved_ctx);
  25758. return manage(res);
  25759. }
  25760. isl::val val::max(long v2) const
  25761. {
  25762. if (!ptr)
  25763. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25764. return this->max(isl::val(ctx(), v2));
  25765. }
  25766. isl::val val::min(isl::val v2) const
  25767. {
  25768. if (!ptr || v2.is_null())
  25769. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25770. auto saved_ctx = ctx();
  25771. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25772. auto res = isl_val_min(copy(), v2.release());
  25773. if (!res)
  25774. exception::throw_last_error(saved_ctx);
  25775. return manage(res);
  25776. }
  25777. isl::val val::min(long v2) const
  25778. {
  25779. if (!ptr)
  25780. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25781. return this->min(isl::val(ctx(), v2));
  25782. }
  25783. isl::val val::mod(isl::val v2) const
  25784. {
  25785. if (!ptr || v2.is_null())
  25786. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25787. auto saved_ctx = ctx();
  25788. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25789. auto res = isl_val_mod(copy(), v2.release());
  25790. if (!res)
  25791. exception::throw_last_error(saved_ctx);
  25792. return manage(res);
  25793. }
  25794. isl::val val::mod(long v2) const
  25795. {
  25796. if (!ptr)
  25797. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25798. return this->mod(isl::val(ctx(), v2));
  25799. }
  25800. isl::val val::mul(isl::val v2) const
  25801. {
  25802. if (!ptr || v2.is_null())
  25803. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25804. auto saved_ctx = ctx();
  25805. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25806. auto res = isl_val_mul(copy(), v2.release());
  25807. if (!res)
  25808. exception::throw_last_error(saved_ctx);
  25809. return manage(res);
  25810. }
  25811. isl::val val::mul(long v2) const
  25812. {
  25813. if (!ptr)
  25814. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25815. return this->mul(isl::val(ctx(), v2));
  25816. }
  25817. isl::val val::nan(isl::ctx ctx)
  25818. {
  25819. auto saved_ctx = ctx;
  25820. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25821. auto res = isl_val_nan(ctx.release());
  25822. if (!res)
  25823. exception::throw_last_error(saved_ctx);
  25824. return manage(res);
  25825. }
  25826. bool val::ne(const isl::val &v2) const
  25827. {
  25828. if (!ptr || v2.is_null())
  25829. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25830. auto saved_ctx = ctx();
  25831. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25832. auto res = isl_val_ne(get(), v2.get());
  25833. if (res < 0)
  25834. exception::throw_last_error(saved_ctx);
  25835. return res;
  25836. }
  25837. bool val::ne(long v2) const
  25838. {
  25839. if (!ptr)
  25840. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25841. return this->ne(isl::val(ctx(), v2));
  25842. }
  25843. isl::val val::neg() const
  25844. {
  25845. if (!ptr)
  25846. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25847. auto saved_ctx = ctx();
  25848. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25849. auto res = isl_val_neg(copy());
  25850. if (!res)
  25851. exception::throw_last_error(saved_ctx);
  25852. return manage(res);
  25853. }
  25854. isl::val val::neginfty(isl::ctx ctx)
  25855. {
  25856. auto saved_ctx = ctx;
  25857. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25858. auto res = isl_val_neginfty(ctx.release());
  25859. if (!res)
  25860. exception::throw_last_error(saved_ctx);
  25861. return manage(res);
  25862. }
  25863. isl::val val::negone(isl::ctx ctx)
  25864. {
  25865. auto saved_ctx = ctx;
  25866. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25867. auto res = isl_val_negone(ctx.release());
  25868. if (!res)
  25869. exception::throw_last_error(saved_ctx);
  25870. return manage(res);
  25871. }
  25872. long val::num_si() const
  25873. {
  25874. if (!ptr)
  25875. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25876. auto saved_ctx = ctx();
  25877. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25878. auto res = isl_val_get_num_si(get());
  25879. return res;
  25880. }
  25881. long val::get_num_si() const
  25882. {
  25883. return num_si();
  25884. }
  25885. isl::val val::one(isl::ctx ctx)
  25886. {
  25887. auto saved_ctx = ctx;
  25888. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25889. auto res = isl_val_one(ctx.release());
  25890. if (!res)
  25891. exception::throw_last_error(saved_ctx);
  25892. return manage(res);
  25893. }
  25894. isl::val val::pow2() const
  25895. {
  25896. if (!ptr)
  25897. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25898. auto saved_ctx = ctx();
  25899. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25900. auto res = isl_val_pow2(copy());
  25901. if (!res)
  25902. exception::throw_last_error(saved_ctx);
  25903. return manage(res);
  25904. }
  25905. int val::sgn() const
  25906. {
  25907. if (!ptr)
  25908. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25909. auto saved_ctx = ctx();
  25910. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25911. auto res = isl_val_sgn(get());
  25912. return res;
  25913. }
  25914. isl::val val::sub(isl::val v2) const
  25915. {
  25916. if (!ptr || v2.is_null())
  25917. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25918. auto saved_ctx = ctx();
  25919. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25920. auto res = isl_val_sub(copy(), v2.release());
  25921. if (!res)
  25922. exception::throw_last_error(saved_ctx);
  25923. return manage(res);
  25924. }
  25925. isl::val val::sub(long v2) const
  25926. {
  25927. if (!ptr)
  25928. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25929. return this->sub(isl::val(ctx(), v2));
  25930. }
  25931. isl::val_list val::to_list() const
  25932. {
  25933. if (!ptr)
  25934. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25935. auto saved_ctx = ctx();
  25936. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25937. auto res = isl_val_to_list(copy());
  25938. if (!res)
  25939. exception::throw_last_error(saved_ctx);
  25940. return manage(res);
  25941. }
  25942. isl::val val::trunc() const
  25943. {
  25944. if (!ptr)
  25945. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25946. auto saved_ctx = ctx();
  25947. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25948. auto res = isl_val_trunc(copy());
  25949. if (!res)
  25950. exception::throw_last_error(saved_ctx);
  25951. return manage(res);
  25952. }
  25953. isl::val val::zero(isl::ctx ctx)
  25954. {
  25955. auto saved_ctx = ctx;
  25956. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25957. auto res = isl_val_zero(ctx.release());
  25958. if (!res)
  25959. exception::throw_last_error(saved_ctx);
  25960. return manage(res);
  25961. }
  25962. inline std::ostream &operator<<(std::ostream &os, const val &obj)
  25963. {
  25964. if (!obj.get())
  25965. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25966. auto saved_ctx = isl_val_get_ctx(obj.get());
  25967. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25968. char *str = isl_val_to_str(obj.get());
  25969. if (!str)
  25970. exception::throw_last_error(saved_ctx);
  25971. os << str;
  25972. free(str);
  25973. return os;
  25974. }
  25975. // implementations for isl::val_list
  25976. val_list manage(__isl_take isl_val_list *ptr) {
  25977. if (!ptr)
  25978. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25979. return val_list(ptr);
  25980. }
  25981. val_list manage_copy(__isl_keep isl_val_list *ptr) {
  25982. if (!ptr)
  25983. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  25984. auto saved_ctx = isl_val_list_get_ctx(ptr);
  25985. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  25986. ptr = isl_val_list_copy(ptr);
  25987. if (!ptr)
  25988. exception::throw_last_error(saved_ctx);
  25989. return val_list(ptr);
  25990. }
  25991. val_list::val_list(__isl_take isl_val_list *ptr)
  25992. : ptr(ptr) {}
  25993. val_list::val_list()
  25994. : ptr(nullptr) {}
  25995. val_list::val_list(const val_list &obj)
  25996. : ptr(nullptr)
  25997. {
  25998. if (!obj.ptr)
  25999. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  26000. auto saved_ctx = isl_val_list_get_ctx(obj.ptr);
  26001. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  26002. ptr = obj.copy();
  26003. if (!ptr)
  26004. exception::throw_last_error(saved_ctx);
  26005. }
  26006. val_list::val_list(isl::ctx ctx, int n)
  26007. {
  26008. auto saved_ctx = ctx;
  26009. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  26010. auto res = isl_val_list_alloc(ctx.release(), n);
  26011. if (!res)
  26012. exception::throw_last_error(saved_ctx);
  26013. ptr = res;
  26014. }
  26015. val_list::val_list(isl::val el)
  26016. {
  26017. if (el.is_null())
  26018. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  26019. auto saved_ctx = el.ctx();
  26020. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  26021. auto res = isl_val_list_from_val(el.release());
  26022. if (!res)
  26023. exception::throw_last_error(saved_ctx);
  26024. ptr = res;
  26025. }
  26026. val_list::val_list(isl::ctx ctx, const std::string &str)
  26027. {
  26028. auto saved_ctx = ctx;
  26029. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  26030. auto res = isl_val_list_read_from_str(ctx.release(), str.c_str());
  26031. if (!res)
  26032. exception::throw_last_error(saved_ctx);
  26033. ptr = res;
  26034. }
  26035. val_list &val_list::operator=(val_list obj) {
  26036. std::swap(this->ptr, obj.ptr);
  26037. return *this;
  26038. }
  26039. val_list::~val_list() {
  26040. if (ptr)
  26041. isl_val_list_free(ptr);
  26042. }
  26043. __isl_give isl_val_list *val_list::copy() const & {
  26044. return isl_val_list_copy(ptr);
  26045. }
  26046. __isl_keep isl_val_list *val_list::get() const {
  26047. return ptr;
  26048. }
  26049. __isl_give isl_val_list *val_list::release() {
  26050. isl_val_list *tmp = ptr;
  26051. ptr = nullptr;
  26052. return tmp;
  26053. }
  26054. bool val_list::is_null() const {
  26055. return ptr == nullptr;
  26056. }
  26057. isl::ctx val_list::ctx() const {
  26058. return isl::ctx(isl_val_list_get_ctx(ptr));
  26059. }
  26060. isl::val_list val_list::add(isl::val el) const
  26061. {
  26062. if (!ptr || el.is_null())
  26063. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  26064. auto saved_ctx = ctx();
  26065. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  26066. auto res = isl_val_list_add(copy(), el.release());
  26067. if (!res)
  26068. exception::throw_last_error(saved_ctx);
  26069. return manage(res);
  26070. }
  26071. isl::val_list val_list::add(long el) const
  26072. {
  26073. if (!ptr)
  26074. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  26075. return this->add(isl::val(ctx(), el));
  26076. }
  26077. isl::val val_list::at(int index) const
  26078. {
  26079. if (!ptr)
  26080. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  26081. auto saved_ctx = ctx();
  26082. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  26083. auto res = isl_val_list_get_at(get(), index);
  26084. if (!res)
  26085. exception::throw_last_error(saved_ctx);
  26086. return manage(res);
  26087. }
  26088. isl::val val_list::get_at(int index) const
  26089. {
  26090. return at(index);
  26091. }
  26092. isl::val_list val_list::clear() const
  26093. {
  26094. if (!ptr)
  26095. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  26096. auto saved_ctx = ctx();
  26097. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  26098. auto res = isl_val_list_clear(copy());
  26099. if (!res)
  26100. exception::throw_last_error(saved_ctx);
  26101. return manage(res);
  26102. }
  26103. isl::val_list val_list::concat(isl::val_list list2) const
  26104. {
  26105. if (!ptr || list2.is_null())
  26106. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  26107. auto saved_ctx = ctx();
  26108. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  26109. auto res = isl_val_list_concat(copy(), list2.release());
  26110. if (!res)
  26111. exception::throw_last_error(saved_ctx);
  26112. return manage(res);
  26113. }
  26114. isl::val_list val_list::drop(unsigned int first, unsigned int n) const
  26115. {
  26116. if (!ptr)
  26117. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  26118. auto saved_ctx = ctx();
  26119. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  26120. auto res = isl_val_list_drop(copy(), first, n);
  26121. if (!res)
  26122. exception::throw_last_error(saved_ctx);
  26123. return manage(res);
  26124. }
  26125. void val_list::foreach(const std::function<void(isl::val)> &fn) const
  26126. {
  26127. if (!ptr)
  26128. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  26129. auto saved_ctx = ctx();
  26130. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  26131. struct fn_data {
  26132. std::function<void(isl::val)> func;
  26133. std::exception_ptr eptr;
  26134. } fn_data = { fn };
  26135. auto fn_lambda = [](isl_val *arg_0, void *arg_1) -> isl_stat {
  26136. auto *data = static_cast<struct fn_data *>(arg_1);
  26137. ISL_CPP_TRY {
  26138. (data->func)(manage(arg_0));
  26139. return isl_stat_ok;
  26140. } ISL_CPP_CATCH_ALL {
  26141. data->eptr = std::current_exception();
  26142. return isl_stat_error;
  26143. }
  26144. };
  26145. auto res = isl_val_list_foreach(get(), fn_lambda, &fn_data);
  26146. if (fn_data.eptr)
  26147. std::rethrow_exception(fn_data.eptr);
  26148. if (res < 0)
  26149. exception::throw_last_error(saved_ctx);
  26150. return;
  26151. }
  26152. void val_list::foreach_scc(const std::function<bool(isl::val, isl::val)> &follows, const std::function<void(isl::val_list)> &fn) const
  26153. {
  26154. if (!ptr)
  26155. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  26156. auto saved_ctx = ctx();
  26157. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  26158. struct follows_data {
  26159. std::function<bool(isl::val, isl::val)> func;
  26160. std::exception_ptr eptr;
  26161. } follows_data = { follows };
  26162. auto follows_lambda = [](isl_val *arg_0, isl_val *arg_1, void *arg_2) -> isl_bool {
  26163. auto *data = static_cast<struct follows_data *>(arg_2);
  26164. ISL_CPP_TRY {
  26165. auto ret = (data->func)(manage_copy(arg_0), manage_copy(arg_1));
  26166. return ret ? isl_bool_true : isl_bool_false;
  26167. } ISL_CPP_CATCH_ALL {
  26168. data->eptr = std::current_exception();
  26169. return isl_bool_error;
  26170. }
  26171. };
  26172. struct fn_data {
  26173. std::function<void(isl::val_list)> func;
  26174. std::exception_ptr eptr;
  26175. } fn_data = { fn };
  26176. auto fn_lambda = [](isl_val_list *arg_0, void *arg_1) -> isl_stat {
  26177. auto *data = static_cast<struct fn_data *>(arg_1);
  26178. ISL_CPP_TRY {
  26179. (data->func)(manage(arg_0));
  26180. return isl_stat_ok;
  26181. } ISL_CPP_CATCH_ALL {
  26182. data->eptr = std::current_exception();
  26183. return isl_stat_error;
  26184. }
  26185. };
  26186. auto res = isl_val_list_foreach_scc(get(), follows_lambda, &follows_data, fn_lambda, &fn_data);
  26187. if (follows_data.eptr)
  26188. std::rethrow_exception(follows_data.eptr);
  26189. if (fn_data.eptr)
  26190. std::rethrow_exception(fn_data.eptr);
  26191. if (res < 0)
  26192. exception::throw_last_error(saved_ctx);
  26193. return;
  26194. }
  26195. isl::val_list val_list::insert(unsigned int pos, isl::val el) const
  26196. {
  26197. if (!ptr || el.is_null())
  26198. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  26199. auto saved_ctx = ctx();
  26200. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  26201. auto res = isl_val_list_insert(copy(), pos, el.release());
  26202. if (!res)
  26203. exception::throw_last_error(saved_ctx);
  26204. return manage(res);
  26205. }
  26206. isl::val_list val_list::insert(unsigned int pos, long el) const
  26207. {
  26208. if (!ptr)
  26209. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  26210. return this->insert(pos, isl::val(ctx(), el));
  26211. }
  26212. unsigned val_list::size() const
  26213. {
  26214. if (!ptr)
  26215. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  26216. auto saved_ctx = ctx();
  26217. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  26218. auto res = isl_val_list_size(get());
  26219. if (res < 0)
  26220. exception::throw_last_error(saved_ctx);
  26221. return res;
  26222. }
  26223. inline std::ostream &operator<<(std::ostream &os, const val_list &obj)
  26224. {
  26225. if (!obj.get())
  26226. exception::throw_invalid("NULL input", __FILE__, __LINE__);
  26227. auto saved_ctx = isl_val_list_get_ctx(obj.get());
  26228. options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
  26229. char *str = isl_val_list_to_str(obj.get());
  26230. if (!str)
  26231. exception::throw_last_error(saved_ctx);
  26232. os << str;
  26233. free(str);
  26234. return os;
  26235. }
  26236. } // namespace isl
  26237. #endif /* ISL_CPP */