bbox.c 342 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649
  1. /* Generated by Cython 0.29.6 */
  2. #define PY_SSIZE_T_CLEAN
  3. #include "Python.h"
  4. #ifndef Py_PYTHON_H
  5. #error Python headers needed to compile C extensions, please install development version of Python.
  6. #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
  7. #error Cython requires Python 2.6+ or Python 3.3+.
  8. #else
  9. #define CYTHON_ABI "0_29_6"
  10. #define CYTHON_HEX_VERSION 0x001D06F0
  11. #define CYTHON_FUTURE_DIVISION 0
  12. #include <stddef.h>
  13. #ifndef offsetof
  14. #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
  15. #endif
  16. #if !defined(WIN32) && !defined(MS_WINDOWS)
  17. #ifndef __stdcall
  18. #define __stdcall
  19. #endif
  20. #ifndef __cdecl
  21. #define __cdecl
  22. #endif
  23. #ifndef __fastcall
  24. #define __fastcall
  25. #endif
  26. #endif
  27. #ifndef DL_IMPORT
  28. #define DL_IMPORT(t) t
  29. #endif
  30. #ifndef DL_EXPORT
  31. #define DL_EXPORT(t) t
  32. #endif
  33. #define __PYX_COMMA ,
  34. #ifndef HAVE_LONG_LONG
  35. #if PY_VERSION_HEX >= 0x02070000
  36. #define HAVE_LONG_LONG
  37. #endif
  38. #endif
  39. #ifndef PY_LONG_LONG
  40. #define PY_LONG_LONG LONG_LONG
  41. #endif
  42. #ifndef Py_HUGE_VAL
  43. #define Py_HUGE_VAL HUGE_VAL
  44. #endif
  45. #ifdef PYPY_VERSION
  46. #define CYTHON_COMPILING_IN_PYPY 1
  47. #define CYTHON_COMPILING_IN_PYSTON 0
  48. #define CYTHON_COMPILING_IN_CPYTHON 0
  49. #undef CYTHON_USE_TYPE_SLOTS
  50. #define CYTHON_USE_TYPE_SLOTS 0
  51. #undef CYTHON_USE_PYTYPE_LOOKUP
  52. #define CYTHON_USE_PYTYPE_LOOKUP 0
  53. #if PY_VERSION_HEX < 0x03050000
  54. #undef CYTHON_USE_ASYNC_SLOTS
  55. #define CYTHON_USE_ASYNC_SLOTS 0
  56. #elif !defined(CYTHON_USE_ASYNC_SLOTS)
  57. #define CYTHON_USE_ASYNC_SLOTS 1
  58. #endif
  59. #undef CYTHON_USE_PYLIST_INTERNALS
  60. #define CYTHON_USE_PYLIST_INTERNALS 0
  61. #undef CYTHON_USE_UNICODE_INTERNALS
  62. #define CYTHON_USE_UNICODE_INTERNALS 0
  63. #undef CYTHON_USE_UNICODE_WRITER
  64. #define CYTHON_USE_UNICODE_WRITER 0
  65. #undef CYTHON_USE_PYLONG_INTERNALS
  66. #define CYTHON_USE_PYLONG_INTERNALS 0
  67. #undef CYTHON_AVOID_BORROWED_REFS
  68. #define CYTHON_AVOID_BORROWED_REFS 1
  69. #undef CYTHON_ASSUME_SAFE_MACROS
  70. #define CYTHON_ASSUME_SAFE_MACROS 0
  71. #undef CYTHON_UNPACK_METHODS
  72. #define CYTHON_UNPACK_METHODS 0
  73. #undef CYTHON_FAST_THREAD_STATE
  74. #define CYTHON_FAST_THREAD_STATE 0
  75. #undef CYTHON_FAST_PYCALL
  76. #define CYTHON_FAST_PYCALL 0
  77. #undef CYTHON_PEP489_MULTI_PHASE_INIT
  78. #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  79. #undef CYTHON_USE_TP_FINALIZE
  80. #define CYTHON_USE_TP_FINALIZE 0
  81. #undef CYTHON_USE_DICT_VERSIONS
  82. #define CYTHON_USE_DICT_VERSIONS 0
  83. #undef CYTHON_USE_EXC_INFO_STACK
  84. #define CYTHON_USE_EXC_INFO_STACK 0
  85. #elif defined(PYSTON_VERSION)
  86. #define CYTHON_COMPILING_IN_PYPY 0
  87. #define CYTHON_COMPILING_IN_PYSTON 1
  88. #define CYTHON_COMPILING_IN_CPYTHON 0
  89. #ifndef CYTHON_USE_TYPE_SLOTS
  90. #define CYTHON_USE_TYPE_SLOTS 1
  91. #endif
  92. #undef CYTHON_USE_PYTYPE_LOOKUP
  93. #define CYTHON_USE_PYTYPE_LOOKUP 0
  94. #undef CYTHON_USE_ASYNC_SLOTS
  95. #define CYTHON_USE_ASYNC_SLOTS 0
  96. #undef CYTHON_USE_PYLIST_INTERNALS
  97. #define CYTHON_USE_PYLIST_INTERNALS 0
  98. #ifndef CYTHON_USE_UNICODE_INTERNALS
  99. #define CYTHON_USE_UNICODE_INTERNALS 1
  100. #endif
  101. #undef CYTHON_USE_UNICODE_WRITER
  102. #define CYTHON_USE_UNICODE_WRITER 0
  103. #undef CYTHON_USE_PYLONG_INTERNALS
  104. #define CYTHON_USE_PYLONG_INTERNALS 0
  105. #ifndef CYTHON_AVOID_BORROWED_REFS
  106. #define CYTHON_AVOID_BORROWED_REFS 0
  107. #endif
  108. #ifndef CYTHON_ASSUME_SAFE_MACROS
  109. #define CYTHON_ASSUME_SAFE_MACROS 1
  110. #endif
  111. #ifndef CYTHON_UNPACK_METHODS
  112. #define CYTHON_UNPACK_METHODS 1
  113. #endif
  114. #undef CYTHON_FAST_THREAD_STATE
  115. #define CYTHON_FAST_THREAD_STATE 0
  116. #undef CYTHON_FAST_PYCALL
  117. #define CYTHON_FAST_PYCALL 0
  118. #undef CYTHON_PEP489_MULTI_PHASE_INIT
  119. #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  120. #undef CYTHON_USE_TP_FINALIZE
  121. #define CYTHON_USE_TP_FINALIZE 0
  122. #undef CYTHON_USE_DICT_VERSIONS
  123. #define CYTHON_USE_DICT_VERSIONS 0
  124. #undef CYTHON_USE_EXC_INFO_STACK
  125. #define CYTHON_USE_EXC_INFO_STACK 0
  126. #else
  127. #define CYTHON_COMPILING_IN_PYPY 0
  128. #define CYTHON_COMPILING_IN_PYSTON 0
  129. #define CYTHON_COMPILING_IN_CPYTHON 1
  130. #ifndef CYTHON_USE_TYPE_SLOTS
  131. #define CYTHON_USE_TYPE_SLOTS 1
  132. #endif
  133. #if PY_VERSION_HEX < 0x02070000
  134. #undef CYTHON_USE_PYTYPE_LOOKUP
  135. #define CYTHON_USE_PYTYPE_LOOKUP 0
  136. #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
  137. #define CYTHON_USE_PYTYPE_LOOKUP 1
  138. #endif
  139. #if PY_MAJOR_VERSION < 3
  140. #undef CYTHON_USE_ASYNC_SLOTS
  141. #define CYTHON_USE_ASYNC_SLOTS 0
  142. #elif !defined(CYTHON_USE_ASYNC_SLOTS)
  143. #define CYTHON_USE_ASYNC_SLOTS 1
  144. #endif
  145. #if PY_VERSION_HEX < 0x02070000
  146. #undef CYTHON_USE_PYLONG_INTERNALS
  147. #define CYTHON_USE_PYLONG_INTERNALS 0
  148. #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
  149. #define CYTHON_USE_PYLONG_INTERNALS 1
  150. #endif
  151. #ifndef CYTHON_USE_PYLIST_INTERNALS
  152. #define CYTHON_USE_PYLIST_INTERNALS 1
  153. #endif
  154. #ifndef CYTHON_USE_UNICODE_INTERNALS
  155. #define CYTHON_USE_UNICODE_INTERNALS 1
  156. #endif
  157. #if PY_VERSION_HEX < 0x030300F0
  158. #undef CYTHON_USE_UNICODE_WRITER
  159. #define CYTHON_USE_UNICODE_WRITER 0
  160. #elif !defined(CYTHON_USE_UNICODE_WRITER)
  161. #define CYTHON_USE_UNICODE_WRITER 1
  162. #endif
  163. #ifndef CYTHON_AVOID_BORROWED_REFS
  164. #define CYTHON_AVOID_BORROWED_REFS 0
  165. #endif
  166. #ifndef CYTHON_ASSUME_SAFE_MACROS
  167. #define CYTHON_ASSUME_SAFE_MACROS 1
  168. #endif
  169. #ifndef CYTHON_UNPACK_METHODS
  170. #define CYTHON_UNPACK_METHODS 1
  171. #endif
  172. #ifndef CYTHON_FAST_THREAD_STATE
  173. #define CYTHON_FAST_THREAD_STATE 1
  174. #endif
  175. #ifndef CYTHON_FAST_PYCALL
  176. #define CYTHON_FAST_PYCALL 1
  177. #endif
  178. #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
  179. #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
  180. #endif
  181. #ifndef CYTHON_USE_TP_FINALIZE
  182. #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
  183. #endif
  184. #ifndef CYTHON_USE_DICT_VERSIONS
  185. #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
  186. #endif
  187. #ifndef CYTHON_USE_EXC_INFO_STACK
  188. #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
  189. #endif
  190. #endif
  191. #if !defined(CYTHON_FAST_PYCCALL)
  192. #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
  193. #endif
  194. #if CYTHON_USE_PYLONG_INTERNALS
  195. #include "longintrepr.h"
  196. #undef SHIFT
  197. #undef BASE
  198. #undef MASK
  199. #ifdef SIZEOF_VOID_P
  200. enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  201. #endif
  202. #endif
  203. #ifndef __has_attribute
  204. #define __has_attribute(x) 0
  205. #endif
  206. #ifndef __has_cpp_attribute
  207. #define __has_cpp_attribute(x) 0
  208. #endif
  209. #ifndef CYTHON_RESTRICT
  210. #if defined(__GNUC__)
  211. #define CYTHON_RESTRICT __restrict__
  212. #elif defined(_MSC_VER) && _MSC_VER >= 1400
  213. #define CYTHON_RESTRICT __restrict
  214. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  215. #define CYTHON_RESTRICT restrict
  216. #else
  217. #define CYTHON_RESTRICT
  218. #endif
  219. #endif
  220. #ifndef CYTHON_UNUSED
  221. # if defined(__GNUC__)
  222. # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  223. # define CYTHON_UNUSED __attribute__ ((__unused__))
  224. # else
  225. # define CYTHON_UNUSED
  226. # endif
  227. # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
  228. # define CYTHON_UNUSED __attribute__ ((__unused__))
  229. # else
  230. # define CYTHON_UNUSED
  231. # endif
  232. #endif
  233. #ifndef CYTHON_MAYBE_UNUSED_VAR
  234. # if defined(__cplusplus)
  235. template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
  236. # else
  237. # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
  238. # endif
  239. #endif
  240. #ifndef CYTHON_NCP_UNUSED
  241. # if CYTHON_COMPILING_IN_CPYTHON
  242. # define CYTHON_NCP_UNUSED
  243. # else
  244. # define CYTHON_NCP_UNUSED CYTHON_UNUSED
  245. # endif
  246. #endif
  247. #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
  248. #ifdef _MSC_VER
  249. #ifndef _MSC_STDINT_H_
  250. #if _MSC_VER < 1300
  251. typedef unsigned char uint8_t;
  252. typedef unsigned int uint32_t;
  253. #else
  254. typedef unsigned __int8 uint8_t;
  255. typedef unsigned __int32 uint32_t;
  256. #endif
  257. #endif
  258. #else
  259. #include <stdint.h>
  260. #endif
  261. #ifndef CYTHON_FALLTHROUGH
  262. #if defined(__cplusplus) && __cplusplus >= 201103L
  263. #if __has_cpp_attribute(fallthrough)
  264. #define CYTHON_FALLTHROUGH [[fallthrough]]
  265. #elif __has_cpp_attribute(clang::fallthrough)
  266. #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
  267. #elif __has_cpp_attribute(gnu::fallthrough)
  268. #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
  269. #endif
  270. #endif
  271. #ifndef CYTHON_FALLTHROUGH
  272. #if __has_attribute(fallthrough)
  273. #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
  274. #else
  275. #define CYTHON_FALLTHROUGH
  276. #endif
  277. #endif
  278. #if defined(__clang__ ) && defined(__apple_build_version__)
  279. #if __apple_build_version__ < 7000000
  280. #undef CYTHON_FALLTHROUGH
  281. #define CYTHON_FALLTHROUGH
  282. #endif
  283. #endif
  284. #endif
  285. #ifndef CYTHON_INLINE
  286. #if defined(__clang__)
  287. #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  288. #elif defined(__GNUC__)
  289. #define CYTHON_INLINE __inline__
  290. #elif defined(_MSC_VER)
  291. #define CYTHON_INLINE __inline
  292. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  293. #define CYTHON_INLINE inline
  294. #else
  295. #define CYTHON_INLINE
  296. #endif
  297. #endif
  298. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  299. #define Py_OptimizeFlag 0
  300. #endif
  301. #define __PYX_BUILD_PY_SSIZE_T "n"
  302. #define CYTHON_FORMAT_SSIZE_T "z"
  303. #if PY_MAJOR_VERSION < 3
  304. #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  305. #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  306. PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  307. #define __Pyx_DefaultClassType PyClass_Type
  308. #else
  309. #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  310. #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  311. PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  312. #define __Pyx_DefaultClassType PyType_Type
  313. #endif
  314. #ifndef Py_TPFLAGS_CHECKTYPES
  315. #define Py_TPFLAGS_CHECKTYPES 0
  316. #endif
  317. #ifndef Py_TPFLAGS_HAVE_INDEX
  318. #define Py_TPFLAGS_HAVE_INDEX 0
  319. #endif
  320. #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  321. #define Py_TPFLAGS_HAVE_NEWBUFFER 0
  322. #endif
  323. #ifndef Py_TPFLAGS_HAVE_FINALIZE
  324. #define Py_TPFLAGS_HAVE_FINALIZE 0
  325. #endif
  326. #ifndef METH_STACKLESS
  327. #define METH_STACKLESS 0
  328. #endif
  329. #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
  330. #ifndef METH_FASTCALL
  331. #define METH_FASTCALL 0x80
  332. #endif
  333. typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  334. typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
  335. Py_ssize_t nargs, PyObject *kwnames);
  336. #else
  337. #define __Pyx_PyCFunctionFast _PyCFunctionFast
  338. #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
  339. #endif
  340. #if CYTHON_FAST_PYCCALL
  341. #define __Pyx_PyFastCFunction_Check(func)\
  342. ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
  343. #else
  344. #define __Pyx_PyFastCFunction_Check(func) 0
  345. #endif
  346. #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  347. #define PyObject_Malloc(s) PyMem_Malloc(s)
  348. #define PyObject_Free(p) PyMem_Free(p)
  349. #define PyObject_Realloc(p) PyMem_Realloc(p)
  350. #endif
  351. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
  352. #define PyMem_RawMalloc(n) PyMem_Malloc(n)
  353. #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
  354. #define PyMem_RawFree(p) PyMem_Free(p)
  355. #endif
  356. #if CYTHON_COMPILING_IN_PYSTON
  357. #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
  358. #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
  359. #else
  360. #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
  361. #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
  362. #endif
  363. #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
  364. #define __Pyx_PyThreadState_Current PyThreadState_GET()
  365. #elif PY_VERSION_HEX >= 0x03060000
  366. #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
  367. #elif PY_VERSION_HEX >= 0x03000000
  368. #define __Pyx_PyThreadState_Current PyThreadState_GET()
  369. #else
  370. #define __Pyx_PyThreadState_Current _PyThreadState_Current
  371. #endif
  372. #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
  373. #include "pythread.h"
  374. #define Py_tss_NEEDS_INIT 0
  375. typedef int Py_tss_t;
  376. static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  377. *key = PyThread_create_key();
  378. return 0;
  379. }
  380. static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  381. Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  382. *key = Py_tss_NEEDS_INIT;
  383. return key;
  384. }
  385. static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  386. PyObject_Free(key);
  387. }
  388. static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  389. return *key != Py_tss_NEEDS_INIT;
  390. }
  391. static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  392. PyThread_delete_key(*key);
  393. *key = Py_tss_NEEDS_INIT;
  394. }
  395. static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  396. return PyThread_set_key_value(*key, value);
  397. }
  398. static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  399. return PyThread_get_key_value(*key);
  400. }
  401. #endif
  402. #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
  403. #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
  404. #else
  405. #define __Pyx_PyDict_NewPresized(n) PyDict_New()
  406. #endif
  407. #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  408. #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
  409. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
  410. #else
  411. #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
  412. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
  413. #endif
  414. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
  415. #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
  416. #else
  417. #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
  418. #endif
  419. #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  420. #define CYTHON_PEP393_ENABLED 1
  421. #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
  422. 0 : _PyUnicode_Ready((PyObject *)(op)))
  423. #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
  424. #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  425. #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
  426. #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
  427. #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
  428. #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
  429. #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
  430. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
  431. #else
  432. #define CYTHON_PEP393_ENABLED 0
  433. #define PyUnicode_1BYTE_KIND 1
  434. #define PyUnicode_2BYTE_KIND 2
  435. #define PyUnicode_4BYTE_KIND 4
  436. #define __Pyx_PyUnicode_READY(op) (0)
  437. #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
  438. #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  439. #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
  440. #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
  441. #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
  442. #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  443. #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
  444. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
  445. #endif
  446. #if CYTHON_COMPILING_IN_PYPY
  447. #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
  448. #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
  449. #else
  450. #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
  451. #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
  452. PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
  453. #endif
  454. #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  455. #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
  456. #endif
  457. #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  458. #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
  459. #endif
  460. #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  461. #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
  462. #endif
  463. #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
  464. #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
  465. #if PY_MAJOR_VERSION >= 3
  466. #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
  467. #else
  468. #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
  469. #endif
  470. #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  471. #define PyObject_ASCII(o) PyObject_Repr(o)
  472. #endif
  473. #if PY_MAJOR_VERSION >= 3
  474. #define PyBaseString_Type PyUnicode_Type
  475. #define PyStringObject PyUnicodeObject
  476. #define PyString_Type PyUnicode_Type
  477. #define PyString_Check PyUnicode_Check
  478. #define PyString_CheckExact PyUnicode_CheckExact
  479. #define PyObject_Unicode PyObject_Str
  480. #endif
  481. #if PY_MAJOR_VERSION >= 3
  482. #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  483. #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
  484. #else
  485. #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  486. #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
  487. #endif
  488. #ifndef PySet_CheckExact
  489. #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
  490. #endif
  491. #if CYTHON_ASSUME_SAFE_MACROS
  492. #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
  493. #else
  494. #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
  495. #endif
  496. #if PY_MAJOR_VERSION >= 3
  497. #define PyIntObject PyLongObject
  498. #define PyInt_Type PyLong_Type
  499. #define PyInt_Check(op) PyLong_Check(op)
  500. #define PyInt_CheckExact(op) PyLong_CheckExact(op)
  501. #define PyInt_FromString PyLong_FromString
  502. #define PyInt_FromUnicode PyLong_FromUnicode
  503. #define PyInt_FromLong PyLong_FromLong
  504. #define PyInt_FromSize_t PyLong_FromSize_t
  505. #define PyInt_FromSsize_t PyLong_FromSsize_t
  506. #define PyInt_AsLong PyLong_AsLong
  507. #define PyInt_AS_LONG PyLong_AS_LONG
  508. #define PyInt_AsSsize_t PyLong_AsSsize_t
  509. #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
  510. #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  511. #define PyNumber_Int PyNumber_Long
  512. #endif
  513. #if PY_MAJOR_VERSION >= 3
  514. #define PyBoolObject PyLongObject
  515. #endif
  516. #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  517. #ifndef PyUnicode_InternFromString
  518. #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  519. #endif
  520. #endif
  521. #if PY_VERSION_HEX < 0x030200A4
  522. typedef long Py_hash_t;
  523. #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  524. #define __Pyx_PyInt_AsHash_t PyInt_AsLong
  525. #else
  526. #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  527. #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
  528. #endif
  529. #if PY_MAJOR_VERSION >= 3
  530. #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
  531. #else
  532. #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
  533. #endif
  534. #if CYTHON_USE_ASYNC_SLOTS
  535. #if PY_VERSION_HEX >= 0x030500B1
  536. #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
  537. #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  538. #else
  539. #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  540. #endif
  541. #else
  542. #define __Pyx_PyType_AsAsync(obj) NULL
  543. #endif
  544. #ifndef __Pyx_PyAsyncMethodsStruct
  545. typedef struct {
  546. unaryfunc am_await;
  547. unaryfunc am_aiter;
  548. unaryfunc am_anext;
  549. } __Pyx_PyAsyncMethodsStruct;
  550. #endif
  551. #if defined(WIN32) || defined(MS_WINDOWS)
  552. #define _USE_MATH_DEFINES
  553. #endif
  554. #include <math.h>
  555. #ifdef NAN
  556. #define __PYX_NAN() ((float) NAN)
  557. #else
  558. static CYTHON_INLINE float __PYX_NAN() {
  559. float value;
  560. memset(&value, 0xFF, sizeof(value));
  561. return value;
  562. }
  563. #endif
  564. #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
  565. #define __Pyx_truncl trunc
  566. #else
  567. #define __Pyx_truncl truncl
  568. #endif
  569. #define __PYX_ERR(f_index, lineno, Ln_error) \
  570. { \
  571. __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
  572. }
  573. #ifndef __PYX_EXTERN_C
  574. #ifdef __cplusplus
  575. #define __PYX_EXTERN_C extern "C"
  576. #else
  577. #define __PYX_EXTERN_C extern
  578. #endif
  579. #endif
  580. #define __PYX_HAVE__utils__cython_bbox
  581. #define __PYX_HAVE_API__utils__cython_bbox
  582. /* Early includes */
  583. #include <string.h>
  584. #include <stdio.h>
  585. #include "numpy/arrayobject.h"
  586. #include "numpy/ufuncobject.h"
  587. #ifdef _OPENMP
  588. #include <omp.h>
  589. #endif /* _OPENMP */
  590. #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
  591. #define CYTHON_WITHOUT_ASSERTIONS
  592. #endif
  593. typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
  594. const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
  595. #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
  596. #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
  597. #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
  598. #define __PYX_DEFAULT_STRING_ENCODING ""
  599. #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
  600. #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  601. #define __Pyx_uchar_cast(c) ((unsigned char)c)
  602. #define __Pyx_long_cast(x) ((long)x)
  603. #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
  604. (sizeof(type) < sizeof(Py_ssize_t)) ||\
  605. (sizeof(type) > sizeof(Py_ssize_t) &&\
  606. likely(v < (type)PY_SSIZE_T_MAX ||\
  607. v == (type)PY_SSIZE_T_MAX) &&\
  608. (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
  609. v == (type)PY_SSIZE_T_MIN))) ||\
  610. (sizeof(type) == sizeof(Py_ssize_t) &&\
  611. (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
  612. v == (type)PY_SSIZE_T_MAX))) )
  613. static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
  614. return (size_t) i < (size_t) limit;
  615. }
  616. #if defined (__cplusplus) && __cplusplus >= 201103L
  617. #include <cstdlib>
  618. #define __Pyx_sst_abs(value) std::abs(value)
  619. #elif SIZEOF_INT >= SIZEOF_SIZE_T
  620. #define __Pyx_sst_abs(value) abs(value)
  621. #elif SIZEOF_LONG >= SIZEOF_SIZE_T
  622. #define __Pyx_sst_abs(value) labs(value)
  623. #elif defined (_MSC_VER)
  624. #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
  625. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  626. #define __Pyx_sst_abs(value) llabs(value)
  627. #elif defined (__GNUC__)
  628. #define __Pyx_sst_abs(value) __builtin_llabs(value)
  629. #else
  630. #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
  631. #endif
  632. static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
  633. static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
  634. #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
  635. #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
  636. #define __Pyx_PyBytes_FromString PyBytes_FromString
  637. #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
  638. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
  639. #if PY_MAJOR_VERSION < 3
  640. #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
  641. #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  642. #else
  643. #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
  644. #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
  645. #endif
  646. #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
  647. #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
  648. #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
  649. #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
  650. #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
  651. #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
  652. #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
  653. #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
  654. #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
  655. #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
  656. #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
  657. #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
  658. #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
  659. #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
  660. #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
  661. #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
  662. static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
  663. const Py_UNICODE *u_end = u;
  664. while (*u_end++) ;
  665. return (size_t)(u_end - u - 1);
  666. }
  667. #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
  668. #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
  669. #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
  670. #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
  671. #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
  672. static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
  673. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
  674. static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
  675. static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
  676. #define __Pyx_PySequence_Tuple(obj)\
  677. (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
  678. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
  679. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
  680. #if CYTHON_ASSUME_SAFE_MACROS
  681. #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
  682. #else
  683. #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
  684. #endif
  685. #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
  686. #if PY_MAJOR_VERSION >= 3
  687. #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
  688. #else
  689. #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
  690. #endif
  691. #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
  692. #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  693. static int __Pyx_sys_getdefaultencoding_not_ascii;
  694. static int __Pyx_init_sys_getdefaultencoding_params(void) {
  695. PyObject* sys;
  696. PyObject* default_encoding = NULL;
  697. PyObject* ascii_chars_u = NULL;
  698. PyObject* ascii_chars_b = NULL;
  699. const char* default_encoding_c;
  700. sys = PyImport_ImportModule("sys");
  701. if (!sys) goto bad;
  702. default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
  703. Py_DECREF(sys);
  704. if (!default_encoding) goto bad;
  705. default_encoding_c = PyBytes_AsString(default_encoding);
  706. if (!default_encoding_c) goto bad;
  707. if (strcmp(default_encoding_c, "ascii") == 0) {
  708. __Pyx_sys_getdefaultencoding_not_ascii = 0;
  709. } else {
  710. char ascii_chars[128];
  711. int c;
  712. for (c = 0; c < 128; c++) {
  713. ascii_chars[c] = c;
  714. }
  715. __Pyx_sys_getdefaultencoding_not_ascii = 1;
  716. ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
  717. if (!ascii_chars_u) goto bad;
  718. ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
  719. if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
  720. PyErr_Format(
  721. PyExc_ValueError,
  722. "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
  723. default_encoding_c);
  724. goto bad;
  725. }
  726. Py_DECREF(ascii_chars_u);
  727. Py_DECREF(ascii_chars_b);
  728. }
  729. Py_DECREF(default_encoding);
  730. return 0;
  731. bad:
  732. Py_XDECREF(default_encoding);
  733. Py_XDECREF(ascii_chars_u);
  734. Py_XDECREF(ascii_chars_b);
  735. return -1;
  736. }
  737. #endif
  738. #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
  739. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
  740. #else
  741. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
  742. #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  743. static char* __PYX_DEFAULT_STRING_ENCODING;
  744. static int __Pyx_init_sys_getdefaultencoding_params(void) {
  745. PyObject* sys;
  746. PyObject* default_encoding = NULL;
  747. char* default_encoding_c;
  748. sys = PyImport_ImportModule("sys");
  749. if (!sys) goto bad;
  750. default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
  751. Py_DECREF(sys);
  752. if (!default_encoding) goto bad;
  753. default_encoding_c = PyBytes_AsString(default_encoding);
  754. if (!default_encoding_c) goto bad;
  755. __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
  756. if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
  757. strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
  758. Py_DECREF(default_encoding);
  759. return 0;
  760. bad:
  761. Py_XDECREF(default_encoding);
  762. return -1;
  763. }
  764. #endif
  765. #endif
  766. /* Test for GCC > 2.95 */
  767. #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  768. #define likely(x) __builtin_expect(!!(x), 1)
  769. #define unlikely(x) __builtin_expect(!!(x), 0)
  770. #else /* !__GNUC__ or GCC < 2.95 */
  771. #define likely(x) (x)
  772. #define unlikely(x) (x)
  773. #endif /* __GNUC__ */
  774. static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
  775. static PyObject *__pyx_m = NULL;
  776. static PyObject *__pyx_d;
  777. static PyObject *__pyx_b;
  778. static PyObject *__pyx_cython_runtime = NULL;
  779. static PyObject *__pyx_empty_tuple;
  780. static PyObject *__pyx_empty_bytes;
  781. static PyObject *__pyx_empty_unicode;
  782. static int __pyx_lineno;
  783. static int __pyx_clineno = 0;
  784. static const char * __pyx_cfilenm= __FILE__;
  785. static const char *__pyx_filename;
  786. /* Header.proto */
  787. #if !defined(CYTHON_CCOMPLEX)
  788. #if defined(__cplusplus)
  789. #define CYTHON_CCOMPLEX 1
  790. #elif defined(_Complex_I)
  791. #define CYTHON_CCOMPLEX 1
  792. #else
  793. #define CYTHON_CCOMPLEX 0
  794. #endif
  795. #endif
  796. #if CYTHON_CCOMPLEX
  797. #ifdef __cplusplus
  798. #include <complex>
  799. #else
  800. #include <complex.h>
  801. #endif
  802. #endif
  803. #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
  804. #undef _Complex_I
  805. #define _Complex_I 1.0fj
  806. #endif
  807. static const char *__pyx_f[] = {
  808. "utils\\bbox.pyx",
  809. "__init__.pxd",
  810. "type.pxd",
  811. };
  812. /* BufferFormatStructs.proto */
  813. #define IS_UNSIGNED(type) (((type) -1) > 0)
  814. struct __Pyx_StructField_;
  815. #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
  816. typedef struct {
  817. const char* name;
  818. struct __Pyx_StructField_* fields;
  819. size_t size;
  820. size_t arraysize[8];
  821. int ndim;
  822. char typegroup;
  823. char is_unsigned;
  824. int flags;
  825. } __Pyx_TypeInfo;
  826. typedef struct __Pyx_StructField_ {
  827. __Pyx_TypeInfo* type;
  828. const char* name;
  829. size_t offset;
  830. } __Pyx_StructField;
  831. typedef struct {
  832. __Pyx_StructField* field;
  833. size_t parent_offset;
  834. } __Pyx_BufFmt_StackElem;
  835. typedef struct {
  836. __Pyx_StructField root;
  837. __Pyx_BufFmt_StackElem* head;
  838. size_t fmt_offset;
  839. size_t new_count, enc_count;
  840. size_t struct_alignment;
  841. int is_complex;
  842. char enc_type;
  843. char new_packmode;
  844. char enc_packmode;
  845. char is_valid_array;
  846. } __Pyx_BufFmt_Context;
  847. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":776
  848. * # in Cython to enable them only on the right systems.
  849. *
  850. * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<<
  851. * ctypedef npy_int16 int16_t
  852. * ctypedef npy_int32 int32_t
  853. */
  854. typedef npy_int8 __pyx_t_5numpy_int8_t;
  855. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":777
  856. *
  857. * ctypedef npy_int8 int8_t
  858. * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<<
  859. * ctypedef npy_int32 int32_t
  860. * ctypedef npy_int64 int64_t
  861. */
  862. typedef npy_int16 __pyx_t_5numpy_int16_t;
  863. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":778
  864. * ctypedef npy_int8 int8_t
  865. * ctypedef npy_int16 int16_t
  866. * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<<
  867. * ctypedef npy_int64 int64_t
  868. * #ctypedef npy_int96 int96_t
  869. */
  870. typedef npy_int32 __pyx_t_5numpy_int32_t;
  871. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":779
  872. * ctypedef npy_int16 int16_t
  873. * ctypedef npy_int32 int32_t
  874. * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<<
  875. * #ctypedef npy_int96 int96_t
  876. * #ctypedef npy_int128 int128_t
  877. */
  878. typedef npy_int64 __pyx_t_5numpy_int64_t;
  879. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":783
  880. * #ctypedef npy_int128 int128_t
  881. *
  882. * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<<
  883. * ctypedef npy_uint16 uint16_t
  884. * ctypedef npy_uint32 uint32_t
  885. */
  886. typedef npy_uint8 __pyx_t_5numpy_uint8_t;
  887. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":784
  888. *
  889. * ctypedef npy_uint8 uint8_t
  890. * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<<
  891. * ctypedef npy_uint32 uint32_t
  892. * ctypedef npy_uint64 uint64_t
  893. */
  894. typedef npy_uint16 __pyx_t_5numpy_uint16_t;
  895. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":785
  896. * ctypedef npy_uint8 uint8_t
  897. * ctypedef npy_uint16 uint16_t
  898. * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<<
  899. * ctypedef npy_uint64 uint64_t
  900. * #ctypedef npy_uint96 uint96_t
  901. */
  902. typedef npy_uint32 __pyx_t_5numpy_uint32_t;
  903. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":786
  904. * ctypedef npy_uint16 uint16_t
  905. * ctypedef npy_uint32 uint32_t
  906. * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<<
  907. * #ctypedef npy_uint96 uint96_t
  908. * #ctypedef npy_uint128 uint128_t
  909. */
  910. typedef npy_uint64 __pyx_t_5numpy_uint64_t;
  911. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":790
  912. * #ctypedef npy_uint128 uint128_t
  913. *
  914. * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<<
  915. * ctypedef npy_float64 float64_t
  916. * #ctypedef npy_float80 float80_t
  917. */
  918. typedef npy_float32 __pyx_t_5numpy_float32_t;
  919. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":791
  920. *
  921. * ctypedef npy_float32 float32_t
  922. * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<<
  923. * #ctypedef npy_float80 float80_t
  924. * #ctypedef npy_float128 float128_t
  925. */
  926. typedef npy_float64 __pyx_t_5numpy_float64_t;
  927. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":800
  928. * # The int types are mapped a bit surprising --
  929. * # numpy.int corresponds to 'l' and numpy.long to 'q'
  930. * ctypedef npy_long int_t # <<<<<<<<<<<<<<
  931. * ctypedef npy_longlong long_t
  932. * ctypedef npy_longlong longlong_t
  933. */
  934. typedef npy_long __pyx_t_5numpy_int_t;
  935. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":801
  936. * # numpy.int corresponds to 'l' and numpy.long to 'q'
  937. * ctypedef npy_long int_t
  938. * ctypedef npy_longlong long_t # <<<<<<<<<<<<<<
  939. * ctypedef npy_longlong longlong_t
  940. *
  941. */
  942. typedef npy_longlong __pyx_t_5numpy_long_t;
  943. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":802
  944. * ctypedef npy_long int_t
  945. * ctypedef npy_longlong long_t
  946. * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<<
  947. *
  948. * ctypedef npy_ulong uint_t
  949. */
  950. typedef npy_longlong __pyx_t_5numpy_longlong_t;
  951. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":804
  952. * ctypedef npy_longlong longlong_t
  953. *
  954. * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<<
  955. * ctypedef npy_ulonglong ulong_t
  956. * ctypedef npy_ulonglong ulonglong_t
  957. */
  958. typedef npy_ulong __pyx_t_5numpy_uint_t;
  959. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":805
  960. *
  961. * ctypedef npy_ulong uint_t
  962. * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<<
  963. * ctypedef npy_ulonglong ulonglong_t
  964. *
  965. */
  966. typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
  967. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":806
  968. * ctypedef npy_ulong uint_t
  969. * ctypedef npy_ulonglong ulong_t
  970. * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<<
  971. *
  972. * ctypedef npy_intp intp_t
  973. */
  974. typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
  975. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":808
  976. * ctypedef npy_ulonglong ulonglong_t
  977. *
  978. * ctypedef npy_intp intp_t # <<<<<<<<<<<<<<
  979. * ctypedef npy_uintp uintp_t
  980. *
  981. */
  982. typedef npy_intp __pyx_t_5numpy_intp_t;
  983. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":809
  984. *
  985. * ctypedef npy_intp intp_t
  986. * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<<
  987. *
  988. * ctypedef npy_double float_t
  989. */
  990. typedef npy_uintp __pyx_t_5numpy_uintp_t;
  991. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":811
  992. * ctypedef npy_uintp uintp_t
  993. *
  994. * ctypedef npy_double float_t # <<<<<<<<<<<<<<
  995. * ctypedef npy_double double_t
  996. * ctypedef npy_longdouble longdouble_t
  997. */
  998. typedef npy_double __pyx_t_5numpy_float_t;
  999. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":812
  1000. *
  1001. * ctypedef npy_double float_t
  1002. * ctypedef npy_double double_t # <<<<<<<<<<<<<<
  1003. * ctypedef npy_longdouble longdouble_t
  1004. *
  1005. */
  1006. typedef npy_double __pyx_t_5numpy_double_t;
  1007. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":813
  1008. * ctypedef npy_double float_t
  1009. * ctypedef npy_double double_t
  1010. * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<<
  1011. *
  1012. * ctypedef npy_cfloat cfloat_t
  1013. */
  1014. typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
  1015. /* "utils/bbox.pyx":13
  1016. *
  1017. * DTYPE = np.float
  1018. * ctypedef np.float_t DTYPE_t # <<<<<<<<<<<<<<
  1019. *
  1020. * def bbox_overlaps(
  1021. */
  1022. typedef __pyx_t_5numpy_float_t __pyx_t_5utils_11cython_bbox_DTYPE_t;
  1023. /* Declarations.proto */
  1024. #if CYTHON_CCOMPLEX
  1025. #ifdef __cplusplus
  1026. typedef ::std::complex< float > __pyx_t_float_complex;
  1027. #else
  1028. typedef float _Complex __pyx_t_float_complex;
  1029. #endif
  1030. #else
  1031. typedef struct { float real, imag; } __pyx_t_float_complex;
  1032. #endif
  1033. static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
  1034. /* Declarations.proto */
  1035. #if CYTHON_CCOMPLEX
  1036. #ifdef __cplusplus
  1037. typedef ::std::complex< double > __pyx_t_double_complex;
  1038. #else
  1039. typedef double _Complex __pyx_t_double_complex;
  1040. #endif
  1041. #else
  1042. typedef struct { double real, imag; } __pyx_t_double_complex;
  1043. #endif
  1044. static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
  1045. /*--- Type declarations ---*/
  1046. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":815
  1047. * ctypedef npy_longdouble longdouble_t
  1048. *
  1049. * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<<
  1050. * ctypedef npy_cdouble cdouble_t
  1051. * ctypedef npy_clongdouble clongdouble_t
  1052. */
  1053. typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
  1054. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":816
  1055. *
  1056. * ctypedef npy_cfloat cfloat_t
  1057. * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<<
  1058. * ctypedef npy_clongdouble clongdouble_t
  1059. *
  1060. */
  1061. typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
  1062. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":817
  1063. * ctypedef npy_cfloat cfloat_t
  1064. * ctypedef npy_cdouble cdouble_t
  1065. * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<<
  1066. *
  1067. * ctypedef npy_cdouble complex_t
  1068. */
  1069. typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
  1070. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":819
  1071. * ctypedef npy_clongdouble clongdouble_t
  1072. *
  1073. * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<<
  1074. *
  1075. * cdef inline object PyArray_MultiIterNew1(a):
  1076. */
  1077. typedef npy_cdouble __pyx_t_5numpy_complex_t;
  1078. /* --- Runtime support code (head) --- */
  1079. /* Refnanny.proto */
  1080. #ifndef CYTHON_REFNANNY
  1081. #define CYTHON_REFNANNY 0
  1082. #endif
  1083. #if CYTHON_REFNANNY
  1084. typedef struct {
  1085. void (*INCREF)(void*, PyObject*, int);
  1086. void (*DECREF)(void*, PyObject*, int);
  1087. void (*GOTREF)(void*, PyObject*, int);
  1088. void (*GIVEREF)(void*, PyObject*, int);
  1089. void* (*SetupContext)(const char*, int, const char*);
  1090. void (*FinishContext)(void**);
  1091. } __Pyx_RefNannyAPIStruct;
  1092. static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  1093. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  1094. #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  1095. #ifdef WITH_THREAD
  1096. #define __Pyx_RefNannySetupContext(name, acquire_gil)\
  1097. if (acquire_gil) {\
  1098. PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
  1099. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
  1100. PyGILState_Release(__pyx_gilstate_save);\
  1101. } else {\
  1102. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
  1103. }
  1104. #else
  1105. #define __Pyx_RefNannySetupContext(name, acquire_gil)\
  1106. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
  1107. #endif
  1108. #define __Pyx_RefNannyFinishContext()\
  1109. __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  1110. #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  1111. #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  1112. #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  1113. #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  1114. #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  1115. #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  1116. #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  1117. #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
  1118. #else
  1119. #define __Pyx_RefNannyDeclarations
  1120. #define __Pyx_RefNannySetupContext(name, acquire_gil)
  1121. #define __Pyx_RefNannyFinishContext()
  1122. #define __Pyx_INCREF(r) Py_INCREF(r)
  1123. #define __Pyx_DECREF(r) Py_DECREF(r)
  1124. #define __Pyx_GOTREF(r)
  1125. #define __Pyx_GIVEREF(r)
  1126. #define __Pyx_XINCREF(r) Py_XINCREF(r)
  1127. #define __Pyx_XDECREF(r) Py_XDECREF(r)
  1128. #define __Pyx_XGOTREF(r)
  1129. #define __Pyx_XGIVEREF(r)
  1130. #endif
  1131. #define __Pyx_XDECREF_SET(r, v) do {\
  1132. PyObject *tmp = (PyObject *) r;\
  1133. r = v; __Pyx_XDECREF(tmp);\
  1134. } while (0)
  1135. #define __Pyx_DECREF_SET(r, v) do {\
  1136. PyObject *tmp = (PyObject *) r;\
  1137. r = v; __Pyx_DECREF(tmp);\
  1138. } while (0)
  1139. #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
  1140. #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
  1141. /* PyObjectGetAttrStr.proto */
  1142. #if CYTHON_USE_TYPE_SLOTS
  1143. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
  1144. #else
  1145. #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
  1146. #endif
  1147. /* GetBuiltinName.proto */
  1148. static PyObject *__Pyx_GetBuiltinName(PyObject *name);
  1149. /* RaiseArgTupleInvalid.proto */
  1150. static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
  1151. Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
  1152. /* RaiseDoubleKeywords.proto */
  1153. static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
  1154. /* ParseKeywords.proto */
  1155. static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
  1156. PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
  1157. const char* function_name);
  1158. /* ArgTypeTest.proto */
  1159. #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
  1160. ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
  1161. __Pyx__ArgTypeTest(obj, type, name, exact))
  1162. static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
  1163. /* IsLittleEndian.proto */
  1164. static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
  1165. /* BufferFormatCheck.proto */
  1166. static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
  1167. static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
  1168. __Pyx_BufFmt_StackElem* stack,
  1169. __Pyx_TypeInfo* type);
  1170. /* BufferGetAndValidate.proto */
  1171. #define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\
  1172. ((obj == Py_None || obj == NULL) ?\
  1173. (__Pyx_ZeroBuffer(buf), 0) :\
  1174. __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack))
  1175. static int __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
  1176. __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
  1177. static void __Pyx_ZeroBuffer(Py_buffer* buf);
  1178. static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
  1179. static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 };
  1180. static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
  1181. /* PyDictVersioning.proto */
  1182. #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
  1183. #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
  1184. #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
  1185. #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
  1186. (version_var) = __PYX_GET_DICT_VERSION(dict);\
  1187. (cache_var) = (value);
  1188. #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
  1189. static PY_UINT64_T __pyx_dict_version = 0;\
  1190. static PyObject *__pyx_dict_cached_value = NULL;\
  1191. if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
  1192. (VAR) = __pyx_dict_cached_value;\
  1193. } else {\
  1194. (VAR) = __pyx_dict_cached_value = (LOOKUP);\
  1195. __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
  1196. }\
  1197. }
  1198. static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
  1199. static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
  1200. static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
  1201. #else
  1202. #define __PYX_GET_DICT_VERSION(dict) (0)
  1203. #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
  1204. #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
  1205. #endif
  1206. /* GetModuleGlobalName.proto */
  1207. #if CYTHON_USE_DICT_VERSIONS
  1208. #define __Pyx_GetModuleGlobalName(var, name) {\
  1209. static PY_UINT64_T __pyx_dict_version = 0;\
  1210. static PyObject *__pyx_dict_cached_value = NULL;\
  1211. (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
  1212. (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
  1213. __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
  1214. }
  1215. #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
  1216. PY_UINT64_T __pyx_dict_version;\
  1217. PyObject *__pyx_dict_cached_value;\
  1218. (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
  1219. }
  1220. static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
  1221. #else
  1222. #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
  1223. #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
  1224. static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
  1225. #endif
  1226. /* PyObjectCall.proto */
  1227. #if CYTHON_COMPILING_IN_CPYTHON
  1228. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
  1229. #else
  1230. #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
  1231. #endif
  1232. /* ExtTypeTest.proto */
  1233. static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
  1234. /* BufferIndexError.proto */
  1235. static void __Pyx_RaiseBufferIndexError(int axis);
  1236. #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
  1237. /* PyThreadStateGet.proto */
  1238. #if CYTHON_FAST_THREAD_STATE
  1239. #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
  1240. #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
  1241. #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
  1242. #else
  1243. #define __Pyx_PyThreadState_declare
  1244. #define __Pyx_PyThreadState_assign
  1245. #define __Pyx_PyErr_Occurred() PyErr_Occurred()
  1246. #endif
  1247. /* PyErrFetchRestore.proto */
  1248. #if CYTHON_FAST_THREAD_STATE
  1249. #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
  1250. #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
  1251. #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
  1252. #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
  1253. #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
  1254. static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
  1255. static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1256. #if CYTHON_COMPILING_IN_CPYTHON
  1257. #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
  1258. #else
  1259. #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
  1260. #endif
  1261. #else
  1262. #define __Pyx_PyErr_Clear() PyErr_Clear()
  1263. #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
  1264. #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
  1265. #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
  1266. #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
  1267. #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
  1268. #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
  1269. #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
  1270. #endif
  1271. /* RaiseException.proto */
  1272. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
  1273. /* PyCFunctionFastCall.proto */
  1274. #if CYTHON_FAST_PYCCALL
  1275. static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
  1276. #else
  1277. #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
  1278. #endif
  1279. /* PyFunctionFastCall.proto */
  1280. #if CYTHON_FAST_PYCALL
  1281. #define __Pyx_PyFunction_FastCall(func, args, nargs)\
  1282. __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
  1283. #if 1 || PY_VERSION_HEX < 0x030600B1
  1284. static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs);
  1285. #else
  1286. #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
  1287. #endif
  1288. #define __Pyx_BUILD_ASSERT_EXPR(cond)\
  1289. (sizeof(char [1 - 2*!(cond)]) - 1)
  1290. #ifndef Py_MEMBER_SIZE
  1291. #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
  1292. #endif
  1293. static size_t __pyx_pyframe_localsplus_offset = 0;
  1294. #include "frameobject.h"
  1295. #define __Pxy_PyFrame_Initialize_Offsets()\
  1296. ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
  1297. (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
  1298. #define __Pyx_PyFrame_GetLocalsplus(frame)\
  1299. (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
  1300. #endif
  1301. /* PyObjectCallMethO.proto */
  1302. #if CYTHON_COMPILING_IN_CPYTHON
  1303. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
  1304. #endif
  1305. /* PyObjectCallOneArg.proto */
  1306. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
  1307. /* DictGetItem.proto */
  1308. #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
  1309. static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
  1310. #define __Pyx_PyObject_Dict_GetItem(obj, name)\
  1311. (likely(PyDict_CheckExact(obj)) ?\
  1312. __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
  1313. #else
  1314. #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
  1315. #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name)
  1316. #endif
  1317. /* RaiseTooManyValuesToUnpack.proto */
  1318. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
  1319. /* RaiseNeedMoreValuesToUnpack.proto */
  1320. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
  1321. /* RaiseNoneIterError.proto */
  1322. static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
  1323. /* GetTopmostException.proto */
  1324. #if CYTHON_USE_EXC_INFO_STACK
  1325. static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
  1326. #endif
  1327. /* SaveResetException.proto */
  1328. #if CYTHON_FAST_THREAD_STATE
  1329. #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
  1330. static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1331. #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
  1332. static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
  1333. #else
  1334. #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
  1335. #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
  1336. #endif
  1337. /* PyErrExceptionMatches.proto */
  1338. #if CYTHON_FAST_THREAD_STATE
  1339. #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
  1340. static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
  1341. #else
  1342. #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
  1343. #endif
  1344. /* GetException.proto */
  1345. #if CYTHON_FAST_THREAD_STATE
  1346. #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
  1347. static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1348. #else
  1349. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
  1350. #endif
  1351. /* TypeImport.proto */
  1352. #ifndef __PYX_HAVE_RT_ImportType_proto
  1353. #define __PYX_HAVE_RT_ImportType_proto
  1354. enum __Pyx_ImportType_CheckSize {
  1355. __Pyx_ImportType_CheckSize_Error = 0,
  1356. __Pyx_ImportType_CheckSize_Warn = 1,
  1357. __Pyx_ImportType_CheckSize_Ignore = 2
  1358. };
  1359. static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
  1360. #endif
  1361. /* Import.proto */
  1362. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
  1363. /* CLineInTraceback.proto */
  1364. #ifdef CYTHON_CLINE_IN_TRACEBACK
  1365. #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
  1366. #else
  1367. static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
  1368. #endif
  1369. /* CodeObjectCache.proto */
  1370. typedef struct {
  1371. PyCodeObject* code_object;
  1372. int code_line;
  1373. } __Pyx_CodeObjectCacheEntry;
  1374. struct __Pyx_CodeObjectCache {
  1375. int count;
  1376. int max_count;
  1377. __Pyx_CodeObjectCacheEntry* entries;
  1378. };
  1379. static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
  1380. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
  1381. static PyCodeObject *__pyx_find_code_object(int code_line);
  1382. static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
  1383. /* AddTraceback.proto */
  1384. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  1385. int py_line, const char *filename);
  1386. /* BufferStructDeclare.proto */
  1387. typedef struct {
  1388. Py_ssize_t shape, strides, suboffsets;
  1389. } __Pyx_Buf_DimInfo;
  1390. typedef struct {
  1391. size_t refcount;
  1392. Py_buffer pybuffer;
  1393. } __Pyx_Buffer;
  1394. typedef struct {
  1395. __Pyx_Buffer *rcbuffer;
  1396. char *data;
  1397. __Pyx_Buf_DimInfo diminfo[8];
  1398. } __Pyx_LocalBuf_ND;
  1399. #if PY_MAJOR_VERSION < 3
  1400. static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
  1401. static void __Pyx_ReleaseBuffer(Py_buffer *view);
  1402. #else
  1403. #define __Pyx_GetBuffer PyObject_GetBuffer
  1404. #define __Pyx_ReleaseBuffer PyBuffer_Release
  1405. #endif
  1406. /* CIntToPy.proto */
  1407. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value);
  1408. /* RealImag.proto */
  1409. #if CYTHON_CCOMPLEX
  1410. #ifdef __cplusplus
  1411. #define __Pyx_CREAL(z) ((z).real())
  1412. #define __Pyx_CIMAG(z) ((z).imag())
  1413. #else
  1414. #define __Pyx_CREAL(z) (__real__(z))
  1415. #define __Pyx_CIMAG(z) (__imag__(z))
  1416. #endif
  1417. #else
  1418. #define __Pyx_CREAL(z) ((z).real)
  1419. #define __Pyx_CIMAG(z) ((z).imag)
  1420. #endif
  1421. #if defined(__cplusplus) && CYTHON_CCOMPLEX\
  1422. && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
  1423. #define __Pyx_SET_CREAL(z,x) ((z).real(x))
  1424. #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
  1425. #else
  1426. #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
  1427. #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
  1428. #endif
  1429. /* Arithmetic.proto */
  1430. #if CYTHON_CCOMPLEX
  1431. #define __Pyx_c_eq_float(a, b) ((a)==(b))
  1432. #define __Pyx_c_sum_float(a, b) ((a)+(b))
  1433. #define __Pyx_c_diff_float(a, b) ((a)-(b))
  1434. #define __Pyx_c_prod_float(a, b) ((a)*(b))
  1435. #define __Pyx_c_quot_float(a, b) ((a)/(b))
  1436. #define __Pyx_c_neg_float(a) (-(a))
  1437. #ifdef __cplusplus
  1438. #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
  1439. #define __Pyx_c_conj_float(z) (::std::conj(z))
  1440. #if 1
  1441. #define __Pyx_c_abs_float(z) (::std::abs(z))
  1442. #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
  1443. #endif
  1444. #else
  1445. #define __Pyx_c_is_zero_float(z) ((z)==0)
  1446. #define __Pyx_c_conj_float(z) (conjf(z))
  1447. #if 1
  1448. #define __Pyx_c_abs_float(z) (cabsf(z))
  1449. #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
  1450. #endif
  1451. #endif
  1452. #else
  1453. static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
  1454. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
  1455. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
  1456. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
  1457. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
  1458. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
  1459. static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
  1460. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
  1461. #if 1
  1462. static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
  1463. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
  1464. #endif
  1465. #endif
  1466. /* Arithmetic.proto */
  1467. #if CYTHON_CCOMPLEX
  1468. #define __Pyx_c_eq_double(a, b) ((a)==(b))
  1469. #define __Pyx_c_sum_double(a, b) ((a)+(b))
  1470. #define __Pyx_c_diff_double(a, b) ((a)-(b))
  1471. #define __Pyx_c_prod_double(a, b) ((a)*(b))
  1472. #define __Pyx_c_quot_double(a, b) ((a)/(b))
  1473. #define __Pyx_c_neg_double(a) (-(a))
  1474. #ifdef __cplusplus
  1475. #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
  1476. #define __Pyx_c_conj_double(z) (::std::conj(z))
  1477. #if 1
  1478. #define __Pyx_c_abs_double(z) (::std::abs(z))
  1479. #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
  1480. #endif
  1481. #else
  1482. #define __Pyx_c_is_zero_double(z) ((z)==0)
  1483. #define __Pyx_c_conj_double(z) (conj(z))
  1484. #if 1
  1485. #define __Pyx_c_abs_double(z) (cabs(z))
  1486. #define __Pyx_c_pow_double(a, b) (cpow(a, b))
  1487. #endif
  1488. #endif
  1489. #else
  1490. static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
  1491. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
  1492. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
  1493. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
  1494. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
  1495. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
  1496. static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
  1497. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
  1498. #if 1
  1499. static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
  1500. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
  1501. #endif
  1502. #endif
  1503. /* CIntToPy.proto */
  1504. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
  1505. /* CIntToPy.proto */
  1506. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);
  1507. /* CIntFromPy.proto */
  1508. static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *);
  1509. /* CIntFromPy.proto */
  1510. static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
  1511. /* CIntToPy.proto */
  1512. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
  1513. /* CIntFromPy.proto */
  1514. static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
  1515. /* FastTypeChecks.proto */
  1516. #if CYTHON_COMPILING_IN_CPYTHON
  1517. #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
  1518. static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
  1519. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
  1520. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
  1521. #else
  1522. #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
  1523. #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
  1524. #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
  1525. #endif
  1526. #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
  1527. /* CheckBinaryVersion.proto */
  1528. static int __Pyx_check_binary_version(void);
  1529. /* InitStrings.proto */
  1530. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
  1531. /* Module declarations from 'cython' */
  1532. /* Module declarations from 'cpython.buffer' */
  1533. /* Module declarations from 'libc.string' */
  1534. /* Module declarations from 'libc.stdio' */
  1535. /* Module declarations from '__builtin__' */
  1536. /* Module declarations from 'cpython.type' */
  1537. static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
  1538. /* Module declarations from 'cpython' */
  1539. /* Module declarations from 'cpython.object' */
  1540. /* Module declarations from 'cpython.ref' */
  1541. /* Module declarations from 'cpython.mem' */
  1542. /* Module declarations from 'numpy' */
  1543. /* Module declarations from 'numpy' */
  1544. static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
  1545. static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
  1546. static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
  1547. static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
  1548. static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
  1549. static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
  1550. /* Module declarations from 'utils.cython_bbox' */
  1551. static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5utils_11cython_bbox_DTYPE_t = { "DTYPE_t", NULL, sizeof(__pyx_t_5utils_11cython_bbox_DTYPE_t), { 0 }, 0, 'R', 0, 0 };
  1552. #define __Pyx_MODULE_NAME "utils.cython_bbox"
  1553. extern int __pyx_module_is_main_utils__cython_bbox;
  1554. int __pyx_module_is_main_utils__cython_bbox = 0;
  1555. /* Implementation of 'utils.cython_bbox' */
  1556. static PyObject *__pyx_builtin_range;
  1557. static PyObject *__pyx_builtin_ValueError;
  1558. static PyObject *__pyx_builtin_RuntimeError;
  1559. static PyObject *__pyx_builtin_ImportError;
  1560. static const char __pyx_k_K[] = "K";
  1561. static const char __pyx_k_N[] = "N";
  1562. static const char __pyx_k_k[] = "k";
  1563. static const char __pyx_k_n[] = "n";
  1564. static const char __pyx_k_ih[] = "ih";
  1565. static const char __pyx_k_iw[] = "iw";
  1566. static const char __pyx_k_np[] = "np";
  1567. static const char __pyx_k_ua[] = "ua";
  1568. static const char __pyx_k_main[] = "__main__";
  1569. static const char __pyx_k_name[] = "__name__";
  1570. static const char __pyx_k_test[] = "__test__";
  1571. static const char __pyx_k_DTYPE[] = "DTYPE";
  1572. static const char __pyx_k_boxes[] = "boxes";
  1573. static const char __pyx_k_dtype[] = "dtype";
  1574. static const char __pyx_k_float[] = "float";
  1575. static const char __pyx_k_numpy[] = "numpy";
  1576. static const char __pyx_k_range[] = "range";
  1577. static const char __pyx_k_zeros[] = "zeros";
  1578. static const char __pyx_k_import[] = "__import__";
  1579. static const char __pyx_k_box_area[] = "box_area";
  1580. static const char __pyx_k_overlaps[] = "overlaps";
  1581. static const char __pyx_k_ValueError[] = "ValueError";
  1582. static const char __pyx_k_ImportError[] = "ImportError";
  1583. static const char __pyx_k_query_boxes[] = "query_boxes";
  1584. static const char __pyx_k_RuntimeError[] = "RuntimeError";
  1585. static const char __pyx_k_bbox_overlaps[] = "bbox_overlaps";
  1586. static const char __pyx_k_utils_bbox_pyx[] = "utils\\bbox.pyx";
  1587. static const char __pyx_k_utils_cython_bbox[] = "utils.cython_bbox";
  1588. static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
  1589. static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
  1590. static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
  1591. static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
  1592. static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
  1593. static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
  1594. static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
  1595. static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
  1596. static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
  1597. static PyObject *__pyx_n_s_DTYPE;
  1598. static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
  1599. static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
  1600. static PyObject *__pyx_n_s_ImportError;
  1601. static PyObject *__pyx_n_s_K;
  1602. static PyObject *__pyx_n_s_N;
  1603. static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
  1604. static PyObject *__pyx_n_s_RuntimeError;
  1605. static PyObject *__pyx_n_s_ValueError;
  1606. static PyObject *__pyx_n_s_bbox_overlaps;
  1607. static PyObject *__pyx_n_s_box_area;
  1608. static PyObject *__pyx_n_s_boxes;
  1609. static PyObject *__pyx_n_s_cline_in_traceback;
  1610. static PyObject *__pyx_n_s_dtype;
  1611. static PyObject *__pyx_n_s_float;
  1612. static PyObject *__pyx_n_s_ih;
  1613. static PyObject *__pyx_n_s_import;
  1614. static PyObject *__pyx_n_s_iw;
  1615. static PyObject *__pyx_n_s_k;
  1616. static PyObject *__pyx_n_s_main;
  1617. static PyObject *__pyx_n_s_n;
  1618. static PyObject *__pyx_n_s_name;
  1619. static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
  1620. static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
  1621. static PyObject *__pyx_n_s_np;
  1622. static PyObject *__pyx_n_s_numpy;
  1623. static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
  1624. static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
  1625. static PyObject *__pyx_n_s_overlaps;
  1626. static PyObject *__pyx_n_s_query_boxes;
  1627. static PyObject *__pyx_n_s_range;
  1628. static PyObject *__pyx_n_s_test;
  1629. static PyObject *__pyx_n_s_ua;
  1630. static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
  1631. static PyObject *__pyx_kp_s_utils_bbox_pyx;
  1632. static PyObject *__pyx_n_s_utils_cython_bbox;
  1633. static PyObject *__pyx_n_s_zeros;
  1634. static PyObject *__pyx_pf_5utils_11cython_bbox_bbox_overlaps(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_boxes, PyArrayObject *__pyx_v_query_boxes); /* proto */
  1635. static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
  1636. static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
  1637. static PyObject *__pyx_tuple_;
  1638. static PyObject *__pyx_tuple__2;
  1639. static PyObject *__pyx_tuple__3;
  1640. static PyObject *__pyx_tuple__4;
  1641. static PyObject *__pyx_tuple__5;
  1642. static PyObject *__pyx_tuple__6;
  1643. static PyObject *__pyx_tuple__7;
  1644. static PyObject *__pyx_tuple__8;
  1645. static PyObject *__pyx_codeobj__9;
  1646. /* Late includes */
  1647. /* "utils/bbox.pyx":15
  1648. * ctypedef np.float_t DTYPE_t
  1649. *
  1650. * def bbox_overlaps( # <<<<<<<<<<<<<<
  1651. * np.ndarray[DTYPE_t, ndim=2] boxes,
  1652. * np.ndarray[DTYPE_t, ndim=2] query_boxes):
  1653. */
  1654. /* Python wrapper */
  1655. static PyObject *__pyx_pw_5utils_11cython_bbox_1bbox_overlaps(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  1656. static char __pyx_doc_5utils_11cython_bbox_bbox_overlaps[] = "\n Parameters\n ----------\n boxes: (N, 4) ndarray of float\n query_boxes: (K, 4) ndarray of float\n Returns\n -------\n overlaps: (N, K) ndarray of overlap between boxes and query_boxes\n ";
  1657. static PyMethodDef __pyx_mdef_5utils_11cython_bbox_1bbox_overlaps = {"bbox_overlaps", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5utils_11cython_bbox_1bbox_overlaps, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5utils_11cython_bbox_bbox_overlaps};
  1658. static PyObject *__pyx_pw_5utils_11cython_bbox_1bbox_overlaps(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  1659. PyArrayObject *__pyx_v_boxes = 0;
  1660. PyArrayObject *__pyx_v_query_boxes = 0;
  1661. PyObject *__pyx_r = 0;
  1662. __Pyx_RefNannyDeclarations
  1663. __Pyx_RefNannySetupContext("bbox_overlaps (wrapper)", 0);
  1664. {
  1665. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_boxes,&__pyx_n_s_query_boxes,0};
  1666. PyObject* values[2] = {0,0};
  1667. if (unlikely(__pyx_kwds)) {
  1668. Py_ssize_t kw_args;
  1669. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  1670. switch (pos_args) {
  1671. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  1672. CYTHON_FALLTHROUGH;
  1673. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  1674. CYTHON_FALLTHROUGH;
  1675. case 0: break;
  1676. default: goto __pyx_L5_argtuple_error;
  1677. }
  1678. kw_args = PyDict_Size(__pyx_kwds);
  1679. switch (pos_args) {
  1680. case 0:
  1681. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_boxes)) != 0)) kw_args--;
  1682. else goto __pyx_L5_argtuple_error;
  1683. CYTHON_FALLTHROUGH;
  1684. case 1:
  1685. if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_query_boxes)) != 0)) kw_args--;
  1686. else {
  1687. __Pyx_RaiseArgtupleInvalid("bbox_overlaps", 1, 2, 2, 1); __PYX_ERR(0, 15, __pyx_L3_error)
  1688. }
  1689. }
  1690. if (unlikely(kw_args > 0)) {
  1691. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bbox_overlaps") < 0)) __PYX_ERR(0, 15, __pyx_L3_error)
  1692. }
  1693. } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
  1694. goto __pyx_L5_argtuple_error;
  1695. } else {
  1696. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  1697. values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  1698. }
  1699. __pyx_v_boxes = ((PyArrayObject *)values[0]);
  1700. __pyx_v_query_boxes = ((PyArrayObject *)values[1]);
  1701. }
  1702. goto __pyx_L4_argument_unpacking_done;
  1703. __pyx_L5_argtuple_error:;
  1704. __Pyx_RaiseArgtupleInvalid("bbox_overlaps", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 15, __pyx_L3_error)
  1705. __pyx_L3_error:;
  1706. __Pyx_AddTraceback("utils.cython_bbox.bbox_overlaps", __pyx_clineno, __pyx_lineno, __pyx_filename);
  1707. __Pyx_RefNannyFinishContext();
  1708. return NULL;
  1709. __pyx_L4_argument_unpacking_done:;
  1710. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_boxes), __pyx_ptype_5numpy_ndarray, 1, "boxes", 0))) __PYX_ERR(0, 16, __pyx_L1_error)
  1711. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_query_boxes), __pyx_ptype_5numpy_ndarray, 1, "query_boxes", 0))) __PYX_ERR(0, 17, __pyx_L1_error)
  1712. __pyx_r = __pyx_pf_5utils_11cython_bbox_bbox_overlaps(__pyx_self, __pyx_v_boxes, __pyx_v_query_boxes);
  1713. /* function exit code */
  1714. goto __pyx_L0;
  1715. __pyx_L1_error:;
  1716. __pyx_r = NULL;
  1717. __pyx_L0:;
  1718. __Pyx_RefNannyFinishContext();
  1719. return __pyx_r;
  1720. }
  1721. static PyObject *__pyx_pf_5utils_11cython_bbox_bbox_overlaps(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_boxes, PyArrayObject *__pyx_v_query_boxes) {
  1722. unsigned int __pyx_v_N;
  1723. unsigned int __pyx_v_K;
  1724. PyArrayObject *__pyx_v_overlaps = 0;
  1725. __pyx_t_5utils_11cython_bbox_DTYPE_t __pyx_v_iw;
  1726. __pyx_t_5utils_11cython_bbox_DTYPE_t __pyx_v_ih;
  1727. __pyx_t_5utils_11cython_bbox_DTYPE_t __pyx_v_box_area;
  1728. __pyx_t_5utils_11cython_bbox_DTYPE_t __pyx_v_ua;
  1729. unsigned int __pyx_v_k;
  1730. unsigned int __pyx_v_n;
  1731. __Pyx_LocalBuf_ND __pyx_pybuffernd_boxes;
  1732. __Pyx_Buffer __pyx_pybuffer_boxes;
  1733. __Pyx_LocalBuf_ND __pyx_pybuffernd_overlaps;
  1734. __Pyx_Buffer __pyx_pybuffer_overlaps;
  1735. __Pyx_LocalBuf_ND __pyx_pybuffernd_query_boxes;
  1736. __Pyx_Buffer __pyx_pybuffer_query_boxes;
  1737. PyObject *__pyx_r = NULL;
  1738. __Pyx_RefNannyDeclarations
  1739. PyObject *__pyx_t_1 = NULL;
  1740. PyObject *__pyx_t_2 = NULL;
  1741. PyObject *__pyx_t_3 = NULL;
  1742. PyObject *__pyx_t_4 = NULL;
  1743. PyArrayObject *__pyx_t_5 = NULL;
  1744. unsigned int __pyx_t_6;
  1745. unsigned int __pyx_t_7;
  1746. unsigned int __pyx_t_8;
  1747. size_t __pyx_t_9;
  1748. Py_ssize_t __pyx_t_10;
  1749. int __pyx_t_11;
  1750. size_t __pyx_t_12;
  1751. Py_ssize_t __pyx_t_13;
  1752. size_t __pyx_t_14;
  1753. Py_ssize_t __pyx_t_15;
  1754. size_t __pyx_t_16;
  1755. Py_ssize_t __pyx_t_17;
  1756. unsigned int __pyx_t_18;
  1757. unsigned int __pyx_t_19;
  1758. unsigned int __pyx_t_20;
  1759. size_t __pyx_t_21;
  1760. Py_ssize_t __pyx_t_22;
  1761. __pyx_t_5utils_11cython_bbox_DTYPE_t __pyx_t_23;
  1762. size_t __pyx_t_24;
  1763. Py_ssize_t __pyx_t_25;
  1764. __pyx_t_5utils_11cython_bbox_DTYPE_t __pyx_t_26;
  1765. __pyx_t_5utils_11cython_bbox_DTYPE_t __pyx_t_27;
  1766. size_t __pyx_t_28;
  1767. Py_ssize_t __pyx_t_29;
  1768. size_t __pyx_t_30;
  1769. Py_ssize_t __pyx_t_31;
  1770. __pyx_t_5utils_11cython_bbox_DTYPE_t __pyx_t_32;
  1771. int __pyx_t_33;
  1772. size_t __pyx_t_34;
  1773. Py_ssize_t __pyx_t_35;
  1774. size_t __pyx_t_36;
  1775. Py_ssize_t __pyx_t_37;
  1776. size_t __pyx_t_38;
  1777. Py_ssize_t __pyx_t_39;
  1778. size_t __pyx_t_40;
  1779. Py_ssize_t __pyx_t_41;
  1780. size_t __pyx_t_42;
  1781. Py_ssize_t __pyx_t_43;
  1782. size_t __pyx_t_44;
  1783. Py_ssize_t __pyx_t_45;
  1784. size_t __pyx_t_46;
  1785. Py_ssize_t __pyx_t_47;
  1786. size_t __pyx_t_48;
  1787. Py_ssize_t __pyx_t_49;
  1788. size_t __pyx_t_50;
  1789. size_t __pyx_t_51;
  1790. __Pyx_RefNannySetupContext("bbox_overlaps", 0);
  1791. __pyx_pybuffer_overlaps.pybuffer.buf = NULL;
  1792. __pyx_pybuffer_overlaps.refcount = 0;
  1793. __pyx_pybuffernd_overlaps.data = NULL;
  1794. __pyx_pybuffernd_overlaps.rcbuffer = &__pyx_pybuffer_overlaps;
  1795. __pyx_pybuffer_boxes.pybuffer.buf = NULL;
  1796. __pyx_pybuffer_boxes.refcount = 0;
  1797. __pyx_pybuffernd_boxes.data = NULL;
  1798. __pyx_pybuffernd_boxes.rcbuffer = &__pyx_pybuffer_boxes;
  1799. __pyx_pybuffer_query_boxes.pybuffer.buf = NULL;
  1800. __pyx_pybuffer_query_boxes.refcount = 0;
  1801. __pyx_pybuffernd_query_boxes.data = NULL;
  1802. __pyx_pybuffernd_query_boxes.rcbuffer = &__pyx_pybuffer_query_boxes;
  1803. {
  1804. __Pyx_BufFmt_StackElem __pyx_stack[1];
  1805. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_boxes.rcbuffer->pybuffer, (PyObject*)__pyx_v_boxes, &__Pyx_TypeInfo_nn___pyx_t_5utils_11cython_bbox_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 15, __pyx_L1_error)
  1806. }
  1807. __pyx_pybuffernd_boxes.diminfo[0].strides = __pyx_pybuffernd_boxes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_boxes.diminfo[0].shape = __pyx_pybuffernd_boxes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_boxes.diminfo[1].strides = __pyx_pybuffernd_boxes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_boxes.diminfo[1].shape = __pyx_pybuffernd_boxes.rcbuffer->pybuffer.shape[1];
  1808. {
  1809. __Pyx_BufFmt_StackElem __pyx_stack[1];
  1810. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_query_boxes.rcbuffer->pybuffer, (PyObject*)__pyx_v_query_boxes, &__Pyx_TypeInfo_nn___pyx_t_5utils_11cython_bbox_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 15, __pyx_L1_error)
  1811. }
  1812. __pyx_pybuffernd_query_boxes.diminfo[0].strides = __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_query_boxes.diminfo[0].shape = __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_query_boxes.diminfo[1].strides = __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_query_boxes.diminfo[1].shape = __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.shape[1];
  1813. /* "utils/bbox.pyx":27
  1814. * overlaps: (N, K) ndarray of overlap between boxes and query_boxes
  1815. * """
  1816. * cdef unsigned int N = boxes.shape[0] # <<<<<<<<<<<<<<
  1817. * cdef unsigned int K = query_boxes.shape[0]
  1818. * cdef np.ndarray[DTYPE_t, ndim=2] overlaps = np.zeros((N, K), dtype=DTYPE)
  1819. */
  1820. __pyx_v_N = (__pyx_v_boxes->dimensions[0]);
  1821. /* "utils/bbox.pyx":28
  1822. * """
  1823. * cdef unsigned int N = boxes.shape[0]
  1824. * cdef unsigned int K = query_boxes.shape[0] # <<<<<<<<<<<<<<
  1825. * cdef np.ndarray[DTYPE_t, ndim=2] overlaps = np.zeros((N, K), dtype=DTYPE)
  1826. * cdef DTYPE_t iw, ih, box_area
  1827. */
  1828. __pyx_v_K = (__pyx_v_query_boxes->dimensions[0]);
  1829. /* "utils/bbox.pyx":29
  1830. * cdef unsigned int N = boxes.shape[0]
  1831. * cdef unsigned int K = query_boxes.shape[0]
  1832. * cdef np.ndarray[DTYPE_t, ndim=2] overlaps = np.zeros((N, K), dtype=DTYPE) # <<<<<<<<<<<<<<
  1833. * cdef DTYPE_t iw, ih, box_area
  1834. * cdef DTYPE_t ua
  1835. */
  1836. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
  1837. __Pyx_GOTREF(__pyx_t_1);
  1838. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error)
  1839. __Pyx_GOTREF(__pyx_t_2);
  1840. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1841. __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_N); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
  1842. __Pyx_GOTREF(__pyx_t_1);
  1843. __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_K); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 29, __pyx_L1_error)
  1844. __Pyx_GOTREF(__pyx_t_3);
  1845. __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 29, __pyx_L1_error)
  1846. __Pyx_GOTREF(__pyx_t_4);
  1847. __Pyx_GIVEREF(__pyx_t_1);
  1848. PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  1849. __Pyx_GIVEREF(__pyx_t_3);
  1850. PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  1851. __pyx_t_1 = 0;
  1852. __pyx_t_3 = 0;
  1853. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 29, __pyx_L1_error)
  1854. __Pyx_GOTREF(__pyx_t_3);
  1855. __Pyx_GIVEREF(__pyx_t_4);
  1856. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  1857. __pyx_t_4 = 0;
  1858. __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 29, __pyx_L1_error)
  1859. __Pyx_GOTREF(__pyx_t_4);
  1860. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_DTYPE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
  1861. __Pyx_GOTREF(__pyx_t_1);
  1862. if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
  1863. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1864. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
  1865. __Pyx_GOTREF(__pyx_t_1);
  1866. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1867. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1868. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1869. if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 29, __pyx_L1_error)
  1870. __pyx_t_5 = ((PyArrayObject *)__pyx_t_1);
  1871. {
  1872. __Pyx_BufFmt_StackElem __pyx_stack[1];
  1873. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_overlaps.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5utils_11cython_bbox_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
  1874. __pyx_v_overlaps = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_overlaps.rcbuffer->pybuffer.buf = NULL;
  1875. __PYX_ERR(0, 29, __pyx_L1_error)
  1876. } else {__pyx_pybuffernd_overlaps.diminfo[0].strides = __pyx_pybuffernd_overlaps.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_overlaps.diminfo[0].shape = __pyx_pybuffernd_overlaps.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_overlaps.diminfo[1].strides = __pyx_pybuffernd_overlaps.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_overlaps.diminfo[1].shape = __pyx_pybuffernd_overlaps.rcbuffer->pybuffer.shape[1];
  1877. }
  1878. }
  1879. __pyx_t_5 = 0;
  1880. __pyx_v_overlaps = ((PyArrayObject *)__pyx_t_1);
  1881. __pyx_t_1 = 0;
  1882. /* "utils/bbox.pyx":33
  1883. * cdef DTYPE_t ua
  1884. * cdef unsigned int k, n
  1885. * for k in range(K): # <<<<<<<<<<<<<<
  1886. * box_area = (
  1887. * (query_boxes[k, 2] - query_boxes[k, 0] + 1) *
  1888. */
  1889. __pyx_t_6 = __pyx_v_K;
  1890. __pyx_t_7 = __pyx_t_6;
  1891. for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
  1892. __pyx_v_k = __pyx_t_8;
  1893. /* "utils/bbox.pyx":35
  1894. * for k in range(K):
  1895. * box_area = (
  1896. * (query_boxes[k, 2] - query_boxes[k, 0] + 1) * # <<<<<<<<<<<<<<
  1897. * (query_boxes[k, 3] - query_boxes[k, 1] + 1)
  1898. * )
  1899. */
  1900. __pyx_t_9 = __pyx_v_k;
  1901. __pyx_t_10 = 2;
  1902. __pyx_t_11 = -1;
  1903. if (unlikely(__pyx_t_9 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_11 = 0;
  1904. if (__pyx_t_10 < 0) {
  1905. __pyx_t_10 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
  1906. if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 1;
  1907. } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_11 = 1;
  1908. if (unlikely(__pyx_t_11 != -1)) {
  1909. __Pyx_RaiseBufferIndexError(__pyx_t_11);
  1910. __PYX_ERR(0, 35, __pyx_L1_error)
  1911. }
  1912. __pyx_t_12 = __pyx_v_k;
  1913. __pyx_t_13 = 0;
  1914. __pyx_t_11 = -1;
  1915. if (unlikely(__pyx_t_12 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_11 = 0;
  1916. if (__pyx_t_13 < 0) {
  1917. __pyx_t_13 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
  1918. if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
  1919. } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_11 = 1;
  1920. if (unlikely(__pyx_t_11 != -1)) {
  1921. __Pyx_RaiseBufferIndexError(__pyx_t_11);
  1922. __PYX_ERR(0, 35, __pyx_L1_error)
  1923. }
  1924. /* "utils/bbox.pyx":36
  1925. * box_area = (
  1926. * (query_boxes[k, 2] - query_boxes[k, 0] + 1) *
  1927. * (query_boxes[k, 3] - query_boxes[k, 1] + 1) # <<<<<<<<<<<<<<
  1928. * )
  1929. * for n in range(N):
  1930. */
  1931. __pyx_t_14 = __pyx_v_k;
  1932. __pyx_t_15 = 3;
  1933. __pyx_t_11 = -1;
  1934. if (unlikely(__pyx_t_14 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_11 = 0;
  1935. if (__pyx_t_15 < 0) {
  1936. __pyx_t_15 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
  1937. if (unlikely(__pyx_t_15 < 0)) __pyx_t_11 = 1;
  1938. } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_11 = 1;
  1939. if (unlikely(__pyx_t_11 != -1)) {
  1940. __Pyx_RaiseBufferIndexError(__pyx_t_11);
  1941. __PYX_ERR(0, 36, __pyx_L1_error)
  1942. }
  1943. __pyx_t_16 = __pyx_v_k;
  1944. __pyx_t_17 = 1;
  1945. __pyx_t_11 = -1;
  1946. if (unlikely(__pyx_t_16 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_11 = 0;
  1947. if (__pyx_t_17 < 0) {
  1948. __pyx_t_17 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
  1949. if (unlikely(__pyx_t_17 < 0)) __pyx_t_11 = 1;
  1950. } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_11 = 1;
  1951. if (unlikely(__pyx_t_11 != -1)) {
  1952. __Pyx_RaiseBufferIndexError(__pyx_t_11);
  1953. __PYX_ERR(0, 36, __pyx_L1_error)
  1954. }
  1955. /* "utils/bbox.pyx":35
  1956. * for k in range(K):
  1957. * box_area = (
  1958. * (query_boxes[k, 2] - query_boxes[k, 0] + 1) * # <<<<<<<<<<<<<<
  1959. * (query_boxes[k, 3] - query_boxes[k, 1] + 1)
  1960. * )
  1961. */
  1962. __pyx_v_box_area = ((((*__Pyx_BufPtrStrided2d(__pyx_t_5utils_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_query_boxes.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_5utils_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_query_boxes.diminfo[1].strides))) + 1.0) * (((*__Pyx_BufPtrStrided2d(__pyx_t_5utils_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_query_boxes.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_5utils_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_query_boxes.diminfo[1].strides))) + 1.0));
  1963. /* "utils/bbox.pyx":38
  1964. * (query_boxes[k, 3] - query_boxes[k, 1] + 1)
  1965. * )
  1966. * for n in range(N): # <<<<<<<<<<<<<<
  1967. * iw = (
  1968. * min(boxes[n, 2], query_boxes[k, 2]) -
  1969. */
  1970. __pyx_t_18 = __pyx_v_N;
  1971. __pyx_t_19 = __pyx_t_18;
  1972. for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
  1973. __pyx_v_n = __pyx_t_20;
  1974. /* "utils/bbox.pyx":40
  1975. * for n in range(N):
  1976. * iw = (
  1977. * min(boxes[n, 2], query_boxes[k, 2]) - # <<<<<<<<<<<<<<
  1978. * max(boxes[n, 0], query_boxes[k, 0]) + 1
  1979. * )
  1980. */
  1981. __pyx_t_21 = __pyx_v_k;
  1982. __pyx_t_22 = 2;
  1983. __pyx_t_11 = -1;
  1984. if (unlikely(__pyx_t_21 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_11 = 0;
  1985. if (__pyx_t_22 < 0) {
  1986. __pyx_t_22 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
  1987. if (unlikely(__pyx_t_22 < 0)) __pyx_t_11 = 1;
  1988. } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_11 = 1;
  1989. if (unlikely(__pyx_t_11 != -1)) {
  1990. __Pyx_RaiseBufferIndexError(__pyx_t_11);
  1991. __PYX_ERR(0, 40, __pyx_L1_error)
  1992. }
  1993. __pyx_t_23 = (*__Pyx_BufPtrStrided2d(__pyx_t_5utils_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_query_boxes.diminfo[1].strides));
  1994. __pyx_t_24 = __pyx_v_n;
  1995. __pyx_t_25 = 2;
  1996. __pyx_t_11 = -1;
  1997. if (unlikely(__pyx_t_24 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_11 = 0;
  1998. if (__pyx_t_25 < 0) {
  1999. __pyx_t_25 += __pyx_pybuffernd_boxes.diminfo[1].shape;
  2000. if (unlikely(__pyx_t_25 < 0)) __pyx_t_11 = 1;
  2001. } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_11 = 1;
  2002. if (unlikely(__pyx_t_11 != -1)) {
  2003. __Pyx_RaiseBufferIndexError(__pyx_t_11);
  2004. __PYX_ERR(0, 40, __pyx_L1_error)
  2005. }
  2006. __pyx_t_26 = (*__Pyx_BufPtrStrided2d(__pyx_t_5utils_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_boxes.diminfo[1].strides));
  2007. if (((__pyx_t_23 < __pyx_t_26) != 0)) {
  2008. __pyx_t_27 = __pyx_t_23;
  2009. } else {
  2010. __pyx_t_27 = __pyx_t_26;
  2011. }
  2012. /* "utils/bbox.pyx":41
  2013. * iw = (
  2014. * min(boxes[n, 2], query_boxes[k, 2]) -
  2015. * max(boxes[n, 0], query_boxes[k, 0]) + 1 # <<<<<<<<<<<<<<
  2016. * )
  2017. * if iw > 0:
  2018. */
  2019. __pyx_t_28 = __pyx_v_k;
  2020. __pyx_t_29 = 0;
  2021. __pyx_t_11 = -1;
  2022. if (unlikely(__pyx_t_28 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_11 = 0;
  2023. if (__pyx_t_29 < 0) {
  2024. __pyx_t_29 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
  2025. if (unlikely(__pyx_t_29 < 0)) __pyx_t_11 = 1;
  2026. } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_11 = 1;
  2027. if (unlikely(__pyx_t_11 != -1)) {
  2028. __Pyx_RaiseBufferIndexError(__pyx_t_11);
  2029. __PYX_ERR(0, 41, __pyx_L1_error)
  2030. }
  2031. __pyx_t_23 = (*__Pyx_BufPtrStrided2d(__pyx_t_5utils_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_query_boxes.diminfo[1].strides));
  2032. __pyx_t_30 = __pyx_v_n;
  2033. __pyx_t_31 = 0;
  2034. __pyx_t_11 = -1;
  2035. if (unlikely(__pyx_t_30 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_11 = 0;
  2036. if (__pyx_t_31 < 0) {
  2037. __pyx_t_31 += __pyx_pybuffernd_boxes.diminfo[1].shape;
  2038. if (unlikely(__pyx_t_31 < 0)) __pyx_t_11 = 1;
  2039. } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_11 = 1;
  2040. if (unlikely(__pyx_t_11 != -1)) {
  2041. __Pyx_RaiseBufferIndexError(__pyx_t_11);
  2042. __PYX_ERR(0, 41, __pyx_L1_error)
  2043. }
  2044. __pyx_t_26 = (*__Pyx_BufPtrStrided2d(__pyx_t_5utils_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_boxes.diminfo[1].strides));
  2045. if (((__pyx_t_23 > __pyx_t_26) != 0)) {
  2046. __pyx_t_32 = __pyx_t_23;
  2047. } else {
  2048. __pyx_t_32 = __pyx_t_26;
  2049. }
  2050. /* "utils/bbox.pyx":40
  2051. * for n in range(N):
  2052. * iw = (
  2053. * min(boxes[n, 2], query_boxes[k, 2]) - # <<<<<<<<<<<<<<
  2054. * max(boxes[n, 0], query_boxes[k, 0]) + 1
  2055. * )
  2056. */
  2057. __pyx_v_iw = ((__pyx_t_27 - __pyx_t_32) + 1.0);
  2058. /* "utils/bbox.pyx":43
  2059. * max(boxes[n, 0], query_boxes[k, 0]) + 1
  2060. * )
  2061. * if iw > 0: # <<<<<<<<<<<<<<
  2062. * ih = (
  2063. * min(boxes[n, 3], query_boxes[k, 3]) -
  2064. */
  2065. __pyx_t_33 = ((__pyx_v_iw > 0.0) != 0);
  2066. if (__pyx_t_33) {
  2067. /* "utils/bbox.pyx":45
  2068. * if iw > 0:
  2069. * ih = (
  2070. * min(boxes[n, 3], query_boxes[k, 3]) - # <<<<<<<<<<<<<<
  2071. * max(boxes[n, 1], query_boxes[k, 1]) + 1
  2072. * )
  2073. */
  2074. __pyx_t_34 = __pyx_v_k;
  2075. __pyx_t_35 = 3;
  2076. __pyx_t_11 = -1;
  2077. if (unlikely(__pyx_t_34 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_11 = 0;
  2078. if (__pyx_t_35 < 0) {
  2079. __pyx_t_35 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
  2080. if (unlikely(__pyx_t_35 < 0)) __pyx_t_11 = 1;
  2081. } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_11 = 1;
  2082. if (unlikely(__pyx_t_11 != -1)) {
  2083. __Pyx_RaiseBufferIndexError(__pyx_t_11);
  2084. __PYX_ERR(0, 45, __pyx_L1_error)
  2085. }
  2086. __pyx_t_32 = (*__Pyx_BufPtrStrided2d(__pyx_t_5utils_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_query_boxes.diminfo[1].strides));
  2087. __pyx_t_36 = __pyx_v_n;
  2088. __pyx_t_37 = 3;
  2089. __pyx_t_11 = -1;
  2090. if (unlikely(__pyx_t_36 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_11 = 0;
  2091. if (__pyx_t_37 < 0) {
  2092. __pyx_t_37 += __pyx_pybuffernd_boxes.diminfo[1].shape;
  2093. if (unlikely(__pyx_t_37 < 0)) __pyx_t_11 = 1;
  2094. } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_11 = 1;
  2095. if (unlikely(__pyx_t_11 != -1)) {
  2096. __Pyx_RaiseBufferIndexError(__pyx_t_11);
  2097. __PYX_ERR(0, 45, __pyx_L1_error)
  2098. }
  2099. __pyx_t_27 = (*__Pyx_BufPtrStrided2d(__pyx_t_5utils_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_boxes.diminfo[1].strides));
  2100. if (((__pyx_t_32 < __pyx_t_27) != 0)) {
  2101. __pyx_t_23 = __pyx_t_32;
  2102. } else {
  2103. __pyx_t_23 = __pyx_t_27;
  2104. }
  2105. /* "utils/bbox.pyx":46
  2106. * ih = (
  2107. * min(boxes[n, 3], query_boxes[k, 3]) -
  2108. * max(boxes[n, 1], query_boxes[k, 1]) + 1 # <<<<<<<<<<<<<<
  2109. * )
  2110. * if ih > 0:
  2111. */
  2112. __pyx_t_38 = __pyx_v_k;
  2113. __pyx_t_39 = 1;
  2114. __pyx_t_11 = -1;
  2115. if (unlikely(__pyx_t_38 >= (size_t)__pyx_pybuffernd_query_boxes.diminfo[0].shape)) __pyx_t_11 = 0;
  2116. if (__pyx_t_39 < 0) {
  2117. __pyx_t_39 += __pyx_pybuffernd_query_boxes.diminfo[1].shape;
  2118. if (unlikely(__pyx_t_39 < 0)) __pyx_t_11 = 1;
  2119. } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_query_boxes.diminfo[1].shape)) __pyx_t_11 = 1;
  2120. if (unlikely(__pyx_t_11 != -1)) {
  2121. __Pyx_RaiseBufferIndexError(__pyx_t_11);
  2122. __PYX_ERR(0, 46, __pyx_L1_error)
  2123. }
  2124. __pyx_t_32 = (*__Pyx_BufPtrStrided2d(__pyx_t_5utils_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_query_boxes.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_query_boxes.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_query_boxes.diminfo[1].strides));
  2125. __pyx_t_40 = __pyx_v_n;
  2126. __pyx_t_41 = 1;
  2127. __pyx_t_11 = -1;
  2128. if (unlikely(__pyx_t_40 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_11 = 0;
  2129. if (__pyx_t_41 < 0) {
  2130. __pyx_t_41 += __pyx_pybuffernd_boxes.diminfo[1].shape;
  2131. if (unlikely(__pyx_t_41 < 0)) __pyx_t_11 = 1;
  2132. } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_11 = 1;
  2133. if (unlikely(__pyx_t_11 != -1)) {
  2134. __Pyx_RaiseBufferIndexError(__pyx_t_11);
  2135. __PYX_ERR(0, 46, __pyx_L1_error)
  2136. }
  2137. __pyx_t_27 = (*__Pyx_BufPtrStrided2d(__pyx_t_5utils_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_boxes.diminfo[1].strides));
  2138. if (((__pyx_t_32 > __pyx_t_27) != 0)) {
  2139. __pyx_t_26 = __pyx_t_32;
  2140. } else {
  2141. __pyx_t_26 = __pyx_t_27;
  2142. }
  2143. /* "utils/bbox.pyx":45
  2144. * if iw > 0:
  2145. * ih = (
  2146. * min(boxes[n, 3], query_boxes[k, 3]) - # <<<<<<<<<<<<<<
  2147. * max(boxes[n, 1], query_boxes[k, 1]) + 1
  2148. * )
  2149. */
  2150. __pyx_v_ih = ((__pyx_t_23 - __pyx_t_26) + 1.0);
  2151. /* "utils/bbox.pyx":48
  2152. * max(boxes[n, 1], query_boxes[k, 1]) + 1
  2153. * )
  2154. * if ih > 0: # <<<<<<<<<<<<<<
  2155. * ua = float(
  2156. * (boxes[n, 2] - boxes[n, 0] + 1) *
  2157. */
  2158. __pyx_t_33 = ((__pyx_v_ih > 0.0) != 0);
  2159. if (__pyx_t_33) {
  2160. /* "utils/bbox.pyx":50
  2161. * if ih > 0:
  2162. * ua = float(
  2163. * (boxes[n, 2] - boxes[n, 0] + 1) * # <<<<<<<<<<<<<<
  2164. * (boxes[n, 3] - boxes[n, 1] + 1) +
  2165. * box_area - iw * ih
  2166. */
  2167. __pyx_t_42 = __pyx_v_n;
  2168. __pyx_t_43 = 2;
  2169. __pyx_t_11 = -1;
  2170. if (unlikely(__pyx_t_42 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_11 = 0;
  2171. if (__pyx_t_43 < 0) {
  2172. __pyx_t_43 += __pyx_pybuffernd_boxes.diminfo[1].shape;
  2173. if (unlikely(__pyx_t_43 < 0)) __pyx_t_11 = 1;
  2174. } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_11 = 1;
  2175. if (unlikely(__pyx_t_11 != -1)) {
  2176. __Pyx_RaiseBufferIndexError(__pyx_t_11);
  2177. __PYX_ERR(0, 50, __pyx_L1_error)
  2178. }
  2179. __pyx_t_44 = __pyx_v_n;
  2180. __pyx_t_45 = 0;
  2181. __pyx_t_11 = -1;
  2182. if (unlikely(__pyx_t_44 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_11 = 0;
  2183. if (__pyx_t_45 < 0) {
  2184. __pyx_t_45 += __pyx_pybuffernd_boxes.diminfo[1].shape;
  2185. if (unlikely(__pyx_t_45 < 0)) __pyx_t_11 = 1;
  2186. } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_11 = 1;
  2187. if (unlikely(__pyx_t_11 != -1)) {
  2188. __Pyx_RaiseBufferIndexError(__pyx_t_11);
  2189. __PYX_ERR(0, 50, __pyx_L1_error)
  2190. }
  2191. /* "utils/bbox.pyx":51
  2192. * ua = float(
  2193. * (boxes[n, 2] - boxes[n, 0] + 1) *
  2194. * (boxes[n, 3] - boxes[n, 1] + 1) + # <<<<<<<<<<<<<<
  2195. * box_area - iw * ih
  2196. * )
  2197. */
  2198. __pyx_t_46 = __pyx_v_n;
  2199. __pyx_t_47 = 3;
  2200. __pyx_t_11 = -1;
  2201. if (unlikely(__pyx_t_46 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_11 = 0;
  2202. if (__pyx_t_47 < 0) {
  2203. __pyx_t_47 += __pyx_pybuffernd_boxes.diminfo[1].shape;
  2204. if (unlikely(__pyx_t_47 < 0)) __pyx_t_11 = 1;
  2205. } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_11 = 1;
  2206. if (unlikely(__pyx_t_11 != -1)) {
  2207. __Pyx_RaiseBufferIndexError(__pyx_t_11);
  2208. __PYX_ERR(0, 51, __pyx_L1_error)
  2209. }
  2210. __pyx_t_48 = __pyx_v_n;
  2211. __pyx_t_49 = 1;
  2212. __pyx_t_11 = -1;
  2213. if (unlikely(__pyx_t_48 >= (size_t)__pyx_pybuffernd_boxes.diminfo[0].shape)) __pyx_t_11 = 0;
  2214. if (__pyx_t_49 < 0) {
  2215. __pyx_t_49 += __pyx_pybuffernd_boxes.diminfo[1].shape;
  2216. if (unlikely(__pyx_t_49 < 0)) __pyx_t_11 = 1;
  2217. } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_boxes.diminfo[1].shape)) __pyx_t_11 = 1;
  2218. if (unlikely(__pyx_t_11 != -1)) {
  2219. __Pyx_RaiseBufferIndexError(__pyx_t_11);
  2220. __PYX_ERR(0, 51, __pyx_L1_error)
  2221. }
  2222. /* "utils/bbox.pyx":49
  2223. * )
  2224. * if ih > 0:
  2225. * ua = float( # <<<<<<<<<<<<<<
  2226. * (boxes[n, 2] - boxes[n, 0] + 1) *
  2227. * (boxes[n, 3] - boxes[n, 1] + 1) +
  2228. */
  2229. __pyx_v_ua = ((double)((((((*__Pyx_BufPtrStrided2d(__pyx_t_5utils_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_boxes.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_5utils_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_boxes.diminfo[1].strides))) + 1.0) * (((*__Pyx_BufPtrStrided2d(__pyx_t_5utils_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_boxes.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_5utils_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_boxes.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_boxes.diminfo[0].strides, __pyx_t_49, __pyx_pybuffernd_boxes.diminfo[1].strides))) + 1.0)) + __pyx_v_box_area) - (__pyx_v_iw * __pyx_v_ih)));
  2230. /* "utils/bbox.pyx":54
  2231. * box_area - iw * ih
  2232. * )
  2233. * overlaps[n, k] = iw * ih / ua # <<<<<<<<<<<<<<
  2234. * return overlaps
  2235. */
  2236. __pyx_t_26 = (__pyx_v_iw * __pyx_v_ih);
  2237. if (unlikely(__pyx_v_ua == 0)) {
  2238. PyErr_SetString(PyExc_ZeroDivisionError, "float division");
  2239. __PYX_ERR(0, 54, __pyx_L1_error)
  2240. }
  2241. __pyx_t_50 = __pyx_v_n;
  2242. __pyx_t_51 = __pyx_v_k;
  2243. __pyx_t_11 = -1;
  2244. if (unlikely(__pyx_t_50 >= (size_t)__pyx_pybuffernd_overlaps.diminfo[0].shape)) __pyx_t_11 = 0;
  2245. if (unlikely(__pyx_t_51 >= (size_t)__pyx_pybuffernd_overlaps.diminfo[1].shape)) __pyx_t_11 = 1;
  2246. if (unlikely(__pyx_t_11 != -1)) {
  2247. __Pyx_RaiseBufferIndexError(__pyx_t_11);
  2248. __PYX_ERR(0, 54, __pyx_L1_error)
  2249. }
  2250. *__Pyx_BufPtrStrided2d(__pyx_t_5utils_11cython_bbox_DTYPE_t *, __pyx_pybuffernd_overlaps.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_overlaps.diminfo[0].strides, __pyx_t_51, __pyx_pybuffernd_overlaps.diminfo[1].strides) = (__pyx_t_26 / __pyx_v_ua);
  2251. /* "utils/bbox.pyx":48
  2252. * max(boxes[n, 1], query_boxes[k, 1]) + 1
  2253. * )
  2254. * if ih > 0: # <<<<<<<<<<<<<<
  2255. * ua = float(
  2256. * (boxes[n, 2] - boxes[n, 0] + 1) *
  2257. */
  2258. }
  2259. /* "utils/bbox.pyx":43
  2260. * max(boxes[n, 0], query_boxes[k, 0]) + 1
  2261. * )
  2262. * if iw > 0: # <<<<<<<<<<<<<<
  2263. * ih = (
  2264. * min(boxes[n, 3], query_boxes[k, 3]) -
  2265. */
  2266. }
  2267. }
  2268. }
  2269. /* "utils/bbox.pyx":55
  2270. * )
  2271. * overlaps[n, k] = iw * ih / ua
  2272. * return overlaps # <<<<<<<<<<<<<<
  2273. */
  2274. __Pyx_XDECREF(__pyx_r);
  2275. __Pyx_INCREF(((PyObject *)__pyx_v_overlaps));
  2276. __pyx_r = ((PyObject *)__pyx_v_overlaps);
  2277. goto __pyx_L0;
  2278. /* "utils/bbox.pyx":15
  2279. * ctypedef np.float_t DTYPE_t
  2280. *
  2281. * def bbox_overlaps( # <<<<<<<<<<<<<<
  2282. * np.ndarray[DTYPE_t, ndim=2] boxes,
  2283. * np.ndarray[DTYPE_t, ndim=2] query_boxes):
  2284. */
  2285. /* function exit code */
  2286. __pyx_L1_error:;
  2287. __Pyx_XDECREF(__pyx_t_1);
  2288. __Pyx_XDECREF(__pyx_t_2);
  2289. __Pyx_XDECREF(__pyx_t_3);
  2290. __Pyx_XDECREF(__pyx_t_4);
  2291. { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
  2292. __Pyx_PyThreadState_declare
  2293. __Pyx_PyThreadState_assign
  2294. __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
  2295. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_boxes.rcbuffer->pybuffer);
  2296. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_overlaps.rcbuffer->pybuffer);
  2297. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_query_boxes.rcbuffer->pybuffer);
  2298. __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  2299. __Pyx_AddTraceback("utils.cython_bbox.bbox_overlaps", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2300. __pyx_r = NULL;
  2301. goto __pyx_L2;
  2302. __pyx_L0:;
  2303. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_boxes.rcbuffer->pybuffer);
  2304. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_overlaps.rcbuffer->pybuffer);
  2305. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_query_boxes.rcbuffer->pybuffer);
  2306. __pyx_L2:;
  2307. __Pyx_XDECREF((PyObject *)__pyx_v_overlaps);
  2308. __Pyx_XGIVEREF(__pyx_r);
  2309. __Pyx_RefNannyFinishContext();
  2310. return __pyx_r;
  2311. }
  2312. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":258
  2313. * # experimental exception made for __getbuffer__ and __releasebuffer__
  2314. * # -- the details of this may change.
  2315. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
  2316. * # This implementation of getbuffer is geared towards Cython
  2317. * # requirements, and does not yet fulfill the PEP.
  2318. */
  2319. /* Python wrapper */
  2320. static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
  2321. static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  2322. int __pyx_r;
  2323. __Pyx_RefNannyDeclarations
  2324. __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  2325. __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
  2326. /* function exit code */
  2327. __Pyx_RefNannyFinishContext();
  2328. return __pyx_r;
  2329. }
  2330. static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  2331. int __pyx_v_i;
  2332. int __pyx_v_ndim;
  2333. int __pyx_v_endian_detector;
  2334. int __pyx_v_little_endian;
  2335. int __pyx_v_t;
  2336. char *__pyx_v_f;
  2337. PyArray_Descr *__pyx_v_descr = 0;
  2338. int __pyx_v_offset;
  2339. int __pyx_r;
  2340. __Pyx_RefNannyDeclarations
  2341. int __pyx_t_1;
  2342. int __pyx_t_2;
  2343. PyObject *__pyx_t_3 = NULL;
  2344. int __pyx_t_4;
  2345. int __pyx_t_5;
  2346. int __pyx_t_6;
  2347. PyArray_Descr *__pyx_t_7;
  2348. PyObject *__pyx_t_8 = NULL;
  2349. char *__pyx_t_9;
  2350. if (__pyx_v_info == NULL) {
  2351. PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
  2352. return -1;
  2353. }
  2354. __Pyx_RefNannySetupContext("__getbuffer__", 0);
  2355. __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
  2356. __Pyx_GIVEREF(__pyx_v_info->obj);
  2357. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":265
  2358. *
  2359. * cdef int i, ndim
  2360. * cdef int endian_detector = 1 # <<<<<<<<<<<<<<
  2361. * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
  2362. *
  2363. */
  2364. __pyx_v_endian_detector = 1;
  2365. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":266
  2366. * cdef int i, ndim
  2367. * cdef int endian_detector = 1
  2368. * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
  2369. *
  2370. * ndim = PyArray_NDIM(self)
  2371. */
  2372. __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
  2373. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":268
  2374. * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
  2375. *
  2376. * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<<
  2377. *
  2378. * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
  2379. */
  2380. __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
  2381. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":270
  2382. * ndim = PyArray_NDIM(self)
  2383. *
  2384. * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
  2385. * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
  2386. * raise ValueError(u"ndarray is not C contiguous")
  2387. */
  2388. __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
  2389. if (__pyx_t_2) {
  2390. } else {
  2391. __pyx_t_1 = __pyx_t_2;
  2392. goto __pyx_L4_bool_binop_done;
  2393. }
  2394. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":271
  2395. *
  2396. * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
  2397. * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): # <<<<<<<<<<<<<<
  2398. * raise ValueError(u"ndarray is not C contiguous")
  2399. *
  2400. */
  2401. __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_C_CONTIGUOUS) != 0)) != 0);
  2402. __pyx_t_1 = __pyx_t_2;
  2403. __pyx_L4_bool_binop_done:;
  2404. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":270
  2405. * ndim = PyArray_NDIM(self)
  2406. *
  2407. * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
  2408. * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
  2409. * raise ValueError(u"ndarray is not C contiguous")
  2410. */
  2411. if (unlikely(__pyx_t_1)) {
  2412. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":272
  2413. * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
  2414. * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
  2415. * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
  2416. *
  2417. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  2418. */
  2419. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 272, __pyx_L1_error)
  2420. __Pyx_GOTREF(__pyx_t_3);
  2421. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  2422. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2423. __PYX_ERR(1, 272, __pyx_L1_error)
  2424. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":270
  2425. * ndim = PyArray_NDIM(self)
  2426. *
  2427. * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
  2428. * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
  2429. * raise ValueError(u"ndarray is not C contiguous")
  2430. */
  2431. }
  2432. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":274
  2433. * raise ValueError(u"ndarray is not C contiguous")
  2434. *
  2435. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
  2436. * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
  2437. * raise ValueError(u"ndarray is not Fortran contiguous")
  2438. */
  2439. __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
  2440. if (__pyx_t_2) {
  2441. } else {
  2442. __pyx_t_1 = __pyx_t_2;
  2443. goto __pyx_L7_bool_binop_done;
  2444. }
  2445. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":275
  2446. *
  2447. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  2448. * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): # <<<<<<<<<<<<<<
  2449. * raise ValueError(u"ndarray is not Fortran contiguous")
  2450. *
  2451. */
  2452. __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_F_CONTIGUOUS) != 0)) != 0);
  2453. __pyx_t_1 = __pyx_t_2;
  2454. __pyx_L7_bool_binop_done:;
  2455. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":274
  2456. * raise ValueError(u"ndarray is not C contiguous")
  2457. *
  2458. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
  2459. * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
  2460. * raise ValueError(u"ndarray is not Fortran contiguous")
  2461. */
  2462. if (unlikely(__pyx_t_1)) {
  2463. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":276
  2464. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  2465. * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
  2466. * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
  2467. *
  2468. * info.buf = PyArray_DATA(self)
  2469. */
  2470. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 276, __pyx_L1_error)
  2471. __Pyx_GOTREF(__pyx_t_3);
  2472. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  2473. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2474. __PYX_ERR(1, 276, __pyx_L1_error)
  2475. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":274
  2476. * raise ValueError(u"ndarray is not C contiguous")
  2477. *
  2478. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
  2479. * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
  2480. * raise ValueError(u"ndarray is not Fortran contiguous")
  2481. */
  2482. }
  2483. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":278
  2484. * raise ValueError(u"ndarray is not Fortran contiguous")
  2485. *
  2486. * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<<
  2487. * info.ndim = ndim
  2488. * if sizeof(npy_intp) != sizeof(Py_ssize_t):
  2489. */
  2490. __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
  2491. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":279
  2492. *
  2493. * info.buf = PyArray_DATA(self)
  2494. * info.ndim = ndim # <<<<<<<<<<<<<<
  2495. * if sizeof(npy_intp) != sizeof(Py_ssize_t):
  2496. * # Allocate new buffer for strides and shape info.
  2497. */
  2498. __pyx_v_info->ndim = __pyx_v_ndim;
  2499. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":280
  2500. * info.buf = PyArray_DATA(self)
  2501. * info.ndim = ndim
  2502. * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
  2503. * # Allocate new buffer for strides and shape info.
  2504. * # This is allocated as one block, strides first.
  2505. */
  2506. __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
  2507. if (__pyx_t_1) {
  2508. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":283
  2509. * # Allocate new buffer for strides and shape info.
  2510. * # This is allocated as one block, strides first.
  2511. * info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim) # <<<<<<<<<<<<<<
  2512. * info.shape = info.strides + ndim
  2513. * for i in range(ndim):
  2514. */
  2515. __pyx_v_info->strides = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * 2) * ((size_t)__pyx_v_ndim))));
  2516. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":284
  2517. * # This is allocated as one block, strides first.
  2518. * info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
  2519. * info.shape = info.strides + ndim # <<<<<<<<<<<<<<
  2520. * for i in range(ndim):
  2521. * info.strides[i] = PyArray_STRIDES(self)[i]
  2522. */
  2523. __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
  2524. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":285
  2525. * info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
  2526. * info.shape = info.strides + ndim
  2527. * for i in range(ndim): # <<<<<<<<<<<<<<
  2528. * info.strides[i] = PyArray_STRIDES(self)[i]
  2529. * info.shape[i] = PyArray_DIMS(self)[i]
  2530. */
  2531. __pyx_t_4 = __pyx_v_ndim;
  2532. __pyx_t_5 = __pyx_t_4;
  2533. for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
  2534. __pyx_v_i = __pyx_t_6;
  2535. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":286
  2536. * info.shape = info.strides + ndim
  2537. * for i in range(ndim):
  2538. * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<<
  2539. * info.shape[i] = PyArray_DIMS(self)[i]
  2540. * else:
  2541. */
  2542. (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
  2543. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":287
  2544. * for i in range(ndim):
  2545. * info.strides[i] = PyArray_STRIDES(self)[i]
  2546. * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<<
  2547. * else:
  2548. * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
  2549. */
  2550. (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
  2551. }
  2552. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":280
  2553. * info.buf = PyArray_DATA(self)
  2554. * info.ndim = ndim
  2555. * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
  2556. * # Allocate new buffer for strides and shape info.
  2557. * # This is allocated as one block, strides first.
  2558. */
  2559. goto __pyx_L9;
  2560. }
  2561. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":289
  2562. * info.shape[i] = PyArray_DIMS(self)[i]
  2563. * else:
  2564. * info.strides = <Py_ssize_t*>PyArray_STRIDES(self) # <<<<<<<<<<<<<<
  2565. * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
  2566. * info.suboffsets = NULL
  2567. */
  2568. /*else*/ {
  2569. __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
  2570. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":290
  2571. * else:
  2572. * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
  2573. * info.shape = <Py_ssize_t*>PyArray_DIMS(self) # <<<<<<<<<<<<<<
  2574. * info.suboffsets = NULL
  2575. * info.itemsize = PyArray_ITEMSIZE(self)
  2576. */
  2577. __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
  2578. }
  2579. __pyx_L9:;
  2580. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":291
  2581. * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
  2582. * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
  2583. * info.suboffsets = NULL # <<<<<<<<<<<<<<
  2584. * info.itemsize = PyArray_ITEMSIZE(self)
  2585. * info.readonly = not PyArray_ISWRITEABLE(self)
  2586. */
  2587. __pyx_v_info->suboffsets = NULL;
  2588. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":292
  2589. * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
  2590. * info.suboffsets = NULL
  2591. * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<<
  2592. * info.readonly = not PyArray_ISWRITEABLE(self)
  2593. *
  2594. */
  2595. __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
  2596. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":293
  2597. * info.suboffsets = NULL
  2598. * info.itemsize = PyArray_ITEMSIZE(self)
  2599. * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<<
  2600. *
  2601. * cdef int t
  2602. */
  2603. __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
  2604. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":296
  2605. *
  2606. * cdef int t
  2607. * cdef char* f = NULL # <<<<<<<<<<<<<<
  2608. * cdef dtype descr = <dtype>PyArray_DESCR(self)
  2609. * cdef int offset
  2610. */
  2611. __pyx_v_f = NULL;
  2612. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":297
  2613. * cdef int t
  2614. * cdef char* f = NULL
  2615. * cdef dtype descr = <dtype>PyArray_DESCR(self) # <<<<<<<<<<<<<<
  2616. * cdef int offset
  2617. *
  2618. */
  2619. __pyx_t_7 = PyArray_DESCR(__pyx_v_self);
  2620. __pyx_t_3 = ((PyObject *)__pyx_t_7);
  2621. __Pyx_INCREF(__pyx_t_3);
  2622. __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
  2623. __pyx_t_3 = 0;
  2624. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":300
  2625. * cdef int offset
  2626. *
  2627. * info.obj = self # <<<<<<<<<<<<<<
  2628. *
  2629. * if not PyDataType_HASFIELDS(descr):
  2630. */
  2631. __Pyx_INCREF(((PyObject *)__pyx_v_self));
  2632. __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  2633. __Pyx_GOTREF(__pyx_v_info->obj);
  2634. __Pyx_DECREF(__pyx_v_info->obj);
  2635. __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
  2636. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":302
  2637. * info.obj = self
  2638. *
  2639. * if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<<
  2640. * t = descr.type_num
  2641. * if ((descr.byteorder == c'>' and little_endian) or
  2642. */
  2643. __pyx_t_1 = ((!(PyDataType_HASFIELDS(__pyx_v_descr) != 0)) != 0);
  2644. if (__pyx_t_1) {
  2645. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":303
  2646. *
  2647. * if not PyDataType_HASFIELDS(descr):
  2648. * t = descr.type_num # <<<<<<<<<<<<<<
  2649. * if ((descr.byteorder == c'>' and little_endian) or
  2650. * (descr.byteorder == c'<' and not little_endian)):
  2651. */
  2652. __pyx_t_4 = __pyx_v_descr->type_num;
  2653. __pyx_v_t = __pyx_t_4;
  2654. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":304
  2655. * if not PyDataType_HASFIELDS(descr):
  2656. * t = descr.type_num
  2657. * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
  2658. * (descr.byteorder == c'<' and not little_endian)):
  2659. * raise ValueError(u"Non-native byte order not supported")
  2660. */
  2661. __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
  2662. if (!__pyx_t_2) {
  2663. goto __pyx_L15_next_or;
  2664. } else {
  2665. }
  2666. __pyx_t_2 = (__pyx_v_little_endian != 0);
  2667. if (!__pyx_t_2) {
  2668. } else {
  2669. __pyx_t_1 = __pyx_t_2;
  2670. goto __pyx_L14_bool_binop_done;
  2671. }
  2672. __pyx_L15_next_or:;
  2673. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":305
  2674. * t = descr.type_num
  2675. * if ((descr.byteorder == c'>' and little_endian) or
  2676. * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
  2677. * raise ValueError(u"Non-native byte order not supported")
  2678. * if t == NPY_BYTE: f = "b"
  2679. */
  2680. __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
  2681. if (__pyx_t_2) {
  2682. } else {
  2683. __pyx_t_1 = __pyx_t_2;
  2684. goto __pyx_L14_bool_binop_done;
  2685. }
  2686. __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
  2687. __pyx_t_1 = __pyx_t_2;
  2688. __pyx_L14_bool_binop_done:;
  2689. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":304
  2690. * if not PyDataType_HASFIELDS(descr):
  2691. * t = descr.type_num
  2692. * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
  2693. * (descr.byteorder == c'<' and not little_endian)):
  2694. * raise ValueError(u"Non-native byte order not supported")
  2695. */
  2696. if (unlikely(__pyx_t_1)) {
  2697. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":306
  2698. * if ((descr.byteorder == c'>' and little_endian) or
  2699. * (descr.byteorder == c'<' and not little_endian)):
  2700. * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
  2701. * if t == NPY_BYTE: f = "b"
  2702. * elif t == NPY_UBYTE: f = "B"
  2703. */
  2704. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 306, __pyx_L1_error)
  2705. __Pyx_GOTREF(__pyx_t_3);
  2706. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  2707. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2708. __PYX_ERR(1, 306, __pyx_L1_error)
  2709. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":304
  2710. * if not PyDataType_HASFIELDS(descr):
  2711. * t = descr.type_num
  2712. * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
  2713. * (descr.byteorder == c'<' and not little_endian)):
  2714. * raise ValueError(u"Non-native byte order not supported")
  2715. */
  2716. }
  2717. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":307
  2718. * (descr.byteorder == c'<' and not little_endian)):
  2719. * raise ValueError(u"Non-native byte order not supported")
  2720. * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<<
  2721. * elif t == NPY_UBYTE: f = "B"
  2722. * elif t == NPY_SHORT: f = "h"
  2723. */
  2724. switch (__pyx_v_t) {
  2725. case NPY_BYTE:
  2726. __pyx_v_f = ((char *)"b");
  2727. break;
  2728. case NPY_UBYTE:
  2729. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":308
  2730. * raise ValueError(u"Non-native byte order not supported")
  2731. * if t == NPY_BYTE: f = "b"
  2732. * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<<
  2733. * elif t == NPY_SHORT: f = "h"
  2734. * elif t == NPY_USHORT: f = "H"
  2735. */
  2736. __pyx_v_f = ((char *)"B");
  2737. break;
  2738. case NPY_SHORT:
  2739. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":309
  2740. * if t == NPY_BYTE: f = "b"
  2741. * elif t == NPY_UBYTE: f = "B"
  2742. * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<<
  2743. * elif t == NPY_USHORT: f = "H"
  2744. * elif t == NPY_INT: f = "i"
  2745. */
  2746. __pyx_v_f = ((char *)"h");
  2747. break;
  2748. case NPY_USHORT:
  2749. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":310
  2750. * elif t == NPY_UBYTE: f = "B"
  2751. * elif t == NPY_SHORT: f = "h"
  2752. * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<<
  2753. * elif t == NPY_INT: f = "i"
  2754. * elif t == NPY_UINT: f = "I"
  2755. */
  2756. __pyx_v_f = ((char *)"H");
  2757. break;
  2758. case NPY_INT:
  2759. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":311
  2760. * elif t == NPY_SHORT: f = "h"
  2761. * elif t == NPY_USHORT: f = "H"
  2762. * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<<
  2763. * elif t == NPY_UINT: f = "I"
  2764. * elif t == NPY_LONG: f = "l"
  2765. */
  2766. __pyx_v_f = ((char *)"i");
  2767. break;
  2768. case NPY_UINT:
  2769. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":312
  2770. * elif t == NPY_USHORT: f = "H"
  2771. * elif t == NPY_INT: f = "i"
  2772. * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<<
  2773. * elif t == NPY_LONG: f = "l"
  2774. * elif t == NPY_ULONG: f = "L"
  2775. */
  2776. __pyx_v_f = ((char *)"I");
  2777. break;
  2778. case NPY_LONG:
  2779. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":313
  2780. * elif t == NPY_INT: f = "i"
  2781. * elif t == NPY_UINT: f = "I"
  2782. * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<<
  2783. * elif t == NPY_ULONG: f = "L"
  2784. * elif t == NPY_LONGLONG: f = "q"
  2785. */
  2786. __pyx_v_f = ((char *)"l");
  2787. break;
  2788. case NPY_ULONG:
  2789. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":314
  2790. * elif t == NPY_UINT: f = "I"
  2791. * elif t == NPY_LONG: f = "l"
  2792. * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<<
  2793. * elif t == NPY_LONGLONG: f = "q"
  2794. * elif t == NPY_ULONGLONG: f = "Q"
  2795. */
  2796. __pyx_v_f = ((char *)"L");
  2797. break;
  2798. case NPY_LONGLONG:
  2799. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":315
  2800. * elif t == NPY_LONG: f = "l"
  2801. * elif t == NPY_ULONG: f = "L"
  2802. * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<<
  2803. * elif t == NPY_ULONGLONG: f = "Q"
  2804. * elif t == NPY_FLOAT: f = "f"
  2805. */
  2806. __pyx_v_f = ((char *)"q");
  2807. break;
  2808. case NPY_ULONGLONG:
  2809. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":316
  2810. * elif t == NPY_ULONG: f = "L"
  2811. * elif t == NPY_LONGLONG: f = "q"
  2812. * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<<
  2813. * elif t == NPY_FLOAT: f = "f"
  2814. * elif t == NPY_DOUBLE: f = "d"
  2815. */
  2816. __pyx_v_f = ((char *)"Q");
  2817. break;
  2818. case NPY_FLOAT:
  2819. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":317
  2820. * elif t == NPY_LONGLONG: f = "q"
  2821. * elif t == NPY_ULONGLONG: f = "Q"
  2822. * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<<
  2823. * elif t == NPY_DOUBLE: f = "d"
  2824. * elif t == NPY_LONGDOUBLE: f = "g"
  2825. */
  2826. __pyx_v_f = ((char *)"f");
  2827. break;
  2828. case NPY_DOUBLE:
  2829. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":318
  2830. * elif t == NPY_ULONGLONG: f = "Q"
  2831. * elif t == NPY_FLOAT: f = "f"
  2832. * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<<
  2833. * elif t == NPY_LONGDOUBLE: f = "g"
  2834. * elif t == NPY_CFLOAT: f = "Zf"
  2835. */
  2836. __pyx_v_f = ((char *)"d");
  2837. break;
  2838. case NPY_LONGDOUBLE:
  2839. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":319
  2840. * elif t == NPY_FLOAT: f = "f"
  2841. * elif t == NPY_DOUBLE: f = "d"
  2842. * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<<
  2843. * elif t == NPY_CFLOAT: f = "Zf"
  2844. * elif t == NPY_CDOUBLE: f = "Zd"
  2845. */
  2846. __pyx_v_f = ((char *)"g");
  2847. break;
  2848. case NPY_CFLOAT:
  2849. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":320
  2850. * elif t == NPY_DOUBLE: f = "d"
  2851. * elif t == NPY_LONGDOUBLE: f = "g"
  2852. * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<<
  2853. * elif t == NPY_CDOUBLE: f = "Zd"
  2854. * elif t == NPY_CLONGDOUBLE: f = "Zg"
  2855. */
  2856. __pyx_v_f = ((char *)"Zf");
  2857. break;
  2858. case NPY_CDOUBLE:
  2859. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":321
  2860. * elif t == NPY_LONGDOUBLE: f = "g"
  2861. * elif t == NPY_CFLOAT: f = "Zf"
  2862. * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<<
  2863. * elif t == NPY_CLONGDOUBLE: f = "Zg"
  2864. * elif t == NPY_OBJECT: f = "O"
  2865. */
  2866. __pyx_v_f = ((char *)"Zd");
  2867. break;
  2868. case NPY_CLONGDOUBLE:
  2869. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":322
  2870. * elif t == NPY_CFLOAT: f = "Zf"
  2871. * elif t == NPY_CDOUBLE: f = "Zd"
  2872. * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<<
  2873. * elif t == NPY_OBJECT: f = "O"
  2874. * else:
  2875. */
  2876. __pyx_v_f = ((char *)"Zg");
  2877. break;
  2878. case NPY_OBJECT:
  2879. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":323
  2880. * elif t == NPY_CDOUBLE: f = "Zd"
  2881. * elif t == NPY_CLONGDOUBLE: f = "Zg"
  2882. * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<<
  2883. * else:
  2884. * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  2885. */
  2886. __pyx_v_f = ((char *)"O");
  2887. break;
  2888. default:
  2889. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":325
  2890. * elif t == NPY_OBJECT: f = "O"
  2891. * else:
  2892. * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
  2893. * info.format = f
  2894. * return
  2895. */
  2896. __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 325, __pyx_L1_error)
  2897. __Pyx_GOTREF(__pyx_t_3);
  2898. __pyx_t_8 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 325, __pyx_L1_error)
  2899. __Pyx_GOTREF(__pyx_t_8);
  2900. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2901. __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 325, __pyx_L1_error)
  2902. __Pyx_GOTREF(__pyx_t_3);
  2903. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  2904. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  2905. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2906. __PYX_ERR(1, 325, __pyx_L1_error)
  2907. break;
  2908. }
  2909. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":326
  2910. * else:
  2911. * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  2912. * info.format = f # <<<<<<<<<<<<<<
  2913. * return
  2914. * else:
  2915. */
  2916. __pyx_v_info->format = __pyx_v_f;
  2917. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":327
  2918. * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  2919. * info.format = f
  2920. * return # <<<<<<<<<<<<<<
  2921. * else:
  2922. * info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
  2923. */
  2924. __pyx_r = 0;
  2925. goto __pyx_L0;
  2926. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":302
  2927. * info.obj = self
  2928. *
  2929. * if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<<
  2930. * t = descr.type_num
  2931. * if ((descr.byteorder == c'>' and little_endian) or
  2932. */
  2933. }
  2934. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":329
  2935. * return
  2936. * else:
  2937. * info.format = <char*>PyObject_Malloc(_buffer_format_string_len) # <<<<<<<<<<<<<<
  2938. * info.format[0] = c'^' # Native data types, manual alignment
  2939. * offset = 0
  2940. */
  2941. /*else*/ {
  2942. __pyx_v_info->format = ((char *)PyObject_Malloc(0xFF));
  2943. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":330
  2944. * else:
  2945. * info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
  2946. * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<<
  2947. * offset = 0
  2948. * f = _util_dtypestring(descr, info.format + 1,
  2949. */
  2950. (__pyx_v_info->format[0]) = '^';
  2951. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":331
  2952. * info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
  2953. * info.format[0] = c'^' # Native data types, manual alignment
  2954. * offset = 0 # <<<<<<<<<<<<<<
  2955. * f = _util_dtypestring(descr, info.format + 1,
  2956. * info.format + _buffer_format_string_len,
  2957. */
  2958. __pyx_v_offset = 0;
  2959. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":332
  2960. * info.format[0] = c'^' # Native data types, manual alignment
  2961. * offset = 0
  2962. * f = _util_dtypestring(descr, info.format + 1, # <<<<<<<<<<<<<<
  2963. * info.format + _buffer_format_string_len,
  2964. * &offset)
  2965. */
  2966. __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 332, __pyx_L1_error)
  2967. __pyx_v_f = __pyx_t_9;
  2968. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":335
  2969. * info.format + _buffer_format_string_len,
  2970. * &offset)
  2971. * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<<
  2972. *
  2973. * def __releasebuffer__(ndarray self, Py_buffer* info):
  2974. */
  2975. (__pyx_v_f[0]) = '\x00';
  2976. }
  2977. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":258
  2978. * # experimental exception made for __getbuffer__ and __releasebuffer__
  2979. * # -- the details of this may change.
  2980. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
  2981. * # This implementation of getbuffer is geared towards Cython
  2982. * # requirements, and does not yet fulfill the PEP.
  2983. */
  2984. /* function exit code */
  2985. __pyx_r = 0;
  2986. goto __pyx_L0;
  2987. __pyx_L1_error:;
  2988. __Pyx_XDECREF(__pyx_t_3);
  2989. __Pyx_XDECREF(__pyx_t_8);
  2990. __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2991. __pyx_r = -1;
  2992. if (__pyx_v_info->obj != NULL) {
  2993. __Pyx_GOTREF(__pyx_v_info->obj);
  2994. __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  2995. }
  2996. goto __pyx_L2;
  2997. __pyx_L0:;
  2998. if (__pyx_v_info->obj == Py_None) {
  2999. __Pyx_GOTREF(__pyx_v_info->obj);
  3000. __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  3001. }
  3002. __pyx_L2:;
  3003. __Pyx_XDECREF((PyObject *)__pyx_v_descr);
  3004. __Pyx_RefNannyFinishContext();
  3005. return __pyx_r;
  3006. }
  3007. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":337
  3008. * f[0] = c'\0' # Terminate format string
  3009. *
  3010. * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
  3011. * if PyArray_HASFIELDS(self):
  3012. * PyObject_Free(info.format)
  3013. */
  3014. /* Python wrapper */
  3015. static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
  3016. static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  3017. __Pyx_RefNannyDeclarations
  3018. __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
  3019. __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
  3020. /* function exit code */
  3021. __Pyx_RefNannyFinishContext();
  3022. }
  3023. static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  3024. __Pyx_RefNannyDeclarations
  3025. int __pyx_t_1;
  3026. __Pyx_RefNannySetupContext("__releasebuffer__", 0);
  3027. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":338
  3028. *
  3029. * def __releasebuffer__(ndarray self, Py_buffer* info):
  3030. * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
  3031. * PyObject_Free(info.format)
  3032. * if sizeof(npy_intp) != sizeof(Py_ssize_t):
  3033. */
  3034. __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
  3035. if (__pyx_t_1) {
  3036. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":339
  3037. * def __releasebuffer__(ndarray self, Py_buffer* info):
  3038. * if PyArray_HASFIELDS(self):
  3039. * PyObject_Free(info.format) # <<<<<<<<<<<<<<
  3040. * if sizeof(npy_intp) != sizeof(Py_ssize_t):
  3041. * PyObject_Free(info.strides)
  3042. */
  3043. PyObject_Free(__pyx_v_info->format);
  3044. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":338
  3045. *
  3046. * def __releasebuffer__(ndarray self, Py_buffer* info):
  3047. * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
  3048. * PyObject_Free(info.format)
  3049. * if sizeof(npy_intp) != sizeof(Py_ssize_t):
  3050. */
  3051. }
  3052. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":340
  3053. * if PyArray_HASFIELDS(self):
  3054. * PyObject_Free(info.format)
  3055. * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
  3056. * PyObject_Free(info.strides)
  3057. * # info.shape was stored after info.strides in the same block
  3058. */
  3059. __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
  3060. if (__pyx_t_1) {
  3061. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":341
  3062. * PyObject_Free(info.format)
  3063. * if sizeof(npy_intp) != sizeof(Py_ssize_t):
  3064. * PyObject_Free(info.strides) # <<<<<<<<<<<<<<
  3065. * # info.shape was stored after info.strides in the same block
  3066. *
  3067. */
  3068. PyObject_Free(__pyx_v_info->strides);
  3069. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":340
  3070. * if PyArray_HASFIELDS(self):
  3071. * PyObject_Free(info.format)
  3072. * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
  3073. * PyObject_Free(info.strides)
  3074. * # info.shape was stored after info.strides in the same block
  3075. */
  3076. }
  3077. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":337
  3078. * f[0] = c'\0' # Terminate format string
  3079. *
  3080. * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
  3081. * if PyArray_HASFIELDS(self):
  3082. * PyObject_Free(info.format)
  3083. */
  3084. /* function exit code */
  3085. __Pyx_RefNannyFinishContext();
  3086. }
  3087. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":821
  3088. * ctypedef npy_cdouble complex_t
  3089. *
  3090. * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
  3091. * return PyArray_MultiIterNew(1, <void*>a)
  3092. *
  3093. */
  3094. static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
  3095. PyObject *__pyx_r = NULL;
  3096. __Pyx_RefNannyDeclarations
  3097. PyObject *__pyx_t_1 = NULL;
  3098. __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
  3099. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":822
  3100. *
  3101. * cdef inline object PyArray_MultiIterNew1(a):
  3102. * return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<<
  3103. *
  3104. * cdef inline object PyArray_MultiIterNew2(a, b):
  3105. */
  3106. __Pyx_XDECREF(__pyx_r);
  3107. __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 822, __pyx_L1_error)
  3108. __Pyx_GOTREF(__pyx_t_1);
  3109. __pyx_r = __pyx_t_1;
  3110. __pyx_t_1 = 0;
  3111. goto __pyx_L0;
  3112. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":821
  3113. * ctypedef npy_cdouble complex_t
  3114. *
  3115. * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
  3116. * return PyArray_MultiIterNew(1, <void*>a)
  3117. *
  3118. */
  3119. /* function exit code */
  3120. __pyx_L1_error:;
  3121. __Pyx_XDECREF(__pyx_t_1);
  3122. __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3123. __pyx_r = 0;
  3124. __pyx_L0:;
  3125. __Pyx_XGIVEREF(__pyx_r);
  3126. __Pyx_RefNannyFinishContext();
  3127. return __pyx_r;
  3128. }
  3129. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":824
  3130. * return PyArray_MultiIterNew(1, <void*>a)
  3131. *
  3132. * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
  3133. * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
  3134. *
  3135. */
  3136. static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  3137. PyObject *__pyx_r = NULL;
  3138. __Pyx_RefNannyDeclarations
  3139. PyObject *__pyx_t_1 = NULL;
  3140. __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
  3141. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":825
  3142. *
  3143. * cdef inline object PyArray_MultiIterNew2(a, b):
  3144. * return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<<
  3145. *
  3146. * cdef inline object PyArray_MultiIterNew3(a, b, c):
  3147. */
  3148. __Pyx_XDECREF(__pyx_r);
  3149. __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 825, __pyx_L1_error)
  3150. __Pyx_GOTREF(__pyx_t_1);
  3151. __pyx_r = __pyx_t_1;
  3152. __pyx_t_1 = 0;
  3153. goto __pyx_L0;
  3154. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":824
  3155. * return PyArray_MultiIterNew(1, <void*>a)
  3156. *
  3157. * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
  3158. * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
  3159. *
  3160. */
  3161. /* function exit code */
  3162. __pyx_L1_error:;
  3163. __Pyx_XDECREF(__pyx_t_1);
  3164. __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3165. __pyx_r = 0;
  3166. __pyx_L0:;
  3167. __Pyx_XGIVEREF(__pyx_r);
  3168. __Pyx_RefNannyFinishContext();
  3169. return __pyx_r;
  3170. }
  3171. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":827
  3172. * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
  3173. *
  3174. * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
  3175. * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
  3176. *
  3177. */
  3178. static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
  3179. PyObject *__pyx_r = NULL;
  3180. __Pyx_RefNannyDeclarations
  3181. PyObject *__pyx_t_1 = NULL;
  3182. __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
  3183. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":828
  3184. *
  3185. * cdef inline object PyArray_MultiIterNew3(a, b, c):
  3186. * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<<
  3187. *
  3188. * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
  3189. */
  3190. __Pyx_XDECREF(__pyx_r);
  3191. __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 828, __pyx_L1_error)
  3192. __Pyx_GOTREF(__pyx_t_1);
  3193. __pyx_r = __pyx_t_1;
  3194. __pyx_t_1 = 0;
  3195. goto __pyx_L0;
  3196. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":827
  3197. * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
  3198. *
  3199. * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
  3200. * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
  3201. *
  3202. */
  3203. /* function exit code */
  3204. __pyx_L1_error:;
  3205. __Pyx_XDECREF(__pyx_t_1);
  3206. __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3207. __pyx_r = 0;
  3208. __pyx_L0:;
  3209. __Pyx_XGIVEREF(__pyx_r);
  3210. __Pyx_RefNannyFinishContext();
  3211. return __pyx_r;
  3212. }
  3213. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":830
  3214. * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
  3215. *
  3216. * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
  3217. * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
  3218. *
  3219. */
  3220. static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
  3221. PyObject *__pyx_r = NULL;
  3222. __Pyx_RefNannyDeclarations
  3223. PyObject *__pyx_t_1 = NULL;
  3224. __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
  3225. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":831
  3226. *
  3227. * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
  3228. * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<<
  3229. *
  3230. * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
  3231. */
  3232. __Pyx_XDECREF(__pyx_r);
  3233. __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 831, __pyx_L1_error)
  3234. __Pyx_GOTREF(__pyx_t_1);
  3235. __pyx_r = __pyx_t_1;
  3236. __pyx_t_1 = 0;
  3237. goto __pyx_L0;
  3238. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":830
  3239. * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
  3240. *
  3241. * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
  3242. * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
  3243. *
  3244. */
  3245. /* function exit code */
  3246. __pyx_L1_error:;
  3247. __Pyx_XDECREF(__pyx_t_1);
  3248. __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3249. __pyx_r = 0;
  3250. __pyx_L0:;
  3251. __Pyx_XGIVEREF(__pyx_r);
  3252. __Pyx_RefNannyFinishContext();
  3253. return __pyx_r;
  3254. }
  3255. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":833
  3256. * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
  3257. *
  3258. * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
  3259. * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
  3260. *
  3261. */
  3262. static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
  3263. PyObject *__pyx_r = NULL;
  3264. __Pyx_RefNannyDeclarations
  3265. PyObject *__pyx_t_1 = NULL;
  3266. __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
  3267. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":834
  3268. *
  3269. * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
  3270. * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<<
  3271. *
  3272. * cdef inline tuple PyDataType_SHAPE(dtype d):
  3273. */
  3274. __Pyx_XDECREF(__pyx_r);
  3275. __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 834, __pyx_L1_error)
  3276. __Pyx_GOTREF(__pyx_t_1);
  3277. __pyx_r = __pyx_t_1;
  3278. __pyx_t_1 = 0;
  3279. goto __pyx_L0;
  3280. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":833
  3281. * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
  3282. *
  3283. * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
  3284. * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
  3285. *
  3286. */
  3287. /* function exit code */
  3288. __pyx_L1_error:;
  3289. __Pyx_XDECREF(__pyx_t_1);
  3290. __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3291. __pyx_r = 0;
  3292. __pyx_L0:;
  3293. __Pyx_XGIVEREF(__pyx_r);
  3294. __Pyx_RefNannyFinishContext();
  3295. return __pyx_r;
  3296. }
  3297. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":836
  3298. * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
  3299. *
  3300. * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
  3301. * if PyDataType_HASSUBARRAY(d):
  3302. * return <tuple>d.subarray.shape
  3303. */
  3304. static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
  3305. PyObject *__pyx_r = NULL;
  3306. __Pyx_RefNannyDeclarations
  3307. int __pyx_t_1;
  3308. __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
  3309. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":837
  3310. *
  3311. * cdef inline tuple PyDataType_SHAPE(dtype d):
  3312. * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
  3313. * return <tuple>d.subarray.shape
  3314. * else:
  3315. */
  3316. __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
  3317. if (__pyx_t_1) {
  3318. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":838
  3319. * cdef inline tuple PyDataType_SHAPE(dtype d):
  3320. * if PyDataType_HASSUBARRAY(d):
  3321. * return <tuple>d.subarray.shape # <<<<<<<<<<<<<<
  3322. * else:
  3323. * return ()
  3324. */
  3325. __Pyx_XDECREF(__pyx_r);
  3326. __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
  3327. __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
  3328. goto __pyx_L0;
  3329. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":837
  3330. *
  3331. * cdef inline tuple PyDataType_SHAPE(dtype d):
  3332. * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
  3333. * return <tuple>d.subarray.shape
  3334. * else:
  3335. */
  3336. }
  3337. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":840
  3338. * return <tuple>d.subarray.shape
  3339. * else:
  3340. * return () # <<<<<<<<<<<<<<
  3341. *
  3342. * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
  3343. */
  3344. /*else*/ {
  3345. __Pyx_XDECREF(__pyx_r);
  3346. __Pyx_INCREF(__pyx_empty_tuple);
  3347. __pyx_r = __pyx_empty_tuple;
  3348. goto __pyx_L0;
  3349. }
  3350. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":836
  3351. * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
  3352. *
  3353. * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
  3354. * if PyDataType_HASSUBARRAY(d):
  3355. * return <tuple>d.subarray.shape
  3356. */
  3357. /* function exit code */
  3358. __pyx_L0:;
  3359. __Pyx_XGIVEREF(__pyx_r);
  3360. __Pyx_RefNannyFinishContext();
  3361. return __pyx_r;
  3362. }
  3363. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":842
  3364. * return ()
  3365. *
  3366. * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
  3367. * # Recursive utility function used in __getbuffer__ to get format
  3368. * # string. The new location in the format string is returned.
  3369. */
  3370. static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
  3371. PyArray_Descr *__pyx_v_child = 0;
  3372. int __pyx_v_endian_detector;
  3373. int __pyx_v_little_endian;
  3374. PyObject *__pyx_v_fields = 0;
  3375. PyObject *__pyx_v_childname = NULL;
  3376. PyObject *__pyx_v_new_offset = NULL;
  3377. PyObject *__pyx_v_t = NULL;
  3378. char *__pyx_r;
  3379. __Pyx_RefNannyDeclarations
  3380. PyObject *__pyx_t_1 = NULL;
  3381. Py_ssize_t __pyx_t_2;
  3382. PyObject *__pyx_t_3 = NULL;
  3383. PyObject *__pyx_t_4 = NULL;
  3384. int __pyx_t_5;
  3385. int __pyx_t_6;
  3386. int __pyx_t_7;
  3387. long __pyx_t_8;
  3388. char *__pyx_t_9;
  3389. __Pyx_RefNannySetupContext("_util_dtypestring", 0);
  3390. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":847
  3391. *
  3392. * cdef dtype child
  3393. * cdef int endian_detector = 1 # <<<<<<<<<<<<<<
  3394. * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
  3395. * cdef tuple fields
  3396. */
  3397. __pyx_v_endian_detector = 1;
  3398. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":848
  3399. * cdef dtype child
  3400. * cdef int endian_detector = 1
  3401. * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
  3402. * cdef tuple fields
  3403. *
  3404. */
  3405. __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
  3406. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":851
  3407. * cdef tuple fields
  3408. *
  3409. * for childname in descr.names: # <<<<<<<<<<<<<<
  3410. * fields = descr.fields[childname]
  3411. * child, new_offset = fields
  3412. */
  3413. if (unlikely(__pyx_v_descr->names == Py_None)) {
  3414. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
  3415. __PYX_ERR(1, 851, __pyx_L1_error)
  3416. }
  3417. __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  3418. for (;;) {
  3419. if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
  3420. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  3421. __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 851, __pyx_L1_error)
  3422. #else
  3423. __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 851, __pyx_L1_error)
  3424. __Pyx_GOTREF(__pyx_t_3);
  3425. #endif
  3426. __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
  3427. __pyx_t_3 = 0;
  3428. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":852
  3429. *
  3430. * for childname in descr.names:
  3431. * fields = descr.fields[childname] # <<<<<<<<<<<<<<
  3432. * child, new_offset = fields
  3433. *
  3434. */
  3435. if (unlikely(__pyx_v_descr->fields == Py_None)) {
  3436. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
  3437. __PYX_ERR(1, 852, __pyx_L1_error)
  3438. }
  3439. __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 852, __pyx_L1_error)
  3440. __Pyx_GOTREF(__pyx_t_3);
  3441. if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(1, 852, __pyx_L1_error)
  3442. __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
  3443. __pyx_t_3 = 0;
  3444. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":853
  3445. * for childname in descr.names:
  3446. * fields = descr.fields[childname]
  3447. * child, new_offset = fields # <<<<<<<<<<<<<<
  3448. *
  3449. * if (end - f) - <int>(new_offset - offset[0]) < 15:
  3450. */
  3451. if (likely(__pyx_v_fields != Py_None)) {
  3452. PyObject* sequence = __pyx_v_fields;
  3453. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  3454. if (unlikely(size != 2)) {
  3455. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  3456. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  3457. __PYX_ERR(1, 853, __pyx_L1_error)
  3458. }
  3459. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  3460. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  3461. __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
  3462. __Pyx_INCREF(__pyx_t_3);
  3463. __Pyx_INCREF(__pyx_t_4);
  3464. #else
  3465. __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 853, __pyx_L1_error)
  3466. __Pyx_GOTREF(__pyx_t_3);
  3467. __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 853, __pyx_L1_error)
  3468. __Pyx_GOTREF(__pyx_t_4);
  3469. #endif
  3470. } else {
  3471. __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 853, __pyx_L1_error)
  3472. }
  3473. if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 853, __pyx_L1_error)
  3474. __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
  3475. __pyx_t_3 = 0;
  3476. __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
  3477. __pyx_t_4 = 0;
  3478. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":855
  3479. * child, new_offset = fields
  3480. *
  3481. * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
  3482. * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
  3483. *
  3484. */
  3485. __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 855, __pyx_L1_error)
  3486. __Pyx_GOTREF(__pyx_t_4);
  3487. __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 855, __pyx_L1_error)
  3488. __Pyx_GOTREF(__pyx_t_3);
  3489. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3490. __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 855, __pyx_L1_error)
  3491. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3492. __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
  3493. if (unlikely(__pyx_t_6)) {
  3494. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":856
  3495. *
  3496. * if (end - f) - <int>(new_offset - offset[0]) < 15:
  3497. * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
  3498. *
  3499. * if ((child.byteorder == c'>' and little_endian) or
  3500. */
  3501. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 856, __pyx_L1_error)
  3502. __Pyx_GOTREF(__pyx_t_3);
  3503. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  3504. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3505. __PYX_ERR(1, 856, __pyx_L1_error)
  3506. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":855
  3507. * child, new_offset = fields
  3508. *
  3509. * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
  3510. * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
  3511. *
  3512. */
  3513. }
  3514. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":858
  3515. * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
  3516. *
  3517. * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
  3518. * (child.byteorder == c'<' and not little_endian)):
  3519. * raise ValueError(u"Non-native byte order not supported")
  3520. */
  3521. __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
  3522. if (!__pyx_t_7) {
  3523. goto __pyx_L8_next_or;
  3524. } else {
  3525. }
  3526. __pyx_t_7 = (__pyx_v_little_endian != 0);
  3527. if (!__pyx_t_7) {
  3528. } else {
  3529. __pyx_t_6 = __pyx_t_7;
  3530. goto __pyx_L7_bool_binop_done;
  3531. }
  3532. __pyx_L8_next_or:;
  3533. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":859
  3534. *
  3535. * if ((child.byteorder == c'>' and little_endian) or
  3536. * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
  3537. * raise ValueError(u"Non-native byte order not supported")
  3538. * # One could encode it in the format string and have Cython
  3539. */
  3540. __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
  3541. if (__pyx_t_7) {
  3542. } else {
  3543. __pyx_t_6 = __pyx_t_7;
  3544. goto __pyx_L7_bool_binop_done;
  3545. }
  3546. __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
  3547. __pyx_t_6 = __pyx_t_7;
  3548. __pyx_L7_bool_binop_done:;
  3549. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":858
  3550. * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
  3551. *
  3552. * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
  3553. * (child.byteorder == c'<' and not little_endian)):
  3554. * raise ValueError(u"Non-native byte order not supported")
  3555. */
  3556. if (unlikely(__pyx_t_6)) {
  3557. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":860
  3558. * if ((child.byteorder == c'>' and little_endian) or
  3559. * (child.byteorder == c'<' and not little_endian)):
  3560. * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
  3561. * # One could encode it in the format string and have Cython
  3562. * # complain instead, BUT: < and > in format strings also imply
  3563. */
  3564. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 860, __pyx_L1_error)
  3565. __Pyx_GOTREF(__pyx_t_3);
  3566. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  3567. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3568. __PYX_ERR(1, 860, __pyx_L1_error)
  3569. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":858
  3570. * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
  3571. *
  3572. * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
  3573. * (child.byteorder == c'<' and not little_endian)):
  3574. * raise ValueError(u"Non-native byte order not supported")
  3575. */
  3576. }
  3577. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":870
  3578. *
  3579. * # Output padding bytes
  3580. * while offset[0] < new_offset: # <<<<<<<<<<<<<<
  3581. * f[0] = 120 # "x"; pad byte
  3582. * f += 1
  3583. */
  3584. while (1) {
  3585. __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 870, __pyx_L1_error)
  3586. __Pyx_GOTREF(__pyx_t_3);
  3587. __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 870, __pyx_L1_error)
  3588. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3589. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 870, __pyx_L1_error)
  3590. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3591. if (!__pyx_t_6) break;
  3592. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":871
  3593. * # Output padding bytes
  3594. * while offset[0] < new_offset:
  3595. * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<<
  3596. * f += 1
  3597. * offset[0] += 1
  3598. */
  3599. (__pyx_v_f[0]) = 0x78;
  3600. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":872
  3601. * while offset[0] < new_offset:
  3602. * f[0] = 120 # "x"; pad byte
  3603. * f += 1 # <<<<<<<<<<<<<<
  3604. * offset[0] += 1
  3605. *
  3606. */
  3607. __pyx_v_f = (__pyx_v_f + 1);
  3608. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":873
  3609. * f[0] = 120 # "x"; pad byte
  3610. * f += 1
  3611. * offset[0] += 1 # <<<<<<<<<<<<<<
  3612. *
  3613. * offset[0] += child.itemsize
  3614. */
  3615. __pyx_t_8 = 0;
  3616. (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
  3617. }
  3618. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":875
  3619. * offset[0] += 1
  3620. *
  3621. * offset[0] += child.itemsize # <<<<<<<<<<<<<<
  3622. *
  3623. * if not PyDataType_HASFIELDS(child):
  3624. */
  3625. __pyx_t_8 = 0;
  3626. (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
  3627. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":877
  3628. * offset[0] += child.itemsize
  3629. *
  3630. * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
  3631. * t = child.type_num
  3632. * if end - f < 5:
  3633. */
  3634. __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
  3635. if (__pyx_t_6) {
  3636. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":878
  3637. *
  3638. * if not PyDataType_HASFIELDS(child):
  3639. * t = child.type_num # <<<<<<<<<<<<<<
  3640. * if end - f < 5:
  3641. * raise RuntimeError(u"Format string allocated too short.")
  3642. */
  3643. __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 878, __pyx_L1_error)
  3644. __Pyx_GOTREF(__pyx_t_4);
  3645. __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
  3646. __pyx_t_4 = 0;
  3647. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":879
  3648. * if not PyDataType_HASFIELDS(child):
  3649. * t = child.type_num
  3650. * if end - f < 5: # <<<<<<<<<<<<<<
  3651. * raise RuntimeError(u"Format string allocated too short.")
  3652. *
  3653. */
  3654. __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
  3655. if (unlikely(__pyx_t_6)) {
  3656. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":880
  3657. * t = child.type_num
  3658. * if end - f < 5:
  3659. * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
  3660. *
  3661. * # Until ticket #99 is fixed, use integers to avoid warnings
  3662. */
  3663. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 880, __pyx_L1_error)
  3664. __Pyx_GOTREF(__pyx_t_4);
  3665. __Pyx_Raise(__pyx_t_4, 0, 0, 0);
  3666. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3667. __PYX_ERR(1, 880, __pyx_L1_error)
  3668. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":879
  3669. * if not PyDataType_HASFIELDS(child):
  3670. * t = child.type_num
  3671. * if end - f < 5: # <<<<<<<<<<<<<<
  3672. * raise RuntimeError(u"Format string allocated too short.")
  3673. *
  3674. */
  3675. }
  3676. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":883
  3677. *
  3678. * # Until ticket #99 is fixed, use integers to avoid warnings
  3679. * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<<
  3680. * elif t == NPY_UBYTE: f[0] = 66 #"B"
  3681. * elif t == NPY_SHORT: f[0] = 104 #"h"
  3682. */
  3683. __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 883, __pyx_L1_error)
  3684. __Pyx_GOTREF(__pyx_t_4);
  3685. __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 883, __pyx_L1_error)
  3686. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3687. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 883, __pyx_L1_error)
  3688. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3689. if (__pyx_t_6) {
  3690. (__pyx_v_f[0]) = 98;
  3691. goto __pyx_L15;
  3692. }
  3693. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":884
  3694. * # Until ticket #99 is fixed, use integers to avoid warnings
  3695. * if t == NPY_BYTE: f[0] = 98 #"b"
  3696. * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<<
  3697. * elif t == NPY_SHORT: f[0] = 104 #"h"
  3698. * elif t == NPY_USHORT: f[0] = 72 #"H"
  3699. */
  3700. __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 884, __pyx_L1_error)
  3701. __Pyx_GOTREF(__pyx_t_3);
  3702. __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 884, __pyx_L1_error)
  3703. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3704. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 884, __pyx_L1_error)
  3705. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3706. if (__pyx_t_6) {
  3707. (__pyx_v_f[0]) = 66;
  3708. goto __pyx_L15;
  3709. }
  3710. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":885
  3711. * if t == NPY_BYTE: f[0] = 98 #"b"
  3712. * elif t == NPY_UBYTE: f[0] = 66 #"B"
  3713. * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<<
  3714. * elif t == NPY_USHORT: f[0] = 72 #"H"
  3715. * elif t == NPY_INT: f[0] = 105 #"i"
  3716. */
  3717. __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 885, __pyx_L1_error)
  3718. __Pyx_GOTREF(__pyx_t_4);
  3719. __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 885, __pyx_L1_error)
  3720. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3721. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 885, __pyx_L1_error)
  3722. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3723. if (__pyx_t_6) {
  3724. (__pyx_v_f[0]) = 0x68;
  3725. goto __pyx_L15;
  3726. }
  3727. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":886
  3728. * elif t == NPY_UBYTE: f[0] = 66 #"B"
  3729. * elif t == NPY_SHORT: f[0] = 104 #"h"
  3730. * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<<
  3731. * elif t == NPY_INT: f[0] = 105 #"i"
  3732. * elif t == NPY_UINT: f[0] = 73 #"I"
  3733. */
  3734. __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 886, __pyx_L1_error)
  3735. __Pyx_GOTREF(__pyx_t_3);
  3736. __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 886, __pyx_L1_error)
  3737. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3738. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 886, __pyx_L1_error)
  3739. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3740. if (__pyx_t_6) {
  3741. (__pyx_v_f[0]) = 72;
  3742. goto __pyx_L15;
  3743. }
  3744. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":887
  3745. * elif t == NPY_SHORT: f[0] = 104 #"h"
  3746. * elif t == NPY_USHORT: f[0] = 72 #"H"
  3747. * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<<
  3748. * elif t == NPY_UINT: f[0] = 73 #"I"
  3749. * elif t == NPY_LONG: f[0] = 108 #"l"
  3750. */
  3751. __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 887, __pyx_L1_error)
  3752. __Pyx_GOTREF(__pyx_t_4);
  3753. __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 887, __pyx_L1_error)
  3754. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3755. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 887, __pyx_L1_error)
  3756. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3757. if (__pyx_t_6) {
  3758. (__pyx_v_f[0]) = 0x69;
  3759. goto __pyx_L15;
  3760. }
  3761. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":888
  3762. * elif t == NPY_USHORT: f[0] = 72 #"H"
  3763. * elif t == NPY_INT: f[0] = 105 #"i"
  3764. * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<<
  3765. * elif t == NPY_LONG: f[0] = 108 #"l"
  3766. * elif t == NPY_ULONG: f[0] = 76 #"L"
  3767. */
  3768. __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 888, __pyx_L1_error)
  3769. __Pyx_GOTREF(__pyx_t_3);
  3770. __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 888, __pyx_L1_error)
  3771. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3772. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 888, __pyx_L1_error)
  3773. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3774. if (__pyx_t_6) {
  3775. (__pyx_v_f[0]) = 73;
  3776. goto __pyx_L15;
  3777. }
  3778. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":889
  3779. * elif t == NPY_INT: f[0] = 105 #"i"
  3780. * elif t == NPY_UINT: f[0] = 73 #"I"
  3781. * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<<
  3782. * elif t == NPY_ULONG: f[0] = 76 #"L"
  3783. * elif t == NPY_LONGLONG: f[0] = 113 #"q"
  3784. */
  3785. __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 889, __pyx_L1_error)
  3786. __Pyx_GOTREF(__pyx_t_4);
  3787. __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 889, __pyx_L1_error)
  3788. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3789. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 889, __pyx_L1_error)
  3790. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3791. if (__pyx_t_6) {
  3792. (__pyx_v_f[0]) = 0x6C;
  3793. goto __pyx_L15;
  3794. }
  3795. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":890
  3796. * elif t == NPY_UINT: f[0] = 73 #"I"
  3797. * elif t == NPY_LONG: f[0] = 108 #"l"
  3798. * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<<
  3799. * elif t == NPY_LONGLONG: f[0] = 113 #"q"
  3800. * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
  3801. */
  3802. __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 890, __pyx_L1_error)
  3803. __Pyx_GOTREF(__pyx_t_3);
  3804. __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 890, __pyx_L1_error)
  3805. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3806. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 890, __pyx_L1_error)
  3807. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3808. if (__pyx_t_6) {
  3809. (__pyx_v_f[0]) = 76;
  3810. goto __pyx_L15;
  3811. }
  3812. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":891
  3813. * elif t == NPY_LONG: f[0] = 108 #"l"
  3814. * elif t == NPY_ULONG: f[0] = 76 #"L"
  3815. * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<<
  3816. * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
  3817. * elif t == NPY_FLOAT: f[0] = 102 #"f"
  3818. */
  3819. __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 891, __pyx_L1_error)
  3820. __Pyx_GOTREF(__pyx_t_4);
  3821. __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 891, __pyx_L1_error)
  3822. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3823. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 891, __pyx_L1_error)
  3824. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3825. if (__pyx_t_6) {
  3826. (__pyx_v_f[0]) = 0x71;
  3827. goto __pyx_L15;
  3828. }
  3829. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":892
  3830. * elif t == NPY_ULONG: f[0] = 76 #"L"
  3831. * elif t == NPY_LONGLONG: f[0] = 113 #"q"
  3832. * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<<
  3833. * elif t == NPY_FLOAT: f[0] = 102 #"f"
  3834. * elif t == NPY_DOUBLE: f[0] = 100 #"d"
  3835. */
  3836. __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 892, __pyx_L1_error)
  3837. __Pyx_GOTREF(__pyx_t_3);
  3838. __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 892, __pyx_L1_error)
  3839. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3840. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 892, __pyx_L1_error)
  3841. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3842. if (__pyx_t_6) {
  3843. (__pyx_v_f[0]) = 81;
  3844. goto __pyx_L15;
  3845. }
  3846. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":893
  3847. * elif t == NPY_LONGLONG: f[0] = 113 #"q"
  3848. * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
  3849. * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<<
  3850. * elif t == NPY_DOUBLE: f[0] = 100 #"d"
  3851. * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
  3852. */
  3853. __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 893, __pyx_L1_error)
  3854. __Pyx_GOTREF(__pyx_t_4);
  3855. __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 893, __pyx_L1_error)
  3856. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3857. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 893, __pyx_L1_error)
  3858. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3859. if (__pyx_t_6) {
  3860. (__pyx_v_f[0]) = 0x66;
  3861. goto __pyx_L15;
  3862. }
  3863. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":894
  3864. * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
  3865. * elif t == NPY_FLOAT: f[0] = 102 #"f"
  3866. * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<<
  3867. * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
  3868. * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
  3869. */
  3870. __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 894, __pyx_L1_error)
  3871. __Pyx_GOTREF(__pyx_t_3);
  3872. __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 894, __pyx_L1_error)
  3873. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3874. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 894, __pyx_L1_error)
  3875. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3876. if (__pyx_t_6) {
  3877. (__pyx_v_f[0]) = 0x64;
  3878. goto __pyx_L15;
  3879. }
  3880. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":895
  3881. * elif t == NPY_FLOAT: f[0] = 102 #"f"
  3882. * elif t == NPY_DOUBLE: f[0] = 100 #"d"
  3883. * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<<
  3884. * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
  3885. * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
  3886. */
  3887. __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 895, __pyx_L1_error)
  3888. __Pyx_GOTREF(__pyx_t_4);
  3889. __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 895, __pyx_L1_error)
  3890. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3891. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 895, __pyx_L1_error)
  3892. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3893. if (__pyx_t_6) {
  3894. (__pyx_v_f[0]) = 0x67;
  3895. goto __pyx_L15;
  3896. }
  3897. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":896
  3898. * elif t == NPY_DOUBLE: f[0] = 100 #"d"
  3899. * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
  3900. * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<<
  3901. * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
  3902. * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
  3903. */
  3904. __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 896, __pyx_L1_error)
  3905. __Pyx_GOTREF(__pyx_t_3);
  3906. __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 896, __pyx_L1_error)
  3907. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3908. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 896, __pyx_L1_error)
  3909. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3910. if (__pyx_t_6) {
  3911. (__pyx_v_f[0]) = 90;
  3912. (__pyx_v_f[1]) = 0x66;
  3913. __pyx_v_f = (__pyx_v_f + 1);
  3914. goto __pyx_L15;
  3915. }
  3916. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":897
  3917. * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
  3918. * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
  3919. * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<<
  3920. * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
  3921. * elif t == NPY_OBJECT: f[0] = 79 #"O"
  3922. */
  3923. __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 897, __pyx_L1_error)
  3924. __Pyx_GOTREF(__pyx_t_4);
  3925. __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 897, __pyx_L1_error)
  3926. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3927. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 897, __pyx_L1_error)
  3928. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3929. if (__pyx_t_6) {
  3930. (__pyx_v_f[0]) = 90;
  3931. (__pyx_v_f[1]) = 0x64;
  3932. __pyx_v_f = (__pyx_v_f + 1);
  3933. goto __pyx_L15;
  3934. }
  3935. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":898
  3936. * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
  3937. * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
  3938. * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<<
  3939. * elif t == NPY_OBJECT: f[0] = 79 #"O"
  3940. * else:
  3941. */
  3942. __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 898, __pyx_L1_error)
  3943. __Pyx_GOTREF(__pyx_t_3);
  3944. __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 898, __pyx_L1_error)
  3945. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3946. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 898, __pyx_L1_error)
  3947. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3948. if (__pyx_t_6) {
  3949. (__pyx_v_f[0]) = 90;
  3950. (__pyx_v_f[1]) = 0x67;
  3951. __pyx_v_f = (__pyx_v_f + 1);
  3952. goto __pyx_L15;
  3953. }
  3954. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":899
  3955. * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
  3956. * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
  3957. * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<<
  3958. * else:
  3959. * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  3960. */
  3961. __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 899, __pyx_L1_error)
  3962. __Pyx_GOTREF(__pyx_t_4);
  3963. __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 899, __pyx_L1_error)
  3964. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3965. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 899, __pyx_L1_error)
  3966. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3967. if (likely(__pyx_t_6)) {
  3968. (__pyx_v_f[0]) = 79;
  3969. goto __pyx_L15;
  3970. }
  3971. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":901
  3972. * elif t == NPY_OBJECT: f[0] = 79 #"O"
  3973. * else:
  3974. * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
  3975. * f += 1
  3976. * else:
  3977. */
  3978. /*else*/ {
  3979. __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 901, __pyx_L1_error)
  3980. __Pyx_GOTREF(__pyx_t_3);
  3981. __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 901, __pyx_L1_error)
  3982. __Pyx_GOTREF(__pyx_t_4);
  3983. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3984. __Pyx_Raise(__pyx_t_4, 0, 0, 0);
  3985. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3986. __PYX_ERR(1, 901, __pyx_L1_error)
  3987. }
  3988. __pyx_L15:;
  3989. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":902
  3990. * else:
  3991. * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  3992. * f += 1 # <<<<<<<<<<<<<<
  3993. * else:
  3994. * # Cython ignores struct boundary information ("T{...}"),
  3995. */
  3996. __pyx_v_f = (__pyx_v_f + 1);
  3997. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":877
  3998. * offset[0] += child.itemsize
  3999. *
  4000. * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
  4001. * t = child.type_num
  4002. * if end - f < 5:
  4003. */
  4004. goto __pyx_L13;
  4005. }
  4006. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":906
  4007. * # Cython ignores struct boundary information ("T{...}"),
  4008. * # so don't output it
  4009. * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<<
  4010. * return f
  4011. *
  4012. */
  4013. /*else*/ {
  4014. __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 906, __pyx_L1_error)
  4015. __pyx_v_f = __pyx_t_9;
  4016. }
  4017. __pyx_L13:;
  4018. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":851
  4019. * cdef tuple fields
  4020. *
  4021. * for childname in descr.names: # <<<<<<<<<<<<<<
  4022. * fields = descr.fields[childname]
  4023. * child, new_offset = fields
  4024. */
  4025. }
  4026. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4027. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":907
  4028. * # so don't output it
  4029. * f = _util_dtypestring(child, f, end, offset)
  4030. * return f # <<<<<<<<<<<<<<
  4031. *
  4032. *
  4033. */
  4034. __pyx_r = __pyx_v_f;
  4035. goto __pyx_L0;
  4036. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":842
  4037. * return ()
  4038. *
  4039. * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
  4040. * # Recursive utility function used in __getbuffer__ to get format
  4041. * # string. The new location in the format string is returned.
  4042. */
  4043. /* function exit code */
  4044. __pyx_L1_error:;
  4045. __Pyx_XDECREF(__pyx_t_1);
  4046. __Pyx_XDECREF(__pyx_t_3);
  4047. __Pyx_XDECREF(__pyx_t_4);
  4048. __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4049. __pyx_r = NULL;
  4050. __pyx_L0:;
  4051. __Pyx_XDECREF((PyObject *)__pyx_v_child);
  4052. __Pyx_XDECREF(__pyx_v_fields);
  4053. __Pyx_XDECREF(__pyx_v_childname);
  4054. __Pyx_XDECREF(__pyx_v_new_offset);
  4055. __Pyx_XDECREF(__pyx_v_t);
  4056. __Pyx_RefNannyFinishContext();
  4057. return __pyx_r;
  4058. }
  4059. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1022
  4060. * int _import_umath() except -1
  4061. *
  4062. * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
  4063. * Py_INCREF(base) # important to do this before stealing the reference below!
  4064. * PyArray_SetBaseObject(arr, base)
  4065. */
  4066. static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
  4067. __Pyx_RefNannyDeclarations
  4068. __Pyx_RefNannySetupContext("set_array_base", 0);
  4069. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1023
  4070. *
  4071. * cdef inline void set_array_base(ndarray arr, object base):
  4072. * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<<
  4073. * PyArray_SetBaseObject(arr, base)
  4074. *
  4075. */
  4076. Py_INCREF(__pyx_v_base);
  4077. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1024
  4078. * cdef inline void set_array_base(ndarray arr, object base):
  4079. * Py_INCREF(base) # important to do this before stealing the reference below!
  4080. * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<<
  4081. *
  4082. * cdef inline object get_array_base(ndarray arr):
  4083. */
  4084. (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
  4085. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1022
  4086. * int _import_umath() except -1
  4087. *
  4088. * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
  4089. * Py_INCREF(base) # important to do this before stealing the reference below!
  4090. * PyArray_SetBaseObject(arr, base)
  4091. */
  4092. /* function exit code */
  4093. __Pyx_RefNannyFinishContext();
  4094. }
  4095. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1026
  4096. * PyArray_SetBaseObject(arr, base)
  4097. *
  4098. * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
  4099. * base = PyArray_BASE(arr)
  4100. * if base is NULL:
  4101. */
  4102. static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
  4103. PyObject *__pyx_v_base;
  4104. PyObject *__pyx_r = NULL;
  4105. __Pyx_RefNannyDeclarations
  4106. int __pyx_t_1;
  4107. __Pyx_RefNannySetupContext("get_array_base", 0);
  4108. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1027
  4109. *
  4110. * cdef inline object get_array_base(ndarray arr):
  4111. * base = PyArray_BASE(arr) # <<<<<<<<<<<<<<
  4112. * if base is NULL:
  4113. * return None
  4114. */
  4115. __pyx_v_base = PyArray_BASE(__pyx_v_arr);
  4116. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1028
  4117. * cdef inline object get_array_base(ndarray arr):
  4118. * base = PyArray_BASE(arr)
  4119. * if base is NULL: # <<<<<<<<<<<<<<
  4120. * return None
  4121. * return <object>base
  4122. */
  4123. __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
  4124. if (__pyx_t_1) {
  4125. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1029
  4126. * base = PyArray_BASE(arr)
  4127. * if base is NULL:
  4128. * return None # <<<<<<<<<<<<<<
  4129. * return <object>base
  4130. *
  4131. */
  4132. __Pyx_XDECREF(__pyx_r);
  4133. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  4134. goto __pyx_L0;
  4135. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1028
  4136. * cdef inline object get_array_base(ndarray arr):
  4137. * base = PyArray_BASE(arr)
  4138. * if base is NULL: # <<<<<<<<<<<<<<
  4139. * return None
  4140. * return <object>base
  4141. */
  4142. }
  4143. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1030
  4144. * if base is NULL:
  4145. * return None
  4146. * return <object>base # <<<<<<<<<<<<<<
  4147. *
  4148. * # Versions of the import_* functions which are more suitable for
  4149. */
  4150. __Pyx_XDECREF(__pyx_r);
  4151. __Pyx_INCREF(((PyObject *)__pyx_v_base));
  4152. __pyx_r = ((PyObject *)__pyx_v_base);
  4153. goto __pyx_L0;
  4154. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1026
  4155. * PyArray_SetBaseObject(arr, base)
  4156. *
  4157. * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
  4158. * base = PyArray_BASE(arr)
  4159. * if base is NULL:
  4160. */
  4161. /* function exit code */
  4162. __pyx_L0:;
  4163. __Pyx_XGIVEREF(__pyx_r);
  4164. __Pyx_RefNannyFinishContext();
  4165. return __pyx_r;
  4166. }
  4167. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1034
  4168. * # Versions of the import_* functions which are more suitable for
  4169. * # Cython code.
  4170. * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
  4171. * try:
  4172. * _import_array()
  4173. */
  4174. static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
  4175. int __pyx_r;
  4176. __Pyx_RefNannyDeclarations
  4177. PyObject *__pyx_t_1 = NULL;
  4178. PyObject *__pyx_t_2 = NULL;
  4179. PyObject *__pyx_t_3 = NULL;
  4180. int __pyx_t_4;
  4181. PyObject *__pyx_t_5 = NULL;
  4182. PyObject *__pyx_t_6 = NULL;
  4183. PyObject *__pyx_t_7 = NULL;
  4184. PyObject *__pyx_t_8 = NULL;
  4185. __Pyx_RefNannySetupContext("import_array", 0);
  4186. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1035
  4187. * # Cython code.
  4188. * cdef inline int import_array() except -1:
  4189. * try: # <<<<<<<<<<<<<<
  4190. * _import_array()
  4191. * except Exception:
  4192. */
  4193. {
  4194. __Pyx_PyThreadState_declare
  4195. __Pyx_PyThreadState_assign
  4196. __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  4197. __Pyx_XGOTREF(__pyx_t_1);
  4198. __Pyx_XGOTREF(__pyx_t_2);
  4199. __Pyx_XGOTREF(__pyx_t_3);
  4200. /*try:*/ {
  4201. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1036
  4202. * cdef inline int import_array() except -1:
  4203. * try:
  4204. * _import_array() # <<<<<<<<<<<<<<
  4205. * except Exception:
  4206. * raise ImportError("numpy.core.multiarray failed to import")
  4207. */
  4208. __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1036, __pyx_L3_error)
  4209. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1035
  4210. * # Cython code.
  4211. * cdef inline int import_array() except -1:
  4212. * try: # <<<<<<<<<<<<<<
  4213. * _import_array()
  4214. * except Exception:
  4215. */
  4216. }
  4217. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  4218. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  4219. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  4220. goto __pyx_L8_try_end;
  4221. __pyx_L3_error:;
  4222. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1037
  4223. * try:
  4224. * _import_array()
  4225. * except Exception: # <<<<<<<<<<<<<<
  4226. * raise ImportError("numpy.core.multiarray failed to import")
  4227. *
  4228. */
  4229. __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
  4230. if (__pyx_t_4) {
  4231. __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4232. if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1037, __pyx_L5_except_error)
  4233. __Pyx_GOTREF(__pyx_t_5);
  4234. __Pyx_GOTREF(__pyx_t_6);
  4235. __Pyx_GOTREF(__pyx_t_7);
  4236. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1038
  4237. * _import_array()
  4238. * except Exception:
  4239. * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
  4240. *
  4241. * cdef inline int import_umath() except -1:
  4242. */
  4243. __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1038, __pyx_L5_except_error)
  4244. __Pyx_GOTREF(__pyx_t_8);
  4245. __Pyx_Raise(__pyx_t_8, 0, 0, 0);
  4246. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4247. __PYX_ERR(1, 1038, __pyx_L5_except_error)
  4248. }
  4249. goto __pyx_L5_except_error;
  4250. __pyx_L5_except_error:;
  4251. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1035
  4252. * # Cython code.
  4253. * cdef inline int import_array() except -1:
  4254. * try: # <<<<<<<<<<<<<<
  4255. * _import_array()
  4256. * except Exception:
  4257. */
  4258. __Pyx_XGIVEREF(__pyx_t_1);
  4259. __Pyx_XGIVEREF(__pyx_t_2);
  4260. __Pyx_XGIVEREF(__pyx_t_3);
  4261. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  4262. goto __pyx_L1_error;
  4263. __pyx_L8_try_end:;
  4264. }
  4265. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1034
  4266. * # Versions of the import_* functions which are more suitable for
  4267. * # Cython code.
  4268. * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
  4269. * try:
  4270. * _import_array()
  4271. */
  4272. /* function exit code */
  4273. __pyx_r = 0;
  4274. goto __pyx_L0;
  4275. __pyx_L1_error:;
  4276. __Pyx_XDECREF(__pyx_t_5);
  4277. __Pyx_XDECREF(__pyx_t_6);
  4278. __Pyx_XDECREF(__pyx_t_7);
  4279. __Pyx_XDECREF(__pyx_t_8);
  4280. __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4281. __pyx_r = -1;
  4282. __pyx_L0:;
  4283. __Pyx_RefNannyFinishContext();
  4284. return __pyx_r;
  4285. }
  4286. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1040
  4287. * raise ImportError("numpy.core.multiarray failed to import")
  4288. *
  4289. * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
  4290. * try:
  4291. * _import_umath()
  4292. */
  4293. static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
  4294. int __pyx_r;
  4295. __Pyx_RefNannyDeclarations
  4296. PyObject *__pyx_t_1 = NULL;
  4297. PyObject *__pyx_t_2 = NULL;
  4298. PyObject *__pyx_t_3 = NULL;
  4299. int __pyx_t_4;
  4300. PyObject *__pyx_t_5 = NULL;
  4301. PyObject *__pyx_t_6 = NULL;
  4302. PyObject *__pyx_t_7 = NULL;
  4303. PyObject *__pyx_t_8 = NULL;
  4304. __Pyx_RefNannySetupContext("import_umath", 0);
  4305. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1041
  4306. *
  4307. * cdef inline int import_umath() except -1:
  4308. * try: # <<<<<<<<<<<<<<
  4309. * _import_umath()
  4310. * except Exception:
  4311. */
  4312. {
  4313. __Pyx_PyThreadState_declare
  4314. __Pyx_PyThreadState_assign
  4315. __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  4316. __Pyx_XGOTREF(__pyx_t_1);
  4317. __Pyx_XGOTREF(__pyx_t_2);
  4318. __Pyx_XGOTREF(__pyx_t_3);
  4319. /*try:*/ {
  4320. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1042
  4321. * cdef inline int import_umath() except -1:
  4322. * try:
  4323. * _import_umath() # <<<<<<<<<<<<<<
  4324. * except Exception:
  4325. * raise ImportError("numpy.core.umath failed to import")
  4326. */
  4327. __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1042, __pyx_L3_error)
  4328. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1041
  4329. *
  4330. * cdef inline int import_umath() except -1:
  4331. * try: # <<<<<<<<<<<<<<
  4332. * _import_umath()
  4333. * except Exception:
  4334. */
  4335. }
  4336. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  4337. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  4338. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  4339. goto __pyx_L8_try_end;
  4340. __pyx_L3_error:;
  4341. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1043
  4342. * try:
  4343. * _import_umath()
  4344. * except Exception: # <<<<<<<<<<<<<<
  4345. * raise ImportError("numpy.core.umath failed to import")
  4346. *
  4347. */
  4348. __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
  4349. if (__pyx_t_4) {
  4350. __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4351. if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1043, __pyx_L5_except_error)
  4352. __Pyx_GOTREF(__pyx_t_5);
  4353. __Pyx_GOTREF(__pyx_t_6);
  4354. __Pyx_GOTREF(__pyx_t_7);
  4355. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1044
  4356. * _import_umath()
  4357. * except Exception:
  4358. * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
  4359. *
  4360. * cdef inline int import_ufunc() except -1:
  4361. */
  4362. __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1044, __pyx_L5_except_error)
  4363. __Pyx_GOTREF(__pyx_t_8);
  4364. __Pyx_Raise(__pyx_t_8, 0, 0, 0);
  4365. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4366. __PYX_ERR(1, 1044, __pyx_L5_except_error)
  4367. }
  4368. goto __pyx_L5_except_error;
  4369. __pyx_L5_except_error:;
  4370. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1041
  4371. *
  4372. * cdef inline int import_umath() except -1:
  4373. * try: # <<<<<<<<<<<<<<
  4374. * _import_umath()
  4375. * except Exception:
  4376. */
  4377. __Pyx_XGIVEREF(__pyx_t_1);
  4378. __Pyx_XGIVEREF(__pyx_t_2);
  4379. __Pyx_XGIVEREF(__pyx_t_3);
  4380. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  4381. goto __pyx_L1_error;
  4382. __pyx_L8_try_end:;
  4383. }
  4384. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1040
  4385. * raise ImportError("numpy.core.multiarray failed to import")
  4386. *
  4387. * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
  4388. * try:
  4389. * _import_umath()
  4390. */
  4391. /* function exit code */
  4392. __pyx_r = 0;
  4393. goto __pyx_L0;
  4394. __pyx_L1_error:;
  4395. __Pyx_XDECREF(__pyx_t_5);
  4396. __Pyx_XDECREF(__pyx_t_6);
  4397. __Pyx_XDECREF(__pyx_t_7);
  4398. __Pyx_XDECREF(__pyx_t_8);
  4399. __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4400. __pyx_r = -1;
  4401. __pyx_L0:;
  4402. __Pyx_RefNannyFinishContext();
  4403. return __pyx_r;
  4404. }
  4405. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1046
  4406. * raise ImportError("numpy.core.umath failed to import")
  4407. *
  4408. * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
  4409. * try:
  4410. * _import_umath()
  4411. */
  4412. static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
  4413. int __pyx_r;
  4414. __Pyx_RefNannyDeclarations
  4415. PyObject *__pyx_t_1 = NULL;
  4416. PyObject *__pyx_t_2 = NULL;
  4417. PyObject *__pyx_t_3 = NULL;
  4418. int __pyx_t_4;
  4419. PyObject *__pyx_t_5 = NULL;
  4420. PyObject *__pyx_t_6 = NULL;
  4421. PyObject *__pyx_t_7 = NULL;
  4422. PyObject *__pyx_t_8 = NULL;
  4423. __Pyx_RefNannySetupContext("import_ufunc", 0);
  4424. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1047
  4425. *
  4426. * cdef inline int import_ufunc() except -1:
  4427. * try: # <<<<<<<<<<<<<<
  4428. * _import_umath()
  4429. * except Exception:
  4430. */
  4431. {
  4432. __Pyx_PyThreadState_declare
  4433. __Pyx_PyThreadState_assign
  4434. __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  4435. __Pyx_XGOTREF(__pyx_t_1);
  4436. __Pyx_XGOTREF(__pyx_t_2);
  4437. __Pyx_XGOTREF(__pyx_t_3);
  4438. /*try:*/ {
  4439. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1048
  4440. * cdef inline int import_ufunc() except -1:
  4441. * try:
  4442. * _import_umath() # <<<<<<<<<<<<<<
  4443. * except Exception:
  4444. * raise ImportError("numpy.core.umath failed to import")
  4445. */
  4446. __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1048, __pyx_L3_error)
  4447. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1047
  4448. *
  4449. * cdef inline int import_ufunc() except -1:
  4450. * try: # <<<<<<<<<<<<<<
  4451. * _import_umath()
  4452. * except Exception:
  4453. */
  4454. }
  4455. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  4456. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  4457. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  4458. goto __pyx_L8_try_end;
  4459. __pyx_L3_error:;
  4460. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1049
  4461. * try:
  4462. * _import_umath()
  4463. * except Exception: # <<<<<<<<<<<<<<
  4464. * raise ImportError("numpy.core.umath failed to import")
  4465. */
  4466. __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
  4467. if (__pyx_t_4) {
  4468. __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4469. if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1049, __pyx_L5_except_error)
  4470. __Pyx_GOTREF(__pyx_t_5);
  4471. __Pyx_GOTREF(__pyx_t_6);
  4472. __Pyx_GOTREF(__pyx_t_7);
  4473. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1050
  4474. * _import_umath()
  4475. * except Exception:
  4476. * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
  4477. */
  4478. __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1050, __pyx_L5_except_error)
  4479. __Pyx_GOTREF(__pyx_t_8);
  4480. __Pyx_Raise(__pyx_t_8, 0, 0, 0);
  4481. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4482. __PYX_ERR(1, 1050, __pyx_L5_except_error)
  4483. }
  4484. goto __pyx_L5_except_error;
  4485. __pyx_L5_except_error:;
  4486. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1047
  4487. *
  4488. * cdef inline int import_ufunc() except -1:
  4489. * try: # <<<<<<<<<<<<<<
  4490. * _import_umath()
  4491. * except Exception:
  4492. */
  4493. __Pyx_XGIVEREF(__pyx_t_1);
  4494. __Pyx_XGIVEREF(__pyx_t_2);
  4495. __Pyx_XGIVEREF(__pyx_t_3);
  4496. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  4497. goto __pyx_L1_error;
  4498. __pyx_L8_try_end:;
  4499. }
  4500. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1046
  4501. * raise ImportError("numpy.core.umath failed to import")
  4502. *
  4503. * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
  4504. * try:
  4505. * _import_umath()
  4506. */
  4507. /* function exit code */
  4508. __pyx_r = 0;
  4509. goto __pyx_L0;
  4510. __pyx_L1_error:;
  4511. __Pyx_XDECREF(__pyx_t_5);
  4512. __Pyx_XDECREF(__pyx_t_6);
  4513. __Pyx_XDECREF(__pyx_t_7);
  4514. __Pyx_XDECREF(__pyx_t_8);
  4515. __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4516. __pyx_r = -1;
  4517. __pyx_L0:;
  4518. __Pyx_RefNannyFinishContext();
  4519. return __pyx_r;
  4520. }
  4521. static PyMethodDef __pyx_methods[] = {
  4522. {0, 0, 0, 0}
  4523. };
  4524. #if PY_MAJOR_VERSION >= 3
  4525. #if CYTHON_PEP489_MULTI_PHASE_INIT
  4526. static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
  4527. static int __pyx_pymod_exec_cython_bbox(PyObject* module); /*proto*/
  4528. static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  4529. {Py_mod_create, (void*)__pyx_pymod_create},
  4530. {Py_mod_exec, (void*)__pyx_pymod_exec_cython_bbox},
  4531. {0, NULL}
  4532. };
  4533. #endif
  4534. static struct PyModuleDef __pyx_moduledef = {
  4535. PyModuleDef_HEAD_INIT,
  4536. "cython_bbox",
  4537. 0, /* m_doc */
  4538. #if CYTHON_PEP489_MULTI_PHASE_INIT
  4539. 0, /* m_size */
  4540. #else
  4541. -1, /* m_size */
  4542. #endif
  4543. __pyx_methods /* m_methods */,
  4544. #if CYTHON_PEP489_MULTI_PHASE_INIT
  4545. __pyx_moduledef_slots, /* m_slots */
  4546. #else
  4547. NULL, /* m_reload */
  4548. #endif
  4549. NULL, /* m_traverse */
  4550. NULL, /* m_clear */
  4551. NULL /* m_free */
  4552. };
  4553. #endif
  4554. #ifndef CYTHON_SMALL_CODE
  4555. #if defined(__clang__)
  4556. #define CYTHON_SMALL_CODE
  4557. #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
  4558. #define CYTHON_SMALL_CODE __attribute__((cold))
  4559. #else
  4560. #define CYTHON_SMALL_CODE
  4561. #endif
  4562. #endif
  4563. static __Pyx_StringTabEntry __pyx_string_tab[] = {
  4564. {&__pyx_n_s_DTYPE, __pyx_k_DTYPE, sizeof(__pyx_k_DTYPE), 0, 0, 1, 1},
  4565. {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0},
  4566. {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0},
  4567. {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
  4568. {&__pyx_n_s_K, __pyx_k_K, sizeof(__pyx_k_K), 0, 0, 1, 1},
  4569. {&__pyx_n_s_N, __pyx_k_N, sizeof(__pyx_k_N), 0, 0, 1, 1},
  4570. {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0},
  4571. {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
  4572. {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  4573. {&__pyx_n_s_bbox_overlaps, __pyx_k_bbox_overlaps, sizeof(__pyx_k_bbox_overlaps), 0, 0, 1, 1},
  4574. {&__pyx_n_s_box_area, __pyx_k_box_area, sizeof(__pyx_k_box_area), 0, 0, 1, 1},
  4575. {&__pyx_n_s_boxes, __pyx_k_boxes, sizeof(__pyx_k_boxes), 0, 0, 1, 1},
  4576. {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  4577. {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
  4578. {&__pyx_n_s_float, __pyx_k_float, sizeof(__pyx_k_float), 0, 0, 1, 1},
  4579. {&__pyx_n_s_ih, __pyx_k_ih, sizeof(__pyx_k_ih), 0, 0, 1, 1},
  4580. {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  4581. {&__pyx_n_s_iw, __pyx_k_iw, sizeof(__pyx_k_iw), 0, 0, 1, 1},
  4582. {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
  4583. {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  4584. {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
  4585. {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  4586. {&__pyx_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous, sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0},
  4587. {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0},
  4588. {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
  4589. {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
  4590. {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0},
  4591. {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0},
  4592. {&__pyx_n_s_overlaps, __pyx_k_overlaps, sizeof(__pyx_k_overlaps), 0, 0, 1, 1},
  4593. {&__pyx_n_s_query_boxes, __pyx_k_query_boxes, sizeof(__pyx_k_query_boxes), 0, 0, 1, 1},
  4594. {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  4595. {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  4596. {&__pyx_n_s_ua, __pyx_k_ua, sizeof(__pyx_k_ua), 0, 0, 1, 1},
  4597. {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0},
  4598. {&__pyx_kp_s_utils_bbox_pyx, __pyx_k_utils_bbox_pyx, sizeof(__pyx_k_utils_bbox_pyx), 0, 0, 1, 0},
  4599. {&__pyx_n_s_utils_cython_bbox, __pyx_k_utils_cython_bbox, sizeof(__pyx_k_utils_cython_bbox), 0, 0, 1, 1},
  4600. {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
  4601. {0, 0, 0, 0, 0, 0, 0}
  4602. };
  4603. static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  4604. __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 33, __pyx_L1_error)
  4605. __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 272, __pyx_L1_error)
  4606. __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 856, __pyx_L1_error)
  4607. __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 1038, __pyx_L1_error)
  4608. return 0;
  4609. __pyx_L1_error:;
  4610. return -1;
  4611. }
  4612. static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  4613. __Pyx_RefNannyDeclarations
  4614. __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
  4615. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":272
  4616. * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
  4617. * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
  4618. * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
  4619. *
  4620. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  4621. */
  4622. __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 272, __pyx_L1_error)
  4623. __Pyx_GOTREF(__pyx_tuple_);
  4624. __Pyx_GIVEREF(__pyx_tuple_);
  4625. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":276
  4626. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  4627. * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
  4628. * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
  4629. *
  4630. * info.buf = PyArray_DATA(self)
  4631. */
  4632. __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 276, __pyx_L1_error)
  4633. __Pyx_GOTREF(__pyx_tuple__2);
  4634. __Pyx_GIVEREF(__pyx_tuple__2);
  4635. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":306
  4636. * if ((descr.byteorder == c'>' and little_endian) or
  4637. * (descr.byteorder == c'<' and not little_endian)):
  4638. * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
  4639. * if t == NPY_BYTE: f = "b"
  4640. * elif t == NPY_UBYTE: f = "B"
  4641. */
  4642. __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 306, __pyx_L1_error)
  4643. __Pyx_GOTREF(__pyx_tuple__3);
  4644. __Pyx_GIVEREF(__pyx_tuple__3);
  4645. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":856
  4646. *
  4647. * if (end - f) - <int>(new_offset - offset[0]) < 15:
  4648. * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
  4649. *
  4650. * if ((child.byteorder == c'>' and little_endian) or
  4651. */
  4652. __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 856, __pyx_L1_error)
  4653. __Pyx_GOTREF(__pyx_tuple__4);
  4654. __Pyx_GIVEREF(__pyx_tuple__4);
  4655. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":880
  4656. * t = child.type_num
  4657. * if end - f < 5:
  4658. * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
  4659. *
  4660. * # Until ticket #99 is fixed, use integers to avoid warnings
  4661. */
  4662. __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 880, __pyx_L1_error)
  4663. __Pyx_GOTREF(__pyx_tuple__5);
  4664. __Pyx_GIVEREF(__pyx_tuple__5);
  4665. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1038
  4666. * _import_array()
  4667. * except Exception:
  4668. * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
  4669. *
  4670. * cdef inline int import_umath() except -1:
  4671. */
  4672. __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 1038, __pyx_L1_error)
  4673. __Pyx_GOTREF(__pyx_tuple__6);
  4674. __Pyx_GIVEREF(__pyx_tuple__6);
  4675. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1044
  4676. * _import_umath()
  4677. * except Exception:
  4678. * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
  4679. *
  4680. * cdef inline int import_ufunc() except -1:
  4681. */
  4682. __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 1044, __pyx_L1_error)
  4683. __Pyx_GOTREF(__pyx_tuple__7);
  4684. __Pyx_GIVEREF(__pyx_tuple__7);
  4685. /* "utils/bbox.pyx":15
  4686. * ctypedef np.float_t DTYPE_t
  4687. *
  4688. * def bbox_overlaps( # <<<<<<<<<<<<<<
  4689. * np.ndarray[DTYPE_t, ndim=2] boxes,
  4690. * np.ndarray[DTYPE_t, ndim=2] query_boxes):
  4691. */
  4692. __pyx_tuple__8 = PyTuple_Pack(11, __pyx_n_s_boxes, __pyx_n_s_query_boxes, __pyx_n_s_N, __pyx_n_s_K, __pyx_n_s_overlaps, __pyx_n_s_iw, __pyx_n_s_ih, __pyx_n_s_box_area, __pyx_n_s_ua, __pyx_n_s_k, __pyx_n_s_n); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 15, __pyx_L1_error)
  4693. __Pyx_GOTREF(__pyx_tuple__8);
  4694. __Pyx_GIVEREF(__pyx_tuple__8);
  4695. __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(2, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_utils_bbox_pyx, __pyx_n_s_bbox_overlaps, 15, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 15, __pyx_L1_error)
  4696. __Pyx_RefNannyFinishContext();
  4697. return 0;
  4698. __pyx_L1_error:;
  4699. __Pyx_RefNannyFinishContext();
  4700. return -1;
  4701. }
  4702. static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  4703. if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  4704. return 0;
  4705. __pyx_L1_error:;
  4706. return -1;
  4707. }
  4708. static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
  4709. static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
  4710. static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
  4711. static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
  4712. static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
  4713. static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
  4714. static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
  4715. static int __Pyx_modinit_global_init_code(void) {
  4716. __Pyx_RefNannyDeclarations
  4717. __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  4718. /*--- Global init code ---*/
  4719. __Pyx_RefNannyFinishContext();
  4720. return 0;
  4721. }
  4722. static int __Pyx_modinit_variable_export_code(void) {
  4723. __Pyx_RefNannyDeclarations
  4724. __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  4725. /*--- Variable export code ---*/
  4726. __Pyx_RefNannyFinishContext();
  4727. return 0;
  4728. }
  4729. static int __Pyx_modinit_function_export_code(void) {
  4730. __Pyx_RefNannyDeclarations
  4731. __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  4732. /*--- Function export code ---*/
  4733. __Pyx_RefNannyFinishContext();
  4734. return 0;
  4735. }
  4736. static int __Pyx_modinit_type_init_code(void) {
  4737. __Pyx_RefNannyDeclarations
  4738. __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  4739. /*--- Type init code ---*/
  4740. __Pyx_RefNannyFinishContext();
  4741. return 0;
  4742. }
  4743. static int __Pyx_modinit_type_import_code(void) {
  4744. __Pyx_RefNannyDeclarations
  4745. PyObject *__pyx_t_1 = NULL;
  4746. __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  4747. /*--- Type import code ---*/
  4748. __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error)
  4749. __Pyx_GOTREF(__pyx_t_1);
  4750. __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
  4751. #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  4752. sizeof(PyTypeObject),
  4753. #else
  4754. sizeof(PyHeapTypeObject),
  4755. #endif
  4756. __Pyx_ImportType_CheckSize_Warn);
  4757. if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error)
  4758. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4759. __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 206, __pyx_L1_error)
  4760. __Pyx_GOTREF(__pyx_t_1);
  4761. __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
  4762. if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 206, __pyx_L1_error)
  4763. __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Warn);
  4764. if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 229, __pyx_L1_error)
  4765. __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Warn);
  4766. if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 233, __pyx_L1_error)
  4767. __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
  4768. if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 242, __pyx_L1_error)
  4769. __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Warn);
  4770. if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 918, __pyx_L1_error)
  4771. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4772. __Pyx_RefNannyFinishContext();
  4773. return 0;
  4774. __pyx_L1_error:;
  4775. __Pyx_XDECREF(__pyx_t_1);
  4776. __Pyx_RefNannyFinishContext();
  4777. return -1;
  4778. }
  4779. static int __Pyx_modinit_variable_import_code(void) {
  4780. __Pyx_RefNannyDeclarations
  4781. __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  4782. /*--- Variable import code ---*/
  4783. __Pyx_RefNannyFinishContext();
  4784. return 0;
  4785. }
  4786. static int __Pyx_modinit_function_import_code(void) {
  4787. __Pyx_RefNannyDeclarations
  4788. __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  4789. /*--- Function import code ---*/
  4790. __Pyx_RefNannyFinishContext();
  4791. return 0;
  4792. }
  4793. #if PY_MAJOR_VERSION < 3
  4794. #ifdef CYTHON_NO_PYINIT_EXPORT
  4795. #define __Pyx_PyMODINIT_FUNC void
  4796. #else
  4797. #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
  4798. #endif
  4799. #else
  4800. #ifdef CYTHON_NO_PYINIT_EXPORT
  4801. #define __Pyx_PyMODINIT_FUNC PyObject *
  4802. #else
  4803. #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
  4804. #endif
  4805. #endif
  4806. #if PY_MAJOR_VERSION < 3
  4807. __Pyx_PyMODINIT_FUNC initcython_bbox(void) CYTHON_SMALL_CODE; /*proto*/
  4808. __Pyx_PyMODINIT_FUNC initcython_bbox(void)
  4809. #else
  4810. __Pyx_PyMODINIT_FUNC PyInit_cython_bbox(void) CYTHON_SMALL_CODE; /*proto*/
  4811. __Pyx_PyMODINIT_FUNC PyInit_cython_bbox(void)
  4812. #if CYTHON_PEP489_MULTI_PHASE_INIT
  4813. {
  4814. return PyModuleDef_Init(&__pyx_moduledef);
  4815. }
  4816. static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
  4817. #if PY_VERSION_HEX >= 0x030700A1
  4818. static PY_INT64_T main_interpreter_id = -1;
  4819. PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
  4820. if (main_interpreter_id == -1) {
  4821. main_interpreter_id = current_id;
  4822. return (unlikely(current_id == -1)) ? -1 : 0;
  4823. } else if (unlikely(main_interpreter_id != current_id))
  4824. #else
  4825. static PyInterpreterState *main_interpreter = NULL;
  4826. PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
  4827. if (!main_interpreter) {
  4828. main_interpreter = current_interpreter;
  4829. } else if (unlikely(main_interpreter != current_interpreter))
  4830. #endif
  4831. {
  4832. PyErr_SetString(
  4833. PyExc_ImportError,
  4834. "Interpreter change detected - this module can only be loaded into one interpreter per process.");
  4835. return -1;
  4836. }
  4837. return 0;
  4838. }
  4839. static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
  4840. PyObject *value = PyObject_GetAttrString(spec, from_name);
  4841. int result = 0;
  4842. if (likely(value)) {
  4843. if (allow_none || value != Py_None) {
  4844. result = PyDict_SetItemString(moddict, to_name, value);
  4845. }
  4846. Py_DECREF(value);
  4847. } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
  4848. PyErr_Clear();
  4849. } else {
  4850. result = -1;
  4851. }
  4852. return result;
  4853. }
  4854. static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
  4855. PyObject *module = NULL, *moddict, *modname;
  4856. if (__Pyx_check_single_interpreter())
  4857. return NULL;
  4858. if (__pyx_m)
  4859. return __Pyx_NewRef(__pyx_m);
  4860. modname = PyObject_GetAttrString(spec, "name");
  4861. if (unlikely(!modname)) goto bad;
  4862. module = PyModule_NewObject(modname);
  4863. Py_DECREF(modname);
  4864. if (unlikely(!module)) goto bad;
  4865. moddict = PyModule_GetDict(module);
  4866. if (unlikely(!moddict)) goto bad;
  4867. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
  4868. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
  4869. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
  4870. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
  4871. return module;
  4872. bad:
  4873. Py_XDECREF(module);
  4874. return NULL;
  4875. }
  4876. static CYTHON_SMALL_CODE int __pyx_pymod_exec_cython_bbox(PyObject *__pyx_pyinit_module)
  4877. #endif
  4878. #endif
  4879. {
  4880. PyObject *__pyx_t_1 = NULL;
  4881. PyObject *__pyx_t_2 = NULL;
  4882. __Pyx_RefNannyDeclarations
  4883. #if CYTHON_PEP489_MULTI_PHASE_INIT
  4884. if (__pyx_m) {
  4885. if (__pyx_m == __pyx_pyinit_module) return 0;
  4886. PyErr_SetString(PyExc_RuntimeError, "Module 'cython_bbox' has already been imported. Re-initialisation is not supported.");
  4887. return -1;
  4888. }
  4889. #elif PY_MAJOR_VERSION >= 3
  4890. if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  4891. #endif
  4892. #if CYTHON_REFNANNY
  4893. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  4894. if (!__Pyx_RefNanny) {
  4895. PyErr_Clear();
  4896. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  4897. if (!__Pyx_RefNanny)
  4898. Py_FatalError("failed to import 'refnanny' module");
  4899. }
  4900. #endif
  4901. __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_cython_bbox(void)", 0);
  4902. if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  4903. #ifdef __Pxy_PyFrame_Initialize_Offsets
  4904. __Pxy_PyFrame_Initialize_Offsets();
  4905. #endif
  4906. __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  4907. __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  4908. __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  4909. #ifdef __Pyx_CyFunction_USED
  4910. if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  4911. #endif
  4912. #ifdef __Pyx_FusedFunction_USED
  4913. if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  4914. #endif
  4915. #ifdef __Pyx_Coroutine_USED
  4916. if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  4917. #endif
  4918. #ifdef __Pyx_Generator_USED
  4919. if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  4920. #endif
  4921. #ifdef __Pyx_AsyncGen_USED
  4922. if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  4923. #endif
  4924. #ifdef __Pyx_StopAsyncIteration_USED
  4925. if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  4926. #endif
  4927. /*--- Library function declarations ---*/
  4928. /*--- Threads initialization code ---*/
  4929. #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  4930. #ifdef WITH_THREAD /* Python build with threading support? */
  4931. PyEval_InitThreads();
  4932. #endif
  4933. #endif
  4934. /*--- Module creation code ---*/
  4935. #if CYTHON_PEP489_MULTI_PHASE_INIT
  4936. __pyx_m = __pyx_pyinit_module;
  4937. Py_INCREF(__pyx_m);
  4938. #else
  4939. #if PY_MAJOR_VERSION < 3
  4940. __pyx_m = Py_InitModule4("cython_bbox", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  4941. #else
  4942. __pyx_m = PyModule_Create(&__pyx_moduledef);
  4943. #endif
  4944. if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  4945. #endif
  4946. __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  4947. Py_INCREF(__pyx_d);
  4948. __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  4949. __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  4950. #if CYTHON_COMPILING_IN_PYPY
  4951. Py_INCREF(__pyx_b);
  4952. #endif
  4953. if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  4954. /*--- Initialize various global constants etc. ---*/
  4955. if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  4956. #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  4957. if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  4958. #endif
  4959. if (__pyx_module_is_main_utils__cython_bbox) {
  4960. if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  4961. }
  4962. #if PY_MAJOR_VERSION >= 3
  4963. {
  4964. PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
  4965. if (!PyDict_GetItemString(modules, "utils.cython_bbox")) {
  4966. if (unlikely(PyDict_SetItemString(modules, "utils.cython_bbox", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  4967. }
  4968. }
  4969. #endif
  4970. /*--- Builtin init code ---*/
  4971. if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  4972. /*--- Constants init code ---*/
  4973. if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  4974. /*--- Global type/function init code ---*/
  4975. (void)__Pyx_modinit_global_init_code();
  4976. (void)__Pyx_modinit_variable_export_code();
  4977. (void)__Pyx_modinit_function_export_code();
  4978. (void)__Pyx_modinit_type_init_code();
  4979. if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __pyx_L1_error;
  4980. (void)__Pyx_modinit_variable_import_code();
  4981. (void)__Pyx_modinit_function_import_code();
  4982. /*--- Execution code ---*/
  4983. #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  4984. if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  4985. #endif
  4986. /* "utils/bbox.pyx":9
  4987. *
  4988. * cimport cython
  4989. * import numpy as np # <<<<<<<<<<<<<<
  4990. * cimport numpy as np
  4991. *
  4992. */
  4993. __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error)
  4994. __Pyx_GOTREF(__pyx_t_1);
  4995. if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
  4996. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4997. /* "utils/bbox.pyx":12
  4998. * cimport numpy as np
  4999. *
  5000. * DTYPE = np.float # <<<<<<<<<<<<<<
  5001. * ctypedef np.float_t DTYPE_t
  5002. *
  5003. */
  5004. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error)
  5005. __Pyx_GOTREF(__pyx_t_1);
  5006. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error)
  5007. __Pyx_GOTREF(__pyx_t_2);
  5008. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5009. if (PyDict_SetItem(__pyx_d, __pyx_n_s_DTYPE, __pyx_t_2) < 0) __PYX_ERR(0, 12, __pyx_L1_error)
  5010. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  5011. /* "utils/bbox.pyx":15
  5012. * ctypedef np.float_t DTYPE_t
  5013. *
  5014. * def bbox_overlaps( # <<<<<<<<<<<<<<
  5015. * np.ndarray[DTYPE_t, ndim=2] boxes,
  5016. * np.ndarray[DTYPE_t, ndim=2] query_boxes):
  5017. */
  5018. __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5utils_11cython_bbox_1bbox_overlaps, NULL, __pyx_n_s_utils_cython_bbox); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error)
  5019. __Pyx_GOTREF(__pyx_t_2);
  5020. if (PyDict_SetItem(__pyx_d, __pyx_n_s_bbox_overlaps, __pyx_t_2) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
  5021. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  5022. /* "utils/bbox.pyx":1
  5023. * # -------------------------------------------------------- # <<<<<<<<<<<<<<
  5024. * # Fast R-CNN
  5025. * # Copyright (c) 2015 Microsoft
  5026. */
  5027. __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  5028. __Pyx_GOTREF(__pyx_t_2);
  5029. if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  5030. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  5031. /* "../../Anaconda2/lib/site-packages/Cython/Includes/numpy/__init__.pxd":1046
  5032. * raise ImportError("numpy.core.umath failed to import")
  5033. *
  5034. * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
  5035. * try:
  5036. * _import_umath()
  5037. */
  5038. /*--- Wrapped vars code ---*/
  5039. goto __pyx_L0;
  5040. __pyx_L1_error:;
  5041. __Pyx_XDECREF(__pyx_t_1);
  5042. __Pyx_XDECREF(__pyx_t_2);
  5043. if (__pyx_m) {
  5044. if (__pyx_d) {
  5045. __Pyx_AddTraceback("init utils.cython_bbox", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5046. }
  5047. Py_CLEAR(__pyx_m);
  5048. } else if (!PyErr_Occurred()) {
  5049. PyErr_SetString(PyExc_ImportError, "init utils.cython_bbox");
  5050. }
  5051. __pyx_L0:;
  5052. __Pyx_RefNannyFinishContext();
  5053. #if CYTHON_PEP489_MULTI_PHASE_INIT
  5054. return (__pyx_m != NULL) ? 0 : -1;
  5055. #elif PY_MAJOR_VERSION >= 3
  5056. return __pyx_m;
  5057. #else
  5058. return;
  5059. #endif
  5060. }
  5061. /* --- Runtime support code --- */
  5062. /* Refnanny */
  5063. #if CYTHON_REFNANNY
  5064. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
  5065. PyObject *m = NULL, *p = NULL;
  5066. void *r = NULL;
  5067. m = PyImport_ImportModule(modname);
  5068. if (!m) goto end;
  5069. p = PyObject_GetAttrString(m, "RefNannyAPI");
  5070. if (!p) goto end;
  5071. r = PyLong_AsVoidPtr(p);
  5072. end:
  5073. Py_XDECREF(p);
  5074. Py_XDECREF(m);
  5075. return (__Pyx_RefNannyAPIStruct *)r;
  5076. }
  5077. #endif
  5078. /* PyObjectGetAttrStr */
  5079. #if CYTHON_USE_TYPE_SLOTS
  5080. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
  5081. PyTypeObject* tp = Py_TYPE(obj);
  5082. if (likely(tp->tp_getattro))
  5083. return tp->tp_getattro(obj, attr_name);
  5084. #if PY_MAJOR_VERSION < 3
  5085. if (likely(tp->tp_getattr))
  5086. return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
  5087. #endif
  5088. return PyObject_GetAttr(obj, attr_name);
  5089. }
  5090. #endif
  5091. /* GetBuiltinName */
  5092. static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
  5093. PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
  5094. if (unlikely(!result)) {
  5095. PyErr_Format(PyExc_NameError,
  5096. #if PY_MAJOR_VERSION >= 3
  5097. "name '%U' is not defined", name);
  5098. #else
  5099. "name '%.200s' is not defined", PyString_AS_STRING(name));
  5100. #endif
  5101. }
  5102. return result;
  5103. }
  5104. /* RaiseArgTupleInvalid */
  5105. static void __Pyx_RaiseArgtupleInvalid(
  5106. const char* func_name,
  5107. int exact,
  5108. Py_ssize_t num_min,
  5109. Py_ssize_t num_max,
  5110. Py_ssize_t num_found)
  5111. {
  5112. Py_ssize_t num_expected;
  5113. const char *more_or_less;
  5114. if (num_found < num_min) {
  5115. num_expected = num_min;
  5116. more_or_less = "at least";
  5117. } else {
  5118. num_expected = num_max;
  5119. more_or_less = "at most";
  5120. }
  5121. if (exact) {
  5122. more_or_less = "exactly";
  5123. }
  5124. PyErr_Format(PyExc_TypeError,
  5125. "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
  5126. func_name, more_or_less, num_expected,
  5127. (num_expected == 1) ? "" : "s", num_found);
  5128. }
  5129. /* RaiseDoubleKeywords */
  5130. static void __Pyx_RaiseDoubleKeywordsError(
  5131. const char* func_name,
  5132. PyObject* kw_name)
  5133. {
  5134. PyErr_Format(PyExc_TypeError,
  5135. #if PY_MAJOR_VERSION >= 3
  5136. "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
  5137. #else
  5138. "%s() got multiple values for keyword argument '%s'", func_name,
  5139. PyString_AsString(kw_name));
  5140. #endif
  5141. }
  5142. /* ParseKeywords */
  5143. static int __Pyx_ParseOptionalKeywords(
  5144. PyObject *kwds,
  5145. PyObject **argnames[],
  5146. PyObject *kwds2,
  5147. PyObject *values[],
  5148. Py_ssize_t num_pos_args,
  5149. const char* function_name)
  5150. {
  5151. PyObject *key = 0, *value = 0;
  5152. Py_ssize_t pos = 0;
  5153. PyObject*** name;
  5154. PyObject*** first_kw_arg = argnames + num_pos_args;
  5155. while (PyDict_Next(kwds, &pos, &key, &value)) {
  5156. name = first_kw_arg;
  5157. while (*name && (**name != key)) name++;
  5158. if (*name) {
  5159. values[name-argnames] = value;
  5160. continue;
  5161. }
  5162. name = first_kw_arg;
  5163. #if PY_MAJOR_VERSION < 3
  5164. if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
  5165. while (*name) {
  5166. if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
  5167. && _PyString_Eq(**name, key)) {
  5168. values[name-argnames] = value;
  5169. break;
  5170. }
  5171. name++;
  5172. }
  5173. if (*name) continue;
  5174. else {
  5175. PyObject*** argname = argnames;
  5176. while (argname != first_kw_arg) {
  5177. if ((**argname == key) || (
  5178. (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
  5179. && _PyString_Eq(**argname, key))) {
  5180. goto arg_passed_twice;
  5181. }
  5182. argname++;
  5183. }
  5184. }
  5185. } else
  5186. #endif
  5187. if (likely(PyUnicode_Check(key))) {
  5188. while (*name) {
  5189. int cmp = (**name == key) ? 0 :
  5190. #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
  5191. (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
  5192. #endif
  5193. PyUnicode_Compare(**name, key);
  5194. if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  5195. if (cmp == 0) {
  5196. values[name-argnames] = value;
  5197. break;
  5198. }
  5199. name++;
  5200. }
  5201. if (*name) continue;
  5202. else {
  5203. PyObject*** argname = argnames;
  5204. while (argname != first_kw_arg) {
  5205. int cmp = (**argname == key) ? 0 :
  5206. #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
  5207. (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
  5208. #endif
  5209. PyUnicode_Compare(**argname, key);
  5210. if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  5211. if (cmp == 0) goto arg_passed_twice;
  5212. argname++;
  5213. }
  5214. }
  5215. } else
  5216. goto invalid_keyword_type;
  5217. if (kwds2) {
  5218. if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
  5219. } else {
  5220. goto invalid_keyword;
  5221. }
  5222. }
  5223. return 0;
  5224. arg_passed_twice:
  5225. __Pyx_RaiseDoubleKeywordsError(function_name, key);
  5226. goto bad;
  5227. invalid_keyword_type:
  5228. PyErr_Format(PyExc_TypeError,
  5229. "%.200s() keywords must be strings", function_name);
  5230. goto bad;
  5231. invalid_keyword:
  5232. PyErr_Format(PyExc_TypeError,
  5233. #if PY_MAJOR_VERSION < 3
  5234. "%.200s() got an unexpected keyword argument '%.200s'",
  5235. function_name, PyString_AsString(key));
  5236. #else
  5237. "%s() got an unexpected keyword argument '%U'",
  5238. function_name, key);
  5239. #endif
  5240. bad:
  5241. return -1;
  5242. }
  5243. /* ArgTypeTest */
  5244. static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
  5245. {
  5246. if (unlikely(!type)) {
  5247. PyErr_SetString(PyExc_SystemError, "Missing type object");
  5248. return 0;
  5249. }
  5250. else if (exact) {
  5251. #if PY_MAJOR_VERSION == 2
  5252. if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
  5253. #endif
  5254. }
  5255. else {
  5256. if (likely(__Pyx_TypeCheck(obj, type))) return 1;
  5257. }
  5258. PyErr_Format(PyExc_TypeError,
  5259. "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
  5260. name, type->tp_name, Py_TYPE(obj)->tp_name);
  5261. return 0;
  5262. }
  5263. /* IsLittleEndian */
  5264. static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
  5265. {
  5266. union {
  5267. uint32_t u32;
  5268. uint8_t u8[4];
  5269. } S;
  5270. S.u32 = 0x01020304;
  5271. return S.u8[0] == 4;
  5272. }
  5273. /* BufferFormatCheck */
  5274. static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
  5275. __Pyx_BufFmt_StackElem* stack,
  5276. __Pyx_TypeInfo* type) {
  5277. stack[0].field = &ctx->root;
  5278. stack[0].parent_offset = 0;
  5279. ctx->root.type = type;
  5280. ctx->root.name = "buffer dtype";
  5281. ctx->root.offset = 0;
  5282. ctx->head = stack;
  5283. ctx->head->field = &ctx->root;
  5284. ctx->fmt_offset = 0;
  5285. ctx->head->parent_offset = 0;
  5286. ctx->new_packmode = '@';
  5287. ctx->enc_packmode = '@';
  5288. ctx->new_count = 1;
  5289. ctx->enc_count = 0;
  5290. ctx->enc_type = 0;
  5291. ctx->is_complex = 0;
  5292. ctx->is_valid_array = 0;
  5293. ctx->struct_alignment = 0;
  5294. while (type->typegroup == 'S') {
  5295. ++ctx->head;
  5296. ctx->head->field = type->fields;
  5297. ctx->head->parent_offset = 0;
  5298. type = type->fields->type;
  5299. }
  5300. }
  5301. static int __Pyx_BufFmt_ParseNumber(const char** ts) {
  5302. int count;
  5303. const char* t = *ts;
  5304. if (*t < '0' || *t > '9') {
  5305. return -1;
  5306. } else {
  5307. count = *t++ - '0';
  5308. while (*t >= '0' && *t <= '9') {
  5309. count *= 10;
  5310. count += *t++ - '0';
  5311. }
  5312. }
  5313. *ts = t;
  5314. return count;
  5315. }
  5316. static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
  5317. int number = __Pyx_BufFmt_ParseNumber(ts);
  5318. if (number == -1)
  5319. PyErr_Format(PyExc_ValueError,\
  5320. "Does not understand character buffer dtype format string ('%c')", **ts);
  5321. return number;
  5322. }
  5323. static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
  5324. PyErr_Format(PyExc_ValueError,
  5325. "Unexpected format string character: '%c'", ch);
  5326. }
  5327. static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
  5328. switch (ch) {
  5329. case 'c': return "'char'";
  5330. case 'b': return "'signed char'";
  5331. case 'B': return "'unsigned char'";
  5332. case 'h': return "'short'";
  5333. case 'H': return "'unsigned short'";
  5334. case 'i': return "'int'";
  5335. case 'I': return "'unsigned int'";
  5336. case 'l': return "'long'";
  5337. case 'L': return "'unsigned long'";
  5338. case 'q': return "'long long'";
  5339. case 'Q': return "'unsigned long long'";
  5340. case 'f': return (is_complex ? "'complex float'" : "'float'");
  5341. case 'd': return (is_complex ? "'complex double'" : "'double'");
  5342. case 'g': return (is_complex ? "'complex long double'" : "'long double'");
  5343. case 'T': return "a struct";
  5344. case 'O': return "Python object";
  5345. case 'P': return "a pointer";
  5346. case 's': case 'p': return "a string";
  5347. case 0: return "end";
  5348. default: return "unparseable format string";
  5349. }
  5350. }
  5351. static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
  5352. switch (ch) {
  5353. case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
  5354. case 'h': case 'H': return 2;
  5355. case 'i': case 'I': case 'l': case 'L': return 4;
  5356. case 'q': case 'Q': return 8;
  5357. case 'f': return (is_complex ? 8 : 4);
  5358. case 'd': return (is_complex ? 16 : 8);
  5359. case 'g': {
  5360. PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
  5361. return 0;
  5362. }
  5363. case 'O': case 'P': return sizeof(void*);
  5364. default:
  5365. __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  5366. return 0;
  5367. }
  5368. }
  5369. static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
  5370. switch (ch) {
  5371. case 'c': case 'b': case 'B': case 's': case 'p': return 1;
  5372. case 'h': case 'H': return sizeof(short);
  5373. case 'i': case 'I': return sizeof(int);
  5374. case 'l': case 'L': return sizeof(long);
  5375. #ifdef HAVE_LONG_LONG
  5376. case 'q': case 'Q': return sizeof(PY_LONG_LONG);
  5377. #endif
  5378. case 'f': return sizeof(float) * (is_complex ? 2 : 1);
  5379. case 'd': return sizeof(double) * (is_complex ? 2 : 1);
  5380. case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
  5381. case 'O': case 'P': return sizeof(void*);
  5382. default: {
  5383. __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  5384. return 0;
  5385. }
  5386. }
  5387. }
  5388. typedef struct { char c; short x; } __Pyx_st_short;
  5389. typedef struct { char c; int x; } __Pyx_st_int;
  5390. typedef struct { char c; long x; } __Pyx_st_long;
  5391. typedef struct { char c; float x; } __Pyx_st_float;
  5392. typedef struct { char c; double x; } __Pyx_st_double;
  5393. typedef struct { char c; long double x; } __Pyx_st_longdouble;
  5394. typedef struct { char c; void *x; } __Pyx_st_void_p;
  5395. #ifdef HAVE_LONG_LONG
  5396. typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
  5397. #endif
  5398. static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
  5399. switch (ch) {
  5400. case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
  5401. case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
  5402. case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
  5403. case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
  5404. #ifdef HAVE_LONG_LONG
  5405. case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
  5406. #endif
  5407. case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
  5408. case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
  5409. case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
  5410. case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
  5411. default:
  5412. __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  5413. return 0;
  5414. }
  5415. }
  5416. /* These are for computing the padding at the end of the struct to align
  5417. on the first member of the struct. This will probably the same as above,
  5418. but we don't have any guarantees.
  5419. */
  5420. typedef struct { short x; char c; } __Pyx_pad_short;
  5421. typedef struct { int x; char c; } __Pyx_pad_int;
  5422. typedef struct { long x; char c; } __Pyx_pad_long;
  5423. typedef struct { float x; char c; } __Pyx_pad_float;
  5424. typedef struct { double x; char c; } __Pyx_pad_double;
  5425. typedef struct { long double x; char c; } __Pyx_pad_longdouble;
  5426. typedef struct { void *x; char c; } __Pyx_pad_void_p;
  5427. #ifdef HAVE_LONG_LONG
  5428. typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
  5429. #endif
  5430. static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
  5431. switch (ch) {
  5432. case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
  5433. case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
  5434. case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
  5435. case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
  5436. #ifdef HAVE_LONG_LONG
  5437. case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
  5438. #endif
  5439. case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
  5440. case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
  5441. case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
  5442. case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
  5443. default:
  5444. __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  5445. return 0;
  5446. }
  5447. }
  5448. static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
  5449. switch (ch) {
  5450. case 'c':
  5451. return 'H';
  5452. case 'b': case 'h': case 'i':
  5453. case 'l': case 'q': case 's': case 'p':
  5454. return 'I';
  5455. case 'B': case 'H': case 'I': case 'L': case 'Q':
  5456. return 'U';
  5457. case 'f': case 'd': case 'g':
  5458. return (is_complex ? 'C' : 'R');
  5459. case 'O':
  5460. return 'O';
  5461. case 'P':
  5462. return 'P';
  5463. default: {
  5464. __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  5465. return 0;
  5466. }
  5467. }
  5468. }
  5469. static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
  5470. if (ctx->head == NULL || ctx->head->field == &ctx->root) {
  5471. const char* expected;
  5472. const char* quote;
  5473. if (ctx->head == NULL) {
  5474. expected = "end";
  5475. quote = "";
  5476. } else {
  5477. expected = ctx->head->field->type->name;
  5478. quote = "'";
  5479. }
  5480. PyErr_Format(PyExc_ValueError,
  5481. "Buffer dtype mismatch, expected %s%s%s but got %s",
  5482. quote, expected, quote,
  5483. __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
  5484. } else {
  5485. __Pyx_StructField* field = ctx->head->field;
  5486. __Pyx_StructField* parent = (ctx->head - 1)->field;
  5487. PyErr_Format(PyExc_ValueError,
  5488. "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
  5489. field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
  5490. parent->type->name, field->name);
  5491. }
  5492. }
  5493. static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
  5494. char group;
  5495. size_t size, offset, arraysize = 1;
  5496. if (ctx->enc_type == 0) return 0;
  5497. if (ctx->head->field->type->arraysize[0]) {
  5498. int i, ndim = 0;
  5499. if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
  5500. ctx->is_valid_array = ctx->head->field->type->ndim == 1;
  5501. ndim = 1;
  5502. if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
  5503. PyErr_Format(PyExc_ValueError,
  5504. "Expected a dimension of size %zu, got %zu",
  5505. ctx->head->field->type->arraysize[0], ctx->enc_count);
  5506. return -1;
  5507. }
  5508. }
  5509. if (!ctx->is_valid_array) {
  5510. PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
  5511. ctx->head->field->type->ndim, ndim);
  5512. return -1;
  5513. }
  5514. for (i = 0; i < ctx->head->field->type->ndim; i++) {
  5515. arraysize *= ctx->head->field->type->arraysize[i];
  5516. }
  5517. ctx->is_valid_array = 0;
  5518. ctx->enc_count = 1;
  5519. }
  5520. group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
  5521. do {
  5522. __Pyx_StructField* field = ctx->head->field;
  5523. __Pyx_TypeInfo* type = field->type;
  5524. if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
  5525. size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
  5526. } else {
  5527. size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
  5528. }
  5529. if (ctx->enc_packmode == '@') {
  5530. size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
  5531. size_t align_mod_offset;
  5532. if (align_at == 0) return -1;
  5533. align_mod_offset = ctx->fmt_offset % align_at;
  5534. if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
  5535. if (ctx->struct_alignment == 0)
  5536. ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
  5537. ctx->is_complex);
  5538. }
  5539. if (type->size != size || type->typegroup != group) {
  5540. if (type->typegroup == 'C' && type->fields != NULL) {
  5541. size_t parent_offset = ctx->head->parent_offset + field->offset;
  5542. ++ctx->head;
  5543. ctx->head->field = type->fields;
  5544. ctx->head->parent_offset = parent_offset;
  5545. continue;
  5546. }
  5547. if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
  5548. } else {
  5549. __Pyx_BufFmt_RaiseExpected(ctx);
  5550. return -1;
  5551. }
  5552. }
  5553. offset = ctx->head->parent_offset + field->offset;
  5554. if (ctx->fmt_offset != offset) {
  5555. PyErr_Format(PyExc_ValueError,
  5556. "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
  5557. (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
  5558. return -1;
  5559. }
  5560. ctx->fmt_offset += size;
  5561. if (arraysize)
  5562. ctx->fmt_offset += (arraysize - 1) * size;
  5563. --ctx->enc_count;
  5564. while (1) {
  5565. if (field == &ctx->root) {
  5566. ctx->head = NULL;
  5567. if (ctx->enc_count != 0) {
  5568. __Pyx_BufFmt_RaiseExpected(ctx);
  5569. return -1;
  5570. }
  5571. break;
  5572. }
  5573. ctx->head->field = ++field;
  5574. if (field->type == NULL) {
  5575. --ctx->head;
  5576. field = ctx->head->field;
  5577. continue;
  5578. } else if (field->type->typegroup == 'S') {
  5579. size_t parent_offset = ctx->head->parent_offset + field->offset;
  5580. if (field->type->fields->type == NULL) continue;
  5581. field = field->type->fields;
  5582. ++ctx->head;
  5583. ctx->head->field = field;
  5584. ctx->head->parent_offset = parent_offset;
  5585. break;
  5586. } else {
  5587. break;
  5588. }
  5589. }
  5590. } while (ctx->enc_count);
  5591. ctx->enc_type = 0;
  5592. ctx->is_complex = 0;
  5593. return 0;
  5594. }
  5595. static PyObject *
  5596. __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
  5597. {
  5598. const char *ts = *tsp;
  5599. int i = 0, number;
  5600. int ndim = ctx->head->field->type->ndim;
  5601. ;
  5602. ++ts;
  5603. if (ctx->new_count != 1) {
  5604. PyErr_SetString(PyExc_ValueError,
  5605. "Cannot handle repeated arrays in format string");
  5606. return NULL;
  5607. }
  5608. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  5609. while (*ts && *ts != ')') {
  5610. switch (*ts) {
  5611. case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue;
  5612. default: break;
  5613. }
  5614. number = __Pyx_BufFmt_ExpectNumber(&ts);
  5615. if (number == -1) return NULL;
  5616. if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
  5617. return PyErr_Format(PyExc_ValueError,
  5618. "Expected a dimension of size %zu, got %d",
  5619. ctx->head->field->type->arraysize[i], number);
  5620. if (*ts != ',' && *ts != ')')
  5621. return PyErr_Format(PyExc_ValueError,
  5622. "Expected a comma in format string, got '%c'", *ts);
  5623. if (*ts == ',') ts++;
  5624. i++;
  5625. }
  5626. if (i != ndim)
  5627. return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
  5628. ctx->head->field->type->ndim, i);
  5629. if (!*ts) {
  5630. PyErr_SetString(PyExc_ValueError,
  5631. "Unexpected end of format string, expected ')'");
  5632. return NULL;
  5633. }
  5634. ctx->is_valid_array = 1;
  5635. ctx->new_count = 1;
  5636. *tsp = ++ts;
  5637. return Py_None;
  5638. }
  5639. static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
  5640. int got_Z = 0;
  5641. while (1) {
  5642. switch(*ts) {
  5643. case 0:
  5644. if (ctx->enc_type != 0 && ctx->head == NULL) {
  5645. __Pyx_BufFmt_RaiseExpected(ctx);
  5646. return NULL;
  5647. }
  5648. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  5649. if (ctx->head != NULL) {
  5650. __Pyx_BufFmt_RaiseExpected(ctx);
  5651. return NULL;
  5652. }
  5653. return ts;
  5654. case ' ':
  5655. case '\r':
  5656. case '\n':
  5657. ++ts;
  5658. break;
  5659. case '<':
  5660. if (!__Pyx_Is_Little_Endian()) {
  5661. PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
  5662. return NULL;
  5663. }
  5664. ctx->new_packmode = '=';
  5665. ++ts;
  5666. break;
  5667. case '>':
  5668. case '!':
  5669. if (__Pyx_Is_Little_Endian()) {
  5670. PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
  5671. return NULL;
  5672. }
  5673. ctx->new_packmode = '=';
  5674. ++ts;
  5675. break;
  5676. case '=':
  5677. case '@':
  5678. case '^':
  5679. ctx->new_packmode = *ts++;
  5680. break;
  5681. case 'T':
  5682. {
  5683. const char* ts_after_sub;
  5684. size_t i, struct_count = ctx->new_count;
  5685. size_t struct_alignment = ctx->struct_alignment;
  5686. ctx->new_count = 1;
  5687. ++ts;
  5688. if (*ts != '{') {
  5689. PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
  5690. return NULL;
  5691. }
  5692. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  5693. ctx->enc_type = 0;
  5694. ctx->enc_count = 0;
  5695. ctx->struct_alignment = 0;
  5696. ++ts;
  5697. ts_after_sub = ts;
  5698. for (i = 0; i != struct_count; ++i) {
  5699. ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
  5700. if (!ts_after_sub) return NULL;
  5701. }
  5702. ts = ts_after_sub;
  5703. if (struct_alignment) ctx->struct_alignment = struct_alignment;
  5704. }
  5705. break;
  5706. case '}':
  5707. {
  5708. size_t alignment = ctx->struct_alignment;
  5709. ++ts;
  5710. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  5711. ctx->enc_type = 0;
  5712. if (alignment && ctx->fmt_offset % alignment) {
  5713. ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
  5714. }
  5715. }
  5716. return ts;
  5717. case 'x':
  5718. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  5719. ctx->fmt_offset += ctx->new_count;
  5720. ctx->new_count = 1;
  5721. ctx->enc_count = 0;
  5722. ctx->enc_type = 0;
  5723. ctx->enc_packmode = ctx->new_packmode;
  5724. ++ts;
  5725. break;
  5726. case 'Z':
  5727. got_Z = 1;
  5728. ++ts;
  5729. if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
  5730. __Pyx_BufFmt_RaiseUnexpectedChar('Z');
  5731. return NULL;
  5732. }
  5733. CYTHON_FALLTHROUGH;
  5734. case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
  5735. case 'l': case 'L': case 'q': case 'Q':
  5736. case 'f': case 'd': case 'g':
  5737. case 'O': case 'p':
  5738. if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
  5739. ctx->enc_packmode == ctx->new_packmode) {
  5740. ctx->enc_count += ctx->new_count;
  5741. ctx->new_count = 1;
  5742. got_Z = 0;
  5743. ++ts;
  5744. break;
  5745. }
  5746. CYTHON_FALLTHROUGH;
  5747. case 's':
  5748. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  5749. ctx->enc_count = ctx->new_count;
  5750. ctx->enc_packmode = ctx->new_packmode;
  5751. ctx->enc_type = *ts;
  5752. ctx->is_complex = got_Z;
  5753. ++ts;
  5754. ctx->new_count = 1;
  5755. got_Z = 0;
  5756. break;
  5757. case ':':
  5758. ++ts;
  5759. while(*ts != ':') ++ts;
  5760. ++ts;
  5761. break;
  5762. case '(':
  5763. if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
  5764. break;
  5765. default:
  5766. {
  5767. int number = __Pyx_BufFmt_ExpectNumber(&ts);
  5768. if (number == -1) return NULL;
  5769. ctx->new_count = (size_t)number;
  5770. }
  5771. }
  5772. }
  5773. }
  5774. /* BufferGetAndValidate */
  5775. static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
  5776. if (unlikely(info->buf == NULL)) return;
  5777. if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
  5778. __Pyx_ReleaseBuffer(info);
  5779. }
  5780. static void __Pyx_ZeroBuffer(Py_buffer* buf) {
  5781. buf->buf = NULL;
  5782. buf->obj = NULL;
  5783. buf->strides = __Pyx_zeros;
  5784. buf->shape = __Pyx_zeros;
  5785. buf->suboffsets = __Pyx_minusones;
  5786. }
  5787. static int __Pyx__GetBufferAndValidate(
  5788. Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags,
  5789. int nd, int cast, __Pyx_BufFmt_StackElem* stack)
  5790. {
  5791. buf->buf = NULL;
  5792. if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) {
  5793. __Pyx_ZeroBuffer(buf);
  5794. return -1;
  5795. }
  5796. if (unlikely(buf->ndim != nd)) {
  5797. PyErr_Format(PyExc_ValueError,
  5798. "Buffer has wrong number of dimensions (expected %d, got %d)",
  5799. nd, buf->ndim);
  5800. goto fail;
  5801. }
  5802. if (!cast) {
  5803. __Pyx_BufFmt_Context ctx;
  5804. __Pyx_BufFmt_Init(&ctx, stack, dtype);
  5805. if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
  5806. }
  5807. if (unlikely((size_t)buf->itemsize != dtype->size)) {
  5808. PyErr_Format(PyExc_ValueError,
  5809. "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
  5810. buf->itemsize, (buf->itemsize > 1) ? "s" : "",
  5811. dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
  5812. goto fail;
  5813. }
  5814. if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
  5815. return 0;
  5816. fail:;
  5817. __Pyx_SafeReleaseBuffer(buf);
  5818. return -1;
  5819. }
  5820. /* PyDictVersioning */
  5821. #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
  5822. static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
  5823. PyObject *dict = Py_TYPE(obj)->tp_dict;
  5824. return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
  5825. }
  5826. static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
  5827. PyObject **dictptr = NULL;
  5828. Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
  5829. if (offset) {
  5830. #if CYTHON_COMPILING_IN_CPYTHON
  5831. dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
  5832. #else
  5833. dictptr = _PyObject_GetDictPtr(obj);
  5834. #endif
  5835. }
  5836. return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
  5837. }
  5838. static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
  5839. PyObject *dict = Py_TYPE(obj)->tp_dict;
  5840. if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
  5841. return 0;
  5842. return obj_dict_version == __Pyx_get_object_dict_version(obj);
  5843. }
  5844. #endif
  5845. /* GetModuleGlobalName */
  5846. #if CYTHON_USE_DICT_VERSIONS
  5847. static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
  5848. #else
  5849. static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
  5850. #endif
  5851. {
  5852. PyObject *result;
  5853. #if !CYTHON_AVOID_BORROWED_REFS
  5854. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
  5855. result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
  5856. __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
  5857. if (likely(result)) {
  5858. return __Pyx_NewRef(result);
  5859. } else if (unlikely(PyErr_Occurred())) {
  5860. return NULL;
  5861. }
  5862. #else
  5863. result = PyDict_GetItem(__pyx_d, name);
  5864. __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
  5865. if (likely(result)) {
  5866. return __Pyx_NewRef(result);
  5867. }
  5868. #endif
  5869. #else
  5870. result = PyObject_GetItem(__pyx_d, name);
  5871. __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
  5872. if (likely(result)) {
  5873. return __Pyx_NewRef(result);
  5874. }
  5875. PyErr_Clear();
  5876. #endif
  5877. return __Pyx_GetBuiltinName(name);
  5878. }
  5879. /* PyObjectCall */
  5880. #if CYTHON_COMPILING_IN_CPYTHON
  5881. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  5882. PyObject *result;
  5883. ternaryfunc call = func->ob_type->tp_call;
  5884. if (unlikely(!call))
  5885. return PyObject_Call(func, arg, kw);
  5886. if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
  5887. return NULL;
  5888. result = (*call)(func, arg, kw);
  5889. Py_LeaveRecursiveCall();
  5890. if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  5891. PyErr_SetString(
  5892. PyExc_SystemError,
  5893. "NULL result without error in PyObject_Call");
  5894. }
  5895. return result;
  5896. }
  5897. #endif
  5898. /* ExtTypeTest */
  5899. static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
  5900. if (unlikely(!type)) {
  5901. PyErr_SetString(PyExc_SystemError, "Missing type object");
  5902. return 0;
  5903. }
  5904. if (likely(__Pyx_TypeCheck(obj, type)))
  5905. return 1;
  5906. PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
  5907. Py_TYPE(obj)->tp_name, type->tp_name);
  5908. return 0;
  5909. }
  5910. /* BufferIndexError */
  5911. static void __Pyx_RaiseBufferIndexError(int axis) {
  5912. PyErr_Format(PyExc_IndexError,
  5913. "Out of bounds on buffer access (axis %d)", axis);
  5914. }
  5915. /* PyErrFetchRestore */
  5916. #if CYTHON_FAST_THREAD_STATE
  5917. static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  5918. PyObject *tmp_type, *tmp_value, *tmp_tb;
  5919. tmp_type = tstate->curexc_type;
  5920. tmp_value = tstate->curexc_value;
  5921. tmp_tb = tstate->curexc_traceback;
  5922. tstate->curexc_type = type;
  5923. tstate->curexc_value = value;
  5924. tstate->curexc_traceback = tb;
  5925. Py_XDECREF(tmp_type);
  5926. Py_XDECREF(tmp_value);
  5927. Py_XDECREF(tmp_tb);
  5928. }
  5929. static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  5930. *type = tstate->curexc_type;
  5931. *value = tstate->curexc_value;
  5932. *tb = tstate->curexc_traceback;
  5933. tstate->curexc_type = 0;
  5934. tstate->curexc_value = 0;
  5935. tstate->curexc_traceback = 0;
  5936. }
  5937. #endif
  5938. /* RaiseException */
  5939. #if PY_MAJOR_VERSION < 3
  5940. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
  5941. CYTHON_UNUSED PyObject *cause) {
  5942. __Pyx_PyThreadState_declare
  5943. Py_XINCREF(type);
  5944. if (!value || value == Py_None)
  5945. value = NULL;
  5946. else
  5947. Py_INCREF(value);
  5948. if (!tb || tb == Py_None)
  5949. tb = NULL;
  5950. else {
  5951. Py_INCREF(tb);
  5952. if (!PyTraceBack_Check(tb)) {
  5953. PyErr_SetString(PyExc_TypeError,
  5954. "raise: arg 3 must be a traceback or None");
  5955. goto raise_error;
  5956. }
  5957. }
  5958. if (PyType_Check(type)) {
  5959. #if CYTHON_COMPILING_IN_PYPY
  5960. if (!value) {
  5961. Py_INCREF(Py_None);
  5962. value = Py_None;
  5963. }
  5964. #endif
  5965. PyErr_NormalizeException(&type, &value, &tb);
  5966. } else {
  5967. if (value) {
  5968. PyErr_SetString(PyExc_TypeError,
  5969. "instance exception may not have a separate value");
  5970. goto raise_error;
  5971. }
  5972. value = type;
  5973. type = (PyObject*) Py_TYPE(type);
  5974. Py_INCREF(type);
  5975. if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
  5976. PyErr_SetString(PyExc_TypeError,
  5977. "raise: exception class must be a subclass of BaseException");
  5978. goto raise_error;
  5979. }
  5980. }
  5981. __Pyx_PyThreadState_assign
  5982. __Pyx_ErrRestore(type, value, tb);
  5983. return;
  5984. raise_error:
  5985. Py_XDECREF(value);
  5986. Py_XDECREF(type);
  5987. Py_XDECREF(tb);
  5988. return;
  5989. }
  5990. #else
  5991. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
  5992. PyObject* owned_instance = NULL;
  5993. if (tb == Py_None) {
  5994. tb = 0;
  5995. } else if (tb && !PyTraceBack_Check(tb)) {
  5996. PyErr_SetString(PyExc_TypeError,
  5997. "raise: arg 3 must be a traceback or None");
  5998. goto bad;
  5999. }
  6000. if (value == Py_None)
  6001. value = 0;
  6002. if (PyExceptionInstance_Check(type)) {
  6003. if (value) {
  6004. PyErr_SetString(PyExc_TypeError,
  6005. "instance exception may not have a separate value");
  6006. goto bad;
  6007. }
  6008. value = type;
  6009. type = (PyObject*) Py_TYPE(value);
  6010. } else if (PyExceptionClass_Check(type)) {
  6011. PyObject *instance_class = NULL;
  6012. if (value && PyExceptionInstance_Check(value)) {
  6013. instance_class = (PyObject*) Py_TYPE(value);
  6014. if (instance_class != type) {
  6015. int is_subclass = PyObject_IsSubclass(instance_class, type);
  6016. if (!is_subclass) {
  6017. instance_class = NULL;
  6018. } else if (unlikely(is_subclass == -1)) {
  6019. goto bad;
  6020. } else {
  6021. type = instance_class;
  6022. }
  6023. }
  6024. }
  6025. if (!instance_class) {
  6026. PyObject *args;
  6027. if (!value)
  6028. args = PyTuple_New(0);
  6029. else if (PyTuple_Check(value)) {
  6030. Py_INCREF(value);
  6031. args = value;
  6032. } else
  6033. args = PyTuple_Pack(1, value);
  6034. if (!args)
  6035. goto bad;
  6036. owned_instance = PyObject_Call(type, args, NULL);
  6037. Py_DECREF(args);
  6038. if (!owned_instance)
  6039. goto bad;
  6040. value = owned_instance;
  6041. if (!PyExceptionInstance_Check(value)) {
  6042. PyErr_Format(PyExc_TypeError,
  6043. "calling %R should have returned an instance of "
  6044. "BaseException, not %R",
  6045. type, Py_TYPE(value));
  6046. goto bad;
  6047. }
  6048. }
  6049. } else {
  6050. PyErr_SetString(PyExc_TypeError,
  6051. "raise: exception class must be a subclass of BaseException");
  6052. goto bad;
  6053. }
  6054. if (cause) {
  6055. PyObject *fixed_cause;
  6056. if (cause == Py_None) {
  6057. fixed_cause = NULL;
  6058. } else if (PyExceptionClass_Check(cause)) {
  6059. fixed_cause = PyObject_CallObject(cause, NULL);
  6060. if (fixed_cause == NULL)
  6061. goto bad;
  6062. } else if (PyExceptionInstance_Check(cause)) {
  6063. fixed_cause = cause;
  6064. Py_INCREF(fixed_cause);
  6065. } else {
  6066. PyErr_SetString(PyExc_TypeError,
  6067. "exception causes must derive from "
  6068. "BaseException");
  6069. goto bad;
  6070. }
  6071. PyException_SetCause(value, fixed_cause);
  6072. }
  6073. PyErr_SetObject(type, value);
  6074. if (tb) {
  6075. #if CYTHON_COMPILING_IN_PYPY
  6076. PyObject *tmp_type, *tmp_value, *tmp_tb;
  6077. PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
  6078. Py_INCREF(tb);
  6079. PyErr_Restore(tmp_type, tmp_value, tb);
  6080. Py_XDECREF(tmp_tb);
  6081. #else
  6082. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  6083. PyObject* tmp_tb = tstate->curexc_traceback;
  6084. if (tb != tmp_tb) {
  6085. Py_INCREF(tb);
  6086. tstate->curexc_traceback = tb;
  6087. Py_XDECREF(tmp_tb);
  6088. }
  6089. #endif
  6090. }
  6091. bad:
  6092. Py_XDECREF(owned_instance);
  6093. return;
  6094. }
  6095. #endif
  6096. /* PyCFunctionFastCall */
  6097. #if CYTHON_FAST_PYCCALL
  6098. static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
  6099. PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
  6100. PyCFunction meth = PyCFunction_GET_FUNCTION(func);
  6101. PyObject *self = PyCFunction_GET_SELF(func);
  6102. int flags = PyCFunction_GET_FLAGS(func);
  6103. assert(PyCFunction_Check(func));
  6104. assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
  6105. assert(nargs >= 0);
  6106. assert(nargs == 0 || args != NULL);
  6107. /* _PyCFunction_FastCallDict() must not be called with an exception set,
  6108. because it may clear it (directly or indirectly) and so the
  6109. caller loses its exception */
  6110. assert(!PyErr_Occurred());
  6111. if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
  6112. return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
  6113. } else {
  6114. return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
  6115. }
  6116. }
  6117. #endif
  6118. /* PyFunctionFastCall */
  6119. #if CYTHON_FAST_PYCALL
  6120. static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
  6121. PyObject *globals) {
  6122. PyFrameObject *f;
  6123. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  6124. PyObject **fastlocals;
  6125. Py_ssize_t i;
  6126. PyObject *result;
  6127. assert(globals != NULL);
  6128. /* XXX Perhaps we should create a specialized
  6129. PyFrame_New() that doesn't take locals, but does
  6130. take builtins without sanity checking them.
  6131. */
  6132. assert(tstate != NULL);
  6133. f = PyFrame_New(tstate, co, globals, NULL);
  6134. if (f == NULL) {
  6135. return NULL;
  6136. }
  6137. fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
  6138. for (i = 0; i < na; i++) {
  6139. Py_INCREF(*args);
  6140. fastlocals[i] = *args++;
  6141. }
  6142. result = PyEval_EvalFrameEx(f,0);
  6143. ++tstate->recursion_depth;
  6144. Py_DECREF(f);
  6145. --tstate->recursion_depth;
  6146. return result;
  6147. }
  6148. #if 1 || PY_VERSION_HEX < 0x030600B1
  6149. static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) {
  6150. PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
  6151. PyObject *globals = PyFunction_GET_GLOBALS(func);
  6152. PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
  6153. PyObject *closure;
  6154. #if PY_MAJOR_VERSION >= 3
  6155. PyObject *kwdefs;
  6156. #endif
  6157. PyObject *kwtuple, **k;
  6158. PyObject **d;
  6159. Py_ssize_t nd;
  6160. Py_ssize_t nk;
  6161. PyObject *result;
  6162. assert(kwargs == NULL || PyDict_Check(kwargs));
  6163. nk = kwargs ? PyDict_Size(kwargs) : 0;
  6164. if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
  6165. return NULL;
  6166. }
  6167. if (
  6168. #if PY_MAJOR_VERSION >= 3
  6169. co->co_kwonlyargcount == 0 &&
  6170. #endif
  6171. likely(kwargs == NULL || nk == 0) &&
  6172. co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
  6173. if (argdefs == NULL && co->co_argcount == nargs) {
  6174. result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
  6175. goto done;
  6176. }
  6177. else if (nargs == 0 && argdefs != NULL
  6178. && co->co_argcount == Py_SIZE(argdefs)) {
  6179. /* function called with no arguments, but all parameters have
  6180. a default value: use default values as arguments .*/
  6181. args = &PyTuple_GET_ITEM(argdefs, 0);
  6182. result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
  6183. goto done;
  6184. }
  6185. }
  6186. if (kwargs != NULL) {
  6187. Py_ssize_t pos, i;
  6188. kwtuple = PyTuple_New(2 * nk);
  6189. if (kwtuple == NULL) {
  6190. result = NULL;
  6191. goto done;
  6192. }
  6193. k = &PyTuple_GET_ITEM(kwtuple, 0);
  6194. pos = i = 0;
  6195. while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
  6196. Py_INCREF(k[i]);
  6197. Py_INCREF(k[i+1]);
  6198. i += 2;
  6199. }
  6200. nk = i / 2;
  6201. }
  6202. else {
  6203. kwtuple = NULL;
  6204. k = NULL;
  6205. }
  6206. closure = PyFunction_GET_CLOSURE(func);
  6207. #if PY_MAJOR_VERSION >= 3
  6208. kwdefs = PyFunction_GET_KW_DEFAULTS(func);
  6209. #endif
  6210. if (argdefs != NULL) {
  6211. d = &PyTuple_GET_ITEM(argdefs, 0);
  6212. nd = Py_SIZE(argdefs);
  6213. }
  6214. else {
  6215. d = NULL;
  6216. nd = 0;
  6217. }
  6218. #if PY_MAJOR_VERSION >= 3
  6219. result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
  6220. args, nargs,
  6221. k, (int)nk,
  6222. d, (int)nd, kwdefs, closure);
  6223. #else
  6224. result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
  6225. args, nargs,
  6226. k, (int)nk,
  6227. d, (int)nd, closure);
  6228. #endif
  6229. Py_XDECREF(kwtuple);
  6230. done:
  6231. Py_LeaveRecursiveCall();
  6232. return result;
  6233. }
  6234. #endif
  6235. #endif
  6236. /* PyObjectCallMethO */
  6237. #if CYTHON_COMPILING_IN_CPYTHON
  6238. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
  6239. PyObject *self, *result;
  6240. PyCFunction cfunc;
  6241. cfunc = PyCFunction_GET_FUNCTION(func);
  6242. self = PyCFunction_GET_SELF(func);
  6243. if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
  6244. return NULL;
  6245. result = cfunc(self, arg);
  6246. Py_LeaveRecursiveCall();
  6247. if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  6248. PyErr_SetString(
  6249. PyExc_SystemError,
  6250. "NULL result without error in PyObject_Call");
  6251. }
  6252. return result;
  6253. }
  6254. #endif
  6255. /* PyObjectCallOneArg */
  6256. #if CYTHON_COMPILING_IN_CPYTHON
  6257. static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  6258. PyObject *result;
  6259. PyObject *args = PyTuple_New(1);
  6260. if (unlikely(!args)) return NULL;
  6261. Py_INCREF(arg);
  6262. PyTuple_SET_ITEM(args, 0, arg);
  6263. result = __Pyx_PyObject_Call(func, args, NULL);
  6264. Py_DECREF(args);
  6265. return result;
  6266. }
  6267. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  6268. #if CYTHON_FAST_PYCALL
  6269. if (PyFunction_Check(func)) {
  6270. return __Pyx_PyFunction_FastCall(func, &arg, 1);
  6271. }
  6272. #endif
  6273. if (likely(PyCFunction_Check(func))) {
  6274. if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
  6275. return __Pyx_PyObject_CallMethO(func, arg);
  6276. #if CYTHON_FAST_PYCCALL
  6277. } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
  6278. return __Pyx_PyCFunction_FastCall(func, &arg, 1);
  6279. #endif
  6280. }
  6281. }
  6282. return __Pyx__PyObject_CallOneArg(func, arg);
  6283. }
  6284. #else
  6285. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  6286. PyObject *result;
  6287. PyObject *args = PyTuple_Pack(1, arg);
  6288. if (unlikely(!args)) return NULL;
  6289. result = __Pyx_PyObject_Call(func, args, NULL);
  6290. Py_DECREF(args);
  6291. return result;
  6292. }
  6293. #endif
  6294. /* DictGetItem */
  6295. #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
  6296. static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
  6297. PyObject *value;
  6298. value = PyDict_GetItemWithError(d, key);
  6299. if (unlikely(!value)) {
  6300. if (!PyErr_Occurred()) {
  6301. if (unlikely(PyTuple_Check(key))) {
  6302. PyObject* args = PyTuple_Pack(1, key);
  6303. if (likely(args)) {
  6304. PyErr_SetObject(PyExc_KeyError, args);
  6305. Py_DECREF(args);
  6306. }
  6307. } else {
  6308. PyErr_SetObject(PyExc_KeyError, key);
  6309. }
  6310. }
  6311. return NULL;
  6312. }
  6313. Py_INCREF(value);
  6314. return value;
  6315. }
  6316. #endif
  6317. /* RaiseTooManyValuesToUnpack */
  6318. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
  6319. PyErr_Format(PyExc_ValueError,
  6320. "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
  6321. }
  6322. /* RaiseNeedMoreValuesToUnpack */
  6323. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
  6324. PyErr_Format(PyExc_ValueError,
  6325. "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
  6326. index, (index == 1) ? "" : "s");
  6327. }
  6328. /* RaiseNoneIterError */
  6329. static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
  6330. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
  6331. }
  6332. /* GetTopmostException */
  6333. #if CYTHON_USE_EXC_INFO_STACK
  6334. static _PyErr_StackItem *
  6335. __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
  6336. {
  6337. _PyErr_StackItem *exc_info = tstate->exc_info;
  6338. while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
  6339. exc_info->previous_item != NULL)
  6340. {
  6341. exc_info = exc_info->previous_item;
  6342. }
  6343. return exc_info;
  6344. }
  6345. #endif
  6346. /* SaveResetException */
  6347. #if CYTHON_FAST_THREAD_STATE
  6348. static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  6349. #if CYTHON_USE_EXC_INFO_STACK
  6350. _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
  6351. *type = exc_info->exc_type;
  6352. *value = exc_info->exc_value;
  6353. *tb = exc_info->exc_traceback;
  6354. #else
  6355. *type = tstate->exc_type;
  6356. *value = tstate->exc_value;
  6357. *tb = tstate->exc_traceback;
  6358. #endif
  6359. Py_XINCREF(*type);
  6360. Py_XINCREF(*value);
  6361. Py_XINCREF(*tb);
  6362. }
  6363. static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  6364. PyObject *tmp_type, *tmp_value, *tmp_tb;
  6365. #if CYTHON_USE_EXC_INFO_STACK
  6366. _PyErr_StackItem *exc_info = tstate->exc_info;
  6367. tmp_type = exc_info->exc_type;
  6368. tmp_value = exc_info->exc_value;
  6369. tmp_tb = exc_info->exc_traceback;
  6370. exc_info->exc_type = type;
  6371. exc_info->exc_value = value;
  6372. exc_info->exc_traceback = tb;
  6373. #else
  6374. tmp_type = tstate->exc_type;
  6375. tmp_value = tstate->exc_value;
  6376. tmp_tb = tstate->exc_traceback;
  6377. tstate->exc_type = type;
  6378. tstate->exc_value = value;
  6379. tstate->exc_traceback = tb;
  6380. #endif
  6381. Py_XDECREF(tmp_type);
  6382. Py_XDECREF(tmp_value);
  6383. Py_XDECREF(tmp_tb);
  6384. }
  6385. #endif
  6386. /* PyErrExceptionMatches */
  6387. #if CYTHON_FAST_THREAD_STATE
  6388. static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
  6389. Py_ssize_t i, n;
  6390. n = PyTuple_GET_SIZE(tuple);
  6391. #if PY_MAJOR_VERSION >= 3
  6392. for (i=0; i<n; i++) {
  6393. if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
  6394. }
  6395. #endif
  6396. for (i=0; i<n; i++) {
  6397. if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
  6398. }
  6399. return 0;
  6400. }
  6401. static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
  6402. PyObject *exc_type = tstate->curexc_type;
  6403. if (exc_type == err) return 1;
  6404. if (unlikely(!exc_type)) return 0;
  6405. if (unlikely(PyTuple_Check(err)))
  6406. return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
  6407. return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
  6408. }
  6409. #endif
  6410. /* GetException */
  6411. #if CYTHON_FAST_THREAD_STATE
  6412. static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
  6413. #else
  6414. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
  6415. #endif
  6416. {
  6417. PyObject *local_type, *local_value, *local_tb;
  6418. #if CYTHON_FAST_THREAD_STATE
  6419. PyObject *tmp_type, *tmp_value, *tmp_tb;
  6420. local_type = tstate->curexc_type;
  6421. local_value = tstate->curexc_value;
  6422. local_tb = tstate->curexc_traceback;
  6423. tstate->curexc_type = 0;
  6424. tstate->curexc_value = 0;
  6425. tstate->curexc_traceback = 0;
  6426. #else
  6427. PyErr_Fetch(&local_type, &local_value, &local_tb);
  6428. #endif
  6429. PyErr_NormalizeException(&local_type, &local_value, &local_tb);
  6430. #if CYTHON_FAST_THREAD_STATE
  6431. if (unlikely(tstate->curexc_type))
  6432. #else
  6433. if (unlikely(PyErr_Occurred()))
  6434. #endif
  6435. goto bad;
  6436. #if PY_MAJOR_VERSION >= 3
  6437. if (local_tb) {
  6438. if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
  6439. goto bad;
  6440. }
  6441. #endif
  6442. Py_XINCREF(local_tb);
  6443. Py_XINCREF(local_type);
  6444. Py_XINCREF(local_value);
  6445. *type = local_type;
  6446. *value = local_value;
  6447. *tb = local_tb;
  6448. #if CYTHON_FAST_THREAD_STATE
  6449. #if CYTHON_USE_EXC_INFO_STACK
  6450. {
  6451. _PyErr_StackItem *exc_info = tstate->exc_info;
  6452. tmp_type = exc_info->exc_type;
  6453. tmp_value = exc_info->exc_value;
  6454. tmp_tb = exc_info->exc_traceback;
  6455. exc_info->exc_type = local_type;
  6456. exc_info->exc_value = local_value;
  6457. exc_info->exc_traceback = local_tb;
  6458. }
  6459. #else
  6460. tmp_type = tstate->exc_type;
  6461. tmp_value = tstate->exc_value;
  6462. tmp_tb = tstate->exc_traceback;
  6463. tstate->exc_type = local_type;
  6464. tstate->exc_value = local_value;
  6465. tstate->exc_traceback = local_tb;
  6466. #endif
  6467. Py_XDECREF(tmp_type);
  6468. Py_XDECREF(tmp_value);
  6469. Py_XDECREF(tmp_tb);
  6470. #else
  6471. PyErr_SetExcInfo(local_type, local_value, local_tb);
  6472. #endif
  6473. return 0;
  6474. bad:
  6475. *type = 0;
  6476. *value = 0;
  6477. *tb = 0;
  6478. Py_XDECREF(local_type);
  6479. Py_XDECREF(local_value);
  6480. Py_XDECREF(local_tb);
  6481. return -1;
  6482. }
  6483. /* TypeImport */
  6484. #ifndef __PYX_HAVE_RT_ImportType
  6485. #define __PYX_HAVE_RT_ImportType
  6486. static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
  6487. size_t size, enum __Pyx_ImportType_CheckSize check_size)
  6488. {
  6489. PyObject *result = 0;
  6490. char warning[200];
  6491. Py_ssize_t basicsize;
  6492. #ifdef Py_LIMITED_API
  6493. PyObject *py_basicsize;
  6494. #endif
  6495. result = PyObject_GetAttrString(module, class_name);
  6496. if (!result)
  6497. goto bad;
  6498. if (!PyType_Check(result)) {
  6499. PyErr_Format(PyExc_TypeError,
  6500. "%.200s.%.200s is not a type object",
  6501. module_name, class_name);
  6502. goto bad;
  6503. }
  6504. #ifndef Py_LIMITED_API
  6505. basicsize = ((PyTypeObject *)result)->tp_basicsize;
  6506. #else
  6507. py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
  6508. if (!py_basicsize)
  6509. goto bad;
  6510. basicsize = PyLong_AsSsize_t(py_basicsize);
  6511. Py_DECREF(py_basicsize);
  6512. py_basicsize = 0;
  6513. if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
  6514. goto bad;
  6515. #endif
  6516. if ((size_t)basicsize < size) {
  6517. PyErr_Format(PyExc_ValueError,
  6518. "%.200s.%.200s size changed, may indicate binary incompatibility. "
  6519. "Expected %zd from C header, got %zd from PyObject",
  6520. module_name, class_name, size, basicsize);
  6521. goto bad;
  6522. }
  6523. if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
  6524. PyErr_Format(PyExc_ValueError,
  6525. "%.200s.%.200s size changed, may indicate binary incompatibility. "
  6526. "Expected %zd from C header, got %zd from PyObject",
  6527. module_name, class_name, size, basicsize);
  6528. goto bad;
  6529. }
  6530. else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
  6531. PyOS_snprintf(warning, sizeof(warning),
  6532. "%s.%s size changed, may indicate binary incompatibility. "
  6533. "Expected %zd from C header, got %zd from PyObject",
  6534. module_name, class_name, size, basicsize);
  6535. if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
  6536. }
  6537. return (PyTypeObject *)result;
  6538. bad:
  6539. Py_XDECREF(result);
  6540. return NULL;
  6541. }
  6542. #endif
  6543. /* Import */
  6544. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
  6545. PyObject *empty_list = 0;
  6546. PyObject *module = 0;
  6547. PyObject *global_dict = 0;
  6548. PyObject *empty_dict = 0;
  6549. PyObject *list;
  6550. #if PY_MAJOR_VERSION < 3
  6551. PyObject *py_import;
  6552. py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
  6553. if (!py_import)
  6554. goto bad;
  6555. #endif
  6556. if (from_list)
  6557. list = from_list;
  6558. else {
  6559. empty_list = PyList_New(0);
  6560. if (!empty_list)
  6561. goto bad;
  6562. list = empty_list;
  6563. }
  6564. global_dict = PyModule_GetDict(__pyx_m);
  6565. if (!global_dict)
  6566. goto bad;
  6567. empty_dict = PyDict_New();
  6568. if (!empty_dict)
  6569. goto bad;
  6570. {
  6571. #if PY_MAJOR_VERSION >= 3
  6572. if (level == -1) {
  6573. if (strchr(__Pyx_MODULE_NAME, '.')) {
  6574. module = PyImport_ImportModuleLevelObject(
  6575. name, global_dict, empty_dict, list, 1);
  6576. if (!module) {
  6577. if (!PyErr_ExceptionMatches(PyExc_ImportError))
  6578. goto bad;
  6579. PyErr_Clear();
  6580. }
  6581. }
  6582. level = 0;
  6583. }
  6584. #endif
  6585. if (!module) {
  6586. #if PY_MAJOR_VERSION < 3
  6587. PyObject *py_level = PyInt_FromLong(level);
  6588. if (!py_level)
  6589. goto bad;
  6590. module = PyObject_CallFunctionObjArgs(py_import,
  6591. name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
  6592. Py_DECREF(py_level);
  6593. #else
  6594. module = PyImport_ImportModuleLevelObject(
  6595. name, global_dict, empty_dict, list, level);
  6596. #endif
  6597. }
  6598. }
  6599. bad:
  6600. #if PY_MAJOR_VERSION < 3
  6601. Py_XDECREF(py_import);
  6602. #endif
  6603. Py_XDECREF(empty_list);
  6604. Py_XDECREF(empty_dict);
  6605. return module;
  6606. }
  6607. /* CLineInTraceback */
  6608. #ifndef CYTHON_CLINE_IN_TRACEBACK
  6609. static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
  6610. PyObject *use_cline;
  6611. PyObject *ptype, *pvalue, *ptraceback;
  6612. #if CYTHON_COMPILING_IN_CPYTHON
  6613. PyObject **cython_runtime_dict;
  6614. #endif
  6615. if (unlikely(!__pyx_cython_runtime)) {
  6616. return c_line;
  6617. }
  6618. __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
  6619. #if CYTHON_COMPILING_IN_CPYTHON
  6620. cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
  6621. if (likely(cython_runtime_dict)) {
  6622. __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
  6623. use_cline, *cython_runtime_dict,
  6624. __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
  6625. } else
  6626. #endif
  6627. {
  6628. PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
  6629. if (use_cline_obj) {
  6630. use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
  6631. Py_DECREF(use_cline_obj);
  6632. } else {
  6633. PyErr_Clear();
  6634. use_cline = NULL;
  6635. }
  6636. }
  6637. if (!use_cline) {
  6638. c_line = 0;
  6639. PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
  6640. }
  6641. else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
  6642. c_line = 0;
  6643. }
  6644. __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
  6645. return c_line;
  6646. }
  6647. #endif
  6648. /* CodeObjectCache */
  6649. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
  6650. int start = 0, mid = 0, end = count - 1;
  6651. if (end >= 0 && code_line > entries[end].code_line) {
  6652. return count;
  6653. }
  6654. while (start < end) {
  6655. mid = start + (end - start) / 2;
  6656. if (code_line < entries[mid].code_line) {
  6657. end = mid;
  6658. } else if (code_line > entries[mid].code_line) {
  6659. start = mid + 1;
  6660. } else {
  6661. return mid;
  6662. }
  6663. }
  6664. if (code_line <= entries[mid].code_line) {
  6665. return mid;
  6666. } else {
  6667. return mid + 1;
  6668. }
  6669. }
  6670. static PyCodeObject *__pyx_find_code_object(int code_line) {
  6671. PyCodeObject* code_object;
  6672. int pos;
  6673. if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
  6674. return NULL;
  6675. }
  6676. pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
  6677. if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
  6678. return NULL;
  6679. }
  6680. code_object = __pyx_code_cache.entries[pos].code_object;
  6681. Py_INCREF(code_object);
  6682. return code_object;
  6683. }
  6684. static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
  6685. int pos, i;
  6686. __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
  6687. if (unlikely(!code_line)) {
  6688. return;
  6689. }
  6690. if (unlikely(!entries)) {
  6691. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
  6692. if (likely(entries)) {
  6693. __pyx_code_cache.entries = entries;
  6694. __pyx_code_cache.max_count = 64;
  6695. __pyx_code_cache.count = 1;
  6696. entries[0].code_line = code_line;
  6697. entries[0].code_object = code_object;
  6698. Py_INCREF(code_object);
  6699. }
  6700. return;
  6701. }
  6702. pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
  6703. if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
  6704. PyCodeObject* tmp = entries[pos].code_object;
  6705. entries[pos].code_object = code_object;
  6706. Py_DECREF(tmp);
  6707. return;
  6708. }
  6709. if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
  6710. int new_max = __pyx_code_cache.max_count + 64;
  6711. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
  6712. __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
  6713. if (unlikely(!entries)) {
  6714. return;
  6715. }
  6716. __pyx_code_cache.entries = entries;
  6717. __pyx_code_cache.max_count = new_max;
  6718. }
  6719. for (i=__pyx_code_cache.count; i>pos; i--) {
  6720. entries[i] = entries[i-1];
  6721. }
  6722. entries[pos].code_line = code_line;
  6723. entries[pos].code_object = code_object;
  6724. __pyx_code_cache.count++;
  6725. Py_INCREF(code_object);
  6726. }
  6727. /* AddTraceback */
  6728. #include "compile.h"
  6729. #include "frameobject.h"
  6730. #include "traceback.h"
  6731. static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
  6732. const char *funcname, int c_line,
  6733. int py_line, const char *filename) {
  6734. PyCodeObject *py_code = 0;
  6735. PyObject *py_srcfile = 0;
  6736. PyObject *py_funcname = 0;
  6737. #if PY_MAJOR_VERSION < 3
  6738. py_srcfile = PyString_FromString(filename);
  6739. #else
  6740. py_srcfile = PyUnicode_FromString(filename);
  6741. #endif
  6742. if (!py_srcfile) goto bad;
  6743. if (c_line) {
  6744. #if PY_MAJOR_VERSION < 3
  6745. py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  6746. #else
  6747. py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  6748. #endif
  6749. }
  6750. else {
  6751. #if PY_MAJOR_VERSION < 3
  6752. py_funcname = PyString_FromString(funcname);
  6753. #else
  6754. py_funcname = PyUnicode_FromString(funcname);
  6755. #endif
  6756. }
  6757. if (!py_funcname) goto bad;
  6758. py_code = __Pyx_PyCode_New(
  6759. 0,
  6760. 0,
  6761. 0,
  6762. 0,
  6763. 0,
  6764. __pyx_empty_bytes, /*PyObject *code,*/
  6765. __pyx_empty_tuple, /*PyObject *consts,*/
  6766. __pyx_empty_tuple, /*PyObject *names,*/
  6767. __pyx_empty_tuple, /*PyObject *varnames,*/
  6768. __pyx_empty_tuple, /*PyObject *freevars,*/
  6769. __pyx_empty_tuple, /*PyObject *cellvars,*/
  6770. py_srcfile, /*PyObject *filename,*/
  6771. py_funcname, /*PyObject *name,*/
  6772. py_line,
  6773. __pyx_empty_bytes /*PyObject *lnotab*/
  6774. );
  6775. Py_DECREF(py_srcfile);
  6776. Py_DECREF(py_funcname);
  6777. return py_code;
  6778. bad:
  6779. Py_XDECREF(py_srcfile);
  6780. Py_XDECREF(py_funcname);
  6781. return NULL;
  6782. }
  6783. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  6784. int py_line, const char *filename) {
  6785. PyCodeObject *py_code = 0;
  6786. PyFrameObject *py_frame = 0;
  6787. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  6788. if (c_line) {
  6789. c_line = __Pyx_CLineForTraceback(tstate, c_line);
  6790. }
  6791. py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
  6792. if (!py_code) {
  6793. py_code = __Pyx_CreateCodeObjectForTraceback(
  6794. funcname, c_line, py_line, filename);
  6795. if (!py_code) goto bad;
  6796. __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
  6797. }
  6798. py_frame = PyFrame_New(
  6799. tstate, /*PyThreadState *tstate,*/
  6800. py_code, /*PyCodeObject *code,*/
  6801. __pyx_d, /*PyObject *globals,*/
  6802. 0 /*PyObject *locals*/
  6803. );
  6804. if (!py_frame) goto bad;
  6805. __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
  6806. PyTraceBack_Here(py_frame);
  6807. bad:
  6808. Py_XDECREF(py_code);
  6809. Py_XDECREF(py_frame);
  6810. }
  6811. #if PY_MAJOR_VERSION < 3
  6812. static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
  6813. if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
  6814. if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
  6815. PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
  6816. return -1;
  6817. }
  6818. static void __Pyx_ReleaseBuffer(Py_buffer *view) {
  6819. PyObject *obj = view->obj;
  6820. if (!obj) return;
  6821. if (PyObject_CheckBuffer(obj)) {
  6822. PyBuffer_Release(view);
  6823. return;
  6824. }
  6825. if ((0)) {}
  6826. else if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view);
  6827. view->obj = NULL;
  6828. Py_DECREF(obj);
  6829. }
  6830. #endif
  6831. /* CIntToPy */
  6832. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value) {
  6833. const unsigned int neg_one = (unsigned int) ((unsigned int) 0 - (unsigned int) 1), const_zero = (unsigned int) 0;
  6834. const int is_unsigned = neg_one > const_zero;
  6835. if (is_unsigned) {
  6836. if (sizeof(unsigned int) < sizeof(long)) {
  6837. return PyInt_FromLong((long) value);
  6838. } else if (sizeof(unsigned int) <= sizeof(unsigned long)) {
  6839. return PyLong_FromUnsignedLong((unsigned long) value);
  6840. #ifdef HAVE_LONG_LONG
  6841. } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) {
  6842. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  6843. #endif
  6844. }
  6845. } else {
  6846. if (sizeof(unsigned int) <= sizeof(long)) {
  6847. return PyInt_FromLong((long) value);
  6848. #ifdef HAVE_LONG_LONG
  6849. } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) {
  6850. return PyLong_FromLongLong((PY_LONG_LONG) value);
  6851. #endif
  6852. }
  6853. }
  6854. {
  6855. int one = 1; int little = (int)*(unsigned char *)&one;
  6856. unsigned char *bytes = (unsigned char *)&value;
  6857. return _PyLong_FromByteArray(bytes, sizeof(unsigned int),
  6858. little, !is_unsigned);
  6859. }
  6860. }
  6861. /* CIntFromPyVerify */
  6862. #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
  6863. __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
  6864. #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
  6865. __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
  6866. #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
  6867. {\
  6868. func_type value = func_value;\
  6869. if (sizeof(target_type) < sizeof(func_type)) {\
  6870. if (unlikely(value != (func_type) (target_type) value)) {\
  6871. func_type zero = 0;\
  6872. if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
  6873. return (target_type) -1;\
  6874. if (is_unsigned && unlikely(value < zero))\
  6875. goto raise_neg_overflow;\
  6876. else\
  6877. goto raise_overflow;\
  6878. }\
  6879. }\
  6880. return (target_type) value;\
  6881. }
  6882. /* Declarations */
  6883. #if CYTHON_CCOMPLEX
  6884. #ifdef __cplusplus
  6885. static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
  6886. return ::std::complex< float >(x, y);
  6887. }
  6888. #else
  6889. static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
  6890. return x + y*(__pyx_t_float_complex)_Complex_I;
  6891. }
  6892. #endif
  6893. #else
  6894. static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
  6895. __pyx_t_float_complex z;
  6896. z.real = x;
  6897. z.imag = y;
  6898. return z;
  6899. }
  6900. #endif
  6901. /* Arithmetic */
  6902. #if CYTHON_CCOMPLEX
  6903. #else
  6904. static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  6905. return (a.real == b.real) && (a.imag == b.imag);
  6906. }
  6907. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  6908. __pyx_t_float_complex z;
  6909. z.real = a.real + b.real;
  6910. z.imag = a.imag + b.imag;
  6911. return z;
  6912. }
  6913. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  6914. __pyx_t_float_complex z;
  6915. z.real = a.real - b.real;
  6916. z.imag = a.imag - b.imag;
  6917. return z;
  6918. }
  6919. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  6920. __pyx_t_float_complex z;
  6921. z.real = a.real * b.real - a.imag * b.imag;
  6922. z.imag = a.real * b.imag + a.imag * b.real;
  6923. return z;
  6924. }
  6925. #if 1
  6926. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  6927. if (b.imag == 0) {
  6928. return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
  6929. } else if (fabsf(b.real) >= fabsf(b.imag)) {
  6930. if (b.real == 0 && b.imag == 0) {
  6931. return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
  6932. } else {
  6933. float r = b.imag / b.real;
  6934. float s = (float)(1.0) / (b.real + b.imag * r);
  6935. return __pyx_t_float_complex_from_parts(
  6936. (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
  6937. }
  6938. } else {
  6939. float r = b.real / b.imag;
  6940. float s = (float)(1.0) / (b.imag + b.real * r);
  6941. return __pyx_t_float_complex_from_parts(
  6942. (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
  6943. }
  6944. }
  6945. #else
  6946. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  6947. if (b.imag == 0) {
  6948. return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
  6949. } else {
  6950. float denom = b.real * b.real + b.imag * b.imag;
  6951. return __pyx_t_float_complex_from_parts(
  6952. (a.real * b.real + a.imag * b.imag) / denom,
  6953. (a.imag * b.real - a.real * b.imag) / denom);
  6954. }
  6955. }
  6956. #endif
  6957. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
  6958. __pyx_t_float_complex z;
  6959. z.real = -a.real;
  6960. z.imag = -a.imag;
  6961. return z;
  6962. }
  6963. static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
  6964. return (a.real == 0) && (a.imag == 0);
  6965. }
  6966. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
  6967. __pyx_t_float_complex z;
  6968. z.real = a.real;
  6969. z.imag = -a.imag;
  6970. return z;
  6971. }
  6972. #if 1
  6973. static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
  6974. #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
  6975. return sqrtf(z.real*z.real + z.imag*z.imag);
  6976. #else
  6977. return hypotf(z.real, z.imag);
  6978. #endif
  6979. }
  6980. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  6981. __pyx_t_float_complex z;
  6982. float r, lnr, theta, z_r, z_theta;
  6983. if (b.imag == 0 && b.real == (int)b.real) {
  6984. if (b.real < 0) {
  6985. float denom = a.real * a.real + a.imag * a.imag;
  6986. a.real = a.real / denom;
  6987. a.imag = -a.imag / denom;
  6988. b.real = -b.real;
  6989. }
  6990. switch ((int)b.real) {
  6991. case 0:
  6992. z.real = 1;
  6993. z.imag = 0;
  6994. return z;
  6995. case 1:
  6996. return a;
  6997. case 2:
  6998. z = __Pyx_c_prod_float(a, a);
  6999. return __Pyx_c_prod_float(a, a);
  7000. case 3:
  7001. z = __Pyx_c_prod_float(a, a);
  7002. return __Pyx_c_prod_float(z, a);
  7003. case 4:
  7004. z = __Pyx_c_prod_float(a, a);
  7005. return __Pyx_c_prod_float(z, z);
  7006. }
  7007. }
  7008. if (a.imag == 0) {
  7009. if (a.real == 0) {
  7010. return a;
  7011. } else if (b.imag == 0) {
  7012. z.real = powf(a.real, b.real);
  7013. z.imag = 0;
  7014. return z;
  7015. } else if (a.real > 0) {
  7016. r = a.real;
  7017. theta = 0;
  7018. } else {
  7019. r = -a.real;
  7020. theta = atan2f(0.0, -1.0);
  7021. }
  7022. } else {
  7023. r = __Pyx_c_abs_float(a);
  7024. theta = atan2f(a.imag, a.real);
  7025. }
  7026. lnr = logf(r);
  7027. z_r = expf(lnr * b.real - theta * b.imag);
  7028. z_theta = theta * b.real + lnr * b.imag;
  7029. z.real = z_r * cosf(z_theta);
  7030. z.imag = z_r * sinf(z_theta);
  7031. return z;
  7032. }
  7033. #endif
  7034. #endif
  7035. /* Declarations */
  7036. #if CYTHON_CCOMPLEX
  7037. #ifdef __cplusplus
  7038. static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
  7039. return ::std::complex< double >(x, y);
  7040. }
  7041. #else
  7042. static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
  7043. return x + y*(__pyx_t_double_complex)_Complex_I;
  7044. }
  7045. #endif
  7046. #else
  7047. static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
  7048. __pyx_t_double_complex z;
  7049. z.real = x;
  7050. z.imag = y;
  7051. return z;
  7052. }
  7053. #endif
  7054. /* Arithmetic */
  7055. #if CYTHON_CCOMPLEX
  7056. #else
  7057. static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  7058. return (a.real == b.real) && (a.imag == b.imag);
  7059. }
  7060. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  7061. __pyx_t_double_complex z;
  7062. z.real = a.real + b.real;
  7063. z.imag = a.imag + b.imag;
  7064. return z;
  7065. }
  7066. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  7067. __pyx_t_double_complex z;
  7068. z.real = a.real - b.real;
  7069. z.imag = a.imag - b.imag;
  7070. return z;
  7071. }
  7072. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  7073. __pyx_t_double_complex z;
  7074. z.real = a.real * b.real - a.imag * b.imag;
  7075. z.imag = a.real * b.imag + a.imag * b.real;
  7076. return z;
  7077. }
  7078. #if 1
  7079. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  7080. if (b.imag == 0) {
  7081. return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
  7082. } else if (fabs(b.real) >= fabs(b.imag)) {
  7083. if (b.real == 0 && b.imag == 0) {
  7084. return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
  7085. } else {
  7086. double r = b.imag / b.real;
  7087. double s = (double)(1.0) / (b.real + b.imag * r);
  7088. return __pyx_t_double_complex_from_parts(
  7089. (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
  7090. }
  7091. } else {
  7092. double r = b.real / b.imag;
  7093. double s = (double)(1.0) / (b.imag + b.real * r);
  7094. return __pyx_t_double_complex_from_parts(
  7095. (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
  7096. }
  7097. }
  7098. #else
  7099. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  7100. if (b.imag == 0) {
  7101. return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
  7102. } else {
  7103. double denom = b.real * b.real + b.imag * b.imag;
  7104. return __pyx_t_double_complex_from_parts(
  7105. (a.real * b.real + a.imag * b.imag) / denom,
  7106. (a.imag * b.real - a.real * b.imag) / denom);
  7107. }
  7108. }
  7109. #endif
  7110. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
  7111. __pyx_t_double_complex z;
  7112. z.real = -a.real;
  7113. z.imag = -a.imag;
  7114. return z;
  7115. }
  7116. static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
  7117. return (a.real == 0) && (a.imag == 0);
  7118. }
  7119. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
  7120. __pyx_t_double_complex z;
  7121. z.real = a.real;
  7122. z.imag = -a.imag;
  7123. return z;
  7124. }
  7125. #if 1
  7126. static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
  7127. #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
  7128. return sqrt(z.real*z.real + z.imag*z.imag);
  7129. #else
  7130. return hypot(z.real, z.imag);
  7131. #endif
  7132. }
  7133. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  7134. __pyx_t_double_complex z;
  7135. double r, lnr, theta, z_r, z_theta;
  7136. if (b.imag == 0 && b.real == (int)b.real) {
  7137. if (b.real < 0) {
  7138. double denom = a.real * a.real + a.imag * a.imag;
  7139. a.real = a.real / denom;
  7140. a.imag = -a.imag / denom;
  7141. b.real = -b.real;
  7142. }
  7143. switch ((int)b.real) {
  7144. case 0:
  7145. z.real = 1;
  7146. z.imag = 0;
  7147. return z;
  7148. case 1:
  7149. return a;
  7150. case 2:
  7151. z = __Pyx_c_prod_double(a, a);
  7152. return __Pyx_c_prod_double(a, a);
  7153. case 3:
  7154. z = __Pyx_c_prod_double(a, a);
  7155. return __Pyx_c_prod_double(z, a);
  7156. case 4:
  7157. z = __Pyx_c_prod_double(a, a);
  7158. return __Pyx_c_prod_double(z, z);
  7159. }
  7160. }
  7161. if (a.imag == 0) {
  7162. if (a.real == 0) {
  7163. return a;
  7164. } else if (b.imag == 0) {
  7165. z.real = pow(a.real, b.real);
  7166. z.imag = 0;
  7167. return z;
  7168. } else if (a.real > 0) {
  7169. r = a.real;
  7170. theta = 0;
  7171. } else {
  7172. r = -a.real;
  7173. theta = atan2(0.0, -1.0);
  7174. }
  7175. } else {
  7176. r = __Pyx_c_abs_double(a);
  7177. theta = atan2(a.imag, a.real);
  7178. }
  7179. lnr = log(r);
  7180. z_r = exp(lnr * b.real - theta * b.imag);
  7181. z_theta = theta * b.real + lnr * b.imag;
  7182. z.real = z_r * cos(z_theta);
  7183. z.imag = z_r * sin(z_theta);
  7184. return z;
  7185. }
  7186. #endif
  7187. #endif
  7188. /* CIntToPy */
  7189. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
  7190. const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
  7191. const int is_unsigned = neg_one > const_zero;
  7192. if (is_unsigned) {
  7193. if (sizeof(int) < sizeof(long)) {
  7194. return PyInt_FromLong((long) value);
  7195. } else if (sizeof(int) <= sizeof(unsigned long)) {
  7196. return PyLong_FromUnsignedLong((unsigned long) value);
  7197. #ifdef HAVE_LONG_LONG
  7198. } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
  7199. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  7200. #endif
  7201. }
  7202. } else {
  7203. if (sizeof(int) <= sizeof(long)) {
  7204. return PyInt_FromLong((long) value);
  7205. #ifdef HAVE_LONG_LONG
  7206. } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
  7207. return PyLong_FromLongLong((PY_LONG_LONG) value);
  7208. #endif
  7209. }
  7210. }
  7211. {
  7212. int one = 1; int little = (int)*(unsigned char *)&one;
  7213. unsigned char *bytes = (unsigned char *)&value;
  7214. return _PyLong_FromByteArray(bytes, sizeof(int),
  7215. little, !is_unsigned);
  7216. }
  7217. }
  7218. /* CIntToPy */
  7219. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
  7220. const enum NPY_TYPES neg_one = (enum NPY_TYPES) ((enum NPY_TYPES) 0 - (enum NPY_TYPES) 1), const_zero = (enum NPY_TYPES) 0;
  7221. const int is_unsigned = neg_one > const_zero;
  7222. if (is_unsigned) {
  7223. if (sizeof(enum NPY_TYPES) < sizeof(long)) {
  7224. return PyInt_FromLong((long) value);
  7225. } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
  7226. return PyLong_FromUnsignedLong((unsigned long) value);
  7227. #ifdef HAVE_LONG_LONG
  7228. } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
  7229. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  7230. #endif
  7231. }
  7232. } else {
  7233. if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
  7234. return PyInt_FromLong((long) value);
  7235. #ifdef HAVE_LONG_LONG
  7236. } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
  7237. return PyLong_FromLongLong((PY_LONG_LONG) value);
  7238. #endif
  7239. }
  7240. }
  7241. {
  7242. int one = 1; int little = (int)*(unsigned char *)&one;
  7243. unsigned char *bytes = (unsigned char *)&value;
  7244. return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
  7245. little, !is_unsigned);
  7246. }
  7247. }
  7248. /* CIntFromPy */
  7249. static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) {
  7250. const unsigned int neg_one = (unsigned int) ((unsigned int) 0 - (unsigned int) 1), const_zero = (unsigned int) 0;
  7251. const int is_unsigned = neg_one > const_zero;
  7252. #if PY_MAJOR_VERSION < 3
  7253. if (likely(PyInt_Check(x))) {
  7254. if (sizeof(unsigned int) < sizeof(long)) {
  7255. __PYX_VERIFY_RETURN_INT(unsigned int, long, PyInt_AS_LONG(x))
  7256. } else {
  7257. long val = PyInt_AS_LONG(x);
  7258. if (is_unsigned && unlikely(val < 0)) {
  7259. goto raise_neg_overflow;
  7260. }
  7261. return (unsigned int) val;
  7262. }
  7263. } else
  7264. #endif
  7265. if (likely(PyLong_Check(x))) {
  7266. if (is_unsigned) {
  7267. #if CYTHON_USE_PYLONG_INTERNALS
  7268. const digit* digits = ((PyLongObject*)x)->ob_digit;
  7269. switch (Py_SIZE(x)) {
  7270. case 0: return (unsigned int) 0;
  7271. case 1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, digits[0])
  7272. case 2:
  7273. if (8 * sizeof(unsigned int) > 1 * PyLong_SHIFT) {
  7274. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  7275. __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7276. } else if (8 * sizeof(unsigned int) >= 2 * PyLong_SHIFT) {
  7277. return (unsigned int) (((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
  7278. }
  7279. }
  7280. break;
  7281. case 3:
  7282. if (8 * sizeof(unsigned int) > 2 * PyLong_SHIFT) {
  7283. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  7284. __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7285. } else if (8 * sizeof(unsigned int) >= 3 * PyLong_SHIFT) {
  7286. return (unsigned int) (((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
  7287. }
  7288. }
  7289. break;
  7290. case 4:
  7291. if (8 * sizeof(unsigned int) > 3 * PyLong_SHIFT) {
  7292. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  7293. __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7294. } else if (8 * sizeof(unsigned int) >= 4 * PyLong_SHIFT) {
  7295. return (unsigned int) (((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
  7296. }
  7297. }
  7298. break;
  7299. }
  7300. #endif
  7301. #if CYTHON_COMPILING_IN_CPYTHON
  7302. if (unlikely(Py_SIZE(x) < 0)) {
  7303. goto raise_neg_overflow;
  7304. }
  7305. #else
  7306. {
  7307. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  7308. if (unlikely(result < 0))
  7309. return (unsigned int) -1;
  7310. if (unlikely(result == 1))
  7311. goto raise_neg_overflow;
  7312. }
  7313. #endif
  7314. if (sizeof(unsigned int) <= sizeof(unsigned long)) {
  7315. __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned long, PyLong_AsUnsignedLong(x))
  7316. #ifdef HAVE_LONG_LONG
  7317. } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) {
  7318. __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  7319. #endif
  7320. }
  7321. } else {
  7322. #if CYTHON_USE_PYLONG_INTERNALS
  7323. const digit* digits = ((PyLongObject*)x)->ob_digit;
  7324. switch (Py_SIZE(x)) {
  7325. case 0: return (unsigned int) 0;
  7326. case -1: __PYX_VERIFY_RETURN_INT(unsigned int, sdigit, (sdigit) (-(sdigit)digits[0]))
  7327. case 1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, +digits[0])
  7328. case -2:
  7329. if (8 * sizeof(unsigned int) - 1 > 1 * PyLong_SHIFT) {
  7330. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  7331. __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7332. } else if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) {
  7333. return (unsigned int) (((unsigned int)-1)*(((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
  7334. }
  7335. }
  7336. break;
  7337. case 2:
  7338. if (8 * sizeof(unsigned int) > 1 * PyLong_SHIFT) {
  7339. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  7340. __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7341. } else if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) {
  7342. return (unsigned int) ((((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
  7343. }
  7344. }
  7345. break;
  7346. case -3:
  7347. if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) {
  7348. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  7349. __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7350. } else if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) {
  7351. return (unsigned int) (((unsigned int)-1)*(((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
  7352. }
  7353. }
  7354. break;
  7355. case 3:
  7356. if (8 * sizeof(unsigned int) > 2 * PyLong_SHIFT) {
  7357. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  7358. __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7359. } else if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) {
  7360. return (unsigned int) ((((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
  7361. }
  7362. }
  7363. break;
  7364. case -4:
  7365. if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) {
  7366. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  7367. __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7368. } else if (8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT) {
  7369. return (unsigned int) (((unsigned int)-1)*(((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
  7370. }
  7371. }
  7372. break;
  7373. case 4:
  7374. if (8 * sizeof(unsigned int) > 3 * PyLong_SHIFT) {
  7375. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  7376. __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7377. } else if (8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT) {
  7378. return (unsigned int) ((((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
  7379. }
  7380. }
  7381. break;
  7382. }
  7383. #endif
  7384. if (sizeof(unsigned int) <= sizeof(long)) {
  7385. __PYX_VERIFY_RETURN_INT_EXC(unsigned int, long, PyLong_AsLong(x))
  7386. #ifdef HAVE_LONG_LONG
  7387. } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) {
  7388. __PYX_VERIFY_RETURN_INT_EXC(unsigned int, PY_LONG_LONG, PyLong_AsLongLong(x))
  7389. #endif
  7390. }
  7391. }
  7392. {
  7393. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  7394. PyErr_SetString(PyExc_RuntimeError,
  7395. "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  7396. #else
  7397. unsigned int val;
  7398. PyObject *v = __Pyx_PyNumber_IntOrLong(x);
  7399. #if PY_MAJOR_VERSION < 3
  7400. if (likely(v) && !PyLong_Check(v)) {
  7401. PyObject *tmp = v;
  7402. v = PyNumber_Long(tmp);
  7403. Py_DECREF(tmp);
  7404. }
  7405. #endif
  7406. if (likely(v)) {
  7407. int one = 1; int is_little = (int)*(unsigned char *)&one;
  7408. unsigned char *bytes = (unsigned char *)&val;
  7409. int ret = _PyLong_AsByteArray((PyLongObject *)v,
  7410. bytes, sizeof(val),
  7411. is_little, !is_unsigned);
  7412. Py_DECREF(v);
  7413. if (likely(!ret))
  7414. return val;
  7415. }
  7416. #endif
  7417. return (unsigned int) -1;
  7418. }
  7419. } else {
  7420. unsigned int val;
  7421. PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
  7422. if (!tmp) return (unsigned int) -1;
  7423. val = __Pyx_PyInt_As_unsigned_int(tmp);
  7424. Py_DECREF(tmp);
  7425. return val;
  7426. }
  7427. raise_overflow:
  7428. PyErr_SetString(PyExc_OverflowError,
  7429. "value too large to convert to unsigned int");
  7430. return (unsigned int) -1;
  7431. raise_neg_overflow:
  7432. PyErr_SetString(PyExc_OverflowError,
  7433. "can't convert negative value to unsigned int");
  7434. return (unsigned int) -1;
  7435. }
  7436. /* CIntFromPy */
  7437. static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
  7438. const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
  7439. const int is_unsigned = neg_one > const_zero;
  7440. #if PY_MAJOR_VERSION < 3
  7441. if (likely(PyInt_Check(x))) {
  7442. if (sizeof(int) < sizeof(long)) {
  7443. __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
  7444. } else {
  7445. long val = PyInt_AS_LONG(x);
  7446. if (is_unsigned && unlikely(val < 0)) {
  7447. goto raise_neg_overflow;
  7448. }
  7449. return (int) val;
  7450. }
  7451. } else
  7452. #endif
  7453. if (likely(PyLong_Check(x))) {
  7454. if (is_unsigned) {
  7455. #if CYTHON_USE_PYLONG_INTERNALS
  7456. const digit* digits = ((PyLongObject*)x)->ob_digit;
  7457. switch (Py_SIZE(x)) {
  7458. case 0: return (int) 0;
  7459. case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
  7460. case 2:
  7461. if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
  7462. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  7463. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7464. } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
  7465. return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  7466. }
  7467. }
  7468. break;
  7469. case 3:
  7470. if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
  7471. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  7472. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7473. } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
  7474. return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  7475. }
  7476. }
  7477. break;
  7478. case 4:
  7479. if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
  7480. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  7481. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7482. } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
  7483. return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  7484. }
  7485. }
  7486. break;
  7487. }
  7488. #endif
  7489. #if CYTHON_COMPILING_IN_CPYTHON
  7490. if (unlikely(Py_SIZE(x) < 0)) {
  7491. goto raise_neg_overflow;
  7492. }
  7493. #else
  7494. {
  7495. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  7496. if (unlikely(result < 0))
  7497. return (int) -1;
  7498. if (unlikely(result == 1))
  7499. goto raise_neg_overflow;
  7500. }
  7501. #endif
  7502. if (sizeof(int) <= sizeof(unsigned long)) {
  7503. __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
  7504. #ifdef HAVE_LONG_LONG
  7505. } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
  7506. __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  7507. #endif
  7508. }
  7509. } else {
  7510. #if CYTHON_USE_PYLONG_INTERNALS
  7511. const digit* digits = ((PyLongObject*)x)->ob_digit;
  7512. switch (Py_SIZE(x)) {
  7513. case 0: return (int) 0;
  7514. case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
  7515. case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
  7516. case -2:
  7517. if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
  7518. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  7519. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7520. } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
  7521. return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  7522. }
  7523. }
  7524. break;
  7525. case 2:
  7526. if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
  7527. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  7528. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7529. } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
  7530. return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  7531. }
  7532. }
  7533. break;
  7534. case -3:
  7535. if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
  7536. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  7537. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7538. } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
  7539. return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  7540. }
  7541. }
  7542. break;
  7543. case 3:
  7544. if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
  7545. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  7546. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7547. } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
  7548. return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  7549. }
  7550. }
  7551. break;
  7552. case -4:
  7553. if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
  7554. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  7555. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7556. } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
  7557. return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  7558. }
  7559. }
  7560. break;
  7561. case 4:
  7562. if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
  7563. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  7564. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7565. } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
  7566. return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  7567. }
  7568. }
  7569. break;
  7570. }
  7571. #endif
  7572. if (sizeof(int) <= sizeof(long)) {
  7573. __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
  7574. #ifdef HAVE_LONG_LONG
  7575. } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
  7576. __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
  7577. #endif
  7578. }
  7579. }
  7580. {
  7581. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  7582. PyErr_SetString(PyExc_RuntimeError,
  7583. "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  7584. #else
  7585. int val;
  7586. PyObject *v = __Pyx_PyNumber_IntOrLong(x);
  7587. #if PY_MAJOR_VERSION < 3
  7588. if (likely(v) && !PyLong_Check(v)) {
  7589. PyObject *tmp = v;
  7590. v = PyNumber_Long(tmp);
  7591. Py_DECREF(tmp);
  7592. }
  7593. #endif
  7594. if (likely(v)) {
  7595. int one = 1; int is_little = (int)*(unsigned char *)&one;
  7596. unsigned char *bytes = (unsigned char *)&val;
  7597. int ret = _PyLong_AsByteArray((PyLongObject *)v,
  7598. bytes, sizeof(val),
  7599. is_little, !is_unsigned);
  7600. Py_DECREF(v);
  7601. if (likely(!ret))
  7602. return val;
  7603. }
  7604. #endif
  7605. return (int) -1;
  7606. }
  7607. } else {
  7608. int val;
  7609. PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
  7610. if (!tmp) return (int) -1;
  7611. val = __Pyx_PyInt_As_int(tmp);
  7612. Py_DECREF(tmp);
  7613. return val;
  7614. }
  7615. raise_overflow:
  7616. PyErr_SetString(PyExc_OverflowError,
  7617. "value too large to convert to int");
  7618. return (int) -1;
  7619. raise_neg_overflow:
  7620. PyErr_SetString(PyExc_OverflowError,
  7621. "can't convert negative value to int");
  7622. return (int) -1;
  7623. }
  7624. /* CIntToPy */
  7625. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
  7626. const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
  7627. const int is_unsigned = neg_one > const_zero;
  7628. if (is_unsigned) {
  7629. if (sizeof(long) < sizeof(long)) {
  7630. return PyInt_FromLong((long) value);
  7631. } else if (sizeof(long) <= sizeof(unsigned long)) {
  7632. return PyLong_FromUnsignedLong((unsigned long) value);
  7633. #ifdef HAVE_LONG_LONG
  7634. } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
  7635. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  7636. #endif
  7637. }
  7638. } else {
  7639. if (sizeof(long) <= sizeof(long)) {
  7640. return PyInt_FromLong((long) value);
  7641. #ifdef HAVE_LONG_LONG
  7642. } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
  7643. return PyLong_FromLongLong((PY_LONG_LONG) value);
  7644. #endif
  7645. }
  7646. }
  7647. {
  7648. int one = 1; int little = (int)*(unsigned char *)&one;
  7649. unsigned char *bytes = (unsigned char *)&value;
  7650. return _PyLong_FromByteArray(bytes, sizeof(long),
  7651. little, !is_unsigned);
  7652. }
  7653. }
  7654. /* CIntFromPy */
  7655. static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
  7656. const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
  7657. const int is_unsigned = neg_one > const_zero;
  7658. #if PY_MAJOR_VERSION < 3
  7659. if (likely(PyInt_Check(x))) {
  7660. if (sizeof(long) < sizeof(long)) {
  7661. __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
  7662. } else {
  7663. long val = PyInt_AS_LONG(x);
  7664. if (is_unsigned && unlikely(val < 0)) {
  7665. goto raise_neg_overflow;
  7666. }
  7667. return (long) val;
  7668. }
  7669. } else
  7670. #endif
  7671. if (likely(PyLong_Check(x))) {
  7672. if (is_unsigned) {
  7673. #if CYTHON_USE_PYLONG_INTERNALS
  7674. const digit* digits = ((PyLongObject*)x)->ob_digit;
  7675. switch (Py_SIZE(x)) {
  7676. case 0: return (long) 0;
  7677. case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
  7678. case 2:
  7679. if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
  7680. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  7681. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7682. } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
  7683. return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  7684. }
  7685. }
  7686. break;
  7687. case 3:
  7688. if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
  7689. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  7690. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7691. } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
  7692. return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  7693. }
  7694. }
  7695. break;
  7696. case 4:
  7697. if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
  7698. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  7699. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7700. } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
  7701. return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  7702. }
  7703. }
  7704. break;
  7705. }
  7706. #endif
  7707. #if CYTHON_COMPILING_IN_CPYTHON
  7708. if (unlikely(Py_SIZE(x) < 0)) {
  7709. goto raise_neg_overflow;
  7710. }
  7711. #else
  7712. {
  7713. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  7714. if (unlikely(result < 0))
  7715. return (long) -1;
  7716. if (unlikely(result == 1))
  7717. goto raise_neg_overflow;
  7718. }
  7719. #endif
  7720. if (sizeof(long) <= sizeof(unsigned long)) {
  7721. __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
  7722. #ifdef HAVE_LONG_LONG
  7723. } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
  7724. __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  7725. #endif
  7726. }
  7727. } else {
  7728. #if CYTHON_USE_PYLONG_INTERNALS
  7729. const digit* digits = ((PyLongObject*)x)->ob_digit;
  7730. switch (Py_SIZE(x)) {
  7731. case 0: return (long) 0;
  7732. case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
  7733. case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
  7734. case -2:
  7735. if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
  7736. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  7737. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7738. } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  7739. return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  7740. }
  7741. }
  7742. break;
  7743. case 2:
  7744. if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
  7745. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  7746. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7747. } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  7748. return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  7749. }
  7750. }
  7751. break;
  7752. case -3:
  7753. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  7754. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  7755. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7756. } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  7757. return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  7758. }
  7759. }
  7760. break;
  7761. case 3:
  7762. if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
  7763. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  7764. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7765. } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  7766. return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  7767. }
  7768. }
  7769. break;
  7770. case -4:
  7771. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  7772. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  7773. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7774. } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  7775. return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  7776. }
  7777. }
  7778. break;
  7779. case 4:
  7780. if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
  7781. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  7782. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  7783. } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  7784. return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  7785. }
  7786. }
  7787. break;
  7788. }
  7789. #endif
  7790. if (sizeof(long) <= sizeof(long)) {
  7791. __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
  7792. #ifdef HAVE_LONG_LONG
  7793. } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
  7794. __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
  7795. #endif
  7796. }
  7797. }
  7798. {
  7799. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  7800. PyErr_SetString(PyExc_RuntimeError,
  7801. "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  7802. #else
  7803. long val;
  7804. PyObject *v = __Pyx_PyNumber_IntOrLong(x);
  7805. #if PY_MAJOR_VERSION < 3
  7806. if (likely(v) && !PyLong_Check(v)) {
  7807. PyObject *tmp = v;
  7808. v = PyNumber_Long(tmp);
  7809. Py_DECREF(tmp);
  7810. }
  7811. #endif
  7812. if (likely(v)) {
  7813. int one = 1; int is_little = (int)*(unsigned char *)&one;
  7814. unsigned char *bytes = (unsigned char *)&val;
  7815. int ret = _PyLong_AsByteArray((PyLongObject *)v,
  7816. bytes, sizeof(val),
  7817. is_little, !is_unsigned);
  7818. Py_DECREF(v);
  7819. if (likely(!ret))
  7820. return val;
  7821. }
  7822. #endif
  7823. return (long) -1;
  7824. }
  7825. } else {
  7826. long val;
  7827. PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
  7828. if (!tmp) return (long) -1;
  7829. val = __Pyx_PyInt_As_long(tmp);
  7830. Py_DECREF(tmp);
  7831. return val;
  7832. }
  7833. raise_overflow:
  7834. PyErr_SetString(PyExc_OverflowError,
  7835. "value too large to convert to long");
  7836. return (long) -1;
  7837. raise_neg_overflow:
  7838. PyErr_SetString(PyExc_OverflowError,
  7839. "can't convert negative value to long");
  7840. return (long) -1;
  7841. }
  7842. /* FastTypeChecks */
  7843. #if CYTHON_COMPILING_IN_CPYTHON
  7844. static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
  7845. while (a) {
  7846. a = a->tp_base;
  7847. if (a == b)
  7848. return 1;
  7849. }
  7850. return b == &PyBaseObject_Type;
  7851. }
  7852. static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
  7853. PyObject *mro;
  7854. if (a == b) return 1;
  7855. mro = a->tp_mro;
  7856. if (likely(mro)) {
  7857. Py_ssize_t i, n;
  7858. n = PyTuple_GET_SIZE(mro);
  7859. for (i = 0; i < n; i++) {
  7860. if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
  7861. return 1;
  7862. }
  7863. return 0;
  7864. }
  7865. return __Pyx_InBases(a, b);
  7866. }
  7867. #if PY_MAJOR_VERSION == 2
  7868. static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
  7869. PyObject *exception, *value, *tb;
  7870. int res;
  7871. __Pyx_PyThreadState_declare
  7872. __Pyx_PyThreadState_assign
  7873. __Pyx_ErrFetch(&exception, &value, &tb);
  7874. res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
  7875. if (unlikely(res == -1)) {
  7876. PyErr_WriteUnraisable(err);
  7877. res = 0;
  7878. }
  7879. if (!res) {
  7880. res = PyObject_IsSubclass(err, exc_type2);
  7881. if (unlikely(res == -1)) {
  7882. PyErr_WriteUnraisable(err);
  7883. res = 0;
  7884. }
  7885. }
  7886. __Pyx_ErrRestore(exception, value, tb);
  7887. return res;
  7888. }
  7889. #else
  7890. static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
  7891. int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
  7892. if (!res) {
  7893. res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
  7894. }
  7895. return res;
  7896. }
  7897. #endif
  7898. static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
  7899. Py_ssize_t i, n;
  7900. assert(PyExceptionClass_Check(exc_type));
  7901. n = PyTuple_GET_SIZE(tuple);
  7902. #if PY_MAJOR_VERSION >= 3
  7903. for (i=0; i<n; i++) {
  7904. if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
  7905. }
  7906. #endif
  7907. for (i=0; i<n; i++) {
  7908. PyObject *t = PyTuple_GET_ITEM(tuple, i);
  7909. #if PY_MAJOR_VERSION < 3
  7910. if (likely(exc_type == t)) return 1;
  7911. #endif
  7912. if (likely(PyExceptionClass_Check(t))) {
  7913. if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
  7914. } else {
  7915. }
  7916. }
  7917. return 0;
  7918. }
  7919. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
  7920. if (likely(err == exc_type)) return 1;
  7921. if (likely(PyExceptionClass_Check(err))) {
  7922. if (likely(PyExceptionClass_Check(exc_type))) {
  7923. return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
  7924. } else if (likely(PyTuple_Check(exc_type))) {
  7925. return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
  7926. } else {
  7927. }
  7928. }
  7929. return PyErr_GivenExceptionMatches(err, exc_type);
  7930. }
  7931. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
  7932. assert(PyExceptionClass_Check(exc_type1));
  7933. assert(PyExceptionClass_Check(exc_type2));
  7934. if (likely(err == exc_type1 || err == exc_type2)) return 1;
  7935. if (likely(PyExceptionClass_Check(err))) {
  7936. return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
  7937. }
  7938. return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
  7939. }
  7940. #endif
  7941. /* CheckBinaryVersion */
  7942. static int __Pyx_check_binary_version(void) {
  7943. char ctversion[4], rtversion[4];
  7944. PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
  7945. PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
  7946. if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
  7947. char message[200];
  7948. PyOS_snprintf(message, sizeof(message),
  7949. "compiletime version %s of module '%.100s' "
  7950. "does not match runtime version %s",
  7951. ctversion, __Pyx_MODULE_NAME, rtversion);
  7952. return PyErr_WarnEx(NULL, message, 1);
  7953. }
  7954. return 0;
  7955. }
  7956. /* InitStrings */
  7957. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
  7958. while (t->p) {
  7959. #if PY_MAJOR_VERSION < 3
  7960. if (t->is_unicode) {
  7961. *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
  7962. } else if (t->intern) {
  7963. *t->p = PyString_InternFromString(t->s);
  7964. } else {
  7965. *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
  7966. }
  7967. #else
  7968. if (t->is_unicode | t->is_str) {
  7969. if (t->intern) {
  7970. *t->p = PyUnicode_InternFromString(t->s);
  7971. } else if (t->encoding) {
  7972. *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
  7973. } else {
  7974. *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
  7975. }
  7976. } else {
  7977. *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
  7978. }
  7979. #endif
  7980. if (!*t->p)
  7981. return -1;
  7982. if (PyObject_Hash(*t->p) == -1)
  7983. return -1;
  7984. ++t;
  7985. }
  7986. return 0;
  7987. }
  7988. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
  7989. return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
  7990. }
  7991. static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
  7992. Py_ssize_t ignore;
  7993. return __Pyx_PyObject_AsStringAndSize(o, &ignore);
  7994. }
  7995. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  7996. #if !CYTHON_PEP393_ENABLED
  7997. static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  7998. char* defenc_c;
  7999. PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
  8000. if (!defenc) return NULL;
  8001. defenc_c = PyBytes_AS_STRING(defenc);
  8002. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  8003. {
  8004. char* end = defenc_c + PyBytes_GET_SIZE(defenc);
  8005. char* c;
  8006. for (c = defenc_c; c < end; c++) {
  8007. if ((unsigned char) (*c) >= 128) {
  8008. PyUnicode_AsASCIIString(o);
  8009. return NULL;
  8010. }
  8011. }
  8012. }
  8013. #endif
  8014. *length = PyBytes_GET_SIZE(defenc);
  8015. return defenc_c;
  8016. }
  8017. #else
  8018. static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  8019. if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
  8020. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  8021. if (likely(PyUnicode_IS_ASCII(o))) {
  8022. *length = PyUnicode_GET_LENGTH(o);
  8023. return PyUnicode_AsUTF8(o);
  8024. } else {
  8025. PyUnicode_AsASCIIString(o);
  8026. return NULL;
  8027. }
  8028. #else
  8029. return PyUnicode_AsUTF8AndSize(o, length);
  8030. #endif
  8031. }
  8032. #endif
  8033. #endif
  8034. static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  8035. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  8036. if (
  8037. #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  8038. __Pyx_sys_getdefaultencoding_not_ascii &&
  8039. #endif
  8040. PyUnicode_Check(o)) {
  8041. return __Pyx_PyUnicode_AsStringAndSize(o, length);
  8042. } else
  8043. #endif
  8044. #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
  8045. if (PyByteArray_Check(o)) {
  8046. *length = PyByteArray_GET_SIZE(o);
  8047. return PyByteArray_AS_STRING(o);
  8048. } else
  8049. #endif
  8050. {
  8051. char* result;
  8052. int r = PyBytes_AsStringAndSize(o, &result, length);
  8053. if (unlikely(r < 0)) {
  8054. return NULL;
  8055. } else {
  8056. return result;
  8057. }
  8058. }
  8059. }
  8060. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
  8061. int is_true = x == Py_True;
  8062. if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
  8063. else return PyObject_IsTrue(x);
  8064. }
  8065. static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
  8066. int retval;
  8067. if (unlikely(!x)) return -1;
  8068. retval = __Pyx_PyObject_IsTrue(x);
  8069. Py_DECREF(x);
  8070. return retval;
  8071. }
  8072. static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
  8073. #if PY_MAJOR_VERSION >= 3
  8074. if (PyLong_Check(result)) {
  8075. if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
  8076. "__int__ returned non-int (type %.200s). "
  8077. "The ability to return an instance of a strict subclass of int "
  8078. "is deprecated, and may be removed in a future version of Python.",
  8079. Py_TYPE(result)->tp_name)) {
  8080. Py_DECREF(result);
  8081. return NULL;
  8082. }
  8083. return result;
  8084. }
  8085. #endif
  8086. PyErr_Format(PyExc_TypeError,
  8087. "__%.4s__ returned non-%.4s (type %.200s)",
  8088. type_name, type_name, Py_TYPE(result)->tp_name);
  8089. Py_DECREF(result);
  8090. return NULL;
  8091. }
  8092. static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
  8093. #if CYTHON_USE_TYPE_SLOTS
  8094. PyNumberMethods *m;
  8095. #endif
  8096. const char *name = NULL;
  8097. PyObject *res = NULL;
  8098. #if PY_MAJOR_VERSION < 3
  8099. if (likely(PyInt_Check(x) || PyLong_Check(x)))
  8100. #else
  8101. if (likely(PyLong_Check(x)))
  8102. #endif
  8103. return __Pyx_NewRef(x);
  8104. #if CYTHON_USE_TYPE_SLOTS
  8105. m = Py_TYPE(x)->tp_as_number;
  8106. #if PY_MAJOR_VERSION < 3
  8107. if (m && m->nb_int) {
  8108. name = "int";
  8109. res = m->nb_int(x);
  8110. }
  8111. else if (m && m->nb_long) {
  8112. name = "long";
  8113. res = m->nb_long(x);
  8114. }
  8115. #else
  8116. if (likely(m && m->nb_int)) {
  8117. name = "int";
  8118. res = m->nb_int(x);
  8119. }
  8120. #endif
  8121. #else
  8122. if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
  8123. res = PyNumber_Int(x);
  8124. }
  8125. #endif
  8126. if (likely(res)) {
  8127. #if PY_MAJOR_VERSION < 3
  8128. if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
  8129. #else
  8130. if (unlikely(!PyLong_CheckExact(res))) {
  8131. #endif
  8132. return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
  8133. }
  8134. }
  8135. else if (!PyErr_Occurred()) {
  8136. PyErr_SetString(PyExc_TypeError,
  8137. "an integer is required");
  8138. }
  8139. return res;
  8140. }
  8141. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  8142. Py_ssize_t ival;
  8143. PyObject *x;
  8144. #if PY_MAJOR_VERSION < 3
  8145. if (likely(PyInt_CheckExact(b))) {
  8146. if (sizeof(Py_ssize_t) >= sizeof(long))
  8147. return PyInt_AS_LONG(b);
  8148. else
  8149. return PyInt_AsSsize_t(b);
  8150. }
  8151. #endif
  8152. if (likely(PyLong_CheckExact(b))) {
  8153. #if CYTHON_USE_PYLONG_INTERNALS
  8154. const digit* digits = ((PyLongObject*)b)->ob_digit;
  8155. const Py_ssize_t size = Py_SIZE(b);
  8156. if (likely(__Pyx_sst_abs(size) <= 1)) {
  8157. ival = likely(size) ? digits[0] : 0;
  8158. if (size == -1) ival = -ival;
  8159. return ival;
  8160. } else {
  8161. switch (size) {
  8162. case 2:
  8163. if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
  8164. return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  8165. }
  8166. break;
  8167. case -2:
  8168. if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
  8169. return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  8170. }
  8171. break;
  8172. case 3:
  8173. if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
  8174. return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  8175. }
  8176. break;
  8177. case -3:
  8178. if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
  8179. return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  8180. }
  8181. break;
  8182. case 4:
  8183. if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
  8184. return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  8185. }
  8186. break;
  8187. case -4:
  8188. if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
  8189. return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  8190. }
  8191. break;
  8192. }
  8193. }
  8194. #endif
  8195. return PyLong_AsSsize_t(b);
  8196. }
  8197. x = PyNumber_Index(b);
  8198. if (!x) return -1;
  8199. ival = PyInt_AsSsize_t(x);
  8200. Py_DECREF(x);
  8201. return ival;
  8202. }
  8203. static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  8204. return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
  8205. }
  8206. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
  8207. return PyInt_FromSize_t(ival);
  8208. }
  8209. #endif /* Py_PYTHON_H */