box_overlaps.c 305 KB

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