cpu_nms.c 363 KB

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