scattnlay.cpp 523 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424
  1. /* Generated by Cython 0.22 */
  2. #define PY_SSIZE_T_CLEAN
  3. #ifndef CYTHON_USE_PYLONG_INTERNALS
  4. #ifdef PYLONG_BITS_IN_DIGIT
  5. #define CYTHON_USE_PYLONG_INTERNALS 0
  6. #else
  7. #include "pyconfig.h"
  8. #ifdef PYLONG_BITS_IN_DIGIT
  9. #define CYTHON_USE_PYLONG_INTERNALS 1
  10. #else
  11. #define CYTHON_USE_PYLONG_INTERNALS 0
  12. #endif
  13. #endif
  14. #endif
  15. #include "Python.h"
  16. #ifndef Py_PYTHON_H
  17. #error Python headers needed to compile C extensions, please install development version of Python.
  18. #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
  19. #error Cython requires Python 2.6+ or Python 3.2+.
  20. #else
  21. #define CYTHON_ABI "0_22"
  22. #include <stddef.h>
  23. #ifndef offsetof
  24. #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
  25. #endif
  26. #if !defined(WIN32) && !defined(MS_WINDOWS)
  27. #ifndef __stdcall
  28. #define __stdcall
  29. #endif
  30. #ifndef __cdecl
  31. #define __cdecl
  32. #endif
  33. #ifndef __fastcall
  34. #define __fastcall
  35. #endif
  36. #endif
  37. #ifndef DL_IMPORT
  38. #define DL_IMPORT(t) t
  39. #endif
  40. #ifndef DL_EXPORT
  41. #define DL_EXPORT(t) t
  42. #endif
  43. #ifndef PY_LONG_LONG
  44. #define PY_LONG_LONG LONG_LONG
  45. #endif
  46. #ifndef Py_HUGE_VAL
  47. #define Py_HUGE_VAL HUGE_VAL
  48. #endif
  49. #ifdef PYPY_VERSION
  50. #define CYTHON_COMPILING_IN_PYPY 1
  51. #define CYTHON_COMPILING_IN_CPYTHON 0
  52. #else
  53. #define CYTHON_COMPILING_IN_PYPY 0
  54. #define CYTHON_COMPILING_IN_CPYTHON 1
  55. #endif
  56. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  57. #define Py_OptimizeFlag 0
  58. #endif
  59. #define __PYX_BUILD_PY_SSIZE_T "n"
  60. #define CYTHON_FORMAT_SSIZE_T "z"
  61. #if PY_MAJOR_VERSION < 3
  62. #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  63. #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
  64. PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  65. #define __Pyx_DefaultClassType PyClass_Type
  66. #else
  67. #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  68. #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
  69. PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  70. #define __Pyx_DefaultClassType PyType_Type
  71. #endif
  72. #if PY_MAJOR_VERSION >= 3
  73. #define Py_TPFLAGS_CHECKTYPES 0
  74. #define Py_TPFLAGS_HAVE_INDEX 0
  75. #define Py_TPFLAGS_HAVE_NEWBUFFER 0
  76. #endif
  77. #if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
  78. #define Py_TPFLAGS_HAVE_FINALIZE 0
  79. #endif
  80. #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  81. #define CYTHON_PEP393_ENABLED 1
  82. #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \
  83. 0 : _PyUnicode_Ready((PyObject *)(op)))
  84. #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
  85. #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  86. #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
  87. #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
  88. #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
  89. #else
  90. #define CYTHON_PEP393_ENABLED 0
  91. #define __Pyx_PyUnicode_READY(op) (0)
  92. #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
  93. #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  94. #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
  95. #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
  96. #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  97. #endif
  98. #if CYTHON_COMPILING_IN_PYPY
  99. #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
  100. #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
  101. #define __Pyx_PyFrozenSet_Size(s) PyObject_Size(s)
  102. #else
  103. #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
  104. #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \
  105. PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
  106. #define __Pyx_PyFrozenSet_Size(s) PySet_Size(s)
  107. #endif
  108. #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
  109. #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
  110. #if PY_MAJOR_VERSION >= 3
  111. #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
  112. #else
  113. #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
  114. #endif
  115. #if PY_MAJOR_VERSION >= 3
  116. #define PyBaseString_Type PyUnicode_Type
  117. #define PyStringObject PyUnicodeObject
  118. #define PyString_Type PyUnicode_Type
  119. #define PyString_Check PyUnicode_Check
  120. #define PyString_CheckExact PyUnicode_CheckExact
  121. #endif
  122. #if PY_MAJOR_VERSION >= 3
  123. #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  124. #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
  125. #else
  126. #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  127. #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
  128. #endif
  129. #ifndef PySet_CheckExact
  130. #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
  131. #endif
  132. #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
  133. #if PY_MAJOR_VERSION >= 3
  134. #define PyIntObject PyLongObject
  135. #define PyInt_Type PyLong_Type
  136. #define PyInt_Check(op) PyLong_Check(op)
  137. #define PyInt_CheckExact(op) PyLong_CheckExact(op)
  138. #define PyInt_FromString PyLong_FromString
  139. #define PyInt_FromUnicode PyLong_FromUnicode
  140. #define PyInt_FromLong PyLong_FromLong
  141. #define PyInt_FromSize_t PyLong_FromSize_t
  142. #define PyInt_FromSsize_t PyLong_FromSsize_t
  143. #define PyInt_AsLong PyLong_AsLong
  144. #define PyInt_AS_LONG PyLong_AS_LONG
  145. #define PyInt_AsSsize_t PyLong_AsSsize_t
  146. #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
  147. #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  148. #define PyNumber_Int PyNumber_Long
  149. #endif
  150. #if PY_MAJOR_VERSION >= 3
  151. #define PyBoolObject PyLongObject
  152. #endif
  153. #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  154. #ifndef PyUnicode_InternFromString
  155. #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  156. #endif
  157. #endif
  158. #if PY_VERSION_HEX < 0x030200A4
  159. typedef long Py_hash_t;
  160. #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  161. #define __Pyx_PyInt_AsHash_t PyInt_AsLong
  162. #else
  163. #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  164. #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
  165. #endif
  166. #if PY_MAJOR_VERSION >= 3
  167. #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
  168. #else
  169. #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
  170. #endif
  171. #ifndef CYTHON_INLINE
  172. #if defined(__GNUC__)
  173. #define CYTHON_INLINE __inline__
  174. #elif defined(_MSC_VER)
  175. #define CYTHON_INLINE __inline
  176. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  177. #define CYTHON_INLINE inline
  178. #else
  179. #define CYTHON_INLINE
  180. #endif
  181. #endif
  182. #ifndef CYTHON_RESTRICT
  183. #if defined(__GNUC__)
  184. #define CYTHON_RESTRICT __restrict__
  185. #elif defined(_MSC_VER) && _MSC_VER >= 1400
  186. #define CYTHON_RESTRICT __restrict
  187. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  188. #define CYTHON_RESTRICT restrict
  189. #else
  190. #define CYTHON_RESTRICT
  191. #endif
  192. #endif
  193. #ifdef NAN
  194. #define __PYX_NAN() ((float) NAN)
  195. #else
  196. static CYTHON_INLINE float __PYX_NAN() {
  197. /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
  198. a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
  199. a quiet NaN. */
  200. float value;
  201. memset(&value, 0xFF, sizeof(value));
  202. return value;
  203. }
  204. #endif
  205. #define __Pyx_void_to_None(void_result) (void_result, Py_INCREF(Py_None), Py_None)
  206. #ifdef __cplusplus
  207. template<typename T>
  208. void __Pyx_call_destructor(T* x) {
  209. x->~T();
  210. }
  211. template<typename T>
  212. class __Pyx_FakeReference {
  213. public:
  214. __Pyx_FakeReference() : ptr(NULL) { }
  215. __Pyx_FakeReference(T& ref) : ptr(&ref) { }
  216. T *operator->() { return ptr; }
  217. operator T&() { return *ptr; }
  218. private:
  219. T *ptr;
  220. };
  221. #endif
  222. #if PY_MAJOR_VERSION >= 3
  223. #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
  224. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
  225. #else
  226. #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
  227. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
  228. #endif
  229. #ifndef __PYX_EXTERN_C
  230. #ifdef __cplusplus
  231. #define __PYX_EXTERN_C extern "C"
  232. #else
  233. #define __PYX_EXTERN_C extern
  234. #endif
  235. #endif
  236. #if defined(WIN32) || defined(MS_WINDOWS)
  237. #define _USE_MATH_DEFINES
  238. #endif
  239. #include <math.h>
  240. #define __PYX_HAVE__scattnlay
  241. #define __PYX_HAVE_API__scattnlay
  242. #include "string.h"
  243. #include "stdio.h"
  244. #include "stdlib.h"
  245. #include "numpy/arrayobject.h"
  246. #include "numpy/ufuncobject.h"
  247. #include <vector>
  248. #include "ios"
  249. #include "new"
  250. #include "stdexcept"
  251. #include "typeinfo"
  252. #include "py_nmie.h"
  253. #ifdef _OPENMP
  254. #include <omp.h>
  255. #endif /* _OPENMP */
  256. #ifdef PYREX_WITHOUT_ASSERTIONS
  257. #define CYTHON_WITHOUT_ASSERTIONS
  258. #endif
  259. #ifndef CYTHON_UNUSED
  260. # if defined(__GNUC__)
  261. # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  262. # define CYTHON_UNUSED __attribute__ ((__unused__))
  263. # else
  264. # define CYTHON_UNUSED
  265. # endif
  266. # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
  267. # define CYTHON_UNUSED __attribute__ ((__unused__))
  268. # else
  269. # define CYTHON_UNUSED
  270. # endif
  271. #endif
  272. typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
  273. const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
  274. #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
  275. #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
  276. #define __PYX_DEFAULT_STRING_ENCODING ""
  277. #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
  278. #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  279. #define __Pyx_fits_Py_ssize_t(v, type, is_signed) ( \
  280. (sizeof(type) < sizeof(Py_ssize_t)) || \
  281. (sizeof(type) > sizeof(Py_ssize_t) && \
  282. likely(v < (type)PY_SSIZE_T_MAX || \
  283. v == (type)PY_SSIZE_T_MAX) && \
  284. (!is_signed || likely(v > (type)PY_SSIZE_T_MIN || \
  285. v == (type)PY_SSIZE_T_MIN))) || \
  286. (sizeof(type) == sizeof(Py_ssize_t) && \
  287. (is_signed || likely(v < (type)PY_SSIZE_T_MAX || \
  288. v == (type)PY_SSIZE_T_MAX))) )
  289. static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
  290. static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
  291. #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
  292. #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
  293. #define __Pyx_PyBytes_FromString PyBytes_FromString
  294. #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
  295. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
  296. #if PY_MAJOR_VERSION < 3
  297. #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
  298. #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  299. #else
  300. #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
  301. #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
  302. #endif
  303. #define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
  304. #define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
  305. #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
  306. #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
  307. #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
  308. #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
  309. #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
  310. #if PY_MAJOR_VERSION < 3
  311. static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
  312. {
  313. const Py_UNICODE *u_end = u;
  314. while (*u_end++) ;
  315. return (size_t)(u_end - u - 1);
  316. }
  317. #else
  318. #define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
  319. #endif
  320. #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
  321. #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
  322. #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
  323. #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
  324. #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
  325. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
  326. static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
  327. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
  328. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
  329. #if CYTHON_COMPILING_IN_CPYTHON
  330. #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
  331. #else
  332. #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
  333. #endif
  334. #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
  335. #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  336. static int __Pyx_sys_getdefaultencoding_not_ascii;
  337. static int __Pyx_init_sys_getdefaultencoding_params(void) {
  338. PyObject* sys;
  339. PyObject* default_encoding = NULL;
  340. PyObject* ascii_chars_u = NULL;
  341. PyObject* ascii_chars_b = NULL;
  342. const char* default_encoding_c;
  343. sys = PyImport_ImportModule("sys");
  344. if (!sys) goto bad;
  345. default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
  346. Py_DECREF(sys);
  347. if (!default_encoding) goto bad;
  348. default_encoding_c = PyBytes_AsString(default_encoding);
  349. if (!default_encoding_c) goto bad;
  350. if (strcmp(default_encoding_c, "ascii") == 0) {
  351. __Pyx_sys_getdefaultencoding_not_ascii = 0;
  352. } else {
  353. char ascii_chars[128];
  354. int c;
  355. for (c = 0; c < 128; c++) {
  356. ascii_chars[c] = c;
  357. }
  358. __Pyx_sys_getdefaultencoding_not_ascii = 1;
  359. ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
  360. if (!ascii_chars_u) goto bad;
  361. ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
  362. if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
  363. PyErr_Format(
  364. PyExc_ValueError,
  365. "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
  366. default_encoding_c);
  367. goto bad;
  368. }
  369. Py_DECREF(ascii_chars_u);
  370. Py_DECREF(ascii_chars_b);
  371. }
  372. Py_DECREF(default_encoding);
  373. return 0;
  374. bad:
  375. Py_XDECREF(default_encoding);
  376. Py_XDECREF(ascii_chars_u);
  377. Py_XDECREF(ascii_chars_b);
  378. return -1;
  379. }
  380. #endif
  381. #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
  382. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
  383. #else
  384. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
  385. #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  386. static char* __PYX_DEFAULT_STRING_ENCODING;
  387. static int __Pyx_init_sys_getdefaultencoding_params(void) {
  388. PyObject* sys;
  389. PyObject* default_encoding = NULL;
  390. char* default_encoding_c;
  391. sys = PyImport_ImportModule("sys");
  392. if (!sys) goto bad;
  393. default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
  394. Py_DECREF(sys);
  395. if (!default_encoding) goto bad;
  396. default_encoding_c = PyBytes_AsString(default_encoding);
  397. if (!default_encoding_c) goto bad;
  398. __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
  399. if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
  400. strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
  401. Py_DECREF(default_encoding);
  402. return 0;
  403. bad:
  404. Py_XDECREF(default_encoding);
  405. return -1;
  406. }
  407. #endif
  408. #endif
  409. /* Test for GCC > 2.95 */
  410. #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  411. #define likely(x) __builtin_expect(!!(x), 1)
  412. #define unlikely(x) __builtin_expect(!!(x), 0)
  413. #else /* !__GNUC__ or GCC < 2.95 */
  414. #define likely(x) (x)
  415. #define unlikely(x) (x)
  416. #endif /* __GNUC__ */
  417. static PyObject *__pyx_m;
  418. static PyObject *__pyx_d;
  419. static PyObject *__pyx_b;
  420. static PyObject *__pyx_empty_tuple;
  421. static PyObject *__pyx_empty_bytes;
  422. static int __pyx_lineno;
  423. static int __pyx_clineno = 0;
  424. static const char * __pyx_cfilenm= __FILE__;
  425. static const char *__pyx_filename;
  426. #if !defined(CYTHON_CCOMPLEX)
  427. #if defined(__cplusplus)
  428. #define CYTHON_CCOMPLEX 1
  429. #elif defined(_Complex_I)
  430. #define CYTHON_CCOMPLEX 1
  431. #else
  432. #define CYTHON_CCOMPLEX 0
  433. #endif
  434. #endif
  435. #if CYTHON_CCOMPLEX
  436. #ifdef __cplusplus
  437. #include <complex>
  438. #else
  439. #include <complex.h>
  440. #endif
  441. #endif
  442. #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
  443. #undef _Complex_I
  444. #define _Complex_I 1.0fj
  445. #endif
  446. static const char *__pyx_f[] = {
  447. "scattnlay.pyx",
  448. "__init__.pxd",
  449. "stringsource",
  450. "type.pxd",
  451. };
  452. #define IS_UNSIGNED(type) (((type) -1) > 0)
  453. struct __Pyx_StructField_;
  454. #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
  455. typedef struct {
  456. const char* name;
  457. struct __Pyx_StructField_* fields;
  458. size_t size;
  459. size_t arraysize[8];
  460. int ndim;
  461. char typegroup;
  462. char is_unsigned;
  463. int flags;
  464. } __Pyx_TypeInfo;
  465. typedef struct __Pyx_StructField_ {
  466. __Pyx_TypeInfo* type;
  467. const char* name;
  468. size_t offset;
  469. } __Pyx_StructField;
  470. typedef struct {
  471. __Pyx_StructField* field;
  472. size_t parent_offset;
  473. } __Pyx_BufFmt_StackElem;
  474. typedef struct {
  475. __Pyx_StructField root;
  476. __Pyx_BufFmt_StackElem* head;
  477. size_t fmt_offset;
  478. size_t new_count, enc_count;
  479. size_t struct_alignment;
  480. int is_complex;
  481. char enc_type;
  482. char new_packmode;
  483. char enc_packmode;
  484. char is_valid_array;
  485. } __Pyx_BufFmt_Context;
  486. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":726
  487. * # in Cython to enable them only on the right systems.
  488. *
  489. * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<<
  490. * ctypedef npy_int16 int16_t
  491. * ctypedef npy_int32 int32_t
  492. */
  493. typedef npy_int8 __pyx_t_5numpy_int8_t;
  494. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":727
  495. *
  496. * ctypedef npy_int8 int8_t
  497. * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<<
  498. * ctypedef npy_int32 int32_t
  499. * ctypedef npy_int64 int64_t
  500. */
  501. typedef npy_int16 __pyx_t_5numpy_int16_t;
  502. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":728
  503. * ctypedef npy_int8 int8_t
  504. * ctypedef npy_int16 int16_t
  505. * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<<
  506. * ctypedef npy_int64 int64_t
  507. * #ctypedef npy_int96 int96_t
  508. */
  509. typedef npy_int32 __pyx_t_5numpy_int32_t;
  510. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":729
  511. * ctypedef npy_int16 int16_t
  512. * ctypedef npy_int32 int32_t
  513. * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<<
  514. * #ctypedef npy_int96 int96_t
  515. * #ctypedef npy_int128 int128_t
  516. */
  517. typedef npy_int64 __pyx_t_5numpy_int64_t;
  518. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":733
  519. * #ctypedef npy_int128 int128_t
  520. *
  521. * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<<
  522. * ctypedef npy_uint16 uint16_t
  523. * ctypedef npy_uint32 uint32_t
  524. */
  525. typedef npy_uint8 __pyx_t_5numpy_uint8_t;
  526. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":734
  527. *
  528. * ctypedef npy_uint8 uint8_t
  529. * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<<
  530. * ctypedef npy_uint32 uint32_t
  531. * ctypedef npy_uint64 uint64_t
  532. */
  533. typedef npy_uint16 __pyx_t_5numpy_uint16_t;
  534. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":735
  535. * ctypedef npy_uint8 uint8_t
  536. * ctypedef npy_uint16 uint16_t
  537. * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<<
  538. * ctypedef npy_uint64 uint64_t
  539. * #ctypedef npy_uint96 uint96_t
  540. */
  541. typedef npy_uint32 __pyx_t_5numpy_uint32_t;
  542. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":736
  543. * ctypedef npy_uint16 uint16_t
  544. * ctypedef npy_uint32 uint32_t
  545. * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<<
  546. * #ctypedef npy_uint96 uint96_t
  547. * #ctypedef npy_uint128 uint128_t
  548. */
  549. typedef npy_uint64 __pyx_t_5numpy_uint64_t;
  550. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":740
  551. * #ctypedef npy_uint128 uint128_t
  552. *
  553. * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<<
  554. * ctypedef npy_float64 float64_t
  555. * #ctypedef npy_float80 float80_t
  556. */
  557. typedef npy_float32 __pyx_t_5numpy_float32_t;
  558. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":741
  559. *
  560. * ctypedef npy_float32 float32_t
  561. * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<<
  562. * #ctypedef npy_float80 float80_t
  563. * #ctypedef npy_float128 float128_t
  564. */
  565. typedef npy_float64 __pyx_t_5numpy_float64_t;
  566. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":750
  567. * # The int types are mapped a bit surprising --
  568. * # numpy.int corresponds to 'l' and numpy.long to 'q'
  569. * ctypedef npy_long int_t # <<<<<<<<<<<<<<
  570. * ctypedef npy_longlong long_t
  571. * ctypedef npy_longlong longlong_t
  572. */
  573. typedef npy_long __pyx_t_5numpy_int_t;
  574. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":751
  575. * # numpy.int corresponds to 'l' and numpy.long to 'q'
  576. * ctypedef npy_long int_t
  577. * ctypedef npy_longlong long_t # <<<<<<<<<<<<<<
  578. * ctypedef npy_longlong longlong_t
  579. *
  580. */
  581. typedef npy_longlong __pyx_t_5numpy_long_t;
  582. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":752
  583. * ctypedef npy_long int_t
  584. * ctypedef npy_longlong long_t
  585. * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<<
  586. *
  587. * ctypedef npy_ulong uint_t
  588. */
  589. typedef npy_longlong __pyx_t_5numpy_longlong_t;
  590. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":754
  591. * ctypedef npy_longlong longlong_t
  592. *
  593. * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<<
  594. * ctypedef npy_ulonglong ulong_t
  595. * ctypedef npy_ulonglong ulonglong_t
  596. */
  597. typedef npy_ulong __pyx_t_5numpy_uint_t;
  598. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":755
  599. *
  600. * ctypedef npy_ulong uint_t
  601. * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<<
  602. * ctypedef npy_ulonglong ulonglong_t
  603. *
  604. */
  605. typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
  606. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":756
  607. * ctypedef npy_ulong uint_t
  608. * ctypedef npy_ulonglong ulong_t
  609. * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<<
  610. *
  611. * ctypedef npy_intp intp_t
  612. */
  613. typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
  614. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":758
  615. * ctypedef npy_ulonglong ulonglong_t
  616. *
  617. * ctypedef npy_intp intp_t # <<<<<<<<<<<<<<
  618. * ctypedef npy_uintp uintp_t
  619. *
  620. */
  621. typedef npy_intp __pyx_t_5numpy_intp_t;
  622. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":759
  623. *
  624. * ctypedef npy_intp intp_t
  625. * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<<
  626. *
  627. * ctypedef npy_double float_t
  628. */
  629. typedef npy_uintp __pyx_t_5numpy_uintp_t;
  630. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":761
  631. * ctypedef npy_uintp uintp_t
  632. *
  633. * ctypedef npy_double float_t # <<<<<<<<<<<<<<
  634. * ctypedef npy_double double_t
  635. * ctypedef npy_longdouble longdouble_t
  636. */
  637. typedef npy_double __pyx_t_5numpy_float_t;
  638. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":762
  639. *
  640. * ctypedef npy_double float_t
  641. * ctypedef npy_double double_t # <<<<<<<<<<<<<<
  642. * ctypedef npy_longdouble longdouble_t
  643. *
  644. */
  645. typedef npy_double __pyx_t_5numpy_double_t;
  646. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":763
  647. * ctypedef npy_double float_t
  648. * ctypedef npy_double double_t
  649. * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<<
  650. *
  651. * ctypedef npy_cfloat cfloat_t
  652. */
  653. typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
  654. #if CYTHON_CCOMPLEX
  655. #ifdef __cplusplus
  656. typedef ::std::complex< double > __pyx_t_double_complex;
  657. #else
  658. typedef double _Complex __pyx_t_double_complex;
  659. #endif
  660. #else
  661. typedef struct { double real, imag; } __pyx_t_double_complex;
  662. #endif
  663. #if CYTHON_CCOMPLEX
  664. #ifdef __cplusplus
  665. typedef ::std::complex< float > __pyx_t_float_complex;
  666. #else
  667. typedef float _Complex __pyx_t_float_complex;
  668. #endif
  669. #else
  670. typedef struct { float real, imag; } __pyx_t_float_complex;
  671. #endif
  672. /*--- Type declarations ---*/
  673. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":765
  674. * ctypedef npy_longdouble longdouble_t
  675. *
  676. * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<<
  677. * ctypedef npy_cdouble cdouble_t
  678. * ctypedef npy_clongdouble clongdouble_t
  679. */
  680. typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
  681. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":766
  682. *
  683. * ctypedef npy_cfloat cfloat_t
  684. * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<<
  685. * ctypedef npy_clongdouble clongdouble_t
  686. *
  687. */
  688. typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
  689. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":767
  690. * ctypedef npy_cfloat cfloat_t
  691. * ctypedef npy_cdouble cdouble_t
  692. * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<<
  693. *
  694. * ctypedef npy_cdouble complex_t
  695. */
  696. typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
  697. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":769
  698. * ctypedef npy_clongdouble clongdouble_t
  699. *
  700. * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<<
  701. *
  702. * cdef inline object PyArray_MultiIterNew1(a):
  703. */
  704. typedef npy_cdouble __pyx_t_5numpy_complex_t;
  705. /* --- Runtime support code (head) --- */
  706. #ifndef CYTHON_REFNANNY
  707. #define CYTHON_REFNANNY 0
  708. #endif
  709. #if CYTHON_REFNANNY
  710. typedef struct {
  711. void (*INCREF)(void*, PyObject*, int);
  712. void (*DECREF)(void*, PyObject*, int);
  713. void (*GOTREF)(void*, PyObject*, int);
  714. void (*GIVEREF)(void*, PyObject*, int);
  715. void* (*SetupContext)(const char*, int, const char*);
  716. void (*FinishContext)(void**);
  717. } __Pyx_RefNannyAPIStruct;
  718. static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  719. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  720. #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  721. #ifdef WITH_THREAD
  722. #define __Pyx_RefNannySetupContext(name, acquire_gil) \
  723. if (acquire_gil) { \
  724. PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
  725. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
  726. PyGILState_Release(__pyx_gilstate_save); \
  727. } else { \
  728. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
  729. }
  730. #else
  731. #define __Pyx_RefNannySetupContext(name, acquire_gil) \
  732. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
  733. #endif
  734. #define __Pyx_RefNannyFinishContext() \
  735. __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  736. #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  737. #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  738. #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  739. #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  740. #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  741. #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  742. #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  743. #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
  744. #else
  745. #define __Pyx_RefNannyDeclarations
  746. #define __Pyx_RefNannySetupContext(name, acquire_gil)
  747. #define __Pyx_RefNannyFinishContext()
  748. #define __Pyx_INCREF(r) Py_INCREF(r)
  749. #define __Pyx_DECREF(r) Py_DECREF(r)
  750. #define __Pyx_GOTREF(r)
  751. #define __Pyx_GIVEREF(r)
  752. #define __Pyx_XINCREF(r) Py_XINCREF(r)
  753. #define __Pyx_XDECREF(r) Py_XDECREF(r)
  754. #define __Pyx_XGOTREF(r)
  755. #define __Pyx_XGIVEREF(r)
  756. #endif
  757. #define __Pyx_XDECREF_SET(r, v) do { \
  758. PyObject *tmp = (PyObject *) r; \
  759. r = v; __Pyx_XDECREF(tmp); \
  760. } while (0)
  761. #define __Pyx_DECREF_SET(r, v) do { \
  762. PyObject *tmp = (PyObject *) r; \
  763. r = v; __Pyx_DECREF(tmp); \
  764. } while (0)
  765. #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
  766. #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
  767. #if CYTHON_COMPILING_IN_CPYTHON
  768. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
  769. PyTypeObject* tp = Py_TYPE(obj);
  770. if (likely(tp->tp_getattro))
  771. return tp->tp_getattro(obj, attr_name);
  772. #if PY_MAJOR_VERSION < 3
  773. if (likely(tp->tp_getattr))
  774. return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
  775. #endif
  776. return PyObject_GetAttr(obj, attr_name);
  777. }
  778. #else
  779. #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
  780. #endif
  781. static PyObject *__Pyx_GetBuiltinName(PyObject *name);
  782. static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
  783. #if CYTHON_COMPILING_IN_CPYTHON
  784. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
  785. #else
  786. #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
  787. #endif
  788. static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
  789. static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb);
  790. static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb);
  791. static void __Pyx_WriteUnraisable(const char *name, int clineno,
  792. int lineno, const char *filename,
  793. int full_traceback);
  794. static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
  795. Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
  796. static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
  797. static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
  798. PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
  799. const char* function_name);
  800. static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
  801. const char *name, int exact);
  802. static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
  803. __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
  804. static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
  805. static void __Pyx_RaiseBufferFallbackError(void);
  806. #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
  807. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
  808. __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) : \
  809. (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) : \
  810. __Pyx_GetItemInt_Generic(o, to_py_func(i))))
  811. #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
  812. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
  813. __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \
  814. (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
  815. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
  816. int wraparound, int boundscheck);
  817. #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
  818. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
  819. __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \
  820. (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
  821. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
  822. int wraparound, int boundscheck);
  823. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
  824. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
  825. int is_list, int wraparound, int boundscheck);
  826. static void __Pyx_RaiseBufferIndexError(int axis);
  827. #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
  828. #define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
  829. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
  830. __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) : \
  831. (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) : \
  832. __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
  833. static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
  834. static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
  835. int is_list, int wraparound, int boundscheck);
  836. #if CYTHON_COMPILING_IN_CPYTHON
  837. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
  838. #endif
  839. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
  840. #if CYTHON_COMPILING_IN_CPYTHON
  841. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
  842. #else
  843. #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
  844. #endif
  845. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
  846. #if PY_MAJOR_VERSION >= 3
  847. static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
  848. PyObject *value;
  849. value = PyDict_GetItemWithError(d, key);
  850. if (unlikely(!value)) {
  851. if (!PyErr_Occurred()) {
  852. PyObject* args = PyTuple_Pack(1, key);
  853. if (likely(args))
  854. PyErr_SetObject(PyExc_KeyError, args);
  855. Py_XDECREF(args);
  856. }
  857. return NULL;
  858. }
  859. Py_INCREF(value);
  860. return value;
  861. }
  862. #else
  863. #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
  864. #endif
  865. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
  866. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
  867. static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
  868. typedef struct {
  869. int code_line;
  870. PyCodeObject* code_object;
  871. } __Pyx_CodeObjectCacheEntry;
  872. struct __Pyx_CodeObjectCache {
  873. int count;
  874. int max_count;
  875. __Pyx_CodeObjectCacheEntry* entries;
  876. };
  877. static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
  878. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
  879. static PyCodeObject *__pyx_find_code_object(int code_line);
  880. static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
  881. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  882. int py_line, const char *filename);
  883. typedef struct {
  884. Py_ssize_t shape, strides, suboffsets;
  885. } __Pyx_Buf_DimInfo;
  886. typedef struct {
  887. size_t refcount;
  888. Py_buffer pybuffer;
  889. } __Pyx_Buffer;
  890. typedef struct {
  891. __Pyx_Buffer *rcbuffer;
  892. char *data;
  893. __Pyx_Buf_DimInfo diminfo[8];
  894. } __Pyx_LocalBuf_ND;
  895. #if PY_MAJOR_VERSION < 3
  896. static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
  897. static void __Pyx_ReleaseBuffer(Py_buffer *view);
  898. #else
  899. #define __Pyx_GetBuffer PyObject_GetBuffer
  900. #define __Pyx_ReleaseBuffer PyBuffer_Release
  901. #endif
  902. static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0};
  903. static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1};
  904. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
  905. static CYTHON_INLINE npy_long __Pyx_PyInt_As_npy_long(PyObject *);
  906. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value);
  907. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_long(npy_long value);
  908. static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
  909. static __pyx_t_double_complex __Pyx_PyComplex_As___pyx_t_double_complex(PyObject*);
  910. #if CYTHON_CCOMPLEX
  911. #ifdef __cplusplus
  912. #define __Pyx_CREAL(z) ((z).real())
  913. #define __Pyx_CIMAG(z) ((z).imag())
  914. #else
  915. #define __Pyx_CREAL(z) (__real__(z))
  916. #define __Pyx_CIMAG(z) (__imag__(z))
  917. #endif
  918. #else
  919. #define __Pyx_CREAL(z) ((z).real)
  920. #define __Pyx_CIMAG(z) ((z).imag)
  921. #endif
  922. #if (defined(_WIN32) || defined(__clang__)) && defined(__cplusplus) && CYTHON_CCOMPLEX
  923. #define __Pyx_SET_CREAL(z,x) ((z).real(x))
  924. #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
  925. #else
  926. #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
  927. #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
  928. #endif
  929. #if CYTHON_CCOMPLEX
  930. #define __Pyx_c_eq(a, b) ((a)==(b))
  931. #define __Pyx_c_sum(a, b) ((a)+(b))
  932. #define __Pyx_c_diff(a, b) ((a)-(b))
  933. #define __Pyx_c_prod(a, b) ((a)*(b))
  934. #define __Pyx_c_quot(a, b) ((a)/(b))
  935. #define __Pyx_c_neg(a) (-(a))
  936. #ifdef __cplusplus
  937. #define __Pyx_c_is_zero(z) ((z)==(double)0)
  938. #define __Pyx_c_conj(z) (::std::conj(z))
  939. #if 1
  940. #define __Pyx_c_abs(z) (::std::abs(z))
  941. #define __Pyx_c_pow(a, b) (::std::pow(a, b))
  942. #endif
  943. #else
  944. #define __Pyx_c_is_zero(z) ((z)==0)
  945. #define __Pyx_c_conj(z) (conj(z))
  946. #if 1
  947. #define __Pyx_c_abs(z) (cabs(z))
  948. #define __Pyx_c_pow(a, b) (cpow(a, b))
  949. #endif
  950. #endif
  951. #else
  952. static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex);
  953. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex);
  954. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex);
  955. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex);
  956. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex);
  957. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex);
  958. static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex);
  959. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex);
  960. #if 1
  961. static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);
  962. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex);
  963. #endif
  964. #endif
  965. static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
  966. #if CYTHON_CCOMPLEX
  967. #define __Pyx_c_eqf(a, b) ((a)==(b))
  968. #define __Pyx_c_sumf(a, b) ((a)+(b))
  969. #define __Pyx_c_difff(a, b) ((a)-(b))
  970. #define __Pyx_c_prodf(a, b) ((a)*(b))
  971. #define __Pyx_c_quotf(a, b) ((a)/(b))
  972. #define __Pyx_c_negf(a) (-(a))
  973. #ifdef __cplusplus
  974. #define __Pyx_c_is_zerof(z) ((z)==(float)0)
  975. #define __Pyx_c_conjf(z) (::std::conj(z))
  976. #if 1
  977. #define __Pyx_c_absf(z) (::std::abs(z))
  978. #define __Pyx_c_powf(a, b) (::std::pow(a, b))
  979. #endif
  980. #else
  981. #define __Pyx_c_is_zerof(z) ((z)==0)
  982. #define __Pyx_c_conjf(z) (conjf(z))
  983. #if 1
  984. #define __Pyx_c_absf(z) (cabsf(z))
  985. #define __Pyx_c_powf(a, b) (cpowf(a, b))
  986. #endif
  987. #endif
  988. #else
  989. static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex);
  990. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex);
  991. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex);
  992. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex);
  993. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex);
  994. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex);
  995. static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex);
  996. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex);
  997. #if 1
  998. static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);
  999. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex);
  1000. #endif
  1001. #endif
  1002. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
  1003. static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
  1004. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
  1005. static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
  1006. static int __Pyx_check_binary_version(void);
  1007. #if !defined(__Pyx_PyIdentifier_FromString)
  1008. #if PY_MAJOR_VERSION < 3
  1009. #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
  1010. #else
  1011. #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
  1012. #endif
  1013. #endif
  1014. static PyObject *__Pyx_ImportModule(const char *name);
  1015. static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);
  1016. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
  1017. /* Module declarations from 'cpython.buffer' */
  1018. /* Module declarations from 'cpython.ref' */
  1019. /* Module declarations from 'libc.string' */
  1020. /* Module declarations from 'libc.stdio' */
  1021. /* Module declarations from 'cpython.object' */
  1022. /* Module declarations from '__builtin__' */
  1023. /* Module declarations from 'cpython.type' */
  1024. static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
  1025. /* Module declarations from 'libc.stdlib' */
  1026. /* Module declarations from 'numpy' */
  1027. /* Module declarations from 'numpy' */
  1028. static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
  1029. static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
  1030. static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
  1031. static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
  1032. static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
  1033. static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
  1034. /* Module declarations from 'libcpp.vector' */
  1035. /* Module declarations from 'scattnlay' */
  1036. static CYTHON_INLINE double *__pyx_f_9scattnlay_npy2c(PyArrayObject *); /*proto*/
  1037. static std::vector<double> __pyx_convert_vector_from_py_double(PyObject *); /*proto*/
  1038. static std::vector<__pyx_t_double_complex> __pyx_convert_vector_from_py___pyx_t_double_complex(PyObject *); /*proto*/
  1039. 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 };
  1040. static __Pyx_TypeInfo __Pyx_TypeInfo___pyx_t_double_complex = { "double complex", NULL, sizeof(__pyx_t_double_complex), { 0 }, 0, 'C', 0, 0 };
  1041. 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 };
  1042. #define __Pyx_MODULE_NAME "scattnlay"
  1043. int __pyx_module_is_main_scattnlay = 0;
  1044. /* Implementation of 'scattnlay' */
  1045. static PyObject *__pyx_builtin_range;
  1046. static PyObject *__pyx_builtin_ValueError;
  1047. static PyObject *__pyx_builtin_RuntimeError;
  1048. static PyObject *__pyx_pf_9scattnlay_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 */
  1049. static PyObject *__pyx_pf_9scattnlay_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 */
  1050. static PyObject *__pyx_pf_9scattnlay_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 */
  1051. static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
  1052. static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
  1053. static char __pyx_k_B[] = "B";
  1054. static char __pyx_k_C[] = "C";
  1055. static char __pyx_k_E[] = "E";
  1056. static char __pyx_k_H[] = "H";
  1057. static char __pyx_k_I[] = "I";
  1058. static char __pyx_k_L[] = "L";
  1059. static char __pyx_k_O[] = "O";
  1060. static char __pyx_k_Q[] = "Q";
  1061. static char __pyx_k_b[] = "b";
  1062. static char __pyx_k_d[] = "d";
  1063. static char __pyx_k_f[] = "f";
  1064. static char __pyx_k_g[] = "g";
  1065. static char __pyx_k_h[] = "h";
  1066. static char __pyx_k_i[] = "i";
  1067. static char __pyx_k_l[] = "l";
  1068. static char __pyx_k_m[] = "m";
  1069. static char __pyx_k_q[] = "q";
  1070. static char __pyx_k_x[] = "x";
  1071. static char __pyx_k_S1[] = "S1";
  1072. static char __pyx_k_S2[] = "S2";
  1073. static char __pyx_k_Zd[] = "Zd";
  1074. static char __pyx_k_Zf[] = "Zf";
  1075. static char __pyx_k_Zg[] = "Zg";
  1076. static char __pyx_k_an[] = "an";
  1077. static char __pyx_k_bn[] = "bn";
  1078. static char __pyx_k_np[] = "np";
  1079. static char __pyx_k_pl[] = "pl";
  1080. static char __pyx_k_Eix[] = "Eix";
  1081. static char __pyx_k_Eiy[] = "Eiy";
  1082. static char __pyx_k_Eiz[] = "Eiz";
  1083. static char __pyx_k_Erx[] = "Erx";
  1084. static char __pyx_k_Ery[] = "Ery";
  1085. static char __pyx_k_Erz[] = "Erz";
  1086. static char __pyx_k_Hix[] = "Hix";
  1087. static char __pyx_k_Hiy[] = "Hiy";
  1088. static char __pyx_k_Hiz[] = "Hiz";
  1089. static char __pyx_k_Hrx[] = "Hrx";
  1090. static char __pyx_k_Hry[] = "Hry";
  1091. static char __pyx_k_Hrz[] = "Hrz";
  1092. static char __pyx_k_Qbk[] = "Qbk";
  1093. static char __pyx_k_Qpr[] = "Qpr";
  1094. static char __pyx_k_S1i[] = "S1i";
  1095. static char __pyx_k_S1r[] = "S1r";
  1096. static char __pyx_k_S2i[] = "S2i";
  1097. static char __pyx_k_S2r[] = "S2r";
  1098. static char __pyx_k_ani[] = "ani";
  1099. static char __pyx_k_anr[] = "anr";
  1100. static char __pyx_k_bni[] = "bni";
  1101. static char __pyx_k_bnr[] = "bnr";
  1102. static char __pyx_k_int[] = "int";
  1103. static char __pyx_k_Qabs[] = "Qabs";
  1104. static char __pyx_k_Qext[] = "Qext";
  1105. static char __pyx_k_Qsca[] = "Qsca";
  1106. static char __pyx_k_copy[] = "copy";
  1107. static char __pyx_k_main[] = "__main__";
  1108. static char __pyx_k_nmax[] = "nmax";
  1109. static char __pyx_k_test[] = "__test__";
  1110. static char __pyx_k_dtype[] = "dtype";
  1111. static char __pyx_k_flags[] = "flags";
  1112. static char __pyx_k_numpy[] = "numpy";
  1113. static char __pyx_k_range[] = "range";
  1114. static char __pyx_k_terms[] = "terms";
  1115. static char __pyx_k_theta[] = "theta";
  1116. static char __pyx_k_zeros[] = "zeros";
  1117. static char __pyx_k_Albedo[] = "Albedo";
  1118. static char __pyx_k_coords[] = "coords";
  1119. static char __pyx_k_import[] = "__import__";
  1120. static char __pyx_k_vstack[] = "vstack";
  1121. static char __pyx_k_float64[] = "float64";
  1122. static char __pyx_k_fieldnlay[] = "fieldnlay";
  1123. static char __pyx_k_scattnlay[] = "scattnlay";
  1124. static char __pyx_k_transpose[] = "transpose";
  1125. static char __pyx_k_ValueError[] = "ValueError";
  1126. static char __pyx_k_complex128[] = "complex128";
  1127. static char __pyx_k_scattcoeffs[] = "scattcoeffs";
  1128. static char __pyx_k_C_CONTIGUOUS[] = "C_CONTIGUOUS";
  1129. static char __pyx_k_RuntimeError[] = "RuntimeError";
  1130. static char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
  1131. static char __pyx_k_home_tig_KOsty_Documents_Simula[] = "/home/tig/KOsty/Documents/Simulations/Belov/Ovidio/python-scattnlay-dev/scattnlay.pyx";
  1132. static char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
  1133. static char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
  1134. static char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
  1135. static char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
  1136. static char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
  1137. static PyObject *__pyx_n_s_Albedo;
  1138. static PyObject *__pyx_n_s_C;
  1139. static PyObject *__pyx_n_s_C_CONTIGUOUS;
  1140. static PyObject *__pyx_n_s_E;
  1141. static PyObject *__pyx_n_s_Eix;
  1142. static PyObject *__pyx_n_s_Eiy;
  1143. static PyObject *__pyx_n_s_Eiz;
  1144. static PyObject *__pyx_n_s_Erx;
  1145. static PyObject *__pyx_n_s_Ery;
  1146. static PyObject *__pyx_n_s_Erz;
  1147. static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
  1148. static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
  1149. static PyObject *__pyx_n_s_H;
  1150. static PyObject *__pyx_n_s_Hix;
  1151. static PyObject *__pyx_n_s_Hiy;
  1152. static PyObject *__pyx_n_s_Hiz;
  1153. static PyObject *__pyx_n_s_Hrx;
  1154. static PyObject *__pyx_n_s_Hry;
  1155. static PyObject *__pyx_n_s_Hrz;
  1156. static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
  1157. static PyObject *__pyx_n_s_Qabs;
  1158. static PyObject *__pyx_n_s_Qbk;
  1159. static PyObject *__pyx_n_s_Qext;
  1160. static PyObject *__pyx_n_s_Qpr;
  1161. static PyObject *__pyx_n_s_Qsca;
  1162. static PyObject *__pyx_n_s_RuntimeError;
  1163. static PyObject *__pyx_n_s_S1;
  1164. static PyObject *__pyx_n_s_S1i;
  1165. static PyObject *__pyx_n_s_S1r;
  1166. static PyObject *__pyx_n_s_S2;
  1167. static PyObject *__pyx_n_s_S2i;
  1168. static PyObject *__pyx_n_s_S2r;
  1169. static PyObject *__pyx_n_s_ValueError;
  1170. static PyObject *__pyx_n_s_an;
  1171. static PyObject *__pyx_n_s_ani;
  1172. static PyObject *__pyx_n_s_anr;
  1173. static PyObject *__pyx_n_s_bn;
  1174. static PyObject *__pyx_n_s_bni;
  1175. static PyObject *__pyx_n_s_bnr;
  1176. static PyObject *__pyx_n_s_complex128;
  1177. static PyObject *__pyx_n_s_coords;
  1178. static PyObject *__pyx_n_s_copy;
  1179. static PyObject *__pyx_n_s_dtype;
  1180. static PyObject *__pyx_n_s_fieldnlay;
  1181. static PyObject *__pyx_n_s_flags;
  1182. static PyObject *__pyx_n_s_float64;
  1183. static PyObject *__pyx_n_s_g;
  1184. static PyObject *__pyx_kp_s_home_tig_KOsty_Documents_Simula;
  1185. static PyObject *__pyx_n_s_i;
  1186. static PyObject *__pyx_n_s_import;
  1187. static PyObject *__pyx_n_s_int;
  1188. static PyObject *__pyx_n_s_m;
  1189. static PyObject *__pyx_n_s_main;
  1190. static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
  1191. static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
  1192. static PyObject *__pyx_n_s_nmax;
  1193. static PyObject *__pyx_n_s_np;
  1194. static PyObject *__pyx_n_s_numpy;
  1195. static PyObject *__pyx_n_s_pl;
  1196. static PyObject *__pyx_n_s_range;
  1197. static PyObject *__pyx_n_s_scattcoeffs;
  1198. static PyObject *__pyx_n_s_scattnlay;
  1199. static PyObject *__pyx_n_s_terms;
  1200. static PyObject *__pyx_n_s_test;
  1201. static PyObject *__pyx_n_s_theta;
  1202. static PyObject *__pyx_n_s_transpose;
  1203. static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
  1204. static PyObject *__pyx_n_s_vstack;
  1205. static PyObject *__pyx_n_s_x;
  1206. static PyObject *__pyx_n_s_zeros;
  1207. static PyObject *__pyx_int_0;
  1208. static PyObject *__pyx_int_1;
  1209. static PyObject *__pyx_int_2;
  1210. static PyObject *__pyx_int_3;
  1211. static PyArrayObject *__pyx_k__8;
  1212. static PyObject *__pyx_tuple_;
  1213. static PyObject *__pyx_tuple__2;
  1214. static PyObject *__pyx_tuple__3;
  1215. static PyObject *__pyx_tuple__4;
  1216. static PyObject *__pyx_tuple__5;
  1217. static PyObject *__pyx_tuple__6;
  1218. static PyObject *__pyx_tuple__7;
  1219. static PyObject *__pyx_tuple__9;
  1220. static PyObject *__pyx_slice__18;
  1221. static PyObject *__pyx_slice__21;
  1222. static PyObject *__pyx_slice__24;
  1223. static PyObject *__pyx_tuple__10;
  1224. static PyObject *__pyx_tuple__11;
  1225. static PyObject *__pyx_tuple__12;
  1226. static PyObject *__pyx_tuple__13;
  1227. static PyObject *__pyx_tuple__14;
  1228. static PyObject *__pyx_tuple__15;
  1229. static PyObject *__pyx_tuple__16;
  1230. static PyObject *__pyx_tuple__17;
  1231. static PyObject *__pyx_tuple__19;
  1232. static PyObject *__pyx_tuple__20;
  1233. static PyObject *__pyx_tuple__22;
  1234. static PyObject *__pyx_tuple__23;
  1235. static PyObject *__pyx_tuple__25;
  1236. static PyObject *__pyx_tuple__26;
  1237. static PyObject *__pyx_tuple__27;
  1238. static PyObject *__pyx_tuple__28;
  1239. static PyObject *__pyx_tuple__29;
  1240. static PyObject *__pyx_tuple__30;
  1241. static PyObject *__pyx_tuple__31;
  1242. static PyObject *__pyx_tuple__32;
  1243. static PyObject *__pyx_tuple__33;
  1244. static PyObject *__pyx_tuple__34;
  1245. static PyObject *__pyx_tuple__35;
  1246. static PyObject *__pyx_tuple__36;
  1247. static PyObject *__pyx_tuple__37;
  1248. static PyObject *__pyx_tuple__38;
  1249. static PyObject *__pyx_tuple__39;
  1250. static PyObject *__pyx_tuple__40;
  1251. static PyObject *__pyx_tuple__41;
  1252. static PyObject *__pyx_tuple__42;
  1253. static PyObject *__pyx_tuple__43;
  1254. static PyObject *__pyx_tuple__44;
  1255. static PyObject *__pyx_tuple__45;
  1256. static PyObject *__pyx_tuple__47;
  1257. static PyObject *__pyx_tuple__48;
  1258. static PyObject *__pyx_tuple__50;
  1259. static PyObject *__pyx_codeobj__46;
  1260. static PyObject *__pyx_codeobj__49;
  1261. static PyObject *__pyx_codeobj__51;
  1262. /* "scattnlay.pyx":35
  1263. * from libcpp.vector cimport complex
  1264. *
  1265. * cdef inline double *npy2c(np.ndarray a): # <<<<<<<<<<<<<<
  1266. * assert a.dtype == np.float64
  1267. *
  1268. */
  1269. static CYTHON_INLINE double *__pyx_f_9scattnlay_npy2c(PyArrayObject *__pyx_v_a) {
  1270. double *__pyx_r;
  1271. __Pyx_RefNannyDeclarations
  1272. PyObject *__pyx_t_1 = NULL;
  1273. PyObject *__pyx_t_2 = NULL;
  1274. PyObject *__pyx_t_3 = NULL;
  1275. int __pyx_t_4;
  1276. int __pyx_t_5;
  1277. int __pyx_lineno = 0;
  1278. const char *__pyx_filename = NULL;
  1279. int __pyx_clineno = 0;
  1280. __Pyx_RefNannySetupContext("npy2c", 0);
  1281. __Pyx_INCREF((PyObject *)__pyx_v_a);
  1282. /* "scattnlay.pyx":36
  1283. *
  1284. * cdef inline double *npy2c(np.ndarray a):
  1285. * assert a.dtype == np.float64 # <<<<<<<<<<<<<<
  1286. *
  1287. * if not (<object>a).flags["C_CONTIGUOUS"]: # Array is not contiguous, need to make contiguous copy
  1288. */
  1289. #ifndef CYTHON_WITHOUT_ASSERTIONS
  1290. if (unlikely(!Py_OptimizeFlag)) {
  1291. __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 = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1292. __Pyx_GOTREF(__pyx_t_1);
  1293. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1294. __Pyx_GOTREF(__pyx_t_2);
  1295. __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 = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1296. __Pyx_GOTREF(__pyx_t_3);
  1297. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1298. __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 = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1299. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1300. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1301. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1302. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1303. if (unlikely(!__pyx_t_4)) {
  1304. PyErr_SetNone(PyExc_AssertionError);
  1305. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1306. }
  1307. }
  1308. #endif
  1309. /* "scattnlay.pyx":38
  1310. * assert a.dtype == np.float64
  1311. *
  1312. * if not (<object>a).flags["C_CONTIGUOUS"]: # Array is not contiguous, need to make contiguous copy # <<<<<<<<<<<<<<
  1313. * a = a.copy('C')
  1314. *
  1315. */
  1316. __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 = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1317. __Pyx_GOTREF(__pyx_t_2);
  1318. __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 = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  1319. __Pyx_GOTREF(__pyx_t_3);
  1320. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1321. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1322. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1323. __pyx_t_5 = ((!__pyx_t_4) != 0);
  1324. if (__pyx_t_5) {
  1325. /* "scattnlay.pyx":39
  1326. *
  1327. * if not (<object>a).flags["C_CONTIGUOUS"]: # Array is not contiguous, need to make contiguous copy
  1328. * a = a.copy('C') # <<<<<<<<<<<<<<
  1329. *
  1330. * # Return data pointer
  1331. */
  1332. __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 = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1333. __Pyx_GOTREF(__pyx_t_3);
  1334. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1335. __Pyx_GOTREF(__pyx_t_2);
  1336. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1337. if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1338. __Pyx_DECREF_SET(__pyx_v_a, ((PyArrayObject *)__pyx_t_2));
  1339. __pyx_t_2 = 0;
  1340. goto __pyx_L3;
  1341. }
  1342. __pyx_L3:;
  1343. /* "scattnlay.pyx":42
  1344. *
  1345. * # Return data pointer
  1346. * return <double *>(a.data) # <<<<<<<<<<<<<<
  1347. *
  1348. * cdef extern from "py_nmie.h":
  1349. */
  1350. __pyx_r = ((double *)__pyx_v_a->data);
  1351. goto __pyx_L0;
  1352. /* "scattnlay.pyx":35
  1353. * from libcpp.vector cimport complex
  1354. *
  1355. * cdef inline double *npy2c(np.ndarray a): # <<<<<<<<<<<<<<
  1356. * assert a.dtype == np.float64
  1357. *
  1358. */
  1359. /* function exit code */
  1360. __pyx_L1_error:;
  1361. __Pyx_XDECREF(__pyx_t_1);
  1362. __Pyx_XDECREF(__pyx_t_2);
  1363. __Pyx_XDECREF(__pyx_t_3);
  1364. __Pyx_WriteUnraisable("scattnlay.npy2c", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  1365. __pyx_r = 0;
  1366. __pyx_L0:;
  1367. __Pyx_XDECREF((PyObject *)__pyx_v_a);
  1368. __Pyx_RefNannyFinishContext();
  1369. return __pyx_r;
  1370. }
  1371. /* "scattnlay.pyx":49
  1372. * 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[])
  1373. *
  1374. * 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): # <<<<<<<<<<<<<<
  1375. * cdef Py_ssize_t i
  1376. *
  1377. */
  1378. /* Python wrapper */
  1379. static PyObject *__pyx_pw_9scattnlay_1scattcoeffs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  1380. static PyMethodDef __pyx_mdef_9scattnlay_1scattcoeffs = {"scattcoeffs", (PyCFunction)__pyx_pw_9scattnlay_1scattcoeffs, METH_VARARGS|METH_KEYWORDS, 0};
  1381. static PyObject *__pyx_pw_9scattnlay_1scattcoeffs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  1382. PyArrayObject *__pyx_v_x = 0;
  1383. PyArrayObject *__pyx_v_m = 0;
  1384. __pyx_t_5numpy_int_t __pyx_v_nmax;
  1385. __pyx_t_5numpy_int_t __pyx_v_pl;
  1386. int __pyx_lineno = 0;
  1387. const char *__pyx_filename = NULL;
  1388. int __pyx_clineno = 0;
  1389. PyObject *__pyx_r = 0;
  1390. __Pyx_RefNannyDeclarations
  1391. __Pyx_RefNannySetupContext("scattcoeffs (wrapper)", 0);
  1392. {
  1393. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_m,&__pyx_n_s_nmax,&__pyx_n_s_pl,0};
  1394. PyObject* values[4] = {0,0,0,0};
  1395. if (unlikely(__pyx_kwds)) {
  1396. Py_ssize_t kw_args;
  1397. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  1398. switch (pos_args) {
  1399. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  1400. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  1401. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  1402. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  1403. case 0: break;
  1404. default: goto __pyx_L5_argtuple_error;
  1405. }
  1406. kw_args = PyDict_Size(__pyx_kwds);
  1407. switch (pos_args) {
  1408. case 0:
  1409. if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
  1410. else goto __pyx_L5_argtuple_error;
  1411. case 1:
  1412. if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_m)) != 0)) kw_args--;
  1413. else {
  1414. __Pyx_RaiseArgtupleInvalid("scattcoeffs", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1415. }
  1416. case 2:
  1417. if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nmax)) != 0)) kw_args--;
  1418. else {
  1419. __Pyx_RaiseArgtupleInvalid("scattcoeffs", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1420. }
  1421. case 3:
  1422. if (kw_args > 0) {
  1423. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pl);
  1424. if (value) { values[3] = value; kw_args--; }
  1425. }
  1426. }
  1427. if (unlikely(kw_args > 0)) {
  1428. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scattcoeffs") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1429. }
  1430. } else {
  1431. switch (PyTuple_GET_SIZE(__pyx_args)) {
  1432. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  1433. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  1434. values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  1435. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  1436. break;
  1437. default: goto __pyx_L5_argtuple_error;
  1438. }
  1439. }
  1440. __pyx_v_x = ((PyArrayObject *)values[0]);
  1441. __pyx_v_m = ((PyArrayObject *)values[1]);
  1442. __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 = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1443. if (values[3]) {
  1444. __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 = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1445. } else {
  1446. __pyx_v_pl = ((__pyx_t_5numpy_int_t)-1);
  1447. }
  1448. }
  1449. goto __pyx_L4_argument_unpacking_done;
  1450. __pyx_L5_argtuple_error:;
  1451. __Pyx_RaiseArgtupleInvalid("scattcoeffs", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1452. __pyx_L3_error:;
  1453. __Pyx_AddTraceback("scattnlay.scattcoeffs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  1454. __Pyx_RefNannyFinishContext();
  1455. return NULL;
  1456. __pyx_L4_argument_unpacking_done:;
  1457. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1458. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_m), __pyx_ptype_5numpy_ndarray, 1, "m", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1459. __pyx_r = __pyx_pf_9scattnlay_scattcoeffs(__pyx_self, __pyx_v_x, __pyx_v_m, __pyx_v_nmax, __pyx_v_pl);
  1460. /* function exit code */
  1461. goto __pyx_L0;
  1462. __pyx_L1_error:;
  1463. __pyx_r = NULL;
  1464. __pyx_L0:;
  1465. __Pyx_RefNannyFinishContext();
  1466. return __pyx_r;
  1467. }
  1468. static PyObject *__pyx_pf_9scattnlay_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) {
  1469. Py_ssize_t __pyx_v_i;
  1470. PyArrayObject *__pyx_v_terms = 0;
  1471. PyArrayObject *__pyx_v_an = 0;
  1472. PyArrayObject *__pyx_v_bn = 0;
  1473. PyArrayObject *__pyx_v_anr = 0;
  1474. PyArrayObject *__pyx_v_ani = 0;
  1475. PyArrayObject *__pyx_v_bnr = 0;
  1476. PyArrayObject *__pyx_v_bni = 0;
  1477. __Pyx_LocalBuf_ND __pyx_pybuffernd_an;
  1478. __Pyx_Buffer __pyx_pybuffer_an;
  1479. __Pyx_LocalBuf_ND __pyx_pybuffernd_ani;
  1480. __Pyx_Buffer __pyx_pybuffer_ani;
  1481. __Pyx_LocalBuf_ND __pyx_pybuffernd_anr;
  1482. __Pyx_Buffer __pyx_pybuffer_anr;
  1483. __Pyx_LocalBuf_ND __pyx_pybuffernd_bn;
  1484. __Pyx_Buffer __pyx_pybuffer_bn;
  1485. __Pyx_LocalBuf_ND __pyx_pybuffernd_bni;
  1486. __Pyx_Buffer __pyx_pybuffer_bni;
  1487. __Pyx_LocalBuf_ND __pyx_pybuffernd_bnr;
  1488. __Pyx_Buffer __pyx_pybuffer_bnr;
  1489. __Pyx_LocalBuf_ND __pyx_pybuffernd_m;
  1490. __Pyx_Buffer __pyx_pybuffer_m;
  1491. __Pyx_LocalBuf_ND __pyx_pybuffernd_terms;
  1492. __Pyx_Buffer __pyx_pybuffer_terms;
  1493. __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
  1494. __Pyx_Buffer __pyx_pybuffer_x;
  1495. PyObject *__pyx_r = NULL;
  1496. __Pyx_RefNannyDeclarations
  1497. PyObject *__pyx_t_1 = NULL;
  1498. PyObject *__pyx_t_2 = NULL;
  1499. PyObject *__pyx_t_3 = NULL;
  1500. PyObject *__pyx_t_4 = NULL;
  1501. PyObject *__pyx_t_5 = NULL;
  1502. PyArrayObject *__pyx_t_6 = NULL;
  1503. PyArrayObject *__pyx_t_7 = NULL;
  1504. PyArrayObject *__pyx_t_8 = NULL;
  1505. npy_intp __pyx_t_9;
  1506. Py_ssize_t __pyx_t_10;
  1507. PyArrayObject *__pyx_t_11 = NULL;
  1508. int __pyx_t_12;
  1509. PyObject *__pyx_t_13 = NULL;
  1510. PyObject *__pyx_t_14 = NULL;
  1511. PyObject *__pyx_t_15 = NULL;
  1512. PyArrayObject *__pyx_t_16 = NULL;
  1513. PyArrayObject *__pyx_t_17 = NULL;
  1514. PyArrayObject *__pyx_t_18 = NULL;
  1515. std::vector<double> __pyx_t_19;
  1516. std::vector<__pyx_t_double_complex> __pyx_t_20;
  1517. Py_ssize_t __pyx_t_21;
  1518. int __pyx_lineno = 0;
  1519. const char *__pyx_filename = NULL;
  1520. int __pyx_clineno = 0;
  1521. __Pyx_RefNannySetupContext("scattcoeffs", 0);
  1522. __pyx_pybuffer_terms.pybuffer.buf = NULL;
  1523. __pyx_pybuffer_terms.refcount = 0;
  1524. __pyx_pybuffernd_terms.data = NULL;
  1525. __pyx_pybuffernd_terms.rcbuffer = &__pyx_pybuffer_terms;
  1526. __pyx_pybuffer_an.pybuffer.buf = NULL;
  1527. __pyx_pybuffer_an.refcount = 0;
  1528. __pyx_pybuffernd_an.data = NULL;
  1529. __pyx_pybuffernd_an.rcbuffer = &__pyx_pybuffer_an;
  1530. __pyx_pybuffer_bn.pybuffer.buf = NULL;
  1531. __pyx_pybuffer_bn.refcount = 0;
  1532. __pyx_pybuffernd_bn.data = NULL;
  1533. __pyx_pybuffernd_bn.rcbuffer = &__pyx_pybuffer_bn;
  1534. __pyx_pybuffer_anr.pybuffer.buf = NULL;
  1535. __pyx_pybuffer_anr.refcount = 0;
  1536. __pyx_pybuffernd_anr.data = NULL;
  1537. __pyx_pybuffernd_anr.rcbuffer = &__pyx_pybuffer_anr;
  1538. __pyx_pybuffer_ani.pybuffer.buf = NULL;
  1539. __pyx_pybuffer_ani.refcount = 0;
  1540. __pyx_pybuffernd_ani.data = NULL;
  1541. __pyx_pybuffernd_ani.rcbuffer = &__pyx_pybuffer_ani;
  1542. __pyx_pybuffer_bnr.pybuffer.buf = NULL;
  1543. __pyx_pybuffer_bnr.refcount = 0;
  1544. __pyx_pybuffernd_bnr.data = NULL;
  1545. __pyx_pybuffernd_bnr.rcbuffer = &__pyx_pybuffer_bnr;
  1546. __pyx_pybuffer_bni.pybuffer.buf = NULL;
  1547. __pyx_pybuffer_bni.refcount = 0;
  1548. __pyx_pybuffernd_bni.data = NULL;
  1549. __pyx_pybuffernd_bni.rcbuffer = &__pyx_pybuffer_bni;
  1550. __pyx_pybuffer_x.pybuffer.buf = NULL;
  1551. __pyx_pybuffer_x.refcount = 0;
  1552. __pyx_pybuffernd_x.data = NULL;
  1553. __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
  1554. __pyx_pybuffer_m.pybuffer.buf = NULL;
  1555. __pyx_pybuffer_m.refcount = 0;
  1556. __pyx_pybuffernd_m.data = NULL;
  1557. __pyx_pybuffernd_m.rcbuffer = &__pyx_pybuffer_m;
  1558. {
  1559. __Pyx_BufFmt_StackElem __pyx_stack[1];
  1560. 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 = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1561. }
  1562. __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];
  1563. {
  1564. __Pyx_BufFmt_StackElem __pyx_stack[1];
  1565. 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 = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1566. }
  1567. __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];
  1568. /* "scattnlay.pyx":52
  1569. * cdef Py_ssize_t i
  1570. *
  1571. * cdef np.ndarray[np.int_t, ndim = 1] terms = np.zeros(x.shape[0], dtype = np.int) # <<<<<<<<<<<<<<
  1572. *
  1573. * cdef np.ndarray[np.complex128_t, ndim = 2] an = np.zeros((x.shape[0], nmax), dtype = np.complex128)
  1574. */
  1575. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1576. __Pyx_GOTREF(__pyx_t_1);
  1577. __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 = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1578. __Pyx_GOTREF(__pyx_t_2);
  1579. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1580. __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 = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1581. __Pyx_GOTREF(__pyx_t_1);
  1582. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1583. __Pyx_GOTREF(__pyx_t_3);
  1584. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  1585. __Pyx_GIVEREF(__pyx_t_1);
  1586. __pyx_t_1 = 0;
  1587. __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1588. __Pyx_GOTREF(__pyx_t_1);
  1589. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1590. __Pyx_GOTREF(__pyx_t_4);
  1591. __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 = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1592. __Pyx_GOTREF(__pyx_t_5);
  1593. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1594. if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1595. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1596. __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 = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1597. __Pyx_GOTREF(__pyx_t_5);
  1598. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1599. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1600. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1601. if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1602. __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  1603. {
  1604. __Pyx_BufFmt_StackElem __pyx_stack[1];
  1605. 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)) {
  1606. __pyx_v_terms = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_terms.rcbuffer->pybuffer.buf = NULL;
  1607. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1608. } 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];
  1609. }
  1610. }
  1611. __pyx_t_6 = 0;
  1612. __pyx_v_terms = ((PyArrayObject *)__pyx_t_5);
  1613. __pyx_t_5 = 0;
  1614. /* "scattnlay.pyx":54
  1615. * cdef np.ndarray[np.int_t, ndim = 1] terms = np.zeros(x.shape[0], dtype = np.int)
  1616. *
  1617. * cdef np.ndarray[np.complex128_t, ndim = 2] an = np.zeros((x.shape[0], nmax), dtype = np.complex128) # <<<<<<<<<<<<<<
  1618. * cdef np.ndarray[np.complex128_t, ndim = 2] bn = np.zeros((x.shape[0], nmax), dtype = np.complex128)
  1619. *
  1620. */
  1621. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1622. __Pyx_GOTREF(__pyx_t_5);
  1623. __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 = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1624. __Pyx_GOTREF(__pyx_t_1);
  1625. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1626. __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 = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1627. __Pyx_GOTREF(__pyx_t_5);
  1628. __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_nmax); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1629. __Pyx_GOTREF(__pyx_t_3);
  1630. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1631. __Pyx_GOTREF(__pyx_t_2);
  1632. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
  1633. __Pyx_GIVEREF(__pyx_t_5);
  1634. PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  1635. __Pyx_GIVEREF(__pyx_t_3);
  1636. __pyx_t_5 = 0;
  1637. __pyx_t_3 = 0;
  1638. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1639. __Pyx_GOTREF(__pyx_t_3);
  1640. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  1641. __Pyx_GIVEREF(__pyx_t_2);
  1642. __pyx_t_2 = 0;
  1643. __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1644. __Pyx_GOTREF(__pyx_t_2);
  1645. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1646. __Pyx_GOTREF(__pyx_t_5);
  1647. __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 = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1648. __Pyx_GOTREF(__pyx_t_4);
  1649. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1650. if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1651. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1652. __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 = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1653. __Pyx_GOTREF(__pyx_t_4);
  1654. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1655. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1656. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1657. if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1658. __pyx_t_7 = ((PyArrayObject *)__pyx_t_4);
  1659. {
  1660. __Pyx_BufFmt_StackElem __pyx_stack[1];
  1661. 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)) {
  1662. __pyx_v_an = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_an.rcbuffer->pybuffer.buf = NULL;
  1663. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1664. } 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];
  1665. }
  1666. }
  1667. __pyx_t_7 = 0;
  1668. __pyx_v_an = ((PyArrayObject *)__pyx_t_4);
  1669. __pyx_t_4 = 0;
  1670. /* "scattnlay.pyx":55
  1671. *
  1672. * cdef np.ndarray[np.complex128_t, ndim = 2] an = np.zeros((x.shape[0], nmax), dtype = np.complex128)
  1673. * cdef np.ndarray[np.complex128_t, ndim = 2] bn = np.zeros((x.shape[0], nmax), dtype = np.complex128) # <<<<<<<<<<<<<<
  1674. *
  1675. * cdef np.ndarray[np.float64_t, ndim = 1] anr
  1676. */
  1677. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1678. __Pyx_GOTREF(__pyx_t_4);
  1679. __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 = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1680. __Pyx_GOTREF(__pyx_t_2);
  1681. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1682. __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 = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1683. __Pyx_GOTREF(__pyx_t_4);
  1684. __pyx_t_3 = __Pyx_PyInt_From_npy_long(__pyx_v_nmax); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1685. __Pyx_GOTREF(__pyx_t_3);
  1686. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1687. __Pyx_GOTREF(__pyx_t_1);
  1688. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
  1689. __Pyx_GIVEREF(__pyx_t_4);
  1690. PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  1691. __Pyx_GIVEREF(__pyx_t_3);
  1692. __pyx_t_4 = 0;
  1693. __pyx_t_3 = 0;
  1694. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1695. __Pyx_GOTREF(__pyx_t_3);
  1696. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  1697. __Pyx_GIVEREF(__pyx_t_1);
  1698. __pyx_t_1 = 0;
  1699. __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1700. __Pyx_GOTREF(__pyx_t_1);
  1701. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1702. __Pyx_GOTREF(__pyx_t_4);
  1703. __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 = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1704. __Pyx_GOTREF(__pyx_t_5);
  1705. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1706. if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1707. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1708. __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 = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1709. __Pyx_GOTREF(__pyx_t_5);
  1710. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1711. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1712. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1713. if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1714. __pyx_t_8 = ((PyArrayObject *)__pyx_t_5);
  1715. {
  1716. __Pyx_BufFmt_StackElem __pyx_stack[1];
  1717. 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)) {
  1718. __pyx_v_bn = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_bn.rcbuffer->pybuffer.buf = NULL;
  1719. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1720. } 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];
  1721. }
  1722. }
  1723. __pyx_t_8 = 0;
  1724. __pyx_v_bn = ((PyArrayObject *)__pyx_t_5);
  1725. __pyx_t_5 = 0;
  1726. /* "scattnlay.pyx":62
  1727. * cdef np.ndarray[np.float64_t, ndim = 1] bni
  1728. *
  1729. * for i in range(x.shape[0]): # <<<<<<<<<<<<<<
  1730. * anr = np.zeros(nmax, dtype = np.float64)
  1731. * ani = np.zeros(nmax, dtype = np.float64)
  1732. */
  1733. __pyx_t_9 = (__pyx_v_x->dimensions[0]);
  1734. for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
  1735. __pyx_v_i = __pyx_t_10;
  1736. /* "scattnlay.pyx":63
  1737. *
  1738. * for i in range(x.shape[0]):
  1739. * anr = np.zeros(nmax, dtype = np.float64) # <<<<<<<<<<<<<<
  1740. * ani = np.zeros(nmax, dtype = np.float64)
  1741. * bnr = np.zeros(nmax, dtype = np.float64)
  1742. */
  1743. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1744. __Pyx_GOTREF(__pyx_t_5);
  1745. __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 = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1746. __Pyx_GOTREF(__pyx_t_1);
  1747. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1748. __pyx_t_5 = __Pyx_PyInt_From_npy_long(__pyx_v_nmax); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1749. __Pyx_GOTREF(__pyx_t_5);
  1750. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1751. __Pyx_GOTREF(__pyx_t_3);
  1752. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  1753. __Pyx_GIVEREF(__pyx_t_5);
  1754. __pyx_t_5 = 0;
  1755. __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1756. __Pyx_GOTREF(__pyx_t_5);
  1757. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1758. __Pyx_GOTREF(__pyx_t_2);
  1759. __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 = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1760. __Pyx_GOTREF(__pyx_t_4);
  1761. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1762. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1763. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1764. __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 = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1765. __Pyx_GOTREF(__pyx_t_4);
  1766. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1767. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1768. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1769. if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1770. __pyx_t_11 = ((PyArrayObject *)__pyx_t_4);
  1771. {
  1772. __Pyx_BufFmt_StackElem __pyx_stack[1];
  1773. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_anr.rcbuffer->pybuffer);
  1774. __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);
  1775. if (unlikely(__pyx_t_12 < 0)) {
  1776. PyErr_Fetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
  1777. 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)) {
  1778. Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15);
  1779. __Pyx_RaiseBufferFallbackError();
  1780. } else {
  1781. PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
  1782. }
  1783. }
  1784. __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];
  1785. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1786. }
  1787. __pyx_t_11 = 0;
  1788. __Pyx_XDECREF_SET(__pyx_v_anr, ((PyArrayObject *)__pyx_t_4));
  1789. __pyx_t_4 = 0;
  1790. /* "scattnlay.pyx":64
  1791. * for i in range(x.shape[0]):
  1792. * anr = np.zeros(nmax, dtype = np.float64)
  1793. * ani = np.zeros(nmax, dtype = np.float64) # <<<<<<<<<<<<<<
  1794. * bnr = np.zeros(nmax, dtype = np.float64)
  1795. * bni = np.zeros(nmax, dtype = np.float64)
  1796. */
  1797. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1798. __Pyx_GOTREF(__pyx_t_4);
  1799. __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 = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1800. __Pyx_GOTREF(__pyx_t_5);
  1801. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1802. __pyx_t_4 = __Pyx_PyInt_From_npy_long(__pyx_v_nmax); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1803. __Pyx_GOTREF(__pyx_t_4);
  1804. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1805. __Pyx_GOTREF(__pyx_t_3);
  1806. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  1807. __Pyx_GIVEREF(__pyx_t_4);
  1808. __pyx_t_4 = 0;
  1809. __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1810. __Pyx_GOTREF(__pyx_t_4);
  1811. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1812. __Pyx_GOTREF(__pyx_t_1);
  1813. __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 = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1814. __Pyx_GOTREF(__pyx_t_2);
  1815. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1816. if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1817. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1818. __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 = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1819. __Pyx_GOTREF(__pyx_t_2);
  1820. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1821. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1822. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1823. if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1824. __pyx_t_16 = ((PyArrayObject *)__pyx_t_2);
  1825. {
  1826. __Pyx_BufFmt_StackElem __pyx_stack[1];
  1827. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ani.rcbuffer->pybuffer);
  1828. __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);
  1829. if (unlikely(__pyx_t_12 < 0)) {
  1830. PyErr_Fetch(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
  1831. 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)) {
  1832. Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13);
  1833. __Pyx_RaiseBufferFallbackError();
  1834. } else {
  1835. PyErr_Restore(__pyx_t_15, __pyx_t_14, __pyx_t_13);
  1836. }
  1837. }
  1838. __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];
  1839. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1840. }
  1841. __pyx_t_16 = 0;
  1842. __Pyx_XDECREF_SET(__pyx_v_ani, ((PyArrayObject *)__pyx_t_2));
  1843. __pyx_t_2 = 0;
  1844. /* "scattnlay.pyx":65
  1845. * anr = np.zeros(nmax, dtype = np.float64)
  1846. * ani = np.zeros(nmax, dtype = np.float64)
  1847. * bnr = np.zeros(nmax, dtype = np.float64) # <<<<<<<<<<<<<<
  1848. * bni = np.zeros(nmax, dtype = np.float64)
  1849. *
  1850. */
  1851. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1852. __Pyx_GOTREF(__pyx_t_2);
  1853. __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 = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1854. __Pyx_GOTREF(__pyx_t_4);
  1855. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1856. __pyx_t_2 = __Pyx_PyInt_From_npy_long(__pyx_v_nmax); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1857. __Pyx_GOTREF(__pyx_t_2);
  1858. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1859. __Pyx_GOTREF(__pyx_t_3);
  1860. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  1861. __Pyx_GIVEREF(__pyx_t_2);
  1862. __pyx_t_2 = 0;
  1863. __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1864. __Pyx_GOTREF(__pyx_t_2);
  1865. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1866. __Pyx_GOTREF(__pyx_t_5);
  1867. __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 = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1868. __Pyx_GOTREF(__pyx_t_1);
  1869. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1870. if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1871. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1872. __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 = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1873. __Pyx_GOTREF(__pyx_t_1);
  1874. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1875. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1876. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1877. if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1878. __pyx_t_17 = ((PyArrayObject *)__pyx_t_1);
  1879. {
  1880. __Pyx_BufFmt_StackElem __pyx_stack[1];
  1881. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bnr.rcbuffer->pybuffer);
  1882. __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);
  1883. if (unlikely(__pyx_t_12 < 0)) {
  1884. PyErr_Fetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
  1885. 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)) {
  1886. Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15);
  1887. __Pyx_RaiseBufferFallbackError();
  1888. } else {
  1889. PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
  1890. }
  1891. }
  1892. __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];
  1893. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1894. }
  1895. __pyx_t_17 = 0;
  1896. __Pyx_XDECREF_SET(__pyx_v_bnr, ((PyArrayObject *)__pyx_t_1));
  1897. __pyx_t_1 = 0;
  1898. /* "scattnlay.pyx":66
  1899. * ani = np.zeros(nmax, dtype = np.float64)
  1900. * bnr = np.zeros(nmax, dtype = np.float64)
  1901. * bni = np.zeros(nmax, dtype = np.float64) # <<<<<<<<<<<<<<
  1902. *
  1903. * terms[i] = ScattCoeffs(x.shape[1], pl, x[i].copy('C'), m[i].copy('C'), nmax, npy2c(anr), npy2c(ani), npy2c(bnr), npy2c(bni))
  1904. */
  1905. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1906. __Pyx_GOTREF(__pyx_t_1);
  1907. __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 = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1908. __Pyx_GOTREF(__pyx_t_2);
  1909. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1910. __pyx_t_1 = __Pyx_PyInt_From_npy_long(__pyx_v_nmax); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1911. __Pyx_GOTREF(__pyx_t_1);
  1912. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1913. __Pyx_GOTREF(__pyx_t_3);
  1914. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  1915. __Pyx_GIVEREF(__pyx_t_1);
  1916. __pyx_t_1 = 0;
  1917. __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1918. __Pyx_GOTREF(__pyx_t_1);
  1919. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1920. __Pyx_GOTREF(__pyx_t_4);
  1921. __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 = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1922. __Pyx_GOTREF(__pyx_t_5);
  1923. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  1924. if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1925. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1926. __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 = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1927. __Pyx_GOTREF(__pyx_t_5);
  1928. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1929. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1930. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1931. if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1932. __pyx_t_18 = ((PyArrayObject *)__pyx_t_5);
  1933. {
  1934. __Pyx_BufFmt_StackElem __pyx_stack[1];
  1935. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bni.rcbuffer->pybuffer);
  1936. __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);
  1937. if (unlikely(__pyx_t_12 < 0)) {
  1938. PyErr_Fetch(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
  1939. 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)) {
  1940. Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13);
  1941. __Pyx_RaiseBufferFallbackError();
  1942. } else {
  1943. PyErr_Restore(__pyx_t_15, __pyx_t_14, __pyx_t_13);
  1944. }
  1945. }
  1946. __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];
  1947. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1948. }
  1949. __pyx_t_18 = 0;
  1950. __Pyx_XDECREF_SET(__pyx_v_bni, ((PyArrayObject *)__pyx_t_5));
  1951. __pyx_t_5 = 0;
  1952. /* "scattnlay.pyx":68
  1953. * bni = np.zeros(nmax, dtype = np.float64)
  1954. *
  1955. * terms[i] = ScattCoeffs(x.shape[1], pl, x[i].copy('C'), m[i].copy('C'), nmax, npy2c(anr), npy2c(ani), npy2c(bnr), npy2c(bni)) # <<<<<<<<<<<<<<
  1956. *
  1957. * an[i] = anr.copy('C') + 1.0j*ani.copy('C')
  1958. */
  1959. __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 = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  1960. __Pyx_GOTREF(__pyx_t_5);
  1961. __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 = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1962. __Pyx_GOTREF(__pyx_t_1);
  1963. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1964. __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 = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1965. __Pyx_GOTREF(__pyx_t_5);
  1966. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1967. __pyx_t_19 = __pyx_convert_vector_from_py_double(__pyx_t_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1968. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1969. __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 = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  1970. __Pyx_GOTREF(__pyx_t_5);
  1971. __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 = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1972. __Pyx_GOTREF(__pyx_t_1);
  1973. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1974. __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 = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1975. __Pyx_GOTREF(__pyx_t_5);
  1976. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1977. __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 = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1978. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  1979. __pyx_t_21 = __pyx_v_i;
  1980. __pyx_t_12 = -1;
  1981. if (__pyx_t_21 < 0) {
  1982. __pyx_t_21 += __pyx_pybuffernd_terms.diminfo[0].shape;
  1983. if (unlikely(__pyx_t_21 < 0)) __pyx_t_12 = 0;
  1984. } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_terms.diminfo[0].shape)) __pyx_t_12 = 0;
  1985. if (unlikely(__pyx_t_12 != -1)) {
  1986. __Pyx_RaiseBufferIndexError(__pyx_t_12);
  1987. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1988. }
  1989. *__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_9scattnlay_npy2c(((PyArrayObject *)__pyx_v_anr)), __pyx_f_9scattnlay_npy2c(((PyArrayObject *)__pyx_v_ani)), __pyx_f_9scattnlay_npy2c(((PyArrayObject *)__pyx_v_bnr)), __pyx_f_9scattnlay_npy2c(((PyArrayObject *)__pyx_v_bni)));
  1990. /* "scattnlay.pyx":70
  1991. * terms[i] = ScattCoeffs(x.shape[1], pl, x[i].copy('C'), m[i].copy('C'), nmax, npy2c(anr), npy2c(ani), npy2c(bnr), npy2c(bni))
  1992. *
  1993. * an[i] = anr.copy('C') + 1.0j*ani.copy('C') # <<<<<<<<<<<<<<
  1994. * bn[i] = bnr.copy('C') + 1.0j*bni.copy('C')
  1995. *
  1996. */
  1997. __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 = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1998. __Pyx_GOTREF(__pyx_t_5);
  1999. __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 = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2000. __Pyx_GOTREF(__pyx_t_1);
  2001. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2002. __pyx_t_5 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2003. __Pyx_GOTREF(__pyx_t_5);
  2004. __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 = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2005. __Pyx_GOTREF(__pyx_t_3);
  2006. __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 = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2007. __Pyx_GOTREF(__pyx_t_2);
  2008. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2009. __pyx_t_3 = PyNumber_Multiply(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2010. __Pyx_GOTREF(__pyx_t_3);
  2011. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2012. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2013. __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2014. __Pyx_GOTREF(__pyx_t_2);
  2015. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2016. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2017. 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 = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2018. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2019. /* "scattnlay.pyx":71
  2020. *
  2021. * an[i] = anr.copy('C') + 1.0j*ani.copy('C')
  2022. * bn[i] = bnr.copy('C') + 1.0j*bni.copy('C') # <<<<<<<<<<<<<<
  2023. *
  2024. * return terms, an, bn
  2025. */
  2026. __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 = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2027. __Pyx_GOTREF(__pyx_t_2);
  2028. __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 = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2029. __Pyx_GOTREF(__pyx_t_3);
  2030. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2031. __pyx_t_2 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2032. __Pyx_GOTREF(__pyx_t_2);
  2033. __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 = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2034. __Pyx_GOTREF(__pyx_t_1);
  2035. __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 = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2036. __Pyx_GOTREF(__pyx_t_5);
  2037. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2038. __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2039. __Pyx_GOTREF(__pyx_t_1);
  2040. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2041. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2042. __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2043. __Pyx_GOTREF(__pyx_t_5);
  2044. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2045. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2046. 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 = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2047. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2048. }
  2049. /* "scattnlay.pyx":73
  2050. * bn[i] = bnr.copy('C') + 1.0j*bni.copy('C')
  2051. *
  2052. * return terms, an, bn # <<<<<<<<<<<<<<
  2053. *
  2054. * 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):
  2055. */
  2056. __Pyx_XDECREF(__pyx_r);
  2057. __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2058. __Pyx_GOTREF(__pyx_t_5);
  2059. __Pyx_INCREF(((PyObject *)__pyx_v_terms));
  2060. PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_terms));
  2061. __Pyx_GIVEREF(((PyObject *)__pyx_v_terms));
  2062. __Pyx_INCREF(((PyObject *)__pyx_v_an));
  2063. PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_an));
  2064. __Pyx_GIVEREF(((PyObject *)__pyx_v_an));
  2065. __Pyx_INCREF(((PyObject *)__pyx_v_bn));
  2066. PyTuple_SET_ITEM(__pyx_t_5, 2, ((PyObject *)__pyx_v_bn));
  2067. __Pyx_GIVEREF(((PyObject *)__pyx_v_bn));
  2068. __pyx_r = __pyx_t_5;
  2069. __pyx_t_5 = 0;
  2070. goto __pyx_L0;
  2071. /* "scattnlay.pyx":49
  2072. * 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[])
  2073. *
  2074. * 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): # <<<<<<<<<<<<<<
  2075. * cdef Py_ssize_t i
  2076. *
  2077. */
  2078. /* function exit code */
  2079. __pyx_L1_error:;
  2080. __Pyx_XDECREF(__pyx_t_1);
  2081. __Pyx_XDECREF(__pyx_t_2);
  2082. __Pyx_XDECREF(__pyx_t_3);
  2083. __Pyx_XDECREF(__pyx_t_4);
  2084. __Pyx_XDECREF(__pyx_t_5);
  2085. { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
  2086. __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
  2087. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_an.rcbuffer->pybuffer);
  2088. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ani.rcbuffer->pybuffer);
  2089. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_anr.rcbuffer->pybuffer);
  2090. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bn.rcbuffer->pybuffer);
  2091. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bni.rcbuffer->pybuffer);
  2092. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bnr.rcbuffer->pybuffer);
  2093. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_m.rcbuffer->pybuffer);
  2094. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_terms.rcbuffer->pybuffer);
  2095. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
  2096. __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  2097. __Pyx_AddTraceback("scattnlay.scattcoeffs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2098. __pyx_r = NULL;
  2099. goto __pyx_L2;
  2100. __pyx_L0:;
  2101. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_an.rcbuffer->pybuffer);
  2102. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ani.rcbuffer->pybuffer);
  2103. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_anr.rcbuffer->pybuffer);
  2104. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bn.rcbuffer->pybuffer);
  2105. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bni.rcbuffer->pybuffer);
  2106. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bnr.rcbuffer->pybuffer);
  2107. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_m.rcbuffer->pybuffer);
  2108. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_terms.rcbuffer->pybuffer);
  2109. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
  2110. __pyx_L2:;
  2111. __Pyx_XDECREF((PyObject *)__pyx_v_terms);
  2112. __Pyx_XDECREF((PyObject *)__pyx_v_an);
  2113. __Pyx_XDECREF((PyObject *)__pyx_v_bn);
  2114. __Pyx_XDECREF((PyObject *)__pyx_v_anr);
  2115. __Pyx_XDECREF((PyObject *)__pyx_v_ani);
  2116. __Pyx_XDECREF((PyObject *)__pyx_v_bnr);
  2117. __Pyx_XDECREF((PyObject *)__pyx_v_bni);
  2118. __Pyx_XGIVEREF(__pyx_r);
  2119. __Pyx_RefNannyFinishContext();
  2120. return __pyx_r;
  2121. }
  2122. /* "scattnlay.pyx":75
  2123. * return terms, an, bn
  2124. *
  2125. * 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): # <<<<<<<<<<<<<<
  2126. * cdef Py_ssize_t i
  2127. *
  2128. */
  2129. /* Python wrapper */
  2130. static PyObject *__pyx_pw_9scattnlay_3scattnlay(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  2131. static PyMethodDef __pyx_mdef_9scattnlay_3scattnlay = {"scattnlay", (PyCFunction)__pyx_pw_9scattnlay_3scattnlay, METH_VARARGS|METH_KEYWORDS, 0};
  2132. static PyObject *__pyx_pw_9scattnlay_3scattnlay(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  2133. PyArrayObject *__pyx_v_x = 0;
  2134. PyArrayObject *__pyx_v_m = 0;
  2135. PyArrayObject *__pyx_v_theta = 0;
  2136. __pyx_t_5numpy_int_t __pyx_v_nmax;
  2137. __pyx_t_5numpy_int_t __pyx_v_pl;
  2138. int __pyx_lineno = 0;
  2139. const char *__pyx_filename = NULL;
  2140. int __pyx_clineno = 0;
  2141. PyObject *__pyx_r = 0;
  2142. __Pyx_RefNannyDeclarations
  2143. __Pyx_RefNannySetupContext("scattnlay (wrapper)", 0);
  2144. {
  2145. 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};
  2146. PyObject* values[5] = {0,0,0,0,0};
  2147. values[2] = (PyObject *)__pyx_k__8;
  2148. if (unlikely(__pyx_kwds)) {
  2149. Py_ssize_t kw_args;
  2150. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  2151. switch (pos_args) {
  2152. case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
  2153. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  2154. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  2155. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  2156. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  2157. case 0: break;
  2158. default: goto __pyx_L5_argtuple_error;
  2159. }
  2160. kw_args = PyDict_Size(__pyx_kwds);
  2161. switch (pos_args) {
  2162. case 0:
  2163. if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
  2164. else goto __pyx_L5_argtuple_error;
  2165. case 1:
  2166. if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_m)) != 0)) kw_args--;
  2167. else {
  2168. __Pyx_RaiseArgtupleInvalid("scattnlay", 0, 2, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2169. }
  2170. case 2:
  2171. if (kw_args > 0) {
  2172. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_theta);
  2173. if (value) { values[2] = value; kw_args--; }
  2174. }
  2175. case 3:
  2176. if (kw_args > 0) {
  2177. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nmax);
  2178. if (value) { values[3] = value; kw_args--; }
  2179. }
  2180. case 4:
  2181. if (kw_args > 0) {
  2182. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pl);
  2183. if (value) { values[4] = value; kw_args--; }
  2184. }
  2185. }
  2186. if (unlikely(kw_args > 0)) {
  2187. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scattnlay") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2188. }
  2189. } else {
  2190. switch (PyTuple_GET_SIZE(__pyx_args)) {
  2191. case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
  2192. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  2193. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  2194. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  2195. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  2196. break;
  2197. default: goto __pyx_L5_argtuple_error;
  2198. }
  2199. }
  2200. __pyx_v_x = ((PyArrayObject *)values[0]);
  2201. __pyx_v_m = ((PyArrayObject *)values[1]);
  2202. __pyx_v_theta = ((PyArrayObject *)values[2]);
  2203. if (values[3]) {
  2204. __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 = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2205. } else {
  2206. __pyx_v_nmax = ((__pyx_t_5numpy_int_t)-1);
  2207. }
  2208. if (values[4]) {
  2209. __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 = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2210. } else {
  2211. __pyx_v_pl = ((__pyx_t_5numpy_int_t)-1);
  2212. }
  2213. }
  2214. goto __pyx_L4_argument_unpacking_done;
  2215. __pyx_L5_argtuple_error:;
  2216. __Pyx_RaiseArgtupleInvalid("scattnlay", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2217. __pyx_L3_error:;
  2218. __Pyx_AddTraceback("scattnlay.scattnlay", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2219. __Pyx_RefNannyFinishContext();
  2220. return NULL;
  2221. __pyx_L4_argument_unpacking_done:;
  2222. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2223. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_m), __pyx_ptype_5numpy_ndarray, 1, "m", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2224. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_theta), __pyx_ptype_5numpy_ndarray, 1, "theta", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2225. __pyx_r = __pyx_pf_9scattnlay_2scattnlay(__pyx_self, __pyx_v_x, __pyx_v_m, __pyx_v_theta, __pyx_v_nmax, __pyx_v_pl);
  2226. /* function exit code */
  2227. goto __pyx_L0;
  2228. __pyx_L1_error:;
  2229. __pyx_r = NULL;
  2230. __pyx_L0:;
  2231. __Pyx_RefNannyFinishContext();
  2232. return __pyx_r;
  2233. }
  2234. static PyObject *__pyx_pf_9scattnlay_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) {
  2235. Py_ssize_t __pyx_v_i;
  2236. PyArrayObject *__pyx_v_terms = 0;
  2237. PyArrayObject *__pyx_v_Qext = 0;
  2238. PyArrayObject *__pyx_v_Qabs = 0;
  2239. PyArrayObject *__pyx_v_Qsca = 0;
  2240. PyArrayObject *__pyx_v_Qbk = 0;
  2241. PyArrayObject *__pyx_v_Qpr = 0;
  2242. PyArrayObject *__pyx_v_g = 0;
  2243. PyArrayObject *__pyx_v_Albedo = 0;
  2244. PyArrayObject *__pyx_v_S1 = 0;
  2245. PyArrayObject *__pyx_v_S2 = 0;
  2246. PyArrayObject *__pyx_v_S1r = 0;
  2247. PyArrayObject *__pyx_v_S1i = 0;
  2248. PyArrayObject *__pyx_v_S2r = 0;
  2249. PyArrayObject *__pyx_v_S2i = 0;
  2250. __Pyx_LocalBuf_ND __pyx_pybuffernd_Albedo;
  2251. __Pyx_Buffer __pyx_pybuffer_Albedo;
  2252. __Pyx_LocalBuf_ND __pyx_pybuffernd_Qabs;
  2253. __Pyx_Buffer __pyx_pybuffer_Qabs;
  2254. __Pyx_LocalBuf_ND __pyx_pybuffernd_Qbk;
  2255. __Pyx_Buffer __pyx_pybuffer_Qbk;
  2256. __Pyx_LocalBuf_ND __pyx_pybuffernd_Qext;
  2257. __Pyx_Buffer __pyx_pybuffer_Qext;
  2258. __Pyx_LocalBuf_ND __pyx_pybuffernd_Qpr;
  2259. __Pyx_Buffer __pyx_pybuffer_Qpr;
  2260. __Pyx_LocalBuf_ND __pyx_pybuffernd_Qsca;
  2261. __Pyx_Buffer __pyx_pybuffer_Qsca;
  2262. __Pyx_LocalBuf_ND __pyx_pybuffernd_S1;
  2263. __Pyx_Buffer __pyx_pybuffer_S1;
  2264. __Pyx_LocalBuf_ND __pyx_pybuffernd_S1i;
  2265. __Pyx_Buffer __pyx_pybuffer_S1i;
  2266. __Pyx_LocalBuf_ND __pyx_pybuffernd_S1r;
  2267. __Pyx_Buffer __pyx_pybuffer_S1r;
  2268. __Pyx_LocalBuf_ND __pyx_pybuffernd_S2;
  2269. __Pyx_Buffer __pyx_pybuffer_S2;
  2270. __Pyx_LocalBuf_ND __pyx_pybuffernd_S2i;
  2271. __Pyx_Buffer __pyx_pybuffer_S2i;
  2272. __Pyx_LocalBuf_ND __pyx_pybuffernd_S2r;
  2273. __Pyx_Buffer __pyx_pybuffer_S2r;
  2274. __Pyx_LocalBuf_ND __pyx_pybuffernd_g;
  2275. __Pyx_Buffer __pyx_pybuffer_g;
  2276. __Pyx_LocalBuf_ND __pyx_pybuffernd_m;
  2277. __Pyx_Buffer __pyx_pybuffer_m;
  2278. __Pyx_LocalBuf_ND __pyx_pybuffernd_terms;
  2279. __Pyx_Buffer __pyx_pybuffer_terms;
  2280. __Pyx_LocalBuf_ND __pyx_pybuffernd_theta;
  2281. __Pyx_Buffer __pyx_pybuffer_theta;
  2282. __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
  2283. __Pyx_Buffer __pyx_pybuffer_x;
  2284. PyObject *__pyx_r = NULL;
  2285. __Pyx_RefNannyDeclarations
  2286. PyObject *__pyx_t_1 = NULL;
  2287. PyObject *__pyx_t_2 = NULL;
  2288. PyObject *__pyx_t_3 = NULL;
  2289. PyObject *__pyx_t_4 = NULL;
  2290. PyObject *__pyx_t_5 = NULL;
  2291. PyArrayObject *__pyx_t_6 = NULL;
  2292. PyArrayObject *__pyx_t_7 = NULL;
  2293. PyArrayObject *__pyx_t_8 = NULL;
  2294. PyArrayObject *__pyx_t_9 = NULL;
  2295. PyArrayObject *__pyx_t_10 = NULL;
  2296. PyArrayObject *__pyx_t_11 = NULL;
  2297. PyArrayObject *__pyx_t_12 = NULL;
  2298. PyArrayObject *__pyx_t_13 = NULL;
  2299. PyArrayObject *__pyx_t_14 = NULL;
  2300. PyArrayObject *__pyx_t_15 = NULL;
  2301. npy_intp __pyx_t_16;
  2302. Py_ssize_t __pyx_t_17;
  2303. PyArrayObject *__pyx_t_18 = NULL;
  2304. int __pyx_t_19;
  2305. PyObject *__pyx_t_20 = NULL;
  2306. PyObject *__pyx_t_21 = NULL;
  2307. PyObject *__pyx_t_22 = NULL;
  2308. PyArrayObject *__pyx_t_23 = NULL;
  2309. PyArrayObject *__pyx_t_24 = NULL;
  2310. PyArrayObject *__pyx_t_25 = NULL;
  2311. std::vector<double> __pyx_t_26;
  2312. std::vector<__pyx_t_double_complex> __pyx_t_27;
  2313. std::vector<double> __pyx_t_28;
  2314. Py_ssize_t __pyx_t_29;
  2315. Py_ssize_t __pyx_t_30;
  2316. Py_ssize_t __pyx_t_31;
  2317. Py_ssize_t __pyx_t_32;
  2318. Py_ssize_t __pyx_t_33;
  2319. Py_ssize_t __pyx_t_34;
  2320. Py_ssize_t __pyx_t_35;
  2321. Py_ssize_t __pyx_t_36;
  2322. int __pyx_lineno = 0;
  2323. const char *__pyx_filename = NULL;
  2324. int __pyx_clineno = 0;
  2325. __Pyx_RefNannySetupContext("scattnlay", 0);
  2326. __pyx_pybuffer_terms.pybuffer.buf = NULL;
  2327. __pyx_pybuffer_terms.refcount = 0;
  2328. __pyx_pybuffernd_terms.data = NULL;
  2329. __pyx_pybuffernd_terms.rcbuffer = &__pyx_pybuffer_terms;
  2330. __pyx_pybuffer_Qext.pybuffer.buf = NULL;
  2331. __pyx_pybuffer_Qext.refcount = 0;
  2332. __pyx_pybuffernd_Qext.data = NULL;
  2333. __pyx_pybuffernd_Qext.rcbuffer = &__pyx_pybuffer_Qext;
  2334. __pyx_pybuffer_Qabs.pybuffer.buf = NULL;
  2335. __pyx_pybuffer_Qabs.refcount = 0;
  2336. __pyx_pybuffernd_Qabs.data = NULL;
  2337. __pyx_pybuffernd_Qabs.rcbuffer = &__pyx_pybuffer_Qabs;
  2338. __pyx_pybuffer_Qsca.pybuffer.buf = NULL;
  2339. __pyx_pybuffer_Qsca.refcount = 0;
  2340. __pyx_pybuffernd_Qsca.data = NULL;
  2341. __pyx_pybuffernd_Qsca.rcbuffer = &__pyx_pybuffer_Qsca;
  2342. __pyx_pybuffer_Qbk.pybuffer.buf = NULL;
  2343. __pyx_pybuffer_Qbk.refcount = 0;
  2344. __pyx_pybuffernd_Qbk.data = NULL;
  2345. __pyx_pybuffernd_Qbk.rcbuffer = &__pyx_pybuffer_Qbk;
  2346. __pyx_pybuffer_Qpr.pybuffer.buf = NULL;
  2347. __pyx_pybuffer_Qpr.refcount = 0;
  2348. __pyx_pybuffernd_Qpr.data = NULL;
  2349. __pyx_pybuffernd_Qpr.rcbuffer = &__pyx_pybuffer_Qpr;
  2350. __pyx_pybuffer_g.pybuffer.buf = NULL;
  2351. __pyx_pybuffer_g.refcount = 0;
  2352. __pyx_pybuffernd_g.data = NULL;
  2353. __pyx_pybuffernd_g.rcbuffer = &__pyx_pybuffer_g;
  2354. __pyx_pybuffer_Albedo.pybuffer.buf = NULL;
  2355. __pyx_pybuffer_Albedo.refcount = 0;
  2356. __pyx_pybuffernd_Albedo.data = NULL;
  2357. __pyx_pybuffernd_Albedo.rcbuffer = &__pyx_pybuffer_Albedo;
  2358. __pyx_pybuffer_S1.pybuffer.buf = NULL;
  2359. __pyx_pybuffer_S1.refcount = 0;
  2360. __pyx_pybuffernd_S1.data = NULL;
  2361. __pyx_pybuffernd_S1.rcbuffer = &__pyx_pybuffer_S1;
  2362. __pyx_pybuffer_S2.pybuffer.buf = NULL;
  2363. __pyx_pybuffer_S2.refcount = 0;
  2364. __pyx_pybuffernd_S2.data = NULL;
  2365. __pyx_pybuffernd_S2.rcbuffer = &__pyx_pybuffer_S2;
  2366. __pyx_pybuffer_S1r.pybuffer.buf = NULL;
  2367. __pyx_pybuffer_S1r.refcount = 0;
  2368. __pyx_pybuffernd_S1r.data = NULL;
  2369. __pyx_pybuffernd_S1r.rcbuffer = &__pyx_pybuffer_S1r;
  2370. __pyx_pybuffer_S1i.pybuffer.buf = NULL;
  2371. __pyx_pybuffer_S1i.refcount = 0;
  2372. __pyx_pybuffernd_S1i.data = NULL;
  2373. __pyx_pybuffernd_S1i.rcbuffer = &__pyx_pybuffer_S1i;
  2374. __pyx_pybuffer_S2r.pybuffer.buf = NULL;
  2375. __pyx_pybuffer_S2r.refcount = 0;
  2376. __pyx_pybuffernd_S2r.data = NULL;
  2377. __pyx_pybuffernd_S2r.rcbuffer = &__pyx_pybuffer_S2r;
  2378. __pyx_pybuffer_S2i.pybuffer.buf = NULL;
  2379. __pyx_pybuffer_S2i.refcount = 0;
  2380. __pyx_pybuffernd_S2i.data = NULL;
  2381. __pyx_pybuffernd_S2i.rcbuffer = &__pyx_pybuffer_S2i;
  2382. __pyx_pybuffer_x.pybuffer.buf = NULL;
  2383. __pyx_pybuffer_x.refcount = 0;
  2384. __pyx_pybuffernd_x.data = NULL;
  2385. __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
  2386. __pyx_pybuffer_m.pybuffer.buf = NULL;
  2387. __pyx_pybuffer_m.refcount = 0;
  2388. __pyx_pybuffernd_m.data = NULL;
  2389. __pyx_pybuffernd_m.rcbuffer = &__pyx_pybuffer_m;
  2390. __pyx_pybuffer_theta.pybuffer.buf = NULL;
  2391. __pyx_pybuffer_theta.refcount = 0;
  2392. __pyx_pybuffernd_theta.data = NULL;
  2393. __pyx_pybuffernd_theta.rcbuffer = &__pyx_pybuffer_theta;
  2394. {
  2395. __Pyx_BufFmt_StackElem __pyx_stack[1];
  2396. 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 = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2397. }
  2398. __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];
  2399. {
  2400. __Pyx_BufFmt_StackElem __pyx_stack[1];
  2401. 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 = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2402. }
  2403. __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];
  2404. {
  2405. __Pyx_BufFmt_StackElem __pyx_stack[1];
  2406. 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 = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2407. }
  2408. __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];
  2409. /* "scattnlay.pyx":78
  2410. * cdef Py_ssize_t i
  2411. *
  2412. * cdef np.ndarray[np.int_t, ndim = 1] terms = np.zeros(x.shape[0], dtype = np.int) # <<<<<<<<<<<<<<
  2413. *
  2414. * cdef np.ndarray[np.float64_t, ndim = 1] Qext = np.zeros(x.shape[0], dtype = np.float64)
  2415. */
  2416. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2417. __Pyx_GOTREF(__pyx_t_1);
  2418. __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 = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2419. __Pyx_GOTREF(__pyx_t_2);
  2420. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2421. __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 = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2422. __Pyx_GOTREF(__pyx_t_1);
  2423. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2424. __Pyx_GOTREF(__pyx_t_3);
  2425. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  2426. __Pyx_GIVEREF(__pyx_t_1);
  2427. __pyx_t_1 = 0;
  2428. __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2429. __Pyx_GOTREF(__pyx_t_1);
  2430. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2431. __Pyx_GOTREF(__pyx_t_4);
  2432. __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 = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2433. __Pyx_GOTREF(__pyx_t_5);
  2434. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2435. if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2436. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2437. __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 = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2438. __Pyx_GOTREF(__pyx_t_5);
  2439. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2440. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2441. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2442. if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2443. __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  2444. {
  2445. __Pyx_BufFmt_StackElem __pyx_stack[1];
  2446. 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)) {
  2447. __pyx_v_terms = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_terms.rcbuffer->pybuffer.buf = NULL;
  2448. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2449. } 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];
  2450. }
  2451. }
  2452. __pyx_t_6 = 0;
  2453. __pyx_v_terms = ((PyArrayObject *)__pyx_t_5);
  2454. __pyx_t_5 = 0;
  2455. /* "scattnlay.pyx":80
  2456. * cdef np.ndarray[np.int_t, ndim = 1] terms = np.zeros(x.shape[0], dtype = np.int)
  2457. *
  2458. * cdef np.ndarray[np.float64_t, ndim = 1] Qext = np.zeros(x.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  2459. * cdef np.ndarray[np.float64_t, ndim = 1] Qabs = np.zeros(x.shape[0], dtype = np.float64)
  2460. * cdef np.ndarray[np.float64_t, ndim = 1] Qsca = np.zeros(x.shape[0], dtype = np.float64)
  2461. */
  2462. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2463. __Pyx_GOTREF(__pyx_t_5);
  2464. __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 = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2465. __Pyx_GOTREF(__pyx_t_1);
  2466. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2467. __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 = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2468. __Pyx_GOTREF(__pyx_t_5);
  2469. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2470. __Pyx_GOTREF(__pyx_t_3);
  2471. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  2472. __Pyx_GIVEREF(__pyx_t_5);
  2473. __pyx_t_5 = 0;
  2474. __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2475. __Pyx_GOTREF(__pyx_t_5);
  2476. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2477. __Pyx_GOTREF(__pyx_t_2);
  2478. __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 = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2479. __Pyx_GOTREF(__pyx_t_4);
  2480. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2481. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2482. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2483. __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 = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2484. __Pyx_GOTREF(__pyx_t_4);
  2485. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2486. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2487. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2488. if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2489. __pyx_t_7 = ((PyArrayObject *)__pyx_t_4);
  2490. {
  2491. __Pyx_BufFmt_StackElem __pyx_stack[1];
  2492. 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)) {
  2493. __pyx_v_Qext = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_Qext.rcbuffer->pybuffer.buf = NULL;
  2494. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2495. } 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];
  2496. }
  2497. }
  2498. __pyx_t_7 = 0;
  2499. __pyx_v_Qext = ((PyArrayObject *)__pyx_t_4);
  2500. __pyx_t_4 = 0;
  2501. /* "scattnlay.pyx":81
  2502. *
  2503. * cdef np.ndarray[np.float64_t, ndim = 1] Qext = np.zeros(x.shape[0], dtype = np.float64)
  2504. * cdef np.ndarray[np.float64_t, ndim = 1] Qabs = np.zeros(x.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  2505. * cdef np.ndarray[np.float64_t, ndim = 1] Qsca = np.zeros(x.shape[0], dtype = np.float64)
  2506. * cdef np.ndarray[np.float64_t, ndim = 1] Qbk = np.zeros(x.shape[0], dtype = np.float64)
  2507. */
  2508. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2509. __Pyx_GOTREF(__pyx_t_4);
  2510. __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 = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2511. __Pyx_GOTREF(__pyx_t_5);
  2512. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2513. __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 = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2514. __Pyx_GOTREF(__pyx_t_4);
  2515. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2516. __Pyx_GOTREF(__pyx_t_3);
  2517. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  2518. __Pyx_GIVEREF(__pyx_t_4);
  2519. __pyx_t_4 = 0;
  2520. __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2521. __Pyx_GOTREF(__pyx_t_4);
  2522. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2523. __Pyx_GOTREF(__pyx_t_1);
  2524. __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 = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2525. __Pyx_GOTREF(__pyx_t_2);
  2526. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2527. if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2528. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2529. __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 = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2530. __Pyx_GOTREF(__pyx_t_2);
  2531. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2532. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2533. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2534. if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2535. __pyx_t_8 = ((PyArrayObject *)__pyx_t_2);
  2536. {
  2537. __Pyx_BufFmt_StackElem __pyx_stack[1];
  2538. 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)) {
  2539. __pyx_v_Qabs = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_Qabs.rcbuffer->pybuffer.buf = NULL;
  2540. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2541. } 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];
  2542. }
  2543. }
  2544. __pyx_t_8 = 0;
  2545. __pyx_v_Qabs = ((PyArrayObject *)__pyx_t_2);
  2546. __pyx_t_2 = 0;
  2547. /* "scattnlay.pyx":82
  2548. * cdef np.ndarray[np.float64_t, ndim = 1] Qext = np.zeros(x.shape[0], dtype = np.float64)
  2549. * cdef np.ndarray[np.float64_t, ndim = 1] Qabs = np.zeros(x.shape[0], dtype = np.float64)
  2550. * cdef np.ndarray[np.float64_t, ndim = 1] Qsca = np.zeros(x.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  2551. * cdef np.ndarray[np.float64_t, ndim = 1] Qbk = np.zeros(x.shape[0], dtype = np.float64)
  2552. * cdef np.ndarray[np.float64_t, ndim = 1] Qpr = np.zeros(x.shape[0], dtype = np.float64)
  2553. */
  2554. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2555. __Pyx_GOTREF(__pyx_t_2);
  2556. __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 = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2557. __Pyx_GOTREF(__pyx_t_4);
  2558. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2559. __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 = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2560. __Pyx_GOTREF(__pyx_t_2);
  2561. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2562. __Pyx_GOTREF(__pyx_t_3);
  2563. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  2564. __Pyx_GIVEREF(__pyx_t_2);
  2565. __pyx_t_2 = 0;
  2566. __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2567. __Pyx_GOTREF(__pyx_t_2);
  2568. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2569. __Pyx_GOTREF(__pyx_t_5);
  2570. __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 = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2571. __Pyx_GOTREF(__pyx_t_1);
  2572. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2573. if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2574. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2575. __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 = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2576. __Pyx_GOTREF(__pyx_t_1);
  2577. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2578. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2579. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2580. if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2581. __pyx_t_9 = ((PyArrayObject *)__pyx_t_1);
  2582. {
  2583. __Pyx_BufFmt_StackElem __pyx_stack[1];
  2584. 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)) {
  2585. __pyx_v_Qsca = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_Qsca.rcbuffer->pybuffer.buf = NULL;
  2586. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2587. } 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];
  2588. }
  2589. }
  2590. __pyx_t_9 = 0;
  2591. __pyx_v_Qsca = ((PyArrayObject *)__pyx_t_1);
  2592. __pyx_t_1 = 0;
  2593. /* "scattnlay.pyx":83
  2594. * cdef np.ndarray[np.float64_t, ndim = 1] Qabs = np.zeros(x.shape[0], dtype = np.float64)
  2595. * cdef np.ndarray[np.float64_t, ndim = 1] Qsca = np.zeros(x.shape[0], dtype = np.float64)
  2596. * cdef np.ndarray[np.float64_t, ndim = 1] Qbk = np.zeros(x.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  2597. * cdef np.ndarray[np.float64_t, ndim = 1] Qpr = np.zeros(x.shape[0], dtype = np.float64)
  2598. * cdef np.ndarray[np.float64_t, ndim = 1] g = np.zeros(x.shape[0], dtype = np.float64)
  2599. */
  2600. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2601. __Pyx_GOTREF(__pyx_t_1);
  2602. __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 = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2603. __Pyx_GOTREF(__pyx_t_2);
  2604. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2605. __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 = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2606. __Pyx_GOTREF(__pyx_t_1);
  2607. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2608. __Pyx_GOTREF(__pyx_t_3);
  2609. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  2610. __Pyx_GIVEREF(__pyx_t_1);
  2611. __pyx_t_1 = 0;
  2612. __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2613. __Pyx_GOTREF(__pyx_t_1);
  2614. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2615. __Pyx_GOTREF(__pyx_t_4);
  2616. __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 = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2617. __Pyx_GOTREF(__pyx_t_5);
  2618. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2619. if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2620. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2621. __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 = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2622. __Pyx_GOTREF(__pyx_t_5);
  2623. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2624. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2625. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2626. if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2627. __pyx_t_10 = ((PyArrayObject *)__pyx_t_5);
  2628. {
  2629. __Pyx_BufFmt_StackElem __pyx_stack[1];
  2630. 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)) {
  2631. __pyx_v_Qbk = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_Qbk.rcbuffer->pybuffer.buf = NULL;
  2632. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2633. } 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];
  2634. }
  2635. }
  2636. __pyx_t_10 = 0;
  2637. __pyx_v_Qbk = ((PyArrayObject *)__pyx_t_5);
  2638. __pyx_t_5 = 0;
  2639. /* "scattnlay.pyx":84
  2640. * cdef np.ndarray[np.float64_t, ndim = 1] Qsca = np.zeros(x.shape[0], dtype = np.float64)
  2641. * cdef np.ndarray[np.float64_t, ndim = 1] Qbk = np.zeros(x.shape[0], dtype = np.float64)
  2642. * cdef np.ndarray[np.float64_t, ndim = 1] Qpr = np.zeros(x.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  2643. * cdef np.ndarray[np.float64_t, ndim = 1] g = np.zeros(x.shape[0], dtype = np.float64)
  2644. * cdef np.ndarray[np.float64_t, ndim = 1] Albedo = np.zeros(x.shape[0], dtype = np.float64)
  2645. */
  2646. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2647. __Pyx_GOTREF(__pyx_t_5);
  2648. __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 = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2649. __Pyx_GOTREF(__pyx_t_1);
  2650. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2651. __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 = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2652. __Pyx_GOTREF(__pyx_t_5);
  2653. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2654. __Pyx_GOTREF(__pyx_t_3);
  2655. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  2656. __Pyx_GIVEREF(__pyx_t_5);
  2657. __pyx_t_5 = 0;
  2658. __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2659. __Pyx_GOTREF(__pyx_t_5);
  2660. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2661. __Pyx_GOTREF(__pyx_t_2);
  2662. __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 = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2663. __Pyx_GOTREF(__pyx_t_4);
  2664. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2665. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2666. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2667. __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 = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2668. __Pyx_GOTREF(__pyx_t_4);
  2669. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2670. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2671. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2672. if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2673. __pyx_t_11 = ((PyArrayObject *)__pyx_t_4);
  2674. {
  2675. __Pyx_BufFmt_StackElem __pyx_stack[1];
  2676. 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)) {
  2677. __pyx_v_Qpr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_Qpr.rcbuffer->pybuffer.buf = NULL;
  2678. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2679. } 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];
  2680. }
  2681. }
  2682. __pyx_t_11 = 0;
  2683. __pyx_v_Qpr = ((PyArrayObject *)__pyx_t_4);
  2684. __pyx_t_4 = 0;
  2685. /* "scattnlay.pyx":85
  2686. * cdef np.ndarray[np.float64_t, ndim = 1] Qbk = np.zeros(x.shape[0], dtype = np.float64)
  2687. * cdef np.ndarray[np.float64_t, ndim = 1] Qpr = np.zeros(x.shape[0], dtype = np.float64)
  2688. * cdef np.ndarray[np.float64_t, ndim = 1] g = np.zeros(x.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  2689. * cdef np.ndarray[np.float64_t, ndim = 1] Albedo = np.zeros(x.shape[0], dtype = np.float64)
  2690. *
  2691. */
  2692. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2693. __Pyx_GOTREF(__pyx_t_4);
  2694. __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 = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2695. __Pyx_GOTREF(__pyx_t_5);
  2696. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2697. __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 = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2698. __Pyx_GOTREF(__pyx_t_4);
  2699. __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;}
  2700. __Pyx_GOTREF(__pyx_t_3);
  2701. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  2702. __Pyx_GIVEREF(__pyx_t_4);
  2703. __pyx_t_4 = 0;
  2704. __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2705. __Pyx_GOTREF(__pyx_t_4);
  2706. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2707. __Pyx_GOTREF(__pyx_t_1);
  2708. __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 = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2709. __Pyx_GOTREF(__pyx_t_2);
  2710. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2711. if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2712. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2713. __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 = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2714. __Pyx_GOTREF(__pyx_t_2);
  2715. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2716. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2717. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2718. if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2719. __pyx_t_12 = ((PyArrayObject *)__pyx_t_2);
  2720. {
  2721. __Pyx_BufFmt_StackElem __pyx_stack[1];
  2722. 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)) {
  2723. __pyx_v_g = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_g.rcbuffer->pybuffer.buf = NULL;
  2724. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2725. } 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];
  2726. }
  2727. }
  2728. __pyx_t_12 = 0;
  2729. __pyx_v_g = ((PyArrayObject *)__pyx_t_2);
  2730. __pyx_t_2 = 0;
  2731. /* "scattnlay.pyx":86
  2732. * cdef np.ndarray[np.float64_t, ndim = 1] Qpr = np.zeros(x.shape[0], dtype = np.float64)
  2733. * cdef np.ndarray[np.float64_t, ndim = 1] g = np.zeros(x.shape[0], dtype = np.float64)
  2734. * cdef np.ndarray[np.float64_t, ndim = 1] Albedo = np.zeros(x.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  2735. *
  2736. * cdef np.ndarray[np.complex128_t, ndim = 2] S1 = np.zeros((x.shape[0], theta.shape[0]), dtype = np.complex128)
  2737. */
  2738. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2739. __Pyx_GOTREF(__pyx_t_2);
  2740. __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 = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2741. __Pyx_GOTREF(__pyx_t_4);
  2742. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2743. __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 = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2744. __Pyx_GOTREF(__pyx_t_2);
  2745. __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;}
  2746. __Pyx_GOTREF(__pyx_t_3);
  2747. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  2748. __Pyx_GIVEREF(__pyx_t_2);
  2749. __pyx_t_2 = 0;
  2750. __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2751. __Pyx_GOTREF(__pyx_t_2);
  2752. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2753. __Pyx_GOTREF(__pyx_t_5);
  2754. __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 = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2755. __Pyx_GOTREF(__pyx_t_1);
  2756. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2757. if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2758. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2759. __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 = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2760. __Pyx_GOTREF(__pyx_t_1);
  2761. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2762. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2763. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2764. if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2765. __pyx_t_13 = ((PyArrayObject *)__pyx_t_1);
  2766. {
  2767. __Pyx_BufFmt_StackElem __pyx_stack[1];
  2768. 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)) {
  2769. __pyx_v_Albedo = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_Albedo.rcbuffer->pybuffer.buf = NULL;
  2770. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2771. } 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];
  2772. }
  2773. }
  2774. __pyx_t_13 = 0;
  2775. __pyx_v_Albedo = ((PyArrayObject *)__pyx_t_1);
  2776. __pyx_t_1 = 0;
  2777. /* "scattnlay.pyx":88
  2778. * cdef np.ndarray[np.float64_t, ndim = 1] Albedo = np.zeros(x.shape[0], dtype = np.float64)
  2779. *
  2780. * cdef np.ndarray[np.complex128_t, ndim = 2] S1 = np.zeros((x.shape[0], theta.shape[0]), dtype = np.complex128) # <<<<<<<<<<<<<<
  2781. * cdef np.ndarray[np.complex128_t, ndim = 2] S2 = np.zeros((x.shape[0], theta.shape[0]), dtype = np.complex128)
  2782. *
  2783. */
  2784. __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;}
  2785. __Pyx_GOTREF(__pyx_t_1);
  2786. __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;}
  2787. __Pyx_GOTREF(__pyx_t_2);
  2788. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2789. __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 = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2790. __Pyx_GOTREF(__pyx_t_1);
  2791. __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 = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2792. __Pyx_GOTREF(__pyx_t_3);
  2793. __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2794. __Pyx_GOTREF(__pyx_t_4);
  2795. PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  2796. __Pyx_GIVEREF(__pyx_t_1);
  2797. PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  2798. __Pyx_GIVEREF(__pyx_t_3);
  2799. __pyx_t_1 = 0;
  2800. __pyx_t_3 = 0;
  2801. __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;}
  2802. __Pyx_GOTREF(__pyx_t_3);
  2803. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  2804. __Pyx_GIVEREF(__pyx_t_4);
  2805. __pyx_t_4 = 0;
  2806. __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2807. __Pyx_GOTREF(__pyx_t_4);
  2808. __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;}
  2809. __Pyx_GOTREF(__pyx_t_1);
  2810. __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 = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2811. __Pyx_GOTREF(__pyx_t_5);
  2812. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2813. if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2814. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2815. __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 = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2816. __Pyx_GOTREF(__pyx_t_5);
  2817. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2818. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2819. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2820. 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;}
  2821. __pyx_t_14 = ((PyArrayObject *)__pyx_t_5);
  2822. {
  2823. __Pyx_BufFmt_StackElem __pyx_stack[1];
  2824. 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)) {
  2825. __pyx_v_S1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_S1.rcbuffer->pybuffer.buf = NULL;
  2826. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2827. } 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];
  2828. }
  2829. }
  2830. __pyx_t_14 = 0;
  2831. __pyx_v_S1 = ((PyArrayObject *)__pyx_t_5);
  2832. __pyx_t_5 = 0;
  2833. /* "scattnlay.pyx":89
  2834. *
  2835. * cdef np.ndarray[np.complex128_t, ndim = 2] S1 = np.zeros((x.shape[0], theta.shape[0]), dtype = np.complex128)
  2836. * cdef np.ndarray[np.complex128_t, ndim = 2] S2 = np.zeros((x.shape[0], theta.shape[0]), dtype = np.complex128) # <<<<<<<<<<<<<<
  2837. *
  2838. * cdef np.ndarray[np.float64_t, ndim = 1] S1r
  2839. */
  2840. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2841. __Pyx_GOTREF(__pyx_t_5);
  2842. __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 = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2843. __Pyx_GOTREF(__pyx_t_4);
  2844. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2845. __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 = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2846. __Pyx_GOTREF(__pyx_t_5);
  2847. __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 = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2848. __Pyx_GOTREF(__pyx_t_3);
  2849. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2850. __Pyx_GOTREF(__pyx_t_2);
  2851. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
  2852. __Pyx_GIVEREF(__pyx_t_5);
  2853. PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  2854. __Pyx_GIVEREF(__pyx_t_3);
  2855. __pyx_t_5 = 0;
  2856. __pyx_t_3 = 0;
  2857. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2858. __Pyx_GOTREF(__pyx_t_3);
  2859. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  2860. __Pyx_GIVEREF(__pyx_t_2);
  2861. __pyx_t_2 = 0;
  2862. __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2863. __Pyx_GOTREF(__pyx_t_2);
  2864. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2865. __Pyx_GOTREF(__pyx_t_5);
  2866. __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 = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2867. __Pyx_GOTREF(__pyx_t_1);
  2868. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2869. if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2870. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2871. __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 = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2872. __Pyx_GOTREF(__pyx_t_1);
  2873. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2874. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2875. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2876. if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2877. __pyx_t_15 = ((PyArrayObject *)__pyx_t_1);
  2878. {
  2879. __Pyx_BufFmt_StackElem __pyx_stack[1];
  2880. 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)) {
  2881. __pyx_v_S2 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_S2.rcbuffer->pybuffer.buf = NULL;
  2882. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2883. } 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];
  2884. }
  2885. }
  2886. __pyx_t_15 = 0;
  2887. __pyx_v_S2 = ((PyArrayObject *)__pyx_t_1);
  2888. __pyx_t_1 = 0;
  2889. /* "scattnlay.pyx":96
  2890. * cdef np.ndarray[np.float64_t, ndim = 1] S2i
  2891. *
  2892. * for i in range(x.shape[0]): # <<<<<<<<<<<<<<
  2893. * S1r = np.zeros(theta.shape[0], dtype = np.float64)
  2894. * S1i = np.zeros(theta.shape[0], dtype = np.float64)
  2895. */
  2896. __pyx_t_16 = (__pyx_v_x->dimensions[0]);
  2897. for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
  2898. __pyx_v_i = __pyx_t_17;
  2899. /* "scattnlay.pyx":97
  2900. *
  2901. * for i in range(x.shape[0]):
  2902. * S1r = np.zeros(theta.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  2903. * S1i = np.zeros(theta.shape[0], dtype = np.float64)
  2904. * S2r = np.zeros(theta.shape[0], dtype = np.float64)
  2905. */
  2906. __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;}
  2907. __Pyx_GOTREF(__pyx_t_1);
  2908. __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;}
  2909. __Pyx_GOTREF(__pyx_t_2);
  2910. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2911. __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 = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2912. __Pyx_GOTREF(__pyx_t_1);
  2913. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2914. __Pyx_GOTREF(__pyx_t_3);
  2915. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  2916. __Pyx_GIVEREF(__pyx_t_1);
  2917. __pyx_t_1 = 0;
  2918. __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;}
  2919. __Pyx_GOTREF(__pyx_t_1);
  2920. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2921. __Pyx_GOTREF(__pyx_t_4);
  2922. __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 = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2923. __Pyx_GOTREF(__pyx_t_5);
  2924. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2925. if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2926. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2927. __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 = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2928. __Pyx_GOTREF(__pyx_t_5);
  2929. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2930. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2931. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2932. if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2933. __pyx_t_18 = ((PyArrayObject *)__pyx_t_5);
  2934. {
  2935. __Pyx_BufFmt_StackElem __pyx_stack[1];
  2936. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S1r.rcbuffer->pybuffer);
  2937. __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);
  2938. if (unlikely(__pyx_t_19 < 0)) {
  2939. PyErr_Fetch(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
  2940. 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)) {
  2941. Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22);
  2942. __Pyx_RaiseBufferFallbackError();
  2943. } else {
  2944. PyErr_Restore(__pyx_t_20, __pyx_t_21, __pyx_t_22);
  2945. }
  2946. }
  2947. __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];
  2948. if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2949. }
  2950. __pyx_t_18 = 0;
  2951. __Pyx_XDECREF_SET(__pyx_v_S1r, ((PyArrayObject *)__pyx_t_5));
  2952. __pyx_t_5 = 0;
  2953. /* "scattnlay.pyx":98
  2954. * for i in range(x.shape[0]):
  2955. * S1r = np.zeros(theta.shape[0], dtype = np.float64)
  2956. * S1i = np.zeros(theta.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  2957. * S2r = np.zeros(theta.shape[0], dtype = np.float64)
  2958. * S2i = np.zeros(theta.shape[0], dtype = np.float64)
  2959. */
  2960. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2961. __Pyx_GOTREF(__pyx_t_5);
  2962. __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 = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2963. __Pyx_GOTREF(__pyx_t_1);
  2964. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2965. __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 = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2966. __Pyx_GOTREF(__pyx_t_5);
  2967. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2968. __Pyx_GOTREF(__pyx_t_3);
  2969. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  2970. __Pyx_GIVEREF(__pyx_t_5);
  2971. __pyx_t_5 = 0;
  2972. __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2973. __Pyx_GOTREF(__pyx_t_5);
  2974. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2975. __Pyx_GOTREF(__pyx_t_2);
  2976. __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 = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2977. __Pyx_GOTREF(__pyx_t_4);
  2978. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2979. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2980. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2981. __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 = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2982. __Pyx_GOTREF(__pyx_t_4);
  2983. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2984. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2985. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2986. if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2987. __pyx_t_23 = ((PyArrayObject *)__pyx_t_4);
  2988. {
  2989. __Pyx_BufFmt_StackElem __pyx_stack[1];
  2990. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S1i.rcbuffer->pybuffer);
  2991. __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);
  2992. if (unlikely(__pyx_t_19 < 0)) {
  2993. PyErr_Fetch(&__pyx_t_22, &__pyx_t_21, &__pyx_t_20);
  2994. 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)) {
  2995. Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20);
  2996. __Pyx_RaiseBufferFallbackError();
  2997. } else {
  2998. PyErr_Restore(__pyx_t_22, __pyx_t_21, __pyx_t_20);
  2999. }
  3000. }
  3001. __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];
  3002. if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3003. }
  3004. __pyx_t_23 = 0;
  3005. __Pyx_XDECREF_SET(__pyx_v_S1i, ((PyArrayObject *)__pyx_t_4));
  3006. __pyx_t_4 = 0;
  3007. /* "scattnlay.pyx":99
  3008. * S1r = np.zeros(theta.shape[0], dtype = np.float64)
  3009. * S1i = np.zeros(theta.shape[0], dtype = np.float64)
  3010. * S2r = np.zeros(theta.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  3011. * S2i = np.zeros(theta.shape[0], dtype = np.float64)
  3012. *
  3013. */
  3014. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3015. __Pyx_GOTREF(__pyx_t_4);
  3016. __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 = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3017. __Pyx_GOTREF(__pyx_t_5);
  3018. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3019. __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 = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3020. __Pyx_GOTREF(__pyx_t_4);
  3021. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3022. __Pyx_GOTREF(__pyx_t_3);
  3023. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  3024. __Pyx_GIVEREF(__pyx_t_4);
  3025. __pyx_t_4 = 0;
  3026. __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3027. __Pyx_GOTREF(__pyx_t_4);
  3028. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3029. __Pyx_GOTREF(__pyx_t_1);
  3030. __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 = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3031. __Pyx_GOTREF(__pyx_t_2);
  3032. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3033. if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3034. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3035. __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 = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3036. __Pyx_GOTREF(__pyx_t_2);
  3037. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3038. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3039. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3040. if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3041. __pyx_t_24 = ((PyArrayObject *)__pyx_t_2);
  3042. {
  3043. __Pyx_BufFmt_StackElem __pyx_stack[1];
  3044. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S2r.rcbuffer->pybuffer);
  3045. __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);
  3046. if (unlikely(__pyx_t_19 < 0)) {
  3047. PyErr_Fetch(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
  3048. 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)) {
  3049. Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22);
  3050. __Pyx_RaiseBufferFallbackError();
  3051. } else {
  3052. PyErr_Restore(__pyx_t_20, __pyx_t_21, __pyx_t_22);
  3053. }
  3054. }
  3055. __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];
  3056. if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3057. }
  3058. __pyx_t_24 = 0;
  3059. __Pyx_XDECREF_SET(__pyx_v_S2r, ((PyArrayObject *)__pyx_t_2));
  3060. __pyx_t_2 = 0;
  3061. /* "scattnlay.pyx":100
  3062. * S1i = np.zeros(theta.shape[0], dtype = np.float64)
  3063. * S2r = np.zeros(theta.shape[0], dtype = np.float64)
  3064. * S2i = np.zeros(theta.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  3065. *
  3066. * 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))
  3067. */
  3068. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3069. __Pyx_GOTREF(__pyx_t_2);
  3070. __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 = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3071. __Pyx_GOTREF(__pyx_t_4);
  3072. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3073. __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 = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3074. __Pyx_GOTREF(__pyx_t_2);
  3075. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3076. __Pyx_GOTREF(__pyx_t_3);
  3077. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  3078. __Pyx_GIVEREF(__pyx_t_2);
  3079. __pyx_t_2 = 0;
  3080. __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3081. __Pyx_GOTREF(__pyx_t_2);
  3082. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3083. __Pyx_GOTREF(__pyx_t_5);
  3084. __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 = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3085. __Pyx_GOTREF(__pyx_t_1);
  3086. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3087. if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3088. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3089. __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 = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3090. __Pyx_GOTREF(__pyx_t_1);
  3091. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3092. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3093. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3094. if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3095. __pyx_t_25 = ((PyArrayObject *)__pyx_t_1);
  3096. {
  3097. __Pyx_BufFmt_StackElem __pyx_stack[1];
  3098. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S2i.rcbuffer->pybuffer);
  3099. __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);
  3100. if (unlikely(__pyx_t_19 < 0)) {
  3101. PyErr_Fetch(&__pyx_t_22, &__pyx_t_21, &__pyx_t_20);
  3102. 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)) {
  3103. Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20);
  3104. __Pyx_RaiseBufferFallbackError();
  3105. } else {
  3106. PyErr_Restore(__pyx_t_22, __pyx_t_21, __pyx_t_20);
  3107. }
  3108. }
  3109. __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];
  3110. if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3111. }
  3112. __pyx_t_25 = 0;
  3113. __Pyx_XDECREF_SET(__pyx_v_S2i, ((PyArrayObject *)__pyx_t_1));
  3114. __pyx_t_1 = 0;
  3115. /* "scattnlay.pyx":102
  3116. * S2i = np.zeros(theta.shape[0], dtype = np.float64)
  3117. *
  3118. * 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)) # <<<<<<<<<<<<<<
  3119. *
  3120. * S1[i] = S1r.copy('C') + 1.0j*S1i.copy('C')
  3121. */
  3122. __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 = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  3123. __Pyx_GOTREF(__pyx_t_1);
  3124. __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 = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3125. __Pyx_GOTREF(__pyx_t_2);
  3126. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3127. __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 = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3128. __Pyx_GOTREF(__pyx_t_1);
  3129. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3130. __pyx_t_26 = __pyx_convert_vector_from_py_double(__pyx_t_1); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3131. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3132. __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 = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  3133. __Pyx_GOTREF(__pyx_t_1);
  3134. __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 = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3135. __Pyx_GOTREF(__pyx_t_2);
  3136. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3137. __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 = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3138. __Pyx_GOTREF(__pyx_t_1);
  3139. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3140. __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 = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3141. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3142. __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 = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3143. __Pyx_GOTREF(__pyx_t_1);
  3144. __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 = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3145. __Pyx_GOTREF(__pyx_t_2);
  3146. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3147. __pyx_t_28 = __pyx_convert_vector_from_py_double(__pyx_t_2); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3148. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3149. __pyx_t_29 = __pyx_v_i;
  3150. __pyx_t_19 = -1;
  3151. if (__pyx_t_29 < 0) {
  3152. __pyx_t_29 += __pyx_pybuffernd_Qext.diminfo[0].shape;
  3153. if (unlikely(__pyx_t_29 < 0)) __pyx_t_19 = 0;
  3154. } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_Qext.diminfo[0].shape)) __pyx_t_19 = 0;
  3155. if (unlikely(__pyx_t_19 != -1)) {
  3156. __Pyx_RaiseBufferIndexError(__pyx_t_19);
  3157. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3158. }
  3159. __pyx_t_30 = __pyx_v_i;
  3160. __pyx_t_19 = -1;
  3161. if (__pyx_t_30 < 0) {
  3162. __pyx_t_30 += __pyx_pybuffernd_Qsca.diminfo[0].shape;
  3163. if (unlikely(__pyx_t_30 < 0)) __pyx_t_19 = 0;
  3164. } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_Qsca.diminfo[0].shape)) __pyx_t_19 = 0;
  3165. if (unlikely(__pyx_t_19 != -1)) {
  3166. __Pyx_RaiseBufferIndexError(__pyx_t_19);
  3167. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3168. }
  3169. __pyx_t_31 = __pyx_v_i;
  3170. __pyx_t_19 = -1;
  3171. if (__pyx_t_31 < 0) {
  3172. __pyx_t_31 += __pyx_pybuffernd_Qabs.diminfo[0].shape;
  3173. if (unlikely(__pyx_t_31 < 0)) __pyx_t_19 = 0;
  3174. } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_Qabs.diminfo[0].shape)) __pyx_t_19 = 0;
  3175. if (unlikely(__pyx_t_19 != -1)) {
  3176. __Pyx_RaiseBufferIndexError(__pyx_t_19);
  3177. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3178. }
  3179. __pyx_t_32 = __pyx_v_i;
  3180. __pyx_t_19 = -1;
  3181. if (__pyx_t_32 < 0) {
  3182. __pyx_t_32 += __pyx_pybuffernd_Qbk.diminfo[0].shape;
  3183. if (unlikely(__pyx_t_32 < 0)) __pyx_t_19 = 0;
  3184. } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_Qbk.diminfo[0].shape)) __pyx_t_19 = 0;
  3185. if (unlikely(__pyx_t_19 != -1)) {
  3186. __Pyx_RaiseBufferIndexError(__pyx_t_19);
  3187. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3188. }
  3189. __pyx_t_33 = __pyx_v_i;
  3190. __pyx_t_19 = -1;
  3191. if (__pyx_t_33 < 0) {
  3192. __pyx_t_33 += __pyx_pybuffernd_Qpr.diminfo[0].shape;
  3193. if (unlikely(__pyx_t_33 < 0)) __pyx_t_19 = 0;
  3194. } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_Qpr.diminfo[0].shape)) __pyx_t_19 = 0;
  3195. if (unlikely(__pyx_t_19 != -1)) {
  3196. __Pyx_RaiseBufferIndexError(__pyx_t_19);
  3197. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3198. }
  3199. __pyx_t_34 = __pyx_v_i;
  3200. __pyx_t_19 = -1;
  3201. if (__pyx_t_34 < 0) {
  3202. __pyx_t_34 += __pyx_pybuffernd_g.diminfo[0].shape;
  3203. if (unlikely(__pyx_t_34 < 0)) __pyx_t_19 = 0;
  3204. } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_g.diminfo[0].shape)) __pyx_t_19 = 0;
  3205. if (unlikely(__pyx_t_19 != -1)) {
  3206. __Pyx_RaiseBufferIndexError(__pyx_t_19);
  3207. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3208. }
  3209. __pyx_t_35 = __pyx_v_i;
  3210. __pyx_t_19 = -1;
  3211. if (__pyx_t_35 < 0) {
  3212. __pyx_t_35 += __pyx_pybuffernd_Albedo.diminfo[0].shape;
  3213. if (unlikely(__pyx_t_35 < 0)) __pyx_t_19 = 0;
  3214. } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_Albedo.diminfo[0].shape)) __pyx_t_19 = 0;
  3215. if (unlikely(__pyx_t_19 != -1)) {
  3216. __Pyx_RaiseBufferIndexError(__pyx_t_19);
  3217. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3218. }
  3219. __pyx_t_36 = __pyx_v_i;
  3220. __pyx_t_19 = -1;
  3221. if (__pyx_t_36 < 0) {
  3222. __pyx_t_36 += __pyx_pybuffernd_terms.diminfo[0].shape;
  3223. if (unlikely(__pyx_t_36 < 0)) __pyx_t_19 = 0;
  3224. } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_terms.diminfo[0].shape)) __pyx_t_19 = 0;
  3225. if (unlikely(__pyx_t_19 != -1)) {
  3226. __Pyx_RaiseBufferIndexError(__pyx_t_19);
  3227. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3228. }
  3229. *__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_9scattnlay_npy2c(((PyArrayObject *)__pyx_v_S1r)), __pyx_f_9scattnlay_npy2c(((PyArrayObject *)__pyx_v_S1i)), __pyx_f_9scattnlay_npy2c(((PyArrayObject *)__pyx_v_S2r)), __pyx_f_9scattnlay_npy2c(((PyArrayObject *)__pyx_v_S2i)));
  3230. /* "scattnlay.pyx":104
  3231. * 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))
  3232. *
  3233. * S1[i] = S1r.copy('C') + 1.0j*S1i.copy('C') # <<<<<<<<<<<<<<
  3234. * S2[i] = S2r.copy('C') + 1.0j*S2i.copy('C')
  3235. *
  3236. */
  3237. __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 = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3238. __Pyx_GOTREF(__pyx_t_2);
  3239. __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 = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3240. __Pyx_GOTREF(__pyx_t_1);
  3241. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3242. __pyx_t_2 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3243. __Pyx_GOTREF(__pyx_t_2);
  3244. __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 = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3245. __Pyx_GOTREF(__pyx_t_3);
  3246. __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 = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3247. __Pyx_GOTREF(__pyx_t_4);
  3248. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3249. __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3250. __Pyx_GOTREF(__pyx_t_3);
  3251. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3252. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3253. __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3254. __Pyx_GOTREF(__pyx_t_4);
  3255. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3256. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3257. 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 = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3258. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3259. /* "scattnlay.pyx":105
  3260. *
  3261. * S1[i] = S1r.copy('C') + 1.0j*S1i.copy('C')
  3262. * S2[i] = S2r.copy('C') + 1.0j*S2i.copy('C') # <<<<<<<<<<<<<<
  3263. *
  3264. * return terms, Qext, Qsca, Qabs, Qbk, Qpr, g, Albedo, S1, S2
  3265. */
  3266. __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 = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3267. __Pyx_GOTREF(__pyx_t_4);
  3268. __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 = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3269. __Pyx_GOTREF(__pyx_t_3);
  3270. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3271. __pyx_t_4 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3272. __Pyx_GOTREF(__pyx_t_4);
  3273. __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 = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3274. __Pyx_GOTREF(__pyx_t_1);
  3275. __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 = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3276. __Pyx_GOTREF(__pyx_t_2);
  3277. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3278. __pyx_t_1 = PyNumber_Multiply(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3279. __Pyx_GOTREF(__pyx_t_1);
  3280. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3281. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3282. __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3283. __Pyx_GOTREF(__pyx_t_2);
  3284. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3285. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3286. 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 = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3287. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3288. }
  3289. /* "scattnlay.pyx":107
  3290. * S2[i] = S2r.copy('C') + 1.0j*S2i.copy('C')
  3291. *
  3292. * return terms, Qext, Qsca, Qabs, Qbk, Qpr, g, Albedo, S1, S2 # <<<<<<<<<<<<<<
  3293. *
  3294. * 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):
  3295. */
  3296. __Pyx_XDECREF(__pyx_r);
  3297. __pyx_t_2 = PyTuple_New(10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3298. __Pyx_GOTREF(__pyx_t_2);
  3299. __Pyx_INCREF(((PyObject *)__pyx_v_terms));
  3300. PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_terms));
  3301. __Pyx_GIVEREF(((PyObject *)__pyx_v_terms));
  3302. __Pyx_INCREF(((PyObject *)__pyx_v_Qext));
  3303. PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_Qext));
  3304. __Pyx_GIVEREF(((PyObject *)__pyx_v_Qext));
  3305. __Pyx_INCREF(((PyObject *)__pyx_v_Qsca));
  3306. PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_Qsca));
  3307. __Pyx_GIVEREF(((PyObject *)__pyx_v_Qsca));
  3308. __Pyx_INCREF(((PyObject *)__pyx_v_Qabs));
  3309. PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_v_Qabs));
  3310. __Pyx_GIVEREF(((PyObject *)__pyx_v_Qabs));
  3311. __Pyx_INCREF(((PyObject *)__pyx_v_Qbk));
  3312. PyTuple_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_v_Qbk));
  3313. __Pyx_GIVEREF(((PyObject *)__pyx_v_Qbk));
  3314. __Pyx_INCREF(((PyObject *)__pyx_v_Qpr));
  3315. PyTuple_SET_ITEM(__pyx_t_2, 5, ((PyObject *)__pyx_v_Qpr));
  3316. __Pyx_GIVEREF(((PyObject *)__pyx_v_Qpr));
  3317. __Pyx_INCREF(((PyObject *)__pyx_v_g));
  3318. PyTuple_SET_ITEM(__pyx_t_2, 6, ((PyObject *)__pyx_v_g));
  3319. __Pyx_GIVEREF(((PyObject *)__pyx_v_g));
  3320. __Pyx_INCREF(((PyObject *)__pyx_v_Albedo));
  3321. PyTuple_SET_ITEM(__pyx_t_2, 7, ((PyObject *)__pyx_v_Albedo));
  3322. __Pyx_GIVEREF(((PyObject *)__pyx_v_Albedo));
  3323. __Pyx_INCREF(((PyObject *)__pyx_v_S1));
  3324. PyTuple_SET_ITEM(__pyx_t_2, 8, ((PyObject *)__pyx_v_S1));
  3325. __Pyx_GIVEREF(((PyObject *)__pyx_v_S1));
  3326. __Pyx_INCREF(((PyObject *)__pyx_v_S2));
  3327. PyTuple_SET_ITEM(__pyx_t_2, 9, ((PyObject *)__pyx_v_S2));
  3328. __Pyx_GIVEREF(((PyObject *)__pyx_v_S2));
  3329. __pyx_r = __pyx_t_2;
  3330. __pyx_t_2 = 0;
  3331. goto __pyx_L0;
  3332. /* "scattnlay.pyx":75
  3333. * return terms, an, bn
  3334. *
  3335. * 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): # <<<<<<<<<<<<<<
  3336. * cdef Py_ssize_t i
  3337. *
  3338. */
  3339. /* function exit code */
  3340. __pyx_L1_error:;
  3341. __Pyx_XDECREF(__pyx_t_1);
  3342. __Pyx_XDECREF(__pyx_t_2);
  3343. __Pyx_XDECREF(__pyx_t_3);
  3344. __Pyx_XDECREF(__pyx_t_4);
  3345. __Pyx_XDECREF(__pyx_t_5);
  3346. { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
  3347. __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
  3348. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Albedo.rcbuffer->pybuffer);
  3349. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Qabs.rcbuffer->pybuffer);
  3350. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Qbk.rcbuffer->pybuffer);
  3351. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Qext.rcbuffer->pybuffer);
  3352. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Qpr.rcbuffer->pybuffer);
  3353. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Qsca.rcbuffer->pybuffer);
  3354. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S1.rcbuffer->pybuffer);
  3355. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S1i.rcbuffer->pybuffer);
  3356. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S1r.rcbuffer->pybuffer);
  3357. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S2.rcbuffer->pybuffer);
  3358. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S2i.rcbuffer->pybuffer);
  3359. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S2r.rcbuffer->pybuffer);
  3360. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_g.rcbuffer->pybuffer);
  3361. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_m.rcbuffer->pybuffer);
  3362. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_terms.rcbuffer->pybuffer);
  3363. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_theta.rcbuffer->pybuffer);
  3364. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
  3365. __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  3366. __Pyx_AddTraceback("scattnlay.scattnlay", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3367. __pyx_r = NULL;
  3368. goto __pyx_L2;
  3369. __pyx_L0:;
  3370. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Albedo.rcbuffer->pybuffer);
  3371. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Qabs.rcbuffer->pybuffer);
  3372. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Qbk.rcbuffer->pybuffer);
  3373. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Qext.rcbuffer->pybuffer);
  3374. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Qpr.rcbuffer->pybuffer);
  3375. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Qsca.rcbuffer->pybuffer);
  3376. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S1.rcbuffer->pybuffer);
  3377. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S1i.rcbuffer->pybuffer);
  3378. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S1r.rcbuffer->pybuffer);
  3379. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S2.rcbuffer->pybuffer);
  3380. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S2i.rcbuffer->pybuffer);
  3381. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_S2r.rcbuffer->pybuffer);
  3382. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_g.rcbuffer->pybuffer);
  3383. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_m.rcbuffer->pybuffer);
  3384. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_terms.rcbuffer->pybuffer);
  3385. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_theta.rcbuffer->pybuffer);
  3386. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
  3387. __pyx_L2:;
  3388. __Pyx_XDECREF((PyObject *)__pyx_v_terms);
  3389. __Pyx_XDECREF((PyObject *)__pyx_v_Qext);
  3390. __Pyx_XDECREF((PyObject *)__pyx_v_Qabs);
  3391. __Pyx_XDECREF((PyObject *)__pyx_v_Qsca);
  3392. __Pyx_XDECREF((PyObject *)__pyx_v_Qbk);
  3393. __Pyx_XDECREF((PyObject *)__pyx_v_Qpr);
  3394. __Pyx_XDECREF((PyObject *)__pyx_v_g);
  3395. __Pyx_XDECREF((PyObject *)__pyx_v_Albedo);
  3396. __Pyx_XDECREF((PyObject *)__pyx_v_S1);
  3397. __Pyx_XDECREF((PyObject *)__pyx_v_S2);
  3398. __Pyx_XDECREF((PyObject *)__pyx_v_S1r);
  3399. __Pyx_XDECREF((PyObject *)__pyx_v_S1i);
  3400. __Pyx_XDECREF((PyObject *)__pyx_v_S2r);
  3401. __Pyx_XDECREF((PyObject *)__pyx_v_S2i);
  3402. __Pyx_XGIVEREF(__pyx_r);
  3403. __Pyx_RefNannyFinishContext();
  3404. return __pyx_r;
  3405. }
  3406. /* "scattnlay.pyx":109
  3407. * return terms, Qext, Qsca, Qabs, Qbk, Qpr, g, Albedo, S1, S2
  3408. *
  3409. * 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): # <<<<<<<<<<<<<<
  3410. * cdef Py_ssize_t i
  3411. *
  3412. */
  3413. /* Python wrapper */
  3414. static PyObject *__pyx_pw_9scattnlay_5fieldnlay(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  3415. static PyMethodDef __pyx_mdef_9scattnlay_5fieldnlay = {"fieldnlay", (PyCFunction)__pyx_pw_9scattnlay_5fieldnlay, METH_VARARGS|METH_KEYWORDS, 0};
  3416. static PyObject *__pyx_pw_9scattnlay_5fieldnlay(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  3417. PyArrayObject *__pyx_v_x = 0;
  3418. PyArrayObject *__pyx_v_m = 0;
  3419. PyArrayObject *__pyx_v_coords = 0;
  3420. __pyx_t_5numpy_int_t __pyx_v_nmax;
  3421. __pyx_t_5numpy_int_t __pyx_v_pl;
  3422. int __pyx_lineno = 0;
  3423. const char *__pyx_filename = NULL;
  3424. int __pyx_clineno = 0;
  3425. PyObject *__pyx_r = 0;
  3426. __Pyx_RefNannyDeclarations
  3427. __Pyx_RefNannySetupContext("fieldnlay (wrapper)", 0);
  3428. {
  3429. 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};
  3430. PyObject* values[5] = {0,0,0,0,0};
  3431. if (unlikely(__pyx_kwds)) {
  3432. Py_ssize_t kw_args;
  3433. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  3434. switch (pos_args) {
  3435. case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
  3436. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  3437. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  3438. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  3439. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  3440. case 0: break;
  3441. default: goto __pyx_L5_argtuple_error;
  3442. }
  3443. kw_args = PyDict_Size(__pyx_kwds);
  3444. switch (pos_args) {
  3445. case 0:
  3446. if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
  3447. else goto __pyx_L5_argtuple_error;
  3448. case 1:
  3449. if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_m)) != 0)) kw_args--;
  3450. else {
  3451. __Pyx_RaiseArgtupleInvalid("fieldnlay", 0, 3, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3452. }
  3453. case 2:
  3454. if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_coords)) != 0)) kw_args--;
  3455. else {
  3456. __Pyx_RaiseArgtupleInvalid("fieldnlay", 0, 3, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3457. }
  3458. case 3:
  3459. if (kw_args > 0) {
  3460. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nmax);
  3461. if (value) { values[3] = value; kw_args--; }
  3462. }
  3463. case 4:
  3464. if (kw_args > 0) {
  3465. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pl);
  3466. if (value) { values[4] = value; kw_args--; }
  3467. }
  3468. }
  3469. if (unlikely(kw_args > 0)) {
  3470. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fieldnlay") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3471. }
  3472. } else {
  3473. switch (PyTuple_GET_SIZE(__pyx_args)) {
  3474. case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
  3475. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  3476. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  3477. values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  3478. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  3479. break;
  3480. default: goto __pyx_L5_argtuple_error;
  3481. }
  3482. }
  3483. __pyx_v_x = ((PyArrayObject *)values[0]);
  3484. __pyx_v_m = ((PyArrayObject *)values[1]);
  3485. __pyx_v_coords = ((PyArrayObject *)values[2]);
  3486. if (values[3]) {
  3487. __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 = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3488. } else {
  3489. __pyx_v_nmax = ((__pyx_t_5numpy_int_t)-1);
  3490. }
  3491. if (values[4]) {
  3492. __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 = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3493. } else {
  3494. __pyx_v_pl = ((__pyx_t_5numpy_int_t)-1);
  3495. }
  3496. }
  3497. goto __pyx_L4_argument_unpacking_done;
  3498. __pyx_L5_argtuple_error:;
  3499. __Pyx_RaiseArgtupleInvalid("fieldnlay", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3500. __pyx_L3_error:;
  3501. __Pyx_AddTraceback("scattnlay.fieldnlay", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3502. __Pyx_RefNannyFinishContext();
  3503. return NULL;
  3504. __pyx_L4_argument_unpacking_done:;
  3505. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3506. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_m), __pyx_ptype_5numpy_ndarray, 1, "m", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3507. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coords), __pyx_ptype_5numpy_ndarray, 1, "coords", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3508. __pyx_r = __pyx_pf_9scattnlay_4fieldnlay(__pyx_self, __pyx_v_x, __pyx_v_m, __pyx_v_coords, __pyx_v_nmax, __pyx_v_pl);
  3509. /* function exit code */
  3510. goto __pyx_L0;
  3511. __pyx_L1_error:;
  3512. __pyx_r = NULL;
  3513. __pyx_L0:;
  3514. __Pyx_RefNannyFinishContext();
  3515. return __pyx_r;
  3516. }
  3517. static PyObject *__pyx_pf_9scattnlay_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) {
  3518. Py_ssize_t __pyx_v_i;
  3519. PyArrayObject *__pyx_v_terms = 0;
  3520. PyArrayObject *__pyx_v_E = 0;
  3521. PyArrayObject *__pyx_v_H = 0;
  3522. PyArrayObject *__pyx_v_Erx = 0;
  3523. PyArrayObject *__pyx_v_Ery = 0;
  3524. PyArrayObject *__pyx_v_Erz = 0;
  3525. PyArrayObject *__pyx_v_Eix = 0;
  3526. PyArrayObject *__pyx_v_Eiy = 0;
  3527. PyArrayObject *__pyx_v_Eiz = 0;
  3528. PyArrayObject *__pyx_v_Hrx = 0;
  3529. PyArrayObject *__pyx_v_Hry = 0;
  3530. PyArrayObject *__pyx_v_Hrz = 0;
  3531. PyArrayObject *__pyx_v_Hix = 0;
  3532. PyArrayObject *__pyx_v_Hiy = 0;
  3533. PyArrayObject *__pyx_v_Hiz = 0;
  3534. __Pyx_LocalBuf_ND __pyx_pybuffernd_E;
  3535. __Pyx_Buffer __pyx_pybuffer_E;
  3536. __Pyx_LocalBuf_ND __pyx_pybuffernd_Eix;
  3537. __Pyx_Buffer __pyx_pybuffer_Eix;
  3538. __Pyx_LocalBuf_ND __pyx_pybuffernd_Eiy;
  3539. __Pyx_Buffer __pyx_pybuffer_Eiy;
  3540. __Pyx_LocalBuf_ND __pyx_pybuffernd_Eiz;
  3541. __Pyx_Buffer __pyx_pybuffer_Eiz;
  3542. __Pyx_LocalBuf_ND __pyx_pybuffernd_Erx;
  3543. __Pyx_Buffer __pyx_pybuffer_Erx;
  3544. __Pyx_LocalBuf_ND __pyx_pybuffernd_Ery;
  3545. __Pyx_Buffer __pyx_pybuffer_Ery;
  3546. __Pyx_LocalBuf_ND __pyx_pybuffernd_Erz;
  3547. __Pyx_Buffer __pyx_pybuffer_Erz;
  3548. __Pyx_LocalBuf_ND __pyx_pybuffernd_H;
  3549. __Pyx_Buffer __pyx_pybuffer_H;
  3550. __Pyx_LocalBuf_ND __pyx_pybuffernd_Hix;
  3551. __Pyx_Buffer __pyx_pybuffer_Hix;
  3552. __Pyx_LocalBuf_ND __pyx_pybuffernd_Hiy;
  3553. __Pyx_Buffer __pyx_pybuffer_Hiy;
  3554. __Pyx_LocalBuf_ND __pyx_pybuffernd_Hiz;
  3555. __Pyx_Buffer __pyx_pybuffer_Hiz;
  3556. __Pyx_LocalBuf_ND __pyx_pybuffernd_Hrx;
  3557. __Pyx_Buffer __pyx_pybuffer_Hrx;
  3558. __Pyx_LocalBuf_ND __pyx_pybuffernd_Hry;
  3559. __Pyx_Buffer __pyx_pybuffer_Hry;
  3560. __Pyx_LocalBuf_ND __pyx_pybuffernd_Hrz;
  3561. __Pyx_Buffer __pyx_pybuffer_Hrz;
  3562. __Pyx_LocalBuf_ND __pyx_pybuffernd_coords;
  3563. __Pyx_Buffer __pyx_pybuffer_coords;
  3564. __Pyx_LocalBuf_ND __pyx_pybuffernd_m;
  3565. __Pyx_Buffer __pyx_pybuffer_m;
  3566. __Pyx_LocalBuf_ND __pyx_pybuffernd_terms;
  3567. __Pyx_Buffer __pyx_pybuffer_terms;
  3568. __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
  3569. __Pyx_Buffer __pyx_pybuffer_x;
  3570. PyObject *__pyx_r = NULL;
  3571. __Pyx_RefNannyDeclarations
  3572. PyObject *__pyx_t_1 = NULL;
  3573. PyObject *__pyx_t_2 = NULL;
  3574. PyObject *__pyx_t_3 = NULL;
  3575. PyObject *__pyx_t_4 = NULL;
  3576. PyObject *__pyx_t_5 = NULL;
  3577. PyArrayObject *__pyx_t_6 = NULL;
  3578. PyArrayObject *__pyx_t_7 = NULL;
  3579. PyArrayObject *__pyx_t_8 = NULL;
  3580. npy_intp __pyx_t_9;
  3581. Py_ssize_t __pyx_t_10;
  3582. PyArrayObject *__pyx_t_11 = NULL;
  3583. int __pyx_t_12;
  3584. PyObject *__pyx_t_13 = NULL;
  3585. PyObject *__pyx_t_14 = NULL;
  3586. PyObject *__pyx_t_15 = NULL;
  3587. PyArrayObject *__pyx_t_16 = NULL;
  3588. PyArrayObject *__pyx_t_17 = NULL;
  3589. PyArrayObject *__pyx_t_18 = NULL;
  3590. PyArrayObject *__pyx_t_19 = NULL;
  3591. PyArrayObject *__pyx_t_20 = NULL;
  3592. PyArrayObject *__pyx_t_21 = NULL;
  3593. PyArrayObject *__pyx_t_22 = NULL;
  3594. PyArrayObject *__pyx_t_23 = NULL;
  3595. PyArrayObject *__pyx_t_24 = NULL;
  3596. PyArrayObject *__pyx_t_25 = NULL;
  3597. PyArrayObject *__pyx_t_26 = NULL;
  3598. std::vector<double> __pyx_t_27;
  3599. std::vector<__pyx_t_double_complex> __pyx_t_28;
  3600. std::vector<double> __pyx_t_29;
  3601. std::vector<double> __pyx_t_30;
  3602. std::vector<double> __pyx_t_31;
  3603. Py_ssize_t __pyx_t_32;
  3604. PyObject *__pyx_t_33 = NULL;
  3605. PyObject *__pyx_t_34 = NULL;
  3606. PyObject *__pyx_t_35 = NULL;
  3607. PyObject *__pyx_t_36 = NULL;
  3608. int __pyx_lineno = 0;
  3609. const char *__pyx_filename = NULL;
  3610. int __pyx_clineno = 0;
  3611. __Pyx_RefNannySetupContext("fieldnlay", 0);
  3612. __pyx_pybuffer_terms.pybuffer.buf = NULL;
  3613. __pyx_pybuffer_terms.refcount = 0;
  3614. __pyx_pybuffernd_terms.data = NULL;
  3615. __pyx_pybuffernd_terms.rcbuffer = &__pyx_pybuffer_terms;
  3616. __pyx_pybuffer_E.pybuffer.buf = NULL;
  3617. __pyx_pybuffer_E.refcount = 0;
  3618. __pyx_pybuffernd_E.data = NULL;
  3619. __pyx_pybuffernd_E.rcbuffer = &__pyx_pybuffer_E;
  3620. __pyx_pybuffer_H.pybuffer.buf = NULL;
  3621. __pyx_pybuffer_H.refcount = 0;
  3622. __pyx_pybuffernd_H.data = NULL;
  3623. __pyx_pybuffernd_H.rcbuffer = &__pyx_pybuffer_H;
  3624. __pyx_pybuffer_Erx.pybuffer.buf = NULL;
  3625. __pyx_pybuffer_Erx.refcount = 0;
  3626. __pyx_pybuffernd_Erx.data = NULL;
  3627. __pyx_pybuffernd_Erx.rcbuffer = &__pyx_pybuffer_Erx;
  3628. __pyx_pybuffer_Ery.pybuffer.buf = NULL;
  3629. __pyx_pybuffer_Ery.refcount = 0;
  3630. __pyx_pybuffernd_Ery.data = NULL;
  3631. __pyx_pybuffernd_Ery.rcbuffer = &__pyx_pybuffer_Ery;
  3632. __pyx_pybuffer_Erz.pybuffer.buf = NULL;
  3633. __pyx_pybuffer_Erz.refcount = 0;
  3634. __pyx_pybuffernd_Erz.data = NULL;
  3635. __pyx_pybuffernd_Erz.rcbuffer = &__pyx_pybuffer_Erz;
  3636. __pyx_pybuffer_Eix.pybuffer.buf = NULL;
  3637. __pyx_pybuffer_Eix.refcount = 0;
  3638. __pyx_pybuffernd_Eix.data = NULL;
  3639. __pyx_pybuffernd_Eix.rcbuffer = &__pyx_pybuffer_Eix;
  3640. __pyx_pybuffer_Eiy.pybuffer.buf = NULL;
  3641. __pyx_pybuffer_Eiy.refcount = 0;
  3642. __pyx_pybuffernd_Eiy.data = NULL;
  3643. __pyx_pybuffernd_Eiy.rcbuffer = &__pyx_pybuffer_Eiy;
  3644. __pyx_pybuffer_Eiz.pybuffer.buf = NULL;
  3645. __pyx_pybuffer_Eiz.refcount = 0;
  3646. __pyx_pybuffernd_Eiz.data = NULL;
  3647. __pyx_pybuffernd_Eiz.rcbuffer = &__pyx_pybuffer_Eiz;
  3648. __pyx_pybuffer_Hrx.pybuffer.buf = NULL;
  3649. __pyx_pybuffer_Hrx.refcount = 0;
  3650. __pyx_pybuffernd_Hrx.data = NULL;
  3651. __pyx_pybuffernd_Hrx.rcbuffer = &__pyx_pybuffer_Hrx;
  3652. __pyx_pybuffer_Hry.pybuffer.buf = NULL;
  3653. __pyx_pybuffer_Hry.refcount = 0;
  3654. __pyx_pybuffernd_Hry.data = NULL;
  3655. __pyx_pybuffernd_Hry.rcbuffer = &__pyx_pybuffer_Hry;
  3656. __pyx_pybuffer_Hrz.pybuffer.buf = NULL;
  3657. __pyx_pybuffer_Hrz.refcount = 0;
  3658. __pyx_pybuffernd_Hrz.data = NULL;
  3659. __pyx_pybuffernd_Hrz.rcbuffer = &__pyx_pybuffer_Hrz;
  3660. __pyx_pybuffer_Hix.pybuffer.buf = NULL;
  3661. __pyx_pybuffer_Hix.refcount = 0;
  3662. __pyx_pybuffernd_Hix.data = NULL;
  3663. __pyx_pybuffernd_Hix.rcbuffer = &__pyx_pybuffer_Hix;
  3664. __pyx_pybuffer_Hiy.pybuffer.buf = NULL;
  3665. __pyx_pybuffer_Hiy.refcount = 0;
  3666. __pyx_pybuffernd_Hiy.data = NULL;
  3667. __pyx_pybuffernd_Hiy.rcbuffer = &__pyx_pybuffer_Hiy;
  3668. __pyx_pybuffer_Hiz.pybuffer.buf = NULL;
  3669. __pyx_pybuffer_Hiz.refcount = 0;
  3670. __pyx_pybuffernd_Hiz.data = NULL;
  3671. __pyx_pybuffernd_Hiz.rcbuffer = &__pyx_pybuffer_Hiz;
  3672. __pyx_pybuffer_x.pybuffer.buf = NULL;
  3673. __pyx_pybuffer_x.refcount = 0;
  3674. __pyx_pybuffernd_x.data = NULL;
  3675. __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
  3676. __pyx_pybuffer_m.pybuffer.buf = NULL;
  3677. __pyx_pybuffer_m.refcount = 0;
  3678. __pyx_pybuffernd_m.data = NULL;
  3679. __pyx_pybuffernd_m.rcbuffer = &__pyx_pybuffer_m;
  3680. __pyx_pybuffer_coords.pybuffer.buf = NULL;
  3681. __pyx_pybuffer_coords.refcount = 0;
  3682. __pyx_pybuffernd_coords.data = NULL;
  3683. __pyx_pybuffernd_coords.rcbuffer = &__pyx_pybuffer_coords;
  3684. {
  3685. __Pyx_BufFmt_StackElem __pyx_stack[1];
  3686. 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 = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3687. }
  3688. __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];
  3689. {
  3690. __Pyx_BufFmt_StackElem __pyx_stack[1];
  3691. 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 = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3692. }
  3693. __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];
  3694. {
  3695. __Pyx_BufFmt_StackElem __pyx_stack[1];
  3696. 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 = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3697. }
  3698. __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];
  3699. /* "scattnlay.pyx":112
  3700. * cdef Py_ssize_t i
  3701. *
  3702. * cdef np.ndarray[np.int_t, ndim = 1] terms = np.zeros(x.shape[0], dtype = np.int) # <<<<<<<<<<<<<<
  3703. *
  3704. * cdef np.ndarray[np.complex128_t, ndim = 3] E = np.zeros((x.shape[0], coords.shape[0], 3), dtype = np.complex128)
  3705. */
  3706. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3707. __Pyx_GOTREF(__pyx_t_1);
  3708. __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 = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3709. __Pyx_GOTREF(__pyx_t_2);
  3710. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3711. __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 = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3712. __Pyx_GOTREF(__pyx_t_1);
  3713. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3714. __Pyx_GOTREF(__pyx_t_3);
  3715. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  3716. __Pyx_GIVEREF(__pyx_t_1);
  3717. __pyx_t_1 = 0;
  3718. __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3719. __Pyx_GOTREF(__pyx_t_1);
  3720. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3721. __Pyx_GOTREF(__pyx_t_4);
  3722. __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 = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3723. __Pyx_GOTREF(__pyx_t_5);
  3724. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3725. if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3726. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3727. __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 = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3728. __Pyx_GOTREF(__pyx_t_5);
  3729. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3730. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3731. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3732. if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3733. __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  3734. {
  3735. __Pyx_BufFmt_StackElem __pyx_stack[1];
  3736. 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)) {
  3737. __pyx_v_terms = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_terms.rcbuffer->pybuffer.buf = NULL;
  3738. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3739. } 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];
  3740. }
  3741. }
  3742. __pyx_t_6 = 0;
  3743. __pyx_v_terms = ((PyArrayObject *)__pyx_t_5);
  3744. __pyx_t_5 = 0;
  3745. /* "scattnlay.pyx":114
  3746. * cdef np.ndarray[np.int_t, ndim = 1] terms = np.zeros(x.shape[0], dtype = np.int)
  3747. *
  3748. * cdef np.ndarray[np.complex128_t, ndim = 3] E = np.zeros((x.shape[0], coords.shape[0], 3), dtype = np.complex128) # <<<<<<<<<<<<<<
  3749. * cdef np.ndarray[np.complex128_t, ndim = 3] H = np.zeros((x.shape[0], coords.shape[0], 3), dtype = np.complex128)
  3750. *
  3751. */
  3752. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3753. __Pyx_GOTREF(__pyx_t_5);
  3754. __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 = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3755. __Pyx_GOTREF(__pyx_t_1);
  3756. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3757. __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 = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3758. __Pyx_GOTREF(__pyx_t_5);
  3759. __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 = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3760. __Pyx_GOTREF(__pyx_t_3);
  3761. __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3762. __Pyx_GOTREF(__pyx_t_2);
  3763. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
  3764. __Pyx_GIVEREF(__pyx_t_5);
  3765. PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  3766. __Pyx_GIVEREF(__pyx_t_3);
  3767. __Pyx_INCREF(__pyx_int_3);
  3768. PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_int_3);
  3769. __Pyx_GIVEREF(__pyx_int_3);
  3770. __pyx_t_5 = 0;
  3771. __pyx_t_3 = 0;
  3772. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3773. __Pyx_GOTREF(__pyx_t_3);
  3774. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  3775. __Pyx_GIVEREF(__pyx_t_2);
  3776. __pyx_t_2 = 0;
  3777. __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3778. __Pyx_GOTREF(__pyx_t_2);
  3779. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3780. __Pyx_GOTREF(__pyx_t_5);
  3781. __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 = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3782. __Pyx_GOTREF(__pyx_t_4);
  3783. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3784. if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3785. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3786. __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 = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3787. __Pyx_GOTREF(__pyx_t_4);
  3788. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3789. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3790. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3791. if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3792. __pyx_t_7 = ((PyArrayObject *)__pyx_t_4);
  3793. {
  3794. __Pyx_BufFmt_StackElem __pyx_stack[1];
  3795. 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)) {
  3796. __pyx_v_E = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_E.rcbuffer->pybuffer.buf = NULL;
  3797. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3798. } 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];
  3799. }
  3800. }
  3801. __pyx_t_7 = 0;
  3802. __pyx_v_E = ((PyArrayObject *)__pyx_t_4);
  3803. __pyx_t_4 = 0;
  3804. /* "scattnlay.pyx":115
  3805. *
  3806. * cdef np.ndarray[np.complex128_t, ndim = 3] E = np.zeros((x.shape[0], coords.shape[0], 3), dtype = np.complex128)
  3807. * cdef np.ndarray[np.complex128_t, ndim = 3] H = np.zeros((x.shape[0], coords.shape[0], 3), dtype = np.complex128) # <<<<<<<<<<<<<<
  3808. *
  3809. * cdef np.ndarray[np.float64_t, ndim = 1] Erx
  3810. */
  3811. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3812. __Pyx_GOTREF(__pyx_t_4);
  3813. __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 = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3814. __Pyx_GOTREF(__pyx_t_2);
  3815. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3816. __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 = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3817. __Pyx_GOTREF(__pyx_t_4);
  3818. __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 = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3819. __Pyx_GOTREF(__pyx_t_3);
  3820. __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3821. __Pyx_GOTREF(__pyx_t_1);
  3822. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
  3823. __Pyx_GIVEREF(__pyx_t_4);
  3824. PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  3825. __Pyx_GIVEREF(__pyx_t_3);
  3826. __Pyx_INCREF(__pyx_int_3);
  3827. PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_int_3);
  3828. __Pyx_GIVEREF(__pyx_int_3);
  3829. __pyx_t_4 = 0;
  3830. __pyx_t_3 = 0;
  3831. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3832. __Pyx_GOTREF(__pyx_t_3);
  3833. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  3834. __Pyx_GIVEREF(__pyx_t_1);
  3835. __pyx_t_1 = 0;
  3836. __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3837. __Pyx_GOTREF(__pyx_t_1);
  3838. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3839. __Pyx_GOTREF(__pyx_t_4);
  3840. __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 = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3841. __Pyx_GOTREF(__pyx_t_5);
  3842. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3843. if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3844. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3845. __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 = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3846. __Pyx_GOTREF(__pyx_t_5);
  3847. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3848. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3849. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3850. if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3851. __pyx_t_8 = ((PyArrayObject *)__pyx_t_5);
  3852. {
  3853. __Pyx_BufFmt_StackElem __pyx_stack[1];
  3854. 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)) {
  3855. __pyx_v_H = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_H.rcbuffer->pybuffer.buf = NULL;
  3856. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3857. } 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];
  3858. }
  3859. }
  3860. __pyx_t_8 = 0;
  3861. __pyx_v_H = ((PyArrayObject *)__pyx_t_5);
  3862. __pyx_t_5 = 0;
  3863. /* "scattnlay.pyx":130
  3864. * cdef np.ndarray[np.float64_t, ndim = 1] Hiz
  3865. *
  3866. * for i in range(x.shape[0]): # <<<<<<<<<<<<<<
  3867. * Erx = np.zeros(coords.shape[0], dtype = np.float64)
  3868. * Ery = np.zeros(coords.shape[0], dtype = np.float64)
  3869. */
  3870. __pyx_t_9 = (__pyx_v_x->dimensions[0]);
  3871. for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
  3872. __pyx_v_i = __pyx_t_10;
  3873. /* "scattnlay.pyx":131
  3874. *
  3875. * for i in range(x.shape[0]):
  3876. * Erx = np.zeros(coords.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  3877. * Ery = np.zeros(coords.shape[0], dtype = np.float64)
  3878. * Erz = np.zeros(coords.shape[0], dtype = np.float64)
  3879. */
  3880. __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;}
  3881. __Pyx_GOTREF(__pyx_t_5);
  3882. __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;}
  3883. __Pyx_GOTREF(__pyx_t_1);
  3884. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3885. __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 = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3886. __Pyx_GOTREF(__pyx_t_5);
  3887. __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;}
  3888. __Pyx_GOTREF(__pyx_t_3);
  3889. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  3890. __Pyx_GIVEREF(__pyx_t_5);
  3891. __pyx_t_5 = 0;
  3892. __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;}
  3893. __Pyx_GOTREF(__pyx_t_5);
  3894. __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;}
  3895. __Pyx_GOTREF(__pyx_t_2);
  3896. __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;}
  3897. __Pyx_GOTREF(__pyx_t_4);
  3898. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3899. 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;}
  3900. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3901. __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;}
  3902. __Pyx_GOTREF(__pyx_t_4);
  3903. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3904. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3905. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3906. 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;}
  3907. __pyx_t_11 = ((PyArrayObject *)__pyx_t_4);
  3908. {
  3909. __Pyx_BufFmt_StackElem __pyx_stack[1];
  3910. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Erx.rcbuffer->pybuffer);
  3911. __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);
  3912. if (unlikely(__pyx_t_12 < 0)) {
  3913. PyErr_Fetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
  3914. 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)) {
  3915. Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15);
  3916. __Pyx_RaiseBufferFallbackError();
  3917. } else {
  3918. PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
  3919. }
  3920. }
  3921. __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];
  3922. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3923. }
  3924. __pyx_t_11 = 0;
  3925. __Pyx_XDECREF_SET(__pyx_v_Erx, ((PyArrayObject *)__pyx_t_4));
  3926. __pyx_t_4 = 0;
  3927. /* "scattnlay.pyx":132
  3928. * for i in range(x.shape[0]):
  3929. * Erx = np.zeros(coords.shape[0], dtype = np.float64)
  3930. * Ery = np.zeros(coords.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  3931. * Erz = np.zeros(coords.shape[0], dtype = np.float64)
  3932. * Eix = np.zeros(coords.shape[0], dtype = np.float64)
  3933. */
  3934. __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;}
  3935. __Pyx_GOTREF(__pyx_t_4);
  3936. __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;}
  3937. __Pyx_GOTREF(__pyx_t_5);
  3938. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3939. __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 = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3940. __Pyx_GOTREF(__pyx_t_4);
  3941. __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;}
  3942. __Pyx_GOTREF(__pyx_t_3);
  3943. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  3944. __Pyx_GIVEREF(__pyx_t_4);
  3945. __pyx_t_4 = 0;
  3946. __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;}
  3947. __Pyx_GOTREF(__pyx_t_4);
  3948. __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;}
  3949. __Pyx_GOTREF(__pyx_t_1);
  3950. __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;}
  3951. __Pyx_GOTREF(__pyx_t_2);
  3952. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3953. 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;}
  3954. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3955. __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;}
  3956. __Pyx_GOTREF(__pyx_t_2);
  3957. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3958. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3959. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3960. 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;}
  3961. __pyx_t_16 = ((PyArrayObject *)__pyx_t_2);
  3962. {
  3963. __Pyx_BufFmt_StackElem __pyx_stack[1];
  3964. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Ery.rcbuffer->pybuffer);
  3965. __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);
  3966. if (unlikely(__pyx_t_12 < 0)) {
  3967. PyErr_Fetch(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
  3968. 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)) {
  3969. Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13);
  3970. __Pyx_RaiseBufferFallbackError();
  3971. } else {
  3972. PyErr_Restore(__pyx_t_15, __pyx_t_14, __pyx_t_13);
  3973. }
  3974. }
  3975. __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];
  3976. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3977. }
  3978. __pyx_t_16 = 0;
  3979. __Pyx_XDECREF_SET(__pyx_v_Ery, ((PyArrayObject *)__pyx_t_2));
  3980. __pyx_t_2 = 0;
  3981. /* "scattnlay.pyx":133
  3982. * Erx = np.zeros(coords.shape[0], dtype = np.float64)
  3983. * Ery = np.zeros(coords.shape[0], dtype = np.float64)
  3984. * Erz = np.zeros(coords.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  3985. * Eix = np.zeros(coords.shape[0], dtype = np.float64)
  3986. * Eiy = np.zeros(coords.shape[0], dtype = np.float64)
  3987. */
  3988. __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;}
  3989. __Pyx_GOTREF(__pyx_t_2);
  3990. __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;}
  3991. __Pyx_GOTREF(__pyx_t_4);
  3992. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3993. __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 = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3994. __Pyx_GOTREF(__pyx_t_2);
  3995. __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;}
  3996. __Pyx_GOTREF(__pyx_t_3);
  3997. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  3998. __Pyx_GIVEREF(__pyx_t_2);
  3999. __pyx_t_2 = 0;
  4000. __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;}
  4001. __Pyx_GOTREF(__pyx_t_2);
  4002. __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;}
  4003. __Pyx_GOTREF(__pyx_t_5);
  4004. __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;}
  4005. __Pyx_GOTREF(__pyx_t_1);
  4006. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4007. 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;}
  4008. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4009. __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;}
  4010. __Pyx_GOTREF(__pyx_t_1);
  4011. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4012. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4013. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4014. 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;}
  4015. __pyx_t_17 = ((PyArrayObject *)__pyx_t_1);
  4016. {
  4017. __Pyx_BufFmt_StackElem __pyx_stack[1];
  4018. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Erz.rcbuffer->pybuffer);
  4019. __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);
  4020. if (unlikely(__pyx_t_12 < 0)) {
  4021. PyErr_Fetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
  4022. 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)) {
  4023. Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15);
  4024. __Pyx_RaiseBufferFallbackError();
  4025. } else {
  4026. PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
  4027. }
  4028. }
  4029. __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];
  4030. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4031. }
  4032. __pyx_t_17 = 0;
  4033. __Pyx_XDECREF_SET(__pyx_v_Erz, ((PyArrayObject *)__pyx_t_1));
  4034. __pyx_t_1 = 0;
  4035. /* "scattnlay.pyx":134
  4036. * Ery = np.zeros(coords.shape[0], dtype = np.float64)
  4037. * Erz = np.zeros(coords.shape[0], dtype = np.float64)
  4038. * Eix = np.zeros(coords.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  4039. * Eiy = np.zeros(coords.shape[0], dtype = np.float64)
  4040. * Eiz = np.zeros(coords.shape[0], dtype = np.float64)
  4041. */
  4042. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4043. __Pyx_GOTREF(__pyx_t_1);
  4044. __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 = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4045. __Pyx_GOTREF(__pyx_t_2);
  4046. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4047. __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 = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4048. __Pyx_GOTREF(__pyx_t_1);
  4049. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4050. __Pyx_GOTREF(__pyx_t_3);
  4051. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  4052. __Pyx_GIVEREF(__pyx_t_1);
  4053. __pyx_t_1 = 0;
  4054. __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4055. __Pyx_GOTREF(__pyx_t_1);
  4056. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4057. __Pyx_GOTREF(__pyx_t_4);
  4058. __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 = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4059. __Pyx_GOTREF(__pyx_t_5);
  4060. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4061. if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4062. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4063. __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 = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4064. __Pyx_GOTREF(__pyx_t_5);
  4065. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4066. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4067. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4068. if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4069. __pyx_t_18 = ((PyArrayObject *)__pyx_t_5);
  4070. {
  4071. __Pyx_BufFmt_StackElem __pyx_stack[1];
  4072. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Eix.rcbuffer->pybuffer);
  4073. __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);
  4074. if (unlikely(__pyx_t_12 < 0)) {
  4075. PyErr_Fetch(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
  4076. 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)) {
  4077. Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13);
  4078. __Pyx_RaiseBufferFallbackError();
  4079. } else {
  4080. PyErr_Restore(__pyx_t_15, __pyx_t_14, __pyx_t_13);
  4081. }
  4082. }
  4083. __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];
  4084. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4085. }
  4086. __pyx_t_18 = 0;
  4087. __Pyx_XDECREF_SET(__pyx_v_Eix, ((PyArrayObject *)__pyx_t_5));
  4088. __pyx_t_5 = 0;
  4089. /* "scattnlay.pyx":135
  4090. * Erz = np.zeros(coords.shape[0], dtype = np.float64)
  4091. * Eix = np.zeros(coords.shape[0], dtype = np.float64)
  4092. * Eiy = np.zeros(coords.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  4093. * Eiz = np.zeros(coords.shape[0], dtype = np.float64)
  4094. * Hrx = np.zeros(coords.shape[0], dtype = np.float64)
  4095. */
  4096. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4097. __Pyx_GOTREF(__pyx_t_5);
  4098. __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 = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4099. __Pyx_GOTREF(__pyx_t_1);
  4100. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4101. __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 = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4102. __Pyx_GOTREF(__pyx_t_5);
  4103. __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;}
  4104. __Pyx_GOTREF(__pyx_t_3);
  4105. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  4106. __Pyx_GIVEREF(__pyx_t_5);
  4107. __pyx_t_5 = 0;
  4108. __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4109. __Pyx_GOTREF(__pyx_t_5);
  4110. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4111. __Pyx_GOTREF(__pyx_t_2);
  4112. __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 = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4113. __Pyx_GOTREF(__pyx_t_4);
  4114. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4115. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4116. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4117. __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 = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4118. __Pyx_GOTREF(__pyx_t_4);
  4119. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4120. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4121. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4122. if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4123. __pyx_t_19 = ((PyArrayObject *)__pyx_t_4);
  4124. {
  4125. __Pyx_BufFmt_StackElem __pyx_stack[1];
  4126. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Eiy.rcbuffer->pybuffer);
  4127. __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);
  4128. if (unlikely(__pyx_t_12 < 0)) {
  4129. PyErr_Fetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
  4130. 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)) {
  4131. Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15);
  4132. __Pyx_RaiseBufferFallbackError();
  4133. } else {
  4134. PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
  4135. }
  4136. }
  4137. __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];
  4138. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4139. }
  4140. __pyx_t_19 = 0;
  4141. __Pyx_XDECREF_SET(__pyx_v_Eiy, ((PyArrayObject *)__pyx_t_4));
  4142. __pyx_t_4 = 0;
  4143. /* "scattnlay.pyx":136
  4144. * Eix = np.zeros(coords.shape[0], dtype = np.float64)
  4145. * Eiy = np.zeros(coords.shape[0], dtype = np.float64)
  4146. * Eiz = np.zeros(coords.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  4147. * Hrx = np.zeros(coords.shape[0], dtype = np.float64)
  4148. * Hry = np.zeros(coords.shape[0], dtype = np.float64)
  4149. */
  4150. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4151. __Pyx_GOTREF(__pyx_t_4);
  4152. __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 = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4153. __Pyx_GOTREF(__pyx_t_5);
  4154. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4155. __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 = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4156. __Pyx_GOTREF(__pyx_t_4);
  4157. __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;}
  4158. __Pyx_GOTREF(__pyx_t_3);
  4159. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  4160. __Pyx_GIVEREF(__pyx_t_4);
  4161. __pyx_t_4 = 0;
  4162. __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4163. __Pyx_GOTREF(__pyx_t_4);
  4164. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4165. __Pyx_GOTREF(__pyx_t_1);
  4166. __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 = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4167. __Pyx_GOTREF(__pyx_t_2);
  4168. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4169. if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4170. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4171. __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 = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4172. __Pyx_GOTREF(__pyx_t_2);
  4173. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4174. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4175. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4176. if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4177. __pyx_t_20 = ((PyArrayObject *)__pyx_t_2);
  4178. {
  4179. __Pyx_BufFmt_StackElem __pyx_stack[1];
  4180. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Eiz.rcbuffer->pybuffer);
  4181. __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);
  4182. if (unlikely(__pyx_t_12 < 0)) {
  4183. PyErr_Fetch(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
  4184. 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)) {
  4185. Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13);
  4186. __Pyx_RaiseBufferFallbackError();
  4187. } else {
  4188. PyErr_Restore(__pyx_t_15, __pyx_t_14, __pyx_t_13);
  4189. }
  4190. }
  4191. __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];
  4192. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4193. }
  4194. __pyx_t_20 = 0;
  4195. __Pyx_XDECREF_SET(__pyx_v_Eiz, ((PyArrayObject *)__pyx_t_2));
  4196. __pyx_t_2 = 0;
  4197. /* "scattnlay.pyx":137
  4198. * Eiy = np.zeros(coords.shape[0], dtype = np.float64)
  4199. * Eiz = np.zeros(coords.shape[0], dtype = np.float64)
  4200. * Hrx = np.zeros(coords.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  4201. * Hry = np.zeros(coords.shape[0], dtype = np.float64)
  4202. * Hrz = np.zeros(coords.shape[0], dtype = np.float64)
  4203. */
  4204. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4205. __Pyx_GOTREF(__pyx_t_2);
  4206. __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 = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4207. __Pyx_GOTREF(__pyx_t_4);
  4208. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4209. __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 = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4210. __Pyx_GOTREF(__pyx_t_2);
  4211. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4212. __Pyx_GOTREF(__pyx_t_3);
  4213. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  4214. __Pyx_GIVEREF(__pyx_t_2);
  4215. __pyx_t_2 = 0;
  4216. __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4217. __Pyx_GOTREF(__pyx_t_2);
  4218. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4219. __Pyx_GOTREF(__pyx_t_5);
  4220. __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 = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4221. __Pyx_GOTREF(__pyx_t_1);
  4222. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4223. if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4224. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4225. __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 = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4226. __Pyx_GOTREF(__pyx_t_1);
  4227. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4228. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4229. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4230. if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4231. __pyx_t_21 = ((PyArrayObject *)__pyx_t_1);
  4232. {
  4233. __Pyx_BufFmt_StackElem __pyx_stack[1];
  4234. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hrx.rcbuffer->pybuffer);
  4235. __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);
  4236. if (unlikely(__pyx_t_12 < 0)) {
  4237. PyErr_Fetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
  4238. 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)) {
  4239. Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15);
  4240. __Pyx_RaiseBufferFallbackError();
  4241. } else {
  4242. PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
  4243. }
  4244. }
  4245. __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];
  4246. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4247. }
  4248. __pyx_t_21 = 0;
  4249. __Pyx_XDECREF_SET(__pyx_v_Hrx, ((PyArrayObject *)__pyx_t_1));
  4250. __pyx_t_1 = 0;
  4251. /* "scattnlay.pyx":138
  4252. * Eiz = np.zeros(coords.shape[0], dtype = np.float64)
  4253. * Hrx = np.zeros(coords.shape[0], dtype = np.float64)
  4254. * Hry = np.zeros(coords.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  4255. * Hrz = np.zeros(coords.shape[0], dtype = np.float64)
  4256. * Hix = np.zeros(coords.shape[0], dtype = np.float64)
  4257. */
  4258. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4259. __Pyx_GOTREF(__pyx_t_1);
  4260. __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 = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4261. __Pyx_GOTREF(__pyx_t_2);
  4262. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4263. __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 = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4264. __Pyx_GOTREF(__pyx_t_1);
  4265. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4266. __Pyx_GOTREF(__pyx_t_3);
  4267. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  4268. __Pyx_GIVEREF(__pyx_t_1);
  4269. __pyx_t_1 = 0;
  4270. __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4271. __Pyx_GOTREF(__pyx_t_1);
  4272. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4273. __Pyx_GOTREF(__pyx_t_4);
  4274. __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 = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4275. __Pyx_GOTREF(__pyx_t_5);
  4276. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4277. if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4278. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4279. __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 = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4280. __Pyx_GOTREF(__pyx_t_5);
  4281. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4282. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4283. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4284. if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4285. __pyx_t_22 = ((PyArrayObject *)__pyx_t_5);
  4286. {
  4287. __Pyx_BufFmt_StackElem __pyx_stack[1];
  4288. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hry.rcbuffer->pybuffer);
  4289. __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);
  4290. if (unlikely(__pyx_t_12 < 0)) {
  4291. PyErr_Fetch(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
  4292. 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)) {
  4293. Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13);
  4294. __Pyx_RaiseBufferFallbackError();
  4295. } else {
  4296. PyErr_Restore(__pyx_t_15, __pyx_t_14, __pyx_t_13);
  4297. }
  4298. }
  4299. __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];
  4300. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4301. }
  4302. __pyx_t_22 = 0;
  4303. __Pyx_XDECREF_SET(__pyx_v_Hry, ((PyArrayObject *)__pyx_t_5));
  4304. __pyx_t_5 = 0;
  4305. /* "scattnlay.pyx":139
  4306. * Hrx = np.zeros(coords.shape[0], dtype = np.float64)
  4307. * Hry = np.zeros(coords.shape[0], dtype = np.float64)
  4308. * Hrz = np.zeros(coords.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  4309. * Hix = np.zeros(coords.shape[0], dtype = np.float64)
  4310. * Hiy = np.zeros(coords.shape[0], dtype = np.float64)
  4311. */
  4312. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4313. __Pyx_GOTREF(__pyx_t_5);
  4314. __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 = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4315. __Pyx_GOTREF(__pyx_t_1);
  4316. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4317. __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 = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4318. __Pyx_GOTREF(__pyx_t_5);
  4319. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4320. __Pyx_GOTREF(__pyx_t_3);
  4321. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  4322. __Pyx_GIVEREF(__pyx_t_5);
  4323. __pyx_t_5 = 0;
  4324. __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4325. __Pyx_GOTREF(__pyx_t_5);
  4326. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4327. __Pyx_GOTREF(__pyx_t_2);
  4328. __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 = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4329. __Pyx_GOTREF(__pyx_t_4);
  4330. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4331. if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4332. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4333. __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 = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4334. __Pyx_GOTREF(__pyx_t_4);
  4335. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4336. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4337. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4338. if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4339. __pyx_t_23 = ((PyArrayObject *)__pyx_t_4);
  4340. {
  4341. __Pyx_BufFmt_StackElem __pyx_stack[1];
  4342. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hrz.rcbuffer->pybuffer);
  4343. __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);
  4344. if (unlikely(__pyx_t_12 < 0)) {
  4345. PyErr_Fetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
  4346. 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)) {
  4347. Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15);
  4348. __Pyx_RaiseBufferFallbackError();
  4349. } else {
  4350. PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
  4351. }
  4352. }
  4353. __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];
  4354. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4355. }
  4356. __pyx_t_23 = 0;
  4357. __Pyx_XDECREF_SET(__pyx_v_Hrz, ((PyArrayObject *)__pyx_t_4));
  4358. __pyx_t_4 = 0;
  4359. /* "scattnlay.pyx":140
  4360. * Hry = np.zeros(coords.shape[0], dtype = np.float64)
  4361. * Hrz = np.zeros(coords.shape[0], dtype = np.float64)
  4362. * Hix = np.zeros(coords.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  4363. * Hiy = np.zeros(coords.shape[0], dtype = np.float64)
  4364. * Hiz = np.zeros(coords.shape[0], dtype = np.float64)
  4365. */
  4366. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4367. __Pyx_GOTREF(__pyx_t_4);
  4368. __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 = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4369. __Pyx_GOTREF(__pyx_t_5);
  4370. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4371. __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 = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4372. __Pyx_GOTREF(__pyx_t_4);
  4373. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4374. __Pyx_GOTREF(__pyx_t_3);
  4375. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  4376. __Pyx_GIVEREF(__pyx_t_4);
  4377. __pyx_t_4 = 0;
  4378. __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4379. __Pyx_GOTREF(__pyx_t_4);
  4380. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4381. __Pyx_GOTREF(__pyx_t_1);
  4382. __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 = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4383. __Pyx_GOTREF(__pyx_t_2);
  4384. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4385. if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4386. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4387. __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 = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4388. __Pyx_GOTREF(__pyx_t_2);
  4389. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4390. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4391. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4392. if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4393. __pyx_t_24 = ((PyArrayObject *)__pyx_t_2);
  4394. {
  4395. __Pyx_BufFmt_StackElem __pyx_stack[1];
  4396. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hix.rcbuffer->pybuffer);
  4397. __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);
  4398. if (unlikely(__pyx_t_12 < 0)) {
  4399. PyErr_Fetch(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
  4400. 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)) {
  4401. Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13);
  4402. __Pyx_RaiseBufferFallbackError();
  4403. } else {
  4404. PyErr_Restore(__pyx_t_15, __pyx_t_14, __pyx_t_13);
  4405. }
  4406. }
  4407. __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];
  4408. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4409. }
  4410. __pyx_t_24 = 0;
  4411. __Pyx_XDECREF_SET(__pyx_v_Hix, ((PyArrayObject *)__pyx_t_2));
  4412. __pyx_t_2 = 0;
  4413. /* "scattnlay.pyx":141
  4414. * Hrz = np.zeros(coords.shape[0], dtype = np.float64)
  4415. * Hix = np.zeros(coords.shape[0], dtype = np.float64)
  4416. * Hiy = np.zeros(coords.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  4417. * Hiz = np.zeros(coords.shape[0], dtype = np.float64)
  4418. *
  4419. */
  4420. __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4421. __Pyx_GOTREF(__pyx_t_2);
  4422. __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 = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4423. __Pyx_GOTREF(__pyx_t_4);
  4424. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4425. __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 = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4426. __Pyx_GOTREF(__pyx_t_2);
  4427. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4428. __Pyx_GOTREF(__pyx_t_3);
  4429. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  4430. __Pyx_GIVEREF(__pyx_t_2);
  4431. __pyx_t_2 = 0;
  4432. __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4433. __Pyx_GOTREF(__pyx_t_2);
  4434. __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4435. __Pyx_GOTREF(__pyx_t_5);
  4436. __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 = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4437. __Pyx_GOTREF(__pyx_t_1);
  4438. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4439. if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4440. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4441. __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 = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4442. __Pyx_GOTREF(__pyx_t_1);
  4443. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4444. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4445. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4446. if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4447. __pyx_t_25 = ((PyArrayObject *)__pyx_t_1);
  4448. {
  4449. __Pyx_BufFmt_StackElem __pyx_stack[1];
  4450. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hiy.rcbuffer->pybuffer);
  4451. __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);
  4452. if (unlikely(__pyx_t_12 < 0)) {
  4453. PyErr_Fetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
  4454. 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)) {
  4455. Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15);
  4456. __Pyx_RaiseBufferFallbackError();
  4457. } else {
  4458. PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
  4459. }
  4460. }
  4461. __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];
  4462. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4463. }
  4464. __pyx_t_25 = 0;
  4465. __Pyx_XDECREF_SET(__pyx_v_Hiy, ((PyArrayObject *)__pyx_t_1));
  4466. __pyx_t_1 = 0;
  4467. /* "scattnlay.pyx":142
  4468. * Hix = np.zeros(coords.shape[0], dtype = np.float64)
  4469. * Hiy = np.zeros(coords.shape[0], dtype = np.float64)
  4470. * Hiz = np.zeros(coords.shape[0], dtype = np.float64) # <<<<<<<<<<<<<<
  4471. *
  4472. * 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))
  4473. */
  4474. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4475. __Pyx_GOTREF(__pyx_t_1);
  4476. __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 = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4477. __Pyx_GOTREF(__pyx_t_2);
  4478. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4479. __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 = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4480. __Pyx_GOTREF(__pyx_t_1);
  4481. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4482. __Pyx_GOTREF(__pyx_t_3);
  4483. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  4484. __Pyx_GIVEREF(__pyx_t_1);
  4485. __pyx_t_1 = 0;
  4486. __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4487. __Pyx_GOTREF(__pyx_t_1);
  4488. __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4489. __Pyx_GOTREF(__pyx_t_4);
  4490. __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 = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4491. __Pyx_GOTREF(__pyx_t_5);
  4492. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4493. if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4494. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4495. __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 = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4496. __Pyx_GOTREF(__pyx_t_5);
  4497. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4498. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4499. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4500. if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4501. __pyx_t_26 = ((PyArrayObject *)__pyx_t_5);
  4502. {
  4503. __Pyx_BufFmt_StackElem __pyx_stack[1];
  4504. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hiz.rcbuffer->pybuffer);
  4505. __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);
  4506. if (unlikely(__pyx_t_12 < 0)) {
  4507. PyErr_Fetch(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
  4508. 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)) {
  4509. Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13);
  4510. __Pyx_RaiseBufferFallbackError();
  4511. } else {
  4512. PyErr_Restore(__pyx_t_15, __pyx_t_14, __pyx_t_13);
  4513. }
  4514. }
  4515. __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];
  4516. if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4517. }
  4518. __pyx_t_26 = 0;
  4519. __Pyx_XDECREF_SET(__pyx_v_Hiz, ((PyArrayObject *)__pyx_t_5));
  4520. __pyx_t_5 = 0;
  4521. /* "scattnlay.pyx":144
  4522. * Hiz = np.zeros(coords.shape[0], dtype = np.float64)
  4523. *
  4524. * 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)) # <<<<<<<<<<<<<<
  4525. *
  4526. * 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()
  4527. */
  4528. __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 = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  4529. __Pyx_GOTREF(__pyx_t_5);
  4530. __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 = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4531. __Pyx_GOTREF(__pyx_t_1);
  4532. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4533. __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 = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4534. __Pyx_GOTREF(__pyx_t_5);
  4535. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4536. __pyx_t_27 = __pyx_convert_vector_from_py_double(__pyx_t_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4537. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4538. __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 = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  4539. __Pyx_GOTREF(__pyx_t_5);
  4540. __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 = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4541. __Pyx_GOTREF(__pyx_t_1);
  4542. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4543. __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 = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4544. __Pyx_GOTREF(__pyx_t_5);
  4545. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4546. __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 = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4547. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4548. __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 = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  4549. __Pyx_GOTREF(__pyx_t_5);
  4550. __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 = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4551. __Pyx_GOTREF(__pyx_t_1);
  4552. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4553. __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 = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4554. __Pyx_GOTREF(__pyx_t_5);
  4555. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4556. __pyx_t_29 = __pyx_convert_vector_from_py_double(__pyx_t_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4557. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4558. __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 = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  4559. __Pyx_GOTREF(__pyx_t_5);
  4560. __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 = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4561. __Pyx_GOTREF(__pyx_t_1);
  4562. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4563. __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 = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4564. __Pyx_GOTREF(__pyx_t_5);
  4565. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4566. __pyx_t_30 = __pyx_convert_vector_from_py_double(__pyx_t_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4567. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4568. __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 = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  4569. __Pyx_GOTREF(__pyx_t_5);
  4570. __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 = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4571. __Pyx_GOTREF(__pyx_t_1);
  4572. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4573. __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 = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4574. __Pyx_GOTREF(__pyx_t_5);
  4575. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4576. __pyx_t_31 = __pyx_convert_vector_from_py_double(__pyx_t_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4577. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4578. __pyx_t_32 = __pyx_v_i;
  4579. __pyx_t_12 = -1;
  4580. if (__pyx_t_32 < 0) {
  4581. __pyx_t_32 += __pyx_pybuffernd_terms.diminfo[0].shape;
  4582. if (unlikely(__pyx_t_32 < 0)) __pyx_t_12 = 0;
  4583. } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_terms.diminfo[0].shape)) __pyx_t_12 = 0;
  4584. if (unlikely(__pyx_t_12 != -1)) {
  4585. __Pyx_RaiseBufferIndexError(__pyx_t_12);
  4586. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4587. }
  4588. *__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_9scattnlay_npy2c(((PyArrayObject *)__pyx_v_Erx)), __pyx_f_9scattnlay_npy2c(((PyArrayObject *)__pyx_v_Ery)), __pyx_f_9scattnlay_npy2c(((PyArrayObject *)__pyx_v_Erz)), __pyx_f_9scattnlay_npy2c(((PyArrayObject *)__pyx_v_Eix)), __pyx_f_9scattnlay_npy2c(((PyArrayObject *)__pyx_v_Eiy)), __pyx_f_9scattnlay_npy2c(((PyArrayObject *)__pyx_v_Eiz)), __pyx_f_9scattnlay_npy2c(((PyArrayObject *)__pyx_v_Hrx)), __pyx_f_9scattnlay_npy2c(((PyArrayObject *)__pyx_v_Hry)), __pyx_f_9scattnlay_npy2c(((PyArrayObject *)__pyx_v_Hrz)), __pyx_f_9scattnlay_npy2c(((PyArrayObject *)__pyx_v_Hix)), __pyx_f_9scattnlay_npy2c(((PyArrayObject *)__pyx_v_Hiy)), __pyx_f_9scattnlay_npy2c(((PyArrayObject *)__pyx_v_Hiz)));
  4589. /* "scattnlay.pyx":146
  4590. * 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))
  4591. *
  4592. * 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() # <<<<<<<<<<<<<<
  4593. * 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()
  4594. *
  4595. */
  4596. __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4597. __Pyx_GOTREF(__pyx_t_3);
  4598. __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 = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4599. __Pyx_GOTREF(__pyx_t_2);
  4600. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4601. __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 = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4602. __Pyx_GOTREF(__pyx_t_3);
  4603. __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 = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4604. __Pyx_GOTREF(__pyx_t_4);
  4605. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4606. __pyx_t_3 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4607. __Pyx_GOTREF(__pyx_t_3);
  4608. __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 = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4609. __Pyx_GOTREF(__pyx_t_33);
  4610. __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 = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4611. __Pyx_GOTREF(__pyx_t_34);
  4612. __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  4613. __pyx_t_33 = PyNumber_Multiply(__pyx_t_3, __pyx_t_34); if (unlikely(!__pyx_t_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4614. __Pyx_GOTREF(__pyx_t_33);
  4615. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4616. __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
  4617. __pyx_t_34 = PyNumber_Add(__pyx_t_4, __pyx_t_33); if (unlikely(!__pyx_t_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4618. __Pyx_GOTREF(__pyx_t_34);
  4619. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4620. __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  4621. __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 = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4622. __Pyx_GOTREF(__pyx_t_33);
  4623. __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 = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4624. __Pyx_GOTREF(__pyx_t_4);
  4625. __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  4626. __pyx_t_33 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4627. __Pyx_GOTREF(__pyx_t_33);
  4628. __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 = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4629. __Pyx_GOTREF(__pyx_t_3);
  4630. __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 = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4631. __Pyx_GOTREF(__pyx_t_35);
  4632. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4633. __pyx_t_3 = PyNumber_Multiply(__pyx_t_33, __pyx_t_35); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4634. __Pyx_GOTREF(__pyx_t_3);
  4635. __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  4636. __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0;
  4637. __pyx_t_35 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4638. __Pyx_GOTREF(__pyx_t_35);
  4639. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4640. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4641. __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 = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4642. __Pyx_GOTREF(__pyx_t_3);
  4643. __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 = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4644. __Pyx_GOTREF(__pyx_t_4);
  4645. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4646. __pyx_t_3 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4647. __Pyx_GOTREF(__pyx_t_3);
  4648. __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 = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4649. __Pyx_GOTREF(__pyx_t_33);
  4650. __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 = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4651. __Pyx_GOTREF(__pyx_t_36);
  4652. __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  4653. __pyx_t_33 = PyNumber_Multiply(__pyx_t_3, __pyx_t_36); if (unlikely(!__pyx_t_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4654. __Pyx_GOTREF(__pyx_t_33);
  4655. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4656. __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
  4657. __pyx_t_36 = PyNumber_Add(__pyx_t_4, __pyx_t_33); if (unlikely(!__pyx_t_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4658. __Pyx_GOTREF(__pyx_t_36);
  4659. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4660. __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  4661. __pyx_t_33 = PyTuple_New(3); if (unlikely(!__pyx_t_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4662. __Pyx_GOTREF(__pyx_t_33);
  4663. PyTuple_SET_ITEM(__pyx_t_33, 0, __pyx_t_34);
  4664. __Pyx_GIVEREF(__pyx_t_34);
  4665. PyTuple_SET_ITEM(__pyx_t_33, 1, __pyx_t_35);
  4666. __Pyx_GIVEREF(__pyx_t_35);
  4667. PyTuple_SET_ITEM(__pyx_t_33, 2, __pyx_t_36);
  4668. __Pyx_GIVEREF(__pyx_t_36);
  4669. __pyx_t_34 = 0;
  4670. __pyx_t_35 = 0;
  4671. __pyx_t_36 = 0;
  4672. __pyx_t_36 = NULL;
  4673. if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
  4674. __pyx_t_36 = PyMethod_GET_SELF(__pyx_t_2);
  4675. if (likely(__pyx_t_36)) {
  4676. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  4677. __Pyx_INCREF(__pyx_t_36);
  4678. __Pyx_INCREF(function);
  4679. __Pyx_DECREF_SET(__pyx_t_2, function);
  4680. }
  4681. }
  4682. if (!__pyx_t_36) {
  4683. __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_33); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4684. __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  4685. __Pyx_GOTREF(__pyx_t_1);
  4686. } else {
  4687. __pyx_t_35 = PyTuple_New(1+1); if (unlikely(!__pyx_t_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4688. __Pyx_GOTREF(__pyx_t_35);
  4689. PyTuple_SET_ITEM(__pyx_t_35, 0, __pyx_t_36); __Pyx_GIVEREF(__pyx_t_36); __pyx_t_36 = NULL;
  4690. PyTuple_SET_ITEM(__pyx_t_35, 0+1, __pyx_t_33);
  4691. __Pyx_GIVEREF(__pyx_t_33);
  4692. __pyx_t_33 = 0;
  4693. __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 = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4694. __Pyx_GOTREF(__pyx_t_1);
  4695. __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0;
  4696. }
  4697. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4698. __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 = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4699. __Pyx_GOTREF(__pyx_t_2);
  4700. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4701. __pyx_t_1 = NULL;
  4702. if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
  4703. __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
  4704. if (likely(__pyx_t_1)) {
  4705. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  4706. __Pyx_INCREF(__pyx_t_1);
  4707. __Pyx_INCREF(function);
  4708. __Pyx_DECREF_SET(__pyx_t_2, function);
  4709. }
  4710. }
  4711. if (__pyx_t_1) {
  4712. __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4713. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4714. } else {
  4715. __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4716. }
  4717. __Pyx_GOTREF(__pyx_t_5);
  4718. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4719. 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 = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4720. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4721. /* "scattnlay.pyx":147
  4722. *
  4723. * 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()
  4724. * 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() # <<<<<<<<<<<<<<
  4725. *
  4726. * return terms, E, H
  4727. */
  4728. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4729. __Pyx_GOTREF(__pyx_t_1);
  4730. __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 = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4731. __Pyx_GOTREF(__pyx_t_35);
  4732. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4733. __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 = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4734. __Pyx_GOTREF(__pyx_t_1);
  4735. __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 = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4736. __Pyx_GOTREF(__pyx_t_33);
  4737. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4738. __pyx_t_1 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4739. __Pyx_GOTREF(__pyx_t_1);
  4740. __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 = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4741. __Pyx_GOTREF(__pyx_t_36);
  4742. __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 = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4743. __Pyx_GOTREF(__pyx_t_34);
  4744. __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
  4745. __pyx_t_36 = PyNumber_Multiply(__pyx_t_1, __pyx_t_34); if (unlikely(!__pyx_t_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4746. __Pyx_GOTREF(__pyx_t_36);
  4747. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4748. __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
  4749. __pyx_t_34 = PyNumber_Add(__pyx_t_33, __pyx_t_36); if (unlikely(!__pyx_t_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4750. __Pyx_GOTREF(__pyx_t_34);
  4751. __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  4752. __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
  4753. __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 = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4754. __Pyx_GOTREF(__pyx_t_36);
  4755. __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 = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4756. __Pyx_GOTREF(__pyx_t_33);
  4757. __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
  4758. __pyx_t_36 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4759. __Pyx_GOTREF(__pyx_t_36);
  4760. __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 = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4761. __Pyx_GOTREF(__pyx_t_1);
  4762. __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 = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4763. __Pyx_GOTREF(__pyx_t_4);
  4764. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4765. __pyx_t_1 = PyNumber_Multiply(__pyx_t_36, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4766. __Pyx_GOTREF(__pyx_t_1);
  4767. __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
  4768. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4769. __pyx_t_4 = PyNumber_Add(__pyx_t_33, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4770. __Pyx_GOTREF(__pyx_t_4);
  4771. __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  4772. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4773. __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 = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4774. __Pyx_GOTREF(__pyx_t_1);
  4775. __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 = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4776. __Pyx_GOTREF(__pyx_t_33);
  4777. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4778. __pyx_t_1 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4779. __Pyx_GOTREF(__pyx_t_1);
  4780. __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 = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4781. __Pyx_GOTREF(__pyx_t_36);
  4782. __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 = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4783. __Pyx_GOTREF(__pyx_t_3);
  4784. __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
  4785. __pyx_t_36 = PyNumber_Multiply(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4786. __Pyx_GOTREF(__pyx_t_36);
  4787. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4788. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4789. __pyx_t_3 = PyNumber_Add(__pyx_t_33, __pyx_t_36); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4790. __Pyx_GOTREF(__pyx_t_3);
  4791. __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  4792. __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
  4793. __pyx_t_36 = PyTuple_New(3); if (unlikely(!__pyx_t_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4794. __Pyx_GOTREF(__pyx_t_36);
  4795. PyTuple_SET_ITEM(__pyx_t_36, 0, __pyx_t_34);
  4796. __Pyx_GIVEREF(__pyx_t_34);
  4797. PyTuple_SET_ITEM(__pyx_t_36, 1, __pyx_t_4);
  4798. __Pyx_GIVEREF(__pyx_t_4);
  4799. PyTuple_SET_ITEM(__pyx_t_36, 2, __pyx_t_3);
  4800. __Pyx_GIVEREF(__pyx_t_3);
  4801. __pyx_t_34 = 0;
  4802. __pyx_t_4 = 0;
  4803. __pyx_t_3 = 0;
  4804. __pyx_t_3 = NULL;
  4805. if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_35))) {
  4806. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_35);
  4807. if (likely(__pyx_t_3)) {
  4808. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_35);
  4809. __Pyx_INCREF(__pyx_t_3);
  4810. __Pyx_INCREF(function);
  4811. __Pyx_DECREF_SET(__pyx_t_35, function);
  4812. }
  4813. }
  4814. if (!__pyx_t_3) {
  4815. __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_35, __pyx_t_36); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4816. __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0;
  4817. __Pyx_GOTREF(__pyx_t_2);
  4818. } else {
  4819. __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4820. __Pyx_GOTREF(__pyx_t_4);
  4821. PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
  4822. PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_36);
  4823. __Pyx_GIVEREF(__pyx_t_36);
  4824. __pyx_t_36 = 0;
  4825. __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 = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4826. __Pyx_GOTREF(__pyx_t_2);
  4827. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4828. }
  4829. __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0;
  4830. __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 = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4831. __Pyx_GOTREF(__pyx_t_35);
  4832. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4833. __pyx_t_2 = NULL;
  4834. if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_35))) {
  4835. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_35);
  4836. if (likely(__pyx_t_2)) {
  4837. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_35);
  4838. __Pyx_INCREF(__pyx_t_2);
  4839. __Pyx_INCREF(function);
  4840. __Pyx_DECREF_SET(__pyx_t_35, function);
  4841. }
  4842. }
  4843. if (__pyx_t_2) {
  4844. __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_35, __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4845. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4846. } else {
  4847. __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_35); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4848. }
  4849. __Pyx_GOTREF(__pyx_t_5);
  4850. __Pyx_DECREF(__pyx_t_35); __pyx_t_35 = 0;
  4851. 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 = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4852. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4853. }
  4854. /* "scattnlay.pyx":149
  4855. * 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()
  4856. *
  4857. * return terms, E, H # <<<<<<<<<<<<<<
  4858. *
  4859. */
  4860. __Pyx_XDECREF(__pyx_r);
  4861. __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4862. __Pyx_GOTREF(__pyx_t_5);
  4863. __Pyx_INCREF(((PyObject *)__pyx_v_terms));
  4864. PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_terms));
  4865. __Pyx_GIVEREF(((PyObject *)__pyx_v_terms));
  4866. __Pyx_INCREF(((PyObject *)__pyx_v_E));
  4867. PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_E));
  4868. __Pyx_GIVEREF(((PyObject *)__pyx_v_E));
  4869. __Pyx_INCREF(((PyObject *)__pyx_v_H));
  4870. PyTuple_SET_ITEM(__pyx_t_5, 2, ((PyObject *)__pyx_v_H));
  4871. __Pyx_GIVEREF(((PyObject *)__pyx_v_H));
  4872. __pyx_r = __pyx_t_5;
  4873. __pyx_t_5 = 0;
  4874. goto __pyx_L0;
  4875. /* "scattnlay.pyx":109
  4876. * return terms, Qext, Qsca, Qabs, Qbk, Qpr, g, Albedo, S1, S2
  4877. *
  4878. * 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): # <<<<<<<<<<<<<<
  4879. * cdef Py_ssize_t i
  4880. *
  4881. */
  4882. /* function exit code */
  4883. __pyx_L1_error:;
  4884. __Pyx_XDECREF(__pyx_t_1);
  4885. __Pyx_XDECREF(__pyx_t_2);
  4886. __Pyx_XDECREF(__pyx_t_3);
  4887. __Pyx_XDECREF(__pyx_t_4);
  4888. __Pyx_XDECREF(__pyx_t_5);
  4889. __Pyx_XDECREF(__pyx_t_33);
  4890. __Pyx_XDECREF(__pyx_t_34);
  4891. __Pyx_XDECREF(__pyx_t_35);
  4892. __Pyx_XDECREF(__pyx_t_36);
  4893. { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
  4894. __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
  4895. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_E.rcbuffer->pybuffer);
  4896. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Eix.rcbuffer->pybuffer);
  4897. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Eiy.rcbuffer->pybuffer);
  4898. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Eiz.rcbuffer->pybuffer);
  4899. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Erx.rcbuffer->pybuffer);
  4900. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Ery.rcbuffer->pybuffer);
  4901. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Erz.rcbuffer->pybuffer);
  4902. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_H.rcbuffer->pybuffer);
  4903. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hix.rcbuffer->pybuffer);
  4904. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hiy.rcbuffer->pybuffer);
  4905. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hiz.rcbuffer->pybuffer);
  4906. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hrx.rcbuffer->pybuffer);
  4907. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hry.rcbuffer->pybuffer);
  4908. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hrz.rcbuffer->pybuffer);
  4909. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coords.rcbuffer->pybuffer);
  4910. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_m.rcbuffer->pybuffer);
  4911. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_terms.rcbuffer->pybuffer);
  4912. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
  4913. __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  4914. __Pyx_AddTraceback("scattnlay.fieldnlay", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4915. __pyx_r = NULL;
  4916. goto __pyx_L2;
  4917. __pyx_L0:;
  4918. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_E.rcbuffer->pybuffer);
  4919. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Eix.rcbuffer->pybuffer);
  4920. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Eiy.rcbuffer->pybuffer);
  4921. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Eiz.rcbuffer->pybuffer);
  4922. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Erx.rcbuffer->pybuffer);
  4923. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Ery.rcbuffer->pybuffer);
  4924. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Erz.rcbuffer->pybuffer);
  4925. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_H.rcbuffer->pybuffer);
  4926. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hix.rcbuffer->pybuffer);
  4927. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hiy.rcbuffer->pybuffer);
  4928. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hiz.rcbuffer->pybuffer);
  4929. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hrx.rcbuffer->pybuffer);
  4930. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hry.rcbuffer->pybuffer);
  4931. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Hrz.rcbuffer->pybuffer);
  4932. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coords.rcbuffer->pybuffer);
  4933. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_m.rcbuffer->pybuffer);
  4934. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_terms.rcbuffer->pybuffer);
  4935. __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
  4936. __pyx_L2:;
  4937. __Pyx_XDECREF((PyObject *)__pyx_v_terms);
  4938. __Pyx_XDECREF((PyObject *)__pyx_v_E);
  4939. __Pyx_XDECREF((PyObject *)__pyx_v_H);
  4940. __Pyx_XDECREF((PyObject *)__pyx_v_Erx);
  4941. __Pyx_XDECREF((PyObject *)__pyx_v_Ery);
  4942. __Pyx_XDECREF((PyObject *)__pyx_v_Erz);
  4943. __Pyx_XDECREF((PyObject *)__pyx_v_Eix);
  4944. __Pyx_XDECREF((PyObject *)__pyx_v_Eiy);
  4945. __Pyx_XDECREF((PyObject *)__pyx_v_Eiz);
  4946. __Pyx_XDECREF((PyObject *)__pyx_v_Hrx);
  4947. __Pyx_XDECREF((PyObject *)__pyx_v_Hry);
  4948. __Pyx_XDECREF((PyObject *)__pyx_v_Hrz);
  4949. __Pyx_XDECREF((PyObject *)__pyx_v_Hix);
  4950. __Pyx_XDECREF((PyObject *)__pyx_v_Hiy);
  4951. __Pyx_XDECREF((PyObject *)__pyx_v_Hiz);
  4952. __Pyx_XGIVEREF(__pyx_r);
  4953. __Pyx_RefNannyFinishContext();
  4954. return __pyx_r;
  4955. }
  4956. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":197
  4957. * # experimental exception made for __getbuffer__ and __releasebuffer__
  4958. * # -- the details of this may change.
  4959. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
  4960. * # This implementation of getbuffer is geared towards Cython
  4961. * # requirements, and does not yet fullfill the PEP.
  4962. */
  4963. /* Python wrapper */
  4964. static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
  4965. static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  4966. int __pyx_r;
  4967. __Pyx_RefNannyDeclarations
  4968. __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  4969. __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
  4970. /* function exit code */
  4971. __Pyx_RefNannyFinishContext();
  4972. return __pyx_r;
  4973. }
  4974. static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  4975. int __pyx_v_copy_shape;
  4976. int __pyx_v_i;
  4977. int __pyx_v_ndim;
  4978. int __pyx_v_endian_detector;
  4979. int __pyx_v_little_endian;
  4980. int __pyx_v_t;
  4981. char *__pyx_v_f;
  4982. PyArray_Descr *__pyx_v_descr = 0;
  4983. int __pyx_v_offset;
  4984. int __pyx_v_hasfields;
  4985. int __pyx_r;
  4986. __Pyx_RefNannyDeclarations
  4987. int __pyx_t_1;
  4988. int __pyx_t_2;
  4989. PyObject *__pyx_t_3 = NULL;
  4990. int __pyx_t_4;
  4991. int __pyx_t_5;
  4992. PyObject *__pyx_t_6 = NULL;
  4993. char *__pyx_t_7;
  4994. int __pyx_lineno = 0;
  4995. const char *__pyx_filename = NULL;
  4996. int __pyx_clineno = 0;
  4997. __Pyx_RefNannySetupContext("__getbuffer__", 0);
  4998. if (__pyx_v_info != NULL) {
  4999. __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
  5000. __Pyx_GIVEREF(__pyx_v_info->obj);
  5001. }
  5002. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":203
  5003. * # of flags
  5004. *
  5005. * if info == NULL: return # <<<<<<<<<<<<<<
  5006. *
  5007. * cdef int copy_shape, i, ndim
  5008. */
  5009. __pyx_t_1 = ((__pyx_v_info == NULL) != 0);
  5010. if (__pyx_t_1) {
  5011. __pyx_r = 0;
  5012. goto __pyx_L0;
  5013. }
  5014. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":206
  5015. *
  5016. * cdef int copy_shape, i, ndim
  5017. * cdef int endian_detector = 1 # <<<<<<<<<<<<<<
  5018. * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
  5019. *
  5020. */
  5021. __pyx_v_endian_detector = 1;
  5022. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":207
  5023. * cdef int copy_shape, i, ndim
  5024. * cdef int endian_detector = 1
  5025. * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
  5026. *
  5027. * ndim = PyArray_NDIM(self)
  5028. */
  5029. __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
  5030. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":209
  5031. * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
  5032. *
  5033. * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<<
  5034. *
  5035. * if sizeof(npy_intp) != sizeof(Py_ssize_t):
  5036. */
  5037. __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
  5038. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":211
  5039. * ndim = PyArray_NDIM(self)
  5040. *
  5041. * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
  5042. * copy_shape = 1
  5043. * else:
  5044. */
  5045. __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
  5046. if (__pyx_t_1) {
  5047. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":212
  5048. *
  5049. * if sizeof(npy_intp) != sizeof(Py_ssize_t):
  5050. * copy_shape = 1 # <<<<<<<<<<<<<<
  5051. * else:
  5052. * copy_shape = 0
  5053. */
  5054. __pyx_v_copy_shape = 1;
  5055. goto __pyx_L4;
  5056. }
  5057. /*else*/ {
  5058. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":214
  5059. * copy_shape = 1
  5060. * else:
  5061. * copy_shape = 0 # <<<<<<<<<<<<<<
  5062. *
  5063. * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
  5064. */
  5065. __pyx_v_copy_shape = 0;
  5066. }
  5067. __pyx_L4:;
  5068. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":216
  5069. * copy_shape = 0
  5070. *
  5071. * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
  5072. * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
  5073. * raise ValueError(u"ndarray is not C contiguous")
  5074. */
  5075. __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
  5076. if (__pyx_t_2) {
  5077. } else {
  5078. __pyx_t_1 = __pyx_t_2;
  5079. goto __pyx_L6_bool_binop_done;
  5080. }
  5081. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":217
  5082. *
  5083. * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
  5084. * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<<
  5085. * raise ValueError(u"ndarray is not C contiguous")
  5086. *
  5087. */
  5088. __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0);
  5089. __pyx_t_1 = __pyx_t_2;
  5090. __pyx_L6_bool_binop_done:;
  5091. if (__pyx_t_1) {
  5092. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":218
  5093. * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
  5094. * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
  5095. * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
  5096. *
  5097. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  5098. */
  5099. __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;}
  5100. __Pyx_GOTREF(__pyx_t_3);
  5101. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  5102. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5103. {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5104. }
  5105. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":220
  5106. * raise ValueError(u"ndarray is not C contiguous")
  5107. *
  5108. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
  5109. * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
  5110. * raise ValueError(u"ndarray is not Fortran contiguous")
  5111. */
  5112. __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
  5113. if (__pyx_t_2) {
  5114. } else {
  5115. __pyx_t_1 = __pyx_t_2;
  5116. goto __pyx_L9_bool_binop_done;
  5117. }
  5118. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":221
  5119. *
  5120. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  5121. * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<<
  5122. * raise ValueError(u"ndarray is not Fortran contiguous")
  5123. *
  5124. */
  5125. __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0);
  5126. __pyx_t_1 = __pyx_t_2;
  5127. __pyx_L9_bool_binop_done:;
  5128. if (__pyx_t_1) {
  5129. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":222
  5130. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  5131. * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
  5132. * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
  5133. *
  5134. * info.buf = PyArray_DATA(self)
  5135. */
  5136. __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;}
  5137. __Pyx_GOTREF(__pyx_t_3);
  5138. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  5139. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5140. {__pyx_filename = __pyx_f[1]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5141. }
  5142. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":224
  5143. * raise ValueError(u"ndarray is not Fortran contiguous")
  5144. *
  5145. * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<<
  5146. * info.ndim = ndim
  5147. * if copy_shape:
  5148. */
  5149. __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
  5150. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":225
  5151. *
  5152. * info.buf = PyArray_DATA(self)
  5153. * info.ndim = ndim # <<<<<<<<<<<<<<
  5154. * if copy_shape:
  5155. * # Allocate new buffer for strides and shape info.
  5156. */
  5157. __pyx_v_info->ndim = __pyx_v_ndim;
  5158. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":226
  5159. * info.buf = PyArray_DATA(self)
  5160. * info.ndim = ndim
  5161. * if copy_shape: # <<<<<<<<<<<<<<
  5162. * # Allocate new buffer for strides and shape info.
  5163. * # This is allocated as one block, strides first.
  5164. */
  5165. __pyx_t_1 = (__pyx_v_copy_shape != 0);
  5166. if (__pyx_t_1) {
  5167. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":229
  5168. * # Allocate new buffer for strides and shape info.
  5169. * # This is allocated as one block, strides first.
  5170. * info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2) # <<<<<<<<<<<<<<
  5171. * info.shape = info.strides + ndim
  5172. * for i in range(ndim):
  5173. */
  5174. __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2)));
  5175. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":230
  5176. * # This is allocated as one block, strides first.
  5177. * info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
  5178. * info.shape = info.strides + ndim # <<<<<<<<<<<<<<
  5179. * for i in range(ndim):
  5180. * info.strides[i] = PyArray_STRIDES(self)[i]
  5181. */
  5182. __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
  5183. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":231
  5184. * info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
  5185. * info.shape = info.strides + ndim
  5186. * for i in range(ndim): # <<<<<<<<<<<<<<
  5187. * info.strides[i] = PyArray_STRIDES(self)[i]
  5188. * info.shape[i] = PyArray_DIMS(self)[i]
  5189. */
  5190. __pyx_t_4 = __pyx_v_ndim;
  5191. for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
  5192. __pyx_v_i = __pyx_t_5;
  5193. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":232
  5194. * info.shape = info.strides + ndim
  5195. * for i in range(ndim):
  5196. * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<<
  5197. * info.shape[i] = PyArray_DIMS(self)[i]
  5198. * else:
  5199. */
  5200. (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
  5201. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":233
  5202. * for i in range(ndim):
  5203. * info.strides[i] = PyArray_STRIDES(self)[i]
  5204. * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<<
  5205. * else:
  5206. * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
  5207. */
  5208. (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
  5209. }
  5210. goto __pyx_L11;
  5211. }
  5212. /*else*/ {
  5213. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":235
  5214. * info.shape[i] = PyArray_DIMS(self)[i]
  5215. * else:
  5216. * info.strides = <Py_ssize_t*>PyArray_STRIDES(self) # <<<<<<<<<<<<<<
  5217. * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
  5218. * info.suboffsets = NULL
  5219. */
  5220. __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
  5221. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":236
  5222. * else:
  5223. * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
  5224. * info.shape = <Py_ssize_t*>PyArray_DIMS(self) # <<<<<<<<<<<<<<
  5225. * info.suboffsets = NULL
  5226. * info.itemsize = PyArray_ITEMSIZE(self)
  5227. */
  5228. __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
  5229. }
  5230. __pyx_L11:;
  5231. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":237
  5232. * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
  5233. * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
  5234. * info.suboffsets = NULL # <<<<<<<<<<<<<<
  5235. * info.itemsize = PyArray_ITEMSIZE(self)
  5236. * info.readonly = not PyArray_ISWRITEABLE(self)
  5237. */
  5238. __pyx_v_info->suboffsets = NULL;
  5239. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":238
  5240. * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
  5241. * info.suboffsets = NULL
  5242. * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<<
  5243. * info.readonly = not PyArray_ISWRITEABLE(self)
  5244. *
  5245. */
  5246. __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
  5247. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":239
  5248. * info.suboffsets = NULL
  5249. * info.itemsize = PyArray_ITEMSIZE(self)
  5250. * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<<
  5251. *
  5252. * cdef int t
  5253. */
  5254. __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
  5255. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":242
  5256. *
  5257. * cdef int t
  5258. * cdef char* f = NULL # <<<<<<<<<<<<<<
  5259. * cdef dtype descr = self.descr
  5260. * cdef list stack
  5261. */
  5262. __pyx_v_f = NULL;
  5263. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":243
  5264. * cdef int t
  5265. * cdef char* f = NULL
  5266. * cdef dtype descr = self.descr # <<<<<<<<<<<<<<
  5267. * cdef list stack
  5268. * cdef int offset
  5269. */
  5270. __pyx_t_3 = ((PyObject *)__pyx_v_self->descr);
  5271. __Pyx_INCREF(__pyx_t_3);
  5272. __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
  5273. __pyx_t_3 = 0;
  5274. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":247
  5275. * cdef int offset
  5276. *
  5277. * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<<
  5278. *
  5279. * if not hasfields and not copy_shape:
  5280. */
  5281. __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);
  5282. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":249
  5283. * cdef bint hasfields = PyDataType_HASFIELDS(descr)
  5284. *
  5285. * if not hasfields and not copy_shape: # <<<<<<<<<<<<<<
  5286. * # do not call releasebuffer
  5287. * info.obj = None
  5288. */
  5289. __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0);
  5290. if (__pyx_t_2) {
  5291. } else {
  5292. __pyx_t_1 = __pyx_t_2;
  5293. goto __pyx_L15_bool_binop_done;
  5294. }
  5295. __pyx_t_2 = ((!(__pyx_v_copy_shape != 0)) != 0);
  5296. __pyx_t_1 = __pyx_t_2;
  5297. __pyx_L15_bool_binop_done:;
  5298. if (__pyx_t_1) {
  5299. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":251
  5300. * if not hasfields and not copy_shape:
  5301. * # do not call releasebuffer
  5302. * info.obj = None # <<<<<<<<<<<<<<
  5303. * else:
  5304. * # need to call releasebuffer
  5305. */
  5306. __Pyx_INCREF(Py_None);
  5307. __Pyx_GIVEREF(Py_None);
  5308. __Pyx_GOTREF(__pyx_v_info->obj);
  5309. __Pyx_DECREF(__pyx_v_info->obj);
  5310. __pyx_v_info->obj = Py_None;
  5311. goto __pyx_L14;
  5312. }
  5313. /*else*/ {
  5314. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":254
  5315. * else:
  5316. * # need to call releasebuffer
  5317. * info.obj = self # <<<<<<<<<<<<<<
  5318. *
  5319. * if not hasfields:
  5320. */
  5321. __Pyx_INCREF(((PyObject *)__pyx_v_self));
  5322. __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  5323. __Pyx_GOTREF(__pyx_v_info->obj);
  5324. __Pyx_DECREF(__pyx_v_info->obj);
  5325. __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
  5326. }
  5327. __pyx_L14:;
  5328. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":256
  5329. * info.obj = self
  5330. *
  5331. * if not hasfields: # <<<<<<<<<<<<<<
  5332. * t = descr.type_num
  5333. * if ((descr.byteorder == c'>' and little_endian) or
  5334. */
  5335. __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0);
  5336. if (__pyx_t_1) {
  5337. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":257
  5338. *
  5339. * if not hasfields:
  5340. * t = descr.type_num # <<<<<<<<<<<<<<
  5341. * if ((descr.byteorder == c'>' and little_endian) or
  5342. * (descr.byteorder == c'<' and not little_endian)):
  5343. */
  5344. __pyx_t_4 = __pyx_v_descr->type_num;
  5345. __pyx_v_t = __pyx_t_4;
  5346. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":258
  5347. * if not hasfields:
  5348. * t = descr.type_num
  5349. * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
  5350. * (descr.byteorder == c'<' and not little_endian)):
  5351. * raise ValueError(u"Non-native byte order not supported")
  5352. */
  5353. __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
  5354. if (!__pyx_t_2) {
  5355. goto __pyx_L20_next_or;
  5356. } else {
  5357. }
  5358. __pyx_t_2 = (__pyx_v_little_endian != 0);
  5359. if (!__pyx_t_2) {
  5360. } else {
  5361. __pyx_t_1 = __pyx_t_2;
  5362. goto __pyx_L19_bool_binop_done;
  5363. }
  5364. __pyx_L20_next_or:;
  5365. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":259
  5366. * t = descr.type_num
  5367. * if ((descr.byteorder == c'>' and little_endian) or
  5368. * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
  5369. * raise ValueError(u"Non-native byte order not supported")
  5370. * if t == NPY_BYTE: f = "b"
  5371. */
  5372. __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
  5373. if (__pyx_t_2) {
  5374. } else {
  5375. __pyx_t_1 = __pyx_t_2;
  5376. goto __pyx_L19_bool_binop_done;
  5377. }
  5378. __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
  5379. __pyx_t_1 = __pyx_t_2;
  5380. __pyx_L19_bool_binop_done:;
  5381. if (__pyx_t_1) {
  5382. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":260
  5383. * if ((descr.byteorder == c'>' and little_endian) or
  5384. * (descr.byteorder == c'<' and not little_endian)):
  5385. * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
  5386. * if t == NPY_BYTE: f = "b"
  5387. * elif t == NPY_UBYTE: f = "B"
  5388. */
  5389. __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 = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5390. __Pyx_GOTREF(__pyx_t_3);
  5391. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  5392. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5393. {__pyx_filename = __pyx_f[1]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5394. }
  5395. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":277
  5396. * elif t == NPY_CDOUBLE: f = "Zd"
  5397. * elif t == NPY_CLONGDOUBLE: f = "Zg"
  5398. * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<<
  5399. * else:
  5400. * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  5401. */
  5402. switch (__pyx_v_t) {
  5403. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":261
  5404. * (descr.byteorder == c'<' and not little_endian)):
  5405. * raise ValueError(u"Non-native byte order not supported")
  5406. * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<<
  5407. * elif t == NPY_UBYTE: f = "B"
  5408. * elif t == NPY_SHORT: f = "h"
  5409. */
  5410. case NPY_BYTE:
  5411. __pyx_v_f = __pyx_k_b;
  5412. break;
  5413. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":262
  5414. * raise ValueError(u"Non-native byte order not supported")
  5415. * if t == NPY_BYTE: f = "b"
  5416. * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<<
  5417. * elif t == NPY_SHORT: f = "h"
  5418. * elif t == NPY_USHORT: f = "H"
  5419. */
  5420. case NPY_UBYTE:
  5421. __pyx_v_f = __pyx_k_B;
  5422. break;
  5423. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":263
  5424. * if t == NPY_BYTE: f = "b"
  5425. * elif t == NPY_UBYTE: f = "B"
  5426. * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<<
  5427. * elif t == NPY_USHORT: f = "H"
  5428. * elif t == NPY_INT: f = "i"
  5429. */
  5430. case NPY_SHORT:
  5431. __pyx_v_f = __pyx_k_h;
  5432. break;
  5433. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":264
  5434. * elif t == NPY_UBYTE: f = "B"
  5435. * elif t == NPY_SHORT: f = "h"
  5436. * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<<
  5437. * elif t == NPY_INT: f = "i"
  5438. * elif t == NPY_UINT: f = "I"
  5439. */
  5440. case NPY_USHORT:
  5441. __pyx_v_f = __pyx_k_H;
  5442. break;
  5443. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":265
  5444. * elif t == NPY_SHORT: f = "h"
  5445. * elif t == NPY_USHORT: f = "H"
  5446. * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<<
  5447. * elif t == NPY_UINT: f = "I"
  5448. * elif t == NPY_LONG: f = "l"
  5449. */
  5450. case NPY_INT:
  5451. __pyx_v_f = __pyx_k_i;
  5452. break;
  5453. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":266
  5454. * elif t == NPY_USHORT: f = "H"
  5455. * elif t == NPY_INT: f = "i"
  5456. * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<<
  5457. * elif t == NPY_LONG: f = "l"
  5458. * elif t == NPY_ULONG: f = "L"
  5459. */
  5460. case NPY_UINT:
  5461. __pyx_v_f = __pyx_k_I;
  5462. break;
  5463. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":267
  5464. * elif t == NPY_INT: f = "i"
  5465. * elif t == NPY_UINT: f = "I"
  5466. * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<<
  5467. * elif t == NPY_ULONG: f = "L"
  5468. * elif t == NPY_LONGLONG: f = "q"
  5469. */
  5470. case NPY_LONG:
  5471. __pyx_v_f = __pyx_k_l;
  5472. break;
  5473. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":268
  5474. * elif t == NPY_UINT: f = "I"
  5475. * elif t == NPY_LONG: f = "l"
  5476. * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<<
  5477. * elif t == NPY_LONGLONG: f = "q"
  5478. * elif t == NPY_ULONGLONG: f = "Q"
  5479. */
  5480. case NPY_ULONG:
  5481. __pyx_v_f = __pyx_k_L;
  5482. break;
  5483. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":269
  5484. * elif t == NPY_LONG: f = "l"
  5485. * elif t == NPY_ULONG: f = "L"
  5486. * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<<
  5487. * elif t == NPY_ULONGLONG: f = "Q"
  5488. * elif t == NPY_FLOAT: f = "f"
  5489. */
  5490. case NPY_LONGLONG:
  5491. __pyx_v_f = __pyx_k_q;
  5492. break;
  5493. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":270
  5494. * elif t == NPY_ULONG: f = "L"
  5495. * elif t == NPY_LONGLONG: f = "q"
  5496. * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<<
  5497. * elif t == NPY_FLOAT: f = "f"
  5498. * elif t == NPY_DOUBLE: f = "d"
  5499. */
  5500. case NPY_ULONGLONG:
  5501. __pyx_v_f = __pyx_k_Q;
  5502. break;
  5503. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":271
  5504. * elif t == NPY_LONGLONG: f = "q"
  5505. * elif t == NPY_ULONGLONG: f = "Q"
  5506. * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<<
  5507. * elif t == NPY_DOUBLE: f = "d"
  5508. * elif t == NPY_LONGDOUBLE: f = "g"
  5509. */
  5510. case NPY_FLOAT:
  5511. __pyx_v_f = __pyx_k_f;
  5512. break;
  5513. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":272
  5514. * elif t == NPY_ULONGLONG: f = "Q"
  5515. * elif t == NPY_FLOAT: f = "f"
  5516. * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<<
  5517. * elif t == NPY_LONGDOUBLE: f = "g"
  5518. * elif t == NPY_CFLOAT: f = "Zf"
  5519. */
  5520. case NPY_DOUBLE:
  5521. __pyx_v_f = __pyx_k_d;
  5522. break;
  5523. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":273
  5524. * elif t == NPY_FLOAT: f = "f"
  5525. * elif t == NPY_DOUBLE: f = "d"
  5526. * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<<
  5527. * elif t == NPY_CFLOAT: f = "Zf"
  5528. * elif t == NPY_CDOUBLE: f = "Zd"
  5529. */
  5530. case NPY_LONGDOUBLE:
  5531. __pyx_v_f = __pyx_k_g;
  5532. break;
  5533. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":274
  5534. * elif t == NPY_DOUBLE: f = "d"
  5535. * elif t == NPY_LONGDOUBLE: f = "g"
  5536. * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<<
  5537. * elif t == NPY_CDOUBLE: f = "Zd"
  5538. * elif t == NPY_CLONGDOUBLE: f = "Zg"
  5539. */
  5540. case NPY_CFLOAT:
  5541. __pyx_v_f = __pyx_k_Zf;
  5542. break;
  5543. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":275
  5544. * elif t == NPY_LONGDOUBLE: f = "g"
  5545. * elif t == NPY_CFLOAT: f = "Zf"
  5546. * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<<
  5547. * elif t == NPY_CLONGDOUBLE: f = "Zg"
  5548. * elif t == NPY_OBJECT: f = "O"
  5549. */
  5550. case NPY_CDOUBLE:
  5551. __pyx_v_f = __pyx_k_Zd;
  5552. break;
  5553. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":276
  5554. * elif t == NPY_CFLOAT: f = "Zf"
  5555. * elif t == NPY_CDOUBLE: f = "Zd"
  5556. * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<<
  5557. * elif t == NPY_OBJECT: f = "O"
  5558. * else:
  5559. */
  5560. case NPY_CLONGDOUBLE:
  5561. __pyx_v_f = __pyx_k_Zg;
  5562. break;
  5563. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":277
  5564. * elif t == NPY_CDOUBLE: f = "Zd"
  5565. * elif t == NPY_CLONGDOUBLE: f = "Zg"
  5566. * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<<
  5567. * else:
  5568. * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  5569. */
  5570. case NPY_OBJECT:
  5571. __pyx_v_f = __pyx_k_O;
  5572. break;
  5573. default:
  5574. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":279
  5575. * elif t == NPY_OBJECT: f = "O"
  5576. * else:
  5577. * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
  5578. * info.format = f
  5579. * return
  5580. */
  5581. __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5582. __Pyx_GOTREF(__pyx_t_3);
  5583. __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 = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5584. __Pyx_GOTREF(__pyx_t_6);
  5585. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5586. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5587. __Pyx_GOTREF(__pyx_t_3);
  5588. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
  5589. __Pyx_GIVEREF(__pyx_t_6);
  5590. __pyx_t_6 = 0;
  5591. __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 = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5592. __Pyx_GOTREF(__pyx_t_6);
  5593. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5594. __Pyx_Raise(__pyx_t_6, 0, 0, 0);
  5595. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5596. {__pyx_filename = __pyx_f[1]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5597. break;
  5598. }
  5599. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":280
  5600. * else:
  5601. * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  5602. * info.format = f # <<<<<<<<<<<<<<
  5603. * return
  5604. * else:
  5605. */
  5606. __pyx_v_info->format = __pyx_v_f;
  5607. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":281
  5608. * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  5609. * info.format = f
  5610. * return # <<<<<<<<<<<<<<
  5611. * else:
  5612. * info.format = <char*>stdlib.malloc(_buffer_format_string_len)
  5613. */
  5614. __pyx_r = 0;
  5615. goto __pyx_L0;
  5616. }
  5617. /*else*/ {
  5618. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":283
  5619. * return
  5620. * else:
  5621. * info.format = <char*>stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<<
  5622. * info.format[0] = c'^' # Native data types, manual alignment
  5623. * offset = 0
  5624. */
  5625. __pyx_v_info->format = ((char *)malloc(255));
  5626. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":284
  5627. * else:
  5628. * info.format = <char*>stdlib.malloc(_buffer_format_string_len)
  5629. * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<<
  5630. * offset = 0
  5631. * f = _util_dtypestring(descr, info.format + 1,
  5632. */
  5633. (__pyx_v_info->format[0]) = '^';
  5634. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":285
  5635. * info.format = <char*>stdlib.malloc(_buffer_format_string_len)
  5636. * info.format[0] = c'^' # Native data types, manual alignment
  5637. * offset = 0 # <<<<<<<<<<<<<<
  5638. * f = _util_dtypestring(descr, info.format + 1,
  5639. * info.format + _buffer_format_string_len,
  5640. */
  5641. __pyx_v_offset = 0;
  5642. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":286
  5643. * info.format[0] = c'^' # Native data types, manual alignment
  5644. * offset = 0
  5645. * f = _util_dtypestring(descr, info.format + 1, # <<<<<<<<<<<<<<
  5646. * info.format + _buffer_format_string_len,
  5647. * &offset)
  5648. */
  5649. __pyx_t_7 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5650. __pyx_v_f = __pyx_t_7;
  5651. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":289
  5652. * info.format + _buffer_format_string_len,
  5653. * &offset)
  5654. * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<<
  5655. *
  5656. * def __releasebuffer__(ndarray self, Py_buffer* info):
  5657. */
  5658. (__pyx_v_f[0]) = '\x00';
  5659. }
  5660. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":197
  5661. * # experimental exception made for __getbuffer__ and __releasebuffer__
  5662. * # -- the details of this may change.
  5663. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
  5664. * # This implementation of getbuffer is geared towards Cython
  5665. * # requirements, and does not yet fullfill the PEP.
  5666. */
  5667. /* function exit code */
  5668. __pyx_r = 0;
  5669. goto __pyx_L0;
  5670. __pyx_L1_error:;
  5671. __Pyx_XDECREF(__pyx_t_3);
  5672. __Pyx_XDECREF(__pyx_t_6);
  5673. __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5674. __pyx_r = -1;
  5675. if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
  5676. __Pyx_GOTREF(__pyx_v_info->obj);
  5677. __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
  5678. }
  5679. goto __pyx_L2;
  5680. __pyx_L0:;
  5681. if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) {
  5682. __Pyx_GOTREF(Py_None);
  5683. __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
  5684. }
  5685. __pyx_L2:;
  5686. __Pyx_XDECREF((PyObject *)__pyx_v_descr);
  5687. __Pyx_RefNannyFinishContext();
  5688. return __pyx_r;
  5689. }
  5690. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":291
  5691. * f[0] = c'\0' # Terminate format string
  5692. *
  5693. * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
  5694. * if PyArray_HASFIELDS(self):
  5695. * stdlib.free(info.format)
  5696. */
  5697. /* Python wrapper */
  5698. static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
  5699. static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  5700. __Pyx_RefNannyDeclarations
  5701. __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
  5702. __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
  5703. /* function exit code */
  5704. __Pyx_RefNannyFinishContext();
  5705. }
  5706. static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  5707. __Pyx_RefNannyDeclarations
  5708. int __pyx_t_1;
  5709. __Pyx_RefNannySetupContext("__releasebuffer__", 0);
  5710. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":292
  5711. *
  5712. * def __releasebuffer__(ndarray self, Py_buffer* info):
  5713. * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
  5714. * stdlib.free(info.format)
  5715. * if sizeof(npy_intp) != sizeof(Py_ssize_t):
  5716. */
  5717. __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
  5718. if (__pyx_t_1) {
  5719. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":293
  5720. * def __releasebuffer__(ndarray self, Py_buffer* info):
  5721. * if PyArray_HASFIELDS(self):
  5722. * stdlib.free(info.format) # <<<<<<<<<<<<<<
  5723. * if sizeof(npy_intp) != sizeof(Py_ssize_t):
  5724. * stdlib.free(info.strides)
  5725. */
  5726. free(__pyx_v_info->format);
  5727. goto __pyx_L3;
  5728. }
  5729. __pyx_L3:;
  5730. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":294
  5731. * if PyArray_HASFIELDS(self):
  5732. * stdlib.free(info.format)
  5733. * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
  5734. * stdlib.free(info.strides)
  5735. * # info.shape was stored after info.strides in the same block
  5736. */
  5737. __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
  5738. if (__pyx_t_1) {
  5739. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":295
  5740. * stdlib.free(info.format)
  5741. * if sizeof(npy_intp) != sizeof(Py_ssize_t):
  5742. * stdlib.free(info.strides) # <<<<<<<<<<<<<<
  5743. * # info.shape was stored after info.strides in the same block
  5744. *
  5745. */
  5746. free(__pyx_v_info->strides);
  5747. goto __pyx_L4;
  5748. }
  5749. __pyx_L4:;
  5750. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":291
  5751. * f[0] = c'\0' # Terminate format string
  5752. *
  5753. * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
  5754. * if PyArray_HASFIELDS(self):
  5755. * stdlib.free(info.format)
  5756. */
  5757. /* function exit code */
  5758. __Pyx_RefNannyFinishContext();
  5759. }
  5760. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":771
  5761. * ctypedef npy_cdouble complex_t
  5762. *
  5763. * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
  5764. * return PyArray_MultiIterNew(1, <void*>a)
  5765. *
  5766. */
  5767. static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
  5768. PyObject *__pyx_r = NULL;
  5769. __Pyx_RefNannyDeclarations
  5770. PyObject *__pyx_t_1 = NULL;
  5771. int __pyx_lineno = 0;
  5772. const char *__pyx_filename = NULL;
  5773. int __pyx_clineno = 0;
  5774. __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
  5775. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":772
  5776. *
  5777. * cdef inline object PyArray_MultiIterNew1(a):
  5778. * return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<<
  5779. *
  5780. * cdef inline object PyArray_MultiIterNew2(a, b):
  5781. */
  5782. __Pyx_XDECREF(__pyx_r);
  5783. __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5784. __Pyx_GOTREF(__pyx_t_1);
  5785. __pyx_r = __pyx_t_1;
  5786. __pyx_t_1 = 0;
  5787. goto __pyx_L0;
  5788. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":771
  5789. * ctypedef npy_cdouble complex_t
  5790. *
  5791. * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
  5792. * return PyArray_MultiIterNew(1, <void*>a)
  5793. *
  5794. */
  5795. /* function exit code */
  5796. __pyx_L1_error:;
  5797. __Pyx_XDECREF(__pyx_t_1);
  5798. __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5799. __pyx_r = 0;
  5800. __pyx_L0:;
  5801. __Pyx_XGIVEREF(__pyx_r);
  5802. __Pyx_RefNannyFinishContext();
  5803. return __pyx_r;
  5804. }
  5805. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":774
  5806. * return PyArray_MultiIterNew(1, <void*>a)
  5807. *
  5808. * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
  5809. * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
  5810. *
  5811. */
  5812. static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  5813. PyObject *__pyx_r = NULL;
  5814. __Pyx_RefNannyDeclarations
  5815. PyObject *__pyx_t_1 = NULL;
  5816. int __pyx_lineno = 0;
  5817. const char *__pyx_filename = NULL;
  5818. int __pyx_clineno = 0;
  5819. __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
  5820. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":775
  5821. *
  5822. * cdef inline object PyArray_MultiIterNew2(a, b):
  5823. * return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<<
  5824. *
  5825. * cdef inline object PyArray_MultiIterNew3(a, b, c):
  5826. */
  5827. __Pyx_XDECREF(__pyx_r);
  5828. __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 = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5829. __Pyx_GOTREF(__pyx_t_1);
  5830. __pyx_r = __pyx_t_1;
  5831. __pyx_t_1 = 0;
  5832. goto __pyx_L0;
  5833. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":774
  5834. * return PyArray_MultiIterNew(1, <void*>a)
  5835. *
  5836. * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
  5837. * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
  5838. *
  5839. */
  5840. /* function exit code */
  5841. __pyx_L1_error:;
  5842. __Pyx_XDECREF(__pyx_t_1);
  5843. __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5844. __pyx_r = 0;
  5845. __pyx_L0:;
  5846. __Pyx_XGIVEREF(__pyx_r);
  5847. __Pyx_RefNannyFinishContext();
  5848. return __pyx_r;
  5849. }
  5850. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":777
  5851. * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
  5852. *
  5853. * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
  5854. * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
  5855. *
  5856. */
  5857. static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
  5858. PyObject *__pyx_r = NULL;
  5859. __Pyx_RefNannyDeclarations
  5860. PyObject *__pyx_t_1 = NULL;
  5861. int __pyx_lineno = 0;
  5862. const char *__pyx_filename = NULL;
  5863. int __pyx_clineno = 0;
  5864. __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
  5865. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":778
  5866. *
  5867. * cdef inline object PyArray_MultiIterNew3(a, b, c):
  5868. * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<<
  5869. *
  5870. * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
  5871. */
  5872. __Pyx_XDECREF(__pyx_r);
  5873. __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 = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5874. __Pyx_GOTREF(__pyx_t_1);
  5875. __pyx_r = __pyx_t_1;
  5876. __pyx_t_1 = 0;
  5877. goto __pyx_L0;
  5878. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":777
  5879. * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
  5880. *
  5881. * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
  5882. * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
  5883. *
  5884. */
  5885. /* function exit code */
  5886. __pyx_L1_error:;
  5887. __Pyx_XDECREF(__pyx_t_1);
  5888. __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5889. __pyx_r = 0;
  5890. __pyx_L0:;
  5891. __Pyx_XGIVEREF(__pyx_r);
  5892. __Pyx_RefNannyFinishContext();
  5893. return __pyx_r;
  5894. }
  5895. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":780
  5896. * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
  5897. *
  5898. * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
  5899. * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
  5900. *
  5901. */
  5902. 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) {
  5903. PyObject *__pyx_r = NULL;
  5904. __Pyx_RefNannyDeclarations
  5905. PyObject *__pyx_t_1 = NULL;
  5906. int __pyx_lineno = 0;
  5907. const char *__pyx_filename = NULL;
  5908. int __pyx_clineno = 0;
  5909. __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
  5910. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":781
  5911. *
  5912. * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
  5913. * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<<
  5914. *
  5915. * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
  5916. */
  5917. __Pyx_XDECREF(__pyx_r);
  5918. __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 = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5919. __Pyx_GOTREF(__pyx_t_1);
  5920. __pyx_r = __pyx_t_1;
  5921. __pyx_t_1 = 0;
  5922. goto __pyx_L0;
  5923. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":780
  5924. * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
  5925. *
  5926. * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
  5927. * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
  5928. *
  5929. */
  5930. /* function exit code */
  5931. __pyx_L1_error:;
  5932. __Pyx_XDECREF(__pyx_t_1);
  5933. __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5934. __pyx_r = 0;
  5935. __pyx_L0:;
  5936. __Pyx_XGIVEREF(__pyx_r);
  5937. __Pyx_RefNannyFinishContext();
  5938. return __pyx_r;
  5939. }
  5940. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":783
  5941. * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
  5942. *
  5943. * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
  5944. * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
  5945. *
  5946. */
  5947. 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) {
  5948. PyObject *__pyx_r = NULL;
  5949. __Pyx_RefNannyDeclarations
  5950. PyObject *__pyx_t_1 = NULL;
  5951. int __pyx_lineno = 0;
  5952. const char *__pyx_filename = NULL;
  5953. int __pyx_clineno = 0;
  5954. __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
  5955. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":784
  5956. *
  5957. * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
  5958. * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<<
  5959. *
  5960. * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
  5961. */
  5962. __Pyx_XDECREF(__pyx_r);
  5963. __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 = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5964. __Pyx_GOTREF(__pyx_t_1);
  5965. __pyx_r = __pyx_t_1;
  5966. __pyx_t_1 = 0;
  5967. goto __pyx_L0;
  5968. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":783
  5969. * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
  5970. *
  5971. * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
  5972. * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
  5973. *
  5974. */
  5975. /* function exit code */
  5976. __pyx_L1_error:;
  5977. __Pyx_XDECREF(__pyx_t_1);
  5978. __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5979. __pyx_r = 0;
  5980. __pyx_L0:;
  5981. __Pyx_XGIVEREF(__pyx_r);
  5982. __Pyx_RefNannyFinishContext();
  5983. return __pyx_r;
  5984. }
  5985. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":786
  5986. * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
  5987. *
  5988. * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
  5989. * # Recursive utility function used in __getbuffer__ to get format
  5990. * # string. The new location in the format string is returned.
  5991. */
  5992. 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) {
  5993. PyArray_Descr *__pyx_v_child = 0;
  5994. int __pyx_v_endian_detector;
  5995. int __pyx_v_little_endian;
  5996. PyObject *__pyx_v_fields = 0;
  5997. PyObject *__pyx_v_childname = NULL;
  5998. PyObject *__pyx_v_new_offset = NULL;
  5999. PyObject *__pyx_v_t = NULL;
  6000. char *__pyx_r;
  6001. __Pyx_RefNannyDeclarations
  6002. PyObject *__pyx_t_1 = NULL;
  6003. Py_ssize_t __pyx_t_2;
  6004. PyObject *__pyx_t_3 = NULL;
  6005. PyObject *__pyx_t_4 = NULL;
  6006. int __pyx_t_5;
  6007. int __pyx_t_6;
  6008. int __pyx_t_7;
  6009. long __pyx_t_8;
  6010. char *__pyx_t_9;
  6011. int __pyx_lineno = 0;
  6012. const char *__pyx_filename = NULL;
  6013. int __pyx_clineno = 0;
  6014. __Pyx_RefNannySetupContext("_util_dtypestring", 0);
  6015. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":793
  6016. * cdef int delta_offset
  6017. * cdef tuple i
  6018. * cdef int endian_detector = 1 # <<<<<<<<<<<<<<
  6019. * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
  6020. * cdef tuple fields
  6021. */
  6022. __pyx_v_endian_detector = 1;
  6023. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":794
  6024. * cdef tuple i
  6025. * cdef int endian_detector = 1
  6026. * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
  6027. * cdef tuple fields
  6028. *
  6029. */
  6030. __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
  6031. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":797
  6032. * cdef tuple fields
  6033. *
  6034. * for childname in descr.names: # <<<<<<<<<<<<<<
  6035. * fields = descr.fields[childname]
  6036. * child, new_offset = fields
  6037. */
  6038. if (unlikely(__pyx_v_descr->names == Py_None)) {
  6039. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
  6040. {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6041. }
  6042. __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  6043. for (;;) {
  6044. if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
  6045. #if CYTHON_COMPILING_IN_CPYTHON
  6046. __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 = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6047. #else
  6048. __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 = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6049. #endif
  6050. __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
  6051. __pyx_t_3 = 0;
  6052. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":798
  6053. *
  6054. * for childname in descr.names:
  6055. * fields = descr.fields[childname] # <<<<<<<<<<<<<<
  6056. * child, new_offset = fields
  6057. *
  6058. */
  6059. if (unlikely(__pyx_v_descr->fields == Py_None)) {
  6060. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
  6061. {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6062. }
  6063. __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 = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  6064. __Pyx_GOTREF(__pyx_t_3);
  6065. 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 = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6066. __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
  6067. __pyx_t_3 = 0;
  6068. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":799
  6069. * for childname in descr.names:
  6070. * fields = descr.fields[childname]
  6071. * child, new_offset = fields # <<<<<<<<<<<<<<
  6072. *
  6073. * if (end - f) - <int>(new_offset - offset[0]) < 15:
  6074. */
  6075. if (likely(__pyx_v_fields != Py_None)) {
  6076. PyObject* sequence = __pyx_v_fields;
  6077. #if CYTHON_COMPILING_IN_CPYTHON
  6078. Py_ssize_t size = Py_SIZE(sequence);
  6079. #else
  6080. Py_ssize_t size = PySequence_Size(sequence);
  6081. #endif
  6082. if (unlikely(size != 2)) {
  6083. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  6084. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  6085. {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6086. }
  6087. #if CYTHON_COMPILING_IN_CPYTHON
  6088. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  6089. __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
  6090. __Pyx_INCREF(__pyx_t_3);
  6091. __Pyx_INCREF(__pyx_t_4);
  6092. #else
  6093. __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6094. __Pyx_GOTREF(__pyx_t_3);
  6095. __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6096. __Pyx_GOTREF(__pyx_t_4);
  6097. #endif
  6098. } else {
  6099. __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6100. }
  6101. if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6102. __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
  6103. __pyx_t_3 = 0;
  6104. __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
  6105. __pyx_t_4 = 0;
  6106. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":801
  6107. * child, new_offset = fields
  6108. *
  6109. * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
  6110. * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
  6111. *
  6112. */
  6113. __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6114. __Pyx_GOTREF(__pyx_t_4);
  6115. __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6116. __Pyx_GOTREF(__pyx_t_3);
  6117. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6118. __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 = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6119. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6120. __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
  6121. if (__pyx_t_6) {
  6122. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":802
  6123. *
  6124. * if (end - f) - <int>(new_offset - offset[0]) < 15:
  6125. * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
  6126. *
  6127. * if ((child.byteorder == c'>' and little_endian) or
  6128. */
  6129. __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 = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6130. __Pyx_GOTREF(__pyx_t_3);
  6131. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  6132. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6133. {__pyx_filename = __pyx_f[1]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6134. }
  6135. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":804
  6136. * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
  6137. *
  6138. * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
  6139. * (child.byteorder == c'<' and not little_endian)):
  6140. * raise ValueError(u"Non-native byte order not supported")
  6141. */
  6142. __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
  6143. if (!__pyx_t_7) {
  6144. goto __pyx_L8_next_or;
  6145. } else {
  6146. }
  6147. __pyx_t_7 = (__pyx_v_little_endian != 0);
  6148. if (!__pyx_t_7) {
  6149. } else {
  6150. __pyx_t_6 = __pyx_t_7;
  6151. goto __pyx_L7_bool_binop_done;
  6152. }
  6153. __pyx_L8_next_or:;
  6154. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":805
  6155. *
  6156. * if ((child.byteorder == c'>' and little_endian) or
  6157. * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
  6158. * raise ValueError(u"Non-native byte order not supported")
  6159. * # One could encode it in the format string and have Cython
  6160. */
  6161. __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
  6162. if (__pyx_t_7) {
  6163. } else {
  6164. __pyx_t_6 = __pyx_t_7;
  6165. goto __pyx_L7_bool_binop_done;
  6166. }
  6167. __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
  6168. __pyx_t_6 = __pyx_t_7;
  6169. __pyx_L7_bool_binop_done:;
  6170. if (__pyx_t_6) {
  6171. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":806
  6172. * if ((child.byteorder == c'>' and little_endian) or
  6173. * (child.byteorder == c'<' and not little_endian)):
  6174. * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
  6175. * # One could encode it in the format string and have Cython
  6176. * # complain instead, BUT: < and > in format strings also imply
  6177. */
  6178. __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 = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6179. __Pyx_GOTREF(__pyx_t_3);
  6180. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  6181. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6182. {__pyx_filename = __pyx_f[1]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6183. }
  6184. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":816
  6185. *
  6186. * # Output padding bytes
  6187. * while offset[0] < new_offset: # <<<<<<<<<<<<<<
  6188. * f[0] = 120 # "x"; pad byte
  6189. * f += 1
  6190. */
  6191. while (1) {
  6192. __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6193. __Pyx_GOTREF(__pyx_t_3);
  6194. __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 = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6195. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6196. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6197. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6198. if (!__pyx_t_6) break;
  6199. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":817
  6200. * # Output padding bytes
  6201. * while offset[0] < new_offset:
  6202. * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<<
  6203. * f += 1
  6204. * offset[0] += 1
  6205. */
  6206. (__pyx_v_f[0]) = 120;
  6207. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":818
  6208. * while offset[0] < new_offset:
  6209. * f[0] = 120 # "x"; pad byte
  6210. * f += 1 # <<<<<<<<<<<<<<
  6211. * offset[0] += 1
  6212. *
  6213. */
  6214. __pyx_v_f = (__pyx_v_f + 1);
  6215. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":819
  6216. * f[0] = 120 # "x"; pad byte
  6217. * f += 1
  6218. * offset[0] += 1 # <<<<<<<<<<<<<<
  6219. *
  6220. * offset[0] += child.itemsize
  6221. */
  6222. __pyx_t_8 = 0;
  6223. (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
  6224. }
  6225. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":821
  6226. * offset[0] += 1
  6227. *
  6228. * offset[0] += child.itemsize # <<<<<<<<<<<<<<
  6229. *
  6230. * if not PyDataType_HASFIELDS(child):
  6231. */
  6232. __pyx_t_8 = 0;
  6233. (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
  6234. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":823
  6235. * offset[0] += child.itemsize
  6236. *
  6237. * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
  6238. * t = child.type_num
  6239. * if end - f < 5:
  6240. */
  6241. __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
  6242. if (__pyx_t_6) {
  6243. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":824
  6244. *
  6245. * if not PyDataType_HASFIELDS(child):
  6246. * t = child.type_num # <<<<<<<<<<<<<<
  6247. * if end - f < 5:
  6248. * raise RuntimeError(u"Format string allocated too short.")
  6249. */
  6250. __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6251. __Pyx_GOTREF(__pyx_t_4);
  6252. __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
  6253. __pyx_t_4 = 0;
  6254. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":825
  6255. * if not PyDataType_HASFIELDS(child):
  6256. * t = child.type_num
  6257. * if end - f < 5: # <<<<<<<<<<<<<<
  6258. * raise RuntimeError(u"Format string allocated too short.")
  6259. *
  6260. */
  6261. __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
  6262. if (__pyx_t_6) {
  6263. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":826
  6264. * t = child.type_num
  6265. * if end - f < 5:
  6266. * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
  6267. *
  6268. * # Until ticket #99 is fixed, use integers to avoid warnings
  6269. */
  6270. __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 = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6271. __Pyx_GOTREF(__pyx_t_4);
  6272. __Pyx_Raise(__pyx_t_4, 0, 0, 0);
  6273. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6274. {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6275. }
  6276. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":829
  6277. *
  6278. * # Until ticket #99 is fixed, use integers to avoid warnings
  6279. * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<<
  6280. * elif t == NPY_UBYTE: f[0] = 66 #"B"
  6281. * elif t == NPY_SHORT: f[0] = 104 #"h"
  6282. */
  6283. __pyx_t_4 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6284. __Pyx_GOTREF(__pyx_t_4);
  6285. __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 = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6286. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6287. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6288. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6289. if (__pyx_t_6) {
  6290. (__pyx_v_f[0]) = 98;
  6291. goto __pyx_L15;
  6292. }
  6293. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":830
  6294. * # Until ticket #99 is fixed, use integers to avoid warnings
  6295. * if t == NPY_BYTE: f[0] = 98 #"b"
  6296. * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<<
  6297. * elif t == NPY_SHORT: f[0] = 104 #"h"
  6298. * elif t == NPY_USHORT: f[0] = 72 #"H"
  6299. */
  6300. __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6301. __Pyx_GOTREF(__pyx_t_3);
  6302. __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 = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6303. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6304. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6305. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6306. if (__pyx_t_6) {
  6307. (__pyx_v_f[0]) = 66;
  6308. goto __pyx_L15;
  6309. }
  6310. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":831
  6311. * if t == NPY_BYTE: f[0] = 98 #"b"
  6312. * elif t == NPY_UBYTE: f[0] = 66 #"B"
  6313. * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<<
  6314. * elif t == NPY_USHORT: f[0] = 72 #"H"
  6315. * elif t == NPY_INT: f[0] = 105 #"i"
  6316. */
  6317. __pyx_t_4 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6318. __Pyx_GOTREF(__pyx_t_4);
  6319. __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 = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6320. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6321. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6322. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6323. if (__pyx_t_6) {
  6324. (__pyx_v_f[0]) = 104;
  6325. goto __pyx_L15;
  6326. }
  6327. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":832
  6328. * elif t == NPY_UBYTE: f[0] = 66 #"B"
  6329. * elif t == NPY_SHORT: f[0] = 104 #"h"
  6330. * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<<
  6331. * elif t == NPY_INT: f[0] = 105 #"i"
  6332. * elif t == NPY_UINT: f[0] = 73 #"I"
  6333. */
  6334. __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6335. __Pyx_GOTREF(__pyx_t_3);
  6336. __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 = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6337. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6338. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6339. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6340. if (__pyx_t_6) {
  6341. (__pyx_v_f[0]) = 72;
  6342. goto __pyx_L15;
  6343. }
  6344. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":833
  6345. * elif t == NPY_SHORT: f[0] = 104 #"h"
  6346. * elif t == NPY_USHORT: f[0] = 72 #"H"
  6347. * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<<
  6348. * elif t == NPY_UINT: f[0] = 73 #"I"
  6349. * elif t == NPY_LONG: f[0] = 108 #"l"
  6350. */
  6351. __pyx_t_4 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6352. __Pyx_GOTREF(__pyx_t_4);
  6353. __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 = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6354. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6355. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6356. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6357. if (__pyx_t_6) {
  6358. (__pyx_v_f[0]) = 105;
  6359. goto __pyx_L15;
  6360. }
  6361. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":834
  6362. * elif t == NPY_USHORT: f[0] = 72 #"H"
  6363. * elif t == NPY_INT: f[0] = 105 #"i"
  6364. * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<<
  6365. * elif t == NPY_LONG: f[0] = 108 #"l"
  6366. * elif t == NPY_ULONG: f[0] = 76 #"L"
  6367. */
  6368. __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6369. __Pyx_GOTREF(__pyx_t_3);
  6370. __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 = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6371. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6372. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6373. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6374. if (__pyx_t_6) {
  6375. (__pyx_v_f[0]) = 73;
  6376. goto __pyx_L15;
  6377. }
  6378. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":835
  6379. * elif t == NPY_INT: f[0] = 105 #"i"
  6380. * elif t == NPY_UINT: f[0] = 73 #"I"
  6381. * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<<
  6382. * elif t == NPY_ULONG: f[0] = 76 #"L"
  6383. * elif t == NPY_LONGLONG: f[0] = 113 #"q"
  6384. */
  6385. __pyx_t_4 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6386. __Pyx_GOTREF(__pyx_t_4);
  6387. __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 = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6388. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6389. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6390. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6391. if (__pyx_t_6) {
  6392. (__pyx_v_f[0]) = 108;
  6393. goto __pyx_L15;
  6394. }
  6395. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":836
  6396. * elif t == NPY_UINT: f[0] = 73 #"I"
  6397. * elif t == NPY_LONG: f[0] = 108 #"l"
  6398. * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<<
  6399. * elif t == NPY_LONGLONG: f[0] = 113 #"q"
  6400. * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
  6401. */
  6402. __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6403. __Pyx_GOTREF(__pyx_t_3);
  6404. __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 = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6405. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6406. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6407. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6408. if (__pyx_t_6) {
  6409. (__pyx_v_f[0]) = 76;
  6410. goto __pyx_L15;
  6411. }
  6412. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":837
  6413. * elif t == NPY_LONG: f[0] = 108 #"l"
  6414. * elif t == NPY_ULONG: f[0] = 76 #"L"
  6415. * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<<
  6416. * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
  6417. * elif t == NPY_FLOAT: f[0] = 102 #"f"
  6418. */
  6419. __pyx_t_4 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6420. __Pyx_GOTREF(__pyx_t_4);
  6421. __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 = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6422. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6423. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6424. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6425. if (__pyx_t_6) {
  6426. (__pyx_v_f[0]) = 113;
  6427. goto __pyx_L15;
  6428. }
  6429. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":838
  6430. * elif t == NPY_ULONG: f[0] = 76 #"L"
  6431. * elif t == NPY_LONGLONG: f[0] = 113 #"q"
  6432. * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<<
  6433. * elif t == NPY_FLOAT: f[0] = 102 #"f"
  6434. * elif t == NPY_DOUBLE: f[0] = 100 #"d"
  6435. */
  6436. __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6437. __Pyx_GOTREF(__pyx_t_3);
  6438. __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 = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6439. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6440. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6441. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6442. if (__pyx_t_6) {
  6443. (__pyx_v_f[0]) = 81;
  6444. goto __pyx_L15;
  6445. }
  6446. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":839
  6447. * elif t == NPY_LONGLONG: f[0] = 113 #"q"
  6448. * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
  6449. * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<<
  6450. * elif t == NPY_DOUBLE: f[0] = 100 #"d"
  6451. * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
  6452. */
  6453. __pyx_t_4 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6454. __Pyx_GOTREF(__pyx_t_4);
  6455. __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 = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6456. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6457. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6458. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6459. if (__pyx_t_6) {
  6460. (__pyx_v_f[0]) = 102;
  6461. goto __pyx_L15;
  6462. }
  6463. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":840
  6464. * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
  6465. * elif t == NPY_FLOAT: f[0] = 102 #"f"
  6466. * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<<
  6467. * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
  6468. * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
  6469. */
  6470. __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6471. __Pyx_GOTREF(__pyx_t_3);
  6472. __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 = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6473. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6474. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6475. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6476. if (__pyx_t_6) {
  6477. (__pyx_v_f[0]) = 100;
  6478. goto __pyx_L15;
  6479. }
  6480. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":841
  6481. * elif t == NPY_FLOAT: f[0] = 102 #"f"
  6482. * elif t == NPY_DOUBLE: f[0] = 100 #"d"
  6483. * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<<
  6484. * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
  6485. * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
  6486. */
  6487. __pyx_t_4 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6488. __Pyx_GOTREF(__pyx_t_4);
  6489. __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 = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6490. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6491. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6492. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6493. if (__pyx_t_6) {
  6494. (__pyx_v_f[0]) = 103;
  6495. goto __pyx_L15;
  6496. }
  6497. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":842
  6498. * elif t == NPY_DOUBLE: f[0] = 100 #"d"
  6499. * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
  6500. * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<<
  6501. * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
  6502. * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
  6503. */
  6504. __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6505. __Pyx_GOTREF(__pyx_t_3);
  6506. __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 = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6507. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6508. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6509. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6510. if (__pyx_t_6) {
  6511. (__pyx_v_f[0]) = 90;
  6512. (__pyx_v_f[1]) = 102;
  6513. __pyx_v_f = (__pyx_v_f + 1);
  6514. goto __pyx_L15;
  6515. }
  6516. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":843
  6517. * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
  6518. * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
  6519. * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<<
  6520. * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
  6521. * elif t == NPY_OBJECT: f[0] = 79 #"O"
  6522. */
  6523. __pyx_t_4 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __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 = 843; __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 = 843; __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]) = 90;
  6531. (__pyx_v_f[1]) = 100;
  6532. __pyx_v_f = (__pyx_v_f + 1);
  6533. goto __pyx_L15;
  6534. }
  6535. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":844
  6536. * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
  6537. * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
  6538. * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<<
  6539. * elif t == NPY_OBJECT: f[0] = 79 #"O"
  6540. * else:
  6541. */
  6542. __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6543. __Pyx_GOTREF(__pyx_t_3);
  6544. __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 = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6545. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6546. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6547. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6548. if (__pyx_t_6) {
  6549. (__pyx_v_f[0]) = 90;
  6550. (__pyx_v_f[1]) = 103;
  6551. __pyx_v_f = (__pyx_v_f + 1);
  6552. goto __pyx_L15;
  6553. }
  6554. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":845
  6555. * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
  6556. * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
  6557. * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<<
  6558. * else:
  6559. * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  6560. */
  6561. __pyx_t_4 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6562. __Pyx_GOTREF(__pyx_t_4);
  6563. __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 = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6564. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6565. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6566. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6567. if (__pyx_t_6) {
  6568. (__pyx_v_f[0]) = 79;
  6569. goto __pyx_L15;
  6570. }
  6571. /*else*/ {
  6572. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":847
  6573. * elif t == NPY_OBJECT: f[0] = 79 #"O"
  6574. * else:
  6575. * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
  6576. * f += 1
  6577. * else:
  6578. */
  6579. __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 = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6580. __Pyx_GOTREF(__pyx_t_3);
  6581. __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6582. __Pyx_GOTREF(__pyx_t_4);
  6583. PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  6584. __Pyx_GIVEREF(__pyx_t_3);
  6585. __pyx_t_3 = 0;
  6586. __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 = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6587. __Pyx_GOTREF(__pyx_t_3);
  6588. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6589. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  6590. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6591. {__pyx_filename = __pyx_f[1]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6592. }
  6593. __pyx_L15:;
  6594. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":848
  6595. * else:
  6596. * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  6597. * f += 1 # <<<<<<<<<<<<<<
  6598. * else:
  6599. * # Cython ignores struct boundary information ("T{...}"),
  6600. */
  6601. __pyx_v_f = (__pyx_v_f + 1);
  6602. goto __pyx_L13;
  6603. }
  6604. /*else*/ {
  6605. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":852
  6606. * # Cython ignores struct boundary information ("T{...}"),
  6607. * # so don't output it
  6608. * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<<
  6609. * return f
  6610. *
  6611. */
  6612. __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 = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6613. __pyx_v_f = __pyx_t_9;
  6614. }
  6615. __pyx_L13:;
  6616. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":797
  6617. * cdef tuple fields
  6618. *
  6619. * for childname in descr.names: # <<<<<<<<<<<<<<
  6620. * fields = descr.fields[childname]
  6621. * child, new_offset = fields
  6622. */
  6623. }
  6624. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6625. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":853
  6626. * # so don't output it
  6627. * f = _util_dtypestring(child, f, end, offset)
  6628. * return f # <<<<<<<<<<<<<<
  6629. *
  6630. *
  6631. */
  6632. __pyx_r = __pyx_v_f;
  6633. goto __pyx_L0;
  6634. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":786
  6635. * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
  6636. *
  6637. * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
  6638. * # Recursive utility function used in __getbuffer__ to get format
  6639. * # string. The new location in the format string is returned.
  6640. */
  6641. /* function exit code */
  6642. __pyx_L1_error:;
  6643. __Pyx_XDECREF(__pyx_t_1);
  6644. __Pyx_XDECREF(__pyx_t_3);
  6645. __Pyx_XDECREF(__pyx_t_4);
  6646. __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6647. __pyx_r = NULL;
  6648. __pyx_L0:;
  6649. __Pyx_XDECREF((PyObject *)__pyx_v_child);
  6650. __Pyx_XDECREF(__pyx_v_fields);
  6651. __Pyx_XDECREF(__pyx_v_childname);
  6652. __Pyx_XDECREF(__pyx_v_new_offset);
  6653. __Pyx_XDECREF(__pyx_v_t);
  6654. __Pyx_RefNannyFinishContext();
  6655. return __pyx_r;
  6656. }
  6657. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":969
  6658. *
  6659. *
  6660. * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
  6661. * cdef PyObject* baseptr
  6662. * if base is None:
  6663. */
  6664. static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
  6665. PyObject *__pyx_v_baseptr;
  6666. __Pyx_RefNannyDeclarations
  6667. int __pyx_t_1;
  6668. int __pyx_t_2;
  6669. __Pyx_RefNannySetupContext("set_array_base", 0);
  6670. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":971
  6671. * cdef inline void set_array_base(ndarray arr, object base):
  6672. * cdef PyObject* baseptr
  6673. * if base is None: # <<<<<<<<<<<<<<
  6674. * baseptr = NULL
  6675. * else:
  6676. */
  6677. __pyx_t_1 = (__pyx_v_base == Py_None);
  6678. __pyx_t_2 = (__pyx_t_1 != 0);
  6679. if (__pyx_t_2) {
  6680. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":972
  6681. * cdef PyObject* baseptr
  6682. * if base is None:
  6683. * baseptr = NULL # <<<<<<<<<<<<<<
  6684. * else:
  6685. * Py_INCREF(base) # important to do this before decref below!
  6686. */
  6687. __pyx_v_baseptr = NULL;
  6688. goto __pyx_L3;
  6689. }
  6690. /*else*/ {
  6691. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":974
  6692. * baseptr = NULL
  6693. * else:
  6694. * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<<
  6695. * baseptr = <PyObject*>base
  6696. * Py_XDECREF(arr.base)
  6697. */
  6698. Py_INCREF(__pyx_v_base);
  6699. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":975
  6700. * else:
  6701. * Py_INCREF(base) # important to do this before decref below!
  6702. * baseptr = <PyObject*>base # <<<<<<<<<<<<<<
  6703. * Py_XDECREF(arr.base)
  6704. * arr.base = baseptr
  6705. */
  6706. __pyx_v_baseptr = ((PyObject *)__pyx_v_base);
  6707. }
  6708. __pyx_L3:;
  6709. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":976
  6710. * Py_INCREF(base) # important to do this before decref below!
  6711. * baseptr = <PyObject*>base
  6712. * Py_XDECREF(arr.base) # <<<<<<<<<<<<<<
  6713. * arr.base = baseptr
  6714. *
  6715. */
  6716. Py_XDECREF(__pyx_v_arr->base);
  6717. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":977
  6718. * baseptr = <PyObject*>base
  6719. * Py_XDECREF(arr.base)
  6720. * arr.base = baseptr # <<<<<<<<<<<<<<
  6721. *
  6722. * cdef inline object get_array_base(ndarray arr):
  6723. */
  6724. __pyx_v_arr->base = __pyx_v_baseptr;
  6725. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":969
  6726. *
  6727. *
  6728. * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
  6729. * cdef PyObject* baseptr
  6730. * if base is None:
  6731. */
  6732. /* function exit code */
  6733. __Pyx_RefNannyFinishContext();
  6734. }
  6735. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":979
  6736. * arr.base = baseptr
  6737. *
  6738. * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
  6739. * if arr.base is NULL:
  6740. * return None
  6741. */
  6742. static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
  6743. PyObject *__pyx_r = NULL;
  6744. __Pyx_RefNannyDeclarations
  6745. int __pyx_t_1;
  6746. __Pyx_RefNannySetupContext("get_array_base", 0);
  6747. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":980
  6748. *
  6749. * cdef inline object get_array_base(ndarray arr):
  6750. * if arr.base is NULL: # <<<<<<<<<<<<<<
  6751. * return None
  6752. * else:
  6753. */
  6754. __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0);
  6755. if (__pyx_t_1) {
  6756. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":981
  6757. * cdef inline object get_array_base(ndarray arr):
  6758. * if arr.base is NULL:
  6759. * return None # <<<<<<<<<<<<<<
  6760. * else:
  6761. * return <object>arr.base
  6762. */
  6763. __Pyx_XDECREF(__pyx_r);
  6764. __Pyx_INCREF(Py_None);
  6765. __pyx_r = Py_None;
  6766. goto __pyx_L0;
  6767. }
  6768. /*else*/ {
  6769. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":983
  6770. * return None
  6771. * else:
  6772. * return <object>arr.base # <<<<<<<<<<<<<<
  6773. */
  6774. __Pyx_XDECREF(__pyx_r);
  6775. __Pyx_INCREF(((PyObject *)__pyx_v_arr->base));
  6776. __pyx_r = ((PyObject *)__pyx_v_arr->base);
  6777. goto __pyx_L0;
  6778. }
  6779. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":979
  6780. * arr.base = baseptr
  6781. *
  6782. * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
  6783. * if arr.base is NULL:
  6784. * return None
  6785. */
  6786. /* function exit code */
  6787. __pyx_L0:;
  6788. __Pyx_XGIVEREF(__pyx_r);
  6789. __Pyx_RefNannyFinishContext();
  6790. return __pyx_r;
  6791. }
  6792. /* "vector.from_py":49
  6793. *
  6794. * @cname("__pyx_convert_vector_from_py_double")
  6795. * cdef vector[X] __pyx_convert_vector_from_py_double(object o) except *: # <<<<<<<<<<<<<<
  6796. * cdef vector[X] v
  6797. * for item in o:
  6798. */
  6799. static std::vector<double> __pyx_convert_vector_from_py_double(PyObject *__pyx_v_o) {
  6800. std::vector<double> __pyx_v_v;
  6801. PyObject *__pyx_v_item = NULL;
  6802. std::vector<double> __pyx_r;
  6803. __Pyx_RefNannyDeclarations
  6804. PyObject *__pyx_t_1 = NULL;
  6805. Py_ssize_t __pyx_t_2;
  6806. PyObject *(*__pyx_t_3)(PyObject *);
  6807. PyObject *__pyx_t_4 = NULL;
  6808. double __pyx_t_5;
  6809. int __pyx_lineno = 0;
  6810. const char *__pyx_filename = NULL;
  6811. int __pyx_clineno = 0;
  6812. __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_double", 0);
  6813. /* "vector.from_py":51
  6814. * cdef vector[X] __pyx_convert_vector_from_py_double(object o) except *:
  6815. * cdef vector[X] v
  6816. * for item in o: # <<<<<<<<<<<<<<
  6817. * v.push_back(X_from_py(item))
  6818. * return v
  6819. */
  6820. if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
  6821. __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  6822. __pyx_t_3 = NULL;
  6823. } else {
  6824. __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;}
  6825. __Pyx_GOTREF(__pyx_t_1);
  6826. __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;}
  6827. }
  6828. for (;;) {
  6829. if (likely(!__pyx_t_3)) {
  6830. if (likely(PyList_CheckExact(__pyx_t_1))) {
  6831. if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
  6832. #if CYTHON_COMPILING_IN_CPYTHON
  6833. __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;}
  6834. #else
  6835. __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;}
  6836. #endif
  6837. } else {
  6838. if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
  6839. #if CYTHON_COMPILING_IN_CPYTHON
  6840. __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;}
  6841. #else
  6842. __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;}
  6843. #endif
  6844. }
  6845. } else {
  6846. __pyx_t_4 = __pyx_t_3(__pyx_t_1);
  6847. if (unlikely(!__pyx_t_4)) {
  6848. PyObject* exc_type = PyErr_Occurred();
  6849. if (exc_type) {
  6850. if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  6851. else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6852. }
  6853. break;
  6854. }
  6855. __Pyx_GOTREF(__pyx_t_4);
  6856. }
  6857. __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
  6858. __pyx_t_4 = 0;
  6859. /* "vector.from_py":52
  6860. * cdef vector[X] v
  6861. * for item in o:
  6862. * v.push_back(X_from_py(item)) # <<<<<<<<<<<<<<
  6863. * return v
  6864. *
  6865. */
  6866. __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;}
  6867. __pyx_v_v.push_back(__pyx_t_5);
  6868. /* "vector.from_py":51
  6869. * cdef vector[X] __pyx_convert_vector_from_py_double(object o) except *:
  6870. * cdef vector[X] v
  6871. * for item in o: # <<<<<<<<<<<<<<
  6872. * v.push_back(X_from_py(item))
  6873. * return v
  6874. */
  6875. }
  6876. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6877. /* "vector.from_py":53
  6878. * for item in o:
  6879. * v.push_back(X_from_py(item))
  6880. * return v # <<<<<<<<<<<<<<
  6881. *
  6882. *
  6883. */
  6884. __pyx_r = __pyx_v_v;
  6885. goto __pyx_L0;
  6886. /* "vector.from_py":49
  6887. *
  6888. * @cname("__pyx_convert_vector_from_py_double")
  6889. * cdef vector[X] __pyx_convert_vector_from_py_double(object o) except *: # <<<<<<<<<<<<<<
  6890. * cdef vector[X] v
  6891. * for item in o:
  6892. */
  6893. /* function exit code */
  6894. __pyx_L1_error:;
  6895. __Pyx_XDECREF(__pyx_t_1);
  6896. __Pyx_XDECREF(__pyx_t_4);
  6897. __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_double", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6898. __pyx_L0:;
  6899. __Pyx_XDECREF(__pyx_v_item);
  6900. __Pyx_RefNannyFinishContext();
  6901. return __pyx_r;
  6902. }
  6903. /* "vector.from_py":50
  6904. *
  6905. * @cname("__pyx_convert_vector_from_py___pyx_t_double_complex")
  6906. * cdef vector[X] __pyx_convert_vector_from_py___pyx_t_double_complex(object o) except *: # <<<<<<<<<<<<<<
  6907. * cdef vector[X] v
  6908. * for item in o:
  6909. */
  6910. static std::vector<__pyx_t_double_complex> __pyx_convert_vector_from_py___pyx_t_double_complex(PyObject *__pyx_v_o) {
  6911. std::vector<__pyx_t_double_complex> __pyx_v_v;
  6912. PyObject *__pyx_v_item = NULL;
  6913. std::vector<__pyx_t_double_complex> __pyx_r;
  6914. __Pyx_RefNannyDeclarations
  6915. PyObject *__pyx_t_1 = NULL;
  6916. Py_ssize_t __pyx_t_2;
  6917. PyObject *(*__pyx_t_3)(PyObject *);
  6918. PyObject *__pyx_t_4 = NULL;
  6919. __pyx_t_double_complex __pyx_t_5;
  6920. int __pyx_lineno = 0;
  6921. const char *__pyx_filename = NULL;
  6922. int __pyx_clineno = 0;
  6923. __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py___pyx_t_double_complex", 0);
  6924. /* "vector.from_py":52
  6925. * cdef vector[X] __pyx_convert_vector_from_py___pyx_t_double_complex(object o) except *:
  6926. * cdef vector[X] v
  6927. * for item in o: # <<<<<<<<<<<<<<
  6928. * v.push_back(X_from_py(item))
  6929. * return v
  6930. */
  6931. if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) {
  6932. __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  6933. __pyx_t_3 = NULL;
  6934. } else {
  6935. __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;}
  6936. __Pyx_GOTREF(__pyx_t_1);
  6937. __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;}
  6938. }
  6939. for (;;) {
  6940. if (likely(!__pyx_t_3)) {
  6941. if (likely(PyList_CheckExact(__pyx_t_1))) {
  6942. if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
  6943. #if CYTHON_COMPILING_IN_CPYTHON
  6944. __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;}
  6945. #else
  6946. __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;}
  6947. #endif
  6948. } else {
  6949. if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
  6950. #if CYTHON_COMPILING_IN_CPYTHON
  6951. __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;}
  6952. #else
  6953. __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;}
  6954. #endif
  6955. }
  6956. } else {
  6957. __pyx_t_4 = __pyx_t_3(__pyx_t_1);
  6958. if (unlikely(!__pyx_t_4)) {
  6959. PyObject* exc_type = PyErr_Occurred();
  6960. if (exc_type) {
  6961. if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  6962. else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6963. }
  6964. break;
  6965. }
  6966. __Pyx_GOTREF(__pyx_t_4);
  6967. }
  6968. __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4);
  6969. __pyx_t_4 = 0;
  6970. /* "vector.from_py":53
  6971. * cdef vector[X] v
  6972. * for item in o:
  6973. * v.push_back(X_from_py(item)) # <<<<<<<<<<<<<<
  6974. * return v
  6975. *
  6976. */
  6977. __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;}
  6978. __pyx_v_v.push_back(__pyx_t_5);
  6979. /* "vector.from_py":52
  6980. * cdef vector[X] __pyx_convert_vector_from_py___pyx_t_double_complex(object o) except *:
  6981. * cdef vector[X] v
  6982. * for item in o: # <<<<<<<<<<<<<<
  6983. * v.push_back(X_from_py(item))
  6984. * return v
  6985. */
  6986. }
  6987. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6988. /* "vector.from_py":54
  6989. * for item in o:
  6990. * v.push_back(X_from_py(item))
  6991. * return v # <<<<<<<<<<<<<<
  6992. *
  6993. *
  6994. */
  6995. __pyx_r = __pyx_v_v;
  6996. goto __pyx_L0;
  6997. /* "vector.from_py":50
  6998. *
  6999. * @cname("__pyx_convert_vector_from_py___pyx_t_double_complex")
  7000. * cdef vector[X] __pyx_convert_vector_from_py___pyx_t_double_complex(object o) except *: # <<<<<<<<<<<<<<
  7001. * cdef vector[X] v
  7002. * for item in o:
  7003. */
  7004. /* function exit code */
  7005. __pyx_L1_error:;
  7006. __Pyx_XDECREF(__pyx_t_1);
  7007. __Pyx_XDECREF(__pyx_t_4);
  7008. __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py___pyx_t_double_complex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7009. __pyx_L0:;
  7010. __Pyx_XDECREF(__pyx_v_item);
  7011. __Pyx_RefNannyFinishContext();
  7012. return __pyx_r;
  7013. }
  7014. static PyMethodDef __pyx_methods[] = {
  7015. {0, 0, 0, 0}
  7016. };
  7017. #if PY_MAJOR_VERSION >= 3
  7018. static struct PyModuleDef __pyx_moduledef = {
  7019. #if PY_VERSION_HEX < 0x03020000
  7020. { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
  7021. #else
  7022. PyModuleDef_HEAD_INIT,
  7023. #endif
  7024. "scattnlay",
  7025. 0, /* m_doc */
  7026. -1, /* m_size */
  7027. __pyx_methods /* m_methods */,
  7028. NULL, /* m_reload */
  7029. NULL, /* m_traverse */
  7030. NULL, /* m_clear */
  7031. NULL /* m_free */
  7032. };
  7033. #endif
  7034. static __Pyx_StringTabEntry __pyx_string_tab[] = {
  7035. {&__pyx_n_s_Albedo, __pyx_k_Albedo, sizeof(__pyx_k_Albedo), 0, 0, 1, 1},
  7036. {&__pyx_n_s_C, __pyx_k_C, sizeof(__pyx_k_C), 0, 0, 1, 1},
  7037. {&__pyx_n_s_C_CONTIGUOUS, __pyx_k_C_CONTIGUOUS, sizeof(__pyx_k_C_CONTIGUOUS), 0, 0, 1, 1},
  7038. {&__pyx_n_s_E, __pyx_k_E, sizeof(__pyx_k_E), 0, 0, 1, 1},
  7039. {&__pyx_n_s_Eix, __pyx_k_Eix, sizeof(__pyx_k_Eix), 0, 0, 1, 1},
  7040. {&__pyx_n_s_Eiy, __pyx_k_Eiy, sizeof(__pyx_k_Eiy), 0, 0, 1, 1},
  7041. {&__pyx_n_s_Eiz, __pyx_k_Eiz, sizeof(__pyx_k_Eiz), 0, 0, 1, 1},
  7042. {&__pyx_n_s_Erx, __pyx_k_Erx, sizeof(__pyx_k_Erx), 0, 0, 1, 1},
  7043. {&__pyx_n_s_Ery, __pyx_k_Ery, sizeof(__pyx_k_Ery), 0, 0, 1, 1},
  7044. {&__pyx_n_s_Erz, __pyx_k_Erz, sizeof(__pyx_k_Erz), 0, 0, 1, 1},
  7045. {&__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},
  7046. {&__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},
  7047. {&__pyx_n_s_H, __pyx_k_H, sizeof(__pyx_k_H), 0, 0, 1, 1},
  7048. {&__pyx_n_s_Hix, __pyx_k_Hix, sizeof(__pyx_k_Hix), 0, 0, 1, 1},
  7049. {&__pyx_n_s_Hiy, __pyx_k_Hiy, sizeof(__pyx_k_Hiy), 0, 0, 1, 1},
  7050. {&__pyx_n_s_Hiz, __pyx_k_Hiz, sizeof(__pyx_k_Hiz), 0, 0, 1, 1},
  7051. {&__pyx_n_s_Hrx, __pyx_k_Hrx, sizeof(__pyx_k_Hrx), 0, 0, 1, 1},
  7052. {&__pyx_n_s_Hry, __pyx_k_Hry, sizeof(__pyx_k_Hry), 0, 0, 1, 1},
  7053. {&__pyx_n_s_Hrz, __pyx_k_Hrz, sizeof(__pyx_k_Hrz), 0, 0, 1, 1},
  7054. {&__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},
  7055. {&__pyx_n_s_Qabs, __pyx_k_Qabs, sizeof(__pyx_k_Qabs), 0, 0, 1, 1},
  7056. {&__pyx_n_s_Qbk, __pyx_k_Qbk, sizeof(__pyx_k_Qbk), 0, 0, 1, 1},
  7057. {&__pyx_n_s_Qext, __pyx_k_Qext, sizeof(__pyx_k_Qext), 0, 0, 1, 1},
  7058. {&__pyx_n_s_Qpr, __pyx_k_Qpr, sizeof(__pyx_k_Qpr), 0, 0, 1, 1},
  7059. {&__pyx_n_s_Qsca, __pyx_k_Qsca, sizeof(__pyx_k_Qsca), 0, 0, 1, 1},
  7060. {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
  7061. {&__pyx_n_s_S1, __pyx_k_S1, sizeof(__pyx_k_S1), 0, 0, 1, 1},
  7062. {&__pyx_n_s_S1i, __pyx_k_S1i, sizeof(__pyx_k_S1i), 0, 0, 1, 1},
  7063. {&__pyx_n_s_S1r, __pyx_k_S1r, sizeof(__pyx_k_S1r), 0, 0, 1, 1},
  7064. {&__pyx_n_s_S2, __pyx_k_S2, sizeof(__pyx_k_S2), 0, 0, 1, 1},
  7065. {&__pyx_n_s_S2i, __pyx_k_S2i, sizeof(__pyx_k_S2i), 0, 0, 1, 1},
  7066. {&__pyx_n_s_S2r, __pyx_k_S2r, sizeof(__pyx_k_S2r), 0, 0, 1, 1},
  7067. {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  7068. {&__pyx_n_s_an, __pyx_k_an, sizeof(__pyx_k_an), 0, 0, 1, 1},
  7069. {&__pyx_n_s_ani, __pyx_k_ani, sizeof(__pyx_k_ani), 0, 0, 1, 1},
  7070. {&__pyx_n_s_anr, __pyx_k_anr, sizeof(__pyx_k_anr), 0, 0, 1, 1},
  7071. {&__pyx_n_s_bn, __pyx_k_bn, sizeof(__pyx_k_bn), 0, 0, 1, 1},
  7072. {&__pyx_n_s_bni, __pyx_k_bni, sizeof(__pyx_k_bni), 0, 0, 1, 1},
  7073. {&__pyx_n_s_bnr, __pyx_k_bnr, sizeof(__pyx_k_bnr), 0, 0, 1, 1},
  7074. {&__pyx_n_s_complex128, __pyx_k_complex128, sizeof(__pyx_k_complex128), 0, 0, 1, 1},
  7075. {&__pyx_n_s_coords, __pyx_k_coords, sizeof(__pyx_k_coords), 0, 0, 1, 1},
  7076. {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1},
  7077. {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
  7078. {&__pyx_n_s_fieldnlay, __pyx_k_fieldnlay, sizeof(__pyx_k_fieldnlay), 0, 0, 1, 1},
  7079. {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
  7080. {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1},
  7081. {&__pyx_n_s_g, __pyx_k_g, sizeof(__pyx_k_g), 0, 0, 1, 1},
  7082. {&__pyx_kp_s_home_tig_KOsty_Documents_Simula, __pyx_k_home_tig_KOsty_Documents_Simula, sizeof(__pyx_k_home_tig_KOsty_Documents_Simula), 0, 0, 1, 0},
  7083. {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
  7084. {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  7085. {&__pyx_n_s_int, __pyx_k_int, sizeof(__pyx_k_int), 0, 0, 1, 1},
  7086. {&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 0, 1, 1},
  7087. {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  7088. {&__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},
  7089. {&__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},
  7090. {&__pyx_n_s_nmax, __pyx_k_nmax, sizeof(__pyx_k_nmax), 0, 0, 1, 1},
  7091. {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
  7092. {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
  7093. {&__pyx_n_s_pl, __pyx_k_pl, sizeof(__pyx_k_pl), 0, 0, 1, 1},
  7094. {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  7095. {&__pyx_n_s_scattcoeffs, __pyx_k_scattcoeffs, sizeof(__pyx_k_scattcoeffs), 0, 0, 1, 1},
  7096. {&__pyx_n_s_scattnlay, __pyx_k_scattnlay, sizeof(__pyx_k_scattnlay), 0, 0, 1, 1},
  7097. {&__pyx_n_s_terms, __pyx_k_terms, sizeof(__pyx_k_terms), 0, 0, 1, 1},
  7098. {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  7099. {&__pyx_n_s_theta, __pyx_k_theta, sizeof(__pyx_k_theta), 0, 0, 1, 1},
  7100. {&__pyx_n_s_transpose, __pyx_k_transpose, sizeof(__pyx_k_transpose), 0, 0, 1, 1},
  7101. {&__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},
  7102. {&__pyx_n_s_vstack, __pyx_k_vstack, sizeof(__pyx_k_vstack), 0, 0, 1, 1},
  7103. {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
  7104. {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
  7105. {0, 0, 0, 0, 0, 0, 0}
  7106. };
  7107. static int __Pyx_InitCachedBuiltins(void) {
  7108. __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7109. __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;}
  7110. __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7111. return 0;
  7112. __pyx_L1_error:;
  7113. return -1;
  7114. }
  7115. static int __Pyx_InitCachedConstants(void) {
  7116. __Pyx_RefNannyDeclarations
  7117. __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
  7118. /* "scattnlay.pyx":39
  7119. *
  7120. * if not (<object>a).flags["C_CONTIGUOUS"]: # Array is not contiguous, need to make contiguous copy
  7121. * a = a.copy('C') # <<<<<<<<<<<<<<
  7122. *
  7123. * # Return data pointer
  7124. */
  7125. __pyx_tuple_ = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7126. __Pyx_GOTREF(__pyx_tuple_);
  7127. __Pyx_GIVEREF(__pyx_tuple_);
  7128. /* "scattnlay.pyx":68
  7129. * bni = np.zeros(nmax, dtype = np.float64)
  7130. *
  7131. * terms[i] = ScattCoeffs(x.shape[1], pl, x[i].copy('C'), m[i].copy('C'), nmax, npy2c(anr), npy2c(ani), npy2c(bnr), npy2c(bni)) # <<<<<<<<<<<<<<
  7132. *
  7133. * an[i] = anr.copy('C') + 1.0j*ani.copy('C')
  7134. */
  7135. __pyx_tuple__2 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7136. __Pyx_GOTREF(__pyx_tuple__2);
  7137. __Pyx_GIVEREF(__pyx_tuple__2);
  7138. __pyx_tuple__3 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7139. __Pyx_GOTREF(__pyx_tuple__3);
  7140. __Pyx_GIVEREF(__pyx_tuple__3);
  7141. /* "scattnlay.pyx":70
  7142. * terms[i] = ScattCoeffs(x.shape[1], pl, x[i].copy('C'), m[i].copy('C'), nmax, npy2c(anr), npy2c(ani), npy2c(bnr), npy2c(bni))
  7143. *
  7144. * an[i] = anr.copy('C') + 1.0j*ani.copy('C') # <<<<<<<<<<<<<<
  7145. * bn[i] = bnr.copy('C') + 1.0j*bni.copy('C')
  7146. *
  7147. */
  7148. __pyx_tuple__4 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7149. __Pyx_GOTREF(__pyx_tuple__4);
  7150. __Pyx_GIVEREF(__pyx_tuple__4);
  7151. __pyx_tuple__5 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7152. __Pyx_GOTREF(__pyx_tuple__5);
  7153. __Pyx_GIVEREF(__pyx_tuple__5);
  7154. /* "scattnlay.pyx":71
  7155. *
  7156. * an[i] = anr.copy('C') + 1.0j*ani.copy('C')
  7157. * bn[i] = bnr.copy('C') + 1.0j*bni.copy('C') # <<<<<<<<<<<<<<
  7158. *
  7159. * return terms, an, bn
  7160. */
  7161. __pyx_tuple__6 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7162. __Pyx_GOTREF(__pyx_tuple__6);
  7163. __Pyx_GIVEREF(__pyx_tuple__6);
  7164. __pyx_tuple__7 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7165. __Pyx_GOTREF(__pyx_tuple__7);
  7166. __Pyx_GIVEREF(__pyx_tuple__7);
  7167. /* "scattnlay.pyx":102
  7168. * S2i = np.zeros(theta.shape[0], dtype = np.float64)
  7169. *
  7170. * 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)) # <<<<<<<<<<<<<<
  7171. *
  7172. * S1[i] = S1r.copy('C') + 1.0j*S1i.copy('C')
  7173. */
  7174. __pyx_tuple__9 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7175. __Pyx_GOTREF(__pyx_tuple__9);
  7176. __Pyx_GIVEREF(__pyx_tuple__9);
  7177. __pyx_tuple__10 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7178. __Pyx_GOTREF(__pyx_tuple__10);
  7179. __Pyx_GIVEREF(__pyx_tuple__10);
  7180. __pyx_tuple__11 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7181. __Pyx_GOTREF(__pyx_tuple__11);
  7182. __Pyx_GIVEREF(__pyx_tuple__11);
  7183. /* "scattnlay.pyx":104
  7184. * 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))
  7185. *
  7186. * S1[i] = S1r.copy('C') + 1.0j*S1i.copy('C') # <<<<<<<<<<<<<<
  7187. * S2[i] = S2r.copy('C') + 1.0j*S2i.copy('C')
  7188. *
  7189. */
  7190. __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7191. __Pyx_GOTREF(__pyx_tuple__12);
  7192. __Pyx_GIVEREF(__pyx_tuple__12);
  7193. __pyx_tuple__13 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7194. __Pyx_GOTREF(__pyx_tuple__13);
  7195. __Pyx_GIVEREF(__pyx_tuple__13);
  7196. /* "scattnlay.pyx":105
  7197. *
  7198. * S1[i] = S1r.copy('C') + 1.0j*S1i.copy('C')
  7199. * S2[i] = S2r.copy('C') + 1.0j*S2i.copy('C') # <<<<<<<<<<<<<<
  7200. *
  7201. * return terms, Qext, Qsca, Qabs, Qbk, Qpr, g, Albedo, S1, S2
  7202. */
  7203. __pyx_tuple__14 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7204. __Pyx_GOTREF(__pyx_tuple__14);
  7205. __Pyx_GIVEREF(__pyx_tuple__14);
  7206. __pyx_tuple__15 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7207. __Pyx_GOTREF(__pyx_tuple__15);
  7208. __Pyx_GIVEREF(__pyx_tuple__15);
  7209. /* "scattnlay.pyx":144
  7210. * Hiz = np.zeros(coords.shape[0], dtype = np.float64)
  7211. *
  7212. * 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)) # <<<<<<<<<<<<<<
  7213. *
  7214. * 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()
  7215. */
  7216. __pyx_tuple__16 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7217. __Pyx_GOTREF(__pyx_tuple__16);
  7218. __Pyx_GIVEREF(__pyx_tuple__16);
  7219. __pyx_tuple__17 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7220. __Pyx_GOTREF(__pyx_tuple__17);
  7221. __Pyx_GIVEREF(__pyx_tuple__17);
  7222. __pyx_slice__18 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7223. __Pyx_GOTREF(__pyx_slice__18);
  7224. __Pyx_GIVEREF(__pyx_slice__18);
  7225. __pyx_tuple__19 = PyTuple_Pack(2, __pyx_slice__18, __pyx_int_0); if (unlikely(!__pyx_tuple__19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7226. __Pyx_GOTREF(__pyx_tuple__19);
  7227. __Pyx_GIVEREF(__pyx_tuple__19);
  7228. __pyx_tuple__20 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7229. __Pyx_GOTREF(__pyx_tuple__20);
  7230. __Pyx_GIVEREF(__pyx_tuple__20);
  7231. __pyx_slice__21 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7232. __Pyx_GOTREF(__pyx_slice__21);
  7233. __Pyx_GIVEREF(__pyx_slice__21);
  7234. __pyx_tuple__22 = PyTuple_Pack(2, __pyx_slice__21, __pyx_int_1); if (unlikely(!__pyx_tuple__22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7235. __Pyx_GOTREF(__pyx_tuple__22);
  7236. __Pyx_GIVEREF(__pyx_tuple__22);
  7237. __pyx_tuple__23 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7238. __Pyx_GOTREF(__pyx_tuple__23);
  7239. __Pyx_GIVEREF(__pyx_tuple__23);
  7240. __pyx_slice__24 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7241. __Pyx_GOTREF(__pyx_slice__24);
  7242. __Pyx_GIVEREF(__pyx_slice__24);
  7243. __pyx_tuple__25 = PyTuple_Pack(2, __pyx_slice__24, __pyx_int_2); if (unlikely(!__pyx_tuple__25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7244. __Pyx_GOTREF(__pyx_tuple__25);
  7245. __Pyx_GIVEREF(__pyx_tuple__25);
  7246. __pyx_tuple__26 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7247. __Pyx_GOTREF(__pyx_tuple__26);
  7248. __Pyx_GIVEREF(__pyx_tuple__26);
  7249. /* "scattnlay.pyx":146
  7250. * 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))
  7251. *
  7252. * 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() # <<<<<<<<<<<<<<
  7253. * 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()
  7254. *
  7255. */
  7256. __pyx_tuple__27 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7257. __Pyx_GOTREF(__pyx_tuple__27);
  7258. __Pyx_GIVEREF(__pyx_tuple__27);
  7259. __pyx_tuple__28 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7260. __Pyx_GOTREF(__pyx_tuple__28);
  7261. __Pyx_GIVEREF(__pyx_tuple__28);
  7262. __pyx_tuple__29 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7263. __Pyx_GOTREF(__pyx_tuple__29);
  7264. __Pyx_GIVEREF(__pyx_tuple__29);
  7265. __pyx_tuple__30 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7266. __Pyx_GOTREF(__pyx_tuple__30);
  7267. __Pyx_GIVEREF(__pyx_tuple__30);
  7268. __pyx_tuple__31 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7269. __Pyx_GOTREF(__pyx_tuple__31);
  7270. __Pyx_GIVEREF(__pyx_tuple__31);
  7271. __pyx_tuple__32 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7272. __Pyx_GOTREF(__pyx_tuple__32);
  7273. __Pyx_GIVEREF(__pyx_tuple__32);
  7274. /* "scattnlay.pyx":147
  7275. *
  7276. * 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()
  7277. * 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() # <<<<<<<<<<<<<<
  7278. *
  7279. * return terms, E, H
  7280. */
  7281. __pyx_tuple__33 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7282. __Pyx_GOTREF(__pyx_tuple__33);
  7283. __Pyx_GIVEREF(__pyx_tuple__33);
  7284. __pyx_tuple__34 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7285. __Pyx_GOTREF(__pyx_tuple__34);
  7286. __Pyx_GIVEREF(__pyx_tuple__34);
  7287. __pyx_tuple__35 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7288. __Pyx_GOTREF(__pyx_tuple__35);
  7289. __Pyx_GIVEREF(__pyx_tuple__35);
  7290. __pyx_tuple__36 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7291. __Pyx_GOTREF(__pyx_tuple__36);
  7292. __Pyx_GIVEREF(__pyx_tuple__36);
  7293. __pyx_tuple__37 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7294. __Pyx_GOTREF(__pyx_tuple__37);
  7295. __Pyx_GIVEREF(__pyx_tuple__37);
  7296. __pyx_tuple__38 = PyTuple_Pack(1, __pyx_n_s_C); if (unlikely(!__pyx_tuple__38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7297. __Pyx_GOTREF(__pyx_tuple__38);
  7298. __Pyx_GIVEREF(__pyx_tuple__38);
  7299. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":218
  7300. * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
  7301. * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
  7302. * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
  7303. *
  7304. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  7305. */
  7306. __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;}
  7307. __Pyx_GOTREF(__pyx_tuple__39);
  7308. __Pyx_GIVEREF(__pyx_tuple__39);
  7309. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":222
  7310. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  7311. * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
  7312. * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
  7313. *
  7314. * info.buf = PyArray_DATA(self)
  7315. */
  7316. __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;}
  7317. __Pyx_GOTREF(__pyx_tuple__40);
  7318. __Pyx_GIVEREF(__pyx_tuple__40);
  7319. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":260
  7320. * if ((descr.byteorder == c'>' and little_endian) or
  7321. * (descr.byteorder == c'<' and not little_endian)):
  7322. * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
  7323. * if t == NPY_BYTE: f = "b"
  7324. * elif t == NPY_UBYTE: f = "B"
  7325. */
  7326. __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 = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7327. __Pyx_GOTREF(__pyx_tuple__41);
  7328. __Pyx_GIVEREF(__pyx_tuple__41);
  7329. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":802
  7330. *
  7331. * if (end - f) - <int>(new_offset - offset[0]) < 15:
  7332. * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
  7333. *
  7334. * if ((child.byteorder == c'>' and little_endian) or
  7335. */
  7336. __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 = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7337. __Pyx_GOTREF(__pyx_tuple__42);
  7338. __Pyx_GIVEREF(__pyx_tuple__42);
  7339. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":806
  7340. * if ((child.byteorder == c'>' and little_endian) or
  7341. * (child.byteorder == c'<' and not little_endian)):
  7342. * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
  7343. * # One could encode it in the format string and have Cython
  7344. * # complain instead, BUT: < and > in format strings also imply
  7345. */
  7346. __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 = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7347. __Pyx_GOTREF(__pyx_tuple__43);
  7348. __Pyx_GIVEREF(__pyx_tuple__43);
  7349. /* "../../../../../../../../usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":826
  7350. * t = child.type_num
  7351. * if end - f < 5:
  7352. * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
  7353. *
  7354. * # Until ticket #99 is fixed, use integers to avoid warnings
  7355. */
  7356. __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 = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7357. __Pyx_GOTREF(__pyx_tuple__44);
  7358. __Pyx_GIVEREF(__pyx_tuple__44);
  7359. /* "scattnlay.pyx":49
  7360. * 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[])
  7361. *
  7362. * 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): # <<<<<<<<<<<<<<
  7363. * cdef Py_ssize_t i
  7364. *
  7365. */
  7366. __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 = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7367. __Pyx_GOTREF(__pyx_tuple__45);
  7368. __Pyx_GIVEREF(__pyx_tuple__45);
  7369. __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_tig_KOsty_Documents_Simula, __pyx_n_s_scattcoeffs, 49, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7370. /* "scattnlay.pyx":75
  7371. * return terms, an, bn
  7372. *
  7373. * 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): # <<<<<<<<<<<<<<
  7374. * cdef Py_ssize_t i
  7375. *
  7376. */
  7377. __pyx_tuple__47 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7378. __Pyx_GOTREF(__pyx_tuple__47);
  7379. __Pyx_GIVEREF(__pyx_tuple__47);
  7380. __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 = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7381. __Pyx_GOTREF(__pyx_tuple__48);
  7382. __Pyx_GIVEREF(__pyx_tuple__48);
  7383. __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_tig_KOsty_Documents_Simula, __pyx_n_s_scattnlay, 75, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7384. /* "scattnlay.pyx":109
  7385. * return terms, Qext, Qsca, Qabs, Qbk, Qpr, g, Albedo, S1, S2
  7386. *
  7387. * 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): # <<<<<<<<<<<<<<
  7388. * cdef Py_ssize_t i
  7389. *
  7390. */
  7391. __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 = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7392. __Pyx_GOTREF(__pyx_tuple__50);
  7393. __Pyx_GIVEREF(__pyx_tuple__50);
  7394. __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_tig_KOsty_Documents_Simula, __pyx_n_s_fieldnlay, 109, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7395. __Pyx_RefNannyFinishContext();
  7396. return 0;
  7397. __pyx_L1_error:;
  7398. __Pyx_RefNannyFinishContext();
  7399. return -1;
  7400. }
  7401. static int __Pyx_InitGlobals(void) {
  7402. if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  7403. __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;}
  7404. __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;}
  7405. __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;}
  7406. __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;}
  7407. return 0;
  7408. __pyx_L1_error:;
  7409. return -1;
  7410. }
  7411. #if PY_MAJOR_VERSION < 3
  7412. PyMODINIT_FUNC initscattnlay(void); /*proto*/
  7413. PyMODINIT_FUNC initscattnlay(void)
  7414. #else
  7415. PyMODINIT_FUNC PyInit_scattnlay(void); /*proto*/
  7416. PyMODINIT_FUNC PyInit_scattnlay(void)
  7417. #endif
  7418. {
  7419. PyObject *__pyx_t_1 = NULL;
  7420. PyObject *__pyx_t_2 = NULL;
  7421. PyObject *__pyx_t_3 = NULL;
  7422. PyObject *__pyx_t_4 = NULL;
  7423. int __pyx_lineno = 0;
  7424. const char *__pyx_filename = NULL;
  7425. int __pyx_clineno = 0;
  7426. __Pyx_RefNannyDeclarations
  7427. #if CYTHON_REFNANNY
  7428. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  7429. if (!__Pyx_RefNanny) {
  7430. PyErr_Clear();
  7431. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  7432. if (!__Pyx_RefNanny)
  7433. Py_FatalError("failed to import 'refnanny' module");
  7434. }
  7435. #endif
  7436. __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_scattnlay(void)", 0);
  7437. if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7438. __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;}
  7439. __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;}
  7440. #ifdef __Pyx_CyFunction_USED
  7441. if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7442. #endif
  7443. #ifdef __Pyx_FusedFunction_USED
  7444. if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7445. #endif
  7446. #ifdef __Pyx_Generator_USED
  7447. if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7448. #endif
  7449. /*--- Library function declarations ---*/
  7450. /*--- Threads initialization code ---*/
  7451. #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  7452. #ifdef WITH_THREAD /* Python build with threading support? */
  7453. PyEval_InitThreads();
  7454. #endif
  7455. #endif
  7456. /*--- Module creation code ---*/
  7457. #if PY_MAJOR_VERSION < 3
  7458. __pyx_m = Py_InitModule4("scattnlay", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  7459. #else
  7460. __pyx_m = PyModule_Create(&__pyx_moduledef);
  7461. #endif
  7462. if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7463. __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;}
  7464. Py_INCREF(__pyx_d);
  7465. __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;}
  7466. #if CYTHON_COMPILING_IN_PYPY
  7467. Py_INCREF(__pyx_b);
  7468. #endif
  7469. if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  7470. /*--- Initialize various global constants etc. ---*/
  7471. if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7472. #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  7473. if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7474. #endif
  7475. if (__pyx_module_is_main_scattnlay) {
  7476. 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;};
  7477. }
  7478. #if PY_MAJOR_VERSION >= 3
  7479. {
  7480. PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7481. if (!PyDict_GetItemString(modules, "scattnlay")) {
  7482. if (unlikely(PyDict_SetItemString(modules, "scattnlay", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7483. }
  7484. }
  7485. #endif
  7486. /*--- Builtin init code ---*/
  7487. if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7488. /*--- Constants init code ---*/
  7489. if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7490. /*--- Global init code ---*/
  7491. /*--- Variable export code ---*/
  7492. /*--- Function export code ---*/
  7493. /*--- Type init code ---*/
  7494. /*--- Type import code ---*/
  7495. __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type",
  7496. #if CYTHON_COMPILING_IN_PYPY
  7497. sizeof(PyTypeObject),
  7498. #else
  7499. sizeof(PyHeapTypeObject),
  7500. #endif
  7501. 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7502. __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;}
  7503. __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;}
  7504. __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;}
  7505. __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;}
  7506. __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7507. /*--- Variable import code ---*/
  7508. /*--- Function import code ---*/
  7509. /*--- Execution code ---*/
  7510. /* "scattnlay.pyx":30
  7511. *
  7512. * from __future__ import division
  7513. * import numpy as np # <<<<<<<<<<<<<<
  7514. * cimport numpy as np
  7515. * from libcpp.vector cimport vector
  7516. */
  7517. __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7518. __Pyx_GOTREF(__pyx_t_1);
  7519. if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7520. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7521. /* "scattnlay.pyx":49
  7522. * 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[])
  7523. *
  7524. * 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): # <<<<<<<<<<<<<<
  7525. * cdef Py_ssize_t i
  7526. *
  7527. */
  7528. __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9scattnlay_1scattcoeffs, NULL, __pyx_n_s_scattnlay); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7529. __Pyx_GOTREF(__pyx_t_1);
  7530. if (PyDict_SetItem(__pyx_d, __pyx_n_s_scattcoeffs, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7531. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7532. /* "scattnlay.pyx":75
  7533. * return terms, an, bn
  7534. *
  7535. * 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): # <<<<<<<<<<<<<<
  7536. * cdef Py_ssize_t i
  7537. *
  7538. */
  7539. __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7540. __Pyx_GOTREF(__pyx_t_1);
  7541. __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 = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7542. __Pyx_GOTREF(__pyx_t_2);
  7543. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7544. __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7545. __Pyx_GOTREF(__pyx_t_1);
  7546. __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7547. __Pyx_GOTREF(__pyx_t_3);
  7548. __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 = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7549. __Pyx_GOTREF(__pyx_t_4);
  7550. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7551. if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7552. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7553. __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 = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7554. __Pyx_GOTREF(__pyx_t_4);
  7555. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7556. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7557. if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7558. __pyx_k__8 = ((PyArrayObject *)__pyx_t_4);
  7559. __Pyx_GIVEREF(__pyx_t_4);
  7560. __pyx_t_4 = 0;
  7561. __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_9scattnlay_3scattnlay, NULL, __pyx_n_s_scattnlay); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7562. __Pyx_GOTREF(__pyx_t_4);
  7563. if (PyDict_SetItem(__pyx_d, __pyx_n_s_scattnlay, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7564. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7565. /* "scattnlay.pyx":109
  7566. * return terms, Qext, Qsca, Qabs, Qbk, Qpr, g, Albedo, S1, S2
  7567. *
  7568. * 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): # <<<<<<<<<<<<<<
  7569. * cdef Py_ssize_t i
  7570. *
  7571. */
  7572. __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_9scattnlay_5fieldnlay, NULL, __pyx_n_s_scattnlay); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7573. __Pyx_GOTREF(__pyx_t_4);
  7574. if (PyDict_SetItem(__pyx_d, __pyx_n_s_fieldnlay, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7575. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7576. /* "scattnlay.pyx":1
  7577. * # Copyright (C) 2009-2015 Ovidio Pena <ovidio@bytesfall.com> # <<<<<<<<<<<<<<
  7578. * # Copyright (C) 2013-2015 Konstantin Ladutenko <kostyfisik@gmail.com>
  7579. * #
  7580. */
  7581. __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;}
  7582. __Pyx_GOTREF(__pyx_t_4);
  7583. 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;}
  7584. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7585. /* "vector.from_py":50
  7586. *
  7587. * @cname("__pyx_convert_vector_from_py___pyx_t_double_complex")
  7588. * cdef vector[X] __pyx_convert_vector_from_py___pyx_t_double_complex(object o) except *: # <<<<<<<<<<<<<<
  7589. * cdef vector[X] v
  7590. * for item in o:
  7591. */
  7592. /*--- Wrapped vars code ---*/
  7593. goto __pyx_L0;
  7594. __pyx_L1_error:;
  7595. __Pyx_XDECREF(__pyx_t_1);
  7596. __Pyx_XDECREF(__pyx_t_2);
  7597. __Pyx_XDECREF(__pyx_t_3);
  7598. __Pyx_XDECREF(__pyx_t_4);
  7599. if (__pyx_m) {
  7600. if (__pyx_d) {
  7601. __Pyx_AddTraceback("init scattnlay", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7602. }
  7603. Py_DECREF(__pyx_m); __pyx_m = 0;
  7604. } else if (!PyErr_Occurred()) {
  7605. PyErr_SetString(PyExc_ImportError, "init scattnlay");
  7606. }
  7607. __pyx_L0:;
  7608. __Pyx_RefNannyFinishContext();
  7609. #if PY_MAJOR_VERSION < 3
  7610. return;
  7611. #else
  7612. return __pyx_m;
  7613. #endif
  7614. }
  7615. /* --- Runtime support code --- */
  7616. #if CYTHON_REFNANNY
  7617. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
  7618. PyObject *m = NULL, *p = NULL;
  7619. void *r = NULL;
  7620. m = PyImport_ImportModule((char *)modname);
  7621. if (!m) goto end;
  7622. p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
  7623. if (!p) goto end;
  7624. r = PyLong_AsVoidPtr(p);
  7625. end:
  7626. Py_XDECREF(p);
  7627. Py_XDECREF(m);
  7628. return (__Pyx_RefNannyAPIStruct *)r;
  7629. }
  7630. #endif
  7631. static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
  7632. PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
  7633. if (unlikely(!result)) {
  7634. PyErr_Format(PyExc_NameError,
  7635. #if PY_MAJOR_VERSION >= 3
  7636. "name '%U' is not defined", name);
  7637. #else
  7638. "name '%.200s' is not defined", PyString_AS_STRING(name));
  7639. #endif
  7640. }
  7641. return result;
  7642. }
  7643. static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
  7644. PyObject *result;
  7645. #if CYTHON_COMPILING_IN_CPYTHON
  7646. result = PyDict_GetItem(__pyx_d, name);
  7647. if (likely(result)) {
  7648. Py_INCREF(result);
  7649. } else {
  7650. #else
  7651. result = PyObject_GetItem(__pyx_d, name);
  7652. if (!result) {
  7653. PyErr_Clear();
  7654. #endif
  7655. result = __Pyx_GetBuiltinName(name);
  7656. }
  7657. return result;
  7658. }
  7659. #if CYTHON_COMPILING_IN_CPYTHON
  7660. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  7661. PyObject *result;
  7662. ternaryfunc call = func->ob_type->tp_call;
  7663. if (unlikely(!call))
  7664. return PyObject_Call(func, arg, kw);
  7665. if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
  7666. return NULL;
  7667. result = (*call)(func, arg, kw);
  7668. Py_LeaveRecursiveCall();
  7669. if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  7670. PyErr_SetString(
  7671. PyExc_SystemError,
  7672. "NULL result without error in PyObject_Call");
  7673. }
  7674. return result;
  7675. }
  7676. #endif
  7677. static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
  7678. if (unlikely(!type)) {
  7679. PyErr_SetString(PyExc_SystemError, "Missing type object");
  7680. return 0;
  7681. }
  7682. if (likely(PyObject_TypeCheck(obj, type)))
  7683. return 1;
  7684. PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
  7685. Py_TYPE(obj)->tp_name, type->tp_name);
  7686. return 0;
  7687. }
  7688. static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
  7689. #if CYTHON_COMPILING_IN_CPYTHON
  7690. PyObject *tmp_type, *tmp_value, *tmp_tb;
  7691. PyThreadState *tstate = PyThreadState_GET();
  7692. tmp_type = tstate->curexc_type;
  7693. tmp_value = tstate->curexc_value;
  7694. tmp_tb = tstate->curexc_traceback;
  7695. tstate->curexc_type = type;
  7696. tstate->curexc_value = value;
  7697. tstate->curexc_traceback = tb;
  7698. Py_XDECREF(tmp_type);
  7699. Py_XDECREF(tmp_value);
  7700. Py_XDECREF(tmp_tb);
  7701. #else
  7702. PyErr_Restore(type, value, tb);
  7703. #endif
  7704. }
  7705. static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
  7706. #if CYTHON_COMPILING_IN_CPYTHON
  7707. PyThreadState *tstate = PyThreadState_GET();
  7708. *type = tstate->curexc_type;
  7709. *value = tstate->curexc_value;
  7710. *tb = tstate->curexc_traceback;
  7711. tstate->curexc_type = 0;
  7712. tstate->curexc_value = 0;
  7713. tstate->curexc_traceback = 0;
  7714. #else
  7715. PyErr_Fetch(type, value, tb);
  7716. #endif
  7717. }
  7718. static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
  7719. CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
  7720. int full_traceback) {
  7721. PyObject *old_exc, *old_val, *old_tb;
  7722. PyObject *ctx;
  7723. __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
  7724. if (full_traceback) {
  7725. Py_XINCREF(old_exc);
  7726. Py_XINCREF(old_val);
  7727. Py_XINCREF(old_tb);
  7728. __Pyx_ErrRestore(old_exc, old_val, old_tb);
  7729. PyErr_PrintEx(1);
  7730. }
  7731. #if PY_MAJOR_VERSION < 3
  7732. ctx = PyString_FromString(name);
  7733. #else
  7734. ctx = PyUnicode_FromString(name);
  7735. #endif
  7736. __Pyx_ErrRestore(old_exc, old_val, old_tb);
  7737. if (!ctx) {
  7738. PyErr_WriteUnraisable(Py_None);
  7739. } else {
  7740. PyErr_WriteUnraisable(ctx);
  7741. Py_DECREF(ctx);
  7742. }
  7743. }
  7744. static void __Pyx_RaiseArgtupleInvalid(
  7745. const char* func_name,
  7746. int exact,
  7747. Py_ssize_t num_min,
  7748. Py_ssize_t num_max,
  7749. Py_ssize_t num_found)
  7750. {
  7751. Py_ssize_t num_expected;
  7752. const char *more_or_less;
  7753. if (num_found < num_min) {
  7754. num_expected = num_min;
  7755. more_or_less = "at least";
  7756. } else {
  7757. num_expected = num_max;
  7758. more_or_less = "at most";
  7759. }
  7760. if (exact) {
  7761. more_or_less = "exactly";
  7762. }
  7763. PyErr_Format(PyExc_TypeError,
  7764. "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
  7765. func_name, more_or_less, num_expected,
  7766. (num_expected == 1) ? "" : "s", num_found);
  7767. }
  7768. static void __Pyx_RaiseDoubleKeywordsError(
  7769. const char* func_name,
  7770. PyObject* kw_name)
  7771. {
  7772. PyErr_Format(PyExc_TypeError,
  7773. #if PY_MAJOR_VERSION >= 3
  7774. "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
  7775. #else
  7776. "%s() got multiple values for keyword argument '%s'", func_name,
  7777. PyString_AsString(kw_name));
  7778. #endif
  7779. }
  7780. static int __Pyx_ParseOptionalKeywords(
  7781. PyObject *kwds,
  7782. PyObject **argnames[],
  7783. PyObject *kwds2,
  7784. PyObject *values[],
  7785. Py_ssize_t num_pos_args,
  7786. const char* function_name)
  7787. {
  7788. PyObject *key = 0, *value = 0;
  7789. Py_ssize_t pos = 0;
  7790. PyObject*** name;
  7791. PyObject*** first_kw_arg = argnames + num_pos_args;
  7792. while (PyDict_Next(kwds, &pos, &key, &value)) {
  7793. name = first_kw_arg;
  7794. while (*name && (**name != key)) name++;
  7795. if (*name) {
  7796. values[name-argnames] = value;
  7797. continue;
  7798. }
  7799. name = first_kw_arg;
  7800. #if PY_MAJOR_VERSION < 3
  7801. if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
  7802. while (*name) {
  7803. if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
  7804. && _PyString_Eq(**name, key)) {
  7805. values[name-argnames] = value;
  7806. break;
  7807. }
  7808. name++;
  7809. }
  7810. if (*name) continue;
  7811. else {
  7812. PyObject*** argname = argnames;
  7813. while (argname != first_kw_arg) {
  7814. if ((**argname == key) || (
  7815. (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
  7816. && _PyString_Eq(**argname, key))) {
  7817. goto arg_passed_twice;
  7818. }
  7819. argname++;
  7820. }
  7821. }
  7822. } else
  7823. #endif
  7824. if (likely(PyUnicode_Check(key))) {
  7825. while (*name) {
  7826. int cmp = (**name == key) ? 0 :
  7827. #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
  7828. (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
  7829. #endif
  7830. PyUnicode_Compare(**name, key);
  7831. if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  7832. if (cmp == 0) {
  7833. values[name-argnames] = value;
  7834. break;
  7835. }
  7836. name++;
  7837. }
  7838. if (*name) continue;
  7839. else {
  7840. PyObject*** argname = argnames;
  7841. while (argname != first_kw_arg) {
  7842. int cmp = (**argname == key) ? 0 :
  7843. #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
  7844. (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
  7845. #endif
  7846. PyUnicode_Compare(**argname, key);
  7847. if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  7848. if (cmp == 0) goto arg_passed_twice;
  7849. argname++;
  7850. }
  7851. }
  7852. } else
  7853. goto invalid_keyword_type;
  7854. if (kwds2) {
  7855. if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
  7856. } else {
  7857. goto invalid_keyword;
  7858. }
  7859. }
  7860. return 0;
  7861. arg_passed_twice:
  7862. __Pyx_RaiseDoubleKeywordsError(function_name, key);
  7863. goto bad;
  7864. invalid_keyword_type:
  7865. PyErr_Format(PyExc_TypeError,
  7866. "%.200s() keywords must be strings", function_name);
  7867. goto bad;
  7868. invalid_keyword:
  7869. PyErr_Format(PyExc_TypeError,
  7870. #if PY_MAJOR_VERSION < 3
  7871. "%.200s() got an unexpected keyword argument '%.200s'",
  7872. function_name, PyString_AsString(key));
  7873. #else
  7874. "%s() got an unexpected keyword argument '%U'",
  7875. function_name, key);
  7876. #endif
  7877. bad:
  7878. return -1;
  7879. }
  7880. static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
  7881. PyErr_Format(PyExc_TypeError,
  7882. "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
  7883. name, type->tp_name, Py_TYPE(obj)->tp_name);
  7884. }
  7885. static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
  7886. const char *name, int exact)
  7887. {
  7888. if (unlikely(!type)) {
  7889. PyErr_SetString(PyExc_SystemError, "Missing type object");
  7890. return 0;
  7891. }
  7892. if (none_allowed && obj == Py_None) return 1;
  7893. else if (exact) {
  7894. if (likely(Py_TYPE(obj) == type)) return 1;
  7895. #if PY_MAJOR_VERSION == 2
  7896. else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
  7897. #endif
  7898. }
  7899. else {
  7900. if (likely(PyObject_TypeCheck(obj, type))) return 1;
  7901. }
  7902. __Pyx_RaiseArgumentTypeInvalid(name, obj, type);
  7903. return 0;
  7904. }
  7905. static CYTHON_INLINE int __Pyx_IsLittleEndian(void) {
  7906. unsigned int n = 1;
  7907. return *(unsigned char*)(&n) != 0;
  7908. }
  7909. static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
  7910. __Pyx_BufFmt_StackElem* stack,
  7911. __Pyx_TypeInfo* type) {
  7912. stack[0].field = &ctx->root;
  7913. stack[0].parent_offset = 0;
  7914. ctx->root.type = type;
  7915. ctx->root.name = "buffer dtype";
  7916. ctx->root.offset = 0;
  7917. ctx->head = stack;
  7918. ctx->head->field = &ctx->root;
  7919. ctx->fmt_offset = 0;
  7920. ctx->head->parent_offset = 0;
  7921. ctx->new_packmode = '@';
  7922. ctx->enc_packmode = '@';
  7923. ctx->new_count = 1;
  7924. ctx->enc_count = 0;
  7925. ctx->enc_type = 0;
  7926. ctx->is_complex = 0;
  7927. ctx->is_valid_array = 0;
  7928. ctx->struct_alignment = 0;
  7929. while (type->typegroup == 'S') {
  7930. ++ctx->head;
  7931. ctx->head->field = type->fields;
  7932. ctx->head->parent_offset = 0;
  7933. type = type->fields->type;
  7934. }
  7935. }
  7936. static int __Pyx_BufFmt_ParseNumber(const char** ts) {
  7937. int count;
  7938. const char* t = *ts;
  7939. if (*t < '0' || *t > '9') {
  7940. return -1;
  7941. } else {
  7942. count = *t++ - '0';
  7943. while (*t >= '0' && *t < '9') {
  7944. count *= 10;
  7945. count += *t++ - '0';
  7946. }
  7947. }
  7948. *ts = t;
  7949. return count;
  7950. }
  7951. static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
  7952. int number = __Pyx_BufFmt_ParseNumber(ts);
  7953. if (number == -1)
  7954. PyErr_Format(PyExc_ValueError,\
  7955. "Does not understand character buffer dtype format string ('%c')", **ts);
  7956. return number;
  7957. }
  7958. static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
  7959. PyErr_Format(PyExc_ValueError,
  7960. "Unexpected format string character: '%c'", ch);
  7961. }
  7962. static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
  7963. switch (ch) {
  7964. case 'c': return "'char'";
  7965. case 'b': return "'signed char'";
  7966. case 'B': return "'unsigned char'";
  7967. case 'h': return "'short'";
  7968. case 'H': return "'unsigned short'";
  7969. case 'i': return "'int'";
  7970. case 'I': return "'unsigned int'";
  7971. case 'l': return "'long'";
  7972. case 'L': return "'unsigned long'";
  7973. case 'q': return "'long long'";
  7974. case 'Q': return "'unsigned long long'";
  7975. case 'f': return (is_complex ? "'complex float'" : "'float'");
  7976. case 'd': return (is_complex ? "'complex double'" : "'double'");
  7977. case 'g': return (is_complex ? "'complex long double'" : "'long double'");
  7978. case 'T': return "a struct";
  7979. case 'O': return "Python object";
  7980. case 'P': return "a pointer";
  7981. case 's': case 'p': return "a string";
  7982. case 0: return "end";
  7983. default: return "unparseable format string";
  7984. }
  7985. }
  7986. static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
  7987. switch (ch) {
  7988. case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
  7989. case 'h': case 'H': return 2;
  7990. case 'i': case 'I': case 'l': case 'L': return 4;
  7991. case 'q': case 'Q': return 8;
  7992. case 'f': return (is_complex ? 8 : 4);
  7993. case 'd': return (is_complex ? 16 : 8);
  7994. case 'g': {
  7995. PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
  7996. return 0;
  7997. }
  7998. case 'O': case 'P': return sizeof(void*);
  7999. default:
  8000. __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  8001. return 0;
  8002. }
  8003. }
  8004. static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
  8005. switch (ch) {
  8006. case 'c': case 'b': case 'B': case 's': case 'p': return 1;
  8007. case 'h': case 'H': return sizeof(short);
  8008. case 'i': case 'I': return sizeof(int);
  8009. case 'l': case 'L': return sizeof(long);
  8010. #ifdef HAVE_LONG_LONG
  8011. case 'q': case 'Q': return sizeof(PY_LONG_LONG);
  8012. #endif
  8013. case 'f': return sizeof(float) * (is_complex ? 2 : 1);
  8014. case 'd': return sizeof(double) * (is_complex ? 2 : 1);
  8015. case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
  8016. case 'O': case 'P': return sizeof(void*);
  8017. default: {
  8018. __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  8019. return 0;
  8020. }
  8021. }
  8022. }
  8023. typedef struct { char c; short x; } __Pyx_st_short;
  8024. typedef struct { char c; int x; } __Pyx_st_int;
  8025. typedef struct { char c; long x; } __Pyx_st_long;
  8026. typedef struct { char c; float x; } __Pyx_st_float;
  8027. typedef struct { char c; double x; } __Pyx_st_double;
  8028. typedef struct { char c; long double x; } __Pyx_st_longdouble;
  8029. typedef struct { char c; void *x; } __Pyx_st_void_p;
  8030. #ifdef HAVE_LONG_LONG
  8031. typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
  8032. #endif
  8033. static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
  8034. switch (ch) {
  8035. case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
  8036. case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
  8037. case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
  8038. case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
  8039. #ifdef HAVE_LONG_LONG
  8040. case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
  8041. #endif
  8042. case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
  8043. case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
  8044. case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
  8045. case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
  8046. default:
  8047. __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  8048. return 0;
  8049. }
  8050. }
  8051. /* These are for computing the padding at the end of the struct to align
  8052. on the first member of the struct. This will probably the same as above,
  8053. but we don't have any guarantees.
  8054. */
  8055. typedef struct { short x; char c; } __Pyx_pad_short;
  8056. typedef struct { int x; char c; } __Pyx_pad_int;
  8057. typedef struct { long x; char c; } __Pyx_pad_long;
  8058. typedef struct { float x; char c; } __Pyx_pad_float;
  8059. typedef struct { double x; char c; } __Pyx_pad_double;
  8060. typedef struct { long double x; char c; } __Pyx_pad_longdouble;
  8061. typedef struct { void *x; char c; } __Pyx_pad_void_p;
  8062. #ifdef HAVE_LONG_LONG
  8063. typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
  8064. #endif
  8065. static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
  8066. switch (ch) {
  8067. case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
  8068. case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
  8069. case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
  8070. case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
  8071. #ifdef HAVE_LONG_LONG
  8072. case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
  8073. #endif
  8074. case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
  8075. case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
  8076. case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
  8077. case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
  8078. default:
  8079. __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  8080. return 0;
  8081. }
  8082. }
  8083. static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
  8084. switch (ch) {
  8085. case 'c':
  8086. return 'H';
  8087. case 'b': case 'h': case 'i':
  8088. case 'l': case 'q': case 's': case 'p':
  8089. return 'I';
  8090. case 'B': case 'H': case 'I': case 'L': case 'Q':
  8091. return 'U';
  8092. case 'f': case 'd': case 'g':
  8093. return (is_complex ? 'C' : 'R');
  8094. case 'O':
  8095. return 'O';
  8096. case 'P':
  8097. return 'P';
  8098. default: {
  8099. __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  8100. return 0;
  8101. }
  8102. }
  8103. }
  8104. static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
  8105. if (ctx->head == NULL || ctx->head->field == &ctx->root) {
  8106. const char* expected;
  8107. const char* quote;
  8108. if (ctx->head == NULL) {
  8109. expected = "end";
  8110. quote = "";
  8111. } else {
  8112. expected = ctx->head->field->type->name;
  8113. quote = "'";
  8114. }
  8115. PyErr_Format(PyExc_ValueError,
  8116. "Buffer dtype mismatch, expected %s%s%s but got %s",
  8117. quote, expected, quote,
  8118. __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
  8119. } else {
  8120. __Pyx_StructField* field = ctx->head->field;
  8121. __Pyx_StructField* parent = (ctx->head - 1)->field;
  8122. PyErr_Format(PyExc_ValueError,
  8123. "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
  8124. field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
  8125. parent->type->name, field->name);
  8126. }
  8127. }
  8128. static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
  8129. char group;
  8130. size_t size, offset, arraysize = 1;
  8131. if (ctx->enc_type == 0) return 0;
  8132. if (ctx->head->field->type->arraysize[0]) {
  8133. int i, ndim = 0;
  8134. if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
  8135. ctx->is_valid_array = ctx->head->field->type->ndim == 1;
  8136. ndim = 1;
  8137. if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
  8138. PyErr_Format(PyExc_ValueError,
  8139. "Expected a dimension of size %zu, got %zu",
  8140. ctx->head->field->type->arraysize[0], ctx->enc_count);
  8141. return -1;
  8142. }
  8143. }
  8144. if (!ctx->is_valid_array) {
  8145. PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
  8146. ctx->head->field->type->ndim, ndim);
  8147. return -1;
  8148. }
  8149. for (i = 0; i < ctx->head->field->type->ndim; i++) {
  8150. arraysize *= ctx->head->field->type->arraysize[i];
  8151. }
  8152. ctx->is_valid_array = 0;
  8153. ctx->enc_count = 1;
  8154. }
  8155. group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
  8156. do {
  8157. __Pyx_StructField* field = ctx->head->field;
  8158. __Pyx_TypeInfo* type = field->type;
  8159. if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
  8160. size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
  8161. } else {
  8162. size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
  8163. }
  8164. if (ctx->enc_packmode == '@') {
  8165. size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
  8166. size_t align_mod_offset;
  8167. if (align_at == 0) return -1;
  8168. align_mod_offset = ctx->fmt_offset % align_at;
  8169. if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
  8170. if (ctx->struct_alignment == 0)
  8171. ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
  8172. ctx->is_complex);
  8173. }
  8174. if (type->size != size || type->typegroup != group) {
  8175. if (type->typegroup == 'C' && type->fields != NULL) {
  8176. size_t parent_offset = ctx->head->parent_offset + field->offset;
  8177. ++ctx->head;
  8178. ctx->head->field = type->fields;
  8179. ctx->head->parent_offset = parent_offset;
  8180. continue;
  8181. }
  8182. if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
  8183. } else {
  8184. __Pyx_BufFmt_RaiseExpected(ctx);
  8185. return -1;
  8186. }
  8187. }
  8188. offset = ctx->head->parent_offset + field->offset;
  8189. if (ctx->fmt_offset != offset) {
  8190. PyErr_Format(PyExc_ValueError,
  8191. "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
  8192. (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
  8193. return -1;
  8194. }
  8195. ctx->fmt_offset += size;
  8196. if (arraysize)
  8197. ctx->fmt_offset += (arraysize - 1) * size;
  8198. --ctx->enc_count;
  8199. while (1) {
  8200. if (field == &ctx->root) {
  8201. ctx->head = NULL;
  8202. if (ctx->enc_count != 0) {
  8203. __Pyx_BufFmt_RaiseExpected(ctx);
  8204. return -1;
  8205. }
  8206. break;
  8207. }
  8208. ctx->head->field = ++field;
  8209. if (field->type == NULL) {
  8210. --ctx->head;
  8211. field = ctx->head->field;
  8212. continue;
  8213. } else if (field->type->typegroup == 'S') {
  8214. size_t parent_offset = ctx->head->parent_offset + field->offset;
  8215. if (field->type->fields->type == NULL) continue;
  8216. field = field->type->fields;
  8217. ++ctx->head;
  8218. ctx->head->field = field;
  8219. ctx->head->parent_offset = parent_offset;
  8220. break;
  8221. } else {
  8222. break;
  8223. }
  8224. }
  8225. } while (ctx->enc_count);
  8226. ctx->enc_type = 0;
  8227. ctx->is_complex = 0;
  8228. return 0;
  8229. }
  8230. static CYTHON_INLINE PyObject *
  8231. __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
  8232. {
  8233. const char *ts = *tsp;
  8234. int i = 0, number;
  8235. int ndim = ctx->head->field->type->ndim;
  8236. ;
  8237. ++ts;
  8238. if (ctx->new_count != 1) {
  8239. PyErr_SetString(PyExc_ValueError,
  8240. "Cannot handle repeated arrays in format string");
  8241. return NULL;
  8242. }
  8243. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  8244. while (*ts && *ts != ')') {
  8245. switch (*ts) {
  8246. case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue;
  8247. default: break;
  8248. }
  8249. number = __Pyx_BufFmt_ExpectNumber(&ts);
  8250. if (number == -1) return NULL;
  8251. if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
  8252. return PyErr_Format(PyExc_ValueError,
  8253. "Expected a dimension of size %zu, got %d",
  8254. ctx->head->field->type->arraysize[i], number);
  8255. if (*ts != ',' && *ts != ')')
  8256. return PyErr_Format(PyExc_ValueError,
  8257. "Expected a comma in format string, got '%c'", *ts);
  8258. if (*ts == ',') ts++;
  8259. i++;
  8260. }
  8261. if (i != ndim)
  8262. return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
  8263. ctx->head->field->type->ndim, i);
  8264. if (!*ts) {
  8265. PyErr_SetString(PyExc_ValueError,
  8266. "Unexpected end of format string, expected ')'");
  8267. return NULL;
  8268. }
  8269. ctx->is_valid_array = 1;
  8270. ctx->new_count = 1;
  8271. *tsp = ++ts;
  8272. return Py_None;
  8273. }
  8274. static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
  8275. int got_Z = 0;
  8276. while (1) {
  8277. switch(*ts) {
  8278. case 0:
  8279. if (ctx->enc_type != 0 && ctx->head == NULL) {
  8280. __Pyx_BufFmt_RaiseExpected(ctx);
  8281. return NULL;
  8282. }
  8283. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  8284. if (ctx->head != NULL) {
  8285. __Pyx_BufFmt_RaiseExpected(ctx);
  8286. return NULL;
  8287. }
  8288. return ts;
  8289. case ' ':
  8290. case '\r':
  8291. case '\n':
  8292. ++ts;
  8293. break;
  8294. case '<':
  8295. if (!__Pyx_IsLittleEndian()) {
  8296. PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
  8297. return NULL;
  8298. }
  8299. ctx->new_packmode = '=';
  8300. ++ts;
  8301. break;
  8302. case '>':
  8303. case '!':
  8304. if (__Pyx_IsLittleEndian()) {
  8305. PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
  8306. return NULL;
  8307. }
  8308. ctx->new_packmode = '=';
  8309. ++ts;
  8310. break;
  8311. case '=':
  8312. case '@':
  8313. case '^':
  8314. ctx->new_packmode = *ts++;
  8315. break;
  8316. case 'T':
  8317. {
  8318. const char* ts_after_sub;
  8319. size_t i, struct_count = ctx->new_count;
  8320. size_t struct_alignment = ctx->struct_alignment;
  8321. ctx->new_count = 1;
  8322. ++ts;
  8323. if (*ts != '{') {
  8324. PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
  8325. return NULL;
  8326. }
  8327. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  8328. ctx->enc_type = 0;
  8329. ctx->enc_count = 0;
  8330. ctx->struct_alignment = 0;
  8331. ++ts;
  8332. ts_after_sub = ts;
  8333. for (i = 0; i != struct_count; ++i) {
  8334. ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
  8335. if (!ts_after_sub) return NULL;
  8336. }
  8337. ts = ts_after_sub;
  8338. if (struct_alignment) ctx->struct_alignment = struct_alignment;
  8339. }
  8340. break;
  8341. case '}':
  8342. {
  8343. size_t alignment = ctx->struct_alignment;
  8344. ++ts;
  8345. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  8346. ctx->enc_type = 0;
  8347. if (alignment && ctx->fmt_offset % alignment) {
  8348. ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
  8349. }
  8350. }
  8351. return ts;
  8352. case 'x':
  8353. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  8354. ctx->fmt_offset += ctx->new_count;
  8355. ctx->new_count = 1;
  8356. ctx->enc_count = 0;
  8357. ctx->enc_type = 0;
  8358. ctx->enc_packmode = ctx->new_packmode;
  8359. ++ts;
  8360. break;
  8361. case 'Z':
  8362. got_Z = 1;
  8363. ++ts;
  8364. if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
  8365. __Pyx_BufFmt_RaiseUnexpectedChar('Z');
  8366. return NULL;
  8367. }
  8368. case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
  8369. case 'l': case 'L': case 'q': case 'Q':
  8370. case 'f': case 'd': case 'g':
  8371. case 'O': case 'p':
  8372. if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
  8373. ctx->enc_packmode == ctx->new_packmode) {
  8374. ctx->enc_count += ctx->new_count;
  8375. ctx->new_count = 1;
  8376. got_Z = 0;
  8377. ++ts;
  8378. break;
  8379. }
  8380. case 's':
  8381. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  8382. ctx->enc_count = ctx->new_count;
  8383. ctx->enc_packmode = ctx->new_packmode;
  8384. ctx->enc_type = *ts;
  8385. ctx->is_complex = got_Z;
  8386. ++ts;
  8387. ctx->new_count = 1;
  8388. got_Z = 0;
  8389. break;
  8390. case ':':
  8391. ++ts;
  8392. while(*ts != ':') ++ts;
  8393. ++ts;
  8394. break;
  8395. case '(':
  8396. if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
  8397. break;
  8398. default:
  8399. {
  8400. int number = __Pyx_BufFmt_ExpectNumber(&ts);
  8401. if (number == -1) return NULL;
  8402. ctx->new_count = (size_t)number;
  8403. }
  8404. }
  8405. }
  8406. }
  8407. static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
  8408. buf->buf = NULL;
  8409. buf->obj = NULL;
  8410. buf->strides = __Pyx_zeros;
  8411. buf->shape = __Pyx_zeros;
  8412. buf->suboffsets = __Pyx_minusones;
  8413. }
  8414. static CYTHON_INLINE int __Pyx_GetBufferAndValidate(
  8415. Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags,
  8416. int nd, int cast, __Pyx_BufFmt_StackElem* stack)
  8417. {
  8418. if (obj == Py_None || obj == NULL) {
  8419. __Pyx_ZeroBuffer(buf);
  8420. return 0;
  8421. }
  8422. buf->buf = NULL;
  8423. if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
  8424. if (buf->ndim != nd) {
  8425. PyErr_Format(PyExc_ValueError,
  8426. "Buffer has wrong number of dimensions (expected %d, got %d)",
  8427. nd, buf->ndim);
  8428. goto fail;
  8429. }
  8430. if (!cast) {
  8431. __Pyx_BufFmt_Context ctx;
  8432. __Pyx_BufFmt_Init(&ctx, stack, dtype);
  8433. if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
  8434. }
  8435. if ((unsigned)buf->itemsize != dtype->size) {
  8436. PyErr_Format(PyExc_ValueError,
  8437. "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
  8438. buf->itemsize, (buf->itemsize > 1) ? "s" : "",
  8439. dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
  8440. goto fail;
  8441. }
  8442. if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
  8443. return 0;
  8444. fail:;
  8445. __Pyx_ZeroBuffer(buf);
  8446. return -1;
  8447. }
  8448. static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
  8449. if (info->buf == NULL) return;
  8450. if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
  8451. __Pyx_ReleaseBuffer(info);
  8452. }
  8453. static void __Pyx_RaiseBufferFallbackError(void) {
  8454. PyErr_SetString(PyExc_ValueError,
  8455. "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
  8456. }
  8457. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
  8458. PyObject *r;
  8459. if (!j) return NULL;
  8460. r = PyObject_GetItem(o, j);
  8461. Py_DECREF(j);
  8462. return r;
  8463. }
  8464. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
  8465. int wraparound, int boundscheck) {
  8466. #if CYTHON_COMPILING_IN_CPYTHON
  8467. if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
  8468. if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
  8469. PyObject *r = PyList_GET_ITEM(o, i);
  8470. Py_INCREF(r);
  8471. return r;
  8472. }
  8473. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  8474. #else
  8475. return PySequence_GetItem(o, i);
  8476. #endif
  8477. }
  8478. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
  8479. int wraparound, int boundscheck) {
  8480. #if CYTHON_COMPILING_IN_CPYTHON
  8481. if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
  8482. if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
  8483. PyObject *r = PyTuple_GET_ITEM(o, i);
  8484. Py_INCREF(r);
  8485. return r;
  8486. }
  8487. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  8488. #else
  8489. return PySequence_GetItem(o, i);
  8490. #endif
  8491. }
  8492. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
  8493. int is_list, int wraparound, int boundscheck) {
  8494. #if CYTHON_COMPILING_IN_CPYTHON
  8495. if (is_list || PyList_CheckExact(o)) {
  8496. Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
  8497. if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
  8498. PyObject *r = PyList_GET_ITEM(o, n);
  8499. Py_INCREF(r);
  8500. return r;
  8501. }
  8502. }
  8503. else if (PyTuple_CheckExact(o)) {
  8504. Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
  8505. if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
  8506. PyObject *r = PyTuple_GET_ITEM(o, n);
  8507. Py_INCREF(r);
  8508. return r;
  8509. }
  8510. } else {
  8511. PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
  8512. if (likely(m && m->sq_item)) {
  8513. if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
  8514. Py_ssize_t l = m->sq_length(o);
  8515. if (likely(l >= 0)) {
  8516. i += l;
  8517. } else {
  8518. if (PyErr_ExceptionMatches(PyExc_OverflowError))
  8519. PyErr_Clear();
  8520. else
  8521. return NULL;
  8522. }
  8523. }
  8524. return m->sq_item(o, i);
  8525. }
  8526. }
  8527. #else
  8528. if (is_list || PySequence_Check(o)) {
  8529. return PySequence_GetItem(o, i);
  8530. }
  8531. #endif
  8532. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  8533. }
  8534. static void __Pyx_RaiseBufferIndexError(int axis) {
  8535. PyErr_Format(PyExc_IndexError,
  8536. "Out of bounds on buffer access (axis %d)", axis);
  8537. }
  8538. static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
  8539. int r;
  8540. if (!j) return -1;
  8541. r = PyObject_SetItem(o, j, v);
  8542. Py_DECREF(j);
  8543. return r;
  8544. }
  8545. static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
  8546. int is_list, int wraparound, int boundscheck) {
  8547. #if CYTHON_COMPILING_IN_CPYTHON
  8548. if (is_list || PyList_CheckExact(o)) {
  8549. Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
  8550. if ((!boundscheck) || likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
  8551. PyObject* old = PyList_GET_ITEM(o, n);
  8552. Py_INCREF(v);
  8553. PyList_SET_ITEM(o, n, v);
  8554. Py_DECREF(old);
  8555. return 1;
  8556. }
  8557. } else {
  8558. PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
  8559. if (likely(m && m->sq_ass_item)) {
  8560. if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
  8561. Py_ssize_t l = m->sq_length(o);
  8562. if (likely(l >= 0)) {
  8563. i += l;
  8564. } else {
  8565. if (PyErr_ExceptionMatches(PyExc_OverflowError))
  8566. PyErr_Clear();
  8567. else
  8568. return -1;
  8569. }
  8570. }
  8571. return m->sq_ass_item(o, i, v);
  8572. }
  8573. }
  8574. #else
  8575. #if CYTHON_COMPILING_IN_PYPY
  8576. if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) {
  8577. #else
  8578. if (is_list || PySequence_Check(o)) {
  8579. #endif
  8580. return PySequence_SetItem(o, i, v);
  8581. }
  8582. #endif
  8583. return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
  8584. }
  8585. #if CYTHON_COMPILING_IN_CPYTHON
  8586. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
  8587. PyObject *self, *result;
  8588. PyCFunction cfunc;
  8589. cfunc = PyCFunction_GET_FUNCTION(func);
  8590. self = PyCFunction_GET_SELF(func);
  8591. if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
  8592. return NULL;
  8593. result = cfunc(self, arg);
  8594. Py_LeaveRecursiveCall();
  8595. if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  8596. PyErr_SetString(
  8597. PyExc_SystemError,
  8598. "NULL result without error in PyObject_Call");
  8599. }
  8600. return result;
  8601. }
  8602. #endif
  8603. #if CYTHON_COMPILING_IN_CPYTHON
  8604. static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  8605. PyObject *result;
  8606. PyObject *args = PyTuple_New(1);
  8607. if (unlikely(!args)) return NULL;
  8608. Py_INCREF(arg);
  8609. PyTuple_SET_ITEM(args, 0, arg);
  8610. result = __Pyx_PyObject_Call(func, args, NULL);
  8611. Py_DECREF(args);
  8612. return result;
  8613. }
  8614. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  8615. #ifdef __Pyx_CyFunction_USED
  8616. if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
  8617. #else
  8618. if (likely(PyCFunction_Check(func))) {
  8619. #endif
  8620. if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
  8621. return __Pyx_PyObject_CallMethO(func, arg);
  8622. }
  8623. }
  8624. return __Pyx__PyObject_CallOneArg(func, arg);
  8625. }
  8626. #else
  8627. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  8628. PyObject* args = PyTuple_Pack(1, arg);
  8629. return (likely(args)) ? __Pyx_PyObject_Call(func, args, NULL) : NULL;
  8630. }
  8631. #endif
  8632. #if CYTHON_COMPILING_IN_CPYTHON
  8633. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
  8634. #ifdef __Pyx_CyFunction_USED
  8635. if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
  8636. #else
  8637. if (likely(PyCFunction_Check(func))) {
  8638. #endif
  8639. if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
  8640. return __Pyx_PyObject_CallMethO(func, NULL);
  8641. }
  8642. }
  8643. return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
  8644. }
  8645. #endif
  8646. #if PY_MAJOR_VERSION < 3
  8647. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
  8648. CYTHON_UNUSED PyObject *cause) {
  8649. Py_XINCREF(type);
  8650. if (!value || value == Py_None)
  8651. value = NULL;
  8652. else
  8653. Py_INCREF(value);
  8654. if (!tb || tb == Py_None)
  8655. tb = NULL;
  8656. else {
  8657. Py_INCREF(tb);
  8658. if (!PyTraceBack_Check(tb)) {
  8659. PyErr_SetString(PyExc_TypeError,
  8660. "raise: arg 3 must be a traceback or None");
  8661. goto raise_error;
  8662. }
  8663. }
  8664. if (PyType_Check(type)) {
  8665. #if CYTHON_COMPILING_IN_PYPY
  8666. if (!value) {
  8667. Py_INCREF(Py_None);
  8668. value = Py_None;
  8669. }
  8670. #endif
  8671. PyErr_NormalizeException(&type, &value, &tb);
  8672. } else {
  8673. if (value) {
  8674. PyErr_SetString(PyExc_TypeError,
  8675. "instance exception may not have a separate value");
  8676. goto raise_error;
  8677. }
  8678. value = type;
  8679. type = (PyObject*) Py_TYPE(type);
  8680. Py_INCREF(type);
  8681. if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
  8682. PyErr_SetString(PyExc_TypeError,
  8683. "raise: exception class must be a subclass of BaseException");
  8684. goto raise_error;
  8685. }
  8686. }
  8687. __Pyx_ErrRestore(type, value, tb);
  8688. return;
  8689. raise_error:
  8690. Py_XDECREF(value);
  8691. Py_XDECREF(type);
  8692. Py_XDECREF(tb);
  8693. return;
  8694. }
  8695. #else
  8696. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
  8697. PyObject* owned_instance = NULL;
  8698. if (tb == Py_None) {
  8699. tb = 0;
  8700. } else if (tb && !PyTraceBack_Check(tb)) {
  8701. PyErr_SetString(PyExc_TypeError,
  8702. "raise: arg 3 must be a traceback or None");
  8703. goto bad;
  8704. }
  8705. if (value == Py_None)
  8706. value = 0;
  8707. if (PyExceptionInstance_Check(type)) {
  8708. if (value) {
  8709. PyErr_SetString(PyExc_TypeError,
  8710. "instance exception may not have a separate value");
  8711. goto bad;
  8712. }
  8713. value = type;
  8714. type = (PyObject*) Py_TYPE(value);
  8715. } else if (PyExceptionClass_Check(type)) {
  8716. PyObject *instance_class = NULL;
  8717. if (value && PyExceptionInstance_Check(value)) {
  8718. instance_class = (PyObject*) Py_TYPE(value);
  8719. if (instance_class != type) {
  8720. if (PyObject_IsSubclass(instance_class, type)) {
  8721. type = instance_class;
  8722. } else {
  8723. instance_class = NULL;
  8724. }
  8725. }
  8726. }
  8727. if (!instance_class) {
  8728. PyObject *args;
  8729. if (!value)
  8730. args = PyTuple_New(0);
  8731. else if (PyTuple_Check(value)) {
  8732. Py_INCREF(value);
  8733. args = value;
  8734. } else
  8735. args = PyTuple_Pack(1, value);
  8736. if (!args)
  8737. goto bad;
  8738. owned_instance = PyObject_Call(type, args, NULL);
  8739. Py_DECREF(args);
  8740. if (!owned_instance)
  8741. goto bad;
  8742. value = owned_instance;
  8743. if (!PyExceptionInstance_Check(value)) {
  8744. PyErr_Format(PyExc_TypeError,
  8745. "calling %R should have returned an instance of "
  8746. "BaseException, not %R",
  8747. type, Py_TYPE(value));
  8748. goto bad;
  8749. }
  8750. }
  8751. } else {
  8752. PyErr_SetString(PyExc_TypeError,
  8753. "raise: exception class must be a subclass of BaseException");
  8754. goto bad;
  8755. }
  8756. #if PY_VERSION_HEX >= 0x03030000
  8757. if (cause) {
  8758. #else
  8759. if (cause && cause != Py_None) {
  8760. #endif
  8761. PyObject *fixed_cause;
  8762. if (cause == Py_None) {
  8763. fixed_cause = NULL;
  8764. } else if (PyExceptionClass_Check(cause)) {
  8765. fixed_cause = PyObject_CallObject(cause, NULL);
  8766. if (fixed_cause == NULL)
  8767. goto bad;
  8768. } else if (PyExceptionInstance_Check(cause)) {
  8769. fixed_cause = cause;
  8770. Py_INCREF(fixed_cause);
  8771. } else {
  8772. PyErr_SetString(PyExc_TypeError,
  8773. "exception causes must derive from "
  8774. "BaseException");
  8775. goto bad;
  8776. }
  8777. PyException_SetCause(value, fixed_cause);
  8778. }
  8779. PyErr_SetObject(type, value);
  8780. if (tb) {
  8781. #if CYTHON_COMPILING_IN_PYPY
  8782. PyObject *tmp_type, *tmp_value, *tmp_tb;
  8783. PyErr_Fetch(tmp_type, tmp_value, tmp_tb);
  8784. Py_INCREF(tb);
  8785. PyErr_Restore(tmp_type, tmp_value, tb);
  8786. Py_XDECREF(tmp_tb);
  8787. #else
  8788. PyThreadState *tstate = PyThreadState_GET();
  8789. PyObject* tmp_tb = tstate->curexc_traceback;
  8790. if (tb != tmp_tb) {
  8791. Py_INCREF(tb);
  8792. tstate->curexc_traceback = tb;
  8793. Py_XDECREF(tmp_tb);
  8794. }
  8795. #endif
  8796. }
  8797. bad:
  8798. Py_XDECREF(owned_instance);
  8799. return;
  8800. }
  8801. #endif
  8802. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
  8803. PyErr_Format(PyExc_ValueError,
  8804. "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
  8805. }
  8806. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
  8807. PyErr_Format(PyExc_ValueError,
  8808. "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
  8809. index, (index == 1) ? "" : "s");
  8810. }
  8811. static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
  8812. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
  8813. }
  8814. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
  8815. int start = 0, mid = 0, end = count - 1;
  8816. if (end >= 0 && code_line > entries[end].code_line) {
  8817. return count;
  8818. }
  8819. while (start < end) {
  8820. mid = (start + end) / 2;
  8821. if (code_line < entries[mid].code_line) {
  8822. end = mid;
  8823. } else if (code_line > entries[mid].code_line) {
  8824. start = mid + 1;
  8825. } else {
  8826. return mid;
  8827. }
  8828. }
  8829. if (code_line <= entries[mid].code_line) {
  8830. return mid;
  8831. } else {
  8832. return mid + 1;
  8833. }
  8834. }
  8835. static PyCodeObject *__pyx_find_code_object(int code_line) {
  8836. PyCodeObject* code_object;
  8837. int pos;
  8838. if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
  8839. return NULL;
  8840. }
  8841. pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
  8842. if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
  8843. return NULL;
  8844. }
  8845. code_object = __pyx_code_cache.entries[pos].code_object;
  8846. Py_INCREF(code_object);
  8847. return code_object;
  8848. }
  8849. static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
  8850. int pos, i;
  8851. __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
  8852. if (unlikely(!code_line)) {
  8853. return;
  8854. }
  8855. if (unlikely(!entries)) {
  8856. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
  8857. if (likely(entries)) {
  8858. __pyx_code_cache.entries = entries;
  8859. __pyx_code_cache.max_count = 64;
  8860. __pyx_code_cache.count = 1;
  8861. entries[0].code_line = code_line;
  8862. entries[0].code_object = code_object;
  8863. Py_INCREF(code_object);
  8864. }
  8865. return;
  8866. }
  8867. pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
  8868. if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
  8869. PyCodeObject* tmp = entries[pos].code_object;
  8870. entries[pos].code_object = code_object;
  8871. Py_DECREF(tmp);
  8872. return;
  8873. }
  8874. if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
  8875. int new_max = __pyx_code_cache.max_count + 64;
  8876. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
  8877. __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
  8878. if (unlikely(!entries)) {
  8879. return;
  8880. }
  8881. __pyx_code_cache.entries = entries;
  8882. __pyx_code_cache.max_count = new_max;
  8883. }
  8884. for (i=__pyx_code_cache.count; i>pos; i--) {
  8885. entries[i] = entries[i-1];
  8886. }
  8887. entries[pos].code_line = code_line;
  8888. entries[pos].code_object = code_object;
  8889. __pyx_code_cache.count++;
  8890. Py_INCREF(code_object);
  8891. }
  8892. #include "compile.h"
  8893. #include "frameobject.h"
  8894. #include "traceback.h"
  8895. static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
  8896. const char *funcname, int c_line,
  8897. int py_line, const char *filename) {
  8898. PyCodeObject *py_code = 0;
  8899. PyObject *py_srcfile = 0;
  8900. PyObject *py_funcname = 0;
  8901. #if PY_MAJOR_VERSION < 3
  8902. py_srcfile = PyString_FromString(filename);
  8903. #else
  8904. py_srcfile = PyUnicode_FromString(filename);
  8905. #endif
  8906. if (!py_srcfile) goto bad;
  8907. if (c_line) {
  8908. #if PY_MAJOR_VERSION < 3
  8909. py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  8910. #else
  8911. py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  8912. #endif
  8913. }
  8914. else {
  8915. #if PY_MAJOR_VERSION < 3
  8916. py_funcname = PyString_FromString(funcname);
  8917. #else
  8918. py_funcname = PyUnicode_FromString(funcname);
  8919. #endif
  8920. }
  8921. if (!py_funcname) goto bad;
  8922. py_code = __Pyx_PyCode_New(
  8923. 0,
  8924. 0,
  8925. 0,
  8926. 0,
  8927. 0,
  8928. __pyx_empty_bytes, /*PyObject *code,*/
  8929. __pyx_empty_tuple, /*PyObject *consts,*/
  8930. __pyx_empty_tuple, /*PyObject *names,*/
  8931. __pyx_empty_tuple, /*PyObject *varnames,*/
  8932. __pyx_empty_tuple, /*PyObject *freevars,*/
  8933. __pyx_empty_tuple, /*PyObject *cellvars,*/
  8934. py_srcfile, /*PyObject *filename,*/
  8935. py_funcname, /*PyObject *name,*/
  8936. py_line,
  8937. __pyx_empty_bytes /*PyObject *lnotab*/
  8938. );
  8939. Py_DECREF(py_srcfile);
  8940. Py_DECREF(py_funcname);
  8941. return py_code;
  8942. bad:
  8943. Py_XDECREF(py_srcfile);
  8944. Py_XDECREF(py_funcname);
  8945. return NULL;
  8946. }
  8947. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  8948. int py_line, const char *filename) {
  8949. PyCodeObject *py_code = 0;
  8950. PyFrameObject *py_frame = 0;
  8951. py_code = __pyx_find_code_object(c_line ? c_line : py_line);
  8952. if (!py_code) {
  8953. py_code = __Pyx_CreateCodeObjectForTraceback(
  8954. funcname, c_line, py_line, filename);
  8955. if (!py_code) goto bad;
  8956. __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
  8957. }
  8958. py_frame = PyFrame_New(
  8959. PyThreadState_GET(), /*PyThreadState *tstate,*/
  8960. py_code, /*PyCodeObject *code,*/
  8961. __pyx_d, /*PyObject *globals,*/
  8962. 0 /*PyObject *locals*/
  8963. );
  8964. if (!py_frame) goto bad;
  8965. py_frame->f_lineno = py_line;
  8966. PyTraceBack_Here(py_frame);
  8967. bad:
  8968. Py_XDECREF(py_code);
  8969. Py_XDECREF(py_frame);
  8970. }
  8971. #if PY_MAJOR_VERSION < 3
  8972. static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
  8973. if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
  8974. if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
  8975. PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
  8976. return -1;
  8977. }
  8978. static void __Pyx_ReleaseBuffer(Py_buffer *view) {
  8979. PyObject *obj = view->obj;
  8980. if (!obj) return;
  8981. if (PyObject_CheckBuffer(obj)) {
  8982. PyBuffer_Release(view);
  8983. return;
  8984. }
  8985. if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; }
  8986. Py_DECREF(obj);
  8987. view->obj = NULL;
  8988. }
  8989. #endif
  8990. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
  8991. PyObject *empty_list = 0;
  8992. PyObject *module = 0;
  8993. PyObject *global_dict = 0;
  8994. PyObject *empty_dict = 0;
  8995. PyObject *list;
  8996. #if PY_VERSION_HEX < 0x03030000
  8997. PyObject *py_import;
  8998. py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
  8999. if (!py_import)
  9000. goto bad;
  9001. #endif
  9002. if (from_list)
  9003. list = from_list;
  9004. else {
  9005. empty_list = PyList_New(0);
  9006. if (!empty_list)
  9007. goto bad;
  9008. list = empty_list;
  9009. }
  9010. global_dict = PyModule_GetDict(__pyx_m);
  9011. if (!global_dict)
  9012. goto bad;
  9013. empty_dict = PyDict_New();
  9014. if (!empty_dict)
  9015. goto bad;
  9016. {
  9017. #if PY_MAJOR_VERSION >= 3
  9018. if (level == -1) {
  9019. if (strchr(__Pyx_MODULE_NAME, '.')) {
  9020. #if PY_VERSION_HEX < 0x03030000
  9021. PyObject *py_level = PyInt_FromLong(1);
  9022. if (!py_level)
  9023. goto bad;
  9024. module = PyObject_CallFunctionObjArgs(py_import,
  9025. name, global_dict, empty_dict, list, py_level, NULL);
  9026. Py_DECREF(py_level);
  9027. #else
  9028. module = PyImport_ImportModuleLevelObject(
  9029. name, global_dict, empty_dict, list, 1);
  9030. #endif
  9031. if (!module) {
  9032. if (!PyErr_ExceptionMatches(PyExc_ImportError))
  9033. goto bad;
  9034. PyErr_Clear();
  9035. }
  9036. }
  9037. level = 0;
  9038. }
  9039. #endif
  9040. if (!module) {
  9041. #if PY_VERSION_HEX < 0x03030000
  9042. PyObject *py_level = PyInt_FromLong(level);
  9043. if (!py_level)
  9044. goto bad;
  9045. module = PyObject_CallFunctionObjArgs(py_import,
  9046. name, global_dict, empty_dict, list, py_level, NULL);
  9047. Py_DECREF(py_level);
  9048. #else
  9049. module = PyImport_ImportModuleLevelObject(
  9050. name, global_dict, empty_dict, list, level);
  9051. #endif
  9052. }
  9053. }
  9054. bad:
  9055. #if PY_VERSION_HEX < 0x03030000
  9056. Py_XDECREF(py_import);
  9057. #endif
  9058. Py_XDECREF(empty_list);
  9059. Py_XDECREF(empty_dict);
  9060. return module;
  9061. }
  9062. #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value) \
  9063. { \
  9064. func_type value = func_value; \
  9065. if (sizeof(target_type) < sizeof(func_type)) { \
  9066. if (unlikely(value != (func_type) (target_type) value)) { \
  9067. func_type zero = 0; \
  9068. if (is_unsigned && unlikely(value < zero)) \
  9069. goto raise_neg_overflow; \
  9070. else \
  9071. goto raise_overflow; \
  9072. } \
  9073. } \
  9074. return (target_type) value; \
  9075. }
  9076. #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
  9077. #if CYTHON_USE_PYLONG_INTERNALS
  9078. #include "longintrepr.h"
  9079. #endif
  9080. #endif
  9081. static CYTHON_INLINE npy_long __Pyx_PyInt_As_npy_long(PyObject *x) {
  9082. const npy_long neg_one = (npy_long) -1, const_zero = 0;
  9083. const int is_unsigned = neg_one > const_zero;
  9084. #if PY_MAJOR_VERSION < 3
  9085. if (likely(PyInt_Check(x))) {
  9086. if (sizeof(npy_long) < sizeof(long)) {
  9087. __PYX_VERIFY_RETURN_INT(npy_long, long, PyInt_AS_LONG(x))
  9088. } else {
  9089. long val = PyInt_AS_LONG(x);
  9090. if (is_unsigned && unlikely(val < 0)) {
  9091. goto raise_neg_overflow;
  9092. }
  9093. return (npy_long) val;
  9094. }
  9095. } else
  9096. #endif
  9097. if (likely(PyLong_Check(x))) {
  9098. if (is_unsigned) {
  9099. #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
  9100. #if CYTHON_USE_PYLONG_INTERNALS
  9101. switch (Py_SIZE(x)) {
  9102. case 0: return 0;
  9103. case 1: __PYX_VERIFY_RETURN_INT(npy_long, digit, ((PyLongObject*)x)->ob_digit[0]);
  9104. }
  9105. #endif
  9106. #endif
  9107. if (unlikely(Py_SIZE(x) < 0)) {
  9108. goto raise_neg_overflow;
  9109. }
  9110. if (sizeof(npy_long) <= sizeof(unsigned long)) {
  9111. __PYX_VERIFY_RETURN_INT(npy_long, unsigned long, PyLong_AsUnsignedLong(x))
  9112. } else if (sizeof(npy_long) <= sizeof(unsigned long long)) {
  9113. __PYX_VERIFY_RETURN_INT(npy_long, unsigned long long, PyLong_AsUnsignedLongLong(x))
  9114. }
  9115. } else {
  9116. #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
  9117. #if CYTHON_USE_PYLONG_INTERNALS
  9118. switch (Py_SIZE(x)) {
  9119. case 0: return 0;
  9120. case 1: __PYX_VERIFY_RETURN_INT(npy_long, digit, +(((PyLongObject*)x)->ob_digit[0]));
  9121. case -1: __PYX_VERIFY_RETURN_INT(npy_long, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
  9122. }
  9123. #endif
  9124. #endif
  9125. if (sizeof(npy_long) <= sizeof(long)) {
  9126. __PYX_VERIFY_RETURN_INT(npy_long, long, PyLong_AsLong(x))
  9127. } else if (sizeof(npy_long) <= sizeof(long long)) {
  9128. __PYX_VERIFY_RETURN_INT(npy_long, long long, PyLong_AsLongLong(x))
  9129. }
  9130. }
  9131. {
  9132. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  9133. PyErr_SetString(PyExc_RuntimeError,
  9134. "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  9135. #else
  9136. npy_long val;
  9137. PyObject *v = __Pyx_PyNumber_Int(x);
  9138. #if PY_MAJOR_VERSION < 3
  9139. if (likely(v) && !PyLong_Check(v)) {
  9140. PyObject *tmp = v;
  9141. v = PyNumber_Long(tmp);
  9142. Py_DECREF(tmp);
  9143. }
  9144. #endif
  9145. if (likely(v)) {
  9146. int one = 1; int is_little = (int)*(unsigned char *)&one;
  9147. unsigned char *bytes = (unsigned char *)&val;
  9148. int ret = _PyLong_AsByteArray((PyLongObject *)v,
  9149. bytes, sizeof(val),
  9150. is_little, !is_unsigned);
  9151. Py_DECREF(v);
  9152. if (likely(!ret))
  9153. return val;
  9154. }
  9155. #endif
  9156. return (npy_long) -1;
  9157. }
  9158. } else {
  9159. npy_long val;
  9160. PyObject *tmp = __Pyx_PyNumber_Int(x);
  9161. if (!tmp) return (npy_long) -1;
  9162. val = __Pyx_PyInt_As_npy_long(tmp);
  9163. Py_DECREF(tmp);
  9164. return val;
  9165. }
  9166. raise_overflow:
  9167. PyErr_SetString(PyExc_OverflowError,
  9168. "value too large to convert to npy_long");
  9169. return (npy_long) -1;
  9170. raise_neg_overflow:
  9171. PyErr_SetString(PyExc_OverflowError,
  9172. "can't convert negative value to npy_long");
  9173. return (npy_long) -1;
  9174. }
  9175. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) {
  9176. const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = 0;
  9177. const int is_unsigned = neg_one > const_zero;
  9178. if (is_unsigned) {
  9179. if (sizeof(Py_intptr_t) < sizeof(long)) {
  9180. return PyInt_FromLong((long) value);
  9181. } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
  9182. return PyLong_FromUnsignedLong((unsigned long) value);
  9183. } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long long)) {
  9184. return PyLong_FromUnsignedLongLong((unsigned long long) value);
  9185. }
  9186. } else {
  9187. if (sizeof(Py_intptr_t) <= sizeof(long)) {
  9188. return PyInt_FromLong((long) value);
  9189. } else if (sizeof(Py_intptr_t) <= sizeof(long long)) {
  9190. return PyLong_FromLongLong((long long) value);
  9191. }
  9192. }
  9193. {
  9194. int one = 1; int little = (int)*(unsigned char *)&one;
  9195. unsigned char *bytes = (unsigned char *)&value;
  9196. return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t),
  9197. little, !is_unsigned);
  9198. }
  9199. }
  9200. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_long(npy_long value) {
  9201. const npy_long neg_one = (npy_long) -1, const_zero = 0;
  9202. const int is_unsigned = neg_one > const_zero;
  9203. if (is_unsigned) {
  9204. if (sizeof(npy_long) < sizeof(long)) {
  9205. return PyInt_FromLong((long) value);
  9206. } else if (sizeof(npy_long) <= sizeof(unsigned long)) {
  9207. return PyLong_FromUnsignedLong((unsigned long) value);
  9208. } else if (sizeof(npy_long) <= sizeof(unsigned long long)) {
  9209. return PyLong_FromUnsignedLongLong((unsigned long long) value);
  9210. }
  9211. } else {
  9212. if (sizeof(npy_long) <= sizeof(long)) {
  9213. return PyInt_FromLong((long) value);
  9214. } else if (sizeof(npy_long) <= sizeof(long long)) {
  9215. return PyLong_FromLongLong((long long) value);
  9216. }
  9217. }
  9218. {
  9219. int one = 1; int little = (int)*(unsigned char *)&one;
  9220. unsigned char *bytes = (unsigned char *)&value;
  9221. return _PyLong_FromByteArray(bytes, sizeof(npy_long),
  9222. little, !is_unsigned);
  9223. }
  9224. }
  9225. #if CYTHON_CCOMPLEX
  9226. #ifdef __cplusplus
  9227. static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
  9228. return ::std::complex< double >(x, y);
  9229. }
  9230. #else
  9231. static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
  9232. return x + y*(__pyx_t_double_complex)_Complex_I;
  9233. }
  9234. #endif
  9235. #else
  9236. static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
  9237. __pyx_t_double_complex z;
  9238. z.real = x;
  9239. z.imag = y;
  9240. return z;
  9241. }
  9242. #endif
  9243. static __pyx_t_double_complex __Pyx_PyComplex_As___pyx_t_double_complex(PyObject* o) {
  9244. Py_complex cval;
  9245. #if CYTHON_COMPILING_IN_CPYTHON
  9246. if (PyComplex_CheckExact(o))
  9247. cval = ((PyComplexObject *)o)->cval;
  9248. else
  9249. #endif
  9250. cval = PyComplex_AsCComplex(o);
  9251. return __pyx_t_double_complex_from_parts(
  9252. (double)cval.real,
  9253. (double)cval.imag);
  9254. }
  9255. #if CYTHON_CCOMPLEX
  9256. #else
  9257. static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  9258. return (a.real == b.real) && (a.imag == b.imag);
  9259. }
  9260. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  9261. __pyx_t_double_complex z;
  9262. z.real = a.real + b.real;
  9263. z.imag = a.imag + b.imag;
  9264. return z;
  9265. }
  9266. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  9267. __pyx_t_double_complex z;
  9268. z.real = a.real - b.real;
  9269. z.imag = a.imag - b.imag;
  9270. return z;
  9271. }
  9272. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  9273. __pyx_t_double_complex z;
  9274. z.real = a.real * b.real - a.imag * b.imag;
  9275. z.imag = a.real * b.imag + a.imag * b.real;
  9276. return z;
  9277. }
  9278. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  9279. __pyx_t_double_complex z;
  9280. double denom = b.real * b.real + b.imag * b.imag;
  9281. z.real = (a.real * b.real + a.imag * b.imag) / denom;
  9282. z.imag = (a.imag * b.real - a.real * b.imag) / denom;
  9283. return z;
  9284. }
  9285. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) {
  9286. __pyx_t_double_complex z;
  9287. z.real = -a.real;
  9288. z.imag = -a.imag;
  9289. return z;
  9290. }
  9291. static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) {
  9292. return (a.real == 0) && (a.imag == 0);
  9293. }
  9294. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) {
  9295. __pyx_t_double_complex z;
  9296. z.real = a.real;
  9297. z.imag = -a.imag;
  9298. return z;
  9299. }
  9300. #if 1
  9301. static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) {
  9302. #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
  9303. return sqrt(z.real*z.real + z.imag*z.imag);
  9304. #else
  9305. return hypot(z.real, z.imag);
  9306. #endif
  9307. }
  9308. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  9309. __pyx_t_double_complex z;
  9310. double r, lnr, theta, z_r, z_theta;
  9311. if (b.imag == 0 && b.real == (int)b.real) {
  9312. if (b.real < 0) {
  9313. double denom = a.real * a.real + a.imag * a.imag;
  9314. a.real = a.real / denom;
  9315. a.imag = -a.imag / denom;
  9316. b.real = -b.real;
  9317. }
  9318. switch ((int)b.real) {
  9319. case 0:
  9320. z.real = 1;
  9321. z.imag = 0;
  9322. return z;
  9323. case 1:
  9324. return a;
  9325. case 2:
  9326. z = __Pyx_c_prod(a, a);
  9327. return __Pyx_c_prod(a, a);
  9328. case 3:
  9329. z = __Pyx_c_prod(a, a);
  9330. return __Pyx_c_prod(z, a);
  9331. case 4:
  9332. z = __Pyx_c_prod(a, a);
  9333. return __Pyx_c_prod(z, z);
  9334. }
  9335. }
  9336. if (a.imag == 0) {
  9337. if (a.real == 0) {
  9338. return a;
  9339. }
  9340. r = a.real;
  9341. theta = 0;
  9342. } else {
  9343. r = __Pyx_c_abs(a);
  9344. theta = atan2(a.imag, a.real);
  9345. }
  9346. lnr = log(r);
  9347. z_r = exp(lnr * b.real - theta * b.imag);
  9348. z_theta = theta * b.real + lnr * b.imag;
  9349. z.real = z_r * cos(z_theta);
  9350. z.imag = z_r * sin(z_theta);
  9351. return z;
  9352. }
  9353. #endif
  9354. #endif
  9355. #if CYTHON_CCOMPLEX
  9356. #ifdef __cplusplus
  9357. static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
  9358. return ::std::complex< float >(x, y);
  9359. }
  9360. #else
  9361. static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
  9362. return x + y*(__pyx_t_float_complex)_Complex_I;
  9363. }
  9364. #endif
  9365. #else
  9366. static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
  9367. __pyx_t_float_complex z;
  9368. z.real = x;
  9369. z.imag = y;
  9370. return z;
  9371. }
  9372. #endif
  9373. #if CYTHON_CCOMPLEX
  9374. #else
  9375. static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  9376. return (a.real == b.real) && (a.imag == b.imag);
  9377. }
  9378. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  9379. __pyx_t_float_complex z;
  9380. z.real = a.real + b.real;
  9381. z.imag = a.imag + b.imag;
  9382. return z;
  9383. }
  9384. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  9385. __pyx_t_float_complex z;
  9386. z.real = a.real - b.real;
  9387. z.imag = a.imag - b.imag;
  9388. return z;
  9389. }
  9390. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  9391. __pyx_t_float_complex z;
  9392. z.real = a.real * b.real - a.imag * b.imag;
  9393. z.imag = a.real * b.imag + a.imag * b.real;
  9394. return z;
  9395. }
  9396. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  9397. __pyx_t_float_complex z;
  9398. float denom = b.real * b.real + b.imag * b.imag;
  9399. z.real = (a.real * b.real + a.imag * b.imag) / denom;
  9400. z.imag = (a.imag * b.real - a.real * b.imag) / denom;
  9401. return z;
  9402. }
  9403. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) {
  9404. __pyx_t_float_complex z;
  9405. z.real = -a.real;
  9406. z.imag = -a.imag;
  9407. return z;
  9408. }
  9409. static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) {
  9410. return (a.real == 0) && (a.imag == 0);
  9411. }
  9412. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) {
  9413. __pyx_t_float_complex z;
  9414. z.real = a.real;
  9415. z.imag = -a.imag;
  9416. return z;
  9417. }
  9418. #if 1
  9419. static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) {
  9420. #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
  9421. return sqrtf(z.real*z.real + z.imag*z.imag);
  9422. #else
  9423. return hypotf(z.real, z.imag);
  9424. #endif
  9425. }
  9426. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  9427. __pyx_t_float_complex z;
  9428. float r, lnr, theta, z_r, z_theta;
  9429. if (b.imag == 0 && b.real == (int)b.real) {
  9430. if (b.real < 0) {
  9431. float denom = a.real * a.real + a.imag * a.imag;
  9432. a.real = a.real / denom;
  9433. a.imag = -a.imag / denom;
  9434. b.real = -b.real;
  9435. }
  9436. switch ((int)b.real) {
  9437. case 0:
  9438. z.real = 1;
  9439. z.imag = 0;
  9440. return z;
  9441. case 1:
  9442. return a;
  9443. case 2:
  9444. z = __Pyx_c_prodf(a, a);
  9445. return __Pyx_c_prodf(a, a);
  9446. case 3:
  9447. z = __Pyx_c_prodf(a, a);
  9448. return __Pyx_c_prodf(z, a);
  9449. case 4:
  9450. z = __Pyx_c_prodf(a, a);
  9451. return __Pyx_c_prodf(z, z);
  9452. }
  9453. }
  9454. if (a.imag == 0) {
  9455. if (a.real == 0) {
  9456. return a;
  9457. }
  9458. r = a.real;
  9459. theta = 0;
  9460. } else {
  9461. r = __Pyx_c_absf(a);
  9462. theta = atan2f(a.imag, a.real);
  9463. }
  9464. lnr = logf(r);
  9465. z_r = expf(lnr * b.real - theta * b.imag);
  9466. z_theta = theta * b.real + lnr * b.imag;
  9467. z.real = z_r * cosf(z_theta);
  9468. z.imag = z_r * sinf(z_theta);
  9469. return z;
  9470. }
  9471. #endif
  9472. #endif
  9473. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
  9474. const int neg_one = (int) -1, const_zero = 0;
  9475. const int is_unsigned = neg_one > const_zero;
  9476. if (is_unsigned) {
  9477. if (sizeof(int) < sizeof(long)) {
  9478. return PyInt_FromLong((long) value);
  9479. } else if (sizeof(int) <= sizeof(unsigned long)) {
  9480. return PyLong_FromUnsignedLong((unsigned long) value);
  9481. } else if (sizeof(int) <= sizeof(unsigned long long)) {
  9482. return PyLong_FromUnsignedLongLong((unsigned long long) value);
  9483. }
  9484. } else {
  9485. if (sizeof(int) <= sizeof(long)) {
  9486. return PyInt_FromLong((long) value);
  9487. } else if (sizeof(int) <= sizeof(long long)) {
  9488. return PyLong_FromLongLong((long long) value);
  9489. }
  9490. }
  9491. {
  9492. int one = 1; int little = (int)*(unsigned char *)&one;
  9493. unsigned char *bytes = (unsigned char *)&value;
  9494. return _PyLong_FromByteArray(bytes, sizeof(int),
  9495. little, !is_unsigned);
  9496. }
  9497. }
  9498. static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
  9499. const int neg_one = (int) -1, const_zero = 0;
  9500. const int is_unsigned = neg_one > const_zero;
  9501. #if PY_MAJOR_VERSION < 3
  9502. if (likely(PyInt_Check(x))) {
  9503. if (sizeof(int) < sizeof(long)) {
  9504. __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
  9505. } else {
  9506. long val = PyInt_AS_LONG(x);
  9507. if (is_unsigned && unlikely(val < 0)) {
  9508. goto raise_neg_overflow;
  9509. }
  9510. return (int) val;
  9511. }
  9512. } else
  9513. #endif
  9514. if (likely(PyLong_Check(x))) {
  9515. if (is_unsigned) {
  9516. #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
  9517. #if CYTHON_USE_PYLONG_INTERNALS
  9518. switch (Py_SIZE(x)) {
  9519. case 0: return 0;
  9520. case 1: __PYX_VERIFY_RETURN_INT(int, digit, ((PyLongObject*)x)->ob_digit[0]);
  9521. }
  9522. #endif
  9523. #endif
  9524. if (unlikely(Py_SIZE(x) < 0)) {
  9525. goto raise_neg_overflow;
  9526. }
  9527. if (sizeof(int) <= sizeof(unsigned long)) {
  9528. __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong(x))
  9529. } else if (sizeof(int) <= sizeof(unsigned long long)) {
  9530. __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong(x))
  9531. }
  9532. } else {
  9533. #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
  9534. #if CYTHON_USE_PYLONG_INTERNALS
  9535. switch (Py_SIZE(x)) {
  9536. case 0: return 0;
  9537. case 1: __PYX_VERIFY_RETURN_INT(int, digit, +(((PyLongObject*)x)->ob_digit[0]));
  9538. case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
  9539. }
  9540. #endif
  9541. #endif
  9542. if (sizeof(int) <= sizeof(long)) {
  9543. __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong(x))
  9544. } else if (sizeof(int) <= sizeof(long long)) {
  9545. __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong(x))
  9546. }
  9547. }
  9548. {
  9549. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  9550. PyErr_SetString(PyExc_RuntimeError,
  9551. "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  9552. #else
  9553. int val;
  9554. PyObject *v = __Pyx_PyNumber_Int(x);
  9555. #if PY_MAJOR_VERSION < 3
  9556. if (likely(v) && !PyLong_Check(v)) {
  9557. PyObject *tmp = v;
  9558. v = PyNumber_Long(tmp);
  9559. Py_DECREF(tmp);
  9560. }
  9561. #endif
  9562. if (likely(v)) {
  9563. int one = 1; int is_little = (int)*(unsigned char *)&one;
  9564. unsigned char *bytes = (unsigned char *)&val;
  9565. int ret = _PyLong_AsByteArray((PyLongObject *)v,
  9566. bytes, sizeof(val),
  9567. is_little, !is_unsigned);
  9568. Py_DECREF(v);
  9569. if (likely(!ret))
  9570. return val;
  9571. }
  9572. #endif
  9573. return (int) -1;
  9574. }
  9575. } else {
  9576. int val;
  9577. PyObject *tmp = __Pyx_PyNumber_Int(x);
  9578. if (!tmp) return (int) -1;
  9579. val = __Pyx_PyInt_As_int(tmp);
  9580. Py_DECREF(tmp);
  9581. return val;
  9582. }
  9583. raise_overflow:
  9584. PyErr_SetString(PyExc_OverflowError,
  9585. "value too large to convert to int");
  9586. return (int) -1;
  9587. raise_neg_overflow:
  9588. PyErr_SetString(PyExc_OverflowError,
  9589. "can't convert negative value to int");
  9590. return (int) -1;
  9591. }
  9592. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
  9593. const long neg_one = (long) -1, const_zero = 0;
  9594. const int is_unsigned = neg_one > const_zero;
  9595. if (is_unsigned) {
  9596. if (sizeof(long) < sizeof(long)) {
  9597. return PyInt_FromLong((long) value);
  9598. } else if (sizeof(long) <= sizeof(unsigned long)) {
  9599. return PyLong_FromUnsignedLong((unsigned long) value);
  9600. } else if (sizeof(long) <= sizeof(unsigned long long)) {
  9601. return PyLong_FromUnsignedLongLong((unsigned long long) value);
  9602. }
  9603. } else {
  9604. if (sizeof(long) <= sizeof(long)) {
  9605. return PyInt_FromLong((long) value);
  9606. } else if (sizeof(long) <= sizeof(long long)) {
  9607. return PyLong_FromLongLong((long long) value);
  9608. }
  9609. }
  9610. {
  9611. int one = 1; int little = (int)*(unsigned char *)&one;
  9612. unsigned char *bytes = (unsigned char *)&value;
  9613. return _PyLong_FromByteArray(bytes, sizeof(long),
  9614. little, !is_unsigned);
  9615. }
  9616. }
  9617. static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
  9618. const long neg_one = (long) -1, const_zero = 0;
  9619. const int is_unsigned = neg_one > const_zero;
  9620. #if PY_MAJOR_VERSION < 3
  9621. if (likely(PyInt_Check(x))) {
  9622. if (sizeof(long) < sizeof(long)) {
  9623. __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
  9624. } else {
  9625. long val = PyInt_AS_LONG(x);
  9626. if (is_unsigned && unlikely(val < 0)) {
  9627. goto raise_neg_overflow;
  9628. }
  9629. return (long) val;
  9630. }
  9631. } else
  9632. #endif
  9633. if (likely(PyLong_Check(x))) {
  9634. if (is_unsigned) {
  9635. #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
  9636. #if CYTHON_USE_PYLONG_INTERNALS
  9637. switch (Py_SIZE(x)) {
  9638. case 0: return 0;
  9639. case 1: __PYX_VERIFY_RETURN_INT(long, digit, ((PyLongObject*)x)->ob_digit[0]);
  9640. }
  9641. #endif
  9642. #endif
  9643. if (unlikely(Py_SIZE(x) < 0)) {
  9644. goto raise_neg_overflow;
  9645. }
  9646. if (sizeof(long) <= sizeof(unsigned long)) {
  9647. __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong(x))
  9648. } else if (sizeof(long) <= sizeof(unsigned long long)) {
  9649. __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong(x))
  9650. }
  9651. } else {
  9652. #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
  9653. #if CYTHON_USE_PYLONG_INTERNALS
  9654. switch (Py_SIZE(x)) {
  9655. case 0: return 0;
  9656. case 1: __PYX_VERIFY_RETURN_INT(long, digit, +(((PyLongObject*)x)->ob_digit[0]));
  9657. case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
  9658. }
  9659. #endif
  9660. #endif
  9661. if (sizeof(long) <= sizeof(long)) {
  9662. __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong(x))
  9663. } else if (sizeof(long) <= sizeof(long long)) {
  9664. __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong(x))
  9665. }
  9666. }
  9667. {
  9668. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  9669. PyErr_SetString(PyExc_RuntimeError,
  9670. "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  9671. #else
  9672. long val;
  9673. PyObject *v = __Pyx_PyNumber_Int(x);
  9674. #if PY_MAJOR_VERSION < 3
  9675. if (likely(v) && !PyLong_Check(v)) {
  9676. PyObject *tmp = v;
  9677. v = PyNumber_Long(tmp);
  9678. Py_DECREF(tmp);
  9679. }
  9680. #endif
  9681. if (likely(v)) {
  9682. int one = 1; int is_little = (int)*(unsigned char *)&one;
  9683. unsigned char *bytes = (unsigned char *)&val;
  9684. int ret = _PyLong_AsByteArray((PyLongObject *)v,
  9685. bytes, sizeof(val),
  9686. is_little, !is_unsigned);
  9687. Py_DECREF(v);
  9688. if (likely(!ret))
  9689. return val;
  9690. }
  9691. #endif
  9692. return (long) -1;
  9693. }
  9694. } else {
  9695. long val;
  9696. PyObject *tmp = __Pyx_PyNumber_Int(x);
  9697. if (!tmp) return (long) -1;
  9698. val = __Pyx_PyInt_As_long(tmp);
  9699. Py_DECREF(tmp);
  9700. return val;
  9701. }
  9702. raise_overflow:
  9703. PyErr_SetString(PyExc_OverflowError,
  9704. "value too large to convert to long");
  9705. return (long) -1;
  9706. raise_neg_overflow:
  9707. PyErr_SetString(PyExc_OverflowError,
  9708. "can't convert negative value to long");
  9709. return (long) -1;
  9710. }
  9711. static int __Pyx_check_binary_version(void) {
  9712. char ctversion[4], rtversion[4];
  9713. PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
  9714. PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
  9715. if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
  9716. char message[200];
  9717. PyOS_snprintf(message, sizeof(message),
  9718. "compiletime version %s of module '%.100s' "
  9719. "does not match runtime version %s",
  9720. ctversion, __Pyx_MODULE_NAME, rtversion);
  9721. return PyErr_WarnEx(NULL, message, 1);
  9722. }
  9723. return 0;
  9724. }
  9725. #ifndef __PYX_HAVE_RT_ImportModule
  9726. #define __PYX_HAVE_RT_ImportModule
  9727. static PyObject *__Pyx_ImportModule(const char *name) {
  9728. PyObject *py_name = 0;
  9729. PyObject *py_module = 0;
  9730. py_name = __Pyx_PyIdentifier_FromString(name);
  9731. if (!py_name)
  9732. goto bad;
  9733. py_module = PyImport_Import(py_name);
  9734. Py_DECREF(py_name);
  9735. return py_module;
  9736. bad:
  9737. Py_XDECREF(py_name);
  9738. return 0;
  9739. }
  9740. #endif
  9741. #ifndef __PYX_HAVE_RT_ImportType
  9742. #define __PYX_HAVE_RT_ImportType
  9743. static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
  9744. size_t size, int strict)
  9745. {
  9746. PyObject *py_module = 0;
  9747. PyObject *result = 0;
  9748. PyObject *py_name = 0;
  9749. char warning[200];
  9750. Py_ssize_t basicsize;
  9751. #ifdef Py_LIMITED_API
  9752. PyObject *py_basicsize;
  9753. #endif
  9754. py_module = __Pyx_ImportModule(module_name);
  9755. if (!py_module)
  9756. goto bad;
  9757. py_name = __Pyx_PyIdentifier_FromString(class_name);
  9758. if (!py_name)
  9759. goto bad;
  9760. result = PyObject_GetAttr(py_module, py_name);
  9761. Py_DECREF(py_name);
  9762. py_name = 0;
  9763. Py_DECREF(py_module);
  9764. py_module = 0;
  9765. if (!result)
  9766. goto bad;
  9767. if (!PyType_Check(result)) {
  9768. PyErr_Format(PyExc_TypeError,
  9769. "%.200s.%.200s is not a type object",
  9770. module_name, class_name);
  9771. goto bad;
  9772. }
  9773. #ifndef Py_LIMITED_API
  9774. basicsize = ((PyTypeObject *)result)->tp_basicsize;
  9775. #else
  9776. py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
  9777. if (!py_basicsize)
  9778. goto bad;
  9779. basicsize = PyLong_AsSsize_t(py_basicsize);
  9780. Py_DECREF(py_basicsize);
  9781. py_basicsize = 0;
  9782. if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
  9783. goto bad;
  9784. #endif
  9785. if (!strict && (size_t)basicsize > size) {
  9786. PyOS_snprintf(warning, sizeof(warning),
  9787. "%s.%s size changed, may indicate binary incompatibility",
  9788. module_name, class_name);
  9789. if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
  9790. }
  9791. else if ((size_t)basicsize != size) {
  9792. PyErr_Format(PyExc_ValueError,
  9793. "%.200s.%.200s has the wrong size, try recompiling",
  9794. module_name, class_name);
  9795. goto bad;
  9796. }
  9797. return (PyTypeObject *)result;
  9798. bad:
  9799. Py_XDECREF(py_module);
  9800. Py_XDECREF(result);
  9801. return NULL;
  9802. }
  9803. #endif
  9804. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
  9805. while (t->p) {
  9806. #if PY_MAJOR_VERSION < 3
  9807. if (t->is_unicode) {
  9808. *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
  9809. } else if (t->intern) {
  9810. *t->p = PyString_InternFromString(t->s);
  9811. } else {
  9812. *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
  9813. }
  9814. #else
  9815. if (t->is_unicode | t->is_str) {
  9816. if (t->intern) {
  9817. *t->p = PyUnicode_InternFromString(t->s);
  9818. } else if (t->encoding) {
  9819. *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
  9820. } else {
  9821. *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
  9822. }
  9823. } else {
  9824. *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
  9825. }
  9826. #endif
  9827. if (!*t->p)
  9828. return -1;
  9829. ++t;
  9830. }
  9831. return 0;
  9832. }
  9833. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
  9834. return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
  9835. }
  9836. static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
  9837. Py_ssize_t ignore;
  9838. return __Pyx_PyObject_AsStringAndSize(o, &ignore);
  9839. }
  9840. static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  9841. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  9842. if (
  9843. #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  9844. __Pyx_sys_getdefaultencoding_not_ascii &&
  9845. #endif
  9846. PyUnicode_Check(o)) {
  9847. #if PY_VERSION_HEX < 0x03030000
  9848. char* defenc_c;
  9849. PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
  9850. if (!defenc) return NULL;
  9851. defenc_c = PyBytes_AS_STRING(defenc);
  9852. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  9853. {
  9854. char* end = defenc_c + PyBytes_GET_SIZE(defenc);
  9855. char* c;
  9856. for (c = defenc_c; c < end; c++) {
  9857. if ((unsigned char) (*c) >= 128) {
  9858. PyUnicode_AsASCIIString(o);
  9859. return NULL;
  9860. }
  9861. }
  9862. }
  9863. #endif
  9864. *length = PyBytes_GET_SIZE(defenc);
  9865. return defenc_c;
  9866. #else
  9867. if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
  9868. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  9869. if (PyUnicode_IS_ASCII(o)) {
  9870. *length = PyUnicode_GET_LENGTH(o);
  9871. return PyUnicode_AsUTF8(o);
  9872. } else {
  9873. PyUnicode_AsASCIIString(o);
  9874. return NULL;
  9875. }
  9876. #else
  9877. return PyUnicode_AsUTF8AndSize(o, length);
  9878. #endif
  9879. #endif
  9880. } else
  9881. #endif
  9882. #if !CYTHON_COMPILING_IN_PYPY
  9883. if (PyByteArray_Check(o)) {
  9884. *length = PyByteArray_GET_SIZE(o);
  9885. return PyByteArray_AS_STRING(o);
  9886. } else
  9887. #endif
  9888. {
  9889. char* result;
  9890. int r = PyBytes_AsStringAndSize(o, &result, length);
  9891. if (unlikely(r < 0)) {
  9892. return NULL;
  9893. } else {
  9894. return result;
  9895. }
  9896. }
  9897. }
  9898. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
  9899. int is_true = x == Py_True;
  9900. if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
  9901. else return PyObject_IsTrue(x);
  9902. }
  9903. static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  9904. PyNumberMethods *m;
  9905. const char *name = NULL;
  9906. PyObject *res = NULL;
  9907. #if PY_MAJOR_VERSION < 3
  9908. if (PyInt_Check(x) || PyLong_Check(x))
  9909. #else
  9910. if (PyLong_Check(x))
  9911. #endif
  9912. return Py_INCREF(x), x;
  9913. m = Py_TYPE(x)->tp_as_number;
  9914. #if PY_MAJOR_VERSION < 3
  9915. if (m && m->nb_int) {
  9916. name = "int";
  9917. res = PyNumber_Int(x);
  9918. }
  9919. else if (m && m->nb_long) {
  9920. name = "long";
  9921. res = PyNumber_Long(x);
  9922. }
  9923. #else
  9924. if (m && m->nb_int) {
  9925. name = "int";
  9926. res = PyNumber_Long(x);
  9927. }
  9928. #endif
  9929. if (res) {
  9930. #if PY_MAJOR_VERSION < 3
  9931. if (!PyInt_Check(res) && !PyLong_Check(res)) {
  9932. #else
  9933. if (!PyLong_Check(res)) {
  9934. #endif
  9935. PyErr_Format(PyExc_TypeError,
  9936. "__%.4s__ returned non-%.4s (type %.200s)",
  9937. name, name, Py_TYPE(res)->tp_name);
  9938. Py_DECREF(res);
  9939. return NULL;
  9940. }
  9941. }
  9942. else if (!PyErr_Occurred()) {
  9943. PyErr_SetString(PyExc_TypeError,
  9944. "an integer is required");
  9945. }
  9946. return res;
  9947. }
  9948. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  9949. Py_ssize_t ival;
  9950. PyObject *x;
  9951. #if PY_MAJOR_VERSION < 3
  9952. if (likely(PyInt_CheckExact(b)))
  9953. return PyInt_AS_LONG(b);
  9954. #endif
  9955. if (likely(PyLong_CheckExact(b))) {
  9956. #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
  9957. #if CYTHON_USE_PYLONG_INTERNALS
  9958. switch (Py_SIZE(b)) {
  9959. case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0];
  9960. case 0: return 0;
  9961. case 1: return ((PyLongObject*)b)->ob_digit[0];
  9962. }
  9963. #endif
  9964. #endif
  9965. return PyLong_AsSsize_t(b);
  9966. }
  9967. x = PyNumber_Index(b);
  9968. if (!x) return -1;
  9969. ival = PyInt_AsSsize_t(x);
  9970. Py_DECREF(x);
  9971. return ival;
  9972. }
  9973. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
  9974. return PyInt_FromSize_t(ival);
  9975. }
  9976. #endif /* Py_PYTHON_H */