scattnlay_mp.cpp 554 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973
  1. /* Generated by Cython 0.23.4 */
  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 < 0x03020000)
  7. #error Cython requires Python 2.6+ or Python 3.2+.
  8. #else
  9. #define CYTHON_ABI "0_23_4"
  10. #include <stddef.h>
  11. #ifndef offsetof
  12. #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
  13. #endif
  14. #if !defined(WIN32) && !defined(MS_WINDOWS)
  15. #ifndef __stdcall
  16. #define __stdcall
  17. #endif
  18. #ifndef __cdecl
  19. #define __cdecl
  20. #endif
  21. #ifndef __fastcall
  22. #define __fastcall
  23. #endif
  24. #endif
  25. #ifndef DL_IMPORT
  26. #define DL_IMPORT(t) t
  27. #endif
  28. #ifndef DL_EXPORT
  29. #define DL_EXPORT(t) t
  30. #endif
  31. #ifndef PY_LONG_LONG
  32. #define PY_LONG_LONG LONG_LONG
  33. #endif
  34. #ifndef Py_HUGE_VAL
  35. #define Py_HUGE_VAL HUGE_VAL
  36. #endif
  37. #ifdef PYPY_VERSION
  38. #define CYTHON_COMPILING_IN_PYPY 1
  39. #define CYTHON_COMPILING_IN_CPYTHON 0
  40. #else
  41. #define CYTHON_COMPILING_IN_PYPY 0
  42. #define CYTHON_COMPILING_IN_CPYTHON 1
  43. #endif
  44. #if !defined(CYTHON_USE_PYLONG_INTERNALS) && CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000
  45. #define CYTHON_USE_PYLONG_INTERNALS 1
  46. #endif
  47. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  48. #define Py_OptimizeFlag 0
  49. #endif
  50. #define __PYX_BUILD_PY_SSIZE_T "n"
  51. #define CYTHON_FORMAT_SSIZE_T "z"
  52. #if PY_MAJOR_VERSION < 3
  53. #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  54. #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  55. PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  56. #define __Pyx_DefaultClassType PyClass_Type
  57. #else
  58. #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  59. #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  60. PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  61. #define __Pyx_DefaultClassType PyType_Type
  62. #endif
  63. #ifndef Py_TPFLAGS_CHECKTYPES
  64. #define Py_TPFLAGS_CHECKTYPES 0
  65. #endif
  66. #ifndef Py_TPFLAGS_HAVE_INDEX
  67. #define Py_TPFLAGS_HAVE_INDEX 0
  68. #endif
  69. #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  70. #define Py_TPFLAGS_HAVE_NEWBUFFER 0
  71. #endif
  72. #ifndef Py_TPFLAGS_HAVE_FINALIZE
  73. #define Py_TPFLAGS_HAVE_FINALIZE 0
  74. #endif
  75. #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  76. #define CYTHON_PEP393_ENABLED 1
  77. #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
  78. 0 : _PyUnicode_Ready((PyObject *)(op)))
  79. #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
  80. #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  81. #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
  82. #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
  83. #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
  84. #else
  85. #define CYTHON_PEP393_ENABLED 0
  86. #define __Pyx_PyUnicode_READY(op) (0)
  87. #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
  88. #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  89. #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
  90. #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
  91. #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  92. #endif
  93. #if CYTHON_COMPILING_IN_PYPY
  94. #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
  95. #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
  96. #else
  97. #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
  98. #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
  99. PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
  100. #endif
  101. #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  102. #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
  103. #endif
  104. #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
  105. #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
  106. #if PY_MAJOR_VERSION >= 3
  107. #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
  108. #else
  109. #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
  110. #endif
  111. #if PY_MAJOR_VERSION >= 3
  112. #define PyBaseString_Type PyUnicode_Type
  113. #define PyStringObject PyUnicodeObject
  114. #define PyString_Type PyUnicode_Type
  115. #define PyString_Check PyUnicode_Check
  116. #define PyString_CheckExact PyUnicode_CheckExact
  117. #endif
  118. #if PY_MAJOR_VERSION >= 3
  119. #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  120. #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
  121. #else
  122. #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  123. #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
  124. #endif
  125. #ifndef PySet_CheckExact
  126. #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
  127. #endif
  128. #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
  129. #if PY_MAJOR_VERSION >= 3
  130. #define PyIntObject PyLongObject
  131. #define PyInt_Type PyLong_Type
  132. #define PyInt_Check(op) PyLong_Check(op)
  133. #define PyInt_CheckExact(op) PyLong_CheckExact(op)
  134. #define PyInt_FromString PyLong_FromString
  135. #define PyInt_FromUnicode PyLong_FromUnicode
  136. #define PyInt_FromLong PyLong_FromLong
  137. #define PyInt_FromSize_t PyLong_FromSize_t
  138. #define PyInt_FromSsize_t PyLong_FromSsize_t
  139. #define PyInt_AsLong PyLong_AsLong
  140. #define PyInt_AS_LONG PyLong_AS_LONG
  141. #define PyInt_AsSsize_t PyLong_AsSsize_t
  142. #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
  143. #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  144. #define PyNumber_Int PyNumber_Long
  145. #endif
  146. #if PY_MAJOR_VERSION >= 3
  147. #define PyBoolObject PyLongObject
  148. #endif
  149. #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  150. #ifndef PyUnicode_InternFromString
  151. #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  152. #endif
  153. #endif
  154. #if PY_VERSION_HEX < 0x030200A4
  155. typedef long Py_hash_t;
  156. #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  157. #define __Pyx_PyInt_AsHash_t PyInt_AsLong
  158. #else
  159. #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  160. #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
  161. #endif
  162. #if PY_MAJOR_VERSION >= 3
  163. #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
  164. #else
  165. #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
  166. #endif
  167. #if PY_VERSION_HEX >= 0x030500B1
  168. #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
  169. #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  170. #elif CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
  171. typedef struct {
  172. unaryfunc am_await;
  173. unaryfunc am_aiter;
  174. unaryfunc am_anext;
  175. } __Pyx_PyAsyncMethodsStruct;
  176. #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  177. #else
  178. #define __Pyx_PyType_AsAsync(obj) NULL
  179. #endif
  180. #ifndef CYTHON_RESTRICT
  181. #if defined(__GNUC__)
  182. #define CYTHON_RESTRICT __restrict__
  183. #elif defined(_MSC_VER) && _MSC_VER >= 1400
  184. #define CYTHON_RESTRICT __restrict
  185. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  186. #define CYTHON_RESTRICT restrict
  187. #else
  188. #define CYTHON_RESTRICT
  189. #endif
  190. #endif
  191. #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
  192. #ifndef __cplusplus
  193. #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
  194. #endif
  195. #ifndef CYTHON_INLINE
  196. #define CYTHON_INLINE inline
  197. #endif
  198. template<typename T>
  199. void __Pyx_call_destructor(T& x) {
  200. x.~T();
  201. }
  202. template<typename T>
  203. class __Pyx_FakeReference {
  204. public:
  205. __Pyx_FakeReference() : ptr(NULL) { }
  206. __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
  207. T *operator->() { return ptr; }
  208. operator T&() { return *ptr; }
  209. private:
  210. T *ptr;
  211. };
  212. #if defined(WIN32) || defined(MS_WINDOWS)
  213. #define _USE_MATH_DEFINES
  214. #endif
  215. #include <math.h>
  216. #ifdef NAN
  217. #define __PYX_NAN() ((float) NAN)
  218. #else
  219. static CYTHON_INLINE float __PYX_NAN() {
  220. float value;
  221. memset(&value, 0xFF, sizeof(value));
  222. return value;
  223. }
  224. #endif
  225. #if PY_MAJOR_VERSION >= 3
  226. #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
  227. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
  228. #else
  229. #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
  230. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
  231. #endif
  232. #ifndef __PYX_EXTERN_C
  233. #ifdef __cplusplus
  234. #define __PYX_EXTERN_C extern "C"
  235. #else
  236. #define __PYX_EXTERN_C extern
  237. #endif
  238. #endif
  239. #define __PYX_HAVE__scattnlay_mp
  240. #define __PYX_HAVE_API__scattnlay_mp
  241. #include "string.h"
  242. #include "stdio.h"
  243. #include "stdlib.h"
  244. #include "numpy/arrayobject.h"
  245. #include "numpy/ufuncobject.h"
  246. #include <vector>
  247. #include "ios"
  248. #include "new"
  249. #include "stdexcept"
  250. #include "typeinfo"
  251. #include "py_nmie.h"
  252. #ifdef _OPENMP
  253. #include <omp.h>
  254. #endif /* _OPENMP */
  255. #ifdef PYREX_WITHOUT_ASSERTIONS
  256. #define CYTHON_WITHOUT_ASSERTIONS
  257. #endif
  258. #ifndef CYTHON_UNUSED
  259. # if defined(__GNUC__)
  260. # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  261. # define CYTHON_UNUSED __attribute__ ((__unused__))
  262. # else
  263. # define CYTHON_UNUSED
  264. # endif
  265. # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
  266. # define CYTHON_UNUSED __attribute__ ((__unused__))
  267. # else
  268. # define CYTHON_UNUSED
  269. # endif
  270. #endif
  271. #ifndef CYTHON_NCP_UNUSED
  272. # if CYTHON_COMPILING_IN_CPYTHON
  273. # define CYTHON_NCP_UNUSED
  274. # else
  275. # define CYTHON_NCP_UNUSED CYTHON_UNUSED
  276. # endif
  277. #endif
  278. typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
  279. const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
  280. #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
  281. #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
  282. #define __PYX_DEFAULT_STRING_ENCODING ""
  283. #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
  284. #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  285. #define __Pyx_uchar_cast(c) ((unsigned char)c)
  286. #define __Pyx_long_cast(x) ((long)x)
  287. #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
  288. (sizeof(type) < sizeof(Py_ssize_t)) ||\
  289. (sizeof(type) > sizeof(Py_ssize_t) &&\
  290. likely(v < (type)PY_SSIZE_T_MAX ||\
  291. v == (type)PY_SSIZE_T_MAX) &&\
  292. (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
  293. v == (type)PY_SSIZE_T_MIN))) ||\
  294. (sizeof(type) == sizeof(Py_ssize_t) &&\
  295. (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
  296. v == (type)PY_SSIZE_T_MAX))) )
  297. #if defined (__cplusplus) && __cplusplus >= 201103L
  298. #include <cstdlib>
  299. #define __Pyx_sst_abs(value) std::abs(value)
  300. #elif SIZEOF_INT >= SIZEOF_SIZE_T
  301. #define __Pyx_sst_abs(value) abs(value)
  302. #elif SIZEOF_LONG >= SIZEOF_SIZE_T
  303. #define __Pyx_sst_abs(value) labs(value)
  304. #elif defined (_MSC_VER) && defined (_M_X64)
  305. #define __Pyx_sst_abs(value) _abs64(value)
  306. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  307. #define __Pyx_sst_abs(value) llabs(value)
  308. #elif defined (__GNUC__)
  309. #define __Pyx_sst_abs(value) __builtin_llabs(value)
  310. #else
  311. #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
  312. #endif
  313. static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
  314. static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
  315. #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
  316. #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
  317. #define __Pyx_PyBytes_FromString PyBytes_FromString
  318. #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
  319. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
  320. #if PY_MAJOR_VERSION < 3
  321. #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
  322. #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  323. #else
  324. #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
  325. #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
  326. #endif
  327. #define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
  328. #define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
  329. #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
  330. #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
  331. #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
  332. #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
  333. #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
  334. #if PY_MAJOR_VERSION < 3
  335. static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
  336. {
  337. const Py_UNICODE *u_end = u;
  338. while (*u_end++) ;
  339. return (size_t)(u_end - u - 1);
  340. }
  341. #else
  342. #define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
  343. #endif
  344. #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
  345. #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
  346. #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
  347. #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
  348. #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
  349. #define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
  350. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
  351. static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
  352. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
  353. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
  354. #if CYTHON_COMPILING_IN_CPYTHON
  355. #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
  356. #else
  357. #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
  358. #endif
  359. #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
  360. #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  361. static int __Pyx_sys_getdefaultencoding_not_ascii;
  362. static int __Pyx_init_sys_getdefaultencoding_params(void) {
  363. PyObject* sys;
  364. PyObject* default_encoding = NULL;
  365. PyObject* ascii_chars_u = NULL;
  366. PyObject* ascii_chars_b = NULL;
  367. const char* default_encoding_c;
  368. sys = PyImport_ImportModule("sys");
  369. if (!sys) goto bad;
  370. default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
  371. Py_DECREF(sys);
  372. if (!default_encoding) goto bad;
  373. default_encoding_c = PyBytes_AsString(default_encoding);
  374. if (!default_encoding_c) goto bad;
  375. if (strcmp(default_encoding_c, "ascii") == 0) {
  376. __Pyx_sys_getdefaultencoding_not_ascii = 0;
  377. } else {
  378. char ascii_chars[128];
  379. int c;
  380. for (c = 0; c < 128; c++) {
  381. ascii_chars[c] = c;
  382. }
  383. __Pyx_sys_getdefaultencoding_not_ascii = 1;
  384. ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
  385. if (!ascii_chars_u) goto bad;
  386. ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
  387. if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
  388. PyErr_Format(
  389. PyExc_ValueError,
  390. "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
  391. default_encoding_c);
  392. goto bad;
  393. }
  394. Py_DECREF(ascii_chars_u);
  395. Py_DECREF(ascii_chars_b);
  396. }
  397. Py_DECREF(default_encoding);
  398. return 0;
  399. bad:
  400. Py_XDECREF(default_encoding);
  401. Py_XDECREF(ascii_chars_u);
  402. Py_XDECREF(ascii_chars_b);
  403. return -1;
  404. }
  405. #endif
  406. #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
  407. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
  408. #else
  409. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
  410. #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  411. static char* __PYX_DEFAULT_STRING_ENCODING;
  412. static int __Pyx_init_sys_getdefaultencoding_params(void) {
  413. PyObject* sys;
  414. PyObject* default_encoding = NULL;
  415. char* default_encoding_c;
  416. sys = PyImport_ImportModule("sys");
  417. if (!sys) goto bad;
  418. default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
  419. Py_DECREF(sys);
  420. if (!default_encoding) goto bad;
  421. default_encoding_c = PyBytes_AsString(default_encoding);
  422. if (!default_encoding_c) goto bad;
  423. __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
  424. if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
  425. strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
  426. Py_DECREF(default_encoding);
  427. return 0;
  428. bad:
  429. Py_XDECREF(default_encoding);
  430. return -1;
  431. }
  432. #endif
  433. #endif
  434. /* Test for GCC > 2.95 */
  435. #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  436. #define likely(x) __builtin_expect(!!(x), 1)
  437. #define unlikely(x) __builtin_expect(!!(x), 0)
  438. #else /* !__GNUC__ or GCC < 2.95 */
  439. #define likely(x) (x)
  440. #define unlikely(x) (x)
  441. #endif /* __GNUC__ */
  442. static PyObject *__pyx_m;
  443. static PyObject *__pyx_d;
  444. static PyObject *__pyx_b;
  445. static PyObject *__pyx_empty_tuple;
  446. static PyObject *__pyx_empty_bytes;
  447. static int __pyx_lineno;
  448. static int __pyx_clineno = 0;
  449. static const char * __pyx_cfilenm= __FILE__;
  450. static const char *__pyx_filename;
  451. #if !defined(CYTHON_CCOMPLEX)
  452. #if defined(__cplusplus)
  453. #define CYTHON_CCOMPLEX 1
  454. #elif defined(_Complex_I)
  455. #define CYTHON_CCOMPLEX 1
  456. #else
  457. #define CYTHON_CCOMPLEX 0
  458. #endif
  459. #endif
  460. #if CYTHON_CCOMPLEX
  461. #ifdef __cplusplus
  462. #include <complex>
  463. #else
  464. #include <complex.h>
  465. #endif
  466. #endif
  467. #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
  468. #undef _Complex_I
  469. #define _Complex_I 1.0fj
  470. #endif
  471. static const char *__pyx_f[] = {
  472. "src/scattnlay_mp.pyx",
  473. "__init__.pxd",
  474. "stringsource",
  475. "type.pxd",
  476. };
  477. #define IS_UNSIGNED(type) (((type) -1) > 0)
  478. struct __Pyx_StructField_;
  479. #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
  480. typedef struct {
  481. const char* name;
  482. struct __Pyx_StructField_* fields;
  483. size_t size;
  484. size_t arraysize[8];
  485. int ndim;
  486. char typegroup;
  487. char is_unsigned;
  488. int flags;
  489. } __Pyx_TypeInfo;
  490. typedef struct __Pyx_StructField_ {
  491. __Pyx_TypeInfo* type;
  492. const char* name;
  493. size_t offset;
  494. } __Pyx_StructField;
  495. typedef struct {
  496. __Pyx_StructField* field;
  497. size_t parent_offset;
  498. } __Pyx_BufFmt_StackElem;
  499. typedef struct {
  500. __Pyx_StructField root;
  501. __Pyx_BufFmt_StackElem* head;
  502. size_t fmt_offset;
  503. size_t new_count, enc_count;
  504. size_t struct_alignment;
  505. int is_complex;
  506. char enc_type;
  507. char new_packmode;
  508. char enc_packmode;
  509. char is_valid_array;
  510. } __Pyx_BufFmt_Context;
  511. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":725
  512. * # in Cython to enable them only on the right systems.
  513. *
  514. * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<<
  515. * ctypedef npy_int16 int16_t
  516. * ctypedef npy_int32 int32_t
  517. */
  518. typedef npy_int8 __pyx_t_5numpy_int8_t;
  519. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":726
  520. *
  521. * ctypedef npy_int8 int8_t
  522. * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<<
  523. * ctypedef npy_int32 int32_t
  524. * ctypedef npy_int64 int64_t
  525. */
  526. typedef npy_int16 __pyx_t_5numpy_int16_t;
  527. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":727
  528. * ctypedef npy_int8 int8_t
  529. * ctypedef npy_int16 int16_t
  530. * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<<
  531. * ctypedef npy_int64 int64_t
  532. * #ctypedef npy_int96 int96_t
  533. */
  534. typedef npy_int32 __pyx_t_5numpy_int32_t;
  535. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":728
  536. * ctypedef npy_int16 int16_t
  537. * ctypedef npy_int32 int32_t
  538. * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<<
  539. * #ctypedef npy_int96 int96_t
  540. * #ctypedef npy_int128 int128_t
  541. */
  542. typedef npy_int64 __pyx_t_5numpy_int64_t;
  543. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":732
  544. * #ctypedef npy_int128 int128_t
  545. *
  546. * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<<
  547. * ctypedef npy_uint16 uint16_t
  548. * ctypedef npy_uint32 uint32_t
  549. */
  550. typedef npy_uint8 __pyx_t_5numpy_uint8_t;
  551. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":733
  552. *
  553. * ctypedef npy_uint8 uint8_t
  554. * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<<
  555. * ctypedef npy_uint32 uint32_t
  556. * ctypedef npy_uint64 uint64_t
  557. */
  558. typedef npy_uint16 __pyx_t_5numpy_uint16_t;
  559. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":734
  560. * ctypedef npy_uint8 uint8_t
  561. * ctypedef npy_uint16 uint16_t
  562. * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<<
  563. * ctypedef npy_uint64 uint64_t
  564. * #ctypedef npy_uint96 uint96_t
  565. */
  566. typedef npy_uint32 __pyx_t_5numpy_uint32_t;
  567. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":735
  568. * ctypedef npy_uint16 uint16_t
  569. * ctypedef npy_uint32 uint32_t
  570. * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<<
  571. * #ctypedef npy_uint96 uint96_t
  572. * #ctypedef npy_uint128 uint128_t
  573. */
  574. typedef npy_uint64 __pyx_t_5numpy_uint64_t;
  575. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":739
  576. * #ctypedef npy_uint128 uint128_t
  577. *
  578. * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<<
  579. * ctypedef npy_float64 float64_t
  580. * #ctypedef npy_float80 float80_t
  581. */
  582. typedef npy_float32 __pyx_t_5numpy_float32_t;
  583. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":740
  584. *
  585. * ctypedef npy_float32 float32_t
  586. * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<<
  587. * #ctypedef npy_float80 float80_t
  588. * #ctypedef npy_float128 float128_t
  589. */
  590. typedef npy_float64 __pyx_t_5numpy_float64_t;
  591. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":749
  592. * # The int types are mapped a bit surprising --
  593. * # numpy.int corresponds to 'l' and numpy.long to 'q'
  594. * ctypedef npy_long int_t # <<<<<<<<<<<<<<
  595. * ctypedef npy_longlong long_t
  596. * ctypedef npy_longlong longlong_t
  597. */
  598. typedef npy_long __pyx_t_5numpy_int_t;
  599. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":750
  600. * # numpy.int corresponds to 'l' and numpy.long to 'q'
  601. * ctypedef npy_long int_t
  602. * ctypedef npy_longlong long_t # <<<<<<<<<<<<<<
  603. * ctypedef npy_longlong longlong_t
  604. *
  605. */
  606. typedef npy_longlong __pyx_t_5numpy_long_t;
  607. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":751
  608. * ctypedef npy_long int_t
  609. * ctypedef npy_longlong long_t
  610. * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<<
  611. *
  612. * ctypedef npy_ulong uint_t
  613. */
  614. typedef npy_longlong __pyx_t_5numpy_longlong_t;
  615. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":753
  616. * ctypedef npy_longlong longlong_t
  617. *
  618. * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<<
  619. * ctypedef npy_ulonglong ulong_t
  620. * ctypedef npy_ulonglong ulonglong_t
  621. */
  622. typedef npy_ulong __pyx_t_5numpy_uint_t;
  623. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":754
  624. *
  625. * ctypedef npy_ulong uint_t
  626. * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<<
  627. * ctypedef npy_ulonglong ulonglong_t
  628. *
  629. */
  630. typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
  631. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":755
  632. * ctypedef npy_ulong uint_t
  633. * ctypedef npy_ulonglong ulong_t
  634. * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<<
  635. *
  636. * ctypedef npy_intp intp_t
  637. */
  638. typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
  639. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":757
  640. * ctypedef npy_ulonglong ulonglong_t
  641. *
  642. * ctypedef npy_intp intp_t # <<<<<<<<<<<<<<
  643. * ctypedef npy_uintp uintp_t
  644. *
  645. */
  646. typedef npy_intp __pyx_t_5numpy_intp_t;
  647. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":758
  648. *
  649. * ctypedef npy_intp intp_t
  650. * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<<
  651. *
  652. * ctypedef npy_double float_t
  653. */
  654. typedef npy_uintp __pyx_t_5numpy_uintp_t;
  655. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":760
  656. * ctypedef npy_uintp uintp_t
  657. *
  658. * ctypedef npy_double float_t # <<<<<<<<<<<<<<
  659. * ctypedef npy_double double_t
  660. * ctypedef npy_longdouble longdouble_t
  661. */
  662. typedef npy_double __pyx_t_5numpy_float_t;
  663. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":761
  664. *
  665. * ctypedef npy_double float_t
  666. * ctypedef npy_double double_t # <<<<<<<<<<<<<<
  667. * ctypedef npy_longdouble longdouble_t
  668. *
  669. */
  670. typedef npy_double __pyx_t_5numpy_double_t;
  671. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":762
  672. * ctypedef npy_double float_t
  673. * ctypedef npy_double double_t
  674. * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<<
  675. *
  676. * ctypedef npy_cfloat cfloat_t
  677. */
  678. typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
  679. #if CYTHON_CCOMPLEX
  680. #ifdef __cplusplus
  681. typedef ::std::complex< double > __pyx_t_double_complex;
  682. #else
  683. typedef double _Complex __pyx_t_double_complex;
  684. #endif
  685. #else
  686. typedef struct { double real, imag; } __pyx_t_double_complex;
  687. #endif
  688. #if CYTHON_CCOMPLEX
  689. #ifdef __cplusplus
  690. typedef ::std::complex< float > __pyx_t_float_complex;
  691. #else
  692. typedef float _Complex __pyx_t_float_complex;
  693. #endif
  694. #else
  695. typedef struct { float real, imag; } __pyx_t_float_complex;
  696. #endif
  697. /*--- Type declarations ---*/
  698. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":764
  699. * ctypedef npy_longdouble longdouble_t
  700. *
  701. * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<<
  702. * ctypedef npy_cdouble cdouble_t
  703. * ctypedef npy_clongdouble clongdouble_t
  704. */
  705. typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
  706. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":765
  707. *
  708. * ctypedef npy_cfloat cfloat_t
  709. * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<<
  710. * ctypedef npy_clongdouble clongdouble_t
  711. *
  712. */
  713. typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
  714. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":766
  715. * ctypedef npy_cfloat cfloat_t
  716. * ctypedef npy_cdouble cdouble_t
  717. * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<<
  718. *
  719. * ctypedef npy_cdouble complex_t
  720. */
  721. typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
  722. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":768
  723. * ctypedef npy_clongdouble clongdouble_t
  724. *
  725. * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<<
  726. *
  727. * cdef inline object PyArray_MultiIterNew1(a):
  728. */
  729. typedef npy_cdouble __pyx_t_5numpy_complex_t;
  730. /* --- Runtime support code (head) --- */
  731. #ifndef CYTHON_REFNANNY
  732. #define CYTHON_REFNANNY 0
  733. #endif
  734. #if CYTHON_REFNANNY
  735. typedef struct {
  736. void (*INCREF)(void*, PyObject*, int);
  737. void (*DECREF)(void*, PyObject*, int);
  738. void (*GOTREF)(void*, PyObject*, int);
  739. void (*GIVEREF)(void*, PyObject*, int);
  740. void* (*SetupContext)(const char*, int, const char*);
  741. void (*FinishContext)(void**);
  742. } __Pyx_RefNannyAPIStruct;
  743. static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  744. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  745. #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  746. #ifdef WITH_THREAD
  747. #define __Pyx_RefNannySetupContext(name, acquire_gil)\
  748. if (acquire_gil) {\
  749. PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
  750. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
  751. PyGILState_Release(__pyx_gilstate_save);\
  752. } else {\
  753. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
  754. }
  755. #else
  756. #define __Pyx_RefNannySetupContext(name, acquire_gil)\
  757. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
  758. #endif
  759. #define __Pyx_RefNannyFinishContext()\
  760. __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  761. #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  762. #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  763. #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  764. #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  765. #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  766. #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  767. #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  768. #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
  769. #else
  770. #define __Pyx_RefNannyDeclarations
  771. #define __Pyx_RefNannySetupContext(name, acquire_gil)
  772. #define __Pyx_RefNannyFinishContext()
  773. #define __Pyx_INCREF(r) Py_INCREF(r)
  774. #define __Pyx_DECREF(r) Py_DECREF(r)
  775. #define __Pyx_GOTREF(r)
  776. #define __Pyx_GIVEREF(r)
  777. #define __Pyx_XINCREF(r) Py_XINCREF(r)
  778. #define __Pyx_XDECREF(r) Py_XDECREF(r)
  779. #define __Pyx_XGOTREF(r)
  780. #define __Pyx_XGIVEREF(r)
  781. #endif
  782. #define __Pyx_XDECREF_SET(r, v) do {\
  783. PyObject *tmp = (PyObject *) r;\
  784. r = v; __Pyx_XDECREF(tmp);\
  785. } while (0)
  786. #define __Pyx_DECREF_SET(r, v) do {\
  787. PyObject *tmp = (PyObject *) r;\
  788. r = v; __Pyx_DECREF(tmp);\
  789. } while (0)
  790. #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
  791. #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
  792. #if CYTHON_COMPILING_IN_CPYTHON
  793. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
  794. PyTypeObject* tp = Py_TYPE(obj);
  795. if (likely(tp->tp_getattro))
  796. return tp->tp_getattro(obj, attr_name);
  797. #if PY_MAJOR_VERSION < 3
  798. if (likely(tp->tp_getattr))
  799. return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
  800. #endif
  801. return PyObject_GetAttr(obj, attr_name);
  802. }
  803. #else
  804. #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
  805. #endif
  806. static PyObject *__Pyx_GetBuiltinName(PyObject *name);
  807. static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
  808. #if CYTHON_COMPILING_IN_CPYTHON
  809. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
  810. #else
  811. #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
  812. #endif
  813. static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
  814. static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb);
  815. static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb);
  816. static void __Pyx_WriteUnraisable(const char *name, int clineno,
  817. int lineno, const char *filename,
  818. int full_traceback, int nogil);
  819. static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
  820. Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
  821. static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
  822. static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
  823. PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
  824. const char* function_name);
  825. static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
  826. const char *name, int exact);
  827. static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
  828. __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
  829. static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
  830. static void __Pyx_RaiseBufferFallbackError(void);
  831. #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
  832. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  833. __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
  834. (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
  835. __Pyx_GetItemInt_Generic(o, to_py_func(i))))
  836. #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
  837. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  838. __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
  839. (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
  840. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
  841. int wraparound, int boundscheck);
  842. #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
  843. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  844. __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
  845. (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
  846. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
  847. int wraparound, int boundscheck);
  848. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
  849. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
  850. int is_list, int wraparound, int boundscheck);
  851. static void __Pyx_RaiseBufferIndexError(int axis);
  852. #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
  853. #define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
  854. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  855. __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
  856. (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
  857. __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
  858. static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
  859. static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
  860. int is_list, int wraparound, int boundscheck);
  861. #if CYTHON_COMPILING_IN_CPYTHON
  862. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
  863. #endif
  864. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
  865. #if CYTHON_COMPILING_IN_CPYTHON
  866. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
  867. #else
  868. #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
  869. #endif
  870. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
  871. #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
  872. static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
  873. PyObject *value;
  874. value = PyDict_GetItemWithError(d, key);
  875. if (unlikely(!value)) {
  876. if (!PyErr_Occurred()) {
  877. PyObject* args = PyTuple_Pack(1, key);
  878. if (likely(args))
  879. PyErr_SetObject(PyExc_KeyError, args);
  880. Py_XDECREF(args);
  881. }
  882. return NULL;
  883. }
  884. Py_INCREF(value);
  885. return value;
  886. }
  887. #else
  888. #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
  889. #endif
  890. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
  891. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
  892. static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
  893. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
  894. typedef struct {
  895. int code_line;
  896. PyCodeObject* code_object;
  897. } __Pyx_CodeObjectCacheEntry;
  898. struct __Pyx_CodeObjectCache {
  899. int count;
  900. int max_count;
  901. __Pyx_CodeObjectCacheEntry* entries;
  902. };
  903. static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
  904. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
  905. static PyCodeObject *__pyx_find_code_object(int code_line);
  906. static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
  907. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  908. int py_line, const char *filename);
  909. typedef struct {
  910. Py_ssize_t shape, strides, suboffsets;
  911. } __Pyx_Buf_DimInfo;
  912. typedef struct {
  913. size_t refcount;
  914. Py_buffer pybuffer;
  915. } __Pyx_Buffer;
  916. typedef struct {
  917. __Pyx_Buffer *rcbuffer;
  918. char *data;
  919. __Pyx_Buf_DimInfo diminfo[8];
  920. } __Pyx_LocalBuf_ND;
  921. #if PY_MAJOR_VERSION < 3
  922. static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
  923. static void __Pyx_ReleaseBuffer(Py_buffer *view);
  924. #else
  925. #define __Pyx_GetBuffer PyObject_GetBuffer
  926. #define __Pyx_ReleaseBuffer PyBuffer_Release
  927. #endif
  928. static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0};
  929. static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1};
  930. static CYTHON_INLINE npy_long __Pyx_PyInt_As_npy_long(PyObject *);
  931. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value);
  932. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_long(npy_long value);
  933. static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
  934. static __pyx_t_double_complex __Pyx_PyComplex_As___pyx_t_double_complex(PyObject*);
  935. #if CYTHON_CCOMPLEX
  936. #ifdef __cplusplus
  937. #define __Pyx_CREAL(z) ((z).real())
  938. #define __Pyx_CIMAG(z) ((z).imag())
  939. #else
  940. #define __Pyx_CREAL(z) (__real__(z))
  941. #define __Pyx_CIMAG(z) (__imag__(z))
  942. #endif
  943. #else
  944. #define __Pyx_CREAL(z) ((z).real)
  945. #define __Pyx_CIMAG(z) ((z).imag)
  946. #endif
  947. #if (defined(_WIN32) || defined(__clang__)) && defined(__cplusplus) && CYTHON_CCOMPLEX
  948. #define __Pyx_SET_CREAL(z,x) ((z).real(x))
  949. #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
  950. #else
  951. #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
  952. #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
  953. #endif
  954. #if CYTHON_CCOMPLEX
  955. #define __Pyx_c_eq(a, b) ((a)==(b))
  956. #define __Pyx_c_sum(a, b) ((a)+(b))
  957. #define __Pyx_c_diff(a, b) ((a)-(b))
  958. #define __Pyx_c_prod(a, b) ((a)*(b))
  959. #define __Pyx_c_quot(a, b) ((a)/(b))
  960. #define __Pyx_c_neg(a) (-(a))
  961. #ifdef __cplusplus
  962. #define __Pyx_c_is_zero(z) ((z)==(double)0)
  963. #define __Pyx_c_conj(z) (::std::conj(z))
  964. #if 1
  965. #define __Pyx_c_abs(z) (::std::abs(z))
  966. #define __Pyx_c_pow(a, b) (::std::pow(a, b))
  967. #endif
  968. #else
  969. #define __Pyx_c_is_zero(z) ((z)==0)
  970. #define __Pyx_c_conj(z) (conj(z))
  971. #if 1
  972. #define __Pyx_c_abs(z) (cabs(z))
  973. #define __Pyx_c_pow(a, b) (cpow(a, b))
  974. #endif
  975. #endif
  976. #else
  977. static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex);
  978. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex);
  979. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex);
  980. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex);
  981. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex);
  982. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex);
  983. static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex);
  984. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex);
  985. #if 1
  986. static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);
  987. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex);
  988. #endif
  989. #endif
  990. static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
  991. #if CYTHON_CCOMPLEX
  992. #define __Pyx_c_eqf(a, b) ((a)==(b))
  993. #define __Pyx_c_sumf(a, b) ((a)+(b))
  994. #define __Pyx_c_difff(a, b) ((a)-(b))
  995. #define __Pyx_c_prodf(a, b) ((a)*(b))
  996. #define __Pyx_c_quotf(a, b) ((a)/(b))
  997. #define __Pyx_c_negf(a) (-(a))
  998. #ifdef __cplusplus
  999. #define __Pyx_c_is_zerof(z) ((z)==(float)0)
  1000. #define __Pyx_c_conjf(z) (::std::conj(z))
  1001. #if 1
  1002. #define __Pyx_c_absf(z) (::std::abs(z))
  1003. #define __Pyx_c_powf(a, b) (::std::pow(a, b))
  1004. #endif
  1005. #else
  1006. #define __Pyx_c_is_zerof(z) ((z)==0)
  1007. #define __Pyx_c_conjf(z) (conjf(z))
  1008. #if 1
  1009. #define __Pyx_c_absf(z) (cabsf(z))
  1010. #define __Pyx_c_powf(a, b) (cpowf(a, b))
  1011. #endif
  1012. #endif
  1013. #else
  1014. static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex);
  1015. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex);
  1016. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex);
  1017. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex);
  1018. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex);
  1019. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex);
  1020. static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex);
  1021. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex);
  1022. #if 1
  1023. static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);
  1024. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex);
  1025. #endif
  1026. #endif
  1027. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
  1028. static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
  1029. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);
  1030. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
  1031. static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
  1032. static int __Pyx_check_binary_version(void);
  1033. #if !defined(__Pyx_PyIdentifier_FromString)
  1034. #if PY_MAJOR_VERSION < 3
  1035. #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
  1036. #else
  1037. #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
  1038. #endif
  1039. #endif
  1040. static PyObject *__Pyx_ImportModule(const char *name);
  1041. static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);
  1042. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
  1043. /* Module declarations from 'cpython.buffer' */
  1044. /* Module declarations from 'libc.string' */
  1045. /* Module declarations from 'libc.stdio' */
  1046. /* Module declarations from '__builtin__' */
  1047. /* Module declarations from 'cpython.type' */
  1048. static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
  1049. /* Module declarations from 'cpython' */
  1050. /* Module declarations from 'cpython.object' */
  1051. /* Module declarations from 'cpython.ref' */
  1052. /* Module declarations from 'libc.stdlib' */
  1053. /* Module declarations from 'numpy' */
  1054. /* Module declarations from 'numpy' */
  1055. static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
  1056. static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
  1057. static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
  1058. static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
  1059. static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
  1060. static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
  1061. /* Module declarations from 'libcpp.vector' */
  1062. /* Module declarations from 'scattnlay_mp' */
  1063. static CYTHON_INLINE double *__pyx_f_12scattnlay_mp_npy2c(PyArrayObject *); /*proto*/
  1064. static std::vector<double> __pyx_convert_vector_from_py_double(PyObject *); /*proto*/
  1065. static std::vector<__pyx_t_double_complex> __pyx_convert_vector_from_py___pyx_t_double_complex(PyObject *); /*proto*/
  1066. static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t = { "float64_t", NULL, sizeof(__pyx_t_5numpy_float64_t), { 0 }, 0, 'R', 0, 0 };
  1067. static __Pyx_TypeInfo __Pyx_TypeInfo___pyx_t_double_complex = { "double complex", NULL, sizeof(__pyx_t_double_complex), { 0 }, 0, 'C', 0, 0 };
  1068. 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 };
  1069. #define __Pyx_MODULE_NAME "scattnlay_mp"
  1070. int __pyx_module_is_main_scattnlay_mp = 0;
  1071. /* Implementation of 'scattnlay_mp' */
  1072. static PyObject *__pyx_builtin_range;
  1073. static PyObject *__pyx_builtin_ValueError;
  1074. static PyObject *__pyx_builtin_RuntimeError;
  1075. static char __pyx_k_B[] = "B";
  1076. static char __pyx_k_C[] = "C";
  1077. static char __pyx_k_E[] = "E";
  1078. static char __pyx_k_H[] = "H";
  1079. static char __pyx_k_I[] = "I";
  1080. static char __pyx_k_L[] = "L";
  1081. static char __pyx_k_O[] = "O";
  1082. static char __pyx_k_Q[] = "Q";
  1083. static char __pyx_k_b[] = "b";
  1084. static char __pyx_k_d[] = "d";
  1085. static char __pyx_k_f[] = "f";
  1086. static char __pyx_k_g[] = "g";
  1087. static char __pyx_k_h[] = "h";
  1088. static char __pyx_k_i[] = "i";
  1089. static char __pyx_k_l[] = "l";
  1090. static char __pyx_k_m[] = "m";
  1091. static char __pyx_k_q[] = "q";
  1092. static char __pyx_k_x[] = "x";
  1093. static char __pyx_k_S1[] = "S1";
  1094. static char __pyx_k_S2[] = "S2";
  1095. static char __pyx_k_Zd[] = "Zd";
  1096. static char __pyx_k_Zf[] = "Zf";
  1097. static char __pyx_k_Zg[] = "Zg";
  1098. static char __pyx_k_an[] = "an";
  1099. static char __pyx_k_bn[] = "bn";
  1100. static char __pyx_k_np[] = "np";
  1101. static char __pyx_k_pl[] = "pl";
  1102. static char __pyx_k_Eix[] = "Eix";
  1103. static char __pyx_k_Eiy[] = "Eiy";
  1104. static char __pyx_k_Eiz[] = "Eiz";
  1105. static char __pyx_k_Erx[] = "Erx";
  1106. static char __pyx_k_Ery[] = "Ery";
  1107. static char __pyx_k_Erz[] = "Erz";
  1108. static char __pyx_k_Hix[] = "Hix";
  1109. static char __pyx_k_Hiy[] = "Hiy";
  1110. static char __pyx_k_Hiz[] = "Hiz";
  1111. static char __pyx_k_Hrx[] = "Hrx";
  1112. static char __pyx_k_Hry[] = "Hry";
  1113. static char __pyx_k_Hrz[] = "Hrz";
  1114. static char __pyx_k_Qbk[] = "Qbk";
  1115. static char __pyx_k_Qpr[] = "Qpr";
  1116. static char __pyx_k_S1i[] = "S1i";
  1117. static char __pyx_k_S1r[] = "S1r";
  1118. static char __pyx_k_S2i[] = "S2i";
  1119. static char __pyx_k_S2r[] = "S2r";
  1120. static char __pyx_k_ani[] = "ani";
  1121. static char __pyx_k_anr[] = "anr";
  1122. static char __pyx_k_bni[] = "bni";
  1123. static char __pyx_k_bnr[] = "bnr";
  1124. static char __pyx_k_int[] = "int";
  1125. static char __pyx_k_Qabs[] = "Qabs";
  1126. static char __pyx_k_Qext[] = "Qext";
  1127. static char __pyx_k_Qsca[] = "Qsca";
  1128. static char __pyx_k_copy[] = "copy";
  1129. static char __pyx_k_main[] = "__main__";
  1130. static char __pyx_k_nmax[] = "nmax";
  1131. static char __pyx_k_test[] = "__test__";
  1132. static char __pyx_k_dtype[] = "dtype";
  1133. static char __pyx_k_flags[] = "flags";
  1134. static char __pyx_k_numpy[] = "numpy";
  1135. static char __pyx_k_range[] = "range";
  1136. static char __pyx_k_terms[] = "terms";
  1137. static char __pyx_k_theta[] = "theta";
  1138. static char __pyx_k_zeros[] = "zeros";
  1139. static char __pyx_k_Albedo[] = "Albedo";
  1140. static char __pyx_k_coords[] = "coords";
  1141. static char __pyx_k_import[] = "__import__";
  1142. static char __pyx_k_vstack[] = "vstack";
  1143. static char __pyx_k_float64[] = "float64";
  1144. static char __pyx_k_fieldnlay[] = "fieldnlay";
  1145. static char __pyx_k_scattnlay[] = "scattnlay";
  1146. static char __pyx_k_transpose[] = "transpose";
  1147. static char __pyx_k_ValueError[] = "ValueError";
  1148. static char __pyx_k_complex128[] = "complex128";
  1149. static char __pyx_k_scattcoeffs[] = "scattcoeffs";
  1150. static char __pyx_k_C_CONTIGUOUS[] = "C_CONTIGUOUS";
  1151. static char __pyx_k_RuntimeError[] = "RuntimeError";
  1152. static char __pyx_k_scattnlay_mp[] = "scattnlay_mp";
  1153. static char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
  1154. static char __pyx_k_home_ovidio_scattering_scattnla[] = "/home/ovidio/scattering/scattnlay/python-scattnlay-2.1/src/scattnlay_mp.pyx";
  1155. static char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
  1156. static char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
  1157. static char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
  1158. static char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
  1159. static char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
  1160. static PyObject *__pyx_n_s_Albedo;
  1161. static PyObject *__pyx_n_s_C;
  1162. static PyObject *__pyx_n_s_C_CONTIGUOUS;
  1163. static PyObject *__pyx_n_s_E;
  1164. static PyObject *__pyx_n_s_Eix;
  1165. static PyObject *__pyx_n_s_Eiy;
  1166. static PyObject *__pyx_n_s_Eiz;
  1167. static PyObject *__pyx_n_s_Erx;
  1168. static PyObject *__pyx_n_s_Ery;
  1169. static PyObject *__pyx_n_s_Erz;
  1170. static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
  1171. static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
  1172. static PyObject *__pyx_n_s_H;
  1173. static PyObject *__pyx_n_s_Hix;
  1174. static PyObject *__pyx_n_s_Hiy;
  1175. static PyObject *__pyx_n_s_Hiz;
  1176. static PyObject *__pyx_n_s_Hrx;
  1177. static PyObject *__pyx_n_s_Hry;
  1178. static PyObject *__pyx_n_s_Hrz;
  1179. static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
  1180. static PyObject *__pyx_n_s_Qabs;
  1181. static PyObject *__pyx_n_s_Qbk;
  1182. static PyObject *__pyx_n_s_Qext;
  1183. static PyObject *__pyx_n_s_Qpr;
  1184. static PyObject *__pyx_n_s_Qsca;
  1185. static PyObject *__pyx_n_s_RuntimeError;
  1186. static PyObject *__pyx_n_s_S1;
  1187. static PyObject *__pyx_n_s_S1i;
  1188. static PyObject *__pyx_n_s_S1r;
  1189. static PyObject *__pyx_n_s_S2;
  1190. static PyObject *__pyx_n_s_S2i;
  1191. static PyObject *__pyx_n_s_S2r;
  1192. static PyObject *__pyx_n_s_ValueError;
  1193. static PyObject *__pyx_n_s_an;
  1194. static PyObject *__pyx_n_s_ani;
  1195. static PyObject *__pyx_n_s_anr;
  1196. static PyObject *__pyx_n_s_bn;
  1197. static PyObject *__pyx_n_s_bni;
  1198. static PyObject *__pyx_n_s_bnr;
  1199. static PyObject *__pyx_n_s_complex128;
  1200. static PyObject *__pyx_n_s_coords;
  1201. static PyObject *__pyx_n_s_copy;
  1202. static PyObject *__pyx_n_s_dtype;
  1203. static PyObject *__pyx_n_s_fieldnlay;
  1204. static PyObject *__pyx_n_s_flags;
  1205. static PyObject *__pyx_n_s_float64;
  1206. static PyObject *__pyx_n_s_g;
  1207. static PyObject *__pyx_kp_s_home_ovidio_scattering_scattnla;
  1208. static PyObject *__pyx_n_s_i;
  1209. static PyObject *__pyx_n_s_import;
  1210. static PyObject *__pyx_n_s_int;
  1211. static PyObject *__pyx_n_s_m;
  1212. static PyObject *__pyx_n_s_main;
  1213. static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
  1214. static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
  1215. static PyObject *__pyx_n_s_nmax;
  1216. static PyObject *__pyx_n_s_np;
  1217. static PyObject *__pyx_n_s_numpy;
  1218. static PyObject *__pyx_n_s_pl;
  1219. static PyObject *__pyx_n_s_range;
  1220. static PyObject *__pyx_n_s_scattcoeffs;
  1221. static PyObject *__pyx_n_s_scattnlay;
  1222. static PyObject *__pyx_n_s_scattnlay_mp;
  1223. static PyObject *__pyx_n_s_terms;
  1224. static PyObject *__pyx_n_s_test;
  1225. static PyObject *__pyx_n_s_theta;
  1226. static PyObject *__pyx_n_s_transpose;
  1227. static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
  1228. static PyObject *__pyx_n_s_vstack;
  1229. static PyObject *__pyx_n_s_x;
  1230. static PyObject *__pyx_n_s_zeros;
  1231. static PyObject *__pyx_pf_12scattnlay_mp_scattcoeffs(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_m, __pyx_t_5numpy_int_t __pyx_v_nmax, __pyx_t_5numpy_int_t __pyx_v_pl); /* proto */
  1232. static PyObject *__pyx_pf_12scattnlay_mp_2scattnlay(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_m, PyArrayObject *__pyx_v_theta, __pyx_t_5numpy_int_t __pyx_v_nmax, __pyx_t_5numpy_int_t __pyx_v_pl); /* proto */
  1233. static PyObject *__pyx_pf_12scattnlay_mp_4fieldnlay(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_m, PyArrayObject *__pyx_v_coords, __pyx_t_5numpy_int_t __pyx_v_nmax, __pyx_t_5numpy_int_t __pyx_v_pl); /* proto */
  1234. static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
  1235. static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
  1236. static PyObject *__pyx_int_0;
  1237. static PyObject *__pyx_int_1;
  1238. static PyObject *__pyx_int_2;
  1239. static PyObject *__pyx_int_3;
  1240. static PyArrayObject *__pyx_k__8;
  1241. static PyObject *__pyx_tuple_;
  1242. static PyObject *__pyx_tuple__2;
  1243. static PyObject *__pyx_tuple__3;
  1244. static PyObject *__pyx_tuple__4;
  1245. static PyObject *__pyx_tuple__5;
  1246. static PyObject *__pyx_tuple__6;
  1247. static PyObject *__pyx_tuple__7;
  1248. static PyObject *__pyx_tuple__9;
  1249. static PyObject *__pyx_slice__18;
  1250. static PyObject *__pyx_slice__21;
  1251. static PyObject *__pyx_slice__24;
  1252. static PyObject *__pyx_tuple__10;
  1253. static PyObject *__pyx_tuple__11;
  1254. static PyObject *__pyx_tuple__12;
  1255. static PyObject *__pyx_tuple__13;
  1256. static PyObject *__pyx_tuple__14;
  1257. static PyObject *__pyx_tuple__15;
  1258. static PyObject *__pyx_tuple__16;
  1259. static PyObject *__pyx_tuple__17;
  1260. static PyObject *__pyx_tuple__19;
  1261. static PyObject *__pyx_tuple__20;
  1262. static PyObject *__pyx_tuple__22;
  1263. static PyObject *__pyx_tuple__23;
  1264. static PyObject *__pyx_tuple__25;
  1265. static PyObject *__pyx_tuple__26;
  1266. static PyObject *__pyx_tuple__27;
  1267. static PyObject *__pyx_tuple__28;
  1268. static PyObject *__pyx_tuple__29;
  1269. static PyObject *__pyx_tuple__30;
  1270. static PyObject *__pyx_tuple__31;
  1271. static PyObject *__pyx_tuple__32;
  1272. static PyObject *__pyx_tuple__33;
  1273. static PyObject *__pyx_tuple__34;
  1274. static PyObject *__pyx_tuple__35;
  1275. static PyObject *__pyx_tuple__36;
  1276. static PyObject *__pyx_tuple__37;
  1277. static PyObject *__pyx_tuple__38;
  1278. static PyObject *__pyx_tuple__39;
  1279. static PyObject *__pyx_tuple__40;
  1280. static PyObject *__pyx_tuple__41;
  1281. static PyObject *__pyx_tuple__42;
  1282. static PyObject *__pyx_tuple__43;
  1283. static PyObject *__pyx_tuple__44;
  1284. static PyObject *__pyx_tuple__45;
  1285. static PyObject *__pyx_tuple__47;
  1286. static PyObject *__pyx_tuple__48;
  1287. static PyObject *__pyx_tuple__50;
  1288. static PyObject *__pyx_codeobj__46;
  1289. static PyObject *__pyx_codeobj__49;
  1290. static PyObject *__pyx_codeobj__51;
  1291. /* "scattnlay_mp.pyx":39
  1292. * from libcpp.vector cimport complex
  1293. *
  1294. * cdef inline double *npy2c(np.ndarray a): # <<<<<<<<<<<<<<
  1295. * assert a.dtype == np.float64
  1296. *
  1297. */
  1298. static CYTHON_INLINE double *__pyx_f_12scattnlay_mp_npy2c(PyArrayObject *__pyx_v_a) {
  1299. double *__pyx_r;
  1300. __Pyx_RefNannyDeclarations
  1301. PyObject *__pyx_t_1 = NULL;
  1302. PyObject *__pyx_t_2 = NULL;
  1303. PyObject *__pyx_t_3 = NULL;
  1304. int __pyx_t_4;
  1305. int __pyx_t_5;
  1306. int __pyx_lineno = 0;
  1307. const char *__pyx_filename = NULL;
  1308. int __pyx_clineno = 0;
  1309. __Pyx_RefNannySetupContext("npy2c", 0);
  1310. __Pyx_INCREF((PyObject *)__pyx_v_a);
  1311. /* "scattnlay_mp.pyx":40
  1312. *
  1313. * cdef inline double *npy2c(np.ndarray a):
  1314. * assert a.dtype == np.float64 # <<<<<<<<<<<<<<
  1315. *
  1316. * if not (<object>a).flags["C_CONTIGUOUS"]: # Array is not contiguous, need to make contiguous copy
  1317. */
  1318. #ifndef CYTHON_WITHOUT_ASSERTIONS
  1319. if (unlikely(!Py_OptimizeFlag)) {
  1320. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_a), __pyx_n_s_dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1321. __Pyx_GOTREF(__pyx_t_1);
  1322. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1323. __Pyx_GOTREF(__pyx_t_2);
  1324. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1325. __Pyx_GOTREF(__pyx_t_3);
  1326. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1327. __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1328. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1329. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1330. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1331. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1332. if (unlikely(!__pyx_t_4)) {
  1333. PyErr_SetNone(PyExc_AssertionError);
  1334. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1335. }
  1336. }
  1337. #endif
  1338. /* "scattnlay_mp.pyx":42
  1339. * assert a.dtype == np.float64
  1340. *
  1341. * if not (<object>a).flags["C_CONTIGUOUS"]: # Array is not contiguous, need to make contiguous copy # <<<<<<<<<<<<<<
  1342. * a = a.copy('C')
  1343. *
  1344. */
  1345. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_a), __pyx_n_s_flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1346. __Pyx_GOTREF(__pyx_t_2);
  1347. __pyx_t_3 = PyObject_GetItem(__pyx_t_2, __pyx_n_s_C_CONTIGUOUS); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  1348. __Pyx_GOTREF(__pyx_t_3);
  1349. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1350. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1351. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1352. __pyx_t_5 = ((!__pyx_t_4) != 0);
  1353. if (__pyx_t_5) {
  1354. /* "scattnlay_mp.pyx":43
  1355. *
  1356. * if not (<object>a).flags["C_CONTIGUOUS"]: # Array is not contiguous, need to make contiguous copy
  1357. * a = a.copy('C') # <<<<<<<<<<<<<<
  1358. *
  1359. * # Return data pointer
  1360. */
  1361. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_a), __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1362. __Pyx_GOTREF(__pyx_t_3);
  1363. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1364. __Pyx_GOTREF(__pyx_t_2);
  1365. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1366. if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1367. __Pyx_DECREF_SET(__pyx_v_a, ((PyArrayObject *)__pyx_t_2));
  1368. __pyx_t_2 = 0;
  1369. /* "scattnlay_mp.pyx":42
  1370. * assert a.dtype == np.float64
  1371. *
  1372. * if not (<object>a).flags["C_CONTIGUOUS"]: # Array is not contiguous, need to make contiguous copy # <<<<<<<<<<<<<<
  1373. * a = a.copy('C')
  1374. *
  1375. */
  1376. }
  1377. /* "scattnlay_mp.pyx":46
  1378. *
  1379. * # Return data pointer
  1380. * return <double *>(a.data) # <<<<<<<<<<<<<<
  1381. *
  1382. * cdef extern from "py_nmie.h":
  1383. */
  1384. __pyx_r = ((double *)__pyx_v_a->data);
  1385. goto __pyx_L0;
  1386. /* "scattnlay_mp.pyx":39
  1387. * from libcpp.vector cimport complex
  1388. *
  1389. * cdef inline double *npy2c(np.ndarray a): # <<<<<<<<<<<<<<
  1390. * assert a.dtype == np.float64
  1391. *
  1392. */
  1393. /* function exit code */
  1394. __pyx_L1_error:;
  1395. __Pyx_XDECREF(__pyx_t_1);
  1396. __Pyx_XDECREF(__pyx_t_2);
  1397. __Pyx_XDECREF(__pyx_t_3);
  1398. __Pyx_WriteUnraisable("scattnlay_mp.npy2c", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
  1399. __pyx_r = 0;
  1400. __pyx_L0:;
  1401. __Pyx_XDECREF((PyObject *)__pyx_v_a);
  1402. __Pyx_RefNannyFinishContext();
  1403. return __pyx_r;
  1404. }
  1405. /* "scattnlay_mp.pyx":53
  1406. * cdef int nField(int L, int pl, vector[double] x, vector[complex] m, int nmax, int nCoords, vector[double] Xp, vector[double] Yp, vector[double] Zp, double Erx[], double Ery[], double Erz[], double Eix[], double Eiy[], double Eiz[], double Hrx[], double Hry[], double Hrz[], double Hix[], double Hiy[], double Hiz[])
  1407. *
  1408. * def scattcoeffs(np.ndarray[np.float64_t, ndim = 2] x, np.ndarray[np.complex128_t, ndim = 2] m, np.int_t nmax, np.int_t pl = -1): # <<<<<<<<<<<<<<
  1409. * """
  1410. * scattcoeffs(x, m, nmax, pl)
  1411. */
  1412. /* Python wrapper */
  1413. static PyObject *__pyx_pw_12scattnlay_mp_1scattcoeffs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  1414. static char __pyx_doc_12scattnlay_mp_scattcoeffs[] = "\n scattcoeffs(x, m, nmax, pl)\n\n Calculate the scattering coefficients required to calculate both the\n near- and far-field parameters.\n\n x: size parameters (2D ndarray)\n m: relative refractive indices (2D ndarray)\n nmax: Maximum number of multipolar expansion terms to be used for the\n calculations. Only use it if you know what you are doing, otherwise\n set this parameter to -1 and the function will calculate it.\n pl: Index of PEC layer. If there is none just send -1\n\n Returns: (terms, an, bn)\n with\n terms: Number of multipolar expansion terms used for the calculations\n an, bn: complex scattering amplitudes\n ";
  1415. static PyMethodDef __pyx_mdef_12scattnlay_mp_1scattcoeffs = {"scattcoeffs", (PyCFunction)__pyx_pw_12scattnlay_mp_1scattcoeffs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12scattnlay_mp_scattcoeffs};
  1416. static PyObject *__pyx_pw_12scattnlay_mp_1scattcoeffs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  1417. PyArrayObject *__pyx_v_x = 0;
  1418. PyArrayObject *__pyx_v_m = 0;
  1419. __pyx_t_5numpy_int_t __pyx_v_nmax;
  1420. __pyx_t_5numpy_int_t __pyx_v_pl;
  1421. int __pyx_lineno = 0;
  1422. const char *__pyx_filename = NULL;
  1423. int __pyx_clineno = 0;
  1424. PyObject *__pyx_r = 0;
  1425. __Pyx_RefNannyDeclarations
  1426. __Pyx_RefNannySetupContext("scattcoeffs (wrapper)", 0);
  1427. {
  1428. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_m,&__pyx_n_s_nmax,&__pyx_n_s_pl,0};
  1429. PyObject* values[4] = {0,0,0,0};
  1430. if (unlikely(__pyx_kwds)) {
  1431. Py_ssize_t kw_args;
  1432. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  1433. switch (pos_args) {
  1434. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  1435. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  1436. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  1437. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  1438. case 0: break;
  1439. default: goto __pyx_L5_argtuple_error;
  1440. }
  1441. kw_args = PyDict_Size(__pyx_kwds);
  1442. switch (pos_args) {
  1443. case 0:
  1444. if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
  1445. else goto __pyx_L5_argtuple_error;
  1446. case 1:
  1447. if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_m)) != 0)) kw_args--;
  1448. else {
  1449. __Pyx_RaiseArgtupleInvalid("scattcoeffs", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1450. }
  1451. case 2:
  1452. if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nmax)) != 0)) kw_args--;
  1453. else {
  1454. __Pyx_RaiseArgtupleInvalid("scattcoeffs", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1455. }
  1456. case 3:
  1457. if (kw_args > 0) {
  1458. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pl);
  1459. if (value) { values[3] = value; kw_args--; }
  1460. }
  1461. }
  1462. if (unlikely(kw_args > 0)) {
  1463. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scattcoeffs") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1464. }
  1465. } else {
  1466. switch (PyTuple_GET_SIZE(__pyx_args)) {
  1467. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  1468. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  1469. values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  1470. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  1471. break;
  1472. default: goto __pyx_L5_argtuple_error;
  1473. }
  1474. }
  1475. __pyx_v_x = ((PyArrayObject *)values[0]);
  1476. __pyx_v_m = ((PyArrayObject *)values[1]);
  1477. __pyx_v_nmax = __Pyx_PyInt_As_npy_long(values[2]); if (unlikely((__pyx_v_nmax == (npy_long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1478. if (values[3]) {
  1479. __pyx_v_pl = __Pyx_PyInt_As_npy_long(values[3]); if (unlikely((__pyx_v_pl == (npy_long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1480. } else {
  1481. __pyx_v_pl = ((__pyx_t_5numpy_int_t)-1L);
  1482. }
  1483. }
  1484. goto __pyx_L4_argument_unpacking_done;
  1485. __pyx_L5_argtuple_error:;
  1486. __Pyx_RaiseArgtupleInvalid("scattcoeffs", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1487. __pyx_L3_error:;
  1488. __Pyx_AddTraceback("scattnlay_mp.scattcoeffs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  1489. __Pyx_RefNannyFinishContext();
  1490. return NULL;
  1491. __pyx_L4_argument_unpacking_done:;
  1492. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1493. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_m), __pyx_ptype_5numpy_ndarray, 1, "m", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1494. __pyx_r = __pyx_pf_12scattnlay_mp_scattcoeffs(__pyx_self, __pyx_v_x, __pyx_v_m, __pyx_v_nmax, __pyx_v_pl);
  1495. /* function exit code */
  1496. goto __pyx_L0;
  1497. __pyx_L1_error:;
  1498. __pyx_r = NULL;
  1499. __pyx_L0:;
  1500. __Pyx_RefNannyFinishContext();
  1501. return __pyx_r;
  1502. }
  1503. static PyObject *__pyx_pf_12scattnlay_mp_scattcoeffs(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_m, __pyx_t_5numpy_int_t __pyx_v_nmax, __pyx_t_5numpy_int_t __pyx_v_pl) {
  1504. Py_ssize_t __pyx_v_i;
  1505. PyArrayObject *__pyx_v_terms = 0;
  1506. PyArrayObject *__pyx_v_an = 0;
  1507. PyArrayObject *__pyx_v_bn = 0;
  1508. PyArrayObject *__pyx_v_anr = 0;
  1509. PyArrayObject *__pyx_v_ani = 0;
  1510. PyArrayObject *__pyx_v_bnr = 0;
  1511. PyArrayObject *__pyx_v_bni = 0;
  1512. __Pyx_LocalBuf_ND __pyx_pybuffernd_an;
  1513. __Pyx_Buffer __pyx_pybuffer_an;
  1514. __Pyx_LocalBuf_ND __pyx_pybuffernd_ani;
  1515. __Pyx_Buffer __pyx_pybuffer_ani;
  1516. __Pyx_LocalBuf_ND __pyx_pybuffernd_anr;
  1517. __Pyx_Buffer __pyx_pybuffer_anr;
  1518. __Pyx_LocalBuf_ND __pyx_pybuffernd_bn;
  1519. __Pyx_Buffer __pyx_pybuffer_bn;
  1520. __Pyx_LocalBuf_ND __pyx_pybuffernd_bni;
  1521. __Pyx_Buffer __pyx_pybuffer_bni;
  1522. __Pyx_LocalBuf_ND __pyx_pybuffernd_bnr;
  1523. __Pyx_Buffer __pyx_pybuffer_bnr;
  1524. __Pyx_LocalBuf_ND __pyx_pybuffernd_m;
  1525. __Pyx_Buffer __pyx_pybuffer_m;
  1526. __Pyx_LocalBuf_ND __pyx_pybuffernd_terms;
  1527. __Pyx_Buffer __pyx_pybuffer_terms;
  1528. __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
  1529. __Pyx_Buffer __pyx_pybuffer_x;
  1530. PyObject *__pyx_r = NULL;
  1531. __Pyx_RefNannyDeclarations
  1532. PyObject *__pyx_t_1 = NULL;
  1533. PyObject *__pyx_t_2 = NULL;
  1534. PyObject *__pyx_t_3 = NULL;
  1535. PyObject *__pyx_t_4 = NULL;
  1536. PyObject *__pyx_t_5 = NULL;
  1537. PyArrayObject *__pyx_t_6 = NULL;
  1538. PyArrayObject *__pyx_t_7 = NULL;
  1539. PyArrayObject *__pyx_t_8 = NULL;
  1540. npy_intp __pyx_t_9;
  1541. Py_ssize_t __pyx_t_10;
  1542. PyArrayObject *__pyx_t_11 = NULL;
  1543. int __pyx_t_12;
  1544. PyObject *__pyx_t_13 = NULL;
  1545. PyObject *__pyx_t_14 = NULL;
  1546. PyObject *__pyx_t_15 = NULL;
  1547. PyArrayObject *__pyx_t_16 = NULL;
  1548. PyArrayObject *__pyx_t_17 = NULL;
  1549. PyArrayObject *__pyx_t_18 = NULL;
  1550. std::vector<double> __pyx_t_19;
  1551. std::vector<__pyx_t_double_complex> __pyx_t_20;
  1552. Py_ssize_t __pyx_t_21;
  1553. int __pyx_lineno = 0;
  1554. const char *__pyx_filename = NULL;
  1555. int __pyx_clineno = 0;
  1556. __Pyx_RefNannySetupContext("scattcoeffs", 0);
  1557. __pyx_pybuffer_terms.pybuffer.buf = NULL;
  1558. __pyx_pybuffer_terms.refcount = 0;
  1559. __pyx_pybuffernd_terms.data = NULL;
  1560. __pyx_pybuffernd_terms.rcbuffer = &__pyx_pybuffer_terms;
  1561. __pyx_pybuffer_an.pybuffer.buf = NULL;
  1562. __pyx_pybuffer_an.refcount = 0;
  1563. __pyx_pybuffernd_an.data = NULL;
  1564. __pyx_pybuffernd_an.rcbuffer = &__pyx_pybuffer_an;
  1565. __pyx_pybuffer_bn.pybuffer.buf = NULL;
  1566. __pyx_pybuffer_bn.refcount = 0;
  1567. __pyx_pybuffernd_bn.data = NULL;
  1568. __pyx_pybuffernd_bn.rcbuffer = &__pyx_pybuffer_bn;
  1569. __pyx_pybuffer_anr.pybuffer.buf = NULL;
  1570. __pyx_pybuffer_anr.refcount = 0;
  1571. __pyx_pybuffernd_anr.data = NULL;
  1572. __pyx_pybuffernd_anr.rcbuffer = &__pyx_pybuffer_anr;
  1573. __pyx_pybuffer_ani.pybuffer.buf = NULL;
  1574. __pyx_pybuffer_ani.refcount = 0;
  1575. __pyx_pybuffernd_ani.data = NULL;
  1576. __pyx_pybuffernd_ani.rcbuffer = &__pyx_pybuffer_ani;
  1577. __pyx_pybuffer_bnr.pybuffer.buf = NULL;
  1578. __pyx_pybuffer_bnr.refcount = 0;
  1579. __pyx_pybuffernd_bnr.data = NULL;
  1580. __pyx_pybuffernd_bnr.rcbuffer = &__pyx_pybuffer_bnr;
  1581. __pyx_pybuffer_bni.pybuffer.buf = NULL;
  1582. __pyx_pybuffer_bni.refcount = 0;
  1583. __pyx_pybuffernd_bni.data = NULL;
  1584. __pyx_pybuffernd_bni.rcbuffer = &__pyx_pybuffer_bni;
  1585. __pyx_pybuffer_x.pybuffer.buf = NULL;
  1586. __pyx_pybuffer_x.refcount = 0;
  1587. __pyx_pybuffernd_x.data = NULL;
  1588. __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
  1589. __pyx_pybuffer_m.pybuffer.buf = NULL;
  1590. __pyx_pybuffer_m.refcount = 0;
  1591. __pyx_pybuffernd_m.data = NULL;
  1592. __pyx_pybuffernd_m.rcbuffer = &__pyx_pybuffer_m;
  1593. {
  1594. __Pyx_BufFmt_StackElem __pyx_stack[1];
  1595. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1596. }
  1597. __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1];
  1598. {
  1599. __Pyx_BufFmt_StackElem __pyx_stack[1];
  1600. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_m.rcbuffer->pybuffer, (PyObject*)__pyx_v_m, &__Pyx_TypeInfo___pyx_t_double_complex, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1601. }
  1602. __pyx_pybuffernd_m.diminfo[0].strides = __pyx_pybuffernd_m.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_m.diminfo[0].shape = __pyx_pybuffernd_m.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_m.diminfo[1].strides = __pyx_pybuffernd_m.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_m.diminfo[1].shape = __pyx_pybuffernd_m.rcbuffer->pybuffer.shape[1];
  1603. /* "scattnlay_mp.pyx":74
  1604. * cdef Py_ssize_t i
  1605. *
  1606. * cdef np.ndarray[np.int_t, ndim = 1] terms = np.zeros(x.shape[0], dtype = np.int) # <<<<<<<<<<<<<<
  1607. *
  1608. * cdef np.ndarray[np.complex128_t, ndim = 2] an = np.zeros((x.shape[0], nmax), dtype = np.complex128)
  1609. */
  1610. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1611. __Pyx_GOTREF(__pyx_t_1);
  1612. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1613. __Pyx_GOTREF(__pyx_t_2);
  1614. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1615. __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_x->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1616. __Pyx_GOTREF(__pyx_t_1);
  1617. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1618. __Pyx_GOTREF(__pyx_t_3);
  1619. __Pyx_GIVEREF(__pyx_t_1);
  1620. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  1621. __pyx_t_1 = 0;
  1622. __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1623. __Pyx_GOTREF(__pyx_t_1);
  1624. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1625. __Pyx_GOTREF(__pyx_t_4);
  1626. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1627. __Pyx_GOTREF(__pyx_t_5);
  1628. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1629. if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1630. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1631. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1632. __Pyx_GOTREF(__pyx_t_5);
  1633. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1634. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1635. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1636. if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1637. __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  1638. {
  1639. __Pyx_BufFmt_StackElem __pyx_stack[1];
  1640. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_terms.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
  1641. __pyx_v_terms = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_terms.rcbuffer->pybuffer.buf = NULL;
  1642. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1643. } else {__pyx_pybuffernd_terms.diminfo[0].strides = __pyx_pybuffernd_terms.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_terms.diminfo[0].shape = __pyx_pybuffernd_terms.rcbuffer->pybuffer.shape[0];
  1644. }
  1645. }
  1646. __pyx_t_6 = 0;
  1647. __pyx_v_terms = ((PyArrayObject *)__pyx_t_5);
  1648. __pyx_t_5 = 0;
  1649. /* "scattnlay_mp.pyx":76
  1650. * cdef np.ndarray[np.int_t, ndim = 1] terms = np.zeros(x.shape[0], dtype = np.int)
  1651. *
  1652. * cdef np.ndarray[np.complex128_t, ndim = 2] an = np.zeros((x.shape[0], nmax), dtype = np.complex128) # <<<<<<<<<<<<<<
  1653. * cdef np.ndarray[np.complex128_t, ndim = 2] bn = np.zeros((x.shape[0], nmax), dtype = np.complex128)
  1654. *
  1655. */
  1656. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1657. __Pyx_GOTREF(__pyx_t_5);
  1658. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1659. __Pyx_GOTREF(__pyx_t_1);
  1660. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1661. __pyx_t_5 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_x->dimensions[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1662. __Pyx_GOTREF(__pyx_t_5);
  1663. __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_nmax); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1664. __Pyx_GOTREF(__pyx_t_3);
  1665. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1666. __Pyx_GOTREF(__pyx_t_2);
  1667. __Pyx_GIVEREF(__pyx_t_5);
  1668. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
  1669. __Pyx_GIVEREF(__pyx_t_3);
  1670. PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  1671. __pyx_t_5 = 0;
  1672. __pyx_t_3 = 0;
  1673. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1674. __Pyx_GOTREF(__pyx_t_3);
  1675. __Pyx_GIVEREF(__pyx_t_2);
  1676. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  1677. __pyx_t_2 = 0;
  1678. __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1679. __Pyx_GOTREF(__pyx_t_2);
  1680. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1681. __Pyx_GOTREF(__pyx_t_5);
  1682. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_complex128); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1683. __Pyx_GOTREF(__pyx_t_4);
  1684. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1685. if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1686. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1687. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1688. __Pyx_GOTREF(__pyx_t_4);
  1689. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1690. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1691. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1692. if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1693. __pyx_t_7 = ((PyArrayObject *)__pyx_t_4);
  1694. {
  1695. __Pyx_BufFmt_StackElem __pyx_stack[1];
  1696. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_an.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo___pyx_t_double_complex, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
  1697. __pyx_v_an = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_an.rcbuffer->pybuffer.buf = NULL;
  1698. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1699. } else {__pyx_pybuffernd_an.diminfo[0].strides = __pyx_pybuffernd_an.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_an.diminfo[0].shape = __pyx_pybuffernd_an.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_an.diminfo[1].strides = __pyx_pybuffernd_an.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_an.diminfo[1].shape = __pyx_pybuffernd_an.rcbuffer->pybuffer.shape[1];
  1700. }
  1701. }
  1702. __pyx_t_7 = 0;
  1703. __pyx_v_an = ((PyArrayObject *)__pyx_t_4);
  1704. __pyx_t_4 = 0;
  1705. /* "scattnlay_mp.pyx":77
  1706. *
  1707. * cdef np.ndarray[np.complex128_t, ndim = 2] an = np.zeros((x.shape[0], nmax), dtype = np.complex128)
  1708. * cdef np.ndarray[np.complex128_t, ndim = 2] bn = np.zeros((x.shape[0], nmax), dtype = np.complex128) # <<<<<<<<<<<<<<
  1709. *
  1710. * cdef np.ndarray[np.float64_t, ndim = 1] anr
  1711. */
  1712. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1713. __Pyx_GOTREF(__pyx_t_4);
  1714. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1715. __Pyx_GOTREF(__pyx_t_2);
  1716. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1717. __pyx_t_4 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_x->dimensions[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1718. __Pyx_GOTREF(__pyx_t_4);
  1719. __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_nmax); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1720. __Pyx_GOTREF(__pyx_t_3);
  1721. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1722. __Pyx_GOTREF(__pyx_t_1);
  1723. __Pyx_GIVEREF(__pyx_t_4);
  1724. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
  1725. __Pyx_GIVEREF(__pyx_t_3);
  1726. PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  1727. __pyx_t_4 = 0;
  1728. __pyx_t_3 = 0;
  1729. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1730. __Pyx_GOTREF(__pyx_t_3);
  1731. __Pyx_GIVEREF(__pyx_t_1);
  1732. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  1733. __pyx_t_1 = 0;
  1734. __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1735. __Pyx_GOTREF(__pyx_t_1);
  1736. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1737. __Pyx_GOTREF(__pyx_t_4);
  1738. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_complex128); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1739. __Pyx_GOTREF(__pyx_t_5);
  1740. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1741. if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1742. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1743. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1744. __Pyx_GOTREF(__pyx_t_5);
  1745. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1746. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1747. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1748. if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1749. __pyx_t_8 = ((PyArrayObject *)__pyx_t_5);
  1750. {
  1751. __Pyx_BufFmt_StackElem __pyx_stack[1];
  1752. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bn.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo___pyx_t_double_complex, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
  1753. __pyx_v_bn = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_bn.rcbuffer->pybuffer.buf = NULL;
  1754. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1755. } else {__pyx_pybuffernd_bn.diminfo[0].strides = __pyx_pybuffernd_bn.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bn.diminfo[0].shape = __pyx_pybuffernd_bn.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_bn.diminfo[1].strides = __pyx_pybuffernd_bn.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_bn.diminfo[1].shape = __pyx_pybuffernd_bn.rcbuffer->pybuffer.shape[1];
  1756. }
  1757. }
  1758. __pyx_t_8 = 0;
  1759. __pyx_v_bn = ((PyArrayObject *)__pyx_t_5);
  1760. __pyx_t_5 = 0;
  1761. /* "scattnlay_mp.pyx":84
  1762. * cdef np.ndarray[np.float64_t, ndim = 1] bni
  1763. *
  1764. * for i in range(x.shape[0]): # <<<<<<<<<<<<<<
  1765. * anr = np.zeros(nmax, dtype = np.float64)
  1766. * ani = np.zeros(nmax, dtype = np.float64)
  1767. */
  1768. __pyx_t_9 = (__pyx_v_x->dimensions[0]);
  1769. for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
  1770. __pyx_v_i = __pyx_t_10;
  1771. /* "scattnlay_mp.pyx":85
  1772. *
  1773. * for i in range(x.shape[0]):
  1774. * anr = np.zeros(nmax, dtype = np.float64) # <<<<<<<<<<<<<<
  1775. * ani = np.zeros(nmax, dtype = np.float64)
  1776. * bnr = np.zeros(nmax, dtype = np.float64)
  1777. */
  1778. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1779. __Pyx_GOTREF(__pyx_t_5);
  1780. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1781. __Pyx_GOTREF(__pyx_t_1);
  1782. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1783. __pyx_t_5 = __Pyx_PyInt_From_npy_long(__pyx_v_nmax); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1784. __Pyx_GOTREF(__pyx_t_5);
  1785. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1786. __Pyx_GOTREF(__pyx_t_3);
  1787. __Pyx_GIVEREF(__pyx_t_5);
  1788. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  1789. __pyx_t_5 = 0;
  1790. __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1791. __Pyx_GOTREF(__pyx_t_5);
  1792. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1793. __Pyx_GOTREF(__pyx_t_2);
  1794. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1795. __Pyx_GOTREF(__pyx_t_4);
  1796. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1797. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1798. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1799. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1800. __Pyx_GOTREF(__pyx_t_4);
  1801. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1802. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1803. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1804. if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1805. __pyx_t_11 = ((PyArrayObject *)__pyx_t_4);
  1806. {
  1807. __Pyx_BufFmt_StackElem __pyx_stack[1];
  1808. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_anr.rcbuffer->pybuffer);
  1809. __pyx_t_12 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_anr.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
  1810. if (unlikely(__pyx_t_12 < 0)) {
  1811. PyErr_Fetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
  1812. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_anr.rcbuffer->pybuffer, (PyObject*)__pyx_v_anr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
  1813. Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15);
  1814. __Pyx_RaiseBufferFallbackError();
  1815. } else {
  1816. PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
  1817. }
  1818. }
  1819. __pyx_pybuffernd_anr.diminfo[0].strides = __pyx_pybuffernd_anr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_anr.diminfo[0].shape = __pyx_pybuffernd_anr.rcbuffer->pybuffer.shape[0];
  1820. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1821. }
  1822. __pyx_t_11 = 0;
  1823. __Pyx_XDECREF_SET(__pyx_v_anr, ((PyArrayObject *)__pyx_t_4));
  1824. __pyx_t_4 = 0;
  1825. /* "scattnlay_mp.pyx":86
  1826. * for i in range(x.shape[0]):
  1827. * anr = np.zeros(nmax, dtype = np.float64)
  1828. * ani = np.zeros(nmax, dtype = np.float64) # <<<<<<<<<<<<<<
  1829. * bnr = np.zeros(nmax, dtype = np.float64)
  1830. * bni = np.zeros(nmax, dtype = np.float64)
  1831. */
  1832. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1833. __Pyx_GOTREF(__pyx_t_4);
  1834. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1835. __Pyx_GOTREF(__pyx_t_5);
  1836. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1837. __pyx_t_4 = __Pyx_PyInt_From_npy_long(__pyx_v_nmax); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1838. __Pyx_GOTREF(__pyx_t_4);
  1839. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1840. __Pyx_GOTREF(__pyx_t_3);
  1841. __Pyx_GIVEREF(__pyx_t_4);
  1842. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  1843. __pyx_t_4 = 0;
  1844. __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1845. __Pyx_GOTREF(__pyx_t_4);
  1846. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1847. __Pyx_GOTREF(__pyx_t_1);
  1848. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1849. __Pyx_GOTREF(__pyx_t_2);
  1850. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1851. if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1852. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1853. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1854. __Pyx_GOTREF(__pyx_t_2);
  1855. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1856. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1857. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1858. if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1859. __pyx_t_16 = ((PyArrayObject *)__pyx_t_2);
  1860. {
  1861. __Pyx_BufFmt_StackElem __pyx_stack[1];
  1862. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ani.rcbuffer->pybuffer);
  1863. __pyx_t_12 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ani.rcbuffer->pybuffer, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
  1864. if (unlikely(__pyx_t_12 < 0)) {
  1865. PyErr_Fetch(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
  1866. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ani.rcbuffer->pybuffer, (PyObject*)__pyx_v_ani, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
  1867. Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13);
  1868. __Pyx_RaiseBufferFallbackError();
  1869. } else {
  1870. PyErr_Restore(__pyx_t_15, __pyx_t_14, __pyx_t_13);
  1871. }
  1872. }
  1873. __pyx_pybuffernd_ani.diminfo[0].strides = __pyx_pybuffernd_ani.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ani.diminfo[0].shape = __pyx_pybuffernd_ani.rcbuffer->pybuffer.shape[0];
  1874. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1875. }
  1876. __pyx_t_16 = 0;
  1877. __Pyx_XDECREF_SET(__pyx_v_ani, ((PyArrayObject *)__pyx_t_2));
  1878. __pyx_t_2 = 0;
  1879. /* "scattnlay_mp.pyx":87
  1880. * anr = np.zeros(nmax, dtype = np.float64)
  1881. * ani = np.zeros(nmax, dtype = np.float64)
  1882. * bnr = np.zeros(nmax, dtype = np.float64) # <<<<<<<<<<<<<<
  1883. * bni = np.zeros(nmax, dtype = np.float64)
  1884. *
  1885. */
  1886. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1887. __Pyx_GOTREF(__pyx_t_2);
  1888. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1889. __Pyx_GOTREF(__pyx_t_4);
  1890. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1891. __pyx_t_2 = __Pyx_PyInt_From_npy_long(__pyx_v_nmax); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1892. __Pyx_GOTREF(__pyx_t_2);
  1893. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1894. __Pyx_GOTREF(__pyx_t_3);
  1895. __Pyx_GIVEREF(__pyx_t_2);
  1896. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  1897. __pyx_t_2 = 0;
  1898. __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1899. __Pyx_GOTREF(__pyx_t_2);
  1900. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1901. __Pyx_GOTREF(__pyx_t_5);
  1902. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1903. __Pyx_GOTREF(__pyx_t_1);
  1904. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1905. if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1906. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1907. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1908. __Pyx_GOTREF(__pyx_t_1);
  1909. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1910. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1911. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1912. if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1913. __pyx_t_17 = ((PyArrayObject *)__pyx_t_1);
  1914. {
  1915. __Pyx_BufFmt_StackElem __pyx_stack[1];
  1916. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bnr.rcbuffer->pybuffer);
  1917. __pyx_t_12 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bnr.rcbuffer->pybuffer, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
  1918. if (unlikely(__pyx_t_12 < 0)) {
  1919. PyErr_Fetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
  1920. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bnr.rcbuffer->pybuffer, (PyObject*)__pyx_v_bnr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
  1921. Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15);
  1922. __Pyx_RaiseBufferFallbackError();
  1923. } else {
  1924. PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
  1925. }
  1926. }
  1927. __pyx_pybuffernd_bnr.diminfo[0].strides = __pyx_pybuffernd_bnr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bnr.diminfo[0].shape = __pyx_pybuffernd_bnr.rcbuffer->pybuffer.shape[0];
  1928. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1929. }
  1930. __pyx_t_17 = 0;
  1931. __Pyx_XDECREF_SET(__pyx_v_bnr, ((PyArrayObject *)__pyx_t_1));
  1932. __pyx_t_1 = 0;
  1933. /* "scattnlay_mp.pyx":88
  1934. * ani = np.zeros(nmax, dtype = np.float64)
  1935. * bnr = np.zeros(nmax, dtype = np.float64)
  1936. * bni = np.zeros(nmax, dtype = np.float64) # <<<<<<<<<<<<<<
  1937. *
  1938. * terms[i] = ScattCoeffs(x.shape[1], pl, x[i].copy('C'), m[i].copy('C'), nmax, npy2c(anr), npy2c(ani), npy2c(bnr), npy2c(bni))
  1939. */
  1940. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1941. __Pyx_GOTREF(__pyx_t_1);
  1942. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1943. __Pyx_GOTREF(__pyx_t_2);
  1944. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1945. __pyx_t_1 = __Pyx_PyInt_From_npy_long(__pyx_v_nmax); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1946. __Pyx_GOTREF(__pyx_t_1);
  1947. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1948. __Pyx_GOTREF(__pyx_t_3);
  1949. __Pyx_GIVEREF(__pyx_t_1);
  1950. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  1951. __pyx_t_1 = 0;
  1952. __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1953. __Pyx_GOTREF(__pyx_t_1);
  1954. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1955. __Pyx_GOTREF(__pyx_t_4);
  1956. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1957. __Pyx_GOTREF(__pyx_t_5);
  1958. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1959. if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1960. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1961. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1962. __Pyx_GOTREF(__pyx_t_5);
  1963. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1964. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1965. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1966. if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1967. __pyx_t_18 = ((PyArrayObject *)__pyx_t_5);
  1968. {
  1969. __Pyx_BufFmt_StackElem __pyx_stack[1];
  1970. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bni.rcbuffer->pybuffer);
  1971. __pyx_t_12 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bni.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
  1972. if (unlikely(__pyx_t_12 < 0)) {
  1973. PyErr_Fetch(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
  1974. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bni.rcbuffer->pybuffer, (PyObject*)__pyx_v_bni, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
  1975. Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13);
  1976. __Pyx_RaiseBufferFallbackError();
  1977. } else {
  1978. PyErr_Restore(__pyx_t_15, __pyx_t_14, __pyx_t_13);
  1979. }
  1980. }
  1981. __pyx_pybuffernd_bni.diminfo[0].strides = __pyx_pybuffernd_bni.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bni.diminfo[0].shape = __pyx_pybuffernd_bni.rcbuffer->pybuffer.shape[0];
  1982. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1983. }
  1984. __pyx_t_18 = 0;
  1985. __Pyx_XDECREF_SET(__pyx_v_bni, ((PyArrayObject *)__pyx_t_5));
  1986. __pyx_t_5 = 0;
  1987. /* "scattnlay_mp.pyx":90
  1988. * bni = np.zeros(nmax, dtype = np.float64)
  1989. *
  1990. * terms[i] = ScattCoeffs(x.shape[1], pl, x[i].copy('C'), m[i].copy('C'), nmax, npy2c(anr), npy2c(ani), npy2c(bnr), npy2c(bni)) # <<<<<<<<<<<<<<
  1991. *
  1992. * an[i] = anr.copy('C') + 1.0j*ani.copy('C')
  1993. */
  1994. __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_x), __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  1995. __Pyx_GOTREF(__pyx_t_5);
  1996. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1997. __Pyx_GOTREF(__pyx_t_1);
  1998. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1999. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2000. __Pyx_GOTREF(__pyx_t_5);
  2001. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2002. __pyx_t_19 = __pyx_convert_vector_from_py_double(__pyx_t_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2003. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2004. __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_m), __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  2005. __Pyx_GOTREF(__pyx_t_5);
  2006. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2007. __Pyx_GOTREF(__pyx_t_1);
  2008. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2009. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2010. __Pyx_GOTREF(__pyx_t_5);
  2011. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2012. __pyx_t_20 = __pyx_convert_vector_from_py___pyx_t_double_complex(__pyx_t_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2013. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2014. __pyx_t_21 = __pyx_v_i;
  2015. __pyx_t_12 = -1;
  2016. if (__pyx_t_21 < 0) {
  2017. __pyx_t_21 += __pyx_pybuffernd_terms.diminfo[0].shape;
  2018. if (unlikely(__pyx_t_21 < 0)) __pyx_t_12 = 0;
  2019. } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_terms.diminfo[0].shape)) __pyx_t_12 = 0;
  2020. if (unlikely(__pyx_t_12 != -1)) {
  2021. __Pyx_RaiseBufferIndexError(__pyx_t_12);
  2022. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2023. }
  2024. *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int_t *, __pyx_pybuffernd_terms.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_terms.diminfo[0].strides) = ScattCoeffs((__pyx_v_x->dimensions[1]), __pyx_v_pl, __pyx_t_19, __pyx_t_20, __pyx_v_nmax, __pyx_f_12scattnlay_mp_npy2c(((PyArrayObject *)__pyx_v_anr)), __pyx_f_12scattnlay_mp_npy2c(((PyArrayObject *)__pyx_v_ani)), __pyx_f_12scattnlay_mp_npy2c(((PyArrayObject *)__pyx_v_bnr)), __pyx_f_12scattnlay_mp_npy2c(((PyArrayObject *)__pyx_v_bni)));
  2025. /* "scattnlay_mp.pyx":92
  2026. * terms[i] = ScattCoeffs(x.shape[1], pl, x[i].copy('C'), m[i].copy('C'), nmax, npy2c(anr), npy2c(ani), npy2c(bnr), npy2c(bni))
  2027. *
  2028. * an[i] = anr.copy('C') + 1.0j*ani.copy('C') # <<<<<<<<<<<<<<
  2029. * bn[i] = bnr.copy('C') + 1.0j*bni.copy('C')
  2030. *
  2031. */
  2032. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_anr), __pyx_n_s_copy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2033. __Pyx_GOTREF(__pyx_t_5);
  2034. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2035. __Pyx_GOTREF(__pyx_t_1);
  2036. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2037. __pyx_t_5 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2038. __Pyx_GOTREF(__pyx_t_5);
  2039. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_ani), __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2040. __Pyx_GOTREF(__pyx_t_3);
  2041. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2042. __Pyx_GOTREF(__pyx_t_2);
  2043. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2044. __pyx_t_3 = PyNumber_Multiply(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2045. __Pyx_GOTREF(__pyx_t_3);
  2046. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2047. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2048. __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2049. __Pyx_GOTREF(__pyx_t_2);
  2050. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2051. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2052. if (unlikely(__Pyx_SetItemInt(((PyObject *)__pyx_v_an), __pyx_v_i, __pyx_t_2, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2053. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2054. /* "scattnlay_mp.pyx":93
  2055. *
  2056. * an[i] = anr.copy('C') + 1.0j*ani.copy('C')
  2057. * bn[i] = bnr.copy('C') + 1.0j*bni.copy('C') # <<<<<<<<<<<<<<
  2058. *
  2059. * return terms, an, bn
  2060. */
  2061. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_bnr), __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2062. __Pyx_GOTREF(__pyx_t_2);
  2063. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2064. __Pyx_GOTREF(__pyx_t_3);
  2065. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2066. __pyx_t_2 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2067. __Pyx_GOTREF(__pyx_t_2);
  2068. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_bni), __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2069. __Pyx_GOTREF(__pyx_t_1);
  2070. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2071. __Pyx_GOTREF(__pyx_t_5);
  2072. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2073. __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2074. __Pyx_GOTREF(__pyx_t_1);
  2075. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2076. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2077. __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2078. __Pyx_GOTREF(__pyx_t_5);
  2079. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2080. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2081. if (unlikely(__Pyx_SetItemInt(((PyObject *)__pyx_v_bn), __pyx_v_i, __pyx_t_5, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2082. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2083. }
  2084. /* "scattnlay_mp.pyx":95
  2085. * bn[i] = bnr.copy('C') + 1.0j*bni.copy('C')
  2086. *
  2087. * return terms, an, bn # <<<<<<<<<<<<<<
  2088. *
  2089. * def scattnlay(np.ndarray[np.float64_t, ndim = 2] x, np.ndarray[np.complex128_t, ndim = 2] m, np.ndarray[np.float64_t, ndim = 1] theta = np.zeros(0, dtype = np.float64), np.int_t nmax = -1, np.int_t pl = -1):
  2090. */
  2091. __Pyx_XDECREF(__pyx_r);
  2092. __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2093. __Pyx_GOTREF(__pyx_t_5);
  2094. __Pyx_INCREF(((PyObject *)__pyx_v_terms));
  2095. __Pyx_GIVEREF(((PyObject *)__pyx_v_terms));
  2096. PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_terms));
  2097. __Pyx_INCREF(((PyObject *)__pyx_v_an));
  2098. __Pyx_GIVEREF(((PyObject *)__pyx_v_an));
  2099. PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_an));
  2100. __Pyx_INCREF(((PyObject *)__pyx_v_bn));
  2101. __Pyx_GIVEREF(((PyObject *)__pyx_v_bn));
  2102. PyTuple_SET_ITEM(__pyx_t_5, 2, ((PyObject *)__pyx_v_bn));
  2103. __pyx_r = __pyx_t_5;
  2104. __pyx_t_5 = 0;
  2105. goto __pyx_L0;
  2106. /* "scattnlay_mp.pyx":53
  2107. * cdef int nField(int L, int pl, vector[double] x, vector[complex] m, int nmax, int nCoords, vector[double] Xp, vector[double] Yp, vector[double] Zp, double Erx[], double Ery[], double Erz[], double Eix[], double Eiy[], double Eiz[], double Hrx[], double Hry[], double Hrz[], double Hix[], double Hiy[], double Hiz[])
  2108. *
  2109. * def scattcoeffs(np.ndarray[np.float64_t, ndim = 2] x, np.ndarray[np.complex128_t, ndim = 2] m, np.int_t nmax, np.int_t pl = -1): # <<<<<<<<<<<<<<
  2110. * """
  2111. * scattcoeffs(x, m, nmax, pl)
  2112. */
  2113. /* function exit code */
  2114. __pyx_L1_error:;
  2115. __Pyx_XDECREF(__pyx_t_1);
  2116. __Pyx_XDECREF(__pyx_t_2);
  2117. __Pyx_XDECREF(__pyx_t_3);
  2118. __Pyx_XDECREF(__pyx_t_4);
  2119. __Pyx_XDECREF(__pyx_t_5);
  2120. { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
  2121. __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
  2122. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_an.rcbuffer->pybuffer);
  2123. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ani.rcbuffer->pybuffer);
  2124. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_anr.rcbuffer->pybuffer);
  2125. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bn.rcbuffer->pybuffer);
  2126. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bni.rcbuffer->pybuffer);
  2127. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bnr.rcbuffer->pybuffer);
  2128. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_m.rcbuffer->pybuffer);
  2129. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_terms.rcbuffer->pybuffer);
  2130. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
  2131. __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  2132. __Pyx_AddTraceback("scattnlay_mp.scattcoeffs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2133. __pyx_r = NULL;
  2134. goto __pyx_L2;
  2135. __pyx_L0:;
  2136. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_an.rcbuffer->pybuffer);
  2137. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ani.rcbuffer->pybuffer);
  2138. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_anr.rcbuffer->pybuffer);
  2139. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bn.rcbuffer->pybuffer);
  2140. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bni.rcbuffer->pybuffer);
  2141. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bnr.rcbuffer->pybuffer);
  2142. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_m.rcbuffer->pybuffer);
  2143. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_terms.rcbuffer->pybuffer);
  2144. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
  2145. __pyx_L2:;
  2146. __Pyx_XDECREF((PyObject *)__pyx_v_terms);
  2147. __Pyx_XDECREF((PyObject *)__pyx_v_an);
  2148. __Pyx_XDECREF((PyObject *)__pyx_v_bn);
  2149. __Pyx_XDECREF((PyObject *)__pyx_v_anr);
  2150. __Pyx_XDECREF((PyObject *)__pyx_v_ani);
  2151. __Pyx_XDECREF((PyObject *)__pyx_v_bnr);
  2152. __Pyx_XDECREF((PyObject *)__pyx_v_bni);
  2153. __Pyx_XGIVEREF(__pyx_r);
  2154. __Pyx_RefNannyFinishContext();
  2155. return __pyx_r;
  2156. }
  2157. /* "scattnlay_mp.pyx":97
  2158. * return terms, an, bn
  2159. *
  2160. * def scattnlay(np.ndarray[np.float64_t, ndim = 2] x, np.ndarray[np.complex128_t, ndim = 2] m, np.ndarray[np.float64_t, ndim = 1] theta = np.zeros(0, dtype = np.float64), np.int_t nmax = -1, np.int_t pl = -1): # <<<<<<<<<<<<<<
  2161. * """
  2162. * scattnlay(x, m, [theta, nmax, pl])
  2163. */
  2164. /* Python wrapper */
  2165. static PyObject *__pyx_pw_12scattnlay_mp_3scattnlay(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  2166. static char __pyx_doc_12scattnlay_mp_2scattnlay[] = "\n scattnlay(x, m, [theta, nmax, pl])\n\n Calculate the actual scattering parameters and amplitudes.\n\n x: size parameters (2D ndarray)\n m: relative refractive indices (2D ndarray)\n theta: scattering angles where the scattering amplitudes will be\n calculated (optional, 1D ndarray)\n nmax: Maximum number of multipolar expansion terms to be used for the\n calculations. Only use it if you know what you are doing.\n pl: Index of PEC layer.\n\n Returns: (terms, Qext, Qsca, Qabs, Qbk, Qpr, g, Albedo, S1, S2)\n with\n terms: Number of multipolar expansion terms used for the calculations\n Qext: Efficiency factor for extinction\n Qsca: Efficiency factor for scattering\n Qabs: Efficiency factor for absorption (Qabs = Qext - Qsca)\n Qbk: Efficiency factor for backscattering\n Qpr: Efficiency factor for the radiation pressure\n g: Asymmetry factor (g = (Qext-Qpr)/Qsca)\n Albedo: Single scattering albedo (Albedo = Qsca/Qext)\n S1, S2: Complex scattering amplitudes\n ";
  2167. static PyMethodDef __pyx_mdef_12scattnlay_mp_3scattnlay = {"scattnlay", (PyCFunction)__pyx_pw_12scattnlay_mp_3scattnlay, METH_VARARGS|METH_KEYWORDS, __pyx_doc_12scattnlay_mp_2scattnlay};
  2168. static PyObject *__pyx_pw_12scattnlay_mp_3scattnlay(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  2169. PyArrayObject *__pyx_v_x = 0;
  2170. PyArrayObject *__pyx_v_m = 0;
  2171. PyArrayObject *__pyx_v_theta = 0;
  2172. __pyx_t_5numpy_int_t __pyx_v_nmax;
  2173. __pyx_t_5numpy_int_t __pyx_v_pl;
  2174. int __pyx_lineno = 0;
  2175. const char *__pyx_filename = NULL;
  2176. int __pyx_clineno = 0;
  2177. PyObject *__pyx_r = 0;
  2178. __Pyx_RefNannyDeclarations
  2179. __Pyx_RefNannySetupContext("scattnlay (wrapper)", 0);
  2180. {
  2181. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_m,&__pyx_n_s_theta,&__pyx_n_s_nmax,&__pyx_n_s_pl,0};
  2182. PyObject* values[5] = {0,0,0,0,0};
  2183. values[2] = (PyObject *)__pyx_k__8;
  2184. if (unlikely(__pyx_kwds)) {
  2185. Py_ssize_t kw_args;
  2186. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  2187. switch (pos_args) {
  2188. case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
  2189. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  2190. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  2191. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  2192. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  2193. case 0: break;
  2194. default: goto __pyx_L5_argtuple_error;
  2195. }
  2196. kw_args = PyDict_Size(__pyx_kwds);
  2197. switch (pos_args) {
  2198. case 0:
  2199. if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
  2200. else goto __pyx_L5_argtuple_error;
  2201. case 1:
  2202. if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_m)) != 0)) kw_args--;
  2203. else {
  2204. __Pyx_RaiseArgtupleInvalid("scattnlay", 0, 2, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2205. }
  2206. case 2:
  2207. if (kw_args > 0) {
  2208. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_theta);
  2209. if (value) { values[2] = value; kw_args--; }
  2210. }
  2211. case 3:
  2212. if (kw_args > 0) {
  2213. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nmax);
  2214. if (value) { values[3] = value; kw_args--; }
  2215. }
  2216. case 4:
  2217. if (kw_args > 0) {
  2218. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pl);
  2219. if (value) { values[4] = value; kw_args--; }
  2220. }
  2221. }
  2222. if (unlikely(kw_args > 0)) {
  2223. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scattnlay") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2224. }
  2225. } else {
  2226. switch (PyTuple_GET_SIZE(__pyx_args)) {
  2227. case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
  2228. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  2229. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  2230. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  2231. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  2232. break;
  2233. default: goto __pyx_L5_argtuple_error;
  2234. }
  2235. }
  2236. __pyx_v_x = ((PyArrayObject *)values[0]);
  2237. __pyx_v_m = ((PyArrayObject *)values[1]);
  2238. __pyx_v_theta = ((PyArrayObject *)values[2]);
  2239. if (values[3]) {
  2240. __pyx_v_nmax = __Pyx_PyInt_As_npy_long(values[3]); if (unlikely((__pyx_v_nmax == (npy_long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2241. } else {
  2242. __pyx_v_nmax = ((__pyx_t_5numpy_int_t)-1L);
  2243. }
  2244. if (values[4]) {
  2245. __pyx_v_pl = __Pyx_PyInt_As_npy_long(values[4]); if (unlikely((__pyx_v_pl == (npy_long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2246. } else {
  2247. __pyx_v_pl = ((__pyx_t_5numpy_int_t)-1L);
  2248. }
  2249. }
  2250. goto __pyx_L4_argument_unpacking_done;
  2251. __pyx_L5_argtuple_error:;
  2252. __Pyx_RaiseArgtupleInvalid("scattnlay", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2253. __pyx_L3_error:;
  2254. __Pyx_AddTraceback("scattnlay_mp.scattnlay", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2255. __Pyx_RefNannyFinishContext();
  2256. return NULL;
  2257. __pyx_L4_argument_unpacking_done:;
  2258. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2259. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_m), __pyx_ptype_5numpy_ndarray, 1, "m", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2260. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_theta), __pyx_ptype_5numpy_ndarray, 1, "theta", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2261. __pyx_r = __pyx_pf_12scattnlay_mp_2scattnlay(__pyx_self, __pyx_v_x, __pyx_v_m, __pyx_v_theta, __pyx_v_nmax, __pyx_v_pl);
  2262. /* function exit code */
  2263. goto __pyx_L0;
  2264. __pyx_L1_error:;
  2265. __pyx_r = NULL;
  2266. __pyx_L0:;
  2267. __Pyx_RefNannyFinishContext();
  2268. return __pyx_r;
  2269. }
  2270. static PyObject *__pyx_pf_12scattnlay_mp_2scattnlay(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_m, PyArrayObject *__pyx_v_theta, __pyx_t_5numpy_int_t __pyx_v_nmax, __pyx_t_5numpy_int_t __pyx_v_pl) {
  2271. Py_ssize_t __pyx_v_i;
  2272. PyArrayObject *__pyx_v_terms = 0;
  2273. PyArrayObject *__pyx_v_Qext = 0;
  2274. PyArrayObject *__pyx_v_Qabs = 0;
  2275. PyArrayObject *__pyx_v_Qsca = 0;
  2276. PyArrayObject *__pyx_v_Qbk = 0;
  2277. PyArrayObject *__pyx_v_Qpr = 0;
  2278. PyArrayObject *__pyx_v_g = 0;
  2279. PyArrayObject *__pyx_v_Albedo = 0;
  2280. PyArrayObject *__pyx_v_S1 = 0;
  2281. PyArrayObject *__pyx_v_S2 = 0;
  2282. PyArrayObject *__pyx_v_S1r = 0;
  2283. PyArrayObject *__pyx_v_S1i = 0;
  2284. PyArrayObject *__pyx_v_S2r = 0;
  2285. PyArrayObject *__pyx_v_S2i = 0;
  2286. __Pyx_LocalBuf_ND __pyx_pybuffernd_Albedo;
  2287. __Pyx_Buffer __pyx_pybuffer_Albedo;
  2288. __Pyx_LocalBuf_ND __pyx_pybuffernd_Qabs;
  2289. __Pyx_Buffer __pyx_pybuffer_Qabs;
  2290. __Pyx_LocalBuf_ND __pyx_pybuffernd_Qbk;
  2291. __Pyx_Buffer __pyx_pybuffer_Qbk;
  2292. __Pyx_LocalBuf_ND __pyx_pybuffernd_Qext;
  2293. __Pyx_Buffer __pyx_pybuffer_Qext;
  2294. __Pyx_LocalBuf_ND __pyx_pybuffernd_Qpr;
  2295. __Pyx_Buffer __pyx_pybuffer_Qpr;
  2296. __Pyx_LocalBuf_ND __pyx_pybuffernd_Qsca;
  2297. __Pyx_Buffer __pyx_pybuffer_Qsca;
  2298. __Pyx_LocalBuf_ND __pyx_pybuffernd_S1;
  2299. __Pyx_Buffer __pyx_pybuffer_S1;
  2300. __Pyx_LocalBuf_ND __pyx_pybuffernd_S1i;
  2301. __Pyx_Buffer __pyx_pybuffer_S1i;
  2302. __Pyx_LocalBuf_ND __pyx_pybuffernd_S1r;
  2303. __Pyx_Buffer __pyx_pybuffer_S1r;
  2304. __Pyx_LocalBuf_ND __pyx_pybuffernd_S2;
  2305. __Pyx_Buffer __pyx_pybuffer_S2;
  2306. __Pyx_LocalBuf_ND __pyx_pybuffernd_S2i;
  2307. __Pyx_Buffer __pyx_pybuffer_S2i;
  2308. __Pyx_LocalBuf_ND __pyx_pybuffernd_S2r;
  2309. __Pyx_Buffer __pyx_pybuffer_S2r;
  2310. __Pyx_LocalBuf_ND __pyx_pybuffernd_g;
  2311. __Pyx_Buffer __pyx_pybuffer_g;
  2312. __Pyx_LocalBuf_ND __pyx_pybuffernd_m;
  2313. __Pyx_Buffer __pyx_pybuffer_m;
  2314. __Pyx_LocalBuf_ND __pyx_pybuffernd_terms;
  2315. __Pyx_Buffer __pyx_pybuffer_terms;
  2316. __Pyx_LocalBuf_ND __pyx_pybuffernd_theta;
  2317. __Pyx_Buffer __pyx_pybuffer_theta;
  2318. __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
  2319. __Pyx_Buffer __pyx_pybuffer_x;
  2320. PyObject *__pyx_r = NULL;
  2321. __Pyx_RefNannyDeclarations
  2322. PyObject *__pyx_t_1 = NULL;
  2323. PyObject *__pyx_t_2 = NULL;
  2324. PyObject *__pyx_t_3 = NULL;
  2325. PyObject *__pyx_t_4 = NULL;
  2326. PyObject *__pyx_t_5 = NULL;
  2327. PyArrayObject *__pyx_t_6 = NULL;
  2328. PyArrayObject *__pyx_t_7 = NULL;
  2329. PyArrayObject *__pyx_t_8 = NULL;
  2330. PyArrayObject *__pyx_t_9 = NULL;
  2331. PyArrayObject *__pyx_t_10 = NULL;
  2332. PyArrayObject *__pyx_t_11 = NULL;
  2333. PyArrayObject *__pyx_t_12 = NULL;
  2334. PyArrayObject *__pyx_t_13 = NULL;
  2335. PyArrayObject *__pyx_t_14 = NULL;
  2336. PyArrayObject *__pyx_t_15 = NULL;
  2337. npy_intp __pyx_t_16;
  2338. Py_ssize_t __pyx_t_17;
  2339. PyArrayObject *__pyx_t_18 = NULL;
  2340. int __pyx_t_19;
  2341. PyObject *__pyx_t_20 = NULL;
  2342. PyObject *__pyx_t_21 = NULL;
  2343. PyObject *__pyx_t_22 = NULL;
  2344. PyArrayObject *__pyx_t_23 = NULL;
  2345. PyArrayObject *__pyx_t_24 = NULL;
  2346. PyArrayObject *__pyx_t_25 = NULL;
  2347. std::vector<double> __pyx_t_26;
  2348. std::vector<__pyx_t_double_complex> __pyx_t_27;
  2349. std::vector<double> __pyx_t_28;
  2350. Py_ssize_t __pyx_t_29;
  2351. Py_ssize_t __pyx_t_30;
  2352. Py_ssize_t __pyx_t_31;
  2353. Py_ssize_t __pyx_t_32;
  2354. Py_ssize_t __pyx_t_33;
  2355. Py_ssize_t __pyx_t_34;
  2356. Py_ssize_t __pyx_t_35;
  2357. Py_ssize_t __pyx_t_36;
  2358. int __pyx_lineno = 0;
  2359. const char *__pyx_filename = NULL;
  2360. int __pyx_clineno = 0;
  2361. __Pyx_RefNannySetupContext("scattnlay", 0);
  2362. __pyx_pybuffer_terms.pybuffer.buf = NULL;
  2363. __pyx_pybuffer_terms.refcount = 0;
  2364. __pyx_pybuffernd_terms.data = NULL;
  2365. __pyx_pybuffernd_terms.rcbuffer = &__pyx_pybuffer_terms;
  2366. __pyx_pybuffer_Qext.pybuffer.buf = NULL;
  2367. __pyx_pybuffer_Qext.refcount = 0;
  2368. __pyx_pybuffernd_Qext.data = NULL;
  2369. __pyx_pybuffernd_Qext.rcbuffer = &__pyx_pybuffer_Qext;
  2370. __pyx_pybuffer_Qabs.pybuffer.buf = NULL;
  2371. __pyx_pybuffer_Qabs.refcount = 0;
  2372. __pyx_pybuffernd_Qabs.data = NULL;
  2373. __pyx_pybuffernd_Qabs.rcbuffer = &__pyx_pybuffer_Qabs;
  2374. __pyx_pybuffer_Qsca.pybuffer.buf = NULL;
  2375. __pyx_pybuffer_Qsca.refcount = 0;
  2376. __pyx_pybuffernd_Qsca.data = NULL;
  2377. __pyx_pybuffernd_Qsca.rcbuffer = &__pyx_pybuffer_Qsca;
  2378. __pyx_pybuffer_Qbk.pybuffer.buf = NULL;
  2379. __pyx_pybuffer_Qbk.refcount = 0;
  2380. __pyx_pybuffernd_Qbk.data = NULL;
  2381. __pyx_pybuffernd_Qbk.rcbuffer = &__pyx_pybuffer_Qbk;
  2382. __pyx_pybuffer_Qpr.pybuffer.buf = NULL;
  2383. __pyx_pybuffer_Qpr.refcount = 0;
  2384. __pyx_pybuffernd_Qpr.data = NULL;
  2385. __pyx_pybuffernd_Qpr.rcbuffer = &__pyx_pybuffer_Qpr;
  2386. __pyx_pybuffer_g.pybuffer.buf = NULL;
  2387. __pyx_pybuffer_g.refcount = 0;
  2388. __pyx_pybuffernd_g.data = NULL;
  2389. __pyx_pybuffernd_g.rcbuffer = &__pyx_pybuffer_g;
  2390. __pyx_pybuffer_Albedo.pybuffer.buf = NULL;
  2391. __pyx_pybuffer_Albedo.refcount = 0;
  2392. __pyx_pybuffernd_Albedo.data = NULL;
  2393. __pyx_pybuffernd_Albedo.rcbuffer = &__pyx_pybuffer_Albedo;
  2394. __pyx_pybuffer_S1.pybuffer.buf = NULL;
  2395. __pyx_pybuffer_S1.refcount = 0;
  2396. __pyx_pybuffernd_S1.data = NULL;
  2397. __pyx_pybuffernd_S1.rcbuffer = &__pyx_pybuffer_S1;
  2398. __pyx_pybuffer_S2.pybuffer.buf = NULL;
  2399. __pyx_pybuffer_S2.refcount = 0;
  2400. __pyx_pybuffernd_S2.data = NULL;
  2401. __pyx_pybuffernd_S2.rcbuffer = &__pyx_pybuffer_S2;
  2402. __pyx_pybuffer_S1r.pybuffer.buf = NULL;
  2403. __pyx_pybuffer_S1r.refcount = 0;
  2404. __pyx_pybuffernd_S1r.data = NULL;
  2405. __pyx_pybuffernd_S1r.rcbuffer = &__pyx_pybuffer_S1r;
  2406. __pyx_pybuffer_S1i.pybuffer.buf = NULL;
  2407. __pyx_pybuffer_S1i.refcount = 0;
  2408. __pyx_pybuffernd_S1i.data = NULL;
  2409. __pyx_pybuffernd_S1i.rcbuffer = &__pyx_pybuffer_S1i;
  2410. __pyx_pybuffer_S2r.pybuffer.buf = NULL;
  2411. __pyx_pybuffer_S2r.refcount = 0;
  2412. __pyx_pybuffernd_S2r.data = NULL;
  2413. __pyx_pybuffernd_S2r.rcbuffer = &__pyx_pybuffer_S2r;
  2414. __pyx_pybuffer_S2i.pybuffer.buf = NULL;
  2415. __pyx_pybuffer_S2i.refcount = 0;
  2416. __pyx_pybuffernd_S2i.data = NULL;
  2417. __pyx_pybuffernd_S2i.rcbuffer = &__pyx_pybuffer_S2i;
  2418. __pyx_pybuffer_x.pybuffer.buf = NULL;
  2419. __pyx_pybuffer_x.refcount = 0;
  2420. __pyx_pybuffernd_x.data = NULL;
  2421. __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
  2422. __pyx_pybuffer_m.pybuffer.buf = NULL;
  2423. __pyx_pybuffer_m.refcount = 0;
  2424. __pyx_pybuffernd_m.data = NULL;
  2425. __pyx_pybuffernd_m.rcbuffer = &__pyx_pybuffer_m;
  2426. __pyx_pybuffer_theta.pybuffer.buf = NULL;
  2427. __pyx_pybuffer_theta.refcount = 0;
  2428. __pyx_pybuffernd_theta.data = NULL;
  2429. __pyx_pybuffernd_theta.rcbuffer = &__pyx_pybuffer_theta;
  2430. {
  2431. __Pyx_BufFmt_StackElem __pyx_stack[1];
  2432. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2433. }
  2434. __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1];
  2435. {
  2436. __Pyx_BufFmt_StackElem __pyx_stack[1];
  2437. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_m.rcbuffer->pybuffer, (PyObject*)__pyx_v_m, &__Pyx_TypeInfo___pyx_t_double_complex, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2438. }
  2439. __pyx_pybuffernd_m.diminfo[0].strides = __pyx_pybuffernd_m.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_m.diminfo[0].shape = __pyx_pybuffernd_m.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_m.diminfo[1].strides = __pyx_pybuffernd_m.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_m.diminfo[1].shape = __pyx_pybuffernd_m.rcbuffer->pybuffer.shape[1];
  2440. {
  2441. __Pyx_BufFmt_StackElem __pyx_stack[1];
  2442. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_theta.rcbuffer->pybuffer, (PyObject*)__pyx_v_theta, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2443. }
  2444. __pyx_pybuffernd_theta.diminfo[0].strides = __pyx_pybuffernd_theta.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_theta.diminfo[0].shape = __pyx_pybuffernd_theta.rcbuffer->pybuffer.shape[0];
  2445. /* "scattnlay_mp.pyx":125
  2446. * cdef Py_ssize_t i
  2447. *
  2448. * cdef np.ndarray[np.int_t, ndim = 1] terms = np.zeros(x.shape[0], dtype = np.int) # <<<<<<<<<<<<<<
  2449. *
  2450. * cdef np.ndarray[np.float64_t, ndim = 1] Qext = np.zeros(x.shape[0], dtype = np.float64)
  2451. */
  2452. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2453. __Pyx_GOTREF(__pyx_t_1);
  2454. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2455. __Pyx_GOTREF(__pyx_t_2);
  2456. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2457. __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_x->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2458. __Pyx_GOTREF(__pyx_t_1);
  2459. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2460. __Pyx_GOTREF(__pyx_t_3);
  2461. __Pyx_GIVEREF(__pyx_t_1);
  2462. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  2463. __pyx_t_1 = 0;
  2464. __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2465. __Pyx_GOTREF(__pyx_t_1);
  2466. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2467. __Pyx_GOTREF(__pyx_t_4);
  2468. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2469. __Pyx_GOTREF(__pyx_t_5);
  2470. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2471. if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2472. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2473. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2474. __Pyx_GOTREF(__pyx_t_5);
  2475. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2476. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2477. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2478. if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2479. __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  2480. {
  2481. __Pyx_BufFmt_StackElem __pyx_stack[1];
  2482. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_terms.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
  2483. __pyx_v_terms = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_terms.rcbuffer->pybuffer.buf = NULL;
  2484. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2485. } else {__pyx_pybuffernd_terms.diminfo[0].strides = __pyx_pybuffernd_terms.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_terms.diminfo[0].shape = __pyx_pybuffernd_terms.rcbuffer->pybuffer.shape[0];
  2486. }
  2487. }
  2488. __pyx_t_6 = 0;
  2489. __pyx_v_terms = ((PyArrayObject *)__pyx_t_5);
  2490. __pyx_t_5 = 0;
  2491. /* "scattnlay_mp.pyx":127
  2492. * cdef np.ndarray[np.int_t, ndim = 1] terms = np.zeros(x.shape[0], dtype = np.int)
  2493. *
  2494. * cdef np.ndarray[np.float64_t, ndim = 1] Qext = np.zeros(x.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  2495. * cdef np.ndarray[np.float64_t, ndim = 1] Qabs = np.zeros(x.shape[0], dtype = np.float64)
  2496. * cdef np.ndarray[np.float64_t, ndim = 1] Qsca = np.zeros(x.shape[0], dtype = np.float64)
  2497. */
  2498. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2499. __Pyx_GOTREF(__pyx_t_5);
  2500. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2501. __Pyx_GOTREF(__pyx_t_1);
  2502. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2503. __pyx_t_5 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_x->dimensions[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2504. __Pyx_GOTREF(__pyx_t_5);
  2505. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2506. __Pyx_GOTREF(__pyx_t_3);
  2507. __Pyx_GIVEREF(__pyx_t_5);
  2508. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  2509. __pyx_t_5 = 0;
  2510. __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2511. __Pyx_GOTREF(__pyx_t_5);
  2512. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2513. __Pyx_GOTREF(__pyx_t_2);
  2514. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2515. __Pyx_GOTREF(__pyx_t_4);
  2516. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2517. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2518. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2519. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2520. __Pyx_GOTREF(__pyx_t_4);
  2521. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2522. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2523. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2524. if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2525. __pyx_t_7 = ((PyArrayObject *)__pyx_t_4);
  2526. {
  2527. __Pyx_BufFmt_StackElem __pyx_stack[1];
  2528. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Qext.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
  2529. __pyx_v_Qext = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_Qext.rcbuffer->pybuffer.buf = NULL;
  2530. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2531. } else {__pyx_pybuffernd_Qext.diminfo[0].strides = __pyx_pybuffernd_Qext.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Qext.diminfo[0].shape = __pyx_pybuffernd_Qext.rcbuffer->pybuffer.shape[0];
  2532. }
  2533. }
  2534. __pyx_t_7 = 0;
  2535. __pyx_v_Qext = ((PyArrayObject *)__pyx_t_4);
  2536. __pyx_t_4 = 0;
  2537. /* "scattnlay_mp.pyx":128
  2538. *
  2539. * cdef np.ndarray[np.float64_t, ndim = 1] Qext = np.zeros(x.shape[0], dtype = np.float64)
  2540. * cdef np.ndarray[np.float64_t, ndim = 1] Qabs = np.zeros(x.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  2541. * cdef np.ndarray[np.float64_t, ndim = 1] Qsca = np.zeros(x.shape[0], dtype = np.float64)
  2542. * cdef np.ndarray[np.float64_t, ndim = 1] Qbk = np.zeros(x.shape[0], dtype = np.float64)
  2543. */
  2544. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2545. __Pyx_GOTREF(__pyx_t_4);
  2546. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2547. __Pyx_GOTREF(__pyx_t_5);
  2548. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2549. __pyx_t_4 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_x->dimensions[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2550. __Pyx_GOTREF(__pyx_t_4);
  2551. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2552. __Pyx_GOTREF(__pyx_t_3);
  2553. __Pyx_GIVEREF(__pyx_t_4);
  2554. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  2555. __pyx_t_4 = 0;
  2556. __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2557. __Pyx_GOTREF(__pyx_t_4);
  2558. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2559. __Pyx_GOTREF(__pyx_t_1);
  2560. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2561. __Pyx_GOTREF(__pyx_t_2);
  2562. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2563. if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2564. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2565. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2566. __Pyx_GOTREF(__pyx_t_2);
  2567. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2568. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2569. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2570. if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2571. __pyx_t_8 = ((PyArrayObject *)__pyx_t_2);
  2572. {
  2573. __Pyx_BufFmt_StackElem __pyx_stack[1];
  2574. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Qabs.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
  2575. __pyx_v_Qabs = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_Qabs.rcbuffer->pybuffer.buf = NULL;
  2576. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2577. } else {__pyx_pybuffernd_Qabs.diminfo[0].strides = __pyx_pybuffernd_Qabs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Qabs.diminfo[0].shape = __pyx_pybuffernd_Qabs.rcbuffer->pybuffer.shape[0];
  2578. }
  2579. }
  2580. __pyx_t_8 = 0;
  2581. __pyx_v_Qabs = ((PyArrayObject *)__pyx_t_2);
  2582. __pyx_t_2 = 0;
  2583. /* "scattnlay_mp.pyx":129
  2584. * cdef np.ndarray[np.float64_t, ndim = 1] Qext = np.zeros(x.shape[0], dtype = np.float64)
  2585. * cdef np.ndarray[np.float64_t, ndim = 1] Qabs = np.zeros(x.shape[0], dtype = np.float64)
  2586. * cdef np.ndarray[np.float64_t, ndim = 1] Qsca = np.zeros(x.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  2587. * cdef np.ndarray[np.float64_t, ndim = 1] Qbk = np.zeros(x.shape[0], dtype = np.float64)
  2588. * cdef np.ndarray[np.float64_t, ndim = 1] Qpr = np.zeros(x.shape[0], dtype = np.float64)
  2589. */
  2590. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2591. __Pyx_GOTREF(__pyx_t_2);
  2592. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2593. __Pyx_GOTREF(__pyx_t_4);
  2594. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2595. __pyx_t_2 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_x->dimensions[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2596. __Pyx_GOTREF(__pyx_t_2);
  2597. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2598. __Pyx_GOTREF(__pyx_t_3);
  2599. __Pyx_GIVEREF(__pyx_t_2);
  2600. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  2601. __pyx_t_2 = 0;
  2602. __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2603. __Pyx_GOTREF(__pyx_t_2);
  2604. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2605. __Pyx_GOTREF(__pyx_t_5);
  2606. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2607. __Pyx_GOTREF(__pyx_t_1);
  2608. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2609. if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2610. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2611. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2612. __Pyx_GOTREF(__pyx_t_1);
  2613. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2614. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2615. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2616. if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2617. __pyx_t_9 = ((PyArrayObject *)__pyx_t_1);
  2618. {
  2619. __Pyx_BufFmt_StackElem __pyx_stack[1];
  2620. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Qsca.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
  2621. __pyx_v_Qsca = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_Qsca.rcbuffer->pybuffer.buf = NULL;
  2622. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2623. } else {__pyx_pybuffernd_Qsca.diminfo[0].strides = __pyx_pybuffernd_Qsca.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Qsca.diminfo[0].shape = __pyx_pybuffernd_Qsca.rcbuffer->pybuffer.shape[0];
  2624. }
  2625. }
  2626. __pyx_t_9 = 0;
  2627. __pyx_v_Qsca = ((PyArrayObject *)__pyx_t_1);
  2628. __pyx_t_1 = 0;
  2629. /* "scattnlay_mp.pyx":130
  2630. * cdef np.ndarray[np.float64_t, ndim = 1] Qabs = np.zeros(x.shape[0], dtype = np.float64)
  2631. * cdef np.ndarray[np.float64_t, ndim = 1] Qsca = np.zeros(x.shape[0], dtype = np.float64)
  2632. * cdef np.ndarray[np.float64_t, ndim = 1] Qbk = np.zeros(x.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  2633. * cdef np.ndarray[np.float64_t, ndim = 1] Qpr = np.zeros(x.shape[0], dtype = np.float64)
  2634. * cdef np.ndarray[np.float64_t, ndim = 1] g = np.zeros(x.shape[0], dtype = np.float64)
  2635. */
  2636. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2637. __Pyx_GOTREF(__pyx_t_1);
  2638. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2639. __Pyx_GOTREF(__pyx_t_2);
  2640. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2641. __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_x->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2642. __Pyx_GOTREF(__pyx_t_1);
  2643. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2644. __Pyx_GOTREF(__pyx_t_3);
  2645. __Pyx_GIVEREF(__pyx_t_1);
  2646. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  2647. __pyx_t_1 = 0;
  2648. __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2649. __Pyx_GOTREF(__pyx_t_1);
  2650. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2651. __Pyx_GOTREF(__pyx_t_4);
  2652. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2653. __Pyx_GOTREF(__pyx_t_5);
  2654. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2655. if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2656. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2657. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2658. __Pyx_GOTREF(__pyx_t_5);
  2659. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2660. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2661. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2662. if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2663. __pyx_t_10 = ((PyArrayObject *)__pyx_t_5);
  2664. {
  2665. __Pyx_BufFmt_StackElem __pyx_stack[1];
  2666. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Qbk.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
  2667. __pyx_v_Qbk = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_Qbk.rcbuffer->pybuffer.buf = NULL;
  2668. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2669. } else {__pyx_pybuffernd_Qbk.diminfo[0].strides = __pyx_pybuffernd_Qbk.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Qbk.diminfo[0].shape = __pyx_pybuffernd_Qbk.rcbuffer->pybuffer.shape[0];
  2670. }
  2671. }
  2672. __pyx_t_10 = 0;
  2673. __pyx_v_Qbk = ((PyArrayObject *)__pyx_t_5);
  2674. __pyx_t_5 = 0;
  2675. /* "scattnlay_mp.pyx":131
  2676. * cdef np.ndarray[np.float64_t, ndim = 1] Qsca = np.zeros(x.shape[0], dtype = np.float64)
  2677. * cdef np.ndarray[np.float64_t, ndim = 1] Qbk = np.zeros(x.shape[0], dtype = np.float64)
  2678. * cdef np.ndarray[np.float64_t, ndim = 1] Qpr = np.zeros(x.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  2679. * cdef np.ndarray[np.float64_t, ndim = 1] g = np.zeros(x.shape[0], dtype = np.float64)
  2680. * cdef np.ndarray[np.float64_t, ndim = 1] Albedo = np.zeros(x.shape[0], dtype = np.float64)
  2681. */
  2682. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2683. __Pyx_GOTREF(__pyx_t_5);
  2684. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2685. __Pyx_GOTREF(__pyx_t_1);
  2686. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2687. __pyx_t_5 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_x->dimensions[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2688. __Pyx_GOTREF(__pyx_t_5);
  2689. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2690. __Pyx_GOTREF(__pyx_t_3);
  2691. __Pyx_GIVEREF(__pyx_t_5);
  2692. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  2693. __pyx_t_5 = 0;
  2694. __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2695. __Pyx_GOTREF(__pyx_t_5);
  2696. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2697. __Pyx_GOTREF(__pyx_t_2);
  2698. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2699. __Pyx_GOTREF(__pyx_t_4);
  2700. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2701. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2702. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2703. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2704. __Pyx_GOTREF(__pyx_t_4);
  2705. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2706. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2707. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2708. if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2709. __pyx_t_11 = ((PyArrayObject *)__pyx_t_4);
  2710. {
  2711. __Pyx_BufFmt_StackElem __pyx_stack[1];
  2712. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Qpr.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
  2713. __pyx_v_Qpr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_Qpr.rcbuffer->pybuffer.buf = NULL;
  2714. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2715. } else {__pyx_pybuffernd_Qpr.diminfo[0].strides = __pyx_pybuffernd_Qpr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Qpr.diminfo[0].shape = __pyx_pybuffernd_Qpr.rcbuffer->pybuffer.shape[0];
  2716. }
  2717. }
  2718. __pyx_t_11 = 0;
  2719. __pyx_v_Qpr = ((PyArrayObject *)__pyx_t_4);
  2720. __pyx_t_4 = 0;
  2721. /* "scattnlay_mp.pyx":132
  2722. * cdef np.ndarray[np.float64_t, ndim = 1] Qbk = np.zeros(x.shape[0], dtype = np.float64)
  2723. * cdef np.ndarray[np.float64_t, ndim = 1] Qpr = np.zeros(x.shape[0], dtype = np.float64)
  2724. * cdef np.ndarray[np.float64_t, ndim = 1] g = np.zeros(x.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  2725. * cdef np.ndarray[np.float64_t, ndim = 1] Albedo = np.zeros(x.shape[0], dtype = np.float64)
  2726. *
  2727. */
  2728. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2729. __Pyx_GOTREF(__pyx_t_4);
  2730. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2731. __Pyx_GOTREF(__pyx_t_5);
  2732. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2733. __pyx_t_4 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_x->dimensions[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2734. __Pyx_GOTREF(__pyx_t_4);
  2735. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2736. __Pyx_GOTREF(__pyx_t_3);
  2737. __Pyx_GIVEREF(__pyx_t_4);
  2738. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  2739. __pyx_t_4 = 0;
  2740. __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2741. __Pyx_GOTREF(__pyx_t_4);
  2742. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2743. __Pyx_GOTREF(__pyx_t_1);
  2744. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2745. __Pyx_GOTREF(__pyx_t_2);
  2746. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2747. if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2748. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2749. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2750. __Pyx_GOTREF(__pyx_t_2);
  2751. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2752. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2753. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2754. if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2755. __pyx_t_12 = ((PyArrayObject *)__pyx_t_2);
  2756. {
  2757. __Pyx_BufFmt_StackElem __pyx_stack[1];
  2758. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_g.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
  2759. __pyx_v_g = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_g.rcbuffer->pybuffer.buf = NULL;
  2760. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2761. } else {__pyx_pybuffernd_g.diminfo[0].strides = __pyx_pybuffernd_g.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_g.diminfo[0].shape = __pyx_pybuffernd_g.rcbuffer->pybuffer.shape[0];
  2762. }
  2763. }
  2764. __pyx_t_12 = 0;
  2765. __pyx_v_g = ((PyArrayObject *)__pyx_t_2);
  2766. __pyx_t_2 = 0;
  2767. /* "scattnlay_mp.pyx":133
  2768. * cdef np.ndarray[np.float64_t, ndim = 1] Qpr = np.zeros(x.shape[0], dtype = np.float64)
  2769. * cdef np.ndarray[np.float64_t, ndim = 1] g = np.zeros(x.shape[0], dtype = np.float64)
  2770. * cdef np.ndarray[np.float64_t, ndim = 1] Albedo = np.zeros(x.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  2771. *
  2772. * cdef np.ndarray[np.complex128_t, ndim = 2] S1 = np.zeros((x.shape[0], theta.shape[0]), dtype = np.complex128)
  2773. */
  2774. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2775. __Pyx_GOTREF(__pyx_t_2);
  2776. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2777. __Pyx_GOTREF(__pyx_t_4);
  2778. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2779. __pyx_t_2 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_x->dimensions[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2780. __Pyx_GOTREF(__pyx_t_2);
  2781. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2782. __Pyx_GOTREF(__pyx_t_3);
  2783. __Pyx_GIVEREF(__pyx_t_2);
  2784. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  2785. __pyx_t_2 = 0;
  2786. __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2787. __Pyx_GOTREF(__pyx_t_2);
  2788. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2789. __Pyx_GOTREF(__pyx_t_5);
  2790. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2791. __Pyx_GOTREF(__pyx_t_1);
  2792. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2793. if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2794. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2795. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2796. __Pyx_GOTREF(__pyx_t_1);
  2797. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2798. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2799. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2800. if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2801. __pyx_t_13 = ((PyArrayObject *)__pyx_t_1);
  2802. {
  2803. __Pyx_BufFmt_StackElem __pyx_stack[1];
  2804. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Albedo.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
  2805. __pyx_v_Albedo = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_Albedo.rcbuffer->pybuffer.buf = NULL;
  2806. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2807. } else {__pyx_pybuffernd_Albedo.diminfo[0].strides = __pyx_pybuffernd_Albedo.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Albedo.diminfo[0].shape = __pyx_pybuffernd_Albedo.rcbuffer->pybuffer.shape[0];
  2808. }
  2809. }
  2810. __pyx_t_13 = 0;
  2811. __pyx_v_Albedo = ((PyArrayObject *)__pyx_t_1);
  2812. __pyx_t_1 = 0;
  2813. /* "scattnlay_mp.pyx":135
  2814. * cdef np.ndarray[np.float64_t, ndim = 1] Albedo = np.zeros(x.shape[0], dtype = np.float64)
  2815. *
  2816. * cdef np.ndarray[np.complex128_t, ndim = 2] S1 = np.zeros((x.shape[0], theta.shape[0]), dtype = np.complex128) # <<<<<<<<<<<<<<
  2817. * cdef np.ndarray[np.complex128_t, ndim = 2] S2 = np.zeros((x.shape[0], theta.shape[0]), dtype = np.complex128)
  2818. *
  2819. */
  2820. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2821. __Pyx_GOTREF(__pyx_t_1);
  2822. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2823. __Pyx_GOTREF(__pyx_t_2);
  2824. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2825. __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_x->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2826. __Pyx_GOTREF(__pyx_t_1);
  2827. __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_theta->dimensions[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2828. __Pyx_GOTREF(__pyx_t_3);
  2829. __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2830. __Pyx_GOTREF(__pyx_t_4);
  2831. __Pyx_GIVEREF(__pyx_t_1);
  2832. PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  2833. __Pyx_GIVEREF(__pyx_t_3);
  2834. PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  2835. __pyx_t_1 = 0;
  2836. __pyx_t_3 = 0;
  2837. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2838. __Pyx_GOTREF(__pyx_t_3);
  2839. __Pyx_GIVEREF(__pyx_t_4);
  2840. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  2841. __pyx_t_4 = 0;
  2842. __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2843. __Pyx_GOTREF(__pyx_t_4);
  2844. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2845. __Pyx_GOTREF(__pyx_t_1);
  2846. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_complex128); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2847. __Pyx_GOTREF(__pyx_t_5);
  2848. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2849. if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2850. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2851. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2852. __Pyx_GOTREF(__pyx_t_5);
  2853. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2854. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2855. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2856. if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2857. __pyx_t_14 = ((PyArrayObject *)__pyx_t_5);
  2858. {
  2859. __Pyx_BufFmt_StackElem __pyx_stack[1];
  2860. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_S1.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo___pyx_t_double_complex, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
  2861. __pyx_v_S1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_S1.rcbuffer->pybuffer.buf = NULL;
  2862. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2863. } else {__pyx_pybuffernd_S1.diminfo[0].strides = __pyx_pybuffernd_S1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_S1.diminfo[0].shape = __pyx_pybuffernd_S1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_S1.diminfo[1].strides = __pyx_pybuffernd_S1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_S1.diminfo[1].shape = __pyx_pybuffernd_S1.rcbuffer->pybuffer.shape[1];
  2864. }
  2865. }
  2866. __pyx_t_14 = 0;
  2867. __pyx_v_S1 = ((PyArrayObject *)__pyx_t_5);
  2868. __pyx_t_5 = 0;
  2869. /* "scattnlay_mp.pyx":136
  2870. *
  2871. * cdef np.ndarray[np.complex128_t, ndim = 2] S1 = np.zeros((x.shape[0], theta.shape[0]), dtype = np.complex128)
  2872. * cdef np.ndarray[np.complex128_t, ndim = 2] S2 = np.zeros((x.shape[0], theta.shape[0]), dtype = np.complex128) # <<<<<<<<<<<<<<
  2873. *
  2874. * cdef np.ndarray[np.float64_t, ndim = 1] S1r
  2875. */
  2876. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2877. __Pyx_GOTREF(__pyx_t_5);
  2878. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2879. __Pyx_GOTREF(__pyx_t_4);
  2880. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2881. __pyx_t_5 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_x->dimensions[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2882. __Pyx_GOTREF(__pyx_t_5);
  2883. __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_theta->dimensions[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2884. __Pyx_GOTREF(__pyx_t_3);
  2885. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2886. __Pyx_GOTREF(__pyx_t_2);
  2887. __Pyx_GIVEREF(__pyx_t_5);
  2888. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
  2889. __Pyx_GIVEREF(__pyx_t_3);
  2890. PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  2891. __pyx_t_5 = 0;
  2892. __pyx_t_3 = 0;
  2893. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2894. __Pyx_GOTREF(__pyx_t_3);
  2895. __Pyx_GIVEREF(__pyx_t_2);
  2896. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  2897. __pyx_t_2 = 0;
  2898. __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2899. __Pyx_GOTREF(__pyx_t_2);
  2900. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2901. __Pyx_GOTREF(__pyx_t_5);
  2902. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_complex128); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2903. __Pyx_GOTREF(__pyx_t_1);
  2904. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2905. if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2906. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2907. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2908. __Pyx_GOTREF(__pyx_t_1);
  2909. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2910. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2911. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2912. if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2913. __pyx_t_15 = ((PyArrayObject *)__pyx_t_1);
  2914. {
  2915. __Pyx_BufFmt_StackElem __pyx_stack[1];
  2916. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_S2.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo___pyx_t_double_complex, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
  2917. __pyx_v_S2 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_S2.rcbuffer->pybuffer.buf = NULL;
  2918. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2919. } else {__pyx_pybuffernd_S2.diminfo[0].strides = __pyx_pybuffernd_S2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_S2.diminfo[0].shape = __pyx_pybuffernd_S2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_S2.diminfo[1].strides = __pyx_pybuffernd_S2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_S2.diminfo[1].shape = __pyx_pybuffernd_S2.rcbuffer->pybuffer.shape[1];
  2920. }
  2921. }
  2922. __pyx_t_15 = 0;
  2923. __pyx_v_S2 = ((PyArrayObject *)__pyx_t_1);
  2924. __pyx_t_1 = 0;
  2925. /* "scattnlay_mp.pyx":143
  2926. * cdef np.ndarray[np.float64_t, ndim = 1] S2i
  2927. *
  2928. * for i in range(x.shape[0]): # <<<<<<<<<<<<<<
  2929. * S1r = np.zeros(theta.shape[0], dtype = np.float64)
  2930. * S1i = np.zeros(theta.shape[0], dtype = np.float64)
  2931. */
  2932. __pyx_t_16 = (__pyx_v_x->dimensions[0]);
  2933. for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
  2934. __pyx_v_i = __pyx_t_17;
  2935. /* "scattnlay_mp.pyx":144
  2936. *
  2937. * for i in range(x.shape[0]):
  2938. * S1r = np.zeros(theta.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  2939. * S1i = np.zeros(theta.shape[0], dtype = np.float64)
  2940. * S2r = np.zeros(theta.shape[0], dtype = np.float64)
  2941. */
  2942. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2943. __Pyx_GOTREF(__pyx_t_1);
  2944. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2945. __Pyx_GOTREF(__pyx_t_2);
  2946. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2947. __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_theta->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2948. __Pyx_GOTREF(__pyx_t_1);
  2949. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2950. __Pyx_GOTREF(__pyx_t_3);
  2951. __Pyx_GIVEREF(__pyx_t_1);
  2952. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  2953. __pyx_t_1 = 0;
  2954. __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2955. __Pyx_GOTREF(__pyx_t_1);
  2956. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2957. __Pyx_GOTREF(__pyx_t_4);
  2958. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2959. __Pyx_GOTREF(__pyx_t_5);
  2960. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2961. if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2962. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2963. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2964. __Pyx_GOTREF(__pyx_t_5);
  2965. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2966. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2967. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2968. if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2969. __pyx_t_18 = ((PyArrayObject *)__pyx_t_5);
  2970. {
  2971. __Pyx_BufFmt_StackElem __pyx_stack[1];
  2972. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S1r.rcbuffer->pybuffer);
  2973. __pyx_t_19 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_S1r.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
  2974. if (unlikely(__pyx_t_19 < 0)) {
  2975. PyErr_Fetch(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
  2976. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_S1r.rcbuffer->pybuffer, (PyObject*)__pyx_v_S1r, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
  2977. Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22);
  2978. __Pyx_RaiseBufferFallbackError();
  2979. } else {
  2980. PyErr_Restore(__pyx_t_20, __pyx_t_21, __pyx_t_22);
  2981. }
  2982. }
  2983. __pyx_pybuffernd_S1r.diminfo[0].strides = __pyx_pybuffernd_S1r.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_S1r.diminfo[0].shape = __pyx_pybuffernd_S1r.rcbuffer->pybuffer.shape[0];
  2984. if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2985. }
  2986. __pyx_t_18 = 0;
  2987. __Pyx_XDECREF_SET(__pyx_v_S1r, ((PyArrayObject *)__pyx_t_5));
  2988. __pyx_t_5 = 0;
  2989. /* "scattnlay_mp.pyx":145
  2990. * for i in range(x.shape[0]):
  2991. * S1r = np.zeros(theta.shape[0], dtype = np.float64)
  2992. * S1i = np.zeros(theta.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  2993. * S2r = np.zeros(theta.shape[0], dtype = np.float64)
  2994. * S2i = np.zeros(theta.shape[0], dtype = np.float64)
  2995. */
  2996. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2997. __Pyx_GOTREF(__pyx_t_5);
  2998. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2999. __Pyx_GOTREF(__pyx_t_1);
  3000. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3001. __pyx_t_5 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_theta->dimensions[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3002. __Pyx_GOTREF(__pyx_t_5);
  3003. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3004. __Pyx_GOTREF(__pyx_t_3);
  3005. __Pyx_GIVEREF(__pyx_t_5);
  3006. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  3007. __pyx_t_5 = 0;
  3008. __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3009. __Pyx_GOTREF(__pyx_t_5);
  3010. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3011. __Pyx_GOTREF(__pyx_t_2);
  3012. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3013. __Pyx_GOTREF(__pyx_t_4);
  3014. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3015. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3016. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3017. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3018. __Pyx_GOTREF(__pyx_t_4);
  3019. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3020. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3021. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3022. if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3023. __pyx_t_23 = ((PyArrayObject *)__pyx_t_4);
  3024. {
  3025. __Pyx_BufFmt_StackElem __pyx_stack[1];
  3026. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S1i.rcbuffer->pybuffer);
  3027. __pyx_t_19 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_S1i.rcbuffer->pybuffer, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
  3028. if (unlikely(__pyx_t_19 < 0)) {
  3029. PyErr_Fetch(&__pyx_t_22, &__pyx_t_21, &__pyx_t_20);
  3030. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_S1i.rcbuffer->pybuffer, (PyObject*)__pyx_v_S1i, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
  3031. Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20);
  3032. __Pyx_RaiseBufferFallbackError();
  3033. } else {
  3034. PyErr_Restore(__pyx_t_22, __pyx_t_21, __pyx_t_20);
  3035. }
  3036. }
  3037. __pyx_pybuffernd_S1i.diminfo[0].strides = __pyx_pybuffernd_S1i.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_S1i.diminfo[0].shape = __pyx_pybuffernd_S1i.rcbuffer->pybuffer.shape[0];
  3038. if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3039. }
  3040. __pyx_t_23 = 0;
  3041. __Pyx_XDECREF_SET(__pyx_v_S1i, ((PyArrayObject *)__pyx_t_4));
  3042. __pyx_t_4 = 0;
  3043. /* "scattnlay_mp.pyx":146
  3044. * S1r = np.zeros(theta.shape[0], dtype = np.float64)
  3045. * S1i = np.zeros(theta.shape[0], dtype = np.float64)
  3046. * S2r = np.zeros(theta.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  3047. * S2i = np.zeros(theta.shape[0], dtype = np.float64)
  3048. *
  3049. */
  3050. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3051. __Pyx_GOTREF(__pyx_t_4);
  3052. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3053. __Pyx_GOTREF(__pyx_t_5);
  3054. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3055. __pyx_t_4 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_theta->dimensions[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3056. __Pyx_GOTREF(__pyx_t_4);
  3057. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3058. __Pyx_GOTREF(__pyx_t_3);
  3059. __Pyx_GIVEREF(__pyx_t_4);
  3060. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  3061. __pyx_t_4 = 0;
  3062. __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3063. __Pyx_GOTREF(__pyx_t_4);
  3064. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3065. __Pyx_GOTREF(__pyx_t_1);
  3066. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3067. __Pyx_GOTREF(__pyx_t_2);
  3068. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3069. if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3070. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3071. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3072. __Pyx_GOTREF(__pyx_t_2);
  3073. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3074. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3075. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3076. if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3077. __pyx_t_24 = ((PyArrayObject *)__pyx_t_2);
  3078. {
  3079. __Pyx_BufFmt_StackElem __pyx_stack[1];
  3080. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S2r.rcbuffer->pybuffer);
  3081. __pyx_t_19 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_S2r.rcbuffer->pybuffer, (PyObject*)__pyx_t_24, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
  3082. if (unlikely(__pyx_t_19 < 0)) {
  3083. PyErr_Fetch(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
  3084. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_S2r.rcbuffer->pybuffer, (PyObject*)__pyx_v_S2r, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
  3085. Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22);
  3086. __Pyx_RaiseBufferFallbackError();
  3087. } else {
  3088. PyErr_Restore(__pyx_t_20, __pyx_t_21, __pyx_t_22);
  3089. }
  3090. }
  3091. __pyx_pybuffernd_S2r.diminfo[0].strides = __pyx_pybuffernd_S2r.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_S2r.diminfo[0].shape = __pyx_pybuffernd_S2r.rcbuffer->pybuffer.shape[0];
  3092. if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3093. }
  3094. __pyx_t_24 = 0;
  3095. __Pyx_XDECREF_SET(__pyx_v_S2r, ((PyArrayObject *)__pyx_t_2));
  3096. __pyx_t_2 = 0;
  3097. /* "scattnlay_mp.pyx":147
  3098. * S1i = np.zeros(theta.shape[0], dtype = np.float64)
  3099. * S2r = np.zeros(theta.shape[0], dtype = np.float64)
  3100. * S2i = np.zeros(theta.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  3101. *
  3102. * terms[i] = nMie(x.shape[1], pl, x[i].copy('C'), m[i].copy('C'), theta.shape[0], theta.copy('C'), nmax, &Qext[i], &Qsca[i], &Qabs[i], &Qbk[i], &Qpr[i], &g[i], &Albedo[i], npy2c(S1r), npy2c(S1i), npy2c(S2r), npy2c(S2i))
  3103. */
  3104. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3105. __Pyx_GOTREF(__pyx_t_2);
  3106. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3107. __Pyx_GOTREF(__pyx_t_4);
  3108. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3109. __pyx_t_2 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_theta->dimensions[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3110. __Pyx_GOTREF(__pyx_t_2);
  3111. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3112. __Pyx_GOTREF(__pyx_t_3);
  3113. __Pyx_GIVEREF(__pyx_t_2);
  3114. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  3115. __pyx_t_2 = 0;
  3116. __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3117. __Pyx_GOTREF(__pyx_t_2);
  3118. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3119. __Pyx_GOTREF(__pyx_t_5);
  3120. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3121. __Pyx_GOTREF(__pyx_t_1);
  3122. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3123. if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3124. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3125. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3126. __Pyx_GOTREF(__pyx_t_1);
  3127. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3128. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3129. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3130. if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3131. __pyx_t_25 = ((PyArrayObject *)__pyx_t_1);
  3132. {
  3133. __Pyx_BufFmt_StackElem __pyx_stack[1];
  3134. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S2i.rcbuffer->pybuffer);
  3135. __pyx_t_19 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_S2i.rcbuffer->pybuffer, (PyObject*)__pyx_t_25, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
  3136. if (unlikely(__pyx_t_19 < 0)) {
  3137. PyErr_Fetch(&__pyx_t_22, &__pyx_t_21, &__pyx_t_20);
  3138. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_S2i.rcbuffer->pybuffer, (PyObject*)__pyx_v_S2i, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
  3139. Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20);
  3140. __Pyx_RaiseBufferFallbackError();
  3141. } else {
  3142. PyErr_Restore(__pyx_t_22, __pyx_t_21, __pyx_t_20);
  3143. }
  3144. }
  3145. __pyx_pybuffernd_S2i.diminfo[0].strides = __pyx_pybuffernd_S2i.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_S2i.diminfo[0].shape = __pyx_pybuffernd_S2i.rcbuffer->pybuffer.shape[0];
  3146. if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3147. }
  3148. __pyx_t_25 = 0;
  3149. __Pyx_XDECREF_SET(__pyx_v_S2i, ((PyArrayObject *)__pyx_t_1));
  3150. __pyx_t_1 = 0;
  3151. /* "scattnlay_mp.pyx":149
  3152. * S2i = np.zeros(theta.shape[0], dtype = np.float64)
  3153. *
  3154. * terms[i] = nMie(x.shape[1], pl, x[i].copy('C'), m[i].copy('C'), theta.shape[0], theta.copy('C'), nmax, &Qext[i], &Qsca[i], &Qabs[i], &Qbk[i], &Qpr[i], &g[i], &Albedo[i], npy2c(S1r), npy2c(S1i), npy2c(S2r), npy2c(S2i)) # <<<<<<<<<<<<<<
  3155. *
  3156. * S1[i] = S1r.copy('C') + 1.0j*S1i.copy('C')
  3157. */
  3158. __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_x), __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  3159. __Pyx_GOTREF(__pyx_t_1);
  3160. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3161. __Pyx_GOTREF(__pyx_t_2);
  3162. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3163. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3164. __Pyx_GOTREF(__pyx_t_1);
  3165. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3166. __pyx_t_26 = __pyx_convert_vector_from_py_double(__pyx_t_1); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3167. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3168. __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_m), __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  3169. __Pyx_GOTREF(__pyx_t_1);
  3170. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3171. __Pyx_GOTREF(__pyx_t_2);
  3172. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3173. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3174. __Pyx_GOTREF(__pyx_t_1);
  3175. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3176. __pyx_t_27 = __pyx_convert_vector_from_py___pyx_t_double_complex(__pyx_t_1); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3177. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3178. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_theta), __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3179. __Pyx_GOTREF(__pyx_t_1);
  3180. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3181. __Pyx_GOTREF(__pyx_t_2);
  3182. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3183. __pyx_t_28 = __pyx_convert_vector_from_py_double(__pyx_t_2); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3184. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3185. __pyx_t_29 = __pyx_v_i;
  3186. __pyx_t_19 = -1;
  3187. if (__pyx_t_29 < 0) {
  3188. __pyx_t_29 += __pyx_pybuffernd_Qext.diminfo[0].shape;
  3189. if (unlikely(__pyx_t_29 < 0)) __pyx_t_19 = 0;
  3190. } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_Qext.diminfo[0].shape)) __pyx_t_19 = 0;
  3191. if (unlikely(__pyx_t_19 != -1)) {
  3192. __Pyx_RaiseBufferIndexError(__pyx_t_19);
  3193. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3194. }
  3195. __pyx_t_30 = __pyx_v_i;
  3196. __pyx_t_19 = -1;
  3197. if (__pyx_t_30 < 0) {
  3198. __pyx_t_30 += __pyx_pybuffernd_Qsca.diminfo[0].shape;
  3199. if (unlikely(__pyx_t_30 < 0)) __pyx_t_19 = 0;
  3200. } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_Qsca.diminfo[0].shape)) __pyx_t_19 = 0;
  3201. if (unlikely(__pyx_t_19 != -1)) {
  3202. __Pyx_RaiseBufferIndexError(__pyx_t_19);
  3203. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3204. }
  3205. __pyx_t_31 = __pyx_v_i;
  3206. __pyx_t_19 = -1;
  3207. if (__pyx_t_31 < 0) {
  3208. __pyx_t_31 += __pyx_pybuffernd_Qabs.diminfo[0].shape;
  3209. if (unlikely(__pyx_t_31 < 0)) __pyx_t_19 = 0;
  3210. } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_Qabs.diminfo[0].shape)) __pyx_t_19 = 0;
  3211. if (unlikely(__pyx_t_19 != -1)) {
  3212. __Pyx_RaiseBufferIndexError(__pyx_t_19);
  3213. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3214. }
  3215. __pyx_t_32 = __pyx_v_i;
  3216. __pyx_t_19 = -1;
  3217. if (__pyx_t_32 < 0) {
  3218. __pyx_t_32 += __pyx_pybuffernd_Qbk.diminfo[0].shape;
  3219. if (unlikely(__pyx_t_32 < 0)) __pyx_t_19 = 0;
  3220. } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_Qbk.diminfo[0].shape)) __pyx_t_19 = 0;
  3221. if (unlikely(__pyx_t_19 != -1)) {
  3222. __Pyx_RaiseBufferIndexError(__pyx_t_19);
  3223. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3224. }
  3225. __pyx_t_33 = __pyx_v_i;
  3226. __pyx_t_19 = -1;
  3227. if (__pyx_t_33 < 0) {
  3228. __pyx_t_33 += __pyx_pybuffernd_Qpr.diminfo[0].shape;
  3229. if (unlikely(__pyx_t_33 < 0)) __pyx_t_19 = 0;
  3230. } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_Qpr.diminfo[0].shape)) __pyx_t_19 = 0;
  3231. if (unlikely(__pyx_t_19 != -1)) {
  3232. __Pyx_RaiseBufferIndexError(__pyx_t_19);
  3233. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3234. }
  3235. __pyx_t_34 = __pyx_v_i;
  3236. __pyx_t_19 = -1;
  3237. if (__pyx_t_34 < 0) {
  3238. __pyx_t_34 += __pyx_pybuffernd_g.diminfo[0].shape;
  3239. if (unlikely(__pyx_t_34 < 0)) __pyx_t_19 = 0;
  3240. } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_g.diminfo[0].shape)) __pyx_t_19 = 0;
  3241. if (unlikely(__pyx_t_19 != -1)) {
  3242. __Pyx_RaiseBufferIndexError(__pyx_t_19);
  3243. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3244. }
  3245. __pyx_t_35 = __pyx_v_i;
  3246. __pyx_t_19 = -1;
  3247. if (__pyx_t_35 < 0) {
  3248. __pyx_t_35 += __pyx_pybuffernd_Albedo.diminfo[0].shape;
  3249. if (unlikely(__pyx_t_35 < 0)) __pyx_t_19 = 0;
  3250. } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_Albedo.diminfo[0].shape)) __pyx_t_19 = 0;
  3251. if (unlikely(__pyx_t_19 != -1)) {
  3252. __Pyx_RaiseBufferIndexError(__pyx_t_19);
  3253. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3254. }
  3255. __pyx_t_36 = __pyx_v_i;
  3256. __pyx_t_19 = -1;
  3257. if (__pyx_t_36 < 0) {
  3258. __pyx_t_36 += __pyx_pybuffernd_terms.diminfo[0].shape;
  3259. if (unlikely(__pyx_t_36 < 0)) __pyx_t_19 = 0;
  3260. } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_terms.diminfo[0].shape)) __pyx_t_19 = 0;
  3261. if (unlikely(__pyx_t_19 != -1)) {
  3262. __Pyx_RaiseBufferIndexError(__pyx_t_19);
  3263. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3264. }
  3265. *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int_t *, __pyx_pybuffernd_terms.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_terms.diminfo[0].strides) = nMie((__pyx_v_x->dimensions[1]), __pyx_v_pl, __pyx_t_26, __pyx_t_27, (__pyx_v_theta->dimensions[0]), __pyx_t_28, __pyx_v_nmax, (&(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_Qext.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_Qext.diminfo[0].strides))), (&(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_Qsca.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_Qsca.diminfo[0].strides))), (&(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_Qabs.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_Qabs.diminfo[0].strides))), (&(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_Qbk.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_Qbk.diminfo[0].strides))), (&(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_Qpr.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_Qpr.diminfo[0].strides))), (&(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_g.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_g.diminfo[0].strides))), (&(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_Albedo.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_Albedo.diminfo[0].strides))), __pyx_f_12scattnlay_mp_npy2c(((PyArrayObject *)__pyx_v_S1r)), __pyx_f_12scattnlay_mp_npy2c(((PyArrayObject *)__pyx_v_S1i)), __pyx_f_12scattnlay_mp_npy2c(((PyArrayObject *)__pyx_v_S2r)), __pyx_f_12scattnlay_mp_npy2c(((PyArrayObject *)__pyx_v_S2i)));
  3266. /* "scattnlay_mp.pyx":151
  3267. * terms[i] = nMie(x.shape[1], pl, x[i].copy('C'), m[i].copy('C'), theta.shape[0], theta.copy('C'), nmax, &Qext[i], &Qsca[i], &Qabs[i], &Qbk[i], &Qpr[i], &g[i], &Albedo[i], npy2c(S1r), npy2c(S1i), npy2c(S2r), npy2c(S2i))
  3268. *
  3269. * S1[i] = S1r.copy('C') + 1.0j*S1i.copy('C') # <<<<<<<<<<<<<<
  3270. * S2[i] = S2r.copy('C') + 1.0j*S2i.copy('C')
  3271. *
  3272. */
  3273. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_S1r), __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3274. __Pyx_GOTREF(__pyx_t_2);
  3275. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3276. __Pyx_GOTREF(__pyx_t_1);
  3277. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3278. __pyx_t_2 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3279. __Pyx_GOTREF(__pyx_t_2);
  3280. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_S1i), __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3281. __Pyx_GOTREF(__pyx_t_3);
  3282. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3283. __Pyx_GOTREF(__pyx_t_4);
  3284. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3285. __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3286. __Pyx_GOTREF(__pyx_t_3);
  3287. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3288. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3289. __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3290. __Pyx_GOTREF(__pyx_t_4);
  3291. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3292. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3293. if (unlikely(__Pyx_SetItemInt(((PyObject *)__pyx_v_S1), __pyx_v_i, __pyx_t_4, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3294. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3295. /* "scattnlay_mp.pyx":152
  3296. *
  3297. * S1[i] = S1r.copy('C') + 1.0j*S1i.copy('C')
  3298. * S2[i] = S2r.copy('C') + 1.0j*S2i.copy('C') # <<<<<<<<<<<<<<
  3299. *
  3300. * return terms, Qext, Qsca, Qabs, Qbk, Qpr, g, Albedo, S1, S2
  3301. */
  3302. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_S2r), __pyx_n_s_copy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3303. __Pyx_GOTREF(__pyx_t_4);
  3304. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3305. __Pyx_GOTREF(__pyx_t_3);
  3306. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3307. __pyx_t_4 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3308. __Pyx_GOTREF(__pyx_t_4);
  3309. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_S2i), __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3310. __Pyx_GOTREF(__pyx_t_1);
  3311. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3312. __Pyx_GOTREF(__pyx_t_2);
  3313. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3314. __pyx_t_1 = PyNumber_Multiply(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3315. __Pyx_GOTREF(__pyx_t_1);
  3316. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3317. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3318. __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3319. __Pyx_GOTREF(__pyx_t_2);
  3320. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3321. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3322. if (unlikely(__Pyx_SetItemInt(((PyObject *)__pyx_v_S2), __pyx_v_i, __pyx_t_2, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3323. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3324. }
  3325. /* "scattnlay_mp.pyx":154
  3326. * S2[i] = S2r.copy('C') + 1.0j*S2i.copy('C')
  3327. *
  3328. * return terms, Qext, Qsca, Qabs, Qbk, Qpr, g, Albedo, S1, S2 # <<<<<<<<<<<<<<
  3329. *
  3330. * def fieldnlay(np.ndarray[np.float64_t, ndim = 2] x, np.ndarray[np.complex128_t, ndim = 2] m, np.ndarray[np.float64_t, ndim = 2] coords, np.int_t nmax = -1, np.int_t pl = -1):
  3331. */
  3332. __Pyx_XDECREF(__pyx_r);
  3333. __pyx_t_2 = PyTuple_New(10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3334. __Pyx_GOTREF(__pyx_t_2);
  3335. __Pyx_INCREF(((PyObject *)__pyx_v_terms));
  3336. __Pyx_GIVEREF(((PyObject *)__pyx_v_terms));
  3337. PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_terms));
  3338. __Pyx_INCREF(((PyObject *)__pyx_v_Qext));
  3339. __Pyx_GIVEREF(((PyObject *)__pyx_v_Qext));
  3340. PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_Qext));
  3341. __Pyx_INCREF(((PyObject *)__pyx_v_Qsca));
  3342. __Pyx_GIVEREF(((PyObject *)__pyx_v_Qsca));
  3343. PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_Qsca));
  3344. __Pyx_INCREF(((PyObject *)__pyx_v_Qabs));
  3345. __Pyx_GIVEREF(((PyObject *)__pyx_v_Qabs));
  3346. PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_v_Qabs));
  3347. __Pyx_INCREF(((PyObject *)__pyx_v_Qbk));
  3348. __Pyx_GIVEREF(((PyObject *)__pyx_v_Qbk));
  3349. PyTuple_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_v_Qbk));
  3350. __Pyx_INCREF(((PyObject *)__pyx_v_Qpr));
  3351. __Pyx_GIVEREF(((PyObject *)__pyx_v_Qpr));
  3352. PyTuple_SET_ITEM(__pyx_t_2, 5, ((PyObject *)__pyx_v_Qpr));
  3353. __Pyx_INCREF(((PyObject *)__pyx_v_g));
  3354. __Pyx_GIVEREF(((PyObject *)__pyx_v_g));
  3355. PyTuple_SET_ITEM(__pyx_t_2, 6, ((PyObject *)__pyx_v_g));
  3356. __Pyx_INCREF(((PyObject *)__pyx_v_Albedo));
  3357. __Pyx_GIVEREF(((PyObject *)__pyx_v_Albedo));
  3358. PyTuple_SET_ITEM(__pyx_t_2, 7, ((PyObject *)__pyx_v_Albedo));
  3359. __Pyx_INCREF(((PyObject *)__pyx_v_S1));
  3360. __Pyx_GIVEREF(((PyObject *)__pyx_v_S1));
  3361. PyTuple_SET_ITEM(__pyx_t_2, 8, ((PyObject *)__pyx_v_S1));
  3362. __Pyx_INCREF(((PyObject *)__pyx_v_S2));
  3363. __Pyx_GIVEREF(((PyObject *)__pyx_v_S2));
  3364. PyTuple_SET_ITEM(__pyx_t_2, 9, ((PyObject *)__pyx_v_S2));
  3365. __pyx_r = __pyx_t_2;
  3366. __pyx_t_2 = 0;
  3367. goto __pyx_L0;
  3368. /* "scattnlay_mp.pyx":97
  3369. * return terms, an, bn
  3370. *
  3371. * def scattnlay(np.ndarray[np.float64_t, ndim = 2] x, np.ndarray[np.complex128_t, ndim = 2] m, np.ndarray[np.float64_t, ndim = 1] theta = np.zeros(0, dtype = np.float64), np.int_t nmax = -1, np.int_t pl = -1): # <<<<<<<<<<<<<<
  3372. * """
  3373. * scattnlay(x, m, [theta, nmax, pl])
  3374. */
  3375. /* function exit code */
  3376. __pyx_L1_error:;
  3377. __Pyx_XDECREF(__pyx_t_1);
  3378. __Pyx_XDECREF(__pyx_t_2);
  3379. __Pyx_XDECREF(__pyx_t_3);
  3380. __Pyx_XDECREF(__pyx_t_4);
  3381. __Pyx_XDECREF(__pyx_t_5);
  3382. { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
  3383. __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
  3384. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Albedo.rcbuffer->pybuffer);
  3385. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Qabs.rcbuffer->pybuffer);
  3386. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Qbk.rcbuffer->pybuffer);
  3387. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Qext.rcbuffer->pybuffer);
  3388. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Qpr.rcbuffer->pybuffer);
  3389. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Qsca.rcbuffer->pybuffer);
  3390. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S1.rcbuffer->pybuffer);
  3391. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S1i.rcbuffer->pybuffer);
  3392. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S1r.rcbuffer->pybuffer);
  3393. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S2.rcbuffer->pybuffer);
  3394. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S2i.rcbuffer->pybuffer);
  3395. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S2r.rcbuffer->pybuffer);
  3396. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_g.rcbuffer->pybuffer);
  3397. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_m.rcbuffer->pybuffer);
  3398. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_terms.rcbuffer->pybuffer);
  3399. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_theta.rcbuffer->pybuffer);
  3400. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
  3401. __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  3402. __Pyx_AddTraceback("scattnlay_mp.scattnlay", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3403. __pyx_r = NULL;
  3404. goto __pyx_L2;
  3405. __pyx_L0:;
  3406. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Albedo.rcbuffer->pybuffer);
  3407. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Qabs.rcbuffer->pybuffer);
  3408. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Qbk.rcbuffer->pybuffer);
  3409. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Qext.rcbuffer->pybuffer);
  3410. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Qpr.rcbuffer->pybuffer);
  3411. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Qsca.rcbuffer->pybuffer);
  3412. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S1.rcbuffer->pybuffer);
  3413. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S1i.rcbuffer->pybuffer);
  3414. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S1r.rcbuffer->pybuffer);
  3415. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S2.rcbuffer->pybuffer);
  3416. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S2i.rcbuffer->pybuffer);
  3417. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S2r.rcbuffer->pybuffer);
  3418. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_g.rcbuffer->pybuffer);
  3419. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_m.rcbuffer->pybuffer);
  3420. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_terms.rcbuffer->pybuffer);
  3421. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_theta.rcbuffer->pybuffer);
  3422. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
  3423. __pyx_L2:;
  3424. __Pyx_XDECREF((PyObject *)__pyx_v_terms);
  3425. __Pyx_XDECREF((PyObject *)__pyx_v_Qext);
  3426. __Pyx_XDECREF((PyObject *)__pyx_v_Qabs);
  3427. __Pyx_XDECREF((PyObject *)__pyx_v_Qsca);
  3428. __Pyx_XDECREF((PyObject *)__pyx_v_Qbk);
  3429. __Pyx_XDECREF((PyObject *)__pyx_v_Qpr);
  3430. __Pyx_XDECREF((PyObject *)__pyx_v_g);
  3431. __Pyx_XDECREF((PyObject *)__pyx_v_Albedo);
  3432. __Pyx_XDECREF((PyObject *)__pyx_v_S1);
  3433. __Pyx_XDECREF((PyObject *)__pyx_v_S2);
  3434. __Pyx_XDECREF((PyObject *)__pyx_v_S1r);
  3435. __Pyx_XDECREF((PyObject *)__pyx_v_S1i);
  3436. __Pyx_XDECREF((PyObject *)__pyx_v_S2r);
  3437. __Pyx_XDECREF((PyObject *)__pyx_v_S2i);
  3438. __Pyx_XGIVEREF(__pyx_r);
  3439. __Pyx_RefNannyFinishContext();
  3440. return __pyx_r;
  3441. }
  3442. /* "scattnlay_mp.pyx":156
  3443. * return terms, Qext, Qsca, Qabs, Qbk, Qpr, g, Albedo, S1, S2
  3444. *
  3445. * def fieldnlay(np.ndarray[np.float64_t, ndim = 2] x, np.ndarray[np.complex128_t, ndim = 2] m, np.ndarray[np.float64_t, ndim = 2] coords, np.int_t nmax = -1, np.int_t pl = -1): # <<<<<<<<<<<<<<
  3446. * cdef Py_ssize_t i
  3447. *
  3448. */
  3449. /* Python wrapper */
  3450. static PyObject *__pyx_pw_12scattnlay_mp_5fieldnlay(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  3451. static PyMethodDef __pyx_mdef_12scattnlay_mp_5fieldnlay = {"fieldnlay", (PyCFunction)__pyx_pw_12scattnlay_mp_5fieldnlay, METH_VARARGS|METH_KEYWORDS, 0};
  3452. static PyObject *__pyx_pw_12scattnlay_mp_5fieldnlay(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  3453. PyArrayObject *__pyx_v_x = 0;
  3454. PyArrayObject *__pyx_v_m = 0;
  3455. PyArrayObject *__pyx_v_coords = 0;
  3456. __pyx_t_5numpy_int_t __pyx_v_nmax;
  3457. __pyx_t_5numpy_int_t __pyx_v_pl;
  3458. int __pyx_lineno = 0;
  3459. const char *__pyx_filename = NULL;
  3460. int __pyx_clineno = 0;
  3461. PyObject *__pyx_r = 0;
  3462. __Pyx_RefNannyDeclarations
  3463. __Pyx_RefNannySetupContext("fieldnlay (wrapper)", 0);
  3464. {
  3465. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_m,&__pyx_n_s_coords,&__pyx_n_s_nmax,&__pyx_n_s_pl,0};
  3466. PyObject* values[5] = {0,0,0,0,0};
  3467. if (unlikely(__pyx_kwds)) {
  3468. Py_ssize_t kw_args;
  3469. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  3470. switch (pos_args) {
  3471. case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
  3472. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  3473. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  3474. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  3475. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  3476. case 0: break;
  3477. default: goto __pyx_L5_argtuple_error;
  3478. }
  3479. kw_args = PyDict_Size(__pyx_kwds);
  3480. switch (pos_args) {
  3481. case 0:
  3482. if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
  3483. else goto __pyx_L5_argtuple_error;
  3484. case 1:
  3485. if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_m)) != 0)) kw_args--;
  3486. else {
  3487. __Pyx_RaiseArgtupleInvalid("fieldnlay", 0, 3, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3488. }
  3489. case 2:
  3490. if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_coords)) != 0)) kw_args--;
  3491. else {
  3492. __Pyx_RaiseArgtupleInvalid("fieldnlay", 0, 3, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3493. }
  3494. case 3:
  3495. if (kw_args > 0) {
  3496. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nmax);
  3497. if (value) { values[3] = value; kw_args--; }
  3498. }
  3499. case 4:
  3500. if (kw_args > 0) {
  3501. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pl);
  3502. if (value) { values[4] = value; kw_args--; }
  3503. }
  3504. }
  3505. if (unlikely(kw_args > 0)) {
  3506. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fieldnlay") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3507. }
  3508. } else {
  3509. switch (PyTuple_GET_SIZE(__pyx_args)) {
  3510. case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
  3511. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  3512. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  3513. values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  3514. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  3515. break;
  3516. default: goto __pyx_L5_argtuple_error;
  3517. }
  3518. }
  3519. __pyx_v_x = ((PyArrayObject *)values[0]);
  3520. __pyx_v_m = ((PyArrayObject *)values[1]);
  3521. __pyx_v_coords = ((PyArrayObject *)values[2]);
  3522. if (values[3]) {
  3523. __pyx_v_nmax = __Pyx_PyInt_As_npy_long(values[3]); if (unlikely((__pyx_v_nmax == (npy_long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3524. } else {
  3525. __pyx_v_nmax = ((__pyx_t_5numpy_int_t)-1L);
  3526. }
  3527. if (values[4]) {
  3528. __pyx_v_pl = __Pyx_PyInt_As_npy_long(values[4]); if (unlikely((__pyx_v_pl == (npy_long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3529. } else {
  3530. __pyx_v_pl = ((__pyx_t_5numpy_int_t)-1L);
  3531. }
  3532. }
  3533. goto __pyx_L4_argument_unpacking_done;
  3534. __pyx_L5_argtuple_error:;
  3535. __Pyx_RaiseArgtupleInvalid("fieldnlay", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3536. __pyx_L3_error:;
  3537. __Pyx_AddTraceback("scattnlay_mp.fieldnlay", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3538. __Pyx_RefNannyFinishContext();
  3539. return NULL;
  3540. __pyx_L4_argument_unpacking_done:;
  3541. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3542. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_m), __pyx_ptype_5numpy_ndarray, 1, "m", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3543. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coords), __pyx_ptype_5numpy_ndarray, 1, "coords", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3544. __pyx_r = __pyx_pf_12scattnlay_mp_4fieldnlay(__pyx_self, __pyx_v_x, __pyx_v_m, __pyx_v_coords, __pyx_v_nmax, __pyx_v_pl);
  3545. /* function exit code */
  3546. goto __pyx_L0;
  3547. __pyx_L1_error:;
  3548. __pyx_r = NULL;
  3549. __pyx_L0:;
  3550. __Pyx_RefNannyFinishContext();
  3551. return __pyx_r;
  3552. }
  3553. static PyObject *__pyx_pf_12scattnlay_mp_4fieldnlay(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_m, PyArrayObject *__pyx_v_coords, __pyx_t_5numpy_int_t __pyx_v_nmax, __pyx_t_5numpy_int_t __pyx_v_pl) {
  3554. Py_ssize_t __pyx_v_i;
  3555. PyArrayObject *__pyx_v_terms = 0;
  3556. PyArrayObject *__pyx_v_E = 0;
  3557. PyArrayObject *__pyx_v_H = 0;
  3558. PyArrayObject *__pyx_v_Erx = 0;
  3559. PyArrayObject *__pyx_v_Ery = 0;
  3560. PyArrayObject *__pyx_v_Erz = 0;
  3561. PyArrayObject *__pyx_v_Eix = 0;
  3562. PyArrayObject *__pyx_v_Eiy = 0;
  3563. PyArrayObject *__pyx_v_Eiz = 0;
  3564. PyArrayObject *__pyx_v_Hrx = 0;
  3565. PyArrayObject *__pyx_v_Hry = 0;
  3566. PyArrayObject *__pyx_v_Hrz = 0;
  3567. PyArrayObject *__pyx_v_Hix = 0;
  3568. PyArrayObject *__pyx_v_Hiy = 0;
  3569. PyArrayObject *__pyx_v_Hiz = 0;
  3570. __Pyx_LocalBuf_ND __pyx_pybuffernd_E;
  3571. __Pyx_Buffer __pyx_pybuffer_E;
  3572. __Pyx_LocalBuf_ND __pyx_pybuffernd_Eix;
  3573. __Pyx_Buffer __pyx_pybuffer_Eix;
  3574. __Pyx_LocalBuf_ND __pyx_pybuffernd_Eiy;
  3575. __Pyx_Buffer __pyx_pybuffer_Eiy;
  3576. __Pyx_LocalBuf_ND __pyx_pybuffernd_Eiz;
  3577. __Pyx_Buffer __pyx_pybuffer_Eiz;
  3578. __Pyx_LocalBuf_ND __pyx_pybuffernd_Erx;
  3579. __Pyx_Buffer __pyx_pybuffer_Erx;
  3580. __Pyx_LocalBuf_ND __pyx_pybuffernd_Ery;
  3581. __Pyx_Buffer __pyx_pybuffer_Ery;
  3582. __Pyx_LocalBuf_ND __pyx_pybuffernd_Erz;
  3583. __Pyx_Buffer __pyx_pybuffer_Erz;
  3584. __Pyx_LocalBuf_ND __pyx_pybuffernd_H;
  3585. __Pyx_Buffer __pyx_pybuffer_H;
  3586. __Pyx_LocalBuf_ND __pyx_pybuffernd_Hix;
  3587. __Pyx_Buffer __pyx_pybuffer_Hix;
  3588. __Pyx_LocalBuf_ND __pyx_pybuffernd_Hiy;
  3589. __Pyx_Buffer __pyx_pybuffer_Hiy;
  3590. __Pyx_LocalBuf_ND __pyx_pybuffernd_Hiz;
  3591. __Pyx_Buffer __pyx_pybuffer_Hiz;
  3592. __Pyx_LocalBuf_ND __pyx_pybuffernd_Hrx;
  3593. __Pyx_Buffer __pyx_pybuffer_Hrx;
  3594. __Pyx_LocalBuf_ND __pyx_pybuffernd_Hry;
  3595. __Pyx_Buffer __pyx_pybuffer_Hry;
  3596. __Pyx_LocalBuf_ND __pyx_pybuffernd_Hrz;
  3597. __Pyx_Buffer __pyx_pybuffer_Hrz;
  3598. __Pyx_LocalBuf_ND __pyx_pybuffernd_coords;
  3599. __Pyx_Buffer __pyx_pybuffer_coords;
  3600. __Pyx_LocalBuf_ND __pyx_pybuffernd_m;
  3601. __Pyx_Buffer __pyx_pybuffer_m;
  3602. __Pyx_LocalBuf_ND __pyx_pybuffernd_terms;
  3603. __Pyx_Buffer __pyx_pybuffer_terms;
  3604. __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
  3605. __Pyx_Buffer __pyx_pybuffer_x;
  3606. PyObject *__pyx_r = NULL;
  3607. __Pyx_RefNannyDeclarations
  3608. PyObject *__pyx_t_1 = NULL;
  3609. PyObject *__pyx_t_2 = NULL;
  3610. PyObject *__pyx_t_3 = NULL;
  3611. PyObject *__pyx_t_4 = NULL;
  3612. PyObject *__pyx_t_5 = NULL;
  3613. PyArrayObject *__pyx_t_6 = NULL;
  3614. PyArrayObject *__pyx_t_7 = NULL;
  3615. PyArrayObject *__pyx_t_8 = NULL;
  3616. npy_intp __pyx_t_9;
  3617. Py_ssize_t __pyx_t_10;
  3618. PyArrayObject *__pyx_t_11 = NULL;
  3619. int __pyx_t_12;
  3620. PyObject *__pyx_t_13 = NULL;
  3621. PyObject *__pyx_t_14 = NULL;
  3622. PyObject *__pyx_t_15 = NULL;
  3623. PyArrayObject *__pyx_t_16 = NULL;
  3624. PyArrayObject *__pyx_t_17 = NULL;
  3625. PyArrayObject *__pyx_t_18 = NULL;
  3626. PyArrayObject *__pyx_t_19 = NULL;
  3627. PyArrayObject *__pyx_t_20 = NULL;
  3628. PyArrayObject *__pyx_t_21 = NULL;
  3629. PyArrayObject *__pyx_t_22 = NULL;
  3630. PyArrayObject *__pyx_t_23 = NULL;
  3631. PyArrayObject *__pyx_t_24 = NULL;
  3632. PyArrayObject *__pyx_t_25 = NULL;
  3633. PyArrayObject *__pyx_t_26 = NULL;
  3634. std::vector<double> __pyx_t_27;
  3635. std::vector<__pyx_t_double_complex> __pyx_t_28;
  3636. std::vector<double> __pyx_t_29;
  3637. std::vector<double> __pyx_t_30;
  3638. std::vector<double> __pyx_t_31;
  3639. Py_ssize_t __pyx_t_32;
  3640. PyObject *__pyx_t_33 = NULL;
  3641. PyObject *__pyx_t_34 = NULL;
  3642. PyObject *__pyx_t_35 = NULL;
  3643. PyObject *__pyx_t_36 = NULL;
  3644. int __pyx_lineno = 0;
  3645. const char *__pyx_filename = NULL;
  3646. int __pyx_clineno = 0;
  3647. __Pyx_RefNannySetupContext("fieldnlay", 0);
  3648. __pyx_pybuffer_terms.pybuffer.buf = NULL;
  3649. __pyx_pybuffer_terms.refcount = 0;
  3650. __pyx_pybuffernd_terms.data = NULL;
  3651. __pyx_pybuffernd_terms.rcbuffer = &__pyx_pybuffer_terms;
  3652. __pyx_pybuffer_E.pybuffer.buf = NULL;
  3653. __pyx_pybuffer_E.refcount = 0;
  3654. __pyx_pybuffernd_E.data = NULL;
  3655. __pyx_pybuffernd_E.rcbuffer = &__pyx_pybuffer_E;
  3656. __pyx_pybuffer_H.pybuffer.buf = NULL;
  3657. __pyx_pybuffer_H.refcount = 0;
  3658. __pyx_pybuffernd_H.data = NULL;
  3659. __pyx_pybuffernd_H.rcbuffer = &__pyx_pybuffer_H;
  3660. __pyx_pybuffer_Erx.pybuffer.buf = NULL;
  3661. __pyx_pybuffer_Erx.refcount = 0;
  3662. __pyx_pybuffernd_Erx.data = NULL;
  3663. __pyx_pybuffernd_Erx.rcbuffer = &__pyx_pybuffer_Erx;
  3664. __pyx_pybuffer_Ery.pybuffer.buf = NULL;
  3665. __pyx_pybuffer_Ery.refcount = 0;
  3666. __pyx_pybuffernd_Ery.data = NULL;
  3667. __pyx_pybuffernd_Ery.rcbuffer = &__pyx_pybuffer_Ery;
  3668. __pyx_pybuffer_Erz.pybuffer.buf = NULL;
  3669. __pyx_pybuffer_Erz.refcount = 0;
  3670. __pyx_pybuffernd_Erz.data = NULL;
  3671. __pyx_pybuffernd_Erz.rcbuffer = &__pyx_pybuffer_Erz;
  3672. __pyx_pybuffer_Eix.pybuffer.buf = NULL;
  3673. __pyx_pybuffer_Eix.refcount = 0;
  3674. __pyx_pybuffernd_Eix.data = NULL;
  3675. __pyx_pybuffernd_Eix.rcbuffer = &__pyx_pybuffer_Eix;
  3676. __pyx_pybuffer_Eiy.pybuffer.buf = NULL;
  3677. __pyx_pybuffer_Eiy.refcount = 0;
  3678. __pyx_pybuffernd_Eiy.data = NULL;
  3679. __pyx_pybuffernd_Eiy.rcbuffer = &__pyx_pybuffer_Eiy;
  3680. __pyx_pybuffer_Eiz.pybuffer.buf = NULL;
  3681. __pyx_pybuffer_Eiz.refcount = 0;
  3682. __pyx_pybuffernd_Eiz.data = NULL;
  3683. __pyx_pybuffernd_Eiz.rcbuffer = &__pyx_pybuffer_Eiz;
  3684. __pyx_pybuffer_Hrx.pybuffer.buf = NULL;
  3685. __pyx_pybuffer_Hrx.refcount = 0;
  3686. __pyx_pybuffernd_Hrx.data = NULL;
  3687. __pyx_pybuffernd_Hrx.rcbuffer = &__pyx_pybuffer_Hrx;
  3688. __pyx_pybuffer_Hry.pybuffer.buf = NULL;
  3689. __pyx_pybuffer_Hry.refcount = 0;
  3690. __pyx_pybuffernd_Hry.data = NULL;
  3691. __pyx_pybuffernd_Hry.rcbuffer = &__pyx_pybuffer_Hry;
  3692. __pyx_pybuffer_Hrz.pybuffer.buf = NULL;
  3693. __pyx_pybuffer_Hrz.refcount = 0;
  3694. __pyx_pybuffernd_Hrz.data = NULL;
  3695. __pyx_pybuffernd_Hrz.rcbuffer = &__pyx_pybuffer_Hrz;
  3696. __pyx_pybuffer_Hix.pybuffer.buf = NULL;
  3697. __pyx_pybuffer_Hix.refcount = 0;
  3698. __pyx_pybuffernd_Hix.data = NULL;
  3699. __pyx_pybuffernd_Hix.rcbuffer = &__pyx_pybuffer_Hix;
  3700. __pyx_pybuffer_Hiy.pybuffer.buf = NULL;
  3701. __pyx_pybuffer_Hiy.refcount = 0;
  3702. __pyx_pybuffernd_Hiy.data = NULL;
  3703. __pyx_pybuffernd_Hiy.rcbuffer = &__pyx_pybuffer_Hiy;
  3704. __pyx_pybuffer_Hiz.pybuffer.buf = NULL;
  3705. __pyx_pybuffer_Hiz.refcount = 0;
  3706. __pyx_pybuffernd_Hiz.data = NULL;
  3707. __pyx_pybuffernd_Hiz.rcbuffer = &__pyx_pybuffer_Hiz;
  3708. __pyx_pybuffer_x.pybuffer.buf = NULL;
  3709. __pyx_pybuffer_x.refcount = 0;
  3710. __pyx_pybuffernd_x.data = NULL;
  3711. __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
  3712. __pyx_pybuffer_m.pybuffer.buf = NULL;
  3713. __pyx_pybuffer_m.refcount = 0;
  3714. __pyx_pybuffernd_m.data = NULL;
  3715. __pyx_pybuffernd_m.rcbuffer = &__pyx_pybuffer_m;
  3716. __pyx_pybuffer_coords.pybuffer.buf = NULL;
  3717. __pyx_pybuffer_coords.refcount = 0;
  3718. __pyx_pybuffernd_coords.data = NULL;
  3719. __pyx_pybuffernd_coords.rcbuffer = &__pyx_pybuffer_coords;
  3720. {
  3721. __Pyx_BufFmt_StackElem __pyx_stack[1];
  3722. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3723. }
  3724. __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1];
  3725. {
  3726. __Pyx_BufFmt_StackElem __pyx_stack[1];
  3727. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_m.rcbuffer->pybuffer, (PyObject*)__pyx_v_m, &__Pyx_TypeInfo___pyx_t_double_complex, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3728. }
  3729. __pyx_pybuffernd_m.diminfo[0].strides = __pyx_pybuffernd_m.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_m.diminfo[0].shape = __pyx_pybuffernd_m.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_m.diminfo[1].strides = __pyx_pybuffernd_m.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_m.diminfo[1].shape = __pyx_pybuffernd_m.rcbuffer->pybuffer.shape[1];
  3730. {
  3731. __Pyx_BufFmt_StackElem __pyx_stack[1];
  3732. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coords.rcbuffer->pybuffer, (PyObject*)__pyx_v_coords, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3733. }
  3734. __pyx_pybuffernd_coords.diminfo[0].strides = __pyx_pybuffernd_coords.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coords.diminfo[0].shape = __pyx_pybuffernd_coords.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coords.diminfo[1].strides = __pyx_pybuffernd_coords.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coords.diminfo[1].shape = __pyx_pybuffernd_coords.rcbuffer->pybuffer.shape[1];
  3735. /* "scattnlay_mp.pyx":159
  3736. * cdef Py_ssize_t i
  3737. *
  3738. * cdef np.ndarray[np.int_t, ndim = 1] terms = np.zeros(x.shape[0], dtype = np.int) # <<<<<<<<<<<<<<
  3739. *
  3740. * cdef np.ndarray[np.complex128_t, ndim = 3] E = np.zeros((x.shape[0], coords.shape[0], 3), dtype = np.complex128)
  3741. */
  3742. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3743. __Pyx_GOTREF(__pyx_t_1);
  3744. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3745. __Pyx_GOTREF(__pyx_t_2);
  3746. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3747. __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_x->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3748. __Pyx_GOTREF(__pyx_t_1);
  3749. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3750. __Pyx_GOTREF(__pyx_t_3);
  3751. __Pyx_GIVEREF(__pyx_t_1);
  3752. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  3753. __pyx_t_1 = 0;
  3754. __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3755. __Pyx_GOTREF(__pyx_t_1);
  3756. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3757. __Pyx_GOTREF(__pyx_t_4);
  3758. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3759. __Pyx_GOTREF(__pyx_t_5);
  3760. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3761. if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3762. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3763. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3764. __Pyx_GOTREF(__pyx_t_5);
  3765. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3766. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3767. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3768. if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3769. __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  3770. {
  3771. __Pyx_BufFmt_StackElem __pyx_stack[1];
  3772. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_terms.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
  3773. __pyx_v_terms = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_terms.rcbuffer->pybuffer.buf = NULL;
  3774. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3775. } else {__pyx_pybuffernd_terms.diminfo[0].strides = __pyx_pybuffernd_terms.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_terms.diminfo[0].shape = __pyx_pybuffernd_terms.rcbuffer->pybuffer.shape[0];
  3776. }
  3777. }
  3778. __pyx_t_6 = 0;
  3779. __pyx_v_terms = ((PyArrayObject *)__pyx_t_5);
  3780. __pyx_t_5 = 0;
  3781. /* "scattnlay_mp.pyx":161
  3782. * cdef np.ndarray[np.int_t, ndim = 1] terms = np.zeros(x.shape[0], dtype = np.int)
  3783. *
  3784. * cdef np.ndarray[np.complex128_t, ndim = 3] E = np.zeros((x.shape[0], coords.shape[0], 3), dtype = np.complex128) # <<<<<<<<<<<<<<
  3785. * cdef np.ndarray[np.complex128_t, ndim = 3] H = np.zeros((x.shape[0], coords.shape[0], 3), dtype = np.complex128)
  3786. *
  3787. */
  3788. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3789. __Pyx_GOTREF(__pyx_t_5);
  3790. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3791. __Pyx_GOTREF(__pyx_t_1);
  3792. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3793. __pyx_t_5 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_x->dimensions[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3794. __Pyx_GOTREF(__pyx_t_5);
  3795. __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_coords->dimensions[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3796. __Pyx_GOTREF(__pyx_t_3);
  3797. __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3798. __Pyx_GOTREF(__pyx_t_2);
  3799. __Pyx_GIVEREF(__pyx_t_5);
  3800. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
  3801. __Pyx_GIVEREF(__pyx_t_3);
  3802. PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  3803. __Pyx_INCREF(__pyx_int_3);
  3804. __Pyx_GIVEREF(__pyx_int_3);
  3805. PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_int_3);
  3806. __pyx_t_5 = 0;
  3807. __pyx_t_3 = 0;
  3808. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3809. __Pyx_GOTREF(__pyx_t_3);
  3810. __Pyx_GIVEREF(__pyx_t_2);
  3811. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  3812. __pyx_t_2 = 0;
  3813. __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3814. __Pyx_GOTREF(__pyx_t_2);
  3815. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3816. __Pyx_GOTREF(__pyx_t_5);
  3817. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_complex128); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3818. __Pyx_GOTREF(__pyx_t_4);
  3819. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3820. if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3821. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3822. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3823. __Pyx_GOTREF(__pyx_t_4);
  3824. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3825. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3826. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3827. if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3828. __pyx_t_7 = ((PyArrayObject *)__pyx_t_4);
  3829. {
  3830. __Pyx_BufFmt_StackElem __pyx_stack[1];
  3831. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_E.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo___pyx_t_double_complex, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {
  3832. __pyx_v_E = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_E.rcbuffer->pybuffer.buf = NULL;
  3833. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3834. } else {__pyx_pybuffernd_E.diminfo[0].strides = __pyx_pybuffernd_E.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_E.diminfo[0].shape = __pyx_pybuffernd_E.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_E.diminfo[1].strides = __pyx_pybuffernd_E.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_E.diminfo[1].shape = __pyx_pybuffernd_E.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_E.diminfo[2].strides = __pyx_pybuffernd_E.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_E.diminfo[2].shape = __pyx_pybuffernd_E.rcbuffer->pybuffer.shape[2];
  3835. }
  3836. }
  3837. __pyx_t_7 = 0;
  3838. __pyx_v_E = ((PyArrayObject *)__pyx_t_4);
  3839. __pyx_t_4 = 0;
  3840. /* "scattnlay_mp.pyx":162
  3841. *
  3842. * cdef np.ndarray[np.complex128_t, ndim = 3] E = np.zeros((x.shape[0], coords.shape[0], 3), dtype = np.complex128)
  3843. * cdef np.ndarray[np.complex128_t, ndim = 3] H = np.zeros((x.shape[0], coords.shape[0], 3), dtype = np.complex128) # <<<<<<<<<<<<<<
  3844. *
  3845. * cdef np.ndarray[np.float64_t, ndim = 1] Erx
  3846. */
  3847. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3848. __Pyx_GOTREF(__pyx_t_4);
  3849. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3850. __Pyx_GOTREF(__pyx_t_2);
  3851. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3852. __pyx_t_4 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_x->dimensions[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3853. __Pyx_GOTREF(__pyx_t_4);
  3854. __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_coords->dimensions[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3855. __Pyx_GOTREF(__pyx_t_3);
  3856. __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3857. __Pyx_GOTREF(__pyx_t_1);
  3858. __Pyx_GIVEREF(__pyx_t_4);
  3859. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
  3860. __Pyx_GIVEREF(__pyx_t_3);
  3861. PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  3862. __Pyx_INCREF(__pyx_int_3);
  3863. __Pyx_GIVEREF(__pyx_int_3);
  3864. PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_int_3);
  3865. __pyx_t_4 = 0;
  3866. __pyx_t_3 = 0;
  3867. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3868. __Pyx_GOTREF(__pyx_t_3);
  3869. __Pyx_GIVEREF(__pyx_t_1);
  3870. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  3871. __pyx_t_1 = 0;
  3872. __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3873. __Pyx_GOTREF(__pyx_t_1);
  3874. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3875. __Pyx_GOTREF(__pyx_t_4);
  3876. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_complex128); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3877. __Pyx_GOTREF(__pyx_t_5);
  3878. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3879. if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3880. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3881. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3882. __Pyx_GOTREF(__pyx_t_5);
  3883. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3884. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3885. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3886. if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3887. __pyx_t_8 = ((PyArrayObject *)__pyx_t_5);
  3888. {
  3889. __Pyx_BufFmt_StackElem __pyx_stack[1];
  3890. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_H.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo___pyx_t_double_complex, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {
  3891. __pyx_v_H = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_H.rcbuffer->pybuffer.buf = NULL;
  3892. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3893. } else {__pyx_pybuffernd_H.diminfo[0].strides = __pyx_pybuffernd_H.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_H.diminfo[0].shape = __pyx_pybuffernd_H.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_H.diminfo[1].strides = __pyx_pybuffernd_H.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_H.diminfo[1].shape = __pyx_pybuffernd_H.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_H.diminfo[2].strides = __pyx_pybuffernd_H.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_H.diminfo[2].shape = __pyx_pybuffernd_H.rcbuffer->pybuffer.shape[2];
  3894. }
  3895. }
  3896. __pyx_t_8 = 0;
  3897. __pyx_v_H = ((PyArrayObject *)__pyx_t_5);
  3898. __pyx_t_5 = 0;
  3899. /* "scattnlay_mp.pyx":177
  3900. * cdef np.ndarray[np.float64_t, ndim = 1] Hiz
  3901. *
  3902. * for i in range(x.shape[0]): # <<<<<<<<<<<<<<
  3903. * Erx = np.zeros(coords.shape[0], dtype = np.float64)
  3904. * Ery = np.zeros(coords.shape[0], dtype = np.float64)
  3905. */
  3906. __pyx_t_9 = (__pyx_v_x->dimensions[0]);
  3907. for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
  3908. __pyx_v_i = __pyx_t_10;
  3909. /* "scattnlay_mp.pyx":178
  3910. *
  3911. * for i in range(x.shape[0]):
  3912. * Erx = np.zeros(coords.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  3913. * Ery = np.zeros(coords.shape[0], dtype = np.float64)
  3914. * Erz = np.zeros(coords.shape[0], dtype = np.float64)
  3915. */
  3916. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3917. __Pyx_GOTREF(__pyx_t_5);
  3918. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3919. __Pyx_GOTREF(__pyx_t_1);
  3920. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3921. __pyx_t_5 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_coords->dimensions[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3922. __Pyx_GOTREF(__pyx_t_5);
  3923. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3924. __Pyx_GOTREF(__pyx_t_3);
  3925. __Pyx_GIVEREF(__pyx_t_5);
  3926. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  3927. __pyx_t_5 = 0;
  3928. __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3929. __Pyx_GOTREF(__pyx_t_5);
  3930. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3931. __Pyx_GOTREF(__pyx_t_2);
  3932. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3933. __Pyx_GOTREF(__pyx_t_4);
  3934. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3935. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3936. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3937. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3938. __Pyx_GOTREF(__pyx_t_4);
  3939. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3940. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3941. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3942. if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3943. __pyx_t_11 = ((PyArrayObject *)__pyx_t_4);
  3944. {
  3945. __Pyx_BufFmt_StackElem __pyx_stack[1];
  3946. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Erx.rcbuffer->pybuffer);
  3947. __pyx_t_12 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Erx.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
  3948. if (unlikely(__pyx_t_12 < 0)) {
  3949. PyErr_Fetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
  3950. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Erx.rcbuffer->pybuffer, (PyObject*)__pyx_v_Erx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
  3951. Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15);
  3952. __Pyx_RaiseBufferFallbackError();
  3953. } else {
  3954. PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
  3955. }
  3956. }
  3957. __pyx_pybuffernd_Erx.diminfo[0].strides = __pyx_pybuffernd_Erx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Erx.diminfo[0].shape = __pyx_pybuffernd_Erx.rcbuffer->pybuffer.shape[0];
  3958. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3959. }
  3960. __pyx_t_11 = 0;
  3961. __Pyx_XDECREF_SET(__pyx_v_Erx, ((PyArrayObject *)__pyx_t_4));
  3962. __pyx_t_4 = 0;
  3963. /* "scattnlay_mp.pyx":179
  3964. * for i in range(x.shape[0]):
  3965. * Erx = np.zeros(coords.shape[0], dtype = np.float64)
  3966. * Ery = np.zeros(coords.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  3967. * Erz = np.zeros(coords.shape[0], dtype = np.float64)
  3968. * Eix = np.zeros(coords.shape[0], dtype = np.float64)
  3969. */
  3970. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3971. __Pyx_GOTREF(__pyx_t_4);
  3972. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3973. __Pyx_GOTREF(__pyx_t_5);
  3974. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3975. __pyx_t_4 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_coords->dimensions[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3976. __Pyx_GOTREF(__pyx_t_4);
  3977. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3978. __Pyx_GOTREF(__pyx_t_3);
  3979. __Pyx_GIVEREF(__pyx_t_4);
  3980. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  3981. __pyx_t_4 = 0;
  3982. __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3983. __Pyx_GOTREF(__pyx_t_4);
  3984. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3985. __Pyx_GOTREF(__pyx_t_1);
  3986. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3987. __Pyx_GOTREF(__pyx_t_2);
  3988. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3989. if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3990. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3991. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3992. __Pyx_GOTREF(__pyx_t_2);
  3993. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3994. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3995. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3996. if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3997. __pyx_t_16 = ((PyArrayObject *)__pyx_t_2);
  3998. {
  3999. __Pyx_BufFmt_StackElem __pyx_stack[1];
  4000. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Ery.rcbuffer->pybuffer);
  4001. __pyx_t_12 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Ery.rcbuffer->pybuffer, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
  4002. if (unlikely(__pyx_t_12 < 0)) {
  4003. PyErr_Fetch(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
  4004. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Ery.rcbuffer->pybuffer, (PyObject*)__pyx_v_Ery, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
  4005. Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13);
  4006. __Pyx_RaiseBufferFallbackError();
  4007. } else {
  4008. PyErr_Restore(__pyx_t_15, __pyx_t_14, __pyx_t_13);
  4009. }
  4010. }
  4011. __pyx_pybuffernd_Ery.diminfo[0].strides = __pyx_pybuffernd_Ery.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Ery.diminfo[0].shape = __pyx_pybuffernd_Ery.rcbuffer->pybuffer.shape[0];
  4012. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4013. }
  4014. __pyx_t_16 = 0;
  4015. __Pyx_XDECREF_SET(__pyx_v_Ery, ((PyArrayObject *)__pyx_t_2));
  4016. __pyx_t_2 = 0;
  4017. /* "scattnlay_mp.pyx":180
  4018. * Erx = np.zeros(coords.shape[0], dtype = np.float64)
  4019. * Ery = np.zeros(coords.shape[0], dtype = np.float64)
  4020. * Erz = np.zeros(coords.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  4021. * Eix = np.zeros(coords.shape[0], dtype = np.float64)
  4022. * Eiy = np.zeros(coords.shape[0], dtype = np.float64)
  4023. */
  4024. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4025. __Pyx_GOTREF(__pyx_t_2);
  4026. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4027. __Pyx_GOTREF(__pyx_t_4);
  4028. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4029. __pyx_t_2 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_coords->dimensions[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4030. __Pyx_GOTREF(__pyx_t_2);
  4031. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4032. __Pyx_GOTREF(__pyx_t_3);
  4033. __Pyx_GIVEREF(__pyx_t_2);
  4034. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  4035. __pyx_t_2 = 0;
  4036. __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4037. __Pyx_GOTREF(__pyx_t_2);
  4038. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4039. __Pyx_GOTREF(__pyx_t_5);
  4040. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4041. __Pyx_GOTREF(__pyx_t_1);
  4042. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4043. if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4044. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4045. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4046. __Pyx_GOTREF(__pyx_t_1);
  4047. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4048. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4049. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4050. if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4051. __pyx_t_17 = ((PyArrayObject *)__pyx_t_1);
  4052. {
  4053. __Pyx_BufFmt_StackElem __pyx_stack[1];
  4054. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Erz.rcbuffer->pybuffer);
  4055. __pyx_t_12 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Erz.rcbuffer->pybuffer, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
  4056. if (unlikely(__pyx_t_12 < 0)) {
  4057. PyErr_Fetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
  4058. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Erz.rcbuffer->pybuffer, (PyObject*)__pyx_v_Erz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
  4059. Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15);
  4060. __Pyx_RaiseBufferFallbackError();
  4061. } else {
  4062. PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
  4063. }
  4064. }
  4065. __pyx_pybuffernd_Erz.diminfo[0].strides = __pyx_pybuffernd_Erz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Erz.diminfo[0].shape = __pyx_pybuffernd_Erz.rcbuffer->pybuffer.shape[0];
  4066. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4067. }
  4068. __pyx_t_17 = 0;
  4069. __Pyx_XDECREF_SET(__pyx_v_Erz, ((PyArrayObject *)__pyx_t_1));
  4070. __pyx_t_1 = 0;
  4071. /* "scattnlay_mp.pyx":181
  4072. * Ery = np.zeros(coords.shape[0], dtype = np.float64)
  4073. * Erz = np.zeros(coords.shape[0], dtype = np.float64)
  4074. * Eix = np.zeros(coords.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  4075. * Eiy = np.zeros(coords.shape[0], dtype = np.float64)
  4076. * Eiz = np.zeros(coords.shape[0], dtype = np.float64)
  4077. */
  4078. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4079. __Pyx_GOTREF(__pyx_t_1);
  4080. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4081. __Pyx_GOTREF(__pyx_t_2);
  4082. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4083. __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_coords->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4084. __Pyx_GOTREF(__pyx_t_1);
  4085. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4086. __Pyx_GOTREF(__pyx_t_3);
  4087. __Pyx_GIVEREF(__pyx_t_1);
  4088. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  4089. __pyx_t_1 = 0;
  4090. __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4091. __Pyx_GOTREF(__pyx_t_1);
  4092. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4093. __Pyx_GOTREF(__pyx_t_4);
  4094. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4095. __Pyx_GOTREF(__pyx_t_5);
  4096. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4097. if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4098. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4099. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4100. __Pyx_GOTREF(__pyx_t_5);
  4101. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4102. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4103. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4104. if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4105. __pyx_t_18 = ((PyArrayObject *)__pyx_t_5);
  4106. {
  4107. __Pyx_BufFmt_StackElem __pyx_stack[1];
  4108. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Eix.rcbuffer->pybuffer);
  4109. __pyx_t_12 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Eix.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
  4110. if (unlikely(__pyx_t_12 < 0)) {
  4111. PyErr_Fetch(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
  4112. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Eix.rcbuffer->pybuffer, (PyObject*)__pyx_v_Eix, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
  4113. Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13);
  4114. __Pyx_RaiseBufferFallbackError();
  4115. } else {
  4116. PyErr_Restore(__pyx_t_15, __pyx_t_14, __pyx_t_13);
  4117. }
  4118. }
  4119. __pyx_pybuffernd_Eix.diminfo[0].strides = __pyx_pybuffernd_Eix.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Eix.diminfo[0].shape = __pyx_pybuffernd_Eix.rcbuffer->pybuffer.shape[0];
  4120. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4121. }
  4122. __pyx_t_18 = 0;
  4123. __Pyx_XDECREF_SET(__pyx_v_Eix, ((PyArrayObject *)__pyx_t_5));
  4124. __pyx_t_5 = 0;
  4125. /* "scattnlay_mp.pyx":182
  4126. * Erz = np.zeros(coords.shape[0], dtype = np.float64)
  4127. * Eix = np.zeros(coords.shape[0], dtype = np.float64)
  4128. * Eiy = np.zeros(coords.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  4129. * Eiz = np.zeros(coords.shape[0], dtype = np.float64)
  4130. * Hrx = np.zeros(coords.shape[0], dtype = np.float64)
  4131. */
  4132. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4133. __Pyx_GOTREF(__pyx_t_5);
  4134. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4135. __Pyx_GOTREF(__pyx_t_1);
  4136. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4137. __pyx_t_5 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_coords->dimensions[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4138. __Pyx_GOTREF(__pyx_t_5);
  4139. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4140. __Pyx_GOTREF(__pyx_t_3);
  4141. __Pyx_GIVEREF(__pyx_t_5);
  4142. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  4143. __pyx_t_5 = 0;
  4144. __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4145. __Pyx_GOTREF(__pyx_t_5);
  4146. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4147. __Pyx_GOTREF(__pyx_t_2);
  4148. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4149. __Pyx_GOTREF(__pyx_t_4);
  4150. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4151. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4152. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4153. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4154. __Pyx_GOTREF(__pyx_t_4);
  4155. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4156. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4157. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4158. if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4159. __pyx_t_19 = ((PyArrayObject *)__pyx_t_4);
  4160. {
  4161. __Pyx_BufFmt_StackElem __pyx_stack[1];
  4162. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Eiy.rcbuffer->pybuffer);
  4163. __pyx_t_12 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Eiy.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
  4164. if (unlikely(__pyx_t_12 < 0)) {
  4165. PyErr_Fetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
  4166. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Eiy.rcbuffer->pybuffer, (PyObject*)__pyx_v_Eiy, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
  4167. Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15);
  4168. __Pyx_RaiseBufferFallbackError();
  4169. } else {
  4170. PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
  4171. }
  4172. }
  4173. __pyx_pybuffernd_Eiy.diminfo[0].strides = __pyx_pybuffernd_Eiy.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Eiy.diminfo[0].shape = __pyx_pybuffernd_Eiy.rcbuffer->pybuffer.shape[0];
  4174. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4175. }
  4176. __pyx_t_19 = 0;
  4177. __Pyx_XDECREF_SET(__pyx_v_Eiy, ((PyArrayObject *)__pyx_t_4));
  4178. __pyx_t_4 = 0;
  4179. /* "scattnlay_mp.pyx":183
  4180. * Eix = np.zeros(coords.shape[0], dtype = np.float64)
  4181. * Eiy = np.zeros(coords.shape[0], dtype = np.float64)
  4182. * Eiz = np.zeros(coords.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  4183. * Hrx = np.zeros(coords.shape[0], dtype = np.float64)
  4184. * Hry = np.zeros(coords.shape[0], dtype = np.float64)
  4185. */
  4186. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4187. __Pyx_GOTREF(__pyx_t_4);
  4188. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4189. __Pyx_GOTREF(__pyx_t_5);
  4190. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4191. __pyx_t_4 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_coords->dimensions[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4192. __Pyx_GOTREF(__pyx_t_4);
  4193. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4194. __Pyx_GOTREF(__pyx_t_3);
  4195. __Pyx_GIVEREF(__pyx_t_4);
  4196. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  4197. __pyx_t_4 = 0;
  4198. __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4199. __Pyx_GOTREF(__pyx_t_4);
  4200. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4201. __Pyx_GOTREF(__pyx_t_1);
  4202. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4203. __Pyx_GOTREF(__pyx_t_2);
  4204. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4205. if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4206. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4207. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4208. __Pyx_GOTREF(__pyx_t_2);
  4209. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4210. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4211. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4212. if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4213. __pyx_t_20 = ((PyArrayObject *)__pyx_t_2);
  4214. {
  4215. __Pyx_BufFmt_StackElem __pyx_stack[1];
  4216. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Eiz.rcbuffer->pybuffer);
  4217. __pyx_t_12 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Eiz.rcbuffer->pybuffer, (PyObject*)__pyx_t_20, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
  4218. if (unlikely(__pyx_t_12 < 0)) {
  4219. PyErr_Fetch(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
  4220. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Eiz.rcbuffer->pybuffer, (PyObject*)__pyx_v_Eiz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
  4221. Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13);
  4222. __Pyx_RaiseBufferFallbackError();
  4223. } else {
  4224. PyErr_Restore(__pyx_t_15, __pyx_t_14, __pyx_t_13);
  4225. }
  4226. }
  4227. __pyx_pybuffernd_Eiz.diminfo[0].strides = __pyx_pybuffernd_Eiz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Eiz.diminfo[0].shape = __pyx_pybuffernd_Eiz.rcbuffer->pybuffer.shape[0];
  4228. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4229. }
  4230. __pyx_t_20 = 0;
  4231. __Pyx_XDECREF_SET(__pyx_v_Eiz, ((PyArrayObject *)__pyx_t_2));
  4232. __pyx_t_2 = 0;
  4233. /* "scattnlay_mp.pyx":184
  4234. * Eiy = np.zeros(coords.shape[0], dtype = np.float64)
  4235. * Eiz = np.zeros(coords.shape[0], dtype = np.float64)
  4236. * Hrx = np.zeros(coords.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  4237. * Hry = np.zeros(coords.shape[0], dtype = np.float64)
  4238. * Hrz = np.zeros(coords.shape[0], dtype = np.float64)
  4239. */
  4240. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4241. __Pyx_GOTREF(__pyx_t_2);
  4242. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4243. __Pyx_GOTREF(__pyx_t_4);
  4244. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4245. __pyx_t_2 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_coords->dimensions[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4246. __Pyx_GOTREF(__pyx_t_2);
  4247. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4248. __Pyx_GOTREF(__pyx_t_3);
  4249. __Pyx_GIVEREF(__pyx_t_2);
  4250. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  4251. __pyx_t_2 = 0;
  4252. __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4253. __Pyx_GOTREF(__pyx_t_2);
  4254. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4255. __Pyx_GOTREF(__pyx_t_5);
  4256. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4257. __Pyx_GOTREF(__pyx_t_1);
  4258. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4259. if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4260. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4261. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4262. __Pyx_GOTREF(__pyx_t_1);
  4263. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4264. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4265. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4266. if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4267. __pyx_t_21 = ((PyArrayObject *)__pyx_t_1);
  4268. {
  4269. __Pyx_BufFmt_StackElem __pyx_stack[1];
  4270. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hrx.rcbuffer->pybuffer);
  4271. __pyx_t_12 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Hrx.rcbuffer->pybuffer, (PyObject*)__pyx_t_21, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
  4272. if (unlikely(__pyx_t_12 < 0)) {
  4273. PyErr_Fetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
  4274. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Hrx.rcbuffer->pybuffer, (PyObject*)__pyx_v_Hrx, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
  4275. Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15);
  4276. __Pyx_RaiseBufferFallbackError();
  4277. } else {
  4278. PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
  4279. }
  4280. }
  4281. __pyx_pybuffernd_Hrx.diminfo[0].strides = __pyx_pybuffernd_Hrx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Hrx.diminfo[0].shape = __pyx_pybuffernd_Hrx.rcbuffer->pybuffer.shape[0];
  4282. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4283. }
  4284. __pyx_t_21 = 0;
  4285. __Pyx_XDECREF_SET(__pyx_v_Hrx, ((PyArrayObject *)__pyx_t_1));
  4286. __pyx_t_1 = 0;
  4287. /* "scattnlay_mp.pyx":185
  4288. * Eiz = np.zeros(coords.shape[0], dtype = np.float64)
  4289. * Hrx = np.zeros(coords.shape[0], dtype = np.float64)
  4290. * Hry = np.zeros(coords.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  4291. * Hrz = np.zeros(coords.shape[0], dtype = np.float64)
  4292. * Hix = np.zeros(coords.shape[0], dtype = np.float64)
  4293. */
  4294. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4295. __Pyx_GOTREF(__pyx_t_1);
  4296. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4297. __Pyx_GOTREF(__pyx_t_2);
  4298. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4299. __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_coords->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4300. __Pyx_GOTREF(__pyx_t_1);
  4301. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4302. __Pyx_GOTREF(__pyx_t_3);
  4303. __Pyx_GIVEREF(__pyx_t_1);
  4304. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  4305. __pyx_t_1 = 0;
  4306. __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4307. __Pyx_GOTREF(__pyx_t_1);
  4308. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4309. __Pyx_GOTREF(__pyx_t_4);
  4310. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4311. __Pyx_GOTREF(__pyx_t_5);
  4312. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4313. if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4314. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4315. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4316. __Pyx_GOTREF(__pyx_t_5);
  4317. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4318. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4319. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4320. if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4321. __pyx_t_22 = ((PyArrayObject *)__pyx_t_5);
  4322. {
  4323. __Pyx_BufFmt_StackElem __pyx_stack[1];
  4324. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hry.rcbuffer->pybuffer);
  4325. __pyx_t_12 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Hry.rcbuffer->pybuffer, (PyObject*)__pyx_t_22, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
  4326. if (unlikely(__pyx_t_12 < 0)) {
  4327. PyErr_Fetch(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
  4328. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Hry.rcbuffer->pybuffer, (PyObject*)__pyx_v_Hry, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
  4329. Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13);
  4330. __Pyx_RaiseBufferFallbackError();
  4331. } else {
  4332. PyErr_Restore(__pyx_t_15, __pyx_t_14, __pyx_t_13);
  4333. }
  4334. }
  4335. __pyx_pybuffernd_Hry.diminfo[0].strides = __pyx_pybuffernd_Hry.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Hry.diminfo[0].shape = __pyx_pybuffernd_Hry.rcbuffer->pybuffer.shape[0];
  4336. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4337. }
  4338. __pyx_t_22 = 0;
  4339. __Pyx_XDECREF_SET(__pyx_v_Hry, ((PyArrayObject *)__pyx_t_5));
  4340. __pyx_t_5 = 0;
  4341. /* "scattnlay_mp.pyx":186
  4342. * Hrx = np.zeros(coords.shape[0], dtype = np.float64)
  4343. * Hry = np.zeros(coords.shape[0], dtype = np.float64)
  4344. * Hrz = np.zeros(coords.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  4345. * Hix = np.zeros(coords.shape[0], dtype = np.float64)
  4346. * Hiy = np.zeros(coords.shape[0], dtype = np.float64)
  4347. */
  4348. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4349. __Pyx_GOTREF(__pyx_t_5);
  4350. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4351. __Pyx_GOTREF(__pyx_t_1);
  4352. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4353. __pyx_t_5 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_coords->dimensions[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4354. __Pyx_GOTREF(__pyx_t_5);
  4355. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4356. __Pyx_GOTREF(__pyx_t_3);
  4357. __Pyx_GIVEREF(__pyx_t_5);
  4358. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  4359. __pyx_t_5 = 0;
  4360. __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4361. __Pyx_GOTREF(__pyx_t_5);
  4362. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4363. __Pyx_GOTREF(__pyx_t_2);
  4364. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4365. __Pyx_GOTREF(__pyx_t_4);
  4366. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4367. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4368. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4369. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4370. __Pyx_GOTREF(__pyx_t_4);
  4371. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4372. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4373. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4374. if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4375. __pyx_t_23 = ((PyArrayObject *)__pyx_t_4);
  4376. {
  4377. __Pyx_BufFmt_StackElem __pyx_stack[1];
  4378. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hrz.rcbuffer->pybuffer);
  4379. __pyx_t_12 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Hrz.rcbuffer->pybuffer, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
  4380. if (unlikely(__pyx_t_12 < 0)) {
  4381. PyErr_Fetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
  4382. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Hrz.rcbuffer->pybuffer, (PyObject*)__pyx_v_Hrz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
  4383. Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15);
  4384. __Pyx_RaiseBufferFallbackError();
  4385. } else {
  4386. PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
  4387. }
  4388. }
  4389. __pyx_pybuffernd_Hrz.diminfo[0].strides = __pyx_pybuffernd_Hrz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Hrz.diminfo[0].shape = __pyx_pybuffernd_Hrz.rcbuffer->pybuffer.shape[0];
  4390. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4391. }
  4392. __pyx_t_23 = 0;
  4393. __Pyx_XDECREF_SET(__pyx_v_Hrz, ((PyArrayObject *)__pyx_t_4));
  4394. __pyx_t_4 = 0;
  4395. /* "scattnlay_mp.pyx":187
  4396. * Hry = np.zeros(coords.shape[0], dtype = np.float64)
  4397. * Hrz = np.zeros(coords.shape[0], dtype = np.float64)
  4398. * Hix = np.zeros(coords.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  4399. * Hiy = np.zeros(coords.shape[0], dtype = np.float64)
  4400. * Hiz = np.zeros(coords.shape[0], dtype = np.float64)
  4401. */
  4402. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4403. __Pyx_GOTREF(__pyx_t_4);
  4404. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4405. __Pyx_GOTREF(__pyx_t_5);
  4406. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4407. __pyx_t_4 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_coords->dimensions[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4408. __Pyx_GOTREF(__pyx_t_4);
  4409. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4410. __Pyx_GOTREF(__pyx_t_3);
  4411. __Pyx_GIVEREF(__pyx_t_4);
  4412. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  4413. __pyx_t_4 = 0;
  4414. __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4415. __Pyx_GOTREF(__pyx_t_4);
  4416. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4417. __Pyx_GOTREF(__pyx_t_1);
  4418. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4419. __Pyx_GOTREF(__pyx_t_2);
  4420. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4421. if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4422. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4423. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4424. __Pyx_GOTREF(__pyx_t_2);
  4425. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4426. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4427. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4428. if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4429. __pyx_t_24 = ((PyArrayObject *)__pyx_t_2);
  4430. {
  4431. __Pyx_BufFmt_StackElem __pyx_stack[1];
  4432. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hix.rcbuffer->pybuffer);
  4433. __pyx_t_12 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Hix.rcbuffer->pybuffer, (PyObject*)__pyx_t_24, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
  4434. if (unlikely(__pyx_t_12 < 0)) {
  4435. PyErr_Fetch(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
  4436. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Hix.rcbuffer->pybuffer, (PyObject*)__pyx_v_Hix, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
  4437. Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13);
  4438. __Pyx_RaiseBufferFallbackError();
  4439. } else {
  4440. PyErr_Restore(__pyx_t_15, __pyx_t_14, __pyx_t_13);
  4441. }
  4442. }
  4443. __pyx_pybuffernd_Hix.diminfo[0].strides = __pyx_pybuffernd_Hix.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Hix.diminfo[0].shape = __pyx_pybuffernd_Hix.rcbuffer->pybuffer.shape[0];
  4444. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4445. }
  4446. __pyx_t_24 = 0;
  4447. __Pyx_XDECREF_SET(__pyx_v_Hix, ((PyArrayObject *)__pyx_t_2));
  4448. __pyx_t_2 = 0;
  4449. /* "scattnlay_mp.pyx":188
  4450. * Hrz = np.zeros(coords.shape[0], dtype = np.float64)
  4451. * Hix = np.zeros(coords.shape[0], dtype = np.float64)
  4452. * Hiy = np.zeros(coords.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  4453. * Hiz = np.zeros(coords.shape[0], dtype = np.float64)
  4454. *
  4455. */
  4456. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4457. __Pyx_GOTREF(__pyx_t_2);
  4458. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4459. __Pyx_GOTREF(__pyx_t_4);
  4460. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4461. __pyx_t_2 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_coords->dimensions[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4462. __Pyx_GOTREF(__pyx_t_2);
  4463. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4464. __Pyx_GOTREF(__pyx_t_3);
  4465. __Pyx_GIVEREF(__pyx_t_2);
  4466. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  4467. __pyx_t_2 = 0;
  4468. __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4469. __Pyx_GOTREF(__pyx_t_2);
  4470. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4471. __Pyx_GOTREF(__pyx_t_5);
  4472. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4473. __Pyx_GOTREF(__pyx_t_1);
  4474. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4475. if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4476. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4477. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4478. __Pyx_GOTREF(__pyx_t_1);
  4479. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4480. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4481. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4482. if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4483. __pyx_t_25 = ((PyArrayObject *)__pyx_t_1);
  4484. {
  4485. __Pyx_BufFmt_StackElem __pyx_stack[1];
  4486. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hiy.rcbuffer->pybuffer);
  4487. __pyx_t_12 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Hiy.rcbuffer->pybuffer, (PyObject*)__pyx_t_25, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
  4488. if (unlikely(__pyx_t_12 < 0)) {
  4489. PyErr_Fetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
  4490. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Hiy.rcbuffer->pybuffer, (PyObject*)__pyx_v_Hiy, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
  4491. Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15);
  4492. __Pyx_RaiseBufferFallbackError();
  4493. } else {
  4494. PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
  4495. }
  4496. }
  4497. __pyx_pybuffernd_Hiy.diminfo[0].strides = __pyx_pybuffernd_Hiy.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Hiy.diminfo[0].shape = __pyx_pybuffernd_Hiy.rcbuffer->pybuffer.shape[0];
  4498. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4499. }
  4500. __pyx_t_25 = 0;
  4501. __Pyx_XDECREF_SET(__pyx_v_Hiy, ((PyArrayObject *)__pyx_t_1));
  4502. __pyx_t_1 = 0;
  4503. /* "scattnlay_mp.pyx":189
  4504. * Hix = np.zeros(coords.shape[0], dtype = np.float64)
  4505. * Hiy = np.zeros(coords.shape[0], dtype = np.float64)
  4506. * Hiz = np.zeros(coords.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  4507. *
  4508. * terms[i] = nField(x.shape[1], pl, x[i].copy('C'), m[i].copy('C'), nmax, coords.shape[0], coords[:, 0].copy('C'), coords[:, 1].copy('C'), coords[:, 2].copy('C'), npy2c(Erx), npy2c(Ery), npy2c(Erz), npy2c(Eix), npy2c(Eiy), npy2c(Eiz), npy2c(Hrx), npy2c(Hry), npy2c(Hrz), npy2c(Hix), npy2c(Hiy), npy2c(Hiz))
  4509. */
  4510. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4511. __Pyx_GOTREF(__pyx_t_1);
  4512. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4513. __Pyx_GOTREF(__pyx_t_2);
  4514. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4515. __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_coords->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4516. __Pyx_GOTREF(__pyx_t_1);
  4517. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4518. __Pyx_GOTREF(__pyx_t_3);
  4519. __Pyx_GIVEREF(__pyx_t_1);
  4520. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  4521. __pyx_t_1 = 0;
  4522. __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4523. __Pyx_GOTREF(__pyx_t_1);
  4524. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4525. __Pyx_GOTREF(__pyx_t_4);
  4526. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4527. __Pyx_GOTREF(__pyx_t_5);
  4528. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4529. if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4530. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4531. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4532. __Pyx_GOTREF(__pyx_t_5);
  4533. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4534. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4535. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4536. if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4537. __pyx_t_26 = ((PyArrayObject *)__pyx_t_5);
  4538. {
  4539. __Pyx_BufFmt_StackElem __pyx_stack[1];
  4540. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hiz.rcbuffer->pybuffer);
  4541. __pyx_t_12 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Hiz.rcbuffer->pybuffer, (PyObject*)__pyx_t_26, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
  4542. if (unlikely(__pyx_t_12 < 0)) {
  4543. PyErr_Fetch(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
  4544. if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Hiz.rcbuffer->pybuffer, (PyObject*)__pyx_v_Hiz, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
  4545. Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13);
  4546. __Pyx_RaiseBufferFallbackError();
  4547. } else {
  4548. PyErr_Restore(__pyx_t_15, __pyx_t_14, __pyx_t_13);
  4549. }
  4550. }
  4551. __pyx_pybuffernd_Hiz.diminfo[0].strides = __pyx_pybuffernd_Hiz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Hiz.diminfo[0].shape = __pyx_pybuffernd_Hiz.rcbuffer->pybuffer.shape[0];
  4552. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4553. }
  4554. __pyx_t_26 = 0;
  4555. __Pyx_XDECREF_SET(__pyx_v_Hiz, ((PyArrayObject *)__pyx_t_5));
  4556. __pyx_t_5 = 0;
  4557. /* "scattnlay_mp.pyx":191
  4558. * Hiz = np.zeros(coords.shape[0], dtype = np.float64)
  4559. *
  4560. * terms[i] = nField(x.shape[1], pl, x[i].copy('C'), m[i].copy('C'), nmax, coords.shape[0], coords[:, 0].copy('C'), coords[:, 1].copy('C'), coords[:, 2].copy('C'), npy2c(Erx), npy2c(Ery), npy2c(Erz), npy2c(Eix), npy2c(Eiy), npy2c(Eiz), npy2c(Hrx), npy2c(Hry), npy2c(Hrz), npy2c(Hix), npy2c(Hiy), npy2c(Hiz)) # <<<<<<<<<<<<<<
  4561. *
  4562. * E[i] = np.vstack((Erx.copy('C') + 1.0j*Eix.copy('C'), Ery.copy('C') + 1.0j*Eiy.copy('C'), Erz.copy('C') + 1.0j*Eiz.copy('C'))).transpose()
  4563. */
  4564. __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_x), __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  4565. __Pyx_GOTREF(__pyx_t_5);
  4566. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4567. __Pyx_GOTREF(__pyx_t_1);
  4568. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4569. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4570. __Pyx_GOTREF(__pyx_t_5);
  4571. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4572. __pyx_t_27 = __pyx_convert_vector_from_py_double(__pyx_t_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4573. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4574. __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_m), __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  4575. __Pyx_GOTREF(__pyx_t_5);
  4576. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4577. __Pyx_GOTREF(__pyx_t_1);
  4578. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4579. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4580. __Pyx_GOTREF(__pyx_t_5);
  4581. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4582. __pyx_t_28 = __pyx_convert_vector_from_py___pyx_t_double_complex(__pyx_t_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4583. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4584. __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_coords), __pyx_tuple__19); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  4585. __Pyx_GOTREF(__pyx_t_5);
  4586. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4587. __Pyx_GOTREF(__pyx_t_1);
  4588. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4589. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4590. __Pyx_GOTREF(__pyx_t_5);
  4591. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4592. __pyx_t_29 = __pyx_convert_vector_from_py_double(__pyx_t_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4593. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4594. __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_coords), __pyx_tuple__22); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  4595. __Pyx_GOTREF(__pyx_t_5);
  4596. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4597. __Pyx_GOTREF(__pyx_t_1);
  4598. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4599. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4600. __Pyx_GOTREF(__pyx_t_5);
  4601. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4602. __pyx_t_30 = __pyx_convert_vector_from_py_double(__pyx_t_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4603. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4604. __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_coords), __pyx_tuple__25); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  4605. __Pyx_GOTREF(__pyx_t_5);
  4606. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4607. __Pyx_GOTREF(__pyx_t_1);
  4608. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4609. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4610. __Pyx_GOTREF(__pyx_t_5);
  4611. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4612. __pyx_t_31 = __pyx_convert_vector_from_py_double(__pyx_t_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4613. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4614. __pyx_t_32 = __pyx_v_i;
  4615. __pyx_t_12 = -1;
  4616. if (__pyx_t_32 < 0) {
  4617. __pyx_t_32 += __pyx_pybuffernd_terms.diminfo[0].shape;
  4618. if (unlikely(__pyx_t_32 < 0)) __pyx_t_12 = 0;
  4619. } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_terms.diminfo[0].shape)) __pyx_t_12 = 0;
  4620. if (unlikely(__pyx_t_12 != -1)) {
  4621. __Pyx_RaiseBufferIndexError(__pyx_t_12);
  4622. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4623. }
  4624. *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int_t *, __pyx_pybuffernd_terms.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_terms.diminfo[0].strides) = nField((__pyx_v_x->dimensions[1]), __pyx_v_pl, __pyx_t_27, __pyx_t_28, __pyx_v_nmax, (__pyx_v_coords->dimensions[0]), __pyx_t_29, __pyx_t_30, __pyx_t_31, __pyx_f_12scattnlay_mp_npy2c(((PyArrayObject *)__pyx_v_Erx)), __pyx_f_12scattnlay_mp_npy2c(((PyArrayObject *)__pyx_v_Ery)), __pyx_f_12scattnlay_mp_npy2c(((PyArrayObject *)__pyx_v_Erz)), __pyx_f_12scattnlay_mp_npy2c(((PyArrayObject *)__pyx_v_Eix)), __pyx_f_12scattnlay_mp_npy2c(((PyArrayObject *)__pyx_v_Eiy)), __pyx_f_12scattnlay_mp_npy2c(((PyArrayObject *)__pyx_v_Eiz)), __pyx_f_12scattnlay_mp_npy2c(((PyArrayObject *)__pyx_v_Hrx)), __pyx_f_12scattnlay_mp_npy2c(((PyArrayObject *)__pyx_v_Hry)), __pyx_f_12scattnlay_mp_npy2c(((PyArrayObject *)__pyx_v_Hrz)), __pyx_f_12scattnlay_mp_npy2c(((PyArrayObject *)__pyx_v_Hix)), __pyx_f_12scattnlay_mp_npy2c(((PyArrayObject *)__pyx_v_Hiy)), __pyx_f_12scattnlay_mp_npy2c(((PyArrayObject *)__pyx_v_Hiz)));
  4625. /* "scattnlay_mp.pyx":193
  4626. * terms[i] = nField(x.shape[1], pl, x[i].copy('C'), m[i].copy('C'), nmax, coords.shape[0], coords[:, 0].copy('C'), coords[:, 1].copy('C'), coords[:, 2].copy('C'), npy2c(Erx), npy2c(Ery), npy2c(Erz), npy2c(Eix), npy2c(Eiy), npy2c(Eiz), npy2c(Hrx), npy2c(Hry), npy2c(Hrz), npy2c(Hix), npy2c(Hiy), npy2c(Hiz))
  4627. *
  4628. * E[i] = np.vstack((Erx.copy('C') + 1.0j*Eix.copy('C'), Ery.copy('C') + 1.0j*Eiy.copy('C'), Erz.copy('C') + 1.0j*Eiz.copy('C'))).transpose() # <<<<<<<<<<<<<<
  4629. * H[i] = np.vstack((Hrx.copy('C') + 1.0j*Hix.copy('C'), Hry.copy('C') + 1.0j*Hiy.copy('C'), Hrz.copy('C') + 1.0j*Hiz.copy('C'))).transpose()
  4630. *
  4631. */
  4632. __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4633. __Pyx_GOTREF(__pyx_t_3);
  4634. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_vstack); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4635. __Pyx_GOTREF(__pyx_t_2);
  4636. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4637. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_Erx), __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4638. __Pyx_GOTREF(__pyx_t_3);
  4639. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4640. __Pyx_GOTREF(__pyx_t_4);
  4641. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4642. __pyx_t_3 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4643. __Pyx_GOTREF(__pyx_t_3);
  4644. __pyx_t_33 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_Eix), __pyx_n_s_copy); if (unlikely(!__pyx_t_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4645. __Pyx_GOTREF(__pyx_t_33);
  4646. __pyx_t_34 = __Pyx_PyObject_Call(__pyx_t_33, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4647. __Pyx_GOTREF(__pyx_t_34);
  4648. __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  4649. __pyx_t_33 = PyNumber_Multiply(__pyx_t_3, __pyx_t_34); if (unlikely(!__pyx_t_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4650. __Pyx_GOTREF(__pyx_t_33);
  4651. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4652. __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
  4653. __pyx_t_34 = PyNumber_Add(__pyx_t_4, __pyx_t_33); if (unlikely(!__pyx_t_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4654. __Pyx_GOTREF(__pyx_t_34);
  4655. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4656. __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  4657. __pyx_t_33 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_Ery), __pyx_n_s_copy); if (unlikely(!__pyx_t_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4658. __Pyx_GOTREF(__pyx_t_33);
  4659. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_33, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4660. __Pyx_GOTREF(__pyx_t_4);
  4661. __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  4662. __pyx_t_33 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4663. __Pyx_GOTREF(__pyx_t_33);
  4664. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_Eiy), __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4665. __Pyx_GOTREF(__pyx_t_3);
  4666. __pyx_t_35 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4667. __Pyx_GOTREF(__pyx_t_35);
  4668. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4669. __pyx_t_3 = PyNumber_Multiply(__pyx_t_33, __pyx_t_35); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4670. __Pyx_GOTREF(__pyx_t_3);
  4671. __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  4672. __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0;
  4673. __pyx_t_35 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4674. __Pyx_GOTREF(__pyx_t_35);
  4675. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4676. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4677. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_Erz), __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4678. __Pyx_GOTREF(__pyx_t_3);
  4679. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4680. __Pyx_GOTREF(__pyx_t_4);
  4681. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4682. __pyx_t_3 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4683. __Pyx_GOTREF(__pyx_t_3);
  4684. __pyx_t_33 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_Eiz), __pyx_n_s_copy); if (unlikely(!__pyx_t_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4685. __Pyx_GOTREF(__pyx_t_33);
  4686. __pyx_t_36 = __Pyx_PyObject_Call(__pyx_t_33, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4687. __Pyx_GOTREF(__pyx_t_36);
  4688. __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  4689. __pyx_t_33 = PyNumber_Multiply(__pyx_t_3, __pyx_t_36); if (unlikely(!__pyx_t_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4690. __Pyx_GOTREF(__pyx_t_33);
  4691. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4692. __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
  4693. __pyx_t_36 = PyNumber_Add(__pyx_t_4, __pyx_t_33); if (unlikely(!__pyx_t_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4694. __Pyx_GOTREF(__pyx_t_36);
  4695. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4696. __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  4697. __pyx_t_33 = PyTuple_New(3); if (unlikely(!__pyx_t_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4698. __Pyx_GOTREF(__pyx_t_33);
  4699. __Pyx_GIVEREF(__pyx_t_34);
  4700. PyTuple_SET_ITEM(__pyx_t_33, 0, __pyx_t_34);
  4701. __Pyx_GIVEREF(__pyx_t_35);
  4702. PyTuple_SET_ITEM(__pyx_t_33, 1, __pyx_t_35);
  4703. __Pyx_GIVEREF(__pyx_t_36);
  4704. PyTuple_SET_ITEM(__pyx_t_33, 2, __pyx_t_36);
  4705. __pyx_t_34 = 0;
  4706. __pyx_t_35 = 0;
  4707. __pyx_t_36 = 0;
  4708. __pyx_t_36 = NULL;
  4709. if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
  4710. __pyx_t_36 = PyMethod_GET_SELF(__pyx_t_2);
  4711. if (likely(__pyx_t_36)) {
  4712. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  4713. __Pyx_INCREF(__pyx_t_36);
  4714. __Pyx_INCREF(function);
  4715. __Pyx_DECREF_SET(__pyx_t_2, function);
  4716. }
  4717. }
  4718. if (!__pyx_t_36) {
  4719. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_33); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4720. __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  4721. __Pyx_GOTREF(__pyx_t_1);
  4722. } else {
  4723. __pyx_t_35 = PyTuple_New(1+1); if (unlikely(!__pyx_t_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4724. __Pyx_GOTREF(__pyx_t_35);
  4725. __Pyx_GIVEREF(__pyx_t_36); PyTuple_SET_ITEM(__pyx_t_35, 0, __pyx_t_36); __pyx_t_36 = NULL;
  4726. __Pyx_GIVEREF(__pyx_t_33);
  4727. PyTuple_SET_ITEM(__pyx_t_35, 0+1, __pyx_t_33);
  4728. __pyx_t_33 = 0;
  4729. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_35, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4730. __Pyx_GOTREF(__pyx_t_1);
  4731. __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0;
  4732. }
  4733. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4734. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_transpose); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4735. __Pyx_GOTREF(__pyx_t_2);
  4736. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4737. __pyx_t_1 = NULL;
  4738. if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
  4739. __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
  4740. if (likely(__pyx_t_1)) {
  4741. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  4742. __Pyx_INCREF(__pyx_t_1);
  4743. __Pyx_INCREF(function);
  4744. __Pyx_DECREF_SET(__pyx_t_2, function);
  4745. }
  4746. }
  4747. if (__pyx_t_1) {
  4748. __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4749. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4750. } else {
  4751. __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4752. }
  4753. __Pyx_GOTREF(__pyx_t_5);
  4754. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4755. if (unlikely(__Pyx_SetItemInt(((PyObject *)__pyx_v_E), __pyx_v_i, __pyx_t_5, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4756. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4757. /* "scattnlay_mp.pyx":194
  4758. *
  4759. * E[i] = np.vstack((Erx.copy('C') + 1.0j*Eix.copy('C'), Ery.copy('C') + 1.0j*Eiy.copy('C'), Erz.copy('C') + 1.0j*Eiz.copy('C'))).transpose()
  4760. * H[i] = np.vstack((Hrx.copy('C') + 1.0j*Hix.copy('C'), Hry.copy('C') + 1.0j*Hiy.copy('C'), Hrz.copy('C') + 1.0j*Hiz.copy('C'))).transpose() # <<<<<<<<<<<<<<
  4761. *
  4762. * return terms, E, H
  4763. */
  4764. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4765. __Pyx_GOTREF(__pyx_t_1);
  4766. __pyx_t_35 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_vstack); if (unlikely(!__pyx_t_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4767. __Pyx_GOTREF(__pyx_t_35);
  4768. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4769. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_Hrx), __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4770. __Pyx_GOTREF(__pyx_t_1);
  4771. __pyx_t_33 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4772. __Pyx_GOTREF(__pyx_t_33);
  4773. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4774. __pyx_t_1 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4775. __Pyx_GOTREF(__pyx_t_1);
  4776. __pyx_t_36 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_Hix), __pyx_n_s_copy); if (unlikely(!__pyx_t_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4777. __Pyx_GOTREF(__pyx_t_36);
  4778. __pyx_t_34 = __Pyx_PyObject_Call(__pyx_t_36, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4779. __Pyx_GOTREF(__pyx_t_34);
  4780. __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
  4781. __pyx_t_36 = PyNumber_Multiply(__pyx_t_1, __pyx_t_34); if (unlikely(!__pyx_t_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4782. __Pyx_GOTREF(__pyx_t_36);
  4783. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4784. __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
  4785. __pyx_t_34 = PyNumber_Add(__pyx_t_33, __pyx_t_36); if (unlikely(!__pyx_t_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4786. __Pyx_GOTREF(__pyx_t_34);
  4787. __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  4788. __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
  4789. __pyx_t_36 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_Hry), __pyx_n_s_copy); if (unlikely(!__pyx_t_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4790. __Pyx_GOTREF(__pyx_t_36);
  4791. __pyx_t_33 = __Pyx_PyObject_Call(__pyx_t_36, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4792. __Pyx_GOTREF(__pyx_t_33);
  4793. __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
  4794. __pyx_t_36 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4795. __Pyx_GOTREF(__pyx_t_36);
  4796. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_Hiy), __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4797. __Pyx_GOTREF(__pyx_t_1);
  4798. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4799. __Pyx_GOTREF(__pyx_t_4);
  4800. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4801. __pyx_t_1 = PyNumber_Multiply(__pyx_t_36, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4802. __Pyx_GOTREF(__pyx_t_1);
  4803. __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
  4804. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4805. __pyx_t_4 = PyNumber_Add(__pyx_t_33, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4806. __Pyx_GOTREF(__pyx_t_4);
  4807. __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  4808. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4809. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_Hrz), __pyx_n_s_copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4810. __Pyx_GOTREF(__pyx_t_1);
  4811. __pyx_t_33 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__37, NULL); if (unlikely(!__pyx_t_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4812. __Pyx_GOTREF(__pyx_t_33);
  4813. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4814. __pyx_t_1 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4815. __Pyx_GOTREF(__pyx_t_1);
  4816. __pyx_t_36 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_Hiz), __pyx_n_s_copy); if (unlikely(!__pyx_t_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4817. __Pyx_GOTREF(__pyx_t_36);
  4818. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_36, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4819. __Pyx_GOTREF(__pyx_t_3);
  4820. __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
  4821. __pyx_t_36 = PyNumber_Multiply(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4822. __Pyx_GOTREF(__pyx_t_36);
  4823. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4824. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4825. __pyx_t_3 = PyNumber_Add(__pyx_t_33, __pyx_t_36); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4826. __Pyx_GOTREF(__pyx_t_3);
  4827. __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  4828. __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
  4829. __pyx_t_36 = PyTuple_New(3); if (unlikely(!__pyx_t_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4830. __Pyx_GOTREF(__pyx_t_36);
  4831. __Pyx_GIVEREF(__pyx_t_34);
  4832. PyTuple_SET_ITEM(__pyx_t_36, 0, __pyx_t_34);
  4833. __Pyx_GIVEREF(__pyx_t_4);
  4834. PyTuple_SET_ITEM(__pyx_t_36, 1, __pyx_t_4);
  4835. __Pyx_GIVEREF(__pyx_t_3);
  4836. PyTuple_SET_ITEM(__pyx_t_36, 2, __pyx_t_3);
  4837. __pyx_t_34 = 0;
  4838. __pyx_t_4 = 0;
  4839. __pyx_t_3 = 0;
  4840. __pyx_t_3 = NULL;
  4841. if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_35))) {
  4842. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_35);
  4843. if (likely(__pyx_t_3)) {
  4844. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_35);
  4845. __Pyx_INCREF(__pyx_t_3);
  4846. __Pyx_INCREF(function);
  4847. __Pyx_DECREF_SET(__pyx_t_35, function);
  4848. }
  4849. }
  4850. if (!__pyx_t_3) {
  4851. __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_35, __pyx_t_36); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4852. __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
  4853. __Pyx_GOTREF(__pyx_t_2);
  4854. } else {
  4855. __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4856. __Pyx_GOTREF(__pyx_t_4);
  4857. __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
  4858. __Pyx_GIVEREF(__pyx_t_36);
  4859. PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_36);
  4860. __pyx_t_36 = 0;
  4861. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_35, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4862. __Pyx_GOTREF(__pyx_t_2);
  4863. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4864. }
  4865. __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0;
  4866. __pyx_t_35 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_transpose); if (unlikely(!__pyx_t_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4867. __Pyx_GOTREF(__pyx_t_35);
  4868. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4869. __pyx_t_2 = NULL;
  4870. if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_35))) {
  4871. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_35);
  4872. if (likely(__pyx_t_2)) {
  4873. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_35);
  4874. __Pyx_INCREF(__pyx_t_2);
  4875. __Pyx_INCREF(function);
  4876. __Pyx_DECREF_SET(__pyx_t_35, function);
  4877. }
  4878. }
  4879. if (__pyx_t_2) {
  4880. __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_35, __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4881. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4882. } else {
  4883. __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_35); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4884. }
  4885. __Pyx_GOTREF(__pyx_t_5);
  4886. __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0;
  4887. if (unlikely(__Pyx_SetItemInt(((PyObject *)__pyx_v_H), __pyx_v_i, __pyx_t_5, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4888. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4889. }
  4890. /* "scattnlay_mp.pyx":196
  4891. * H[i] = np.vstack((Hrx.copy('C') + 1.0j*Hix.copy('C'), Hry.copy('C') + 1.0j*Hiy.copy('C'), Hrz.copy('C') + 1.0j*Hiz.copy('C'))).transpose()
  4892. *
  4893. * return terms, E, H # <<<<<<<<<<<<<<
  4894. *
  4895. */
  4896. __Pyx_XDECREF(__pyx_r);
  4897. __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4898. __Pyx_GOTREF(__pyx_t_5);
  4899. __Pyx_INCREF(((PyObject *)__pyx_v_terms));
  4900. __Pyx_GIVEREF(((PyObject *)__pyx_v_terms));
  4901. PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_terms));
  4902. __Pyx_INCREF(((PyObject *)__pyx_v_E));
  4903. __Pyx_GIVEREF(((PyObject *)__pyx_v_E));
  4904. PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_E));
  4905. __Pyx_INCREF(((PyObject *)__pyx_v_H));
  4906. __Pyx_GIVEREF(((PyObject *)__pyx_v_H));
  4907. PyTuple_SET_ITEM(__pyx_t_5, 2, ((PyObject *)__pyx_v_H));
  4908. __pyx_r = __pyx_t_5;
  4909. __pyx_t_5 = 0;
  4910. goto __pyx_L0;
  4911. /* "scattnlay_mp.pyx":156
  4912. * return terms, Qext, Qsca, Qabs, Qbk, Qpr, g, Albedo, S1, S2
  4913. *
  4914. * def fieldnlay(np.ndarray[np.float64_t, ndim = 2] x, np.ndarray[np.complex128_t, ndim = 2] m, np.ndarray[np.float64_t, ndim = 2] coords, np.int_t nmax = -1, np.int_t pl = -1): # <<<<<<<<<<<<<<
  4915. * cdef Py_ssize_t i
  4916. *
  4917. */
  4918. /* function exit code */
  4919. __pyx_L1_error:;
  4920. __Pyx_XDECREF(__pyx_t_1);
  4921. __Pyx_XDECREF(__pyx_t_2);
  4922. __Pyx_XDECREF(__pyx_t_3);
  4923. __Pyx_XDECREF(__pyx_t_4);
  4924. __Pyx_XDECREF(__pyx_t_5);
  4925. __Pyx_XDECREF(__pyx_t_33);
  4926. __Pyx_XDECREF(__pyx_t_34);
  4927. __Pyx_XDECREF(__pyx_t_35);
  4928. __Pyx_XDECREF(__pyx_t_36);
  4929. { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
  4930. __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
  4931. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_E.rcbuffer->pybuffer);
  4932. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Eix.rcbuffer->pybuffer);
  4933. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Eiy.rcbuffer->pybuffer);
  4934. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Eiz.rcbuffer->pybuffer);
  4935. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Erx.rcbuffer->pybuffer);
  4936. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Ery.rcbuffer->pybuffer);
  4937. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Erz.rcbuffer->pybuffer);
  4938. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_H.rcbuffer->pybuffer);
  4939. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hix.rcbuffer->pybuffer);
  4940. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hiy.rcbuffer->pybuffer);
  4941. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hiz.rcbuffer->pybuffer);
  4942. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hrx.rcbuffer->pybuffer);
  4943. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hry.rcbuffer->pybuffer);
  4944. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hrz.rcbuffer->pybuffer);
  4945. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coords.rcbuffer->pybuffer);
  4946. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_m.rcbuffer->pybuffer);
  4947. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_terms.rcbuffer->pybuffer);
  4948. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
  4949. __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  4950. __Pyx_AddTraceback("scattnlay_mp.fieldnlay", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4951. __pyx_r = NULL;
  4952. goto __pyx_L2;
  4953. __pyx_L0:;
  4954. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_E.rcbuffer->pybuffer);
  4955. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Eix.rcbuffer->pybuffer);
  4956. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Eiy.rcbuffer->pybuffer);
  4957. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Eiz.rcbuffer->pybuffer);
  4958. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Erx.rcbuffer->pybuffer);
  4959. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Ery.rcbuffer->pybuffer);
  4960. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Erz.rcbuffer->pybuffer);
  4961. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_H.rcbuffer->pybuffer);
  4962. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hix.rcbuffer->pybuffer);
  4963. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hiy.rcbuffer->pybuffer);
  4964. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hiz.rcbuffer->pybuffer);
  4965. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hrx.rcbuffer->pybuffer);
  4966. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hry.rcbuffer->pybuffer);
  4967. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hrz.rcbuffer->pybuffer);
  4968. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coords.rcbuffer->pybuffer);
  4969. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_m.rcbuffer->pybuffer);
  4970. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_terms.rcbuffer->pybuffer);
  4971. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
  4972. __pyx_L2:;
  4973. __Pyx_XDECREF((PyObject *)__pyx_v_terms);
  4974. __Pyx_XDECREF((PyObject *)__pyx_v_E);
  4975. __Pyx_XDECREF((PyObject *)__pyx_v_H);
  4976. __Pyx_XDECREF((PyObject *)__pyx_v_Erx);
  4977. __Pyx_XDECREF((PyObject *)__pyx_v_Ery);
  4978. __Pyx_XDECREF((PyObject *)__pyx_v_Erz);
  4979. __Pyx_XDECREF((PyObject *)__pyx_v_Eix);
  4980. __Pyx_XDECREF((PyObject *)__pyx_v_Eiy);
  4981. __Pyx_XDECREF((PyObject *)__pyx_v_Eiz);
  4982. __Pyx_XDECREF((PyObject *)__pyx_v_Hrx);
  4983. __Pyx_XDECREF((PyObject *)__pyx_v_Hry);
  4984. __Pyx_XDECREF((PyObject *)__pyx_v_Hrz);
  4985. __Pyx_XDECREF((PyObject *)__pyx_v_Hix);
  4986. __Pyx_XDECREF((PyObject *)__pyx_v_Hiy);
  4987. __Pyx_XDECREF((PyObject *)__pyx_v_Hiz);
  4988. __Pyx_XGIVEREF(__pyx_r);
  4989. __Pyx_RefNannyFinishContext();
  4990. return __pyx_r;
  4991. }
  4992. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":197
  4993. * # experimental exception made for __getbuffer__ and __releasebuffer__
  4994. * # -- the details of this may change.
  4995. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
  4996. * # This implementation of getbuffer is geared towards Cython
  4997. * # requirements, and does not yet fullfill the PEP.
  4998. */
  4999. /* Python wrapper */
  5000. static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
  5001. static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  5002. int __pyx_r;
  5003. __Pyx_RefNannyDeclarations
  5004. __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  5005. __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
  5006. /* function exit code */
  5007. __Pyx_RefNannyFinishContext();
  5008. return __pyx_r;
  5009. }
  5010. static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  5011. int __pyx_v_copy_shape;
  5012. int __pyx_v_i;
  5013. int __pyx_v_ndim;
  5014. int __pyx_v_endian_detector;
  5015. int __pyx_v_little_endian;
  5016. int __pyx_v_t;
  5017. char *__pyx_v_f;
  5018. PyArray_Descr *__pyx_v_descr = 0;
  5019. int __pyx_v_offset;
  5020. int __pyx_v_hasfields;
  5021. int __pyx_r;
  5022. __Pyx_RefNannyDeclarations
  5023. int __pyx_t_1;
  5024. int __pyx_t_2;
  5025. PyObject *__pyx_t_3 = NULL;
  5026. int __pyx_t_4;
  5027. int __pyx_t_5;
  5028. PyObject *__pyx_t_6 = NULL;
  5029. char *__pyx_t_7;
  5030. int __pyx_lineno = 0;
  5031. const char *__pyx_filename = NULL;
  5032. int __pyx_clineno = 0;
  5033. __Pyx_RefNannySetupContext("__getbuffer__", 0);
  5034. if (__pyx_v_info != NULL) {
  5035. __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
  5036. __Pyx_GIVEREF(__pyx_v_info->obj);
  5037. }
  5038. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":203
  5039. * # of flags
  5040. *
  5041. * if info == NULL: return # <<<<<<<<<<<<<<
  5042. *
  5043. * cdef int copy_shape, i, ndim
  5044. */
  5045. __pyx_t_1 = ((__pyx_v_info == NULL) != 0);
  5046. if (__pyx_t_1) {
  5047. __pyx_r = 0;
  5048. goto __pyx_L0;
  5049. }
  5050. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":206
  5051. *
  5052. * cdef int copy_shape, i, ndim
  5053. * cdef int endian_detector = 1 # <<<<<<<<<<<<<<
  5054. * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
  5055. *
  5056. */
  5057. __pyx_v_endian_detector = 1;
  5058. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":207
  5059. * cdef int copy_shape, i, ndim
  5060. * cdef int endian_detector = 1
  5061. * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
  5062. *
  5063. * ndim = PyArray_NDIM(self)
  5064. */
  5065. __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
  5066. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":209
  5067. * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
  5068. *
  5069. * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<<
  5070. *
  5071. * if sizeof(npy_intp) != sizeof(Py_ssize_t):
  5072. */
  5073. __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
  5074. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":211
  5075. * ndim = PyArray_NDIM(self)
  5076. *
  5077. * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
  5078. * copy_shape = 1
  5079. * else:
  5080. */
  5081. __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
  5082. if (__pyx_t_1) {
  5083. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":212
  5084. *
  5085. * if sizeof(npy_intp) != sizeof(Py_ssize_t):
  5086. * copy_shape = 1 # <<<<<<<<<<<<<<
  5087. * else:
  5088. * copy_shape = 0
  5089. */
  5090. __pyx_v_copy_shape = 1;
  5091. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":211
  5092. * ndim = PyArray_NDIM(self)
  5093. *
  5094. * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
  5095. * copy_shape = 1
  5096. * else:
  5097. */
  5098. goto __pyx_L4;
  5099. }
  5100. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":214
  5101. * copy_shape = 1
  5102. * else:
  5103. * copy_shape = 0 # <<<<<<<<<<<<<<
  5104. *
  5105. * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
  5106. */
  5107. /*else*/ {
  5108. __pyx_v_copy_shape = 0;
  5109. }
  5110. __pyx_L4:;
  5111. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":216
  5112. * copy_shape = 0
  5113. *
  5114. * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
  5115. * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
  5116. * raise ValueError(u"ndarray is not C contiguous")
  5117. */
  5118. __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
  5119. if (__pyx_t_2) {
  5120. } else {
  5121. __pyx_t_1 = __pyx_t_2;
  5122. goto __pyx_L6_bool_binop_done;
  5123. }
  5124. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":217
  5125. *
  5126. * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
  5127. * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<<
  5128. * raise ValueError(u"ndarray is not C contiguous")
  5129. *
  5130. */
  5131. __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0);
  5132. __pyx_t_1 = __pyx_t_2;
  5133. __pyx_L6_bool_binop_done:;
  5134. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":216
  5135. * copy_shape = 0
  5136. *
  5137. * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
  5138. * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
  5139. * raise ValueError(u"ndarray is not C contiguous")
  5140. */
  5141. if (__pyx_t_1) {
  5142. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":218
  5143. * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
  5144. * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
  5145. * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
  5146. *
  5147. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  5148. */
  5149. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5150. __Pyx_GOTREF(__pyx_t_3);
  5151. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  5152. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5153. {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5154. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":216
  5155. * copy_shape = 0
  5156. *
  5157. * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
  5158. * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
  5159. * raise ValueError(u"ndarray is not C contiguous")
  5160. */
  5161. }
  5162. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":220
  5163. * raise ValueError(u"ndarray is not C contiguous")
  5164. *
  5165. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
  5166. * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
  5167. * raise ValueError(u"ndarray is not Fortran contiguous")
  5168. */
  5169. __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
  5170. if (__pyx_t_2) {
  5171. } else {
  5172. __pyx_t_1 = __pyx_t_2;
  5173. goto __pyx_L9_bool_binop_done;
  5174. }
  5175. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":221
  5176. *
  5177. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  5178. * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<<
  5179. * raise ValueError(u"ndarray is not Fortran contiguous")
  5180. *
  5181. */
  5182. __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0);
  5183. __pyx_t_1 = __pyx_t_2;
  5184. __pyx_L9_bool_binop_done:;
  5185. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":220
  5186. * raise ValueError(u"ndarray is not C contiguous")
  5187. *
  5188. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
  5189. * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
  5190. * raise ValueError(u"ndarray is not Fortran contiguous")
  5191. */
  5192. if (__pyx_t_1) {
  5193. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":222
  5194. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  5195. * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
  5196. * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
  5197. *
  5198. * info.buf = PyArray_DATA(self)
  5199. */
  5200. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__40, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5201. __Pyx_GOTREF(__pyx_t_3);
  5202. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  5203. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5204. {__pyx_filename = __pyx_f[1]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5205. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":220
  5206. * raise ValueError(u"ndarray is not C contiguous")
  5207. *
  5208. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
  5209. * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
  5210. * raise ValueError(u"ndarray is not Fortran contiguous")
  5211. */
  5212. }
  5213. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":224
  5214. * raise ValueError(u"ndarray is not Fortran contiguous")
  5215. *
  5216. * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<<
  5217. * info.ndim = ndim
  5218. * if copy_shape:
  5219. */
  5220. __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
  5221. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":225
  5222. *
  5223. * info.buf = PyArray_DATA(self)
  5224. * info.ndim = ndim # <<<<<<<<<<<<<<
  5225. * if copy_shape:
  5226. * # Allocate new buffer for strides and shape info.
  5227. */
  5228. __pyx_v_info->ndim = __pyx_v_ndim;
  5229. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":226
  5230. * info.buf = PyArray_DATA(self)
  5231. * info.ndim = ndim
  5232. * if copy_shape: # <<<<<<<<<<<<<<
  5233. * # Allocate new buffer for strides and shape info.
  5234. * # This is allocated as one block, strides first.
  5235. */
  5236. __pyx_t_1 = (__pyx_v_copy_shape != 0);
  5237. if (__pyx_t_1) {
  5238. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":229
  5239. * # Allocate new buffer for strides and shape info.
  5240. * # This is allocated as one block, strides first.
  5241. * info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2) # <<<<<<<<<<<<<<
  5242. * info.shape = info.strides + ndim
  5243. * for i in range(ndim):
  5244. */
  5245. __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2)));
  5246. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":230
  5247. * # This is allocated as one block, strides first.
  5248. * info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
  5249. * info.shape = info.strides + ndim # <<<<<<<<<<<<<<
  5250. * for i in range(ndim):
  5251. * info.strides[i] = PyArray_STRIDES(self)[i]
  5252. */
  5253. __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
  5254. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":231
  5255. * info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
  5256. * info.shape = info.strides + ndim
  5257. * for i in range(ndim): # <<<<<<<<<<<<<<
  5258. * info.strides[i] = PyArray_STRIDES(self)[i]
  5259. * info.shape[i] = PyArray_DIMS(self)[i]
  5260. */
  5261. __pyx_t_4 = __pyx_v_ndim;
  5262. for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
  5263. __pyx_v_i = __pyx_t_5;
  5264. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":232
  5265. * info.shape = info.strides + ndim
  5266. * for i in range(ndim):
  5267. * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<<
  5268. * info.shape[i] = PyArray_DIMS(self)[i]
  5269. * else:
  5270. */
  5271. (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
  5272. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":233
  5273. * for i in range(ndim):
  5274. * info.strides[i] = PyArray_STRIDES(self)[i]
  5275. * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<<
  5276. * else:
  5277. * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
  5278. */
  5279. (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
  5280. }
  5281. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":226
  5282. * info.buf = PyArray_DATA(self)
  5283. * info.ndim = ndim
  5284. * if copy_shape: # <<<<<<<<<<<<<<
  5285. * # Allocate new buffer for strides and shape info.
  5286. * # This is allocated as one block, strides first.
  5287. */
  5288. goto __pyx_L11;
  5289. }
  5290. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":235
  5291. * info.shape[i] = PyArray_DIMS(self)[i]
  5292. * else:
  5293. * info.strides = <Py_ssize_t*>PyArray_STRIDES(self) # <<<<<<<<<<<<<<
  5294. * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
  5295. * info.suboffsets = NULL
  5296. */
  5297. /*else*/ {
  5298. __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
  5299. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":236
  5300. * else:
  5301. * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
  5302. * info.shape = <Py_ssize_t*>PyArray_DIMS(self) # <<<<<<<<<<<<<<
  5303. * info.suboffsets = NULL
  5304. * info.itemsize = PyArray_ITEMSIZE(self)
  5305. */
  5306. __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
  5307. }
  5308. __pyx_L11:;
  5309. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":237
  5310. * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
  5311. * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
  5312. * info.suboffsets = NULL # <<<<<<<<<<<<<<
  5313. * info.itemsize = PyArray_ITEMSIZE(self)
  5314. * info.readonly = not PyArray_ISWRITEABLE(self)
  5315. */
  5316. __pyx_v_info->suboffsets = NULL;
  5317. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":238
  5318. * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
  5319. * info.suboffsets = NULL
  5320. * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<<
  5321. * info.readonly = not PyArray_ISWRITEABLE(self)
  5322. *
  5323. */
  5324. __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
  5325. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":239
  5326. * info.suboffsets = NULL
  5327. * info.itemsize = PyArray_ITEMSIZE(self)
  5328. * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<<
  5329. *
  5330. * cdef int t
  5331. */
  5332. __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
  5333. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":242
  5334. *
  5335. * cdef int t
  5336. * cdef char* f = NULL # <<<<<<<<<<<<<<
  5337. * cdef dtype descr = self.descr
  5338. * cdef int offset
  5339. */
  5340. __pyx_v_f = NULL;
  5341. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":243
  5342. * cdef int t
  5343. * cdef char* f = NULL
  5344. * cdef dtype descr = self.descr # <<<<<<<<<<<<<<
  5345. * cdef int offset
  5346. *
  5347. */
  5348. __pyx_t_3 = ((PyObject *)__pyx_v_self->descr);
  5349. __Pyx_INCREF(__pyx_t_3);
  5350. __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
  5351. __pyx_t_3 = 0;
  5352. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":246
  5353. * cdef int offset
  5354. *
  5355. * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<<
  5356. *
  5357. * if not hasfields and not copy_shape:
  5358. */
  5359. __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);
  5360. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":248
  5361. * cdef bint hasfields = PyDataType_HASFIELDS(descr)
  5362. *
  5363. * if not hasfields and not copy_shape: # <<<<<<<<<<<<<<
  5364. * # do not call releasebuffer
  5365. * info.obj = None
  5366. */
  5367. __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0);
  5368. if (__pyx_t_2) {
  5369. } else {
  5370. __pyx_t_1 = __pyx_t_2;
  5371. goto __pyx_L15_bool_binop_done;
  5372. }
  5373. __pyx_t_2 = ((!(__pyx_v_copy_shape != 0)) != 0);
  5374. __pyx_t_1 = __pyx_t_2;
  5375. __pyx_L15_bool_binop_done:;
  5376. if (__pyx_t_1) {
  5377. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":250
  5378. * if not hasfields and not copy_shape:
  5379. * # do not call releasebuffer
  5380. * info.obj = None # <<<<<<<<<<<<<<
  5381. * else:
  5382. * # need to call releasebuffer
  5383. */
  5384. __Pyx_INCREF(Py_None);
  5385. __Pyx_GIVEREF(Py_None);
  5386. __Pyx_GOTREF(__pyx_v_info->obj);
  5387. __Pyx_DECREF(__pyx_v_info->obj);
  5388. __pyx_v_info->obj = Py_None;
  5389. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":248
  5390. * cdef bint hasfields = PyDataType_HASFIELDS(descr)
  5391. *
  5392. * if not hasfields and not copy_shape: # <<<<<<<<<<<<<<
  5393. * # do not call releasebuffer
  5394. * info.obj = None
  5395. */
  5396. goto __pyx_L14;
  5397. }
  5398. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":253
  5399. * else:
  5400. * # need to call releasebuffer
  5401. * info.obj = self # <<<<<<<<<<<<<<
  5402. *
  5403. * if not hasfields:
  5404. */
  5405. /*else*/ {
  5406. __Pyx_INCREF(((PyObject *)__pyx_v_self));
  5407. __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  5408. __Pyx_GOTREF(__pyx_v_info->obj);
  5409. __Pyx_DECREF(__pyx_v_info->obj);
  5410. __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
  5411. }
  5412. __pyx_L14:;
  5413. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":255
  5414. * info.obj = self
  5415. *
  5416. * if not hasfields: # <<<<<<<<<<<<<<
  5417. * t = descr.type_num
  5418. * if ((descr.byteorder == c'>' and little_endian) or
  5419. */
  5420. __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0);
  5421. if (__pyx_t_1) {
  5422. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":256
  5423. *
  5424. * if not hasfields:
  5425. * t = descr.type_num # <<<<<<<<<<<<<<
  5426. * if ((descr.byteorder == c'>' and little_endian) or
  5427. * (descr.byteorder == c'<' and not little_endian)):
  5428. */
  5429. __pyx_t_4 = __pyx_v_descr->type_num;
  5430. __pyx_v_t = __pyx_t_4;
  5431. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":257
  5432. * if not hasfields:
  5433. * t = descr.type_num
  5434. * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
  5435. * (descr.byteorder == c'<' and not little_endian)):
  5436. * raise ValueError(u"Non-native byte order not supported")
  5437. */
  5438. __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
  5439. if (!__pyx_t_2) {
  5440. goto __pyx_L20_next_or;
  5441. } else {
  5442. }
  5443. __pyx_t_2 = (__pyx_v_little_endian != 0);
  5444. if (!__pyx_t_2) {
  5445. } else {
  5446. __pyx_t_1 = __pyx_t_2;
  5447. goto __pyx_L19_bool_binop_done;
  5448. }
  5449. __pyx_L20_next_or:;
  5450. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":258
  5451. * t = descr.type_num
  5452. * if ((descr.byteorder == c'>' and little_endian) or
  5453. * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
  5454. * raise ValueError(u"Non-native byte order not supported")
  5455. * if t == NPY_BYTE: f = "b"
  5456. */
  5457. __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
  5458. if (__pyx_t_2) {
  5459. } else {
  5460. __pyx_t_1 = __pyx_t_2;
  5461. goto __pyx_L19_bool_binop_done;
  5462. }
  5463. __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
  5464. __pyx_t_1 = __pyx_t_2;
  5465. __pyx_L19_bool_binop_done:;
  5466. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":257
  5467. * if not hasfields:
  5468. * t = descr.type_num
  5469. * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
  5470. * (descr.byteorder == c'<' and not little_endian)):
  5471. * raise ValueError(u"Non-native byte order not supported")
  5472. */
  5473. if (__pyx_t_1) {
  5474. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":259
  5475. * if ((descr.byteorder == c'>' and little_endian) or
  5476. * (descr.byteorder == c'<' and not little_endian)):
  5477. * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
  5478. * if t == NPY_BYTE: f = "b"
  5479. * elif t == NPY_UBYTE: f = "B"
  5480. */
  5481. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__41, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5482. __Pyx_GOTREF(__pyx_t_3);
  5483. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  5484. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5485. {__pyx_filename = __pyx_f[1]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5486. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":257
  5487. * if not hasfields:
  5488. * t = descr.type_num
  5489. * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
  5490. * (descr.byteorder == c'<' and not little_endian)):
  5491. * raise ValueError(u"Non-native byte order not supported")
  5492. */
  5493. }
  5494. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":260
  5495. * (descr.byteorder == c'<' and not little_endian)):
  5496. * raise ValueError(u"Non-native byte order not supported")
  5497. * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<<
  5498. * elif t == NPY_UBYTE: f = "B"
  5499. * elif t == NPY_SHORT: f = "h"
  5500. */
  5501. switch (__pyx_v_t) {
  5502. case NPY_BYTE:
  5503. __pyx_v_f = __pyx_k_b;
  5504. break;
  5505. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":261
  5506. * raise ValueError(u"Non-native byte order not supported")
  5507. * if t == NPY_BYTE: f = "b"
  5508. * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<<
  5509. * elif t == NPY_SHORT: f = "h"
  5510. * elif t == NPY_USHORT: f = "H"
  5511. */
  5512. case NPY_UBYTE:
  5513. __pyx_v_f = __pyx_k_B;
  5514. break;
  5515. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":262
  5516. * if t == NPY_BYTE: f = "b"
  5517. * elif t == NPY_UBYTE: f = "B"
  5518. * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<<
  5519. * elif t == NPY_USHORT: f = "H"
  5520. * elif t == NPY_INT: f = "i"
  5521. */
  5522. case NPY_SHORT:
  5523. __pyx_v_f = __pyx_k_h;
  5524. break;
  5525. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":263
  5526. * elif t == NPY_UBYTE: f = "B"
  5527. * elif t == NPY_SHORT: f = "h"
  5528. * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<<
  5529. * elif t == NPY_INT: f = "i"
  5530. * elif t == NPY_UINT: f = "I"
  5531. */
  5532. case NPY_USHORT:
  5533. __pyx_v_f = __pyx_k_H;
  5534. break;
  5535. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":264
  5536. * elif t == NPY_SHORT: f = "h"
  5537. * elif t == NPY_USHORT: f = "H"
  5538. * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<<
  5539. * elif t == NPY_UINT: f = "I"
  5540. * elif t == NPY_LONG: f = "l"
  5541. */
  5542. case NPY_INT:
  5543. __pyx_v_f = __pyx_k_i;
  5544. break;
  5545. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":265
  5546. * elif t == NPY_USHORT: f = "H"
  5547. * elif t == NPY_INT: f = "i"
  5548. * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<<
  5549. * elif t == NPY_LONG: f = "l"
  5550. * elif t == NPY_ULONG: f = "L"
  5551. */
  5552. case NPY_UINT:
  5553. __pyx_v_f = __pyx_k_I;
  5554. break;
  5555. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":266
  5556. * elif t == NPY_INT: f = "i"
  5557. * elif t == NPY_UINT: f = "I"
  5558. * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<<
  5559. * elif t == NPY_ULONG: f = "L"
  5560. * elif t == NPY_LONGLONG: f = "q"
  5561. */
  5562. case NPY_LONG:
  5563. __pyx_v_f = __pyx_k_l;
  5564. break;
  5565. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":267
  5566. * elif t == NPY_UINT: f = "I"
  5567. * elif t == NPY_LONG: f = "l"
  5568. * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<<
  5569. * elif t == NPY_LONGLONG: f = "q"
  5570. * elif t == NPY_ULONGLONG: f = "Q"
  5571. */
  5572. case NPY_ULONG:
  5573. __pyx_v_f = __pyx_k_L;
  5574. break;
  5575. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":268
  5576. * elif t == NPY_LONG: f = "l"
  5577. * elif t == NPY_ULONG: f = "L"
  5578. * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<<
  5579. * elif t == NPY_ULONGLONG: f = "Q"
  5580. * elif t == NPY_FLOAT: f = "f"
  5581. */
  5582. case NPY_LONGLONG:
  5583. __pyx_v_f = __pyx_k_q;
  5584. break;
  5585. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":269
  5586. * elif t == NPY_ULONG: f = "L"
  5587. * elif t == NPY_LONGLONG: f = "q"
  5588. * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<<
  5589. * elif t == NPY_FLOAT: f = "f"
  5590. * elif t == NPY_DOUBLE: f = "d"
  5591. */
  5592. case NPY_ULONGLONG:
  5593. __pyx_v_f = __pyx_k_Q;
  5594. break;
  5595. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":270
  5596. * elif t == NPY_LONGLONG: f = "q"
  5597. * elif t == NPY_ULONGLONG: f = "Q"
  5598. * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<<
  5599. * elif t == NPY_DOUBLE: f = "d"
  5600. * elif t == NPY_LONGDOUBLE: f = "g"
  5601. */
  5602. case NPY_FLOAT:
  5603. __pyx_v_f = __pyx_k_f;
  5604. break;
  5605. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":271
  5606. * elif t == NPY_ULONGLONG: f = "Q"
  5607. * elif t == NPY_FLOAT: f = "f"
  5608. * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<<
  5609. * elif t == NPY_LONGDOUBLE: f = "g"
  5610. * elif t == NPY_CFLOAT: f = "Zf"
  5611. */
  5612. case NPY_DOUBLE:
  5613. __pyx_v_f = __pyx_k_d;
  5614. break;
  5615. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":272
  5616. * elif t == NPY_FLOAT: f = "f"
  5617. * elif t == NPY_DOUBLE: f = "d"
  5618. * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<<
  5619. * elif t == NPY_CFLOAT: f = "Zf"
  5620. * elif t == NPY_CDOUBLE: f = "Zd"
  5621. */
  5622. case NPY_LONGDOUBLE:
  5623. __pyx_v_f = __pyx_k_g;
  5624. break;
  5625. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":273
  5626. * elif t == NPY_DOUBLE: f = "d"
  5627. * elif t == NPY_LONGDOUBLE: f = "g"
  5628. * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<<
  5629. * elif t == NPY_CDOUBLE: f = "Zd"
  5630. * elif t == NPY_CLONGDOUBLE: f = "Zg"
  5631. */
  5632. case NPY_CFLOAT:
  5633. __pyx_v_f = __pyx_k_Zf;
  5634. break;
  5635. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":274
  5636. * elif t == NPY_LONGDOUBLE: f = "g"
  5637. * elif t == NPY_CFLOAT: f = "Zf"
  5638. * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<<
  5639. * elif t == NPY_CLONGDOUBLE: f = "Zg"
  5640. * elif t == NPY_OBJECT: f = "O"
  5641. */
  5642. case NPY_CDOUBLE:
  5643. __pyx_v_f = __pyx_k_Zd;
  5644. break;
  5645. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":275
  5646. * elif t == NPY_CFLOAT: f = "Zf"
  5647. * elif t == NPY_CDOUBLE: f = "Zd"
  5648. * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<<
  5649. * elif t == NPY_OBJECT: f = "O"
  5650. * else:
  5651. */
  5652. case NPY_CLONGDOUBLE:
  5653. __pyx_v_f = __pyx_k_Zg;
  5654. break;
  5655. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":276
  5656. * elif t == NPY_CDOUBLE: f = "Zd"
  5657. * elif t == NPY_CLONGDOUBLE: f = "Zg"
  5658. * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<<
  5659. * else:
  5660. * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  5661. */
  5662. case NPY_OBJECT:
  5663. __pyx_v_f = __pyx_k_O;
  5664. break;
  5665. default:
  5666. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":278
  5667. * elif t == NPY_OBJECT: f = "O"
  5668. * else:
  5669. * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
  5670. * info.format = f
  5671. * return
  5672. */
  5673. __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5674. __Pyx_GOTREF(__pyx_t_3);
  5675. __pyx_t_6 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5676. __Pyx_GOTREF(__pyx_t_6);
  5677. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5678. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5679. __Pyx_GOTREF(__pyx_t_3);
  5680. __Pyx_GIVEREF(__pyx_t_6);
  5681. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
  5682. __pyx_t_6 = 0;
  5683. __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5684. __Pyx_GOTREF(__pyx_t_6);
  5685. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5686. __Pyx_Raise(__pyx_t_6, 0, 0, 0);
  5687. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5688. {__pyx_filename = __pyx_f[1]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5689. break;
  5690. }
  5691. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":279
  5692. * else:
  5693. * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  5694. * info.format = f # <<<<<<<<<<<<<<
  5695. * return
  5696. * else:
  5697. */
  5698. __pyx_v_info->format = __pyx_v_f;
  5699. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":280
  5700. * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  5701. * info.format = f
  5702. * return # <<<<<<<<<<<<<<
  5703. * else:
  5704. * info.format = <char*>stdlib.malloc(_buffer_format_string_len)
  5705. */
  5706. __pyx_r = 0;
  5707. goto __pyx_L0;
  5708. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":255
  5709. * info.obj = self
  5710. *
  5711. * if not hasfields: # <<<<<<<<<<<<<<
  5712. * t = descr.type_num
  5713. * if ((descr.byteorder == c'>' and little_endian) or
  5714. */
  5715. }
  5716. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":282
  5717. * return
  5718. * else:
  5719. * info.format = <char*>stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<<
  5720. * info.format[0] = c'^' # Native data types, manual alignment
  5721. * offset = 0
  5722. */
  5723. /*else*/ {
  5724. __pyx_v_info->format = ((char *)malloc(0xFF));
  5725. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":283
  5726. * else:
  5727. * info.format = <char*>stdlib.malloc(_buffer_format_string_len)
  5728. * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<<
  5729. * offset = 0
  5730. * f = _util_dtypestring(descr, info.format + 1,
  5731. */
  5732. (__pyx_v_info->format[0]) = '^';
  5733. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":284
  5734. * info.format = <char*>stdlib.malloc(_buffer_format_string_len)
  5735. * info.format[0] = c'^' # Native data types, manual alignment
  5736. * offset = 0 # <<<<<<<<<<<<<<
  5737. * f = _util_dtypestring(descr, info.format + 1,
  5738. * info.format + _buffer_format_string_len,
  5739. */
  5740. __pyx_v_offset = 0;
  5741. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":285
  5742. * info.format[0] = c'^' # Native data types, manual alignment
  5743. * offset = 0
  5744. * f = _util_dtypestring(descr, info.format + 1, # <<<<<<<<<<<<<<
  5745. * info.format + _buffer_format_string_len,
  5746. * &offset)
  5747. */
  5748. __pyx_t_7 = __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_7 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5749. __pyx_v_f = __pyx_t_7;
  5750. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":288
  5751. * info.format + _buffer_format_string_len,
  5752. * &offset)
  5753. * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<<
  5754. *
  5755. * def __releasebuffer__(ndarray self, Py_buffer* info):
  5756. */
  5757. (__pyx_v_f[0]) = '\x00';
  5758. }
  5759. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":197
  5760. * # experimental exception made for __getbuffer__ and __releasebuffer__
  5761. * # -- the details of this may change.
  5762. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
  5763. * # This implementation of getbuffer is geared towards Cython
  5764. * # requirements, and does not yet fullfill the PEP.
  5765. */
  5766. /* function exit code */
  5767. __pyx_r = 0;
  5768. goto __pyx_L0;
  5769. __pyx_L1_error:;
  5770. __Pyx_XDECREF(__pyx_t_3);
  5771. __Pyx_XDECREF(__pyx_t_6);
  5772. __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5773. __pyx_r = -1;
  5774. if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
  5775. __Pyx_GOTREF(__pyx_v_info->obj);
  5776. __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
  5777. }
  5778. goto __pyx_L2;
  5779. __pyx_L0:;
  5780. if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) {
  5781. __Pyx_GOTREF(Py_None);
  5782. __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
  5783. }
  5784. __pyx_L2:;
  5785. __Pyx_XDECREF((PyObject *)__pyx_v_descr);
  5786. __Pyx_RefNannyFinishContext();
  5787. return __pyx_r;
  5788. }
  5789. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":290
  5790. * f[0] = c'\0' # Terminate format string
  5791. *
  5792. * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
  5793. * if PyArray_HASFIELDS(self):
  5794. * stdlib.free(info.format)
  5795. */
  5796. /* Python wrapper */
  5797. static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
  5798. static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  5799. __Pyx_RefNannyDeclarations
  5800. __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
  5801. __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
  5802. /* function exit code */
  5803. __Pyx_RefNannyFinishContext();
  5804. }
  5805. static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  5806. __Pyx_RefNannyDeclarations
  5807. int __pyx_t_1;
  5808. __Pyx_RefNannySetupContext("__releasebuffer__", 0);
  5809. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":291
  5810. *
  5811. * def __releasebuffer__(ndarray self, Py_buffer* info):
  5812. * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
  5813. * stdlib.free(info.format)
  5814. * if sizeof(npy_intp) != sizeof(Py_ssize_t):
  5815. */
  5816. __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
  5817. if (__pyx_t_1) {
  5818. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":292
  5819. * def __releasebuffer__(ndarray self, Py_buffer* info):
  5820. * if PyArray_HASFIELDS(self):
  5821. * stdlib.free(info.format) # <<<<<<<<<<<<<<
  5822. * if sizeof(npy_intp) != sizeof(Py_ssize_t):
  5823. * stdlib.free(info.strides)
  5824. */
  5825. free(__pyx_v_info->format);
  5826. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":291
  5827. *
  5828. * def __releasebuffer__(ndarray self, Py_buffer* info):
  5829. * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
  5830. * stdlib.free(info.format)
  5831. * if sizeof(npy_intp) != sizeof(Py_ssize_t):
  5832. */
  5833. }
  5834. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":293
  5835. * if PyArray_HASFIELDS(self):
  5836. * stdlib.free(info.format)
  5837. * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
  5838. * stdlib.free(info.strides)
  5839. * # info.shape was stored after info.strides in the same block
  5840. */
  5841. __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
  5842. if (__pyx_t_1) {
  5843. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":294
  5844. * stdlib.free(info.format)
  5845. * if sizeof(npy_intp) != sizeof(Py_ssize_t):
  5846. * stdlib.free(info.strides) # <<<<<<<<<<<<<<
  5847. * # info.shape was stored after info.strides in the same block
  5848. *
  5849. */
  5850. free(__pyx_v_info->strides);
  5851. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":293
  5852. * if PyArray_HASFIELDS(self):
  5853. * stdlib.free(info.format)
  5854. * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
  5855. * stdlib.free(info.strides)
  5856. * # info.shape was stored after info.strides in the same block
  5857. */
  5858. }
  5859. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":290
  5860. * f[0] = c'\0' # Terminate format string
  5861. *
  5862. * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
  5863. * if PyArray_HASFIELDS(self):
  5864. * stdlib.free(info.format)
  5865. */
  5866. /* function exit code */
  5867. __Pyx_RefNannyFinishContext();
  5868. }
  5869. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":770
  5870. * ctypedef npy_cdouble complex_t
  5871. *
  5872. * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
  5873. * return PyArray_MultiIterNew(1, <void*>a)
  5874. *
  5875. */
  5876. static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
  5877. PyObject *__pyx_r = NULL;
  5878. __Pyx_RefNannyDeclarations
  5879. PyObject *__pyx_t_1 = NULL;
  5880. int __pyx_lineno = 0;
  5881. const char *__pyx_filename = NULL;
  5882. int __pyx_clineno = 0;
  5883. __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
  5884. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":771
  5885. *
  5886. * cdef inline object PyArray_MultiIterNew1(a):
  5887. * return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<<
  5888. *
  5889. * cdef inline object PyArray_MultiIterNew2(a, b):
  5890. */
  5891. __Pyx_XDECREF(__pyx_r);
  5892. __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5893. __Pyx_GOTREF(__pyx_t_1);
  5894. __pyx_r = __pyx_t_1;
  5895. __pyx_t_1 = 0;
  5896. goto __pyx_L0;
  5897. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":770
  5898. * ctypedef npy_cdouble complex_t
  5899. *
  5900. * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
  5901. * return PyArray_MultiIterNew(1, <void*>a)
  5902. *
  5903. */
  5904. /* function exit code */
  5905. __pyx_L1_error:;
  5906. __Pyx_XDECREF(__pyx_t_1);
  5907. __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5908. __pyx_r = 0;
  5909. __pyx_L0:;
  5910. __Pyx_XGIVEREF(__pyx_r);
  5911. __Pyx_RefNannyFinishContext();
  5912. return __pyx_r;
  5913. }
  5914. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":773
  5915. * return PyArray_MultiIterNew(1, <void*>a)
  5916. *
  5917. * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
  5918. * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
  5919. *
  5920. */
  5921. static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  5922. PyObject *__pyx_r = NULL;
  5923. __Pyx_RefNannyDeclarations
  5924. PyObject *__pyx_t_1 = NULL;
  5925. int __pyx_lineno = 0;
  5926. const char *__pyx_filename = NULL;
  5927. int __pyx_clineno = 0;
  5928. __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
  5929. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":774
  5930. *
  5931. * cdef inline object PyArray_MultiIterNew2(a, b):
  5932. * return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<<
  5933. *
  5934. * cdef inline object PyArray_MultiIterNew3(a, b, c):
  5935. */
  5936. __Pyx_XDECREF(__pyx_r);
  5937. __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5938. __Pyx_GOTREF(__pyx_t_1);
  5939. __pyx_r = __pyx_t_1;
  5940. __pyx_t_1 = 0;
  5941. goto __pyx_L0;
  5942. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":773
  5943. * return PyArray_MultiIterNew(1, <void*>a)
  5944. *
  5945. * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
  5946. * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
  5947. *
  5948. */
  5949. /* function exit code */
  5950. __pyx_L1_error:;
  5951. __Pyx_XDECREF(__pyx_t_1);
  5952. __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5953. __pyx_r = 0;
  5954. __pyx_L0:;
  5955. __Pyx_XGIVEREF(__pyx_r);
  5956. __Pyx_RefNannyFinishContext();
  5957. return __pyx_r;
  5958. }
  5959. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":776
  5960. * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
  5961. *
  5962. * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
  5963. * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
  5964. *
  5965. */
  5966. static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
  5967. PyObject *__pyx_r = NULL;
  5968. __Pyx_RefNannyDeclarations
  5969. PyObject *__pyx_t_1 = NULL;
  5970. int __pyx_lineno = 0;
  5971. const char *__pyx_filename = NULL;
  5972. int __pyx_clineno = 0;
  5973. __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
  5974. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":777
  5975. *
  5976. * cdef inline object PyArray_MultiIterNew3(a, b, c):
  5977. * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<<
  5978. *
  5979. * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
  5980. */
  5981. __Pyx_XDECREF(__pyx_r);
  5982. __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5983. __Pyx_GOTREF(__pyx_t_1);
  5984. __pyx_r = __pyx_t_1;
  5985. __pyx_t_1 = 0;
  5986. goto __pyx_L0;
  5987. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":776
  5988. * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
  5989. *
  5990. * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
  5991. * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
  5992. *
  5993. */
  5994. /* function exit code */
  5995. __pyx_L1_error:;
  5996. __Pyx_XDECREF(__pyx_t_1);
  5997. __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5998. __pyx_r = 0;
  5999. __pyx_L0:;
  6000. __Pyx_XGIVEREF(__pyx_r);
  6001. __Pyx_RefNannyFinishContext();
  6002. return __pyx_r;
  6003. }
  6004. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":779
  6005. * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
  6006. *
  6007. * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
  6008. * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
  6009. *
  6010. */
  6011. 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) {
  6012. PyObject *__pyx_r = NULL;
  6013. __Pyx_RefNannyDeclarations
  6014. PyObject *__pyx_t_1 = NULL;
  6015. int __pyx_lineno = 0;
  6016. const char *__pyx_filename = NULL;
  6017. int __pyx_clineno = 0;
  6018. __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
  6019. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":780
  6020. *
  6021. * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
  6022. * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<<
  6023. *
  6024. * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
  6025. */
  6026. __Pyx_XDECREF(__pyx_r);
  6027. __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_filename = __pyx_f[1]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6028. __Pyx_GOTREF(__pyx_t_1);
  6029. __pyx_r = __pyx_t_1;
  6030. __pyx_t_1 = 0;
  6031. goto __pyx_L0;
  6032. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":779
  6033. * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
  6034. *
  6035. * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
  6036. * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
  6037. *
  6038. */
  6039. /* function exit code */
  6040. __pyx_L1_error:;
  6041. __Pyx_XDECREF(__pyx_t_1);
  6042. __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6043. __pyx_r = 0;
  6044. __pyx_L0:;
  6045. __Pyx_XGIVEREF(__pyx_r);
  6046. __Pyx_RefNannyFinishContext();
  6047. return __pyx_r;
  6048. }
  6049. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":782
  6050. * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
  6051. *
  6052. * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
  6053. * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
  6054. *
  6055. */
  6056. 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) {
  6057. PyObject *__pyx_r = NULL;
  6058. __Pyx_RefNannyDeclarations
  6059. PyObject *__pyx_t_1 = NULL;
  6060. int __pyx_lineno = 0;
  6061. const char *__pyx_filename = NULL;
  6062. int __pyx_clineno = 0;
  6063. __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
  6064. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":783
  6065. *
  6066. * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
  6067. * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<<
  6068. *
  6069. * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
  6070. */
  6071. __Pyx_XDECREF(__pyx_r);
  6072. __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_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6073. __Pyx_GOTREF(__pyx_t_1);
  6074. __pyx_r = __pyx_t_1;
  6075. __pyx_t_1 = 0;
  6076. goto __pyx_L0;
  6077. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":782
  6078. * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
  6079. *
  6080. * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
  6081. * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
  6082. *
  6083. */
  6084. /* function exit code */
  6085. __pyx_L1_error:;
  6086. __Pyx_XDECREF(__pyx_t_1);
  6087. __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6088. __pyx_r = 0;
  6089. __pyx_L0:;
  6090. __Pyx_XGIVEREF(__pyx_r);
  6091. __Pyx_RefNannyFinishContext();
  6092. return __pyx_r;
  6093. }
  6094. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":785
  6095. * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
  6096. *
  6097. * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
  6098. * # Recursive utility function used in __getbuffer__ to get format
  6099. * # string. The new location in the format string is returned.
  6100. */
  6101. 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) {
  6102. PyArray_Descr *__pyx_v_child = 0;
  6103. int __pyx_v_endian_detector;
  6104. int __pyx_v_little_endian;
  6105. PyObject *__pyx_v_fields = 0;
  6106. PyObject *__pyx_v_childname = NULL;
  6107. PyObject *__pyx_v_new_offset = NULL;
  6108. PyObject *__pyx_v_t = NULL;
  6109. char *__pyx_r;
  6110. __Pyx_RefNannyDeclarations
  6111. PyObject *__pyx_t_1 = NULL;
  6112. Py_ssize_t __pyx_t_2;
  6113. PyObject *__pyx_t_3 = NULL;
  6114. PyObject *__pyx_t_4 = NULL;
  6115. int __pyx_t_5;
  6116. int __pyx_t_6;
  6117. int __pyx_t_7;
  6118. long __pyx_t_8;
  6119. char *__pyx_t_9;
  6120. int __pyx_lineno = 0;
  6121. const char *__pyx_filename = NULL;
  6122. int __pyx_clineno = 0;
  6123. __Pyx_RefNannySetupContext("_util_dtypestring", 0);
  6124. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":790
  6125. *
  6126. * cdef dtype child
  6127. * cdef int endian_detector = 1 # <<<<<<<<<<<<<<
  6128. * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
  6129. * cdef tuple fields
  6130. */
  6131. __pyx_v_endian_detector = 1;
  6132. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":791
  6133. * cdef dtype child
  6134. * cdef int endian_detector = 1
  6135. * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
  6136. * cdef tuple fields
  6137. *
  6138. */
  6139. __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
  6140. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":794
  6141. * cdef tuple fields
  6142. *
  6143. * for childname in descr.names: # <<<<<<<<<<<<<<
  6144. * fields = descr.fields[childname]
  6145. * child, new_offset = fields
  6146. */
  6147. if (unlikely(__pyx_v_descr->names == Py_None)) {
  6148. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
  6149. {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6150. }
  6151. __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  6152. for (;;) {
  6153. if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
  6154. #if CYTHON_COMPILING_IN_CPYTHON
  6155. __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_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6156. #else
  6157. __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6158. __Pyx_GOTREF(__pyx_t_3);
  6159. #endif
  6160. __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
  6161. __pyx_t_3 = 0;
  6162. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":795
  6163. *
  6164. * for childname in descr.names:
  6165. * fields = descr.fields[childname] # <<<<<<<<<<<<<<
  6166. * child, new_offset = fields
  6167. *
  6168. */
  6169. if (unlikely(__pyx_v_descr->fields == Py_None)) {
  6170. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
  6171. {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6172. }
  6173. __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  6174. __Pyx_GOTREF(__pyx_t_3);
  6175. 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_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6176. __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
  6177. __pyx_t_3 = 0;
  6178. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":796
  6179. * for childname in descr.names:
  6180. * fields = descr.fields[childname]
  6181. * child, new_offset = fields # <<<<<<<<<<<<<<
  6182. *
  6183. * if (end - f) - <int>(new_offset - offset[0]) < 15:
  6184. */
  6185. if (likely(__pyx_v_fields != Py_None)) {
  6186. PyObject* sequence = __pyx_v_fields;
  6187. #if CYTHON_COMPILING_IN_CPYTHON
  6188. Py_ssize_t size = Py_SIZE(sequence);
  6189. #else
  6190. Py_ssize_t size = PySequence_Size(sequence);
  6191. #endif
  6192. if (unlikely(size != 2)) {
  6193. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  6194. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  6195. {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6196. }
  6197. #if CYTHON_COMPILING_IN_CPYTHON
  6198. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  6199. __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
  6200. __Pyx_INCREF(__pyx_t_3);
  6201. __Pyx_INCREF(__pyx_t_4);
  6202. #else
  6203. __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6204. __Pyx_GOTREF(__pyx_t_3);
  6205. __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6206. __Pyx_GOTREF(__pyx_t_4);
  6207. #endif
  6208. } else {
  6209. __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6210. }
  6211. if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6212. __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
  6213. __pyx_t_3 = 0;
  6214. __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
  6215. __pyx_t_4 = 0;
  6216. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":798
  6217. * child, new_offset = fields
  6218. *
  6219. * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
  6220. * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
  6221. *
  6222. */
  6223. __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6224. __Pyx_GOTREF(__pyx_t_4);
  6225. __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6226. __Pyx_GOTREF(__pyx_t_3);
  6227. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6228. __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6229. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6230. __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
  6231. if (__pyx_t_6) {
  6232. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":799
  6233. *
  6234. * if (end - f) - <int>(new_offset - offset[0]) < 15:
  6235. * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
  6236. *
  6237. * if ((child.byteorder == c'>' and little_endian) or
  6238. */
  6239. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__42, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6240. __Pyx_GOTREF(__pyx_t_3);
  6241. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  6242. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6243. {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6244. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":798
  6245. * child, new_offset = fields
  6246. *
  6247. * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
  6248. * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
  6249. *
  6250. */
  6251. }
  6252. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":801
  6253. * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
  6254. *
  6255. * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
  6256. * (child.byteorder == c'<' and not little_endian)):
  6257. * raise ValueError(u"Non-native byte order not supported")
  6258. */
  6259. __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
  6260. if (!__pyx_t_7) {
  6261. goto __pyx_L8_next_or;
  6262. } else {
  6263. }
  6264. __pyx_t_7 = (__pyx_v_little_endian != 0);
  6265. if (!__pyx_t_7) {
  6266. } else {
  6267. __pyx_t_6 = __pyx_t_7;
  6268. goto __pyx_L7_bool_binop_done;
  6269. }
  6270. __pyx_L8_next_or:;
  6271. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":802
  6272. *
  6273. * if ((child.byteorder == c'>' and little_endian) or
  6274. * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
  6275. * raise ValueError(u"Non-native byte order not supported")
  6276. * # One could encode it in the format string and have Cython
  6277. */
  6278. __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
  6279. if (__pyx_t_7) {
  6280. } else {
  6281. __pyx_t_6 = __pyx_t_7;
  6282. goto __pyx_L7_bool_binop_done;
  6283. }
  6284. __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
  6285. __pyx_t_6 = __pyx_t_7;
  6286. __pyx_L7_bool_binop_done:;
  6287. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":801
  6288. * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
  6289. *
  6290. * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
  6291. * (child.byteorder == c'<' and not little_endian)):
  6292. * raise ValueError(u"Non-native byte order not supported")
  6293. */
  6294. if (__pyx_t_6) {
  6295. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":803
  6296. * if ((child.byteorder == c'>' and little_endian) or
  6297. * (child.byteorder == c'<' and not little_endian)):
  6298. * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
  6299. * # One could encode it in the format string and have Cython
  6300. * # complain instead, BUT: < and > in format strings also imply
  6301. */
  6302. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__43, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6303. __Pyx_GOTREF(__pyx_t_3);
  6304. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  6305. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6306. {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6307. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":801
  6308. * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
  6309. *
  6310. * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
  6311. * (child.byteorder == c'<' and not little_endian)):
  6312. * raise ValueError(u"Non-native byte order not supported")
  6313. */
  6314. }
  6315. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":813
  6316. *
  6317. * # Output padding bytes
  6318. * while offset[0] < new_offset: # <<<<<<<<<<<<<<
  6319. * f[0] = 120 # "x"; pad byte
  6320. * f += 1
  6321. */
  6322. while (1) {
  6323. __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6324. __Pyx_GOTREF(__pyx_t_3);
  6325. __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_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6326. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6327. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6328. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6329. if (!__pyx_t_6) break;
  6330. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":814
  6331. * # Output padding bytes
  6332. * while offset[0] < new_offset:
  6333. * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<<
  6334. * f += 1
  6335. * offset[0] += 1
  6336. */
  6337. (__pyx_v_f[0]) = 0x78;
  6338. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":815
  6339. * while offset[0] < new_offset:
  6340. * f[0] = 120 # "x"; pad byte
  6341. * f += 1 # <<<<<<<<<<<<<<
  6342. * offset[0] += 1
  6343. *
  6344. */
  6345. __pyx_v_f = (__pyx_v_f + 1);
  6346. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":816
  6347. * f[0] = 120 # "x"; pad byte
  6348. * f += 1
  6349. * offset[0] += 1 # <<<<<<<<<<<<<<
  6350. *
  6351. * offset[0] += child.itemsize
  6352. */
  6353. __pyx_t_8 = 0;
  6354. (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
  6355. }
  6356. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":818
  6357. * offset[0] += 1
  6358. *
  6359. * offset[0] += child.itemsize # <<<<<<<<<<<<<<
  6360. *
  6361. * if not PyDataType_HASFIELDS(child):
  6362. */
  6363. __pyx_t_8 = 0;
  6364. (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
  6365. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":820
  6366. * offset[0] += child.itemsize
  6367. *
  6368. * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
  6369. * t = child.type_num
  6370. * if end - f < 5:
  6371. */
  6372. __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
  6373. if (__pyx_t_6) {
  6374. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":821
  6375. *
  6376. * if not PyDataType_HASFIELDS(child):
  6377. * t = child.type_num # <<<<<<<<<<<<<<
  6378. * if end - f < 5:
  6379. * raise RuntimeError(u"Format string allocated too short.")
  6380. */
  6381. __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6382. __Pyx_GOTREF(__pyx_t_4);
  6383. __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
  6384. __pyx_t_4 = 0;
  6385. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":822
  6386. * if not PyDataType_HASFIELDS(child):
  6387. * t = child.type_num
  6388. * if end - f < 5: # <<<<<<<<<<<<<<
  6389. * raise RuntimeError(u"Format string allocated too short.")
  6390. *
  6391. */
  6392. __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
  6393. if (__pyx_t_6) {
  6394. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":823
  6395. * t = child.type_num
  6396. * if end - f < 5:
  6397. * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
  6398. *
  6399. * # Until ticket #99 is fixed, use integers to avoid warnings
  6400. */
  6401. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__44, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6402. __Pyx_GOTREF(__pyx_t_4);
  6403. __Pyx_Raise(__pyx_t_4, 0, 0, 0);
  6404. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6405. {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6406. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":822
  6407. * if not PyDataType_HASFIELDS(child):
  6408. * t = child.type_num
  6409. * if end - f < 5: # <<<<<<<<<<<<<<
  6410. * raise RuntimeError(u"Format string allocated too short.")
  6411. *
  6412. */
  6413. }
  6414. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":826
  6415. *
  6416. * # Until ticket #99 is fixed, use integers to avoid warnings
  6417. * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<<
  6418. * elif t == NPY_UBYTE: f[0] = 66 #"B"
  6419. * elif t == NPY_SHORT: f[0] = 104 #"h"
  6420. */
  6421. __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6422. __Pyx_GOTREF(__pyx_t_4);
  6423. __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6424. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6425. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6426. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6427. if (__pyx_t_6) {
  6428. (__pyx_v_f[0]) = 98;
  6429. goto __pyx_L15;
  6430. }
  6431. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":827
  6432. * # Until ticket #99 is fixed, use integers to avoid warnings
  6433. * if t == NPY_BYTE: f[0] = 98 #"b"
  6434. * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<<
  6435. * elif t == NPY_SHORT: f[0] = 104 #"h"
  6436. * elif t == NPY_USHORT: f[0] = 72 #"H"
  6437. */
  6438. __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6439. __Pyx_GOTREF(__pyx_t_3);
  6440. __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6441. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6442. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6443. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6444. if (__pyx_t_6) {
  6445. (__pyx_v_f[0]) = 66;
  6446. goto __pyx_L15;
  6447. }
  6448. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":828
  6449. * if t == NPY_BYTE: f[0] = 98 #"b"
  6450. * elif t == NPY_UBYTE: f[0] = 66 #"B"
  6451. * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<<
  6452. * elif t == NPY_USHORT: f[0] = 72 #"H"
  6453. * elif t == NPY_INT: f[0] = 105 #"i"
  6454. */
  6455. __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6456. __Pyx_GOTREF(__pyx_t_4);
  6457. __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6458. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6459. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6460. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6461. if (__pyx_t_6) {
  6462. (__pyx_v_f[0]) = 0x68;
  6463. goto __pyx_L15;
  6464. }
  6465. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":829
  6466. * elif t == NPY_UBYTE: f[0] = 66 #"B"
  6467. * elif t == NPY_SHORT: f[0] = 104 #"h"
  6468. * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<<
  6469. * elif t == NPY_INT: f[0] = 105 #"i"
  6470. * elif t == NPY_UINT: f[0] = 73 #"I"
  6471. */
  6472. __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6473. __Pyx_GOTREF(__pyx_t_3);
  6474. __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6475. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6476. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6477. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6478. if (__pyx_t_6) {
  6479. (__pyx_v_f[0]) = 72;
  6480. goto __pyx_L15;
  6481. }
  6482. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":830
  6483. * elif t == NPY_SHORT: f[0] = 104 #"h"
  6484. * elif t == NPY_USHORT: f[0] = 72 #"H"
  6485. * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<<
  6486. * elif t == NPY_UINT: f[0] = 73 #"I"
  6487. * elif t == NPY_LONG: f[0] = 108 #"l"
  6488. */
  6489. __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6490. __Pyx_GOTREF(__pyx_t_4);
  6491. __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6492. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6493. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6494. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6495. if (__pyx_t_6) {
  6496. (__pyx_v_f[0]) = 0x69;
  6497. goto __pyx_L15;
  6498. }
  6499. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":831
  6500. * elif t == NPY_USHORT: f[0] = 72 #"H"
  6501. * elif t == NPY_INT: f[0] = 105 #"i"
  6502. * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<<
  6503. * elif t == NPY_LONG: f[0] = 108 #"l"
  6504. * elif t == NPY_ULONG: f[0] = 76 #"L"
  6505. */
  6506. __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6507. __Pyx_GOTREF(__pyx_t_3);
  6508. __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6509. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6510. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6511. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6512. if (__pyx_t_6) {
  6513. (__pyx_v_f[0]) = 73;
  6514. goto __pyx_L15;
  6515. }
  6516. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":832
  6517. * elif t == NPY_INT: f[0] = 105 #"i"
  6518. * elif t == NPY_UINT: f[0] = 73 #"I"
  6519. * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<<
  6520. * elif t == NPY_ULONG: f[0] = 76 #"L"
  6521. * elif t == NPY_LONGLONG: f[0] = 113 #"q"
  6522. */
  6523. __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6524. __Pyx_GOTREF(__pyx_t_4);
  6525. __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6526. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6527. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6528. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6529. if (__pyx_t_6) {
  6530. (__pyx_v_f[0]) = 0x6C;
  6531. goto __pyx_L15;
  6532. }
  6533. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":833
  6534. * elif t == NPY_UINT: f[0] = 73 #"I"
  6535. * elif t == NPY_LONG: f[0] = 108 #"l"
  6536. * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<<
  6537. * elif t == NPY_LONGLONG: f[0] = 113 #"q"
  6538. * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
  6539. */
  6540. __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6541. __Pyx_GOTREF(__pyx_t_3);
  6542. __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6543. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6544. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6545. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6546. if (__pyx_t_6) {
  6547. (__pyx_v_f[0]) = 76;
  6548. goto __pyx_L15;
  6549. }
  6550. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":834
  6551. * elif t == NPY_LONG: f[0] = 108 #"l"
  6552. * elif t == NPY_ULONG: f[0] = 76 #"L"
  6553. * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<<
  6554. * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
  6555. * elif t == NPY_FLOAT: f[0] = 102 #"f"
  6556. */
  6557. __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6558. __Pyx_GOTREF(__pyx_t_4);
  6559. __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6560. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6561. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6562. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6563. if (__pyx_t_6) {
  6564. (__pyx_v_f[0]) = 0x71;
  6565. goto __pyx_L15;
  6566. }
  6567. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":835
  6568. * elif t == NPY_ULONG: f[0] = 76 #"L"
  6569. * elif t == NPY_LONGLONG: f[0] = 113 #"q"
  6570. * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<<
  6571. * elif t == NPY_FLOAT: f[0] = 102 #"f"
  6572. * elif t == NPY_DOUBLE: f[0] = 100 #"d"
  6573. */
  6574. __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6575. __Pyx_GOTREF(__pyx_t_3);
  6576. __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6577. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6578. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6579. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6580. if (__pyx_t_6) {
  6581. (__pyx_v_f[0]) = 81;
  6582. goto __pyx_L15;
  6583. }
  6584. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":836
  6585. * elif t == NPY_LONGLONG: f[0] = 113 #"q"
  6586. * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
  6587. * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<<
  6588. * elif t == NPY_DOUBLE: f[0] = 100 #"d"
  6589. * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
  6590. */
  6591. __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6592. __Pyx_GOTREF(__pyx_t_4);
  6593. __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6594. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6595. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6596. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6597. if (__pyx_t_6) {
  6598. (__pyx_v_f[0]) = 0x66;
  6599. goto __pyx_L15;
  6600. }
  6601. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":837
  6602. * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
  6603. * elif t == NPY_FLOAT: f[0] = 102 #"f"
  6604. * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<<
  6605. * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
  6606. * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
  6607. */
  6608. __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6609. __Pyx_GOTREF(__pyx_t_3);
  6610. __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6611. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6612. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6613. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6614. if (__pyx_t_6) {
  6615. (__pyx_v_f[0]) = 0x64;
  6616. goto __pyx_L15;
  6617. }
  6618. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":838
  6619. * elif t == NPY_FLOAT: f[0] = 102 #"f"
  6620. * elif t == NPY_DOUBLE: f[0] = 100 #"d"
  6621. * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<<
  6622. * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
  6623. * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
  6624. */
  6625. __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6626. __Pyx_GOTREF(__pyx_t_4);
  6627. __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6628. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6629. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6630. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6631. if (__pyx_t_6) {
  6632. (__pyx_v_f[0]) = 0x67;
  6633. goto __pyx_L15;
  6634. }
  6635. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":839
  6636. * elif t == NPY_DOUBLE: f[0] = 100 #"d"
  6637. * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
  6638. * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<<
  6639. * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
  6640. * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
  6641. */
  6642. __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6643. __Pyx_GOTREF(__pyx_t_3);
  6644. __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6645. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6646. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6647. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6648. if (__pyx_t_6) {
  6649. (__pyx_v_f[0]) = 90;
  6650. (__pyx_v_f[1]) = 0x66;
  6651. __pyx_v_f = (__pyx_v_f + 1);
  6652. goto __pyx_L15;
  6653. }
  6654. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":840
  6655. * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
  6656. * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
  6657. * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<<
  6658. * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
  6659. * elif t == NPY_OBJECT: f[0] = 79 #"O"
  6660. */
  6661. __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6662. __Pyx_GOTREF(__pyx_t_4);
  6663. __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6664. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6665. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6666. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6667. if (__pyx_t_6) {
  6668. (__pyx_v_f[0]) = 90;
  6669. (__pyx_v_f[1]) = 0x64;
  6670. __pyx_v_f = (__pyx_v_f + 1);
  6671. goto __pyx_L15;
  6672. }
  6673. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":841
  6674. * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
  6675. * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
  6676. * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<<
  6677. * elif t == NPY_OBJECT: f[0] = 79 #"O"
  6678. * else:
  6679. */
  6680. __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6681. __Pyx_GOTREF(__pyx_t_3);
  6682. __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6683. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6684. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6685. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6686. if (__pyx_t_6) {
  6687. (__pyx_v_f[0]) = 90;
  6688. (__pyx_v_f[1]) = 0x67;
  6689. __pyx_v_f = (__pyx_v_f + 1);
  6690. goto __pyx_L15;
  6691. }
  6692. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":842
  6693. * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
  6694. * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
  6695. * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<<
  6696. * else:
  6697. * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  6698. */
  6699. __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6700. __Pyx_GOTREF(__pyx_t_4);
  6701. __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6702. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6703. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6704. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6705. if (__pyx_t_6) {
  6706. (__pyx_v_f[0]) = 79;
  6707. goto __pyx_L15;
  6708. }
  6709. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":844
  6710. * elif t == NPY_OBJECT: f[0] = 79 #"O"
  6711. * else:
  6712. * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
  6713. * f += 1
  6714. * else:
  6715. */
  6716. /*else*/ {
  6717. __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6718. __Pyx_GOTREF(__pyx_t_3);
  6719. __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6720. __Pyx_GOTREF(__pyx_t_4);
  6721. __Pyx_GIVEREF(__pyx_t_3);
  6722. PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  6723. __pyx_t_3 = 0;
  6724. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6725. __Pyx_GOTREF(__pyx_t_3);
  6726. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6727. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  6728. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6729. {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6730. }
  6731. __pyx_L15:;
  6732. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":845
  6733. * else:
  6734. * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  6735. * f += 1 # <<<<<<<<<<<<<<
  6736. * else:
  6737. * # Cython ignores struct boundary information ("T{...}"),
  6738. */
  6739. __pyx_v_f = (__pyx_v_f + 1);
  6740. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":820
  6741. * offset[0] += child.itemsize
  6742. *
  6743. * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
  6744. * t = child.type_num
  6745. * if end - f < 5:
  6746. */
  6747. goto __pyx_L13;
  6748. }
  6749. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":849
  6750. * # Cython ignores struct boundary information ("T{...}"),
  6751. * # so don't output it
  6752. * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<<
  6753. * return f
  6754. *
  6755. */
  6756. /*else*/ {
  6757. __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 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6758. __pyx_v_f = __pyx_t_9;
  6759. }
  6760. __pyx_L13:;
  6761. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":794
  6762. * cdef tuple fields
  6763. *
  6764. * for childname in descr.names: # <<<<<<<<<<<<<<
  6765. * fields = descr.fields[childname]
  6766. * child, new_offset = fields
  6767. */
  6768. }
  6769. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6770. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":850
  6771. * # so don't output it
  6772. * f = _util_dtypestring(child, f, end, offset)
  6773. * return f # <<<<<<<<<<<<<<
  6774. *
  6775. *
  6776. */
  6777. __pyx_r = __pyx_v_f;
  6778. goto __pyx_L0;
  6779. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":785
  6780. * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
  6781. *
  6782. * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
  6783. * # Recursive utility function used in __getbuffer__ to get format
  6784. * # string. The new location in the format string is returned.
  6785. */
  6786. /* function exit code */
  6787. __pyx_L1_error:;
  6788. __Pyx_XDECREF(__pyx_t_1);
  6789. __Pyx_XDECREF(__pyx_t_3);
  6790. __Pyx_XDECREF(__pyx_t_4);
  6791. __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6792. __pyx_r = NULL;
  6793. __pyx_L0:;
  6794. __Pyx_XDECREF((PyObject *)__pyx_v_child);
  6795. __Pyx_XDECREF(__pyx_v_fields);
  6796. __Pyx_XDECREF(__pyx_v_childname);
  6797. __Pyx_XDECREF(__pyx_v_new_offset);
  6798. __Pyx_XDECREF(__pyx_v_t);
  6799. __Pyx_RefNannyFinishContext();
  6800. return __pyx_r;
  6801. }
  6802. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":966
  6803. *
  6804. *
  6805. * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
  6806. * cdef PyObject* baseptr
  6807. * if base is None:
  6808. */
  6809. static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
  6810. PyObject *__pyx_v_baseptr;
  6811. __Pyx_RefNannyDeclarations
  6812. int __pyx_t_1;
  6813. int __pyx_t_2;
  6814. __Pyx_RefNannySetupContext("set_array_base", 0);
  6815. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":968
  6816. * cdef inline void set_array_base(ndarray arr, object base):
  6817. * cdef PyObject* baseptr
  6818. * if base is None: # <<<<<<<<<<<<<<
  6819. * baseptr = NULL
  6820. * else:
  6821. */
  6822. __pyx_t_1 = (__pyx_v_base == Py_None);
  6823. __pyx_t_2 = (__pyx_t_1 != 0);
  6824. if (__pyx_t_2) {
  6825. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":969
  6826. * cdef PyObject* baseptr
  6827. * if base is None:
  6828. * baseptr = NULL # <<<<<<<<<<<<<<
  6829. * else:
  6830. * Py_INCREF(base) # important to do this before decref below!
  6831. */
  6832. __pyx_v_baseptr = NULL;
  6833. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":968
  6834. * cdef inline void set_array_base(ndarray arr, object base):
  6835. * cdef PyObject* baseptr
  6836. * if base is None: # <<<<<<<<<<<<<<
  6837. * baseptr = NULL
  6838. * else:
  6839. */
  6840. goto __pyx_L3;
  6841. }
  6842. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":971
  6843. * baseptr = NULL
  6844. * else:
  6845. * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<<
  6846. * baseptr = <PyObject*>base
  6847. * Py_XDECREF(arr.base)
  6848. */
  6849. /*else*/ {
  6850. Py_INCREF(__pyx_v_base);
  6851. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":972
  6852. * else:
  6853. * Py_INCREF(base) # important to do this before decref below!
  6854. * baseptr = <PyObject*>base # <<<<<<<<<<<<<<
  6855. * Py_XDECREF(arr.base)
  6856. * arr.base = baseptr
  6857. */
  6858. __pyx_v_baseptr = ((PyObject *)__pyx_v_base);
  6859. }
  6860. __pyx_L3:;
  6861. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":973
  6862. * Py_INCREF(base) # important to do this before decref below!
  6863. * baseptr = <PyObject*>base
  6864. * Py_XDECREF(arr.base) # <<<<<<<<<<<<<<
  6865. * arr.base = baseptr
  6866. *
  6867. */
  6868. Py_XDECREF(__pyx_v_arr->base);
  6869. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":974
  6870. * baseptr = <PyObject*>base
  6871. * Py_XDECREF(arr.base)
  6872. * arr.base = baseptr # <<<<<<<<<<<<<<
  6873. *
  6874. * cdef inline object get_array_base(ndarray arr):
  6875. */
  6876. __pyx_v_arr->base = __pyx_v_baseptr;
  6877. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":966
  6878. *
  6879. *
  6880. * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
  6881. * cdef PyObject* baseptr
  6882. * if base is None:
  6883. */
  6884. /* function exit code */
  6885. __Pyx_RefNannyFinishContext();
  6886. }
  6887. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":976
  6888. * arr.base = baseptr
  6889. *
  6890. * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
  6891. * if arr.base is NULL:
  6892. * return None
  6893. */
  6894. static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
  6895. PyObject *__pyx_r = NULL;
  6896. __Pyx_RefNannyDeclarations
  6897. int __pyx_t_1;
  6898. __Pyx_RefNannySetupContext("get_array_base", 0);
  6899. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":977
  6900. *
  6901. * cdef inline object get_array_base(ndarray arr):
  6902. * if arr.base is NULL: # <<<<<<<<<<<<<<
  6903. * return None
  6904. * else:
  6905. */
  6906. __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0);
  6907. if (__pyx_t_1) {
  6908. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":978
  6909. * cdef inline object get_array_base(ndarray arr):
  6910. * if arr.base is NULL:
  6911. * return None # <<<<<<<<<<<<<<
  6912. * else:
  6913. * return <object>arr.base
  6914. */
  6915. __Pyx_XDECREF(__pyx_r);
  6916. __Pyx_INCREF(Py_None);
  6917. __pyx_r = Py_None;
  6918. goto __pyx_L0;
  6919. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":977
  6920. *
  6921. * cdef inline object get_array_base(ndarray arr):
  6922. * if arr.base is NULL: # <<<<<<<<<<<<<<
  6923. * return None
  6924. * else:
  6925. */
  6926. }
  6927. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":980
  6928. * return None
  6929. * else:
  6930. * return <object>arr.base # <<<<<<<<<<<<<<
  6931. */
  6932. /*else*/ {
  6933. __Pyx_XDECREF(__pyx_r);
  6934. __Pyx_INCREF(((PyObject *)__pyx_v_arr->base));
  6935. __pyx_r = ((PyObject *)__pyx_v_arr->base);
  6936. goto __pyx_L0;
  6937. }
  6938. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":976
  6939. * arr.base = baseptr
  6940. *
  6941. * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
  6942. * if arr.base is NULL:
  6943. * return None
  6944. */
  6945. /* function exit code */
  6946. __pyx_L0:;
  6947. __Pyx_XGIVEREF(__pyx_r);
  6948. __Pyx_RefNannyFinishContext();
  6949. return __pyx_r;
  6950. }
  6951. /* "vector.from_py":49
  6952. *
  6953. * @cname("__pyx_convert_vector_from_py_double")
  6954. * cdef vector[X] __pyx_convert_vector_from_py_double(object o) except *: # <<<<<<<<<<<<<<
  6955. * cdef vector[X] v
  6956. * for item in o:
  6957. */
  6958. static std::vector<double> __pyx_convert_vector_from_py_double(PyObject *__pyx_v_o) {
  6959. std::vector<double> __pyx_v_v;
  6960. PyObject *__pyx_v_item = NULL;
  6961. std::vector<double> __pyx_r;
  6962. __Pyx_RefNannyDeclarations
  6963. PyObject *__pyx_t_1 = NULL;
  6964. Py_ssize_t __pyx_t_2;
  6965. PyObject *(*__pyx_t_3)(PyObject *);
  6966. PyObject *__pyx_t_4 = NULL;
  6967. double __pyx_t_5;
  6968. int __pyx_lineno = 0;
  6969. const char *__pyx_filename = NULL;
  6970. int __pyx_clineno = 0;
  6971. __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_double", 0);
  6972. /* "vector.from_py":51
  6973. * cdef vector[X] __pyx_convert_vector_from_py_double(object o) except *:
  6974. * cdef vector[X] v
  6975. * for item in o: # <<<<<<<<<<<<<<
  6976. * v.push_back(X_from_py(item))
  6977. * return v
  6978. */
  6979. if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
  6980. __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  6981. __pyx_t_3 = NULL;
  6982. } else {
  6983. __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6984. __Pyx_GOTREF(__pyx_t_1);
  6985. __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6986. }
  6987. for (;;) {
  6988. if (likely(!__pyx_t_3)) {
  6989. if (likely(PyList_CheckExact(__pyx_t_1))) {
  6990. if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
  6991. #if CYTHON_COMPILING_IN_CPYTHON
  6992. __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6993. #else
  6994. __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6995. __Pyx_GOTREF(__pyx_t_4);
  6996. #endif
  6997. } else {
  6998. if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
  6999. #if CYTHON_COMPILING_IN_CPYTHON
  7000. __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7001. #else
  7002. __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7003. __Pyx_GOTREF(__pyx_t_4);
  7004. #endif
  7005. }
  7006. } else {
  7007. __pyx_t_4 = __pyx_t_3(__pyx_t_1);
  7008. if (unlikely(!__pyx_t_4)) {
  7009. PyObject* exc_type = PyErr_Occurred();
  7010. if (exc_type) {
  7011. if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  7012. else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7013. }
  7014. break;
  7015. }
  7016. __Pyx_GOTREF(__pyx_t_4);
  7017. }
  7018. __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
  7019. __pyx_t_4 = 0;
  7020. /* "vector.from_py":52
  7021. * cdef vector[X] v
  7022. * for item in o:
  7023. * v.push_back(X_from_py(item)) # <<<<<<<<<<<<<<
  7024. * return v
  7025. *
  7026. */
  7027. __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_item); if (unlikely(__pyx_t_5 == -1.0 && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7028. __pyx_v_v.push_back(__pyx_t_5);
  7029. /* "vector.from_py":51
  7030. * cdef vector[X] __pyx_convert_vector_from_py_double(object o) except *:
  7031. * cdef vector[X] v
  7032. * for item in o: # <<<<<<<<<<<<<<
  7033. * v.push_back(X_from_py(item))
  7034. * return v
  7035. */
  7036. }
  7037. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7038. /* "vector.from_py":53
  7039. * for item in o:
  7040. * v.push_back(X_from_py(item))
  7041. * return v # <<<<<<<<<<<<<<
  7042. *
  7043. *
  7044. */
  7045. __pyx_r = __pyx_v_v;
  7046. goto __pyx_L0;
  7047. /* "vector.from_py":49
  7048. *
  7049. * @cname("__pyx_convert_vector_from_py_double")
  7050. * cdef vector[X] __pyx_convert_vector_from_py_double(object o) except *: # <<<<<<<<<<<<<<
  7051. * cdef vector[X] v
  7052. * for item in o:
  7053. */
  7054. /* function exit code */
  7055. __pyx_L1_error:;
  7056. __Pyx_XDECREF(__pyx_t_1);
  7057. __Pyx_XDECREF(__pyx_t_4);
  7058. __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_double", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7059. __pyx_L0:;
  7060. __Pyx_XDECREF(__pyx_v_item);
  7061. __Pyx_RefNannyFinishContext();
  7062. return __pyx_r;
  7063. }
  7064. /* "vector.from_py":50
  7065. *
  7066. * @cname("__pyx_convert_vector_from_py___pyx_t_double_complex")
  7067. * cdef vector[X] __pyx_convert_vector_from_py___pyx_t_double_complex(object o) except *: # <<<<<<<<<<<<<<
  7068. * cdef vector[X] v
  7069. * for item in o:
  7070. */
  7071. static std::vector<__pyx_t_double_complex> __pyx_convert_vector_from_py___pyx_t_double_complex(PyObject *__pyx_v_o) {
  7072. std::vector<__pyx_t_double_complex> __pyx_v_v;
  7073. PyObject *__pyx_v_item = NULL;
  7074. std::vector<__pyx_t_double_complex> __pyx_r;
  7075. __Pyx_RefNannyDeclarations
  7076. PyObject *__pyx_t_1 = NULL;
  7077. Py_ssize_t __pyx_t_2;
  7078. PyObject *(*__pyx_t_3)(PyObject *);
  7079. PyObject *__pyx_t_4 = NULL;
  7080. __pyx_t_double_complex __pyx_t_5;
  7081. int __pyx_lineno = 0;
  7082. const char *__pyx_filename = NULL;
  7083. int __pyx_clineno = 0;
  7084. __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py___pyx_t_double_complex", 0);
  7085. /* "vector.from_py":52
  7086. * cdef vector[X] __pyx_convert_vector_from_py___pyx_t_double_complex(object o) except *:
  7087. * cdef vector[X] v
  7088. * for item in o: # <<<<<<<<<<<<<<
  7089. * v.push_back(X_from_py(item))
  7090. * return v
  7091. */
  7092. if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
  7093. __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  7094. __pyx_t_3 = NULL;
  7095. } else {
  7096. __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7097. __Pyx_GOTREF(__pyx_t_1);
  7098. __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7099. }
  7100. for (;;) {
  7101. if (likely(!__pyx_t_3)) {
  7102. if (likely(PyList_CheckExact(__pyx_t_1))) {
  7103. if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
  7104. #if CYTHON_COMPILING_IN_CPYTHON
  7105. __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7106. #else
  7107. __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7108. __Pyx_GOTREF(__pyx_t_4);
  7109. #endif
  7110. } else {
  7111. if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
  7112. #if CYTHON_COMPILING_IN_CPYTHON
  7113. __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7114. #else
  7115. __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7116. __Pyx_GOTREF(__pyx_t_4);
  7117. #endif
  7118. }
  7119. } else {
  7120. __pyx_t_4 = __pyx_t_3(__pyx_t_1);
  7121. if (unlikely(!__pyx_t_4)) {
  7122. PyObject* exc_type = PyErr_Occurred();
  7123. if (exc_type) {
  7124. if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  7125. else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7126. }
  7127. break;
  7128. }
  7129. __Pyx_GOTREF(__pyx_t_4);
  7130. }
  7131. __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
  7132. __pyx_t_4 = 0;
  7133. /* "vector.from_py":53
  7134. * cdef vector[X] v
  7135. * for item in o:
  7136. * v.push_back(X_from_py(item)) # <<<<<<<<<<<<<<
  7137. * return v
  7138. *
  7139. */
  7140. __pyx_t_5 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_v_item); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7141. __pyx_v_v.push_back(__pyx_t_5);
  7142. /* "vector.from_py":52
  7143. * cdef vector[X] __pyx_convert_vector_from_py___pyx_t_double_complex(object o) except *:
  7144. * cdef vector[X] v
  7145. * for item in o: # <<<<<<<<<<<<<<
  7146. * v.push_back(X_from_py(item))
  7147. * return v
  7148. */
  7149. }
  7150. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7151. /* "vector.from_py":54
  7152. * for item in o:
  7153. * v.push_back(X_from_py(item))
  7154. * return v # <<<<<<<<<<<<<<
  7155. *
  7156. *
  7157. */
  7158. __pyx_r = __pyx_v_v;
  7159. goto __pyx_L0;
  7160. /* "vector.from_py":50
  7161. *
  7162. * @cname("__pyx_convert_vector_from_py___pyx_t_double_complex")
  7163. * cdef vector[X] __pyx_convert_vector_from_py___pyx_t_double_complex(object o) except *: # <<<<<<<<<<<<<<
  7164. * cdef vector[X] v
  7165. * for item in o:
  7166. */
  7167. /* function exit code */
  7168. __pyx_L1_error:;
  7169. __Pyx_XDECREF(__pyx_t_1);
  7170. __Pyx_XDECREF(__pyx_t_4);
  7171. __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py___pyx_t_double_complex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7172. __pyx_L0:;
  7173. __Pyx_XDECREF(__pyx_v_item);
  7174. __Pyx_RefNannyFinishContext();
  7175. return __pyx_r;
  7176. }
  7177. static PyMethodDef __pyx_methods[] = {
  7178. {0, 0, 0, 0}
  7179. };
  7180. #if PY_MAJOR_VERSION >= 3
  7181. static struct PyModuleDef __pyx_moduledef = {
  7182. #if PY_VERSION_HEX < 0x03020000
  7183. { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
  7184. #else
  7185. PyModuleDef_HEAD_INIT,
  7186. #endif
  7187. "scattnlay_mp",
  7188. 0, /* m_doc */
  7189. -1, /* m_size */
  7190. __pyx_methods /* m_methods */,
  7191. NULL, /* m_reload */
  7192. NULL, /* m_traverse */
  7193. NULL, /* m_clear */
  7194. NULL /* m_free */
  7195. };
  7196. #endif
  7197. static __Pyx_StringTabEntry __pyx_string_tab[] = {
  7198. {&__pyx_n_s_Albedo, __pyx_k_Albedo, sizeof(__pyx_k_Albedo), 0, 0, 1, 1},
  7199. {&__pyx_n_s_C, __pyx_k_C, sizeof(__pyx_k_C), 0, 0, 1, 1},
  7200. {&__pyx_n_s_C_CONTIGUOUS, __pyx_k_C_CONTIGUOUS, sizeof(__pyx_k_C_CONTIGUOUS), 0, 0, 1, 1},
  7201. {&__pyx_n_s_E, __pyx_k_E, sizeof(__pyx_k_E), 0, 0, 1, 1},
  7202. {&__pyx_n_s_Eix, __pyx_k_Eix, sizeof(__pyx_k_Eix), 0, 0, 1, 1},
  7203. {&__pyx_n_s_Eiy, __pyx_k_Eiy, sizeof(__pyx_k_Eiy), 0, 0, 1, 1},
  7204. {&__pyx_n_s_Eiz, __pyx_k_Eiz, sizeof(__pyx_k_Eiz), 0, 0, 1, 1},
  7205. {&__pyx_n_s_Erx, __pyx_k_Erx, sizeof(__pyx_k_Erx), 0, 0, 1, 1},
  7206. {&__pyx_n_s_Ery, __pyx_k_Ery, sizeof(__pyx_k_Ery), 0, 0, 1, 1},
  7207. {&__pyx_n_s_Erz, __pyx_k_Erz, sizeof(__pyx_k_Erz), 0, 0, 1, 1},
  7208. {&__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},
  7209. {&__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},
  7210. {&__pyx_n_s_H, __pyx_k_H, sizeof(__pyx_k_H), 0, 0, 1, 1},
  7211. {&__pyx_n_s_Hix, __pyx_k_Hix, sizeof(__pyx_k_Hix), 0, 0, 1, 1},
  7212. {&__pyx_n_s_Hiy, __pyx_k_Hiy, sizeof(__pyx_k_Hiy), 0, 0, 1, 1},
  7213. {&__pyx_n_s_Hiz, __pyx_k_Hiz, sizeof(__pyx_k_Hiz), 0, 0, 1, 1},
  7214. {&__pyx_n_s_Hrx, __pyx_k_Hrx, sizeof(__pyx_k_Hrx), 0, 0, 1, 1},
  7215. {&__pyx_n_s_Hry, __pyx_k_Hry, sizeof(__pyx_k_Hry), 0, 0, 1, 1},
  7216. {&__pyx_n_s_Hrz, __pyx_k_Hrz, sizeof(__pyx_k_Hrz), 0, 0, 1, 1},
  7217. {&__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},
  7218. {&__pyx_n_s_Qabs, __pyx_k_Qabs, sizeof(__pyx_k_Qabs), 0, 0, 1, 1},
  7219. {&__pyx_n_s_Qbk, __pyx_k_Qbk, sizeof(__pyx_k_Qbk), 0, 0, 1, 1},
  7220. {&__pyx_n_s_Qext, __pyx_k_Qext, sizeof(__pyx_k_Qext), 0, 0, 1, 1},
  7221. {&__pyx_n_s_Qpr, __pyx_k_Qpr, sizeof(__pyx_k_Qpr), 0, 0, 1, 1},
  7222. {&__pyx_n_s_Qsca, __pyx_k_Qsca, sizeof(__pyx_k_Qsca), 0, 0, 1, 1},
  7223. {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
  7224. {&__pyx_n_s_S1, __pyx_k_S1, sizeof(__pyx_k_S1), 0, 0, 1, 1},
  7225. {&__pyx_n_s_S1i, __pyx_k_S1i, sizeof(__pyx_k_S1i), 0, 0, 1, 1},
  7226. {&__pyx_n_s_S1r, __pyx_k_S1r, sizeof(__pyx_k_S1r), 0, 0, 1, 1},
  7227. {&__pyx_n_s_S2, __pyx_k_S2, sizeof(__pyx_k_S2), 0, 0, 1, 1},
  7228. {&__pyx_n_s_S2i, __pyx_k_S2i, sizeof(__pyx_k_S2i), 0, 0, 1, 1},
  7229. {&__pyx_n_s_S2r, __pyx_k_S2r, sizeof(__pyx_k_S2r), 0, 0, 1, 1},
  7230. {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  7231. {&__pyx_n_s_an, __pyx_k_an, sizeof(__pyx_k_an), 0, 0, 1, 1},
  7232. {&__pyx_n_s_ani, __pyx_k_ani, sizeof(__pyx_k_ani), 0, 0, 1, 1},
  7233. {&__pyx_n_s_anr, __pyx_k_anr, sizeof(__pyx_k_anr), 0, 0, 1, 1},
  7234. {&__pyx_n_s_bn, __pyx_k_bn, sizeof(__pyx_k_bn), 0, 0, 1, 1},
  7235. {&__pyx_n_s_bni, __pyx_k_bni, sizeof(__pyx_k_bni), 0, 0, 1, 1},
  7236. {&__pyx_n_s_bnr, __pyx_k_bnr, sizeof(__pyx_k_bnr), 0, 0, 1, 1},
  7237. {&__pyx_n_s_complex128, __pyx_k_complex128, sizeof(__pyx_k_complex128), 0, 0, 1, 1},
  7238. {&__pyx_n_s_coords, __pyx_k_coords, sizeof(__pyx_k_coords), 0, 0, 1, 1},
  7239. {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1},
  7240. {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
  7241. {&__pyx_n_s_fieldnlay, __pyx_k_fieldnlay, sizeof(__pyx_k_fieldnlay), 0, 0, 1, 1},
  7242. {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
  7243. {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1},
  7244. {&__pyx_n_s_g, __pyx_k_g, sizeof(__pyx_k_g), 0, 0, 1, 1},
  7245. {&__pyx_kp_s_home_ovidio_scattering_scattnla, __pyx_k_home_ovidio_scattering_scattnla, sizeof(__pyx_k_home_ovidio_scattering_scattnla), 0, 0, 1, 0},
  7246. {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
  7247. {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  7248. {&__pyx_n_s_int, __pyx_k_int, sizeof(__pyx_k_int), 0, 0, 1, 1},
  7249. {&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 0, 1, 1},
  7250. {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  7251. {&__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},
  7252. {&__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},
  7253. {&__pyx_n_s_nmax, __pyx_k_nmax, sizeof(__pyx_k_nmax), 0, 0, 1, 1},
  7254. {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
  7255. {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
  7256. {&__pyx_n_s_pl, __pyx_k_pl, sizeof(__pyx_k_pl), 0, 0, 1, 1},
  7257. {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  7258. {&__pyx_n_s_scattcoeffs, __pyx_k_scattcoeffs, sizeof(__pyx_k_scattcoeffs), 0, 0, 1, 1},
  7259. {&__pyx_n_s_scattnlay, __pyx_k_scattnlay, sizeof(__pyx_k_scattnlay), 0, 0, 1, 1},
  7260. {&__pyx_n_s_scattnlay_mp, __pyx_k_scattnlay_mp, sizeof(__pyx_k_scattnlay_mp), 0, 0, 1, 1},
  7261. {&__pyx_n_s_terms, __pyx_k_terms, sizeof(__pyx_k_terms), 0, 0, 1, 1},
  7262. {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  7263. {&__pyx_n_s_theta, __pyx_k_theta, sizeof(__pyx_k_theta), 0, 0, 1, 1},
  7264. {&__pyx_n_s_transpose, __pyx_k_transpose, sizeof(__pyx_k_transpose), 0, 0, 1, 1},
  7265. {&__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},
  7266. {&__pyx_n_s_vstack, __pyx_k_vstack, sizeof(__pyx_k_vstack), 0, 0, 1, 1},
  7267. {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
  7268. {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
  7269. {0, 0, 0, 0, 0, 0, 0}
  7270. };
  7271. static int __Pyx_InitCachedBuiltins(void) {
  7272. __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7273. __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7274. __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7275. return 0;
  7276. __pyx_L1_error:;
  7277. return -1;
  7278. }
  7279. static int __Pyx_InitCachedConstants(void) {
  7280. __Pyx_RefNannyDeclarations
  7281. __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
  7282. /* "scattnlay_mp.pyx":43
  7283. *
  7284. * if not (<object>a).flags["C_CONTIGUOUS"]: # Array is not contiguous, need to make contiguous copy
  7285. * a = a.copy('C') # <<<<<<<<<<<<<<
  7286. *
  7287. * # Return data pointer
  7288. */
  7289. __pyx_tuple_ = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7290. __Pyx_GOTREF(__pyx_tuple_);
  7291. __Pyx_GIVEREF(__pyx_tuple_);
  7292. /* "scattnlay_mp.pyx":90
  7293. * bni = np.zeros(nmax, dtype = np.float64)
  7294. *
  7295. * terms[i] = ScattCoeffs(x.shape[1], pl, x[i].copy('C'), m[i].copy('C'), nmax, npy2c(anr), npy2c(ani), npy2c(bnr), npy2c(bni)) # <<<<<<<<<<<<<<
  7296. *
  7297. * an[i] = anr.copy('C') + 1.0j*ani.copy('C')
  7298. */
  7299. __pyx_tuple__2 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7300. __Pyx_GOTREF(__pyx_tuple__2);
  7301. __Pyx_GIVEREF(__pyx_tuple__2);
  7302. __pyx_tuple__3 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7303. __Pyx_GOTREF(__pyx_tuple__3);
  7304. __Pyx_GIVEREF(__pyx_tuple__3);
  7305. /* "scattnlay_mp.pyx":92
  7306. * terms[i] = ScattCoeffs(x.shape[1], pl, x[i].copy('C'), m[i].copy('C'), nmax, npy2c(anr), npy2c(ani), npy2c(bnr), npy2c(bni))
  7307. *
  7308. * an[i] = anr.copy('C') + 1.0j*ani.copy('C') # <<<<<<<<<<<<<<
  7309. * bn[i] = bnr.copy('C') + 1.0j*bni.copy('C')
  7310. *
  7311. */
  7312. __pyx_tuple__4 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7313. __Pyx_GOTREF(__pyx_tuple__4);
  7314. __Pyx_GIVEREF(__pyx_tuple__4);
  7315. __pyx_tuple__5 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7316. __Pyx_GOTREF(__pyx_tuple__5);
  7317. __Pyx_GIVEREF(__pyx_tuple__5);
  7318. /* "scattnlay_mp.pyx":93
  7319. *
  7320. * an[i] = anr.copy('C') + 1.0j*ani.copy('C')
  7321. * bn[i] = bnr.copy('C') + 1.0j*bni.copy('C') # <<<<<<<<<<<<<<
  7322. *
  7323. * return terms, an, bn
  7324. */
  7325. __pyx_tuple__6 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7326. __Pyx_GOTREF(__pyx_tuple__6);
  7327. __Pyx_GIVEREF(__pyx_tuple__6);
  7328. __pyx_tuple__7 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7329. __Pyx_GOTREF(__pyx_tuple__7);
  7330. __Pyx_GIVEREF(__pyx_tuple__7);
  7331. /* "scattnlay_mp.pyx":149
  7332. * S2i = np.zeros(theta.shape[0], dtype = np.float64)
  7333. *
  7334. * terms[i] = nMie(x.shape[1], pl, x[i].copy('C'), m[i].copy('C'), theta.shape[0], theta.copy('C'), nmax, &Qext[i], &Qsca[i], &Qabs[i], &Qbk[i], &Qpr[i], &g[i], &Albedo[i], npy2c(S1r), npy2c(S1i), npy2c(S2r), npy2c(S2i)) # <<<<<<<<<<<<<<
  7335. *
  7336. * S1[i] = S1r.copy('C') + 1.0j*S1i.copy('C')
  7337. */
  7338. __pyx_tuple__9 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7339. __Pyx_GOTREF(__pyx_tuple__9);
  7340. __Pyx_GIVEREF(__pyx_tuple__9);
  7341. __pyx_tuple__10 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7342. __Pyx_GOTREF(__pyx_tuple__10);
  7343. __Pyx_GIVEREF(__pyx_tuple__10);
  7344. __pyx_tuple__11 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7345. __Pyx_GOTREF(__pyx_tuple__11);
  7346. __Pyx_GIVEREF(__pyx_tuple__11);
  7347. /* "scattnlay_mp.pyx":151
  7348. * terms[i] = nMie(x.shape[1], pl, x[i].copy('C'), m[i].copy('C'), theta.shape[0], theta.copy('C'), nmax, &Qext[i], &Qsca[i], &Qabs[i], &Qbk[i], &Qpr[i], &g[i], &Albedo[i], npy2c(S1r), npy2c(S1i), npy2c(S2r), npy2c(S2i))
  7349. *
  7350. * S1[i] = S1r.copy('C') + 1.0j*S1i.copy('C') # <<<<<<<<<<<<<<
  7351. * S2[i] = S2r.copy('C') + 1.0j*S2i.copy('C')
  7352. *
  7353. */
  7354. __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7355. __Pyx_GOTREF(__pyx_tuple__12);
  7356. __Pyx_GIVEREF(__pyx_tuple__12);
  7357. __pyx_tuple__13 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7358. __Pyx_GOTREF(__pyx_tuple__13);
  7359. __Pyx_GIVEREF(__pyx_tuple__13);
  7360. /* "scattnlay_mp.pyx":152
  7361. *
  7362. * S1[i] = S1r.copy('C') + 1.0j*S1i.copy('C')
  7363. * S2[i] = S2r.copy('C') + 1.0j*S2i.copy('C') # <<<<<<<<<<<<<<
  7364. *
  7365. * return terms, Qext, Qsca, Qabs, Qbk, Qpr, g, Albedo, S1, S2
  7366. */
  7367. __pyx_tuple__14 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7368. __Pyx_GOTREF(__pyx_tuple__14);
  7369. __Pyx_GIVEREF(__pyx_tuple__14);
  7370. __pyx_tuple__15 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7371. __Pyx_GOTREF(__pyx_tuple__15);
  7372. __Pyx_GIVEREF(__pyx_tuple__15);
  7373. /* "scattnlay_mp.pyx":191
  7374. * Hiz = np.zeros(coords.shape[0], dtype = np.float64)
  7375. *
  7376. * terms[i] = nField(x.shape[1], pl, x[i].copy('C'), m[i].copy('C'), nmax, coords.shape[0], coords[:, 0].copy('C'), coords[:, 1].copy('C'), coords[:, 2].copy('C'), npy2c(Erx), npy2c(Ery), npy2c(Erz), npy2c(Eix), npy2c(Eiy), npy2c(Eiz), npy2c(Hrx), npy2c(Hry), npy2c(Hrz), npy2c(Hix), npy2c(Hiy), npy2c(Hiz)) # <<<<<<<<<<<<<<
  7377. *
  7378. * E[i] = np.vstack((Erx.copy('C') + 1.0j*Eix.copy('C'), Ery.copy('C') + 1.0j*Eiy.copy('C'), Erz.copy('C') + 1.0j*Eiz.copy('C'))).transpose()
  7379. */
  7380. __pyx_tuple__16 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7381. __Pyx_GOTREF(__pyx_tuple__16);
  7382. __Pyx_GIVEREF(__pyx_tuple__16);
  7383. __pyx_tuple__17 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7384. __Pyx_GOTREF(__pyx_tuple__17);
  7385. __Pyx_GIVEREF(__pyx_tuple__17);
  7386. __pyx_slice__18 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7387. __Pyx_GOTREF(__pyx_slice__18);
  7388. __Pyx_GIVEREF(__pyx_slice__18);
  7389. __pyx_tuple__19 = PyTuple_Pack(2, __pyx_slice__18, __pyx_int_0); if (unlikely(!__pyx_tuple__19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7390. __Pyx_GOTREF(__pyx_tuple__19);
  7391. __Pyx_GIVEREF(__pyx_tuple__19);
  7392. __pyx_tuple__20 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7393. __Pyx_GOTREF(__pyx_tuple__20);
  7394. __Pyx_GIVEREF(__pyx_tuple__20);
  7395. __pyx_slice__21 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7396. __Pyx_GOTREF(__pyx_slice__21);
  7397. __Pyx_GIVEREF(__pyx_slice__21);
  7398. __pyx_tuple__22 = PyTuple_Pack(2, __pyx_slice__21, __pyx_int_1); if (unlikely(!__pyx_tuple__22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7399. __Pyx_GOTREF(__pyx_tuple__22);
  7400. __Pyx_GIVEREF(__pyx_tuple__22);
  7401. __pyx_tuple__23 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7402. __Pyx_GOTREF(__pyx_tuple__23);
  7403. __Pyx_GIVEREF(__pyx_tuple__23);
  7404. __pyx_slice__24 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7405. __Pyx_GOTREF(__pyx_slice__24);
  7406. __Pyx_GIVEREF(__pyx_slice__24);
  7407. __pyx_tuple__25 = PyTuple_Pack(2, __pyx_slice__24, __pyx_int_2); if (unlikely(!__pyx_tuple__25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7408. __Pyx_GOTREF(__pyx_tuple__25);
  7409. __Pyx_GIVEREF(__pyx_tuple__25);
  7410. __pyx_tuple__26 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7411. __Pyx_GOTREF(__pyx_tuple__26);
  7412. __Pyx_GIVEREF(__pyx_tuple__26);
  7413. /* "scattnlay_mp.pyx":193
  7414. * terms[i] = nField(x.shape[1], pl, x[i].copy('C'), m[i].copy('C'), nmax, coords.shape[0], coords[:, 0].copy('C'), coords[:, 1].copy('C'), coords[:, 2].copy('C'), npy2c(Erx), npy2c(Ery), npy2c(Erz), npy2c(Eix), npy2c(Eiy), npy2c(Eiz), npy2c(Hrx), npy2c(Hry), npy2c(Hrz), npy2c(Hix), npy2c(Hiy), npy2c(Hiz))
  7415. *
  7416. * E[i] = np.vstack((Erx.copy('C') + 1.0j*Eix.copy('C'), Ery.copy('C') + 1.0j*Eiy.copy('C'), Erz.copy('C') + 1.0j*Eiz.copy('C'))).transpose() # <<<<<<<<<<<<<<
  7417. * H[i] = np.vstack((Hrx.copy('C') + 1.0j*Hix.copy('C'), Hry.copy('C') + 1.0j*Hiy.copy('C'), Hrz.copy('C') + 1.0j*Hiz.copy('C'))).transpose()
  7418. *
  7419. */
  7420. __pyx_tuple__27 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7421. __Pyx_GOTREF(__pyx_tuple__27);
  7422. __Pyx_GIVEREF(__pyx_tuple__27);
  7423. __pyx_tuple__28 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7424. __Pyx_GOTREF(__pyx_tuple__28);
  7425. __Pyx_GIVEREF(__pyx_tuple__28);
  7426. __pyx_tuple__29 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7427. __Pyx_GOTREF(__pyx_tuple__29);
  7428. __Pyx_GIVEREF(__pyx_tuple__29);
  7429. __pyx_tuple__30 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7430. __Pyx_GOTREF(__pyx_tuple__30);
  7431. __Pyx_GIVEREF(__pyx_tuple__30);
  7432. __pyx_tuple__31 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7433. __Pyx_GOTREF(__pyx_tuple__31);
  7434. __Pyx_GIVEREF(__pyx_tuple__31);
  7435. __pyx_tuple__32 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7436. __Pyx_GOTREF(__pyx_tuple__32);
  7437. __Pyx_GIVEREF(__pyx_tuple__32);
  7438. /* "scattnlay_mp.pyx":194
  7439. *
  7440. * E[i] = np.vstack((Erx.copy('C') + 1.0j*Eix.copy('C'), Ery.copy('C') + 1.0j*Eiy.copy('C'), Erz.copy('C') + 1.0j*Eiz.copy('C'))).transpose()
  7441. * H[i] = np.vstack((Hrx.copy('C') + 1.0j*Hix.copy('C'), Hry.copy('C') + 1.0j*Hiy.copy('C'), Hrz.copy('C') + 1.0j*Hiz.copy('C'))).transpose() # <<<<<<<<<<<<<<
  7442. *
  7443. * return terms, E, H
  7444. */
  7445. __pyx_tuple__33 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7446. __Pyx_GOTREF(__pyx_tuple__33);
  7447. __Pyx_GIVEREF(__pyx_tuple__33);
  7448. __pyx_tuple__34 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7449. __Pyx_GOTREF(__pyx_tuple__34);
  7450. __Pyx_GIVEREF(__pyx_tuple__34);
  7451. __pyx_tuple__35 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7452. __Pyx_GOTREF(__pyx_tuple__35);
  7453. __Pyx_GIVEREF(__pyx_tuple__35);
  7454. __pyx_tuple__36 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7455. __Pyx_GOTREF(__pyx_tuple__36);
  7456. __Pyx_GIVEREF(__pyx_tuple__36);
  7457. __pyx_tuple__37 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7458. __Pyx_GOTREF(__pyx_tuple__37);
  7459. __Pyx_GIVEREF(__pyx_tuple__37);
  7460. __pyx_tuple__38 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7461. __Pyx_GOTREF(__pyx_tuple__38);
  7462. __Pyx_GIVEREF(__pyx_tuple__38);
  7463. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":218
  7464. * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
  7465. * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
  7466. * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
  7467. *
  7468. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  7469. */
  7470. __pyx_tuple__39 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__39)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7471. __Pyx_GOTREF(__pyx_tuple__39);
  7472. __Pyx_GIVEREF(__pyx_tuple__39);
  7473. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":222
  7474. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  7475. * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
  7476. * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
  7477. *
  7478. * info.buf = PyArray_DATA(self)
  7479. */
  7480. __pyx_tuple__40 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__40)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7481. __Pyx_GOTREF(__pyx_tuple__40);
  7482. __Pyx_GIVEREF(__pyx_tuple__40);
  7483. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":259
  7484. * if ((descr.byteorder == c'>' and little_endian) or
  7485. * (descr.byteorder == c'<' and not little_endian)):
  7486. * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
  7487. * if t == NPY_BYTE: f = "b"
  7488. * elif t == NPY_UBYTE: f = "B"
  7489. */
  7490. __pyx_tuple__41 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__41)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7491. __Pyx_GOTREF(__pyx_tuple__41);
  7492. __Pyx_GIVEREF(__pyx_tuple__41);
  7493. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":799
  7494. *
  7495. * if (end - f) - <int>(new_offset - offset[0]) < 15:
  7496. * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
  7497. *
  7498. * if ((child.byteorder == c'>' and little_endian) or
  7499. */
  7500. __pyx_tuple__42 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__42)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7501. __Pyx_GOTREF(__pyx_tuple__42);
  7502. __Pyx_GIVEREF(__pyx_tuple__42);
  7503. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":803
  7504. * if ((child.byteorder == c'>' and little_endian) or
  7505. * (child.byteorder == c'<' and not little_endian)):
  7506. * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
  7507. * # One could encode it in the format string and have Cython
  7508. * # complain instead, BUT: < and > in format strings also imply
  7509. */
  7510. __pyx_tuple__43 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__43)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7511. __Pyx_GOTREF(__pyx_tuple__43);
  7512. __Pyx_GIVEREF(__pyx_tuple__43);
  7513. /* "../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":823
  7514. * t = child.type_num
  7515. * if end - f < 5:
  7516. * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
  7517. *
  7518. * # Until ticket #99 is fixed, use integers to avoid warnings
  7519. */
  7520. __pyx_tuple__44 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__44)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7521. __Pyx_GOTREF(__pyx_tuple__44);
  7522. __Pyx_GIVEREF(__pyx_tuple__44);
  7523. /* "scattnlay_mp.pyx":53
  7524. * cdef int nField(int L, int pl, vector[double] x, vector[complex] m, int nmax, int nCoords, vector[double] Xp, vector[double] Yp, vector[double] Zp, double Erx[], double Ery[], double Erz[], double Eix[], double Eiy[], double Eiz[], double Hrx[], double Hry[], double Hrz[], double Hix[], double Hiy[], double Hiz[])
  7525. *
  7526. * def scattcoeffs(np.ndarray[np.float64_t, ndim = 2] x, np.ndarray[np.complex128_t, ndim = 2] m, np.int_t nmax, np.int_t pl = -1): # <<<<<<<<<<<<<<
  7527. * """
  7528. * scattcoeffs(x, m, nmax, pl)
  7529. */
  7530. __pyx_tuple__45 = PyTuple_Pack(12, __pyx_n_s_x, __pyx_n_s_m, __pyx_n_s_nmax, __pyx_n_s_pl, __pyx_n_s_i, __pyx_n_s_terms, __pyx_n_s_an, __pyx_n_s_bn, __pyx_n_s_anr, __pyx_n_s_ani, __pyx_n_s_bnr, __pyx_n_s_bni); if (unlikely(!__pyx_tuple__45)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7531. __Pyx_GOTREF(__pyx_tuple__45);
  7532. __Pyx_GIVEREF(__pyx_tuple__45);
  7533. __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(4, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_ovidio_scattering_scattnla, __pyx_n_s_scattcoeffs, 53, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7534. /* "scattnlay_mp.pyx":97
  7535. * return terms, an, bn
  7536. *
  7537. * def scattnlay(np.ndarray[np.float64_t, ndim = 2] x, np.ndarray[np.complex128_t, ndim = 2] m, np.ndarray[np.float64_t, ndim = 1] theta = np.zeros(0, dtype = np.float64), np.int_t nmax = -1, np.int_t pl = -1): # <<<<<<<<<<<<<<
  7538. * """
  7539. * scattnlay(x, m, [theta, nmax, pl])
  7540. */
  7541. __pyx_tuple__47 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7542. __Pyx_GOTREF(__pyx_tuple__47);
  7543. __Pyx_GIVEREF(__pyx_tuple__47);
  7544. __pyx_tuple__48 = PyTuple_Pack(20, __pyx_n_s_x, __pyx_n_s_m, __pyx_n_s_theta, __pyx_n_s_nmax, __pyx_n_s_pl, __pyx_n_s_i, __pyx_n_s_terms, __pyx_n_s_Qext, __pyx_n_s_Qabs, __pyx_n_s_Qsca, __pyx_n_s_Qbk, __pyx_n_s_Qpr, __pyx_n_s_g, __pyx_n_s_Albedo, __pyx_n_s_S1, __pyx_n_s_S2, __pyx_n_s_S1r, __pyx_n_s_S1i, __pyx_n_s_S2r, __pyx_n_s_S2i); if (unlikely(!__pyx_tuple__48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7545. __Pyx_GOTREF(__pyx_tuple__48);
  7546. __Pyx_GIVEREF(__pyx_tuple__48);
  7547. __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(5, 0, 20, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_ovidio_scattering_scattnla, __pyx_n_s_scattnlay, 97, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7548. /* "scattnlay_mp.pyx":156
  7549. * return terms, Qext, Qsca, Qabs, Qbk, Qpr, g, Albedo, S1, S2
  7550. *
  7551. * def fieldnlay(np.ndarray[np.float64_t, ndim = 2] x, np.ndarray[np.complex128_t, ndim = 2] m, np.ndarray[np.float64_t, ndim = 2] coords, np.int_t nmax = -1, np.int_t pl = -1): # <<<<<<<<<<<<<<
  7552. * cdef Py_ssize_t i
  7553. *
  7554. */
  7555. __pyx_tuple__50 = PyTuple_Pack(21, __pyx_n_s_x, __pyx_n_s_m, __pyx_n_s_coords, __pyx_n_s_nmax, __pyx_n_s_pl, __pyx_n_s_i, __pyx_n_s_terms, __pyx_n_s_E, __pyx_n_s_H, __pyx_n_s_Erx, __pyx_n_s_Ery, __pyx_n_s_Erz, __pyx_n_s_Eix, __pyx_n_s_Eiy, __pyx_n_s_Eiz, __pyx_n_s_Hrx, __pyx_n_s_Hry, __pyx_n_s_Hrz, __pyx_n_s_Hix, __pyx_n_s_Hiy, __pyx_n_s_Hiz); if (unlikely(!__pyx_tuple__50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7556. __Pyx_GOTREF(__pyx_tuple__50);
  7557. __Pyx_GIVEREF(__pyx_tuple__50);
  7558. __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(5, 0, 21, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_ovidio_scattering_scattnla, __pyx_n_s_fieldnlay, 156, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7559. __Pyx_RefNannyFinishContext();
  7560. return 0;
  7561. __pyx_L1_error:;
  7562. __Pyx_RefNannyFinishContext();
  7563. return -1;
  7564. }
  7565. static int __Pyx_InitGlobals(void) {
  7566. if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  7567. __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7568. __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7569. __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7570. __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7571. return 0;
  7572. __pyx_L1_error:;
  7573. return -1;
  7574. }
  7575. #if PY_MAJOR_VERSION < 3
  7576. PyMODINIT_FUNC initscattnlay_mp(void); /*proto*/
  7577. PyMODINIT_FUNC initscattnlay_mp(void)
  7578. #else
  7579. PyMODINIT_FUNC PyInit_scattnlay_mp(void); /*proto*/
  7580. PyMODINIT_FUNC PyInit_scattnlay_mp(void)
  7581. #endif
  7582. {
  7583. PyObject *__pyx_t_1 = NULL;
  7584. PyObject *__pyx_t_2 = NULL;
  7585. PyObject *__pyx_t_3 = NULL;
  7586. PyObject *__pyx_t_4 = NULL;
  7587. int __pyx_lineno = 0;
  7588. const char *__pyx_filename = NULL;
  7589. int __pyx_clineno = 0;
  7590. __Pyx_RefNannyDeclarations
  7591. #if CYTHON_REFNANNY
  7592. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  7593. if (!__Pyx_RefNanny) {
  7594. PyErr_Clear();
  7595. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  7596. if (!__Pyx_RefNanny)
  7597. Py_FatalError("failed to import 'refnanny' module");
  7598. }
  7599. #endif
  7600. __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_scattnlay_mp(void)", 0);
  7601. if (__Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7602. __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7603. __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7604. #ifdef __Pyx_CyFunction_USED
  7605. if (__pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7606. #endif
  7607. #ifdef __Pyx_FusedFunction_USED
  7608. if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7609. #endif
  7610. #ifdef __Pyx_Coroutine_USED
  7611. if (__pyx_Coroutine_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7612. #endif
  7613. #ifdef __Pyx_Generator_USED
  7614. if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7615. #endif
  7616. #ifdef __Pyx_StopAsyncIteration_USED
  7617. if (__pyx_StopAsyncIteration_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7618. #endif
  7619. /*--- Library function declarations ---*/
  7620. /*--- Threads initialization code ---*/
  7621. #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  7622. #ifdef WITH_THREAD /* Python build with threading support? */
  7623. PyEval_InitThreads();
  7624. #endif
  7625. #endif
  7626. /*--- Module creation code ---*/
  7627. #if PY_MAJOR_VERSION < 3
  7628. __pyx_m = Py_InitModule4("scattnlay_mp", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  7629. #else
  7630. __pyx_m = PyModule_Create(&__pyx_moduledef);
  7631. #endif
  7632. if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7633. __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7634. Py_INCREF(__pyx_d);
  7635. __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7636. #if CYTHON_COMPILING_IN_PYPY
  7637. Py_INCREF(__pyx_b);
  7638. #endif
  7639. if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  7640. /*--- Initialize various global constants etc. ---*/
  7641. if (__Pyx_InitGlobals() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7642. #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  7643. if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7644. #endif
  7645. if (__pyx_module_is_main_scattnlay_mp) {
  7646. if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7647. }
  7648. #if PY_MAJOR_VERSION >= 3
  7649. {
  7650. PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7651. if (!PyDict_GetItemString(modules, "scattnlay_mp")) {
  7652. if (unlikely(PyDict_SetItemString(modules, "scattnlay_mp", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7653. }
  7654. }
  7655. #endif
  7656. /*--- Builtin init code ---*/
  7657. if (__Pyx_InitCachedBuiltins() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7658. /*--- Constants init code ---*/
  7659. if (__Pyx_InitCachedConstants() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7660. /*--- Global init code ---*/
  7661. /*--- Variable export code ---*/
  7662. /*--- Function export code ---*/
  7663. /*--- Type init code ---*/
  7664. /*--- Type import code ---*/
  7665. __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type",
  7666. #if CYTHON_COMPILING_IN_PYPY
  7667. sizeof(PyTypeObject),
  7668. #else
  7669. sizeof(PyHeapTypeObject),
  7670. #endif
  7671. 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7672. __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7673. __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7674. __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7675. __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7676. __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7677. /*--- Variable import code ---*/
  7678. /*--- Function import code ---*/
  7679. /*--- Execution code ---*/
  7680. #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  7681. if (__Pyx_patch_abc() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7682. #endif
  7683. /* "scattnlay_mp.pyx":34
  7684. *
  7685. * from __future__ import division
  7686. * import numpy as np # <<<<<<<<<<<<<<
  7687. * cimport numpy as np
  7688. * from libcpp.vector cimport vector
  7689. */
  7690. __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7691. __Pyx_GOTREF(__pyx_t_1);
  7692. if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7693. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7694. /* "scattnlay_mp.pyx":53
  7695. * cdef int nField(int L, int pl, vector[double] x, vector[complex] m, int nmax, int nCoords, vector[double] Xp, vector[double] Yp, vector[double] Zp, double Erx[], double Ery[], double Erz[], double Eix[], double Eiy[], double Eiz[], double Hrx[], double Hry[], double Hrz[], double Hix[], double Hiy[], double Hiz[])
  7696. *
  7697. * def scattcoeffs(np.ndarray[np.float64_t, ndim = 2] x, np.ndarray[np.complex128_t, ndim = 2] m, np.int_t nmax, np.int_t pl = -1): # <<<<<<<<<<<<<<
  7698. * """
  7699. * scattcoeffs(x, m, nmax, pl)
  7700. */
  7701. __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_12scattnlay_mp_1scattcoeffs, NULL, __pyx_n_s_scattnlay_mp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7702. __Pyx_GOTREF(__pyx_t_1);
  7703. if (PyDict_SetItem(__pyx_d, __pyx_n_s_scattcoeffs, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7704. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7705. /* "scattnlay_mp.pyx":97
  7706. * return terms, an, bn
  7707. *
  7708. * def scattnlay(np.ndarray[np.float64_t, ndim = 2] x, np.ndarray[np.complex128_t, ndim = 2] m, np.ndarray[np.float64_t, ndim = 1] theta = np.zeros(0, dtype = np.float64), np.int_t nmax = -1, np.int_t pl = -1): # <<<<<<<<<<<<<<
  7709. * """
  7710. * scattnlay(x, m, [theta, nmax, pl])
  7711. */
  7712. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7713. __Pyx_GOTREF(__pyx_t_1);
  7714. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7715. __Pyx_GOTREF(__pyx_t_2);
  7716. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7717. __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7718. __Pyx_GOTREF(__pyx_t_1);
  7719. __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7720. __Pyx_GOTREF(__pyx_t_3);
  7721. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7722. __Pyx_GOTREF(__pyx_t_4);
  7723. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7724. if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7725. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7726. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__47, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7727. __Pyx_GOTREF(__pyx_t_4);
  7728. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7729. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7730. if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7731. __pyx_k__8 = ((PyArrayObject *)__pyx_t_4);
  7732. __Pyx_GIVEREF(__pyx_t_4);
  7733. __pyx_t_4 = 0;
  7734. __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_12scattnlay_mp_3scattnlay, NULL, __pyx_n_s_scattnlay_mp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7735. __Pyx_GOTREF(__pyx_t_4);
  7736. if (PyDict_SetItem(__pyx_d, __pyx_n_s_scattnlay, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7737. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7738. /* "scattnlay_mp.pyx":156
  7739. * return terms, Qext, Qsca, Qabs, Qbk, Qpr, g, Albedo, S1, S2
  7740. *
  7741. * def fieldnlay(np.ndarray[np.float64_t, ndim = 2] x, np.ndarray[np.complex128_t, ndim = 2] m, np.ndarray[np.float64_t, ndim = 2] coords, np.int_t nmax = -1, np.int_t pl = -1): # <<<<<<<<<<<<<<
  7742. * cdef Py_ssize_t i
  7743. *
  7744. */
  7745. __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_12scattnlay_mp_5fieldnlay, NULL, __pyx_n_s_scattnlay_mp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7746. __Pyx_GOTREF(__pyx_t_4);
  7747. if (PyDict_SetItem(__pyx_d, __pyx_n_s_fieldnlay, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7748. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7749. /* "scattnlay_mp.pyx":1
  7750. * # Copyright (C) 2009-2017 Ovidio Pena <ovidio@bytesfall.com> # <<<<<<<<<<<<<<
  7751. * # Copyright (C) 2013-2017 Konstantin Ladutenko <kostyfisik@gmail.com>
  7752. * #
  7753. */
  7754. __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7755. __Pyx_GOTREF(__pyx_t_4);
  7756. if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7757. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7758. /* "vector.from_py":50
  7759. *
  7760. * @cname("__pyx_convert_vector_from_py___pyx_t_double_complex")
  7761. * cdef vector[X] __pyx_convert_vector_from_py___pyx_t_double_complex(object o) except *: # <<<<<<<<<<<<<<
  7762. * cdef vector[X] v
  7763. * for item in o:
  7764. */
  7765. /*--- Wrapped vars code ---*/
  7766. goto __pyx_L0;
  7767. __pyx_L1_error:;
  7768. __Pyx_XDECREF(__pyx_t_1);
  7769. __Pyx_XDECREF(__pyx_t_2);
  7770. __Pyx_XDECREF(__pyx_t_3);
  7771. __Pyx_XDECREF(__pyx_t_4);
  7772. if (__pyx_m) {
  7773. if (__pyx_d) {
  7774. __Pyx_AddTraceback("init scattnlay_mp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7775. }
  7776. Py_DECREF(__pyx_m); __pyx_m = 0;
  7777. } else if (!PyErr_Occurred()) {
  7778. PyErr_SetString(PyExc_ImportError, "init scattnlay_mp");
  7779. }
  7780. __pyx_L0:;
  7781. __Pyx_RefNannyFinishContext();
  7782. #if PY_MAJOR_VERSION < 3
  7783. return;
  7784. #else
  7785. return __pyx_m;
  7786. #endif
  7787. }
  7788. /* --- Runtime support code --- */
  7789. #if CYTHON_REFNANNY
  7790. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
  7791. PyObject *m = NULL, *p = NULL;
  7792. void *r = NULL;
  7793. m = PyImport_ImportModule((char *)modname);
  7794. if (!m) goto end;
  7795. p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
  7796. if (!p) goto end;
  7797. r = PyLong_AsVoidPtr(p);
  7798. end:
  7799. Py_XDECREF(p);
  7800. Py_XDECREF(m);
  7801. return (__Pyx_RefNannyAPIStruct *)r;
  7802. }
  7803. #endif
  7804. static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
  7805. PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
  7806. if (unlikely(!result)) {
  7807. PyErr_Format(PyExc_NameError,
  7808. #if PY_MAJOR_VERSION >= 3
  7809. "name '%U' is not defined", name);
  7810. #else
  7811. "name '%.200s' is not defined", PyString_AS_STRING(name));
  7812. #endif
  7813. }
  7814. return result;
  7815. }
  7816. static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
  7817. PyObject *result;
  7818. #if CYTHON_COMPILING_IN_CPYTHON
  7819. result = PyDict_GetItem(__pyx_d, name);
  7820. if (likely(result)) {
  7821. Py_INCREF(result);
  7822. } else {
  7823. #else
  7824. result = PyObject_GetItem(__pyx_d, name);
  7825. if (!result) {
  7826. PyErr_Clear();
  7827. #endif
  7828. result = __Pyx_GetBuiltinName(name);
  7829. }
  7830. return result;
  7831. }
  7832. #if CYTHON_COMPILING_IN_CPYTHON
  7833. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  7834. PyObject *result;
  7835. ternaryfunc call = func->ob_type->tp_call;
  7836. if (unlikely(!call))
  7837. return PyObject_Call(func, arg, kw);
  7838. if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
  7839. return NULL;
  7840. result = (*call)(func, arg, kw);
  7841. Py_LeaveRecursiveCall();
  7842. if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  7843. PyErr_SetString(
  7844. PyExc_SystemError,
  7845. "NULL result without error in PyObject_Call");
  7846. }
  7847. return result;
  7848. }
  7849. #endif
  7850. static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
  7851. if (unlikely(!type)) {
  7852. PyErr_SetString(PyExc_SystemError, "Missing type object");
  7853. return 0;
  7854. }
  7855. if (likely(PyObject_TypeCheck(obj, type)))
  7856. return 1;
  7857. PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
  7858. Py_TYPE(obj)->tp_name, type->tp_name);
  7859. return 0;
  7860. }
  7861. static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
  7862. #if CYTHON_COMPILING_IN_CPYTHON
  7863. PyObject *tmp_type, *tmp_value, *tmp_tb;
  7864. PyThreadState *tstate = PyThreadState_GET();
  7865. tmp_type = tstate->curexc_type;
  7866. tmp_value = tstate->curexc_value;
  7867. tmp_tb = tstate->curexc_traceback;
  7868. tstate->curexc_type = type;
  7869. tstate->curexc_value = value;
  7870. tstate->curexc_traceback = tb;
  7871. Py_XDECREF(tmp_type);
  7872. Py_XDECREF(tmp_value);
  7873. Py_XDECREF(tmp_tb);
  7874. #else
  7875. PyErr_Restore(type, value, tb);
  7876. #endif
  7877. }
  7878. static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
  7879. #if CYTHON_COMPILING_IN_CPYTHON
  7880. PyThreadState *tstate = PyThreadState_GET();
  7881. *type = tstate->curexc_type;
  7882. *value = tstate->curexc_value;
  7883. *tb = tstate->curexc_traceback;
  7884. tstate->curexc_type = 0;
  7885. tstate->curexc_value = 0;
  7886. tstate->curexc_traceback = 0;
  7887. #else
  7888. PyErr_Fetch(type, value, tb);
  7889. #endif
  7890. }
  7891. static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
  7892. CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
  7893. int full_traceback, CYTHON_UNUSED int nogil) {
  7894. PyObject *old_exc, *old_val, *old_tb;
  7895. PyObject *ctx;
  7896. #ifdef WITH_THREAD
  7897. PyGILState_STATE state;
  7898. if (nogil)
  7899. state = PyGILState_Ensure();
  7900. #endif
  7901. __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
  7902. if (full_traceback) {
  7903. Py_XINCREF(old_exc);
  7904. Py_XINCREF(old_val);
  7905. Py_XINCREF(old_tb);
  7906. __Pyx_ErrRestore(old_exc, old_val, old_tb);
  7907. PyErr_PrintEx(1);
  7908. }
  7909. #if PY_MAJOR_VERSION < 3
  7910. ctx = PyString_FromString(name);
  7911. #else
  7912. ctx = PyUnicode_FromString(name);
  7913. #endif
  7914. __Pyx_ErrRestore(old_exc, old_val, old_tb);
  7915. if (!ctx) {
  7916. PyErr_WriteUnraisable(Py_None);
  7917. } else {
  7918. PyErr_WriteUnraisable(ctx);
  7919. Py_DECREF(ctx);
  7920. }
  7921. #ifdef WITH_THREAD
  7922. if (nogil)
  7923. PyGILState_Release(state);
  7924. #endif
  7925. }
  7926. static void __Pyx_RaiseArgtupleInvalid(
  7927. const char* func_name,
  7928. int exact,
  7929. Py_ssize_t num_min,
  7930. Py_ssize_t num_max,
  7931. Py_ssize_t num_found)
  7932. {
  7933. Py_ssize_t num_expected;
  7934. const char *more_or_less;
  7935. if (num_found < num_min) {
  7936. num_expected = num_min;
  7937. more_or_less = "at least";
  7938. } else {
  7939. num_expected = num_max;
  7940. more_or_less = "at most";
  7941. }
  7942. if (exact) {
  7943. more_or_less = "exactly";
  7944. }
  7945. PyErr_Format(PyExc_TypeError,
  7946. "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
  7947. func_name, more_or_less, num_expected,
  7948. (num_expected == 1) ? "" : "s", num_found);
  7949. }
  7950. static void __Pyx_RaiseDoubleKeywordsError(
  7951. const char* func_name,
  7952. PyObject* kw_name)
  7953. {
  7954. PyErr_Format(PyExc_TypeError,
  7955. #if PY_MAJOR_VERSION >= 3
  7956. "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
  7957. #else
  7958. "%s() got multiple values for keyword argument '%s'", func_name,
  7959. PyString_AsString(kw_name));
  7960. #endif
  7961. }
  7962. static int __Pyx_ParseOptionalKeywords(
  7963. PyObject *kwds,
  7964. PyObject **argnames[],
  7965. PyObject *kwds2,
  7966. PyObject *values[],
  7967. Py_ssize_t num_pos_args,
  7968. const char* function_name)
  7969. {
  7970. PyObject *key = 0, *value = 0;
  7971. Py_ssize_t pos = 0;
  7972. PyObject*** name;
  7973. PyObject*** first_kw_arg = argnames + num_pos_args;
  7974. while (PyDict_Next(kwds, &pos, &key, &value)) {
  7975. name = first_kw_arg;
  7976. while (*name && (**name != key)) name++;
  7977. if (*name) {
  7978. values[name-argnames] = value;
  7979. continue;
  7980. }
  7981. name = first_kw_arg;
  7982. #if PY_MAJOR_VERSION < 3
  7983. if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
  7984. while (*name) {
  7985. if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
  7986. && _PyString_Eq(**name, key)) {
  7987. values[name-argnames] = value;
  7988. break;
  7989. }
  7990. name++;
  7991. }
  7992. if (*name) continue;
  7993. else {
  7994. PyObject*** argname = argnames;
  7995. while (argname != first_kw_arg) {
  7996. if ((**argname == key) || (
  7997. (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
  7998. && _PyString_Eq(**argname, key))) {
  7999. goto arg_passed_twice;
  8000. }
  8001. argname++;
  8002. }
  8003. }
  8004. } else
  8005. #endif
  8006. if (likely(PyUnicode_Check(key))) {
  8007. while (*name) {
  8008. int cmp = (**name == key) ? 0 :
  8009. #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
  8010. (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
  8011. #endif
  8012. PyUnicode_Compare(**name, key);
  8013. if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  8014. if (cmp == 0) {
  8015. values[name-argnames] = value;
  8016. break;
  8017. }
  8018. name++;
  8019. }
  8020. if (*name) continue;
  8021. else {
  8022. PyObject*** argname = argnames;
  8023. while (argname != first_kw_arg) {
  8024. int cmp = (**argname == key) ? 0 :
  8025. #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
  8026. (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
  8027. #endif
  8028. PyUnicode_Compare(**argname, key);
  8029. if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  8030. if (cmp == 0) goto arg_passed_twice;
  8031. argname++;
  8032. }
  8033. }
  8034. } else
  8035. goto invalid_keyword_type;
  8036. if (kwds2) {
  8037. if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
  8038. } else {
  8039. goto invalid_keyword;
  8040. }
  8041. }
  8042. return 0;
  8043. arg_passed_twice:
  8044. __Pyx_RaiseDoubleKeywordsError(function_name, key);
  8045. goto bad;
  8046. invalid_keyword_type:
  8047. PyErr_Format(PyExc_TypeError,
  8048. "%.200s() keywords must be strings", function_name);
  8049. goto bad;
  8050. invalid_keyword:
  8051. PyErr_Format(PyExc_TypeError,
  8052. #if PY_MAJOR_VERSION < 3
  8053. "%.200s() got an unexpected keyword argument '%.200s'",
  8054. function_name, PyString_AsString(key));
  8055. #else
  8056. "%s() got an unexpected keyword argument '%U'",
  8057. function_name, key);
  8058. #endif
  8059. bad:
  8060. return -1;
  8061. }
  8062. static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
  8063. PyErr_Format(PyExc_TypeError,
  8064. "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
  8065. name, type->tp_name, Py_TYPE(obj)->tp_name);
  8066. }
  8067. static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
  8068. const char *name, int exact)
  8069. {
  8070. if (unlikely(!type)) {
  8071. PyErr_SetString(PyExc_SystemError, "Missing type object");
  8072. return 0;
  8073. }
  8074. if (none_allowed && obj == Py_None) return 1;
  8075. else if (exact) {
  8076. if (likely(Py_TYPE(obj) == type)) return 1;
  8077. #if PY_MAJOR_VERSION == 2
  8078. else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
  8079. #endif
  8080. }
  8081. else {
  8082. if (likely(PyObject_TypeCheck(obj, type))) return 1;
  8083. }
  8084. __Pyx_RaiseArgumentTypeInvalid(name, obj, type);
  8085. return 0;
  8086. }
  8087. static CYTHON_INLINE int __Pyx_IsLittleEndian(void) {
  8088. unsigned int n = 1;
  8089. return *(unsigned char*)(&n) != 0;
  8090. }
  8091. static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
  8092. __Pyx_BufFmt_StackElem* stack,
  8093. __Pyx_TypeInfo* type) {
  8094. stack[0].field = &ctx->root;
  8095. stack[0].parent_offset = 0;
  8096. ctx->root.type = type;
  8097. ctx->root.name = "buffer dtype";
  8098. ctx->root.offset = 0;
  8099. ctx->head = stack;
  8100. ctx->head->field = &ctx->root;
  8101. ctx->fmt_offset = 0;
  8102. ctx->head->parent_offset = 0;
  8103. ctx->new_packmode = '@';
  8104. ctx->enc_packmode = '@';
  8105. ctx->new_count = 1;
  8106. ctx->enc_count = 0;
  8107. ctx->enc_type = 0;
  8108. ctx->is_complex = 0;
  8109. ctx->is_valid_array = 0;
  8110. ctx->struct_alignment = 0;
  8111. while (type->typegroup == 'S') {
  8112. ++ctx->head;
  8113. ctx->head->field = type->fields;
  8114. ctx->head->parent_offset = 0;
  8115. type = type->fields->type;
  8116. }
  8117. }
  8118. static int __Pyx_BufFmt_ParseNumber(const char** ts) {
  8119. int count;
  8120. const char* t = *ts;
  8121. if (*t < '0' || *t > '9') {
  8122. return -1;
  8123. } else {
  8124. count = *t++ - '0';
  8125. while (*t >= '0' && *t < '9') {
  8126. count *= 10;
  8127. count += *t++ - '0';
  8128. }
  8129. }
  8130. *ts = t;
  8131. return count;
  8132. }
  8133. static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
  8134. int number = __Pyx_BufFmt_ParseNumber(ts);
  8135. if (number == -1)
  8136. PyErr_Format(PyExc_ValueError,\
  8137. "Does not understand character buffer dtype format string ('%c')", **ts);
  8138. return number;
  8139. }
  8140. static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
  8141. PyErr_Format(PyExc_ValueError,
  8142. "Unexpected format string character: '%c'", ch);
  8143. }
  8144. static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
  8145. switch (ch) {
  8146. case 'c': return "'char'";
  8147. case 'b': return "'signed char'";
  8148. case 'B': return "'unsigned char'";
  8149. case 'h': return "'short'";
  8150. case 'H': return "'unsigned short'";
  8151. case 'i': return "'int'";
  8152. case 'I': return "'unsigned int'";
  8153. case 'l': return "'long'";
  8154. case 'L': return "'unsigned long'";
  8155. case 'q': return "'long long'";
  8156. case 'Q': return "'unsigned long long'";
  8157. case 'f': return (is_complex ? "'complex float'" : "'float'");
  8158. case 'd': return (is_complex ? "'complex double'" : "'double'");
  8159. case 'g': return (is_complex ? "'complex long double'" : "'long double'");
  8160. case 'T': return "a struct";
  8161. case 'O': return "Python object";
  8162. case 'P': return "a pointer";
  8163. case 's': case 'p': return "a string";
  8164. case 0: return "end";
  8165. default: return "unparseable format string";
  8166. }
  8167. }
  8168. static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
  8169. switch (ch) {
  8170. case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
  8171. case 'h': case 'H': return 2;
  8172. case 'i': case 'I': case 'l': case 'L': return 4;
  8173. case 'q': case 'Q': return 8;
  8174. case 'f': return (is_complex ? 8 : 4);
  8175. case 'd': return (is_complex ? 16 : 8);
  8176. case 'g': {
  8177. PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
  8178. return 0;
  8179. }
  8180. case 'O': case 'P': return sizeof(void*);
  8181. default:
  8182. __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  8183. return 0;
  8184. }
  8185. }
  8186. static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
  8187. switch (ch) {
  8188. case 'c': case 'b': case 'B': case 's': case 'p': return 1;
  8189. case 'h': case 'H': return sizeof(short);
  8190. case 'i': case 'I': return sizeof(int);
  8191. case 'l': case 'L': return sizeof(long);
  8192. #ifdef HAVE_LONG_LONG
  8193. case 'q': case 'Q': return sizeof(PY_LONG_LONG);
  8194. #endif
  8195. case 'f': return sizeof(float) * (is_complex ? 2 : 1);
  8196. case 'd': return sizeof(double) * (is_complex ? 2 : 1);
  8197. case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
  8198. case 'O': case 'P': return sizeof(void*);
  8199. default: {
  8200. __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  8201. return 0;
  8202. }
  8203. }
  8204. }
  8205. typedef struct { char c; short x; } __Pyx_st_short;
  8206. typedef struct { char c; int x; } __Pyx_st_int;
  8207. typedef struct { char c; long x; } __Pyx_st_long;
  8208. typedef struct { char c; float x; } __Pyx_st_float;
  8209. typedef struct { char c; double x; } __Pyx_st_double;
  8210. typedef struct { char c; long double x; } __Pyx_st_longdouble;
  8211. typedef struct { char c; void *x; } __Pyx_st_void_p;
  8212. #ifdef HAVE_LONG_LONG
  8213. typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
  8214. #endif
  8215. static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
  8216. switch (ch) {
  8217. case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
  8218. case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
  8219. case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
  8220. case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
  8221. #ifdef HAVE_LONG_LONG
  8222. case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
  8223. #endif
  8224. case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
  8225. case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
  8226. case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
  8227. case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
  8228. default:
  8229. __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  8230. return 0;
  8231. }
  8232. }
  8233. /* These are for computing the padding at the end of the struct to align
  8234. on the first member of the struct. This will probably the same as above,
  8235. but we don't have any guarantees.
  8236. */
  8237. typedef struct { short x; char c; } __Pyx_pad_short;
  8238. typedef struct { int x; char c; } __Pyx_pad_int;
  8239. typedef struct { long x; char c; } __Pyx_pad_long;
  8240. typedef struct { float x; char c; } __Pyx_pad_float;
  8241. typedef struct { double x; char c; } __Pyx_pad_double;
  8242. typedef struct { long double x; char c; } __Pyx_pad_longdouble;
  8243. typedef struct { void *x; char c; } __Pyx_pad_void_p;
  8244. #ifdef HAVE_LONG_LONG
  8245. typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
  8246. #endif
  8247. static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
  8248. switch (ch) {
  8249. case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
  8250. case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
  8251. case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
  8252. case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
  8253. #ifdef HAVE_LONG_LONG
  8254. case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
  8255. #endif
  8256. case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
  8257. case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
  8258. case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
  8259. case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
  8260. default:
  8261. __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  8262. return 0;
  8263. }
  8264. }
  8265. static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
  8266. switch (ch) {
  8267. case 'c':
  8268. return 'H';
  8269. case 'b': case 'h': case 'i':
  8270. case 'l': case 'q': case 's': case 'p':
  8271. return 'I';
  8272. case 'B': case 'H': case 'I': case 'L': case 'Q':
  8273. return 'U';
  8274. case 'f': case 'd': case 'g':
  8275. return (is_complex ? 'C' : 'R');
  8276. case 'O':
  8277. return 'O';
  8278. case 'P':
  8279. return 'P';
  8280. default: {
  8281. __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  8282. return 0;
  8283. }
  8284. }
  8285. }
  8286. static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
  8287. if (ctx->head == NULL || ctx->head->field == &ctx->root) {
  8288. const char* expected;
  8289. const char* quote;
  8290. if (ctx->head == NULL) {
  8291. expected = "end";
  8292. quote = "";
  8293. } else {
  8294. expected = ctx->head->field->type->name;
  8295. quote = "'";
  8296. }
  8297. PyErr_Format(PyExc_ValueError,
  8298. "Buffer dtype mismatch, expected %s%s%s but got %s",
  8299. quote, expected, quote,
  8300. __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
  8301. } else {
  8302. __Pyx_StructField* field = ctx->head->field;
  8303. __Pyx_StructField* parent = (ctx->head - 1)->field;
  8304. PyErr_Format(PyExc_ValueError,
  8305. "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
  8306. field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
  8307. parent->type->name, field->name);
  8308. }
  8309. }
  8310. static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
  8311. char group;
  8312. size_t size, offset, arraysize = 1;
  8313. if (ctx->enc_type == 0) return 0;
  8314. if (ctx->head->field->type->arraysize[0]) {
  8315. int i, ndim = 0;
  8316. if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
  8317. ctx->is_valid_array = ctx->head->field->type->ndim == 1;
  8318. ndim = 1;
  8319. if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
  8320. PyErr_Format(PyExc_ValueError,
  8321. "Expected a dimension of size %zu, got %zu",
  8322. ctx->head->field->type->arraysize[0], ctx->enc_count);
  8323. return -1;
  8324. }
  8325. }
  8326. if (!ctx->is_valid_array) {
  8327. PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
  8328. ctx->head->field->type->ndim, ndim);
  8329. return -1;
  8330. }
  8331. for (i = 0; i < ctx->head->field->type->ndim; i++) {
  8332. arraysize *= ctx->head->field->type->arraysize[i];
  8333. }
  8334. ctx->is_valid_array = 0;
  8335. ctx->enc_count = 1;
  8336. }
  8337. group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
  8338. do {
  8339. __Pyx_StructField* field = ctx->head->field;
  8340. __Pyx_TypeInfo* type = field->type;
  8341. if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
  8342. size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
  8343. } else {
  8344. size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
  8345. }
  8346. if (ctx->enc_packmode == '@') {
  8347. size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
  8348. size_t align_mod_offset;
  8349. if (align_at == 0) return -1;
  8350. align_mod_offset = ctx->fmt_offset % align_at;
  8351. if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
  8352. if (ctx->struct_alignment == 0)
  8353. ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
  8354. ctx->is_complex);
  8355. }
  8356. if (type->size != size || type->typegroup != group) {
  8357. if (type->typegroup == 'C' && type->fields != NULL) {
  8358. size_t parent_offset = ctx->head->parent_offset + field->offset;
  8359. ++ctx->head;
  8360. ctx->head->field = type->fields;
  8361. ctx->head->parent_offset = parent_offset;
  8362. continue;
  8363. }
  8364. if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
  8365. } else {
  8366. __Pyx_BufFmt_RaiseExpected(ctx);
  8367. return -1;
  8368. }
  8369. }
  8370. offset = ctx->head->parent_offset + field->offset;
  8371. if (ctx->fmt_offset != offset) {
  8372. PyErr_Format(PyExc_ValueError,
  8373. "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
  8374. (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
  8375. return -1;
  8376. }
  8377. ctx->fmt_offset += size;
  8378. if (arraysize)
  8379. ctx->fmt_offset += (arraysize - 1) * size;
  8380. --ctx->enc_count;
  8381. while (1) {
  8382. if (field == &ctx->root) {
  8383. ctx->head = NULL;
  8384. if (ctx->enc_count != 0) {
  8385. __Pyx_BufFmt_RaiseExpected(ctx);
  8386. return -1;
  8387. }
  8388. break;
  8389. }
  8390. ctx->head->field = ++field;
  8391. if (field->type == NULL) {
  8392. --ctx->head;
  8393. field = ctx->head->field;
  8394. continue;
  8395. } else if (field->type->typegroup == 'S') {
  8396. size_t parent_offset = ctx->head->parent_offset + field->offset;
  8397. if (field->type->fields->type == NULL) continue;
  8398. field = field->type->fields;
  8399. ++ctx->head;
  8400. ctx->head->field = field;
  8401. ctx->head->parent_offset = parent_offset;
  8402. break;
  8403. } else {
  8404. break;
  8405. }
  8406. }
  8407. } while (ctx->enc_count);
  8408. ctx->enc_type = 0;
  8409. ctx->is_complex = 0;
  8410. return 0;
  8411. }
  8412. static CYTHON_INLINE PyObject *
  8413. __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
  8414. {
  8415. const char *ts = *tsp;
  8416. int i = 0, number;
  8417. int ndim = ctx->head->field->type->ndim;
  8418. ;
  8419. ++ts;
  8420. if (ctx->new_count != 1) {
  8421. PyErr_SetString(PyExc_ValueError,
  8422. "Cannot handle repeated arrays in format string");
  8423. return NULL;
  8424. }
  8425. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  8426. while (*ts && *ts != ')') {
  8427. switch (*ts) {
  8428. case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue;
  8429. default: break;
  8430. }
  8431. number = __Pyx_BufFmt_ExpectNumber(&ts);
  8432. if (number == -1) return NULL;
  8433. if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
  8434. return PyErr_Format(PyExc_ValueError,
  8435. "Expected a dimension of size %zu, got %d",
  8436. ctx->head->field->type->arraysize[i], number);
  8437. if (*ts != ',' && *ts != ')')
  8438. return PyErr_Format(PyExc_ValueError,
  8439. "Expected a comma in format string, got '%c'", *ts);
  8440. if (*ts == ',') ts++;
  8441. i++;
  8442. }
  8443. if (i != ndim)
  8444. return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
  8445. ctx->head->field->type->ndim, i);
  8446. if (!*ts) {
  8447. PyErr_SetString(PyExc_ValueError,
  8448. "Unexpected end of format string, expected ')'");
  8449. return NULL;
  8450. }
  8451. ctx->is_valid_array = 1;
  8452. ctx->new_count = 1;
  8453. *tsp = ++ts;
  8454. return Py_None;
  8455. }
  8456. static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
  8457. int got_Z = 0;
  8458. while (1) {
  8459. switch(*ts) {
  8460. case 0:
  8461. if (ctx->enc_type != 0 && ctx->head == NULL) {
  8462. __Pyx_BufFmt_RaiseExpected(ctx);
  8463. return NULL;
  8464. }
  8465. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  8466. if (ctx->head != NULL) {
  8467. __Pyx_BufFmt_RaiseExpected(ctx);
  8468. return NULL;
  8469. }
  8470. return ts;
  8471. case ' ':
  8472. case '\r':
  8473. case '\n':
  8474. ++ts;
  8475. break;
  8476. case '<':
  8477. if (!__Pyx_IsLittleEndian()) {
  8478. PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
  8479. return NULL;
  8480. }
  8481. ctx->new_packmode = '=';
  8482. ++ts;
  8483. break;
  8484. case '>':
  8485. case '!':
  8486. if (__Pyx_IsLittleEndian()) {
  8487. PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
  8488. return NULL;
  8489. }
  8490. ctx->new_packmode = '=';
  8491. ++ts;
  8492. break;
  8493. case '=':
  8494. case '@':
  8495. case '^':
  8496. ctx->new_packmode = *ts++;
  8497. break;
  8498. case 'T':
  8499. {
  8500. const char* ts_after_sub;
  8501. size_t i, struct_count = ctx->new_count;
  8502. size_t struct_alignment = ctx->struct_alignment;
  8503. ctx->new_count = 1;
  8504. ++ts;
  8505. if (*ts != '{') {
  8506. PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
  8507. return NULL;
  8508. }
  8509. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  8510. ctx->enc_type = 0;
  8511. ctx->enc_count = 0;
  8512. ctx->struct_alignment = 0;
  8513. ++ts;
  8514. ts_after_sub = ts;
  8515. for (i = 0; i != struct_count; ++i) {
  8516. ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
  8517. if (!ts_after_sub) return NULL;
  8518. }
  8519. ts = ts_after_sub;
  8520. if (struct_alignment) ctx->struct_alignment = struct_alignment;
  8521. }
  8522. break;
  8523. case '}':
  8524. {
  8525. size_t alignment = ctx->struct_alignment;
  8526. ++ts;
  8527. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  8528. ctx->enc_type = 0;
  8529. if (alignment && ctx->fmt_offset % alignment) {
  8530. ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
  8531. }
  8532. }
  8533. return ts;
  8534. case 'x':
  8535. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  8536. ctx->fmt_offset += ctx->new_count;
  8537. ctx->new_count = 1;
  8538. ctx->enc_count = 0;
  8539. ctx->enc_type = 0;
  8540. ctx->enc_packmode = ctx->new_packmode;
  8541. ++ts;
  8542. break;
  8543. case 'Z':
  8544. got_Z = 1;
  8545. ++ts;
  8546. if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
  8547. __Pyx_BufFmt_RaiseUnexpectedChar('Z');
  8548. return NULL;
  8549. }
  8550. case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
  8551. case 'l': case 'L': case 'q': case 'Q':
  8552. case 'f': case 'd': case 'g':
  8553. case 'O': case 'p':
  8554. if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
  8555. ctx->enc_packmode == ctx->new_packmode) {
  8556. ctx->enc_count += ctx->new_count;
  8557. ctx->new_count = 1;
  8558. got_Z = 0;
  8559. ++ts;
  8560. break;
  8561. }
  8562. case 's':
  8563. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  8564. ctx->enc_count = ctx->new_count;
  8565. ctx->enc_packmode = ctx->new_packmode;
  8566. ctx->enc_type = *ts;
  8567. ctx->is_complex = got_Z;
  8568. ++ts;
  8569. ctx->new_count = 1;
  8570. got_Z = 0;
  8571. break;
  8572. case ':':
  8573. ++ts;
  8574. while(*ts != ':') ++ts;
  8575. ++ts;
  8576. break;
  8577. case '(':
  8578. if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
  8579. break;
  8580. default:
  8581. {
  8582. int number = __Pyx_BufFmt_ExpectNumber(&ts);
  8583. if (number == -1) return NULL;
  8584. ctx->new_count = (size_t)number;
  8585. }
  8586. }
  8587. }
  8588. }
  8589. static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
  8590. buf->buf = NULL;
  8591. buf->obj = NULL;
  8592. buf->strides = __Pyx_zeros;
  8593. buf->shape = __Pyx_zeros;
  8594. buf->suboffsets = __Pyx_minusones;
  8595. }
  8596. static CYTHON_INLINE int __Pyx_GetBufferAndValidate(
  8597. Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags,
  8598. int nd, int cast, __Pyx_BufFmt_StackElem* stack)
  8599. {
  8600. if (obj == Py_None || obj == NULL) {
  8601. __Pyx_ZeroBuffer(buf);
  8602. return 0;
  8603. }
  8604. buf->buf = NULL;
  8605. if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
  8606. if (buf->ndim != nd) {
  8607. PyErr_Format(PyExc_ValueError,
  8608. "Buffer has wrong number of dimensions (expected %d, got %d)",
  8609. nd, buf->ndim);
  8610. goto fail;
  8611. }
  8612. if (!cast) {
  8613. __Pyx_BufFmt_Context ctx;
  8614. __Pyx_BufFmt_Init(&ctx, stack, dtype);
  8615. if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
  8616. }
  8617. if ((unsigned)buf->itemsize != dtype->size) {
  8618. PyErr_Format(PyExc_ValueError,
  8619. "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
  8620. buf->itemsize, (buf->itemsize > 1) ? "s" : "",
  8621. dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
  8622. goto fail;
  8623. }
  8624. if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
  8625. return 0;
  8626. fail:;
  8627. __Pyx_ZeroBuffer(buf);
  8628. return -1;
  8629. }
  8630. static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
  8631. if (info->buf == NULL) return;
  8632. if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
  8633. __Pyx_ReleaseBuffer(info);
  8634. }
  8635. static void __Pyx_RaiseBufferFallbackError(void) {
  8636. PyErr_SetString(PyExc_ValueError,
  8637. "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
  8638. }
  8639. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
  8640. PyObject *r;
  8641. if (!j) return NULL;
  8642. r = PyObject_GetItem(o, j);
  8643. Py_DECREF(j);
  8644. return r;
  8645. }
  8646. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
  8647. CYTHON_NCP_UNUSED int wraparound,
  8648. CYTHON_NCP_UNUSED int boundscheck) {
  8649. #if CYTHON_COMPILING_IN_CPYTHON
  8650. if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
  8651. if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
  8652. PyObject *r = PyList_GET_ITEM(o, i);
  8653. Py_INCREF(r);
  8654. return r;
  8655. }
  8656. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  8657. #else
  8658. return PySequence_GetItem(o, i);
  8659. #endif
  8660. }
  8661. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
  8662. CYTHON_NCP_UNUSED int wraparound,
  8663. CYTHON_NCP_UNUSED int boundscheck) {
  8664. #if CYTHON_COMPILING_IN_CPYTHON
  8665. if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
  8666. if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
  8667. PyObject *r = PyTuple_GET_ITEM(o, i);
  8668. Py_INCREF(r);
  8669. return r;
  8670. }
  8671. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  8672. #else
  8673. return PySequence_GetItem(o, i);
  8674. #endif
  8675. }
  8676. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
  8677. CYTHON_NCP_UNUSED int wraparound,
  8678. CYTHON_NCP_UNUSED int boundscheck) {
  8679. #if CYTHON_COMPILING_IN_CPYTHON
  8680. if (is_list || PyList_CheckExact(o)) {
  8681. Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
  8682. if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
  8683. PyObject *r = PyList_GET_ITEM(o, n);
  8684. Py_INCREF(r);
  8685. return r;
  8686. }
  8687. }
  8688. else if (PyTuple_CheckExact(o)) {
  8689. Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
  8690. if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
  8691. PyObject *r = PyTuple_GET_ITEM(o, n);
  8692. Py_INCREF(r);
  8693. return r;
  8694. }
  8695. } else {
  8696. PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
  8697. if (likely(m && m->sq_item)) {
  8698. if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
  8699. Py_ssize_t l = m->sq_length(o);
  8700. if (likely(l >= 0)) {
  8701. i += l;
  8702. } else {
  8703. if (PyErr_ExceptionMatches(PyExc_OverflowError))
  8704. PyErr_Clear();
  8705. else
  8706. return NULL;
  8707. }
  8708. }
  8709. return m->sq_item(o, i);
  8710. }
  8711. }
  8712. #else
  8713. if (is_list || PySequence_Check(o)) {
  8714. return PySequence_GetItem(o, i);
  8715. }
  8716. #endif
  8717. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  8718. }
  8719. static void __Pyx_RaiseBufferIndexError(int axis) {
  8720. PyErr_Format(PyExc_IndexError,
  8721. "Out of bounds on buffer access (axis %d)", axis);
  8722. }
  8723. static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
  8724. int r;
  8725. if (!j) return -1;
  8726. r = PyObject_SetItem(o, j, v);
  8727. Py_DECREF(j);
  8728. return r;
  8729. }
  8730. static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
  8731. CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) {
  8732. #if CYTHON_COMPILING_IN_CPYTHON
  8733. if (is_list || PyList_CheckExact(o)) {
  8734. Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
  8735. if ((!boundscheck) || likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
  8736. PyObject* old = PyList_GET_ITEM(o, n);
  8737. Py_INCREF(v);
  8738. PyList_SET_ITEM(o, n, v);
  8739. Py_DECREF(old);
  8740. return 1;
  8741. }
  8742. } else {
  8743. PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
  8744. if (likely(m && m->sq_ass_item)) {
  8745. if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
  8746. Py_ssize_t l = m->sq_length(o);
  8747. if (likely(l >= 0)) {
  8748. i += l;
  8749. } else {
  8750. if (PyErr_ExceptionMatches(PyExc_OverflowError))
  8751. PyErr_Clear();
  8752. else
  8753. return -1;
  8754. }
  8755. }
  8756. return m->sq_ass_item(o, i, v);
  8757. }
  8758. }
  8759. #else
  8760. #if CYTHON_COMPILING_IN_PYPY
  8761. if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) {
  8762. #else
  8763. if (is_list || PySequence_Check(o)) {
  8764. #endif
  8765. return PySequence_SetItem(o, i, v);
  8766. }
  8767. #endif
  8768. return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
  8769. }
  8770. #if CYTHON_COMPILING_IN_CPYTHON
  8771. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
  8772. PyObject *self, *result;
  8773. PyCFunction cfunc;
  8774. cfunc = PyCFunction_GET_FUNCTION(func);
  8775. self = PyCFunction_GET_SELF(func);
  8776. if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
  8777. return NULL;
  8778. result = cfunc(self, arg);
  8779. Py_LeaveRecursiveCall();
  8780. if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  8781. PyErr_SetString(
  8782. PyExc_SystemError,
  8783. "NULL result without error in PyObject_Call");
  8784. }
  8785. return result;
  8786. }
  8787. #endif
  8788. #if CYTHON_COMPILING_IN_CPYTHON
  8789. static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  8790. PyObject *result;
  8791. PyObject *args = PyTuple_New(1);
  8792. if (unlikely(!args)) return NULL;
  8793. Py_INCREF(arg);
  8794. PyTuple_SET_ITEM(args, 0, arg);
  8795. result = __Pyx_PyObject_Call(func, args, NULL);
  8796. Py_DECREF(args);
  8797. return result;
  8798. }
  8799. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  8800. #ifdef __Pyx_CyFunction_USED
  8801. if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
  8802. #else
  8803. if (likely(PyCFunction_Check(func))) {
  8804. #endif
  8805. if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
  8806. return __Pyx_PyObject_CallMethO(func, arg);
  8807. }
  8808. }
  8809. return __Pyx__PyObject_CallOneArg(func, arg);
  8810. }
  8811. #else
  8812. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  8813. PyObject *result;
  8814. PyObject *args = PyTuple_Pack(1, arg);
  8815. if (unlikely(!args)) return NULL;
  8816. result = __Pyx_PyObject_Call(func, args, NULL);
  8817. Py_DECREF(args);
  8818. return result;
  8819. }
  8820. #endif
  8821. #if CYTHON_COMPILING_IN_CPYTHON
  8822. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
  8823. #ifdef __Pyx_CyFunction_USED
  8824. if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
  8825. #else
  8826. if (likely(PyCFunction_Check(func))) {
  8827. #endif
  8828. if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
  8829. return __Pyx_PyObject_CallMethO(func, NULL);
  8830. }
  8831. }
  8832. return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
  8833. }
  8834. #endif
  8835. #if PY_MAJOR_VERSION < 3
  8836. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
  8837. CYTHON_UNUSED PyObject *cause) {
  8838. Py_XINCREF(type);
  8839. if (!value || value == Py_None)
  8840. value = NULL;
  8841. else
  8842. Py_INCREF(value);
  8843. if (!tb || tb == Py_None)
  8844. tb = NULL;
  8845. else {
  8846. Py_INCREF(tb);
  8847. if (!PyTraceBack_Check(tb)) {
  8848. PyErr_SetString(PyExc_TypeError,
  8849. "raise: arg 3 must be a traceback or None");
  8850. goto raise_error;
  8851. }
  8852. }
  8853. if (PyType_Check(type)) {
  8854. #if CYTHON_COMPILING_IN_PYPY
  8855. if (!value) {
  8856. Py_INCREF(Py_None);
  8857. value = Py_None;
  8858. }
  8859. #endif
  8860. PyErr_NormalizeException(&type, &value, &tb);
  8861. } else {
  8862. if (value) {
  8863. PyErr_SetString(PyExc_TypeError,
  8864. "instance exception may not have a separate value");
  8865. goto raise_error;
  8866. }
  8867. value = type;
  8868. type = (PyObject*) Py_TYPE(type);
  8869. Py_INCREF(type);
  8870. if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
  8871. PyErr_SetString(PyExc_TypeError,
  8872. "raise: exception class must be a subclass of BaseException");
  8873. goto raise_error;
  8874. }
  8875. }
  8876. __Pyx_ErrRestore(type, value, tb);
  8877. return;
  8878. raise_error:
  8879. Py_XDECREF(value);
  8880. Py_XDECREF(type);
  8881. Py_XDECREF(tb);
  8882. return;
  8883. }
  8884. #else
  8885. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
  8886. PyObject* owned_instance = NULL;
  8887. if (tb == Py_None) {
  8888. tb = 0;
  8889. } else if (tb && !PyTraceBack_Check(tb)) {
  8890. PyErr_SetString(PyExc_TypeError,
  8891. "raise: arg 3 must be a traceback or None");
  8892. goto bad;
  8893. }
  8894. if (value == Py_None)
  8895. value = 0;
  8896. if (PyExceptionInstance_Check(type)) {
  8897. if (value) {
  8898. PyErr_SetString(PyExc_TypeError,
  8899. "instance exception may not have a separate value");
  8900. goto bad;
  8901. }
  8902. value = type;
  8903. type = (PyObject*) Py_TYPE(value);
  8904. } else if (PyExceptionClass_Check(type)) {
  8905. PyObject *instance_class = NULL;
  8906. if (value && PyExceptionInstance_Check(value)) {
  8907. instance_class = (PyObject*) Py_TYPE(value);
  8908. if (instance_class != type) {
  8909. int is_subclass = PyObject_IsSubclass(instance_class, type);
  8910. if (!is_subclass) {
  8911. instance_class = NULL;
  8912. } else if (unlikely(is_subclass == -1)) {
  8913. goto bad;
  8914. } else {
  8915. type = instance_class;
  8916. }
  8917. }
  8918. }
  8919. if (!instance_class) {
  8920. PyObject *args;
  8921. if (!value)
  8922. args = PyTuple_New(0);
  8923. else if (PyTuple_Check(value)) {
  8924. Py_INCREF(value);
  8925. args = value;
  8926. } else
  8927. args = PyTuple_Pack(1, value);
  8928. if (!args)
  8929. goto bad;
  8930. owned_instance = PyObject_Call(type, args, NULL);
  8931. Py_DECREF(args);
  8932. if (!owned_instance)
  8933. goto bad;
  8934. value = owned_instance;
  8935. if (!PyExceptionInstance_Check(value)) {
  8936. PyErr_Format(PyExc_TypeError,
  8937. "calling %R should have returned an instance of "
  8938. "BaseException, not %R",
  8939. type, Py_TYPE(value));
  8940. goto bad;
  8941. }
  8942. }
  8943. } else {
  8944. PyErr_SetString(PyExc_TypeError,
  8945. "raise: exception class must be a subclass of BaseException");
  8946. goto bad;
  8947. }
  8948. #if PY_VERSION_HEX >= 0x03030000
  8949. if (cause) {
  8950. #else
  8951. if (cause && cause != Py_None) {
  8952. #endif
  8953. PyObject *fixed_cause;
  8954. if (cause == Py_None) {
  8955. fixed_cause = NULL;
  8956. } else if (PyExceptionClass_Check(cause)) {
  8957. fixed_cause = PyObject_CallObject(cause, NULL);
  8958. if (fixed_cause == NULL)
  8959. goto bad;
  8960. } else if (PyExceptionInstance_Check(cause)) {
  8961. fixed_cause = cause;
  8962. Py_INCREF(fixed_cause);
  8963. } else {
  8964. PyErr_SetString(PyExc_TypeError,
  8965. "exception causes must derive from "
  8966. "BaseException");
  8967. goto bad;
  8968. }
  8969. PyException_SetCause(value, fixed_cause);
  8970. }
  8971. PyErr_SetObject(type, value);
  8972. if (tb) {
  8973. #if CYTHON_COMPILING_IN_PYPY
  8974. PyObject *tmp_type, *tmp_value, *tmp_tb;
  8975. PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
  8976. Py_INCREF(tb);
  8977. PyErr_Restore(tmp_type, tmp_value, tb);
  8978. Py_XDECREF(tmp_tb);
  8979. #else
  8980. PyThreadState *tstate = PyThreadState_GET();
  8981. PyObject* tmp_tb = tstate->curexc_traceback;
  8982. if (tb != tmp_tb) {
  8983. Py_INCREF(tb);
  8984. tstate->curexc_traceback = tb;
  8985. Py_XDECREF(tmp_tb);
  8986. }
  8987. #endif
  8988. }
  8989. bad:
  8990. Py_XDECREF(owned_instance);
  8991. return;
  8992. }
  8993. #endif
  8994. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
  8995. PyErr_Format(PyExc_ValueError,
  8996. "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
  8997. }
  8998. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
  8999. PyErr_Format(PyExc_ValueError,
  9000. "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
  9001. index, (index == 1) ? "" : "s");
  9002. }
  9003. static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
  9004. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
  9005. }
  9006. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
  9007. PyObject *empty_list = 0;
  9008. PyObject *module = 0;
  9009. PyObject *global_dict = 0;
  9010. PyObject *empty_dict = 0;
  9011. PyObject *list;
  9012. #if PY_VERSION_HEX < 0x03030000
  9013. PyObject *py_import;
  9014. py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
  9015. if (!py_import)
  9016. goto bad;
  9017. #endif
  9018. if (from_list)
  9019. list = from_list;
  9020. else {
  9021. empty_list = PyList_New(0);
  9022. if (!empty_list)
  9023. goto bad;
  9024. list = empty_list;
  9025. }
  9026. global_dict = PyModule_GetDict(__pyx_m);
  9027. if (!global_dict)
  9028. goto bad;
  9029. empty_dict = PyDict_New();
  9030. if (!empty_dict)
  9031. goto bad;
  9032. {
  9033. #if PY_MAJOR_VERSION >= 3
  9034. if (level == -1) {
  9035. if (strchr(__Pyx_MODULE_NAME, '.')) {
  9036. #if PY_VERSION_HEX < 0x03030000
  9037. PyObject *py_level = PyInt_FromLong(1);
  9038. if (!py_level)
  9039. goto bad;
  9040. module = PyObject_CallFunctionObjArgs(py_import,
  9041. name, global_dict, empty_dict, list, py_level, NULL);
  9042. Py_DECREF(py_level);
  9043. #else
  9044. module = PyImport_ImportModuleLevelObject(
  9045. name, global_dict, empty_dict, list, 1);
  9046. #endif
  9047. if (!module) {
  9048. if (!PyErr_ExceptionMatches(PyExc_ImportError))
  9049. goto bad;
  9050. PyErr_Clear();
  9051. }
  9052. }
  9053. level = 0;
  9054. }
  9055. #endif
  9056. if (!module) {
  9057. #if PY_VERSION_HEX < 0x03030000
  9058. PyObject *py_level = PyInt_FromLong(level);
  9059. if (!py_level)
  9060. goto bad;
  9061. module = PyObject_CallFunctionObjArgs(py_import,
  9062. name, global_dict, empty_dict, list, py_level, NULL);
  9063. Py_DECREF(py_level);
  9064. #else
  9065. module = PyImport_ImportModuleLevelObject(
  9066. name, global_dict, empty_dict, list, level);
  9067. #endif
  9068. }
  9069. }
  9070. bad:
  9071. #if PY_VERSION_HEX < 0x03030000
  9072. Py_XDECREF(py_import);
  9073. #endif
  9074. Py_XDECREF(empty_list);
  9075. Py_XDECREF(empty_dict);
  9076. return module;
  9077. }
  9078. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
  9079. int start = 0, mid = 0, end = count - 1;
  9080. if (end >= 0 && code_line > entries[end].code_line) {
  9081. return count;
  9082. }
  9083. while (start < end) {
  9084. mid = start + (end - start) / 2;
  9085. if (code_line < entries[mid].code_line) {
  9086. end = mid;
  9087. } else if (code_line > entries[mid].code_line) {
  9088. start = mid + 1;
  9089. } else {
  9090. return mid;
  9091. }
  9092. }
  9093. if (code_line <= entries[mid].code_line) {
  9094. return mid;
  9095. } else {
  9096. return mid + 1;
  9097. }
  9098. }
  9099. static PyCodeObject *__pyx_find_code_object(int code_line) {
  9100. PyCodeObject* code_object;
  9101. int pos;
  9102. if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
  9103. return NULL;
  9104. }
  9105. pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
  9106. if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
  9107. return NULL;
  9108. }
  9109. code_object = __pyx_code_cache.entries[pos].code_object;
  9110. Py_INCREF(code_object);
  9111. return code_object;
  9112. }
  9113. static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
  9114. int pos, i;
  9115. __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
  9116. if (unlikely(!code_line)) {
  9117. return;
  9118. }
  9119. if (unlikely(!entries)) {
  9120. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
  9121. if (likely(entries)) {
  9122. __pyx_code_cache.entries = entries;
  9123. __pyx_code_cache.max_count = 64;
  9124. __pyx_code_cache.count = 1;
  9125. entries[0].code_line = code_line;
  9126. entries[0].code_object = code_object;
  9127. Py_INCREF(code_object);
  9128. }
  9129. return;
  9130. }
  9131. pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
  9132. if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
  9133. PyCodeObject* tmp = entries[pos].code_object;
  9134. entries[pos].code_object = code_object;
  9135. Py_DECREF(tmp);
  9136. return;
  9137. }
  9138. if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
  9139. int new_max = __pyx_code_cache.max_count + 64;
  9140. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
  9141. __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
  9142. if (unlikely(!entries)) {
  9143. return;
  9144. }
  9145. __pyx_code_cache.entries = entries;
  9146. __pyx_code_cache.max_count = new_max;
  9147. }
  9148. for (i=__pyx_code_cache.count; i>pos; i--) {
  9149. entries[i] = entries[i-1];
  9150. }
  9151. entries[pos].code_line = code_line;
  9152. entries[pos].code_object = code_object;
  9153. __pyx_code_cache.count++;
  9154. Py_INCREF(code_object);
  9155. }
  9156. #include "compile.h"
  9157. #include "frameobject.h"
  9158. #include "traceback.h"
  9159. static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
  9160. const char *funcname, int c_line,
  9161. int py_line, const char *filename) {
  9162. PyCodeObject *py_code = 0;
  9163. PyObject *py_srcfile = 0;
  9164. PyObject *py_funcname = 0;
  9165. #if PY_MAJOR_VERSION < 3
  9166. py_srcfile = PyString_FromString(filename);
  9167. #else
  9168. py_srcfile = PyUnicode_FromString(filename);
  9169. #endif
  9170. if (!py_srcfile) goto bad;
  9171. if (c_line) {
  9172. #if PY_MAJOR_VERSION < 3
  9173. py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  9174. #else
  9175. py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  9176. #endif
  9177. }
  9178. else {
  9179. #if PY_MAJOR_VERSION < 3
  9180. py_funcname = PyString_FromString(funcname);
  9181. #else
  9182. py_funcname = PyUnicode_FromString(funcname);
  9183. #endif
  9184. }
  9185. if (!py_funcname) goto bad;
  9186. py_code = __Pyx_PyCode_New(
  9187. 0,
  9188. 0,
  9189. 0,
  9190. 0,
  9191. 0,
  9192. __pyx_empty_bytes, /*PyObject *code,*/
  9193. __pyx_empty_tuple, /*PyObject *consts,*/
  9194. __pyx_empty_tuple, /*PyObject *names,*/
  9195. __pyx_empty_tuple, /*PyObject *varnames,*/
  9196. __pyx_empty_tuple, /*PyObject *freevars,*/
  9197. __pyx_empty_tuple, /*PyObject *cellvars,*/
  9198. py_srcfile, /*PyObject *filename,*/
  9199. py_funcname, /*PyObject *name,*/
  9200. py_line,
  9201. __pyx_empty_bytes /*PyObject *lnotab*/
  9202. );
  9203. Py_DECREF(py_srcfile);
  9204. Py_DECREF(py_funcname);
  9205. return py_code;
  9206. bad:
  9207. Py_XDECREF(py_srcfile);
  9208. Py_XDECREF(py_funcname);
  9209. return NULL;
  9210. }
  9211. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  9212. int py_line, const char *filename) {
  9213. PyCodeObject *py_code = 0;
  9214. PyFrameObject *py_frame = 0;
  9215. py_code = __pyx_find_code_object(c_line ? c_line : py_line);
  9216. if (!py_code) {
  9217. py_code = __Pyx_CreateCodeObjectForTraceback(
  9218. funcname, c_line, py_line, filename);
  9219. if (!py_code) goto bad;
  9220. __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
  9221. }
  9222. py_frame = PyFrame_New(
  9223. PyThreadState_GET(), /*PyThreadState *tstate,*/
  9224. py_code, /*PyCodeObject *code,*/
  9225. __pyx_d, /*PyObject *globals,*/
  9226. 0 /*PyObject *locals*/
  9227. );
  9228. if (!py_frame) goto bad;
  9229. py_frame->f_lineno = py_line;
  9230. PyTraceBack_Here(py_frame);
  9231. bad:
  9232. Py_XDECREF(py_code);
  9233. Py_XDECREF(py_frame);
  9234. }
  9235. #if PY_MAJOR_VERSION < 3
  9236. static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
  9237. if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
  9238. if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
  9239. PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
  9240. return -1;
  9241. }
  9242. static void __Pyx_ReleaseBuffer(Py_buffer *view) {
  9243. PyObject *obj = view->obj;
  9244. if (!obj) return;
  9245. if (PyObject_CheckBuffer(obj)) {
  9246. PyBuffer_Release(view);
  9247. return;
  9248. }
  9249. if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; }
  9250. Py_DECREF(obj);
  9251. view->obj = NULL;
  9252. }
  9253. #endif
  9254. #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
  9255. __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
  9256. #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
  9257. __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
  9258. #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
  9259. {\
  9260. func_type value = func_value;\
  9261. if (sizeof(target_type) < sizeof(func_type)) {\
  9262. if (unlikely(value != (func_type) (target_type) value)) {\
  9263. func_type zero = 0;\
  9264. if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
  9265. return (target_type) -1;\
  9266. if (is_unsigned && unlikely(value < zero))\
  9267. goto raise_neg_overflow;\
  9268. else\
  9269. goto raise_overflow;\
  9270. }\
  9271. }\
  9272. return (target_type) value;\
  9273. }
  9274. #if CYTHON_USE_PYLONG_INTERNALS
  9275. #include "longintrepr.h"
  9276. #endif
  9277. static CYTHON_INLINE npy_long __Pyx_PyInt_As_npy_long(PyObject *x) {
  9278. const npy_long neg_one = (npy_long) -1, const_zero = (npy_long) 0;
  9279. const int is_unsigned = neg_one > const_zero;
  9280. #if PY_MAJOR_VERSION < 3
  9281. if (likely(PyInt_Check(x))) {
  9282. if (sizeof(npy_long) < sizeof(long)) {
  9283. __PYX_VERIFY_RETURN_INT(npy_long, long, PyInt_AS_LONG(x))
  9284. } else {
  9285. long val = PyInt_AS_LONG(x);
  9286. if (is_unsigned && unlikely(val < 0)) {
  9287. goto raise_neg_overflow;
  9288. }
  9289. return (npy_long) val;
  9290. }
  9291. } else
  9292. #endif
  9293. if (likely(PyLong_Check(x))) {
  9294. if (is_unsigned) {
  9295. #if CYTHON_USE_PYLONG_INTERNALS
  9296. const digit* digits = ((PyLongObject*)x)->ob_digit;
  9297. switch (Py_SIZE(x)) {
  9298. case 0: return (npy_long) 0;
  9299. case 1: __PYX_VERIFY_RETURN_INT(npy_long, digit, digits[0])
  9300. case 2:
  9301. if (8 * sizeof(npy_long) > 1 * PyLong_SHIFT) {
  9302. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  9303. __PYX_VERIFY_RETURN_INT(npy_long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  9304. } else if (8 * sizeof(npy_long) >= 2 * PyLong_SHIFT) {
  9305. return (npy_long) (((((npy_long)digits[1]) << PyLong_SHIFT) | (npy_long)digits[0]));
  9306. }
  9307. }
  9308. break;
  9309. case 3:
  9310. if (8 * sizeof(npy_long) > 2 * PyLong_SHIFT) {
  9311. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  9312. __PYX_VERIFY_RETURN_INT(npy_long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  9313. } else if (8 * sizeof(npy_long) >= 3 * PyLong_SHIFT) {
  9314. return (npy_long) (((((((npy_long)digits[2]) << PyLong_SHIFT) | (npy_long)digits[1]) << PyLong_SHIFT) | (npy_long)digits[0]));
  9315. }
  9316. }
  9317. break;
  9318. case 4:
  9319. if (8 * sizeof(npy_long) > 3 * PyLong_SHIFT) {
  9320. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  9321. __PYX_VERIFY_RETURN_INT(npy_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])))
  9322. } else if (8 * sizeof(npy_long) >= 4 * PyLong_SHIFT) {
  9323. return (npy_long) (((((((((npy_long)digits[3]) << PyLong_SHIFT) | (npy_long)digits[2]) << PyLong_SHIFT) | (npy_long)digits[1]) << PyLong_SHIFT) | (npy_long)digits[0]));
  9324. }
  9325. }
  9326. break;
  9327. }
  9328. #endif
  9329. #if CYTHON_COMPILING_IN_CPYTHON
  9330. if (unlikely(Py_SIZE(x) < 0)) {
  9331. goto raise_neg_overflow;
  9332. }
  9333. #else
  9334. {
  9335. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  9336. if (unlikely(result < 0))
  9337. return (npy_long) -1;
  9338. if (unlikely(result == 1))
  9339. goto raise_neg_overflow;
  9340. }
  9341. #endif
  9342. if (sizeof(npy_long) <= sizeof(unsigned long)) {
  9343. __PYX_VERIFY_RETURN_INT_EXC(npy_long, unsigned long, PyLong_AsUnsignedLong(x))
  9344. } else if (sizeof(npy_long) <= sizeof(unsigned PY_LONG_LONG)) {
  9345. __PYX_VERIFY_RETURN_INT_EXC(npy_long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  9346. }
  9347. } else {
  9348. #if CYTHON_USE_PYLONG_INTERNALS
  9349. const digit* digits = ((PyLongObject*)x)->ob_digit;
  9350. switch (Py_SIZE(x)) {
  9351. case 0: return (npy_long) 0;
  9352. case -1: __PYX_VERIFY_RETURN_INT(npy_long, sdigit, -(sdigit) digits[0])
  9353. case 1: __PYX_VERIFY_RETURN_INT(npy_long, digit, +digits[0])
  9354. case -2:
  9355. if (8 * sizeof(npy_long) - 1 > 1 * PyLong_SHIFT) {
  9356. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  9357. __PYX_VERIFY_RETURN_INT(npy_long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  9358. } else if (8 * sizeof(npy_long) - 1 > 2 * PyLong_SHIFT) {
  9359. return (npy_long) (((npy_long)-1)*(((((npy_long)digits[1]) << PyLong_SHIFT) | (npy_long)digits[0])));
  9360. }
  9361. }
  9362. break;
  9363. case 2:
  9364. if (8 * sizeof(npy_long) > 1 * PyLong_SHIFT) {
  9365. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  9366. __PYX_VERIFY_RETURN_INT(npy_long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  9367. } else if (8 * sizeof(npy_long) - 1 > 2 * PyLong_SHIFT) {
  9368. return (npy_long) ((((((npy_long)digits[1]) << PyLong_SHIFT) | (npy_long)digits[0])));
  9369. }
  9370. }
  9371. break;
  9372. case -3:
  9373. if (8 * sizeof(npy_long) - 1 > 2 * PyLong_SHIFT) {
  9374. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  9375. __PYX_VERIFY_RETURN_INT(npy_long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  9376. } else if (8 * sizeof(npy_long) - 1 > 3 * PyLong_SHIFT) {
  9377. return (npy_long) (((npy_long)-1)*(((((((npy_long)digits[2]) << PyLong_SHIFT) | (npy_long)digits[1]) << PyLong_SHIFT) | (npy_long)digits[0])));
  9378. }
  9379. }
  9380. break;
  9381. case 3:
  9382. if (8 * sizeof(npy_long) > 2 * PyLong_SHIFT) {
  9383. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  9384. __PYX_VERIFY_RETURN_INT(npy_long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  9385. } else if (8 * sizeof(npy_long) - 1 > 3 * PyLong_SHIFT) {
  9386. return (npy_long) ((((((((npy_long)digits[2]) << PyLong_SHIFT) | (npy_long)digits[1]) << PyLong_SHIFT) | (npy_long)digits[0])));
  9387. }
  9388. }
  9389. break;
  9390. case -4:
  9391. if (8 * sizeof(npy_long) - 1 > 3 * PyLong_SHIFT) {
  9392. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  9393. __PYX_VERIFY_RETURN_INT(npy_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])))
  9394. } else if (8 * sizeof(npy_long) - 1 > 4 * PyLong_SHIFT) {
  9395. return (npy_long) (((npy_long)-1)*(((((((((npy_long)digits[3]) << PyLong_SHIFT) | (npy_long)digits[2]) << PyLong_SHIFT) | (npy_long)digits[1]) << PyLong_SHIFT) | (npy_long)digits[0])));
  9396. }
  9397. }
  9398. break;
  9399. case 4:
  9400. if (8 * sizeof(npy_long) > 3 * PyLong_SHIFT) {
  9401. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  9402. __PYX_VERIFY_RETURN_INT(npy_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])))
  9403. } else if (8 * sizeof(npy_long) - 1 > 4 * PyLong_SHIFT) {
  9404. return (npy_long) ((((((((((npy_long)digits[3]) << PyLong_SHIFT) | (npy_long)digits[2]) << PyLong_SHIFT) | (npy_long)digits[1]) << PyLong_SHIFT) | (npy_long)digits[0])));
  9405. }
  9406. }
  9407. break;
  9408. }
  9409. #endif
  9410. if (sizeof(npy_long) <= sizeof(long)) {
  9411. __PYX_VERIFY_RETURN_INT_EXC(npy_long, long, PyLong_AsLong(x))
  9412. } else if (sizeof(npy_long) <= sizeof(PY_LONG_LONG)) {
  9413. __PYX_VERIFY_RETURN_INT_EXC(npy_long, PY_LONG_LONG, PyLong_AsLongLong(x))
  9414. }
  9415. }
  9416. {
  9417. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  9418. PyErr_SetString(PyExc_RuntimeError,
  9419. "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  9420. #else
  9421. npy_long val;
  9422. PyObject *v = __Pyx_PyNumber_Int(x);
  9423. #if PY_MAJOR_VERSION < 3
  9424. if (likely(v) && !PyLong_Check(v)) {
  9425. PyObject *tmp = v;
  9426. v = PyNumber_Long(tmp);
  9427. Py_DECREF(tmp);
  9428. }
  9429. #endif
  9430. if (likely(v)) {
  9431. int one = 1; int is_little = (int)*(unsigned char *)&one;
  9432. unsigned char *bytes = (unsigned char *)&val;
  9433. int ret = _PyLong_AsByteArray((PyLongObject *)v,
  9434. bytes, sizeof(val),
  9435. is_little, !is_unsigned);
  9436. Py_DECREF(v);
  9437. if (likely(!ret))
  9438. return val;
  9439. }
  9440. #endif
  9441. return (npy_long) -1;
  9442. }
  9443. } else {
  9444. npy_long val;
  9445. PyObject *tmp = __Pyx_PyNumber_Int(x);
  9446. if (!tmp) return (npy_long) -1;
  9447. val = __Pyx_PyInt_As_npy_long(tmp);
  9448. Py_DECREF(tmp);
  9449. return val;
  9450. }
  9451. raise_overflow:
  9452. PyErr_SetString(PyExc_OverflowError,
  9453. "value too large to convert to npy_long");
  9454. return (npy_long) -1;
  9455. raise_neg_overflow:
  9456. PyErr_SetString(PyExc_OverflowError,
  9457. "can't convert negative value to npy_long");
  9458. return (npy_long) -1;
  9459. }
  9460. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) {
  9461. const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = (Py_intptr_t) 0;
  9462. const int is_unsigned = neg_one > const_zero;
  9463. if (is_unsigned) {
  9464. if (sizeof(Py_intptr_t) < sizeof(long)) {
  9465. return PyInt_FromLong((long) value);
  9466. } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
  9467. return PyLong_FromUnsignedLong((unsigned long) value);
  9468. } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
  9469. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  9470. }
  9471. } else {
  9472. if (sizeof(Py_intptr_t) <= sizeof(long)) {
  9473. return PyInt_FromLong((long) value);
  9474. } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
  9475. return PyLong_FromLongLong((PY_LONG_LONG) value);
  9476. }
  9477. }
  9478. {
  9479. int one = 1; int little = (int)*(unsigned char *)&one;
  9480. unsigned char *bytes = (unsigned char *)&value;
  9481. return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t),
  9482. little, !is_unsigned);
  9483. }
  9484. }
  9485. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_long(npy_long value) {
  9486. const npy_long neg_one = (npy_long) -1, const_zero = (npy_long) 0;
  9487. const int is_unsigned = neg_one > const_zero;
  9488. if (is_unsigned) {
  9489. if (sizeof(npy_long) < sizeof(long)) {
  9490. return PyInt_FromLong((long) value);
  9491. } else if (sizeof(npy_long) <= sizeof(unsigned long)) {
  9492. return PyLong_FromUnsignedLong((unsigned long) value);
  9493. } else if (sizeof(npy_long) <= sizeof(unsigned PY_LONG_LONG)) {
  9494. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  9495. }
  9496. } else {
  9497. if (sizeof(npy_long) <= sizeof(long)) {
  9498. return PyInt_FromLong((long) value);
  9499. } else if (sizeof(npy_long) <= sizeof(PY_LONG_LONG)) {
  9500. return PyLong_FromLongLong((PY_LONG_LONG) value);
  9501. }
  9502. }
  9503. {
  9504. int one = 1; int little = (int)*(unsigned char *)&one;
  9505. unsigned char *bytes = (unsigned char *)&value;
  9506. return _PyLong_FromByteArray(bytes, sizeof(npy_long),
  9507. little, !is_unsigned);
  9508. }
  9509. }
  9510. #if CYTHON_CCOMPLEX
  9511. #ifdef __cplusplus
  9512. static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
  9513. return ::std::complex< double >(x, y);
  9514. }
  9515. #else
  9516. static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
  9517. return x + y*(__pyx_t_double_complex)_Complex_I;
  9518. }
  9519. #endif
  9520. #else
  9521. static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
  9522. __pyx_t_double_complex z;
  9523. z.real = x;
  9524. z.imag = y;
  9525. return z;
  9526. }
  9527. #endif
  9528. static __pyx_t_double_complex __Pyx_PyComplex_As___pyx_t_double_complex(PyObject* o) {
  9529. Py_complex cval;
  9530. #if CYTHON_COMPILING_IN_CPYTHON
  9531. if (PyComplex_CheckExact(o))
  9532. cval = ((PyComplexObject *)o)->cval;
  9533. else
  9534. #endif
  9535. cval = PyComplex_AsCComplex(o);
  9536. return __pyx_t_double_complex_from_parts(
  9537. (double)cval.real,
  9538. (double)cval.imag);
  9539. }
  9540. #if CYTHON_CCOMPLEX
  9541. #else
  9542. static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  9543. return (a.real == b.real) && (a.imag == b.imag);
  9544. }
  9545. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  9546. __pyx_t_double_complex z;
  9547. z.real = a.real + b.real;
  9548. z.imag = a.imag + b.imag;
  9549. return z;
  9550. }
  9551. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  9552. __pyx_t_double_complex z;
  9553. z.real = a.real - b.real;
  9554. z.imag = a.imag - b.imag;
  9555. return z;
  9556. }
  9557. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  9558. __pyx_t_double_complex z;
  9559. z.real = a.real * b.real - a.imag * b.imag;
  9560. z.imag = a.real * b.imag + a.imag * b.real;
  9561. return z;
  9562. }
  9563. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  9564. __pyx_t_double_complex z;
  9565. double denom = b.real * b.real + b.imag * b.imag;
  9566. z.real = (a.real * b.real + a.imag * b.imag) / denom;
  9567. z.imag = (a.imag * b.real - a.real * b.imag) / denom;
  9568. return z;
  9569. }
  9570. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) {
  9571. __pyx_t_double_complex z;
  9572. z.real = -a.real;
  9573. z.imag = -a.imag;
  9574. return z;
  9575. }
  9576. static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) {
  9577. return (a.real == 0) && (a.imag == 0);
  9578. }
  9579. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) {
  9580. __pyx_t_double_complex z;
  9581. z.real = a.real;
  9582. z.imag = -a.imag;
  9583. return z;
  9584. }
  9585. #if 1
  9586. static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) {
  9587. #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
  9588. return sqrt(z.real*z.real + z.imag*z.imag);
  9589. #else
  9590. return hypot(z.real, z.imag);
  9591. #endif
  9592. }
  9593. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  9594. __pyx_t_double_complex z;
  9595. double r, lnr, theta, z_r, z_theta;
  9596. if (b.imag == 0 && b.real == (int)b.real) {
  9597. if (b.real < 0) {
  9598. double denom = a.real * a.real + a.imag * a.imag;
  9599. a.real = a.real / denom;
  9600. a.imag = -a.imag / denom;
  9601. b.real = -b.real;
  9602. }
  9603. switch ((int)b.real) {
  9604. case 0:
  9605. z.real = 1;
  9606. z.imag = 0;
  9607. return z;
  9608. case 1:
  9609. return a;
  9610. case 2:
  9611. z = __Pyx_c_prod(a, a);
  9612. return __Pyx_c_prod(a, a);
  9613. case 3:
  9614. z = __Pyx_c_prod(a, a);
  9615. return __Pyx_c_prod(z, a);
  9616. case 4:
  9617. z = __Pyx_c_prod(a, a);
  9618. return __Pyx_c_prod(z, z);
  9619. }
  9620. }
  9621. if (a.imag == 0) {
  9622. if (a.real == 0) {
  9623. return a;
  9624. }
  9625. r = a.real;
  9626. theta = 0;
  9627. } else {
  9628. r = __Pyx_c_abs(a);
  9629. theta = atan2(a.imag, a.real);
  9630. }
  9631. lnr = log(r);
  9632. z_r = exp(lnr * b.real - theta * b.imag);
  9633. z_theta = theta * b.real + lnr * b.imag;
  9634. z.real = z_r * cos(z_theta);
  9635. z.imag = z_r * sin(z_theta);
  9636. return z;
  9637. }
  9638. #endif
  9639. #endif
  9640. #if CYTHON_CCOMPLEX
  9641. #ifdef __cplusplus
  9642. static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
  9643. return ::std::complex< float >(x, y);
  9644. }
  9645. #else
  9646. static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
  9647. return x + y*(__pyx_t_float_complex)_Complex_I;
  9648. }
  9649. #endif
  9650. #else
  9651. static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
  9652. __pyx_t_float_complex z;
  9653. z.real = x;
  9654. z.imag = y;
  9655. return z;
  9656. }
  9657. #endif
  9658. #if CYTHON_CCOMPLEX
  9659. #else
  9660. static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  9661. return (a.real == b.real) && (a.imag == b.imag);
  9662. }
  9663. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  9664. __pyx_t_float_complex z;
  9665. z.real = a.real + b.real;
  9666. z.imag = a.imag + b.imag;
  9667. return z;
  9668. }
  9669. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  9670. __pyx_t_float_complex z;
  9671. z.real = a.real - b.real;
  9672. z.imag = a.imag - b.imag;
  9673. return z;
  9674. }
  9675. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  9676. __pyx_t_float_complex z;
  9677. z.real = a.real * b.real - a.imag * b.imag;
  9678. z.imag = a.real * b.imag + a.imag * b.real;
  9679. return z;
  9680. }
  9681. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  9682. __pyx_t_float_complex z;
  9683. float denom = b.real * b.real + b.imag * b.imag;
  9684. z.real = (a.real * b.real + a.imag * b.imag) / denom;
  9685. z.imag = (a.imag * b.real - a.real * b.imag) / denom;
  9686. return z;
  9687. }
  9688. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) {
  9689. __pyx_t_float_complex z;
  9690. z.real = -a.real;
  9691. z.imag = -a.imag;
  9692. return z;
  9693. }
  9694. static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) {
  9695. return (a.real == 0) && (a.imag == 0);
  9696. }
  9697. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) {
  9698. __pyx_t_float_complex z;
  9699. z.real = a.real;
  9700. z.imag = -a.imag;
  9701. return z;
  9702. }
  9703. #if 1
  9704. static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) {
  9705. #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
  9706. return sqrtf(z.real*z.real + z.imag*z.imag);
  9707. #else
  9708. return hypotf(z.real, z.imag);
  9709. #endif
  9710. }
  9711. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  9712. __pyx_t_float_complex z;
  9713. float r, lnr, theta, z_r, z_theta;
  9714. if (b.imag == 0 && b.real == (int)b.real) {
  9715. if (b.real < 0) {
  9716. float denom = a.real * a.real + a.imag * a.imag;
  9717. a.real = a.real / denom;
  9718. a.imag = -a.imag / denom;
  9719. b.real = -b.real;
  9720. }
  9721. switch ((int)b.real) {
  9722. case 0:
  9723. z.real = 1;
  9724. z.imag = 0;
  9725. return z;
  9726. case 1:
  9727. return a;
  9728. case 2:
  9729. z = __Pyx_c_prodf(a, a);
  9730. return __Pyx_c_prodf(a, a);
  9731. case 3:
  9732. z = __Pyx_c_prodf(a, a);
  9733. return __Pyx_c_prodf(z, a);
  9734. case 4:
  9735. z = __Pyx_c_prodf(a, a);
  9736. return __Pyx_c_prodf(z, z);
  9737. }
  9738. }
  9739. if (a.imag == 0) {
  9740. if (a.real == 0) {
  9741. return a;
  9742. }
  9743. r = a.real;
  9744. theta = 0;
  9745. } else {
  9746. r = __Pyx_c_absf(a);
  9747. theta = atan2f(a.imag, a.real);
  9748. }
  9749. lnr = logf(r);
  9750. z_r = expf(lnr * b.real - theta * b.imag);
  9751. z_theta = theta * b.real + lnr * b.imag;
  9752. z.real = z_r * cosf(z_theta);
  9753. z.imag = z_r * sinf(z_theta);
  9754. return z;
  9755. }
  9756. #endif
  9757. #endif
  9758. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
  9759. const int neg_one = (int) -1, const_zero = (int) 0;
  9760. const int is_unsigned = neg_one > const_zero;
  9761. if (is_unsigned) {
  9762. if (sizeof(int) < sizeof(long)) {
  9763. return PyInt_FromLong((long) value);
  9764. } else if (sizeof(int) <= sizeof(unsigned long)) {
  9765. return PyLong_FromUnsignedLong((unsigned long) value);
  9766. } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
  9767. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  9768. }
  9769. } else {
  9770. if (sizeof(int) <= sizeof(long)) {
  9771. return PyInt_FromLong((long) value);
  9772. } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
  9773. return PyLong_FromLongLong((PY_LONG_LONG) value);
  9774. }
  9775. }
  9776. {
  9777. int one = 1; int little = (int)*(unsigned char *)&one;
  9778. unsigned char *bytes = (unsigned char *)&value;
  9779. return _PyLong_FromByteArray(bytes, sizeof(int),
  9780. little, !is_unsigned);
  9781. }
  9782. }
  9783. static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
  9784. const int neg_one = (int) -1, const_zero = (int) 0;
  9785. const int is_unsigned = neg_one > const_zero;
  9786. #if PY_MAJOR_VERSION < 3
  9787. if (likely(PyInt_Check(x))) {
  9788. if (sizeof(int) < sizeof(long)) {
  9789. __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
  9790. } else {
  9791. long val = PyInt_AS_LONG(x);
  9792. if (is_unsigned && unlikely(val < 0)) {
  9793. goto raise_neg_overflow;
  9794. }
  9795. return (int) val;
  9796. }
  9797. } else
  9798. #endif
  9799. if (likely(PyLong_Check(x))) {
  9800. if (is_unsigned) {
  9801. #if CYTHON_USE_PYLONG_INTERNALS
  9802. const digit* digits = ((PyLongObject*)x)->ob_digit;
  9803. switch (Py_SIZE(x)) {
  9804. case 0: return (int) 0;
  9805. case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
  9806. case 2:
  9807. if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
  9808. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  9809. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  9810. } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
  9811. return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  9812. }
  9813. }
  9814. break;
  9815. case 3:
  9816. if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
  9817. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  9818. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  9819. } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
  9820. return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  9821. }
  9822. }
  9823. break;
  9824. case 4:
  9825. if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
  9826. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  9827. __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])))
  9828. } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
  9829. return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  9830. }
  9831. }
  9832. break;
  9833. }
  9834. #endif
  9835. #if CYTHON_COMPILING_IN_CPYTHON
  9836. if (unlikely(Py_SIZE(x) < 0)) {
  9837. goto raise_neg_overflow;
  9838. }
  9839. #else
  9840. {
  9841. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  9842. if (unlikely(result < 0))
  9843. return (int) -1;
  9844. if (unlikely(result == 1))
  9845. goto raise_neg_overflow;
  9846. }
  9847. #endif
  9848. if (sizeof(int) <= sizeof(unsigned long)) {
  9849. __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
  9850. } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
  9851. __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  9852. }
  9853. } else {
  9854. #if CYTHON_USE_PYLONG_INTERNALS
  9855. const digit* digits = ((PyLongObject*)x)->ob_digit;
  9856. switch (Py_SIZE(x)) {
  9857. case 0: return (int) 0;
  9858. case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) digits[0])
  9859. case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
  9860. case -2:
  9861. if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
  9862. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  9863. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  9864. } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
  9865. return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  9866. }
  9867. }
  9868. break;
  9869. case 2:
  9870. if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
  9871. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  9872. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  9873. } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
  9874. return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  9875. }
  9876. }
  9877. break;
  9878. case -3:
  9879. if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
  9880. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  9881. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  9882. } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
  9883. return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  9884. }
  9885. }
  9886. break;
  9887. case 3:
  9888. if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
  9889. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  9890. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  9891. } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
  9892. return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  9893. }
  9894. }
  9895. break;
  9896. case -4:
  9897. if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
  9898. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  9899. __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])))
  9900. } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
  9901. return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  9902. }
  9903. }
  9904. break;
  9905. case 4:
  9906. if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
  9907. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  9908. __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])))
  9909. } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
  9910. return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  9911. }
  9912. }
  9913. break;
  9914. }
  9915. #endif
  9916. if (sizeof(int) <= sizeof(long)) {
  9917. __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
  9918. } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
  9919. __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
  9920. }
  9921. }
  9922. {
  9923. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  9924. PyErr_SetString(PyExc_RuntimeError,
  9925. "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  9926. #else
  9927. int val;
  9928. PyObject *v = __Pyx_PyNumber_Int(x);
  9929. #if PY_MAJOR_VERSION < 3
  9930. if (likely(v) && !PyLong_Check(v)) {
  9931. PyObject *tmp = v;
  9932. v = PyNumber_Long(tmp);
  9933. Py_DECREF(tmp);
  9934. }
  9935. #endif
  9936. if (likely(v)) {
  9937. int one = 1; int is_little = (int)*(unsigned char *)&one;
  9938. unsigned char *bytes = (unsigned char *)&val;
  9939. int ret = _PyLong_AsByteArray((PyLongObject *)v,
  9940. bytes, sizeof(val),
  9941. is_little, !is_unsigned);
  9942. Py_DECREF(v);
  9943. if (likely(!ret))
  9944. return val;
  9945. }
  9946. #endif
  9947. return (int) -1;
  9948. }
  9949. } else {
  9950. int val;
  9951. PyObject *tmp = __Pyx_PyNumber_Int(x);
  9952. if (!tmp) return (int) -1;
  9953. val = __Pyx_PyInt_As_int(tmp);
  9954. Py_DECREF(tmp);
  9955. return val;
  9956. }
  9957. raise_overflow:
  9958. PyErr_SetString(PyExc_OverflowError,
  9959. "value too large to convert to int");
  9960. return (int) -1;
  9961. raise_neg_overflow:
  9962. PyErr_SetString(PyExc_OverflowError,
  9963. "can't convert negative value to int");
  9964. return (int) -1;
  9965. }
  9966. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
  9967. const enum NPY_TYPES neg_one = (enum NPY_TYPES) -1, const_zero = (enum NPY_TYPES) 0;
  9968. const int is_unsigned = neg_one > const_zero;
  9969. if (is_unsigned) {
  9970. if (sizeof(enum NPY_TYPES) < sizeof(long)) {
  9971. return PyInt_FromLong((long) value);
  9972. } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
  9973. return PyLong_FromUnsignedLong((unsigned long) value);
  9974. } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
  9975. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  9976. }
  9977. } else {
  9978. if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
  9979. return PyInt_FromLong((long) value);
  9980. } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
  9981. return PyLong_FromLongLong((PY_LONG_LONG) value);
  9982. }
  9983. }
  9984. {
  9985. int one = 1; int little = (int)*(unsigned char *)&one;
  9986. unsigned char *bytes = (unsigned char *)&value;
  9987. return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
  9988. little, !is_unsigned);
  9989. }
  9990. }
  9991. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
  9992. const long neg_one = (long) -1, const_zero = (long) 0;
  9993. const int is_unsigned = neg_one > const_zero;
  9994. if (is_unsigned) {
  9995. if (sizeof(long) < sizeof(long)) {
  9996. return PyInt_FromLong((long) value);
  9997. } else if (sizeof(long) <= sizeof(unsigned long)) {
  9998. return PyLong_FromUnsignedLong((unsigned long) value);
  9999. } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
  10000. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  10001. }
  10002. } else {
  10003. if (sizeof(long) <= sizeof(long)) {
  10004. return PyInt_FromLong((long) value);
  10005. } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
  10006. return PyLong_FromLongLong((PY_LONG_LONG) value);
  10007. }
  10008. }
  10009. {
  10010. int one = 1; int little = (int)*(unsigned char *)&one;
  10011. unsigned char *bytes = (unsigned char *)&value;
  10012. return _PyLong_FromByteArray(bytes, sizeof(long),
  10013. little, !is_unsigned);
  10014. }
  10015. }
  10016. static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
  10017. const long neg_one = (long) -1, const_zero = (long) 0;
  10018. const int is_unsigned = neg_one > const_zero;
  10019. #if PY_MAJOR_VERSION < 3
  10020. if (likely(PyInt_Check(x))) {
  10021. if (sizeof(long) < sizeof(long)) {
  10022. __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
  10023. } else {
  10024. long val = PyInt_AS_LONG(x);
  10025. if (is_unsigned && unlikely(val < 0)) {
  10026. goto raise_neg_overflow;
  10027. }
  10028. return (long) val;
  10029. }
  10030. } else
  10031. #endif
  10032. if (likely(PyLong_Check(x))) {
  10033. if (is_unsigned) {
  10034. #if CYTHON_USE_PYLONG_INTERNALS
  10035. const digit* digits = ((PyLongObject*)x)->ob_digit;
  10036. switch (Py_SIZE(x)) {
  10037. case 0: return (long) 0;
  10038. case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
  10039. case 2:
  10040. if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
  10041. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  10042. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  10043. } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
  10044. return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  10045. }
  10046. }
  10047. break;
  10048. case 3:
  10049. if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
  10050. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  10051. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  10052. } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
  10053. return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  10054. }
  10055. }
  10056. break;
  10057. case 4:
  10058. if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
  10059. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  10060. __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])))
  10061. } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
  10062. return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  10063. }
  10064. }
  10065. break;
  10066. }
  10067. #endif
  10068. #if CYTHON_COMPILING_IN_CPYTHON
  10069. if (unlikely(Py_SIZE(x) < 0)) {
  10070. goto raise_neg_overflow;
  10071. }
  10072. #else
  10073. {
  10074. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  10075. if (unlikely(result < 0))
  10076. return (long) -1;
  10077. if (unlikely(result == 1))
  10078. goto raise_neg_overflow;
  10079. }
  10080. #endif
  10081. if (sizeof(long) <= sizeof(unsigned long)) {
  10082. __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
  10083. } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
  10084. __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  10085. }
  10086. } else {
  10087. #if CYTHON_USE_PYLONG_INTERNALS
  10088. const digit* digits = ((PyLongObject*)x)->ob_digit;
  10089. switch (Py_SIZE(x)) {
  10090. case 0: return (long) 0;
  10091. case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) digits[0])
  10092. case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
  10093. case -2:
  10094. if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
  10095. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  10096. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  10097. } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  10098. return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  10099. }
  10100. }
  10101. break;
  10102. case 2:
  10103. if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
  10104. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  10105. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  10106. } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  10107. return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  10108. }
  10109. }
  10110. break;
  10111. case -3:
  10112. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  10113. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  10114. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  10115. } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  10116. return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  10117. }
  10118. }
  10119. break;
  10120. case 3:
  10121. if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
  10122. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  10123. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  10124. } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  10125. return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  10126. }
  10127. }
  10128. break;
  10129. case -4:
  10130. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  10131. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  10132. __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])))
  10133. } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  10134. return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  10135. }
  10136. }
  10137. break;
  10138. case 4:
  10139. if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
  10140. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  10141. __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])))
  10142. } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  10143. return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  10144. }
  10145. }
  10146. break;
  10147. }
  10148. #endif
  10149. if (sizeof(long) <= sizeof(long)) {
  10150. __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
  10151. } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
  10152. __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
  10153. }
  10154. }
  10155. {
  10156. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  10157. PyErr_SetString(PyExc_RuntimeError,
  10158. "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  10159. #else
  10160. long val;
  10161. PyObject *v = __Pyx_PyNumber_Int(x);
  10162. #if PY_MAJOR_VERSION < 3
  10163. if (likely(v) && !PyLong_Check(v)) {
  10164. PyObject *tmp = v;
  10165. v = PyNumber_Long(tmp);
  10166. Py_DECREF(tmp);
  10167. }
  10168. #endif
  10169. if (likely(v)) {
  10170. int one = 1; int is_little = (int)*(unsigned char *)&one;
  10171. unsigned char *bytes = (unsigned char *)&val;
  10172. int ret = _PyLong_AsByteArray((PyLongObject *)v,
  10173. bytes, sizeof(val),
  10174. is_little, !is_unsigned);
  10175. Py_DECREF(v);
  10176. if (likely(!ret))
  10177. return val;
  10178. }
  10179. #endif
  10180. return (long) -1;
  10181. }
  10182. } else {
  10183. long val;
  10184. PyObject *tmp = __Pyx_PyNumber_Int(x);
  10185. if (!tmp) return (long) -1;
  10186. val = __Pyx_PyInt_As_long(tmp);
  10187. Py_DECREF(tmp);
  10188. return val;
  10189. }
  10190. raise_overflow:
  10191. PyErr_SetString(PyExc_OverflowError,
  10192. "value too large to convert to long");
  10193. return (long) -1;
  10194. raise_neg_overflow:
  10195. PyErr_SetString(PyExc_OverflowError,
  10196. "can't convert negative value to long");
  10197. return (long) -1;
  10198. }
  10199. static int __Pyx_check_binary_version(void) {
  10200. char ctversion[4], rtversion[4];
  10201. PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
  10202. PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
  10203. if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
  10204. char message[200];
  10205. PyOS_snprintf(message, sizeof(message),
  10206. "compiletime version %s of module '%.100s' "
  10207. "does not match runtime version %s",
  10208. ctversion, __Pyx_MODULE_NAME, rtversion);
  10209. return PyErr_WarnEx(NULL, message, 1);
  10210. }
  10211. return 0;
  10212. }
  10213. #ifndef __PYX_HAVE_RT_ImportModule
  10214. #define __PYX_HAVE_RT_ImportModule
  10215. static PyObject *__Pyx_ImportModule(const char *name) {
  10216. PyObject *py_name = 0;
  10217. PyObject *py_module = 0;
  10218. py_name = __Pyx_PyIdentifier_FromString(name);
  10219. if (!py_name)
  10220. goto bad;
  10221. py_module = PyImport_Import(py_name);
  10222. Py_DECREF(py_name);
  10223. return py_module;
  10224. bad:
  10225. Py_XDECREF(py_name);
  10226. return 0;
  10227. }
  10228. #endif
  10229. #ifndef __PYX_HAVE_RT_ImportType
  10230. #define __PYX_HAVE_RT_ImportType
  10231. static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
  10232. size_t size, int strict)
  10233. {
  10234. PyObject *py_module = 0;
  10235. PyObject *result = 0;
  10236. PyObject *py_name = 0;
  10237. char warning[200];
  10238. Py_ssize_t basicsize;
  10239. #ifdef Py_LIMITED_API
  10240. PyObject *py_basicsize;
  10241. #endif
  10242. py_module = __Pyx_ImportModule(module_name);
  10243. if (!py_module)
  10244. goto bad;
  10245. py_name = __Pyx_PyIdentifier_FromString(class_name);
  10246. if (!py_name)
  10247. goto bad;
  10248. result = PyObject_GetAttr(py_module, py_name);
  10249. Py_DECREF(py_name);
  10250. py_name = 0;
  10251. Py_DECREF(py_module);
  10252. py_module = 0;
  10253. if (!result)
  10254. goto bad;
  10255. if (!PyType_Check(result)) {
  10256. PyErr_Format(PyExc_TypeError,
  10257. "%.200s.%.200s is not a type object",
  10258. module_name, class_name);
  10259. goto bad;
  10260. }
  10261. #ifndef Py_LIMITED_API
  10262. basicsize = ((PyTypeObject *)result)->tp_basicsize;
  10263. #else
  10264. py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
  10265. if (!py_basicsize)
  10266. goto bad;
  10267. basicsize = PyLong_AsSsize_t(py_basicsize);
  10268. Py_DECREF(py_basicsize);
  10269. py_basicsize = 0;
  10270. if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
  10271. goto bad;
  10272. #endif
  10273. if (!strict && (size_t)basicsize > size) {
  10274. PyOS_snprintf(warning, sizeof(warning),
  10275. "%s.%s size changed, may indicate binary incompatibility",
  10276. module_name, class_name);
  10277. if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
  10278. }
  10279. else if ((size_t)basicsize != size) {
  10280. PyErr_Format(PyExc_ValueError,
  10281. "%.200s.%.200s has the wrong size, try recompiling",
  10282. module_name, class_name);
  10283. goto bad;
  10284. }
  10285. return (PyTypeObject *)result;
  10286. bad:
  10287. Py_XDECREF(py_module);
  10288. Py_XDECREF(result);
  10289. return NULL;
  10290. }
  10291. #endif
  10292. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
  10293. while (t->p) {
  10294. #if PY_MAJOR_VERSION < 3
  10295. if (t->is_unicode) {
  10296. *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
  10297. } else if (t->intern) {
  10298. *t->p = PyString_InternFromString(t->s);
  10299. } else {
  10300. *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
  10301. }
  10302. #else
  10303. if (t->is_unicode | t->is_str) {
  10304. if (t->intern) {
  10305. *t->p = PyUnicode_InternFromString(t->s);
  10306. } else if (t->encoding) {
  10307. *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
  10308. } else {
  10309. *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
  10310. }
  10311. } else {
  10312. *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
  10313. }
  10314. #endif
  10315. if (!*t->p)
  10316. return -1;
  10317. ++t;
  10318. }
  10319. return 0;
  10320. }
  10321. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
  10322. return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
  10323. }
  10324. static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
  10325. Py_ssize_t ignore;
  10326. return __Pyx_PyObject_AsStringAndSize(o, &ignore);
  10327. }
  10328. static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  10329. #if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  10330. if (
  10331. #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  10332. __Pyx_sys_getdefaultencoding_not_ascii &&
  10333. #endif
  10334. PyUnicode_Check(o)) {
  10335. #if PY_VERSION_HEX < 0x03030000
  10336. char* defenc_c;
  10337. PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
  10338. if (!defenc) return NULL;
  10339. defenc_c = PyBytes_AS_STRING(defenc);
  10340. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  10341. {
  10342. char* end = defenc_c + PyBytes_GET_SIZE(defenc);
  10343. char* c;
  10344. for (c = defenc_c; c < end; c++) {
  10345. if ((unsigned char) (*c) >= 128) {
  10346. PyUnicode_AsASCIIString(o);
  10347. return NULL;
  10348. }
  10349. }
  10350. }
  10351. #endif
  10352. *length = PyBytes_GET_SIZE(defenc);
  10353. return defenc_c;
  10354. #else
  10355. if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
  10356. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  10357. if (PyUnicode_IS_ASCII(o)) {
  10358. *length = PyUnicode_GET_LENGTH(o);
  10359. return PyUnicode_AsUTF8(o);
  10360. } else {
  10361. PyUnicode_AsASCIIString(o);
  10362. return NULL;
  10363. }
  10364. #else
  10365. return PyUnicode_AsUTF8AndSize(o, length);
  10366. #endif
  10367. #endif
  10368. } else
  10369. #endif
  10370. #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
  10371. if (PyByteArray_Check(o)) {
  10372. *length = PyByteArray_GET_SIZE(o);
  10373. return PyByteArray_AS_STRING(o);
  10374. } else
  10375. #endif
  10376. {
  10377. char* result;
  10378. int r = PyBytes_AsStringAndSize(o, &result, length);
  10379. if (unlikely(r < 0)) {
  10380. return NULL;
  10381. } else {
  10382. return result;
  10383. }
  10384. }
  10385. }
  10386. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
  10387. int is_true = x == Py_True;
  10388. if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
  10389. else return PyObject_IsTrue(x);
  10390. }
  10391. static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  10392. PyNumberMethods *m;
  10393. const char *name = NULL;
  10394. PyObject *res = NULL;
  10395. #if PY_MAJOR_VERSION < 3
  10396. if (PyInt_Check(x) || PyLong_Check(x))
  10397. #else
  10398. if (PyLong_Check(x))
  10399. #endif
  10400. return __Pyx_NewRef(x);
  10401. m = Py_TYPE(x)->tp_as_number;
  10402. #if PY_MAJOR_VERSION < 3
  10403. if (m && m->nb_int) {
  10404. name = "int";
  10405. res = PyNumber_Int(x);
  10406. }
  10407. else if (m && m->nb_long) {
  10408. name = "long";
  10409. res = PyNumber_Long(x);
  10410. }
  10411. #else
  10412. if (m && m->nb_int) {
  10413. name = "int";
  10414. res = PyNumber_Long(x);
  10415. }
  10416. #endif
  10417. if (res) {
  10418. #if PY_MAJOR_VERSION < 3
  10419. if (!PyInt_Check(res) && !PyLong_Check(res)) {
  10420. #else
  10421. if (!PyLong_Check(res)) {
  10422. #endif
  10423. PyErr_Format(PyExc_TypeError,
  10424. "__%.4s__ returned non-%.4s (type %.200s)",
  10425. name, name, Py_TYPE(res)->tp_name);
  10426. Py_DECREF(res);
  10427. return NULL;
  10428. }
  10429. }
  10430. else if (!PyErr_Occurred()) {
  10431. PyErr_SetString(PyExc_TypeError,
  10432. "an integer is required");
  10433. }
  10434. return res;
  10435. }
  10436. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  10437. Py_ssize_t ival;
  10438. PyObject *x;
  10439. #if PY_MAJOR_VERSION < 3
  10440. if (likely(PyInt_CheckExact(b))) {
  10441. if (sizeof(Py_ssize_t) >= sizeof(long))
  10442. return PyInt_AS_LONG(b);
  10443. else
  10444. return PyInt_AsSsize_t(x);
  10445. }
  10446. #endif
  10447. if (likely(PyLong_CheckExact(b))) {
  10448. #if CYTHON_USE_PYLONG_INTERNALS
  10449. const digit* digits = ((PyLongObject*)b)->ob_digit;
  10450. const Py_ssize_t size = Py_SIZE(b);
  10451. if (likely(__Pyx_sst_abs(size) <= 1)) {
  10452. ival = likely(size) ? digits[0] : 0;
  10453. if (size == -1) ival = -ival;
  10454. return ival;
  10455. } else {
  10456. switch (size) {
  10457. case 2:
  10458. if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
  10459. return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  10460. }
  10461. break;
  10462. case -2:
  10463. if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
  10464. return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  10465. }
  10466. break;
  10467. case 3:
  10468. if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
  10469. return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  10470. }
  10471. break;
  10472. case -3:
  10473. if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
  10474. return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  10475. }
  10476. break;
  10477. case 4:
  10478. if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
  10479. 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]));
  10480. }
  10481. break;
  10482. case -4:
  10483. if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
  10484. 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]));
  10485. }
  10486. break;
  10487. }
  10488. }
  10489. #endif
  10490. return PyLong_AsSsize_t(b);
  10491. }
  10492. x = PyNumber_Index(b);
  10493. if (!x) return -1;
  10494. ival = PyInt_AsSsize_t(x);
  10495. Py_DECREF(x);
  10496. return ival;
  10497. }
  10498. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
  10499. return PyInt_FromSize_t(ival);
  10500. }
  10501. #endif /* Py_PYTHON_H */