blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
264
content_id
stringlengths
40
40
detected_licenses
listlengths
0
85
license_type
stringclasses
2 values
repo_name
stringlengths
5
140
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
986 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
3.89k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
23 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
145 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
10.4M
extension
stringclasses
122 values
content
stringlengths
3
10.4M
authors
listlengths
1
1
author_id
stringlengths
0
158
35fdeba996ae4bfd1b7c1f401349d2328a86d9c1
0443b924cabcccc6a96af86d5d94c46bfb7bd301
/MPR121/MPR121.ino
8ddfd604233bf195765530204fb7c22d17188c5f
[]
no_license
MelAaron/Arduino
89756bb69790b6ae2499fc06d0526016e0e004fa
458555649245762ee8a1101e4f8612571a9e3be8
refs/heads/main
2023-03-22T03:47:30.037107
2021-03-17T20:58:30
2021-03-17T20:58:30
348,849,592
0
0
null
null
null
null
UTF-8
C++
false
false
1,974
ino
//SDA - SDA //SCL - SCL //3.3V - 3.3V //GND - GND #include <Wire.h> #include "Adafruit_MPR121.h" #ifndef _BV #define _BV(bit) (1 << (bit)) #endif // You can have up to 4 on one i2c bus but one is enough for testing! Adafruit_MPR121 cap = Adafruit_MPR121(); // Keeps track of the last pins touched // so we know when buttons are 'released' uint16_t lasttouched = 0; uint16_t currtouched = 0; void setup() { Serial.begin(9600); while (!Serial) { // needed to keep leonardo/micro from starting too fast! delay(10); } Serial.println("Adafruit MPR121 Capacitive Touch sensor test"); // Default address is 0x5A, if tied to 3.3V its 0x5B // If tied to SDA its 0x5C and if SCL then 0x5D if (!cap.begin(0x5A)) { Serial.println("MPR121 not found, check wiring?"); while (1); } Serial.println("MPR121 found!"); } void loop() { // Get the currently touched pads currtouched = cap.touched(); for (uint8_t i=0; i<12; i++) { // it if *is* touched and *wasnt* touched before, alert! if ((currtouched & _BV(i)) && !(lasttouched & _BV(i)) ) { Serial.print(i); Serial.println(" touched"); } // if it *was* touched and now *isnt*, alert! if (!(currtouched & _BV(i)) && (lasttouched & _BV(i)) ) { Serial.print(i); Serial.println(" released"); } } // reset our state lasttouched = currtouched; // comment out this line for detailed data from the sensor! return; // debugging info, what Serial.print("\t\t\t\t\t\t\t\t\t\t\t\t\t 0x"); Serial.println(cap.touched(), HEX); Serial.print("Filt: "); for (uint8_t i=0; i<12; i++) { Serial.print(cap.filteredData(i)); Serial.print("\t"); } Serial.println(); Serial.print("Base: "); for (uint8_t i=0; i<12; i++) { Serial.print(cap.baselineData(i)); Serial.print("\t"); } Serial.println(); // put a delay so it isn't overwhelming delay(100); }
[ "noreply@github.com" ]
MelAaron.noreply@github.com
5f324698fc968714ae85d6d04cae3e6ff942562b
e351acdfbc906f141756b99443004e052dfce152
/2_add_two_num.cpp
57a880091428b73a4cc3a4bd0fb2f22b666324be
[]
no_license
jhasudhakar/leetcode
e4ec680c6aef8dbe156c683ee9ae8834100e59e4
6669580d91a2ce02794ac2e0a83adc588dfcaaae
refs/heads/master
2023-04-07T19:41:23.296959
2021-04-07T03:29:05
2021-04-07T03:29:05
293,828,736
0
0
null
null
null
null
UTF-8
C++
false
false
1,071
cpp
#include <stdlib.h> //Definition for singly-linked list. struct ListNode { int val; ListNode *next; ListNode() : val(0), next(nullptr) {} ListNode(int x) : val(x), next(nullptr) {} ListNode(int x, ListNode *next) : val(x), next(next) {} }; class Solution { public: ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) { ListNode* root = new ListNode(0, NULL); ListNode* l_new = root; int offset = 0; while(l1 && l2) { int sum = l1->val + l2->val + offset; offset = sum / 10; sum = sum% 10; l_new->next = new ListNode(sum, NULL); l_new = l_new->next; l1 = l1->next; l2 = l2->next; } ListNode* l3 = l1; if(l1 == NULL) l3 = l2; while(l3) { if(offset == 0) { l_new->next = l3; break; } int sum = l3->val + offset; offset = sum / 10; sum = sum% 10; l_new->next = new ListNode(sum, NULL); l_new = l_new->next; l3 = l3->next; } if(offset) { l_new->next = new ListNode(offset, NULL); } l_new = root->next; delete root; return l_new; } };
[ "jhasudhakar.ai@gmail.com" ]
jhasudhakar.ai@gmail.com
39bd46b1100be24f27cb5ed4c349b6947155a547
3b1de2ad43d067411fcfd3e9d59f89f01b1a5c83
/scuApp/src/scuMain.cpp
c145c6399c242b8bd8ff76c930a8c7f093538972
[]
no_license
allanbugyi/SMARACT_SCU_IOC
b2f9a8677e34ccf306de83459ebc239662aff8ea
06771dacad4d54a1ecf3910dc498e2e3434fc542
refs/heads/master
2020-08-26T15:04:50.973933
2019-10-23T12:05:05
2019-10-23T12:05:05
217,049,317
3
0
null
null
null
null
UTF-8
C++
false
false
403
cpp
/* scuMain.cpp */ /* Author: Marty Kraimer Date: 17MAR2000 */ #include <stddef.h> #include <stdlib.h> #include <stddef.h> #include <string.h> #include <stdio.h> #include "epicsExit.h" #include "epicsThread.h" #include "iocsh.h" int main(int argc,char *argv[]) { if(argc>=2) { iocsh(argv[1]); epicsThreadSleep(.2); } iocsh(NULL); epicsExit(0); return(0); }
[ "allan.bugyi@lnls.br" ]
allan.bugyi@lnls.br
343054916a121883fbd8de72287d1ae7dcecd312
3935ac1e3bd8958e987b44b366f3c17376d6c766
/camuso 114 Copy Constructors (setter)/src/data.cpp
b31c386a923adc6f68d01d3358c7c32bb7db0c24
[]
no_license
mircocrit/Cpp-workspace-camuso
0f2dc9231fd52b63cea688fa9702084071993c61
fe1928a0f4718880d53b4acbf3bd832df2ae9713
refs/heads/master
2020-05-19T13:29:31.944404
2019-05-05T15:03:06
2019-05-05T15:03:06
185,040,544
0
0
null
null
null
null
UTF-8
C++
false
false
1,107
cpp
#include "data.h" #include <ctime> #include <iostream> Data::Data(int gg, int mm) : Data(gg, mm, data_corrente()->tm_year+1900 ){ } Data::Data(int gg) : Data(gg, data_corrente()->tm_mon, data_corrente()->tm_year+1900 ){} Data::Data(const std::string d) : Data( stoi( d.substr(0,2) ), stoi( d.substr(3,2) ), stoi( d.substr(6,4) ) ){ } Data::Data() {} Data::Data(int gg, int mm, int aa){ if ( valida(gg, mm, aa) ) { giorno = gg; mese = mm; anno = aa; } else{ giorno = oggi->tm_mday; mese = oggi->tm_mon; anno = oggi->tm_year+1900; } } bool Data::valida(int gg, int mm, int aa){return gg>=1 && gg<=31 && mm>=1 && mm<=12 && anno>=1970;} tm* Data::oggi = Data::data_corrente(); tm* Data::data_corrente(){ time_t tempo_secondi = time(nullptr); return localtime(&tempo_secondi); } std::string Data::formato_breve(){ return std::to_string(giorno) + "/" + std::to_string(mese) + "/" +std::to_string(anno);} bool Data::set_mese(int _mese){ if (valida(giorno, _mese, anno) ){ mese=_mese; return true; } else return false; }
[ "Mirco@DESKTOP-A55DTAV" ]
Mirco@DESKTOP-A55DTAV
0a04810b26fd127ed254db3a97f9ac813286fc46
9ddc81b9f8285b3a384b13fbbbf292f4a473e638
/src/qt/test/test_main.cpp
0483571436c0544204014055adc80adb083b3ad7
[ "MIT" ]
permissive
Al3xxx19/jiyo
80f15e659e80a928823be6e7c6e1b9a16920b78c
363ae3a1f1154c64ddf066a5095973b3cd9b1268
refs/heads/master
2020-04-25T17:34:44.187357
2019-02-27T17:34:37
2019-02-27T17:34:37
172,953,658
0
0
null
null
null
null
UTF-8
C++
false
false
1,601
cpp
// Copyright (c) 2009-2009 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers // Copyright (c) 2015-2018 The PIVX developers // Copyright (c) 2018-2018 The Jiyo developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #if defined(HAVE_CONFIG_H) #include "config/jiyo-config.h" #endif #include "util.h" #include "uritests.h" #ifdef ENABLE_WALLET #include "paymentservertests.h" #endif #include <QCoreApplication> #include <QObject> #include <QTest> #include <openssl/ssl.h> #if defined(QT_STATICPLUGIN) #include <QtPlugin> #if defined(QT_QPA_PLATFORM_MINIMAL) Q_IMPORT_PLUGIN(QMinimalIntegrationPlugin); #endif #if defined(QT_QPA_PLATFORM_XCB) Q_IMPORT_PLUGIN(QXcbIntegrationPlugin); #elif defined(QT_QPA_PLATFORM_WINDOWS) Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin); #elif defined(QT_QPA_PLATFORM_COCOA) Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin); #endif #endif extern void noui_connect(); // This is all you need to run all the tests int main(int argc, char *argv[]) { SetupEnvironment(); bool fInvalid = false; // Don't remove this, it's needed to access // QCoreApplication:: in the tests QCoreApplication app(argc, argv); app.setApplicationName("Jiyo-Qt-test"); SSL_library_init(); URITests test1; if (QTest::qExec(&test1) != 0) fInvalid = true; #ifdef ENABLE_WALLET PaymentServerTests test2; if (QTest::qExec(&test2) != 0) fInvalid = true; #endif return fInvalid; }
[ "39266190+Al3xxx19@users.noreply.github.com" ]
39266190+Al3xxx19@users.noreply.github.com
7b7be03b070b7eef158519603af2b422f5638624
629f413e1ef30c1e388c89613c0012b1b8dfa96d
/src/sherpaTTPlanner_rtwutil.cpp
71a3d35440bf186bc4c796c6e153e0f55c593e0d
[]
no_license
wired2015/single_leg_planner
be59dfb6bf241387bed331d7ee0c594ef15a3136
439a226c506f6850950237cc31e016626f477444
refs/heads/master
2020-06-04T05:59:50.661336
2015-03-05T14:03:37
2015-03-05T14:03:37
30,363,456
0
1
null
2015-03-05T09:26:23
2015-02-05T15:46:44
HTML
UTF-8
C++
false
false
1,447
cpp
// // File: sherpaTTPlanner_rtwutil.cpp // // MATLAB Coder version : 2.7 // C/C++ source code generated on : 05-Mar-2015 15:01:21 // // Include Files #include "rt_nonfinite.h" #include "buildBiDirectionalRRTWrapper.h" #include "buildRRTWrapper.h" #include "randomStateGenerator.h" #include "sherpaTTPlanner_rtwutil.h" #include <stdio.h> // Function Definitions // // Arguments : double u0 // double u1 // Return Type : double // double rt_atan2d_snf(double u0, double u1) { double y; int b_u0; int b_u1; if (rtIsNaN(u0) || rtIsNaN(u1)) { y = rtNaN; } else if (rtIsInf(u0) && rtIsInf(u1)) { if (u0 > 0.0) { b_u0 = 1; } else { b_u0 = -1; } if (u1 > 0.0) { b_u1 = 1; } else { b_u1 = -1; } y = atan2((double)b_u0, (double)b_u1); } else if (u1 == 0.0) { if (u0 > 0.0) { y = RT_PI / 2.0; } else if (u0 < 0.0) { y = -(double)(RT_PI / 2.0); } else { y = 0.0; } } else { y = atan2(u0, u1); } return y; } // // Arguments : double u // Return Type : double // double rt_roundd_snf(double u) { double y; if (std::abs(u) < 4.503599627370496E+15) { if (u >= 0.5) { y = std::floor(u + 0.5); } else if (u > -0.5) { y = u * 0.0; } else { y = std::ceil(u - 0.5); } } else { y = u; } return y; } // // File trailer for sherpaTTPlanner_rtwutil.cpp // // [EOF] //
[ "will.reid3@gmail.com" ]
will.reid3@gmail.com
4e4c923616a10c6a25c90b35c9ccad077b911d24
5c7e7bb3222e2f27858d15b5d5bc51c0a5d763e7
/obj_dir/VMIPS__Syms.cpp
63366bd90bd3e11c75fb360ef8b486bbf52d87ab
[]
no_license
NickTGraham/ECE401_Project1
ec68570167816c37bd51488f1eeca720fb240d83
a8e857137aace9eb52f1dc81856690d79535204d
refs/heads/master
2021-03-30T15:59:41.310980
2017-11-16T18:43:14
2017-11-16T18:43:14
70,346,243
0
0
null
null
null
null
UTF-8
C++
false
false
2,982
cpp
// Verilated -*- C++ -*- // DESCRIPTION: Verilator output: Symbol table implementation internals #include "VMIPS__Syms.h" #include "VMIPS.h" #include "VMIPS_MIPS.h" #include "VMIPS_ID.h" #include "VMIPS_EXE.h" #include "VMIPS_RegFile.h" // FUNCTIONS VMIPS__Syms::VMIPS__Syms(VMIPS* topp, const char* namep) // Setup locals : __Vm_namep(namep) , __Vm_activity(false) , __Vm_didInit(false) // Setup submodule names , TOP__v (Verilated::catName(topp->name(),"v")) , TOP__v__EXE (Verilated::catName(topp->name(),"v.EXE")) , TOP__v__ID (Verilated::catName(topp->name(),"v.ID")) , TOP__v__ID__RegFile (Verilated::catName(topp->name(),"v.ID.RegFile")) { // Pointer to top level TOPp = topp; // Setup each module's pointers to their submodules TOPp->v = &TOP__v; TOPp->v->EXE = &TOP__v__EXE; TOPp->v->ID = &TOP__v__ID; TOPp->v->ID->RegFile = &TOP__v__ID__RegFile; // Setup each module's pointer back to symbol table (for public functions) TOPp->__Vconfigure(this, true); TOP__v.__Vconfigure(this, true); TOP__v__EXE.__Vconfigure(this, true); TOP__v__ID.__Vconfigure(this, true); TOP__v__ID__RegFile.__Vconfigure(this, true); // Setup scope names __Vscope_v.configure(this,name(),"v"); __Vscope_v__EXE.configure(this,name(),"v.EXE"); __Vscope_v__ID__RegFile.configure(this,name(),"v.ID.RegFile"); // Setup export functions for (int __Vfinal=0; __Vfinal<2; __Vfinal++) { __Vscope_v.varInsert(__Vfinal,"Instr_address_2IC", &(TOP__v.Instr_address_2IC), VLVT_UINT32,VLVD_NODIR|VLVF_PUB_RW,1 ,31,0); __Vscope_v.varInsert(__Vfinal,"data_address_2DC", &(TOP__v.data_address_2DC), VLVT_UINT32,VLVD_NODIR|VLVF_PUB_RW,1 ,31,0); __Vscope_v.varInsert(__Vfinal,"data_read_fDC", &(TOP__v.data_read_fDC), VLVT_UINT32,VLVD_NODIR|VLVF_PUB_RW,1 ,31,0); __Vscope_v.varInsert(__Vfinal,"data_valid_fDC", &(TOP__v.data_valid_fDC), VLVT_UINT8,VLVD_NODIR|VLVF_PUB_RW,0); __Vscope_v.varInsert(__Vfinal,"data_write_2DC", &(TOP__v.data_write_2DC), VLVT_UINT32,VLVD_NODIR|VLVF_PUB_RW,1 ,31,0); __Vscope_v.varInsert(__Vfinal,"data_write_size_2DC", &(TOP__v.data_write_size_2DC), VLVT_UINT8,VLVD_NODIR|VLVF_PUB_RW,1 ,1,0); __Vscope_v.varInsert(__Vfinal,"flush_2DC", &(TOP__v.flush_2DC), VLVT_UINT8,VLVD_NODIR|VLVF_PUB_RW,0); __Vscope_v.varInsert(__Vfinal,"read_2DC", &(TOP__v.read_2DC), VLVT_UINT8,VLVD_NODIR|VLVF_PUB_RW,0); __Vscope_v.varInsert(__Vfinal,"write_2DC", &(TOP__v.write_2DC), VLVT_UINT8,VLVD_NODIR|VLVF_PUB_RW,0); __Vscope_v__EXE.varInsert(__Vfinal,"HI", &(TOP__v__EXE.HI), VLVT_UINT32,VLVD_NODIR|VLVF_PUB_RW,1 ,31,0); __Vscope_v__EXE.varInsert(__Vfinal,"LO", &(TOP__v__EXE.LO), VLVT_UINT32,VLVD_NODIR|VLVF_PUB_RW,1 ,31,0); __Vscope_v__ID__RegFile.varInsert(__Vfinal,"Reg", &(TOP__v__ID__RegFile.Reg), VLVT_UINT32,VLVD_NODIR|VLVF_PUB_RW,2 ,31,0 ,31,0); } }
[ "nickdud341@gmail.com" ]
nickdud341@gmail.com
ba0013256a3f50bad7f92094693be78cb0456ddc
b7e97047616d9343be5b9bbe03fc0d79ba5a6143
/test/core/select/residue_selector/NeighborhoodResidueSelector.cxxtest.hh
400c01e653edaeb01e6ff6377121c0ebc232475c
[]
no_license
achitturi/ROSETTA-main-source
2772623a78e33e7883a453f051d53ea6cc53ffa5
fe11c7e7cb68644f404f4c0629b64da4bb73b8f9
refs/heads/master
2021-05-09T15:04:34.006421
2018-01-26T17:10:33
2018-01-26T17:10:33
119,081,547
1
3
null
null
null
null
UTF-8
C++
false
false
7,364
hh
// -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*- // vi: set ts=2 noet: // // (c) Copyright Rosetta Commons Member Institutions. // (c) This file is part of the Rosetta software suite and is made available under license. // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons. // (c) For more information, see http://www.rosettacommons.org. Questions about this can be // (c) addressed to University of Washington CoMotion, email: license@uw.edu. /// @file core/select/residue_selector/NeighborhoodResidueSelector.cxxtest.hh /// @brief test suite for core::select::residue_selector::NeighborhoodResidueSelector /// @author Robert Lindner (rlindner@mpimf-heidelberg.mpg.de) /// @author Jared Adolf-Bryfogle (jadolfbr@gmail.com) // Test headers #include <cxxtest/TestSuite.h> #include <test/protocols/init_util.hh> #include <test/util/pose_funcs.hh> #include <test/core/select/residue_selector/DummySelectors.hh> #include <test/core/select/residue_selector/utilities_for_testing.hh> // Package headers #include <core/select/residue_selector/NeighborhoodResidueSelector.hh> #include <core/scoring/ScoreFunction.hh> #include <core/scoring/ScoreFunctionFactory.hh> // Project headers #include <core/pose/Pose.hh> #include <core/conformation/Residue.hh> // Utility headers #include <utility/tag/Tag.hh> #include <utility/excn/Exceptions.hh> #include <utility/string_util.hh> // Basic headers #include <basic/datacache/DataMap.hh> #include <basic/Tracer.hh> // C++ headers #include <string> using namespace core::select::residue_selector; static THREAD_LOCAL basic::Tracer TR("core.select.residue_selector.NeighborhoodResidueSelectorTests"); class NeighborhoodResidueSelectorTests : public CxxTest::TestSuite { public: void setUp() { core_init(); trpcage = create_trpcage_ideal_pose(); core::scoring::ScoreFunctionOP score = core::scoring::get_score_function(); score->score(trpcage); } /// @brief Test NotResidueSelector::parse_my_tag void test_NeighborhoodResidueSelector_parse_my_tag_selector() { std::string tag_string = "<Neighborhood name=neighbor_rs selector=odd distance=5.2/>"; std::stringstream ss( tag_string ); utility::tag::TagOP tag( new utility::tag::Tag() ); tag->read( ss ); basic::datacache::DataMap dm; ResidueSelectorOP odd_rs( new OddResidueSelector ); dm.add( "ResidueSelector", "odd", odd_rs ); ResidueSelectorOP neighbor_rs( new NeighborhoodResidueSelector ); neighbor_rs->parse_my_tag( tag, dm ); ResidueSubset subset = neighbor_rs->apply( trpcage ); TS_ASSERT_EQUALS( subset.size(), trpcage.size() ); // check the result // 1. generate fake focus utility::vector1< core::Size > testFocus(trpcage.size(), false); for ( core::Size ii = 1; ii <= trpcage.size(); ii += 2 ) { testFocus[ ii ] = true; } // test TS_ASSERT( check_calculation( trpcage, subset, testFocus, 5.2 ) ); } void test_NeighborhoodResidueSelector_parse_my_tag_str() { std::string tag_string = "<Neighborhood name=neighbor_rs resnums=2,3,5 distance=5.2/>"; std::stringstream ss( tag_string ); utility::tag::TagOP tag( new utility::tag::Tag() ); tag->read( ss ); basic::datacache::DataMap dm; ResidueSelectorOP neighbor_rs( new NeighborhoodResidueSelector ); neighbor_rs->parse_my_tag( tag, dm ); ResidueSubset subset = neighbor_rs->apply( trpcage ); utility::vector1< core::Size > testFocus(trpcage.size(), false); testFocus[2] = true; testFocus[3] = true; testFocus[5] = true; TS_ASSERT( check_calculation( trpcage, subset, testFocus, 5.2 ) ); } // make sure we fail if neither selector nor focus string are provided void test_NeighbohoodResidueSelector_fail_no_focus() { std::string tag_string = "<Neighborhood name=neighbor_rs distance=5.2/>"; std::stringstream ss( tag_string ); utility::tag::TagOP tag( new utility::tag::Tag() ); tag->read( ss ); basic::datacache::DataMap dm; ResidueSelectorOP neighbor_rs( new NeighborhoodResidueSelector ); try { neighbor_rs->parse_my_tag( tag, dm ); TS_ASSERT( false ); //parsing should fail! } catch ( utility::excn::EXCN_Msg_Exception e ) { TS_ASSERT(true == true); //We should always get here. } } // desired behavior is that the most recent call to set_focus or set_focus_selector // determines which source of focus residues is used void test_NeighborhoodResidueSelector_use_last_provided_source_of_focus() { utility::vector1< core::Size > focus_set(trpcage.size(), false); focus_set[2] = true; focus_set[3] = true; NeighborhoodResidueSelectorOP neighbor_rs( new NeighborhoodResidueSelector(focus_set, 5.0) ); ResidueSelectorOP odd_rs( new OddResidueSelector ); ResidueSubset subset( trpcage.size(), false ); TS_ASSERT_EQUALS( subset.size(), trpcage.size() ); utility::vector1< core::Size > testFocus_odd(trpcage.size(), false); for ( core::Size ii = 1; ii <= trpcage.size(); ii += 2 ) { testFocus_odd[ ii ] = true; } try { subset = neighbor_rs->apply( trpcage ); TS_ASSERT( check_calculation( trpcage, subset, focus_set, 5.0 ) ); neighbor_rs->set_focus_selector( odd_rs ); subset = neighbor_rs->apply( trpcage ); TS_ASSERT( check_calculation( trpcage, subset, testFocus_odd, 5.0 ) ); neighbor_rs->set_focus( focus_set ); subset = neighbor_rs->apply( trpcage ); TS_ASSERT( check_calculation( trpcage, subset, focus_set, 5.0 ) ); } catch ( utility::excn::EXCN_Msg_Exception e ) { std::cerr << "Exception! " << e.msg(); TS_ASSERT( false ); } } bool check_calculation( core::pose::Pose const & pose, ResidueSubset const & subset, ResidueSubset const & focus, core::Real distance) { if ( focus.size() != subset.size() ) { return false; } //JAB - rewrite to simplify logic and change to ResidueSubset as focus. /// We measure neighbors to the focus and this is the ctrl_subset. /// We then compare this subset to our actual subset. ResidueSubset ctrl_subset(subset.size(), false); core::Real const dst_squared = distance * distance; for ( core::Size i = 1; i <= focus.size(); ++i ) { //If we have a focus residue, we will calculate its neighbors. if ( !focus[i] ) continue; ctrl_subset[i] = true; core::conformation::Residue const & r1( pose.residue( i ) ); //Go through all Subset residues for ( core::Size x = 1; x <= subset.size(); ++x ) { //If this is already true, we don't need to recalculate. if ( ctrl_subset[ x ] ) continue; //Measure the distance, set the ctrl_subset. core::conformation::Residue const & r2( pose.residue( x ) ); core::Real const d_sq( r1.xyz( r1.nbr_atom() ).distance_squared( r2.xyz( r2.nbr_atom() ) ) ); if ( d_sq <= dst_squared ) { ctrl_subset[ x ] = true; } } } TR<< "focus " << utility::to_string(focus) << std::endl; TR<< "subset" << utility::to_string(subset) << std::endl; TR<< "ctrl " << utility::to_string(ctrl_subset) << std::endl; //Compare subset to control subset. Return False if they do not match. for ( core::Size i = 1; i <= pose.size(); ++i ) { if ( ctrl_subset[ i ] != subset[ i ] ) { TR << "Resnum "<< i <<" "<< ctrl_subset[ i ] << "!=" << subset[ i ] << std::endl; return false; } } // no mismatches found return true; } private: core::pose::Pose trpcage; };
[ "achitturi17059@gmail.com" ]
achitturi17059@gmail.com
78537fee0c8cd4738e0fc5fc8666319ffe764a57
88aac5840b11009e4fb0275c150329b3e46c9e1c
/SFML_GAME/HitboxComponent.cpp
3729637c899ba04d189bd8b18e3456c97a03dfdb
[]
no_license
ohmlim123/Game-suraj-Ohmlim
bcf640b48fa0aa9f74d08869df95a93d23cd11d5
4afc60059728c490c55b59b89df6dcf06ebfa1f6
refs/heads/master
2023-01-13T18:18:10.685423
2020-11-20T19:40:07
2020-11-20T19:40:07
306,371,528
0
0
null
null
null
null
UTF-8
C++
false
false
1,946
cpp
#include"stdafx.h" #include "HitboxComponent.h" HitboxComponent::HitboxComponent(sf::Sprite& sprite, float offset_x, float offset_y, float width, float height) :sprite(sprite), offsetX(offset_x),offsetY(offset_y) { this->nextPosition.left = 0.f; this->nextPosition.top = 0.f; this->nextPosition.width = width; this->nextPosition.height = height; this->hitbox.setPosition(this->sprite.getPosition().x + offset_x, this->sprite.getPosition().y + offset_y ); this->hitbox.setSize(sf::Vector2f(width, height)); this->hitbox.setFillColor(sf::Color::Transparent); this->hitbox.setOutlineThickness(-1.f); this->hitbox.setOutlineColor(sf::Color::Red); //work hard play harder!! } HitboxComponent::~HitboxComponent() { } //Accessors const sf::Vector2f& HitboxComponent::getPosition() const { return this->hitbox.getPosition(); } const sf::FloatRect HitboxComponent::getGlobalBounds() const { return this->hitbox.getGlobalBounds(); } const sf::FloatRect& HitboxComponent::getnextPosition(const sf::Vector2f& velocity) { this->nextPosition.left = this->hitbox.getPosition().x + velocity.x; this->nextPosition.top = this->hitbox.getPosition().y + velocity.y ; return this->nextPosition; } //Modifier void HitboxComponent::setPosition(const sf::Vector2f& position) { this->hitbox.setPosition(position); this->sprite.setPosition(position.x - this->offsetX, position.y - this->offsetY ); } void HitboxComponent::setPosition(const float x, const float y) { this->hitbox.setPosition(x,y); this->sprite.setPosition(x - this->offsetX, y - this->offsetY); } bool HitboxComponent::intersects(const sf::FloatRect& frect) { return this->hitbox.getGlobalBounds().intersects(frect); } void HitboxComponent::update() { this->hitbox.setPosition(this->sprite.getPosition().x + this->offsetX, this->sprite.getPosition().y + this->offsetY ); } void HitboxComponent::render(sf::RenderTarget& target) { target.draw(this->hitbox); }
[ "ohmlim1234567@gmail.com" ]
ohmlim1234567@gmail.com
f552ec1d4aeed4b0128065300a443c574daaba47
e2bec2f1d30fb6471fc758da6a74b6e49758bdda
/android/build/generated/jni/ti.canvas.CanvasModule.cpp
ab338dda8908c71735b6d0de63d3eb4f8a4b0728
[]
no_license
AppWerft/Ti.Canvas
6ee43feafa1b3b804b7d0e479ba7fc0af9b32733
df8b2c5f07a57935442dd045c1630bdfd3276454
refs/heads/master
2021-04-06T08:26:18.251517
2018-03-13T08:51:12
2018-03-13T08:51:12
124,749,594
3
2
null
2018-03-13T08:51:13
2018-03-11T11:27:16
Java
UTF-8
C++
false
false
3,692
cpp
/** * Appcelerator Titanium Mobile * Copyright (c) 2011-2017 by Appcelerator, Inc. All Rights Reserved. * Licensed under the terms of the Apache Public License * Please see the LICENSE included with this distribution for details. */ /** This code is generated, do not edit by hand. **/ #include "ti.canvas.CanvasModule.h" #include "AndroidUtil.h" #include "JNIUtil.h" #include "JSException.h" #include "TypeConverter.h" #include "V8Util.h" #include "ti.canvas.ViewProxy.h" #include "org.appcelerator.kroll.KrollModule.h" #define TAG "CanvasModule" using namespace v8; namespace ti { namespace canvas { Persistent<FunctionTemplate> CanvasModule::proxyTemplate; jclass CanvasModule::javaClass = NULL; CanvasModule::CanvasModule() : titanium::Proxy() { } void CanvasModule::bindProxy(Local<Object> exports, Local<Context> context) { Isolate* isolate = context->GetIsolate(); Local<FunctionTemplate> pt = getProxyTemplate(isolate); v8::TryCatch tryCatch(isolate); Local<Function> constructor; MaybeLocal<Function> maybeConstructor = pt->GetFunction(context); if (!maybeConstructor.ToLocal(&constructor)) { titanium::V8Util::fatalException(isolate, tryCatch); return; } Local<String> nameSymbol = NEW_SYMBOL(isolate, "Canvas"); // use symbol over string for efficiency MaybeLocal<Object> maybeInstance = constructor->NewInstance(context); Local<Object> moduleInstance; if (!maybeInstance.ToLocal(&moduleInstance)) { titanium::V8Util::fatalException(isolate, tryCatch); return; } exports->Set(nameSymbol, moduleInstance); } void CanvasModule::dispose(Isolate* isolate) { LOGD(TAG, "dispose()"); if (!proxyTemplate.IsEmpty()) { proxyTemplate.Reset(); } titanium::KrollModule::dispose(isolate); } Local<FunctionTemplate> CanvasModule::getProxyTemplate(Isolate* isolate) { if (!proxyTemplate.IsEmpty()) { return proxyTemplate.Get(isolate); } LOGD(TAG, "CanvasModule::getProxyTemplate()"); javaClass = titanium::JNIUtil::findClass("ti/canvas/CanvasModule"); EscapableHandleScope scope(isolate); // use symbol over string for efficiency Local<String> nameSymbol = NEW_SYMBOL(isolate, "Canvas"); Local<FunctionTemplate> t = titanium::Proxy::inheritProxyTemplate(isolate, titanium::KrollModule::getProxyTemplate(isolate) , javaClass, nameSymbol); proxyTemplate.Reset(isolate, t); t->Set(titanium::Proxy::inheritSymbol.Get(isolate), FunctionTemplate::New(isolate, titanium::Proxy::inherit<CanvasModule>)); // Method bindings -------------------------------------------------------- Local<ObjectTemplate> prototypeTemplate = t->PrototypeTemplate(); Local<ObjectTemplate> instanceTemplate = t->InstanceTemplate(); // Delegate indexed property get and set to the Java proxy. instanceTemplate->SetIndexedPropertyHandler(titanium::Proxy::getIndexedProperty, titanium::Proxy::setIndexedProperty); // Constants -------------------------------------------------------------- JNIEnv *env = titanium::JNIScope::getEnv(); if (!env) { LOGE(TAG, "Failed to get environment in CanvasModule"); //return; } DEFINE_INT_CONSTANT(isolate, prototypeTemplate, "VERTEX_MODE_TRIANGLES_STRIP", 2); DEFINE_INT_CONSTANT(isolate, prototypeTemplate, "VERTEX_MODE_TRIANGLES", 0); DEFINE_INT_CONSTANT(isolate, prototypeTemplate, "VERTEX_MODE_TRIANGLES_FAN", 1); // Dynamic properties ----------------------------------------------------- // Accessors -------------------------------------------------------------- return scope.Escape(t); } // Methods -------------------------------------------------------------------- // Dynamic property accessors ------------------------------------------------- } // canvas } // ti
[ "“rs@hamburger-appwerft.de“" ]
“rs@hamburger-appwerft.de“
75338c90e48290ac44c3b5ea3d01388d40388326
2a7e77565c33e6b5d92ce6702b4a5fd96f80d7d0
/fuzzedpackages/Rmixmod/src/mixmod_iostream/to_be_removed/DomClusteringProject.h
0029cfb45458b0ba920b2a17bacb04d2a71065e3
[]
no_license
akhikolla/testpackages
62ccaeed866e2194652b65e7360987b3b20df7e7
01259c3543febc89955ea5b79f3a08d3afe57e95
refs/heads/master
2023-02-18T03:50:28.288006
2021-01-18T13:23:32
2021-01-18T13:23:32
329,981,898
7
1
null
null
null
null
UTF-8
C++
false
false
2,165
h
/*************************************************************************** SRC/MIXMOD_IOSTREAM/XEMDomClusteringProject.h description copyright : (C) MIXMOD Team - 2001-2011 email : contact@mixmod.org ***************************************************************************/ /*************************************************************************** This file is part of MIXMOD MIXMOD is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. MIXMOD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with MIXMOD. If not, see <http://www.gnu.org/licenses/>. All informations available on : http://www.mixmod.org ***************************************************************************/ #ifndef XEM_DOMCLUSTERINGPROJECT_H #define XEM_DOMCLUSTERINGPROJECT_H #include "mixmod_iostream/DomProject.h" namespace XEM { ///use to create .mixmod file in Clustering case class DomClusteringProject : public DomProject { public : ///constructor by default DomClusteringProject(); ///destructor virtual ~DomClusteringProject(); ///constructor by initialization DomClusteringProject(xmlpp::Element *root); ///fill the xmlpp::Document to create the .mixmod file from a ClusteringInput and ClusteringOutput void writeClustering(string & s, ClusteringMain * cMain); ///read a XML file and fill ClusteringInput void readClustering(ClusteringInput * cInput); ///read a XML file and fill ClusteringOutput void readClustering(ClusteringOutput * cOutput); }; } //end namespace #endif // XEM_DOMCLUSTERINGPROJECT_H
[ "akhilakollasrinu424jf@gmail.com" ]
akhilakollasrinu424jf@gmail.com
ef9a754079c0db91440a9dba63fcf9b96e68f416
0eff74b05b60098333ad66cf801bdd93becc9ea4
/second/download/curl/gumtree/curl_old_log_6301.cpp
a7de7af12f6a8d052cec3db6648f11d83f7699c1
[]
no_license
niuxu18/logTracker-old
97543445ea7e414ed40bdc681239365d33418975
f2b060f13a0295387fe02187543db124916eb446
refs/heads/master
2021-09-13T21:39:37.686481
2017-12-11T03:36:34
2017-12-11T03:36:34
null
0
0
null
null
null
null
UTF-8
C++
false
false
498
cpp
fputs( " --crlf (FTP) Convert LF to CRLF in upload. Useful for MVS (OS/390).\n" "\n" " --crlfile <file>\n" " (HTTPS/FTPS) Provide a file using PEM format with a Certificate\n" " Revocation List that may specify peer certificates that are to\n" " be considered revoked.\n" "\n" " If this option is used several times, the last one will be used.\n" "\n" " (Added in 7.19.7)\n" "\n" " -d/--data <data>\n" , stdout);
[ "993273596@qq.com" ]
993273596@qq.com
8f34a1eb74640ad4d178f6c2d5c3ae5ffe76cadb
ffec661fbab4218ece3b026d84606813c0ddc9ac
/src/objects/js-objects-inl.h
9a755af84a321123a84f1ba19d7ffa791af188f8
[ "BSD-3-Clause", "SunPro", "bzip2-1.0.6" ]
permissive
j10sanders/v8
ce9dd110b17eef969d21b28185796706ba7ce89a
0988e0d6477dfee77535cbbd08d3e519a40ee874
refs/heads/master
2020-04-22T19:34:36.935169
2019-02-13T22:54:45
2019-02-14T00:02:03
170,612,198
0
0
NOASSERTION
2019-02-14T02:17:34
2019-02-14T02:17:34
null
UTF-8
C++
false
false
36,366
h
// Copyright 2018 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_OBJECTS_JS_OBJECTS_INL_H_ #define V8_OBJECTS_JS_OBJECTS_INL_H_ #include "src/objects/js-objects.h" #include "src/feedback-vector.h" #include "src/field-index-inl.h" #include "src/heap/heap-write-barrier.h" #include "src/keys.h" #include "src/lookup-inl.h" #include "src/objects/embedder-data-slot-inl.h" #include "src/objects/feedback-cell-inl.h" #include "src/objects/hash-table-inl.h" #include "src/objects/heap-number-inl.h" #include "src/objects/property-array-inl.h" #include "src/objects/shared-function-info.h" #include "src/objects/slots.h" #include "src/objects/smi-inl.h" #include "src/prototype-inl.h" // Has to be the last include (doesn't have include guards): #include "src/objects/object-macros.h" namespace v8 { namespace internal { OBJECT_CONSTRUCTORS_IMPL(JSReceiver, HeapObject) OBJECT_CONSTRUCTORS_IMPL(JSObject, JSReceiver) OBJECT_CONSTRUCTORS_IMPL(JSAsyncFromSyncIterator, JSObject) OBJECT_CONSTRUCTORS_IMPL(JSBoundFunction, JSObject) OBJECT_CONSTRUCTORS_IMPL(JSDate, JSObject) OBJECT_CONSTRUCTORS_IMPL(JSFunction, JSObject) OBJECT_CONSTRUCTORS_IMPL(JSGlobalObject, JSObject) OBJECT_CONSTRUCTORS_IMPL(JSGlobalProxy, JSObject) JSIteratorResult::JSIteratorResult(Address ptr) : JSObject(ptr) {} OBJECT_CONSTRUCTORS_IMPL(JSMessageObject, JSObject) OBJECT_CONSTRUCTORS_IMPL(JSStringIterator, JSObject) OBJECT_CONSTRUCTORS_IMPL(JSValue, JSObject) NEVER_READ_ONLY_SPACE_IMPL(JSReceiver) CAST_ACCESSOR(JSAsyncFromSyncIterator) CAST_ACCESSOR(JSBoundFunction) CAST_ACCESSOR(JSDate) CAST_ACCESSOR(JSFunction) CAST_ACCESSOR(JSGlobalObject) CAST_ACCESSOR(JSGlobalProxy) CAST_ACCESSOR(JSIteratorResult) CAST_ACCESSOR(JSMessageObject) CAST_ACCESSOR(JSObject) CAST_ACCESSOR(JSReceiver) CAST_ACCESSOR(JSStringIterator) CAST_ACCESSOR(JSValue) MaybeHandle<Object> JSReceiver::GetProperty(Isolate* isolate, Handle<JSReceiver> receiver, Handle<Name> name) { LookupIterator it(isolate, receiver, name, receiver); if (!it.IsFound()) return it.factory()->undefined_value(); return Object::GetProperty(&it); } MaybeHandle<Object> JSReceiver::GetElement(Isolate* isolate, Handle<JSReceiver> receiver, uint32_t index) { LookupIterator it(isolate, receiver, index, receiver); if (!it.IsFound()) return it.factory()->undefined_value(); return Object::GetProperty(&it); } Handle<Object> JSReceiver::GetDataProperty(Handle<JSReceiver> object, Handle<Name> name) { LookupIterator it(object, name, object, LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); if (!it.IsFound()) return it.factory()->undefined_value(); return GetDataProperty(&it); } MaybeHandle<Object> JSReceiver::GetPrototype(Isolate* isolate, Handle<JSReceiver> receiver) { // We don't expect access checks to be needed on JSProxy objects. DCHECK(!receiver->IsAccessCheckNeeded() || receiver->IsJSObject()); PrototypeIterator iter(isolate, receiver, kStartAtReceiver, PrototypeIterator::END_AT_NON_HIDDEN); do { if (!iter.AdvanceFollowingProxies()) return MaybeHandle<Object>(); } while (!iter.IsAtEnd()); return PrototypeIterator::GetCurrent(iter); } MaybeHandle<Object> JSReceiver::GetProperty(Isolate* isolate, Handle<JSReceiver> receiver, const char* name) { Handle<String> str = isolate->factory()->InternalizeUtf8String(name); return GetProperty(isolate, receiver, str); } // static V8_WARN_UNUSED_RESULT MaybeHandle<FixedArray> JSReceiver::OwnPropertyKeys( Handle<JSReceiver> object) { return KeyAccumulator::GetKeys(object, KeyCollectionMode::kOwnOnly, ALL_PROPERTIES, GetKeysConversion::kConvertToString); } bool JSObject::PrototypeHasNoElements(Isolate* isolate, JSObject object) { DisallowHeapAllocation no_gc; HeapObject prototype = HeapObject::cast(object->map()->prototype()); ReadOnlyRoots roots(isolate); HeapObject null = roots.null_value(); FixedArrayBase empty_fixed_array = roots.empty_fixed_array(); FixedArrayBase empty_slow_element_dictionary = roots.empty_slow_element_dictionary(); while (prototype != null) { Map map = prototype->map(); if (map->IsCustomElementsReceiverMap()) return false; FixedArrayBase elements = JSObject::cast(prototype)->elements(); if (elements != empty_fixed_array && elements != empty_slow_element_dictionary) { return false; } prototype = HeapObject::cast(map->prototype()); } return true; } ACCESSORS(JSReceiver, raw_properties_or_hash, Object, kPropertiesOrHashOffset) FixedArrayBase JSObject::elements() const { Object array = READ_FIELD(*this, kElementsOffset); return FixedArrayBase::cast(array); } void JSObject::EnsureCanContainHeapObjectElements(Handle<JSObject> object) { JSObject::ValidateElements(*object); ElementsKind elements_kind = object->map()->elements_kind(); if (!IsObjectElementsKind(elements_kind)) { if (IsHoleyElementsKind(elements_kind)) { TransitionElementsKind(object, HOLEY_ELEMENTS); } else { TransitionElementsKind(object, PACKED_ELEMENTS); } } } template <typename TSlot> void JSObject::EnsureCanContainElements(Handle<JSObject> object, TSlot objects, uint32_t count, EnsureElementsMode mode) { static_assert(std::is_same<TSlot, FullObjectSlot>::value || std::is_same<TSlot, ObjectSlot>::value, "Only ObjectSlot and FullObjectSlot are expected here"); ElementsKind current_kind = object->GetElementsKind(); ElementsKind target_kind = current_kind; { DisallowHeapAllocation no_allocation; DCHECK(mode != ALLOW_COPIED_DOUBLE_ELEMENTS); bool is_holey = IsHoleyElementsKind(current_kind); if (current_kind == HOLEY_ELEMENTS) return; Object the_hole = object->GetReadOnlyRoots().the_hole_value(); for (uint32_t i = 0; i < count; ++i, ++objects) { Object current = *objects; if (current == the_hole) { is_holey = true; target_kind = GetHoleyElementsKind(target_kind); } else if (!current->IsSmi()) { if (mode == ALLOW_CONVERTED_DOUBLE_ELEMENTS && current->IsNumber()) { if (IsSmiElementsKind(target_kind)) { if (is_holey) { target_kind = HOLEY_DOUBLE_ELEMENTS; } else { target_kind = PACKED_DOUBLE_ELEMENTS; } } } else if (is_holey) { target_kind = HOLEY_ELEMENTS; break; } else { target_kind = PACKED_ELEMENTS; } } } } if (target_kind != current_kind) { TransitionElementsKind(object, target_kind); } } void JSObject::EnsureCanContainElements(Handle<JSObject> object, Handle<FixedArrayBase> elements, uint32_t length, EnsureElementsMode mode) { ReadOnlyRoots roots = object->GetReadOnlyRoots(); if (elements->map() != roots.fixed_double_array_map()) { DCHECK(elements->map() == roots.fixed_array_map() || elements->map() == roots.fixed_cow_array_map()); if (mode == ALLOW_COPIED_DOUBLE_ELEMENTS) { mode = DONT_ALLOW_DOUBLE_ELEMENTS; } ObjectSlot objects = Handle<FixedArray>::cast(elements)->GetFirstElementAddress(); EnsureCanContainElements(object, objects, length, mode); return; } DCHECK(mode == ALLOW_COPIED_DOUBLE_ELEMENTS); if (object->GetElementsKind() == HOLEY_SMI_ELEMENTS) { TransitionElementsKind(object, HOLEY_DOUBLE_ELEMENTS); } else if (object->GetElementsKind() == PACKED_SMI_ELEMENTS) { Handle<FixedDoubleArray> double_array = Handle<FixedDoubleArray>::cast(elements); for (uint32_t i = 0; i < length; ++i) { if (double_array->is_the_hole(i)) { TransitionElementsKind(object, HOLEY_DOUBLE_ELEMENTS); return; } } TransitionElementsKind(object, PACKED_DOUBLE_ELEMENTS); } } void JSObject::SetMapAndElements(Handle<JSObject> object, Handle<Map> new_map, Handle<FixedArrayBase> value) { JSObject::MigrateToMap(object, new_map); DCHECK((object->map()->has_fast_smi_or_object_elements() || (*value == object->GetReadOnlyRoots().empty_fixed_array()) || object->map()->has_fast_string_wrapper_elements()) == (value->map() == object->GetReadOnlyRoots().fixed_array_map() || value->map() == object->GetReadOnlyRoots().fixed_cow_array_map())); DCHECK((*value == object->GetReadOnlyRoots().empty_fixed_array()) || (object->map()->has_fast_double_elements() == value->IsFixedDoubleArray())); object->set_elements(*value); } void JSObject::set_elements(FixedArrayBase value, WriteBarrierMode mode) { WRITE_FIELD(*this, kElementsOffset, value); CONDITIONAL_WRITE_BARRIER(*this, kElementsOffset, value, mode); } void JSObject::initialize_elements() { FixedArrayBase elements = map()->GetInitialElements(); WRITE_FIELD(*this, kElementsOffset, elements); } InterceptorInfo JSObject::GetIndexedInterceptor() { return map()->GetIndexedInterceptor(); } InterceptorInfo JSObject::GetNamedInterceptor() { return map()->GetNamedInterceptor(); } int JSObject::GetHeaderSize() const { return GetHeaderSize(map()); } int JSObject::GetHeaderSize(const Map map) { // Check for the most common kind of JavaScript object before // falling into the generic switch. This speeds up the internal // field operations considerably on average. InstanceType instance_type = map->instance_type(); return instance_type == JS_OBJECT_TYPE ? JSObject::kHeaderSize : GetHeaderSize(instance_type, map->has_prototype_slot()); } // static int JSObject::GetEmbedderFieldsStartOffset(const Map map) { // Embedder fields are located after the header size rounded up to the // kSystemPointerSize, whereas in-object properties are at the end of the // object. int header_size = GetHeaderSize(map); if (kTaggedSize == kSystemPointerSize) { DCHECK(IsAligned(header_size, kSystemPointerSize)); return header_size; } else { return RoundUp(header_size, kSystemPointerSize); } } int JSObject::GetEmbedderFieldsStartOffset() { return GetEmbedderFieldsStartOffset(map()); } // static int JSObject::GetEmbedderFieldCount(const Map map) { int instance_size = map->instance_size(); if (instance_size == kVariableSizeSentinel) return 0; // Embedder fields are located after the header size rounded up to the // kSystemPointerSize, whereas in-object properties are at the end of the // object. We don't have to round up the header size here because division by // kEmbedderDataSlotSizeInTaggedSlots will swallow potential padding in case // of (kTaggedSize != kSystemPointerSize) anyway. return (((instance_size - GetHeaderSize(map)) >> kTaggedSizeLog2) - map->GetInObjectProperties()) / kEmbedderDataSlotSizeInTaggedSlots; } int JSObject::GetEmbedderFieldCount() const { return GetEmbedderFieldCount(map()); } int JSObject::GetEmbedderFieldOffset(int index) { DCHECK_LT(static_cast<unsigned>(index), static_cast<unsigned>(GetEmbedderFieldCount())); return GetEmbedderFieldsStartOffset() + (kEmbedderDataSlotSize * index); } Object JSObject::GetEmbedderField(int index) { return EmbedderDataSlot(*this, index).load_tagged(); } void JSObject::SetEmbedderField(int index, Object value) { EmbedderDataSlot::store_tagged(*this, index, value); } void JSObject::SetEmbedderField(int index, Smi value) { EmbedderDataSlot(*this, index).store_smi(value); } bool JSObject::IsUnboxedDoubleField(FieldIndex index) { if (!FLAG_unbox_double_fields) return false; return map()->IsUnboxedDoubleField(index); } // Access fast-case object properties at index. The use of these routines // is needed to correctly distinguish between properties stored in-object and // properties stored in the properties array. Object JSObject::RawFastPropertyAt(FieldIndex index) { DCHECK(!IsUnboxedDoubleField(index)); if (index.is_inobject()) { return READ_FIELD(*this, index.offset()); } else { return property_array()->get(index.outobject_array_index()); } } double JSObject::RawFastDoublePropertyAt(FieldIndex index) { DCHECK(IsUnboxedDoubleField(index)); return READ_DOUBLE_FIELD(*this, index.offset()); } uint64_t JSObject::RawFastDoublePropertyAsBitsAt(FieldIndex index) { DCHECK(IsUnboxedDoubleField(index)); return READ_UINT64_FIELD(*this, index.offset()); } void JSObject::RawFastPropertyAtPut(FieldIndex index, Object value) { if (index.is_inobject()) { int offset = index.offset(); WRITE_FIELD(*this, offset, value); WRITE_BARRIER(*this, offset, value); } else { property_array()->set(index.outobject_array_index(), value); } } void JSObject::RawFastDoublePropertyAsBitsAtPut(FieldIndex index, uint64_t bits) { // Double unboxing is enabled only on 64-bit platforms without pointer // compression. DCHECK_EQ(kDoubleSize, kTaggedSize); Address field_addr = FIELD_ADDR(*this, index.offset()); base::Relaxed_Store(reinterpret_cast<base::AtomicWord*>(field_addr), static_cast<base::AtomicWord>(bits)); } void JSObject::FastPropertyAtPut(FieldIndex index, Object value) { if (IsUnboxedDoubleField(index)) { DCHECK(value->IsMutableHeapNumber()); // Ensure that all bits of the double value are preserved. RawFastDoublePropertyAsBitsAtPut( index, MutableHeapNumber::cast(value)->value_as_bits()); } else { RawFastPropertyAtPut(index, value); } } void JSObject::WriteToField(int descriptor, PropertyDetails details, Object value) { DCHECK_EQ(kField, details.location()); DCHECK_EQ(kData, details.kind()); DisallowHeapAllocation no_gc; FieldIndex index = FieldIndex::ForDescriptor(map(), descriptor); if (details.representation().IsDouble()) { // Nothing more to be done. if (value->IsUninitialized()) { return; } // Manipulating the signaling NaN used for the hole and uninitialized // double field sentinel in C++, e.g. with bit_cast or value()/set_value(), // will change its value on ia32 (the x87 stack is used to return values // and stores to the stack silently clear the signalling bit). uint64_t bits; if (value->IsSmi()) { bits = bit_cast<uint64_t>(static_cast<double>(Smi::ToInt(value))); } else { DCHECK(value->IsHeapNumber()); bits = HeapNumber::cast(value)->value_as_bits(); } if (IsUnboxedDoubleField(index)) { RawFastDoublePropertyAsBitsAtPut(index, bits); } else { auto box = MutableHeapNumber::cast(RawFastPropertyAt(index)); box->set_value_as_bits(bits); } } else { RawFastPropertyAtPut(index, value); } } int JSObject::GetInObjectPropertyOffset(int index) { return map()->GetInObjectPropertyOffset(index); } Object JSObject::InObjectPropertyAt(int index) { int offset = GetInObjectPropertyOffset(index); return READ_FIELD(*this, offset); } Object JSObject::InObjectPropertyAtPut(int index, Object value, WriteBarrierMode mode) { // Adjust for the number of properties stored in the object. int offset = GetInObjectPropertyOffset(index); WRITE_FIELD(*this, offset, value); CONDITIONAL_WRITE_BARRIER(*this, offset, value, mode); return value; } void JSObject::InitializeBody(Map map, int start_offset, Object pre_allocated_value, Object filler_value) { DCHECK_IMPLIES(filler_value->IsHeapObject(), !Heap::InYoungGeneration(filler_value)); DCHECK_IMPLIES(pre_allocated_value->IsHeapObject(), !Heap::InYoungGeneration(pre_allocated_value)); int size = map->instance_size(); int offset = start_offset; if (filler_value != pre_allocated_value) { int end_of_pre_allocated_offset = size - (map->UnusedPropertyFields() * kTaggedSize); DCHECK_LE(kHeaderSize, end_of_pre_allocated_offset); while (offset < end_of_pre_allocated_offset) { WRITE_FIELD(*this, offset, pre_allocated_value); offset += kTaggedSize; } } while (offset < size) { WRITE_FIELD(*this, offset, filler_value); offset += kTaggedSize; } } Object JSBoundFunction::raw_bound_target_function() const { return READ_FIELD(*this, kBoundTargetFunctionOffset); } ACCESSORS(JSBoundFunction, bound_target_function, JSReceiver, kBoundTargetFunctionOffset) ACCESSORS(JSBoundFunction, bound_this, Object, kBoundThisOffset) ACCESSORS(JSBoundFunction, bound_arguments, FixedArray, kBoundArgumentsOffset) ACCESSORS(JSFunction, raw_feedback_cell, FeedbackCell, kFeedbackCellOffset) ACCESSORS(JSGlobalObject, native_context, NativeContext, kNativeContextOffset) ACCESSORS(JSGlobalObject, global_proxy, JSObject, kGlobalProxyOffset) ACCESSORS(JSGlobalProxy, native_context, Object, kNativeContextOffset) FeedbackVector JSFunction::feedback_vector() const { DCHECK(has_feedback_vector()); return FeedbackVector::cast(raw_feedback_cell()->value()); } // Code objects that are marked for deoptimization are not considered to be // optimized. This is because the JSFunction might have been already // deoptimized but its code() still needs to be unlinked, which will happen on // its next activation. // TODO(jupvfranco): rename this function. Maybe RunOptimizedCode, // or IsValidOptimizedCode. bool JSFunction::IsOptimized() { return is_compiled() && code()->kind() == Code::OPTIMIZED_FUNCTION && !code()->marked_for_deoptimization(); } bool JSFunction::HasOptimizedCode() { return IsOptimized() || (has_feedback_vector() && feedback_vector()->has_optimized_code() && !feedback_vector()->optimized_code()->marked_for_deoptimization()); } bool JSFunction::HasOptimizationMarker() { return has_feedback_vector() && feedback_vector()->has_optimization_marker(); } void JSFunction::ClearOptimizationMarker() { DCHECK(has_feedback_vector()); feedback_vector()->ClearOptimizationMarker(); } // Optimized code marked for deoptimization will tier back down to running // interpreted on its next activation, and already doesn't count as IsOptimized. bool JSFunction::IsInterpreted() { return is_compiled() && (code()->is_interpreter_trampoline_builtin() || (code()->kind() == Code::OPTIMIZED_FUNCTION && code()->marked_for_deoptimization())); } bool JSFunction::ChecksOptimizationMarker() { return code()->checks_optimization_marker(); } bool JSFunction::IsMarkedForOptimization() { return has_feedback_vector() && feedback_vector()->optimization_marker() == OptimizationMarker::kCompileOptimized; } bool JSFunction::IsMarkedForConcurrentOptimization() { return has_feedback_vector() && feedback_vector()->optimization_marker() == OptimizationMarker::kCompileOptimizedConcurrent; } bool JSFunction::IsInOptimizationQueue() { return has_feedback_vector() && feedback_vector()->optimization_marker() == OptimizationMarker::kInOptimizationQueue; } void JSFunction::CompleteInobjectSlackTrackingIfActive() { if (!has_prototype_slot()) return; if (has_initial_map() && initial_map()->IsInobjectSlackTrackingInProgress()) { initial_map()->CompleteInobjectSlackTracking(GetIsolate()); } } AbstractCode JSFunction::abstract_code() { if (IsInterpreted()) { return AbstractCode::cast(shared()->GetBytecodeArray()); } else { return AbstractCode::cast(code()); } } Code JSFunction::code() const { return Code::cast(RELAXED_READ_FIELD(*this, kCodeOffset)); } void JSFunction::set_code(Code value) { DCHECK(!Heap::InYoungGeneration(value)); RELAXED_WRITE_FIELD(*this, kCodeOffset, value); MarkingBarrier(*this, RawField(kCodeOffset), value); } void JSFunction::set_code_no_write_barrier(Code value) { DCHECK(!Heap::InYoungGeneration(value)); RELAXED_WRITE_FIELD(*this, kCodeOffset, value); } SharedFunctionInfo JSFunction::shared() const { return SharedFunctionInfo::cast( RELAXED_READ_FIELD(*this, kSharedFunctionInfoOffset)); } void JSFunction::set_shared(SharedFunctionInfo value, WriteBarrierMode mode) { // Release semantics to support acquire read in NeedsResetDueToFlushedBytecode RELEASE_WRITE_FIELD(*this, kSharedFunctionInfoOffset, value); CONDITIONAL_WRITE_BARRIER(*this, kSharedFunctionInfoOffset, value, mode); } void JSFunction::ClearOptimizedCodeSlot(const char* reason) { if (has_feedback_vector() && feedback_vector()->has_optimized_code()) { if (FLAG_trace_opt) { PrintF("[evicting entry from optimizing code feedback slot (%s) for ", reason); ShortPrint(); PrintF("]\n"); } feedback_vector()->ClearOptimizedCode(); } } void JSFunction::SetOptimizationMarker(OptimizationMarker marker) { DCHECK(has_feedback_vector()); DCHECK(ChecksOptimizationMarker()); DCHECK(!HasOptimizedCode()); feedback_vector()->SetOptimizationMarker(marker); } bool JSFunction::has_feedback_vector() const { return shared()->is_compiled() && !raw_feedback_cell()->value()->IsUndefined(); } Context JSFunction::context() { return Context::cast(READ_FIELD(*this, kContextOffset)); } bool JSFunction::has_context() const { return READ_FIELD(*this, kContextOffset)->IsContext(); } JSGlobalProxy JSFunction::global_proxy() { return context()->global_proxy(); } NativeContext JSFunction::native_context() { return context()->native_context(); } void JSFunction::set_context(Object value) { DCHECK(value->IsUndefined() || value->IsContext()); WRITE_FIELD(*this, kContextOffset, value); WRITE_BARRIER(*this, kContextOffset, value); } ACCESSORS_CHECKED(JSFunction, prototype_or_initial_map, Object, kPrototypeOrInitialMapOffset, map()->has_prototype_slot()) bool JSFunction::has_prototype_slot() const { return map()->has_prototype_slot(); } Map JSFunction::initial_map() { return Map::cast(prototype_or_initial_map()); } bool JSFunction::has_initial_map() { DCHECK(has_prototype_slot()); return prototype_or_initial_map()->IsMap(); } bool JSFunction::has_instance_prototype() { DCHECK(has_prototype_slot()); return has_initial_map() || !prototype_or_initial_map()->IsTheHole(); } bool JSFunction::has_prototype() { DCHECK(has_prototype_slot()); return map()->has_non_instance_prototype() || has_instance_prototype(); } bool JSFunction::has_prototype_property() { return (has_prototype_slot() && IsConstructor()) || IsGeneratorFunction(shared()->kind()); } bool JSFunction::PrototypeRequiresRuntimeLookup() { return !has_prototype_property() || map()->has_non_instance_prototype(); } Object JSFunction::instance_prototype() { DCHECK(has_instance_prototype()); if (has_initial_map()) return initial_map()->prototype(); // When there is no initial map and the prototype is a JSReceiver, the // initial map field is used for the prototype field. return prototype_or_initial_map(); } Object JSFunction::prototype() { DCHECK(has_prototype()); // If the function's prototype property has been set to a non-JSReceiver // value, that value is stored in the constructor field of the map. if (map()->has_non_instance_prototype()) { Object prototype = map()->GetConstructor(); // The map must have a prototype in that field, not a back pointer. DCHECK(!prototype->IsMap()); DCHECK(!prototype->IsFunctionTemplateInfo()); return prototype; } return instance_prototype(); } bool JSFunction::is_compiled() const { return code()->builtin_index() != Builtins::kCompileLazy && shared()->is_compiled(); } bool JSFunction::NeedsResetDueToFlushedBytecode() { if (!FLAG_flush_bytecode) return false; // Do a raw read for shared and code fields here since this function may be // called on a concurrent thread and the JSFunction might not be fully // initialized yet. Object maybe_shared = ACQUIRE_READ_FIELD(*this, kSharedFunctionInfoOffset); Object maybe_code = RELAXED_READ_FIELD(*this, kCodeOffset); if (!maybe_shared->IsSharedFunctionInfo() || !maybe_code->IsCode()) { return false; } SharedFunctionInfo shared = SharedFunctionInfo::cast(maybe_shared); Code code = Code::cast(maybe_code); return !shared->is_compiled() && code->builtin_index() != Builtins::kCompileLazy; } void JSFunction::ResetIfBytecodeFlushed() { if (NeedsResetDueToFlushedBytecode()) { // Bytecode was flushed and function is now uncompiled, reset JSFunction // by setting code to CompileLazy and clearing the feedback vector. set_code(GetIsolate()->builtins()->builtin(i::Builtins::kCompileLazy)); raw_feedback_cell()->set_value( ReadOnlyRoots(GetIsolate()).undefined_value()); } } ACCESSORS(JSValue, value, Object, kValueOffset) ACCESSORS(JSDate, value, Object, kValueOffset) ACCESSORS(JSDate, cache_stamp, Object, kCacheStampOffset) ACCESSORS(JSDate, year, Object, kYearOffset) ACCESSORS(JSDate, month, Object, kMonthOffset) ACCESSORS(JSDate, day, Object, kDayOffset) ACCESSORS(JSDate, weekday, Object, kWeekdayOffset) ACCESSORS(JSDate, hour, Object, kHourOffset) ACCESSORS(JSDate, min, Object, kMinOffset) ACCESSORS(JSDate, sec, Object, kSecOffset) MessageTemplate JSMessageObject::type() const { Object value = READ_FIELD(*this, kTypeOffset); return MessageTemplateFromInt(Smi::ToInt(value)); } void JSMessageObject::set_type(MessageTemplate value) { WRITE_FIELD(*this, kTypeOffset, Smi::FromInt(static_cast<int>(value))); } ACCESSORS(JSMessageObject, argument, Object, kArgumentsOffset) ACCESSORS(JSMessageObject, script, Script, kScriptOffset) ACCESSORS(JSMessageObject, stack_frames, Object, kStackFramesOffset) SMI_ACCESSORS(JSMessageObject, start_position, kStartPositionOffset) SMI_ACCESSORS(JSMessageObject, end_position, kEndPositionOffset) SMI_ACCESSORS(JSMessageObject, error_level, kErrorLevelOffset) ElementsKind JSObject::GetElementsKind() const { ElementsKind kind = map()->elements_kind(); #if VERIFY_HEAP && DEBUG FixedArrayBase fixed_array = FixedArrayBase::unchecked_cast(READ_FIELD(*this, kElementsOffset)); // If a GC was caused while constructing this object, the elements // pointer may point to a one pointer filler map. if (ElementsAreSafeToExamine()) { Map map = fixed_array->map(); if (IsSmiOrObjectElementsKind(kind)) { DCHECK(map == GetReadOnlyRoots().fixed_array_map() || map == GetReadOnlyRoots().fixed_cow_array_map()); } else if (IsDoubleElementsKind(kind)) { DCHECK(fixed_array->IsFixedDoubleArray() || fixed_array == GetReadOnlyRoots().empty_fixed_array()); } else if (kind == DICTIONARY_ELEMENTS) { DCHECK(fixed_array->IsFixedArray()); DCHECK(fixed_array->IsDictionary()); } else { DCHECK(kind > DICTIONARY_ELEMENTS); } DCHECK(!IsSloppyArgumentsElementsKind(kind) || (elements()->IsFixedArray() && elements()->length() >= 2)); } #endif return kind; } bool JSObject::HasObjectElements() { return IsObjectElementsKind(GetElementsKind()); } bool JSObject::HasSmiElements() { return IsSmiElementsKind(GetElementsKind()); } bool JSObject::HasSmiOrObjectElements() { return IsSmiOrObjectElementsKind(GetElementsKind()); } bool JSObject::HasDoubleElements() { return IsDoubleElementsKind(GetElementsKind()); } bool JSObject::HasHoleyElements() { return IsHoleyElementsKind(GetElementsKind()); } bool JSObject::HasFastElements() { return IsFastElementsKind(GetElementsKind()); } bool JSObject::HasFastPackedElements() { return IsFastPackedElementsKind(GetElementsKind()); } bool JSObject::HasDictionaryElements() { return GetElementsKind() == DICTIONARY_ELEMENTS; } bool JSObject::HasFastArgumentsElements() { return GetElementsKind() == FAST_SLOPPY_ARGUMENTS_ELEMENTS; } bool JSObject::HasSlowArgumentsElements() { return GetElementsKind() == SLOW_SLOPPY_ARGUMENTS_ELEMENTS; } bool JSObject::HasSloppyArgumentsElements() { return IsSloppyArgumentsElementsKind(GetElementsKind()); } bool JSObject::HasStringWrapperElements() { return IsStringWrapperElementsKind(GetElementsKind()); } bool JSObject::HasFastStringWrapperElements() { return GetElementsKind() == FAST_STRING_WRAPPER_ELEMENTS; } bool JSObject::HasSlowStringWrapperElements() { return GetElementsKind() == SLOW_STRING_WRAPPER_ELEMENTS; } bool JSObject::HasFixedTypedArrayElements() { DCHECK(!elements().is_null()); return map()->has_fixed_typed_array_elements(); } #define FIXED_TYPED_ELEMENTS_CHECK(Type, type, TYPE, ctype) \ bool JSObject::HasFixed##Type##Elements() { \ FixedArrayBase array = elements(); \ return array->map()->instance_type() == FIXED_##TYPE##_ARRAY_TYPE; \ } TYPED_ARRAYS(FIXED_TYPED_ELEMENTS_CHECK) #undef FIXED_TYPED_ELEMENTS_CHECK bool JSObject::HasNamedInterceptor() { return map()->has_named_interceptor(); } bool JSObject::HasIndexedInterceptor() { return map()->has_indexed_interceptor(); } void JSGlobalObject::set_global_dictionary(GlobalDictionary dictionary) { DCHECK(IsJSGlobalObject()); set_raw_properties_or_hash(dictionary); } GlobalDictionary JSGlobalObject::global_dictionary() { DCHECK(!HasFastProperties()); DCHECK(IsJSGlobalObject()); return GlobalDictionary::cast(raw_properties_or_hash()); } NumberDictionary JSObject::element_dictionary() { DCHECK(HasDictionaryElements() || HasSlowStringWrapperElements()); return NumberDictionary::cast(elements()); } void JSReceiver::initialize_properties() { ReadOnlyRoots roots = GetReadOnlyRoots(); DCHECK(!Heap::InYoungGeneration(roots.empty_fixed_array())); DCHECK(!Heap::InYoungGeneration(roots.empty_property_dictionary())); if (map()->is_dictionary_map()) { WRITE_FIELD(*this, kPropertiesOrHashOffset, roots.empty_property_dictionary()); } else { WRITE_FIELD(*this, kPropertiesOrHashOffset, roots.empty_fixed_array()); } } bool JSReceiver::HasFastProperties() const { DCHECK( raw_properties_or_hash()->IsSmi() || (raw_properties_or_hash()->IsDictionary() == map()->is_dictionary_map())); return !map()->is_dictionary_map(); } NameDictionary JSReceiver::property_dictionary() const { DCHECK(!IsJSGlobalObject()); DCHECK(!HasFastProperties()); Object prop = raw_properties_or_hash(); if (prop->IsSmi()) { return GetReadOnlyRoots().empty_property_dictionary(); } return NameDictionary::cast(prop); } // TODO(gsathya): Pass isolate directly to this function and access // the heap from this. PropertyArray JSReceiver::property_array() const { DCHECK(HasFastProperties()); Object prop = raw_properties_or_hash(); if (prop->IsSmi() || prop == GetReadOnlyRoots().empty_fixed_array()) { return GetReadOnlyRoots().empty_property_array(); } return PropertyArray::cast(prop); } Maybe<bool> JSReceiver::HasProperty(Handle<JSReceiver> object, Handle<Name> name) { LookupIterator it = LookupIterator::PropertyOrElement(object->GetIsolate(), object, name, object); return HasProperty(&it); } Maybe<bool> JSReceiver::HasOwnProperty(Handle<JSReceiver> object, uint32_t index) { if (object->IsJSModuleNamespace()) return Just(false); if (object->IsJSObject()) { // Shortcut. LookupIterator it(object->GetIsolate(), object, index, object, LookupIterator::OWN); return HasProperty(&it); } Maybe<PropertyAttributes> attributes = JSReceiver::GetOwnPropertyAttributes(object, index); MAYBE_RETURN(attributes, Nothing<bool>()); return Just(attributes.FromJust() != ABSENT); } Maybe<PropertyAttributes> JSReceiver::GetPropertyAttributes( Handle<JSReceiver> object, Handle<Name> name) { LookupIterator it = LookupIterator::PropertyOrElement(object->GetIsolate(), object, name, object); return GetPropertyAttributes(&it); } Maybe<PropertyAttributes> JSReceiver::GetOwnPropertyAttributes( Handle<JSReceiver> object, Handle<Name> name) { LookupIterator it = LookupIterator::PropertyOrElement( object->GetIsolate(), object, name, object, LookupIterator::OWN); return GetPropertyAttributes(&it); } Maybe<PropertyAttributes> JSReceiver::GetOwnPropertyAttributes( Handle<JSReceiver> object, uint32_t index) { LookupIterator it(object->GetIsolate(), object, index, object, LookupIterator::OWN); return GetPropertyAttributes(&it); } Maybe<bool> JSReceiver::HasElement(Handle<JSReceiver> object, uint32_t index) { LookupIterator it(object->GetIsolate(), object, index, object); return HasProperty(&it); } Maybe<PropertyAttributes> JSReceiver::GetElementAttributes( Handle<JSReceiver> object, uint32_t index) { Isolate* isolate = object->GetIsolate(); LookupIterator it(isolate, object, index, object); return GetPropertyAttributes(&it); } Maybe<PropertyAttributes> JSReceiver::GetOwnElementAttributes( Handle<JSReceiver> object, uint32_t index) { Isolate* isolate = object->GetIsolate(); LookupIterator it(isolate, object, index, object, LookupIterator::OWN); return GetPropertyAttributes(&it); } bool JSGlobalObject::IsDetached() { return JSGlobalProxy::cast(global_proxy())->IsDetachedFrom(*this); } bool JSGlobalProxy::IsDetachedFrom(JSGlobalObject global) const { const PrototypeIterator iter(this->GetIsolate(), *this); return iter.GetCurrent() != global; } inline int JSGlobalProxy::SizeWithEmbedderFields(int embedder_field_count) { DCHECK_GE(embedder_field_count, 0); return kSize + embedder_field_count * kEmbedderDataSlotSize; } ACCESSORS(JSIteratorResult, value, Object, kValueOffset) ACCESSORS(JSIteratorResult, done, Object, kDoneOffset) ACCESSORS(JSAsyncFromSyncIterator, sync_iterator, JSReceiver, kSyncIteratorOffset) ACCESSORS(JSAsyncFromSyncIterator, next, Object, kNextOffset) ACCESSORS(JSStringIterator, string, String, kStringOffset) SMI_ACCESSORS(JSStringIterator, index, kNextIndexOffset) static inline bool ShouldConvertToSlowElements(JSObject object, uint32_t capacity, uint32_t index, uint32_t* new_capacity) { STATIC_ASSERT(JSObject::kMaxUncheckedOldFastElementsLength <= JSObject::kMaxUncheckedFastElementsLength); if (index < capacity) { *new_capacity = capacity; return false; } if (index - capacity >= JSObject::kMaxGap) return true; *new_capacity = JSObject::NewElementsCapacity(index + 1); DCHECK_LT(index, *new_capacity); // TODO(ulan): Check if it works with young large objects. if (*new_capacity <= JSObject::kMaxUncheckedOldFastElementsLength || (*new_capacity <= JSObject::kMaxUncheckedFastElementsLength && Heap::InYoungGeneration(object))) { return false; } // If the fast-case backing storage takes up much more memory than a // dictionary backing storage would, the object should have slow elements. int used_elements = object->GetFastElementsUsage(); uint32_t size_threshold = NumberDictionary::kPreferFastElementsSizeFactor * NumberDictionary::ComputeCapacity(used_elements) * NumberDictionary::kEntrySize; return size_threshold <= *new_capacity; } } // namespace internal } // namespace v8 #include "src/objects/object-macros-undef.h" #endif // V8_OBJECTS_JS_OBJECTS_INL_H_
[ "commit-bot@chromium.org" ]
commit-bot@chromium.org
f2f469b0ac6e6412aeaa52fe13d09ab54bfdf276
497f9e14784bbf49e4c250ab9d0129465acca309
/src/Calibration.cpp
347bfd402f363ebe746fe9b9cea6a4fb091b8b11
[]
no_license
davidjonas/Painter
72b3b5e0fd91133aa79083f5e205b370d179a15e
dabc95cadba28df15b158adf33227d341635687f
refs/heads/master
2021-01-02T09:28:43.965228
2017-11-14T18:24:44
2017-11-14T18:24:44
99,219,519
0
0
null
null
null
null
UTF-8
C++
false
false
175
cpp
#include "Calibration.h" Calibration::Calibration() { flipX = flipY = flipZ = true; angle = 0; //ofQuaternion qtAdd(-0.122736, 0, 0, 0.992439); //rotation = qtAdd; }
[ "davidjonasdesign@gmail.com" ]
davidjonasdesign@gmail.com
ad8357622c3545b72fc13eabf74f8f6600a8b27b
e0e0d7c929d353ffd903fff0826faec9d4c904e9
/TowerD/TextBox.cpp
f1bb4c6906f1c6b7f26e946cddcf3ff387bdc9bf
[]
no_license
rich98521/FYP
11a06dbb4457849bb9376bbb8f63b8fddda8eee8
d6624d1a1960da1db45a5ab61bdd06eab0b056b1
refs/heads/master
2021-01-21T13:26:34.653989
2016-04-20T20:16:48
2016-04-20T20:16:48
45,685,896
1
0
null
null
null
null
UTF-8
C++
false
false
10,340
cpp
#include "stdafx.h" #include "TextBox.h" //button just containing text TextBox::TextBox(sf::FloatRect r, string text, string value, Renderer* ren, int maxChars) : mRect(r), mValueText(value, "detente.ttf"), mText(text, "detente.ttf"), mRen(ren) { mValueText.setColor(sf::Color(20, 20, 20, 255)); mValueText.setCharacterSize(r.height / 2.f); mMaxChars = maxChars; SetValue(value); mText.setColor(sf::Color(255, 255, 255, 255)); mText.setCharacterSize(r.height / 2.f); mText.setPosition(r.left - mText.getLocalBounds().width - 5, r.top + (r.height - mText.getLocalBounds().height) / 2.f - mText.getLocalBounds().top); mBackground.first.setFillColor(sf::Color(20, 20, 20, 255)); mBackground.first.setPosition(mRect.left, mRect.top); mBackground.first.setSize(sf::Vector2f(mRect.width, mRect.height)); mTextRect = sf::FloatRect(mRect.left + 3, mRect.top + 3, mRect.width - 6, mRect.height - 6); mTextArea.first.setFillColor(sf::Color(255, 255, 255, 255)); mTextArea.first.setSize(sf::Vector2f(mTextRect.width, mTextRect.height)); mTextArea.first.setPosition(mTextRect.left, mTextRect.top); mValueText.setPosition(mTextRect.left + 2, mTextRect.top + (mTextRect.height - mValueText.getLocalBounds().height) / 2.f - mValueText.getLocalBounds().top); mCaretRect = sf::FloatRect(0, mTextRect.top + 2, 2, mTextRect.height - 4); mCaret.first.setFillColor(sf::Color(210, 100, 0, 255)); mCaret.first.setPosition(mCaretRect.left, mCaretRect.top); mCaret.first.setSize(sf::Vector2f(mCaretRect.width, mCaretRect.height)); mHighlight.first.setFillColor(sf::Color(0, 100, 250, 255)); mHighlight.first.setSize(sf::Vector2f(0, mCaretRect.height)); ren->Add(&mBackground); ren->Add(&mTextArea); ren->Add(&mValueText); ren->Add(&mHighlight); ren->Add(&mCaret); ren->Add(&mText); InitBoundary(ren); SetVisible(false); mChanged = false; mString = text; } void TextBox::Offset(float x, float y) { mRect.left += x; mRect.top += y; mValueText.setPosition(mValueText.getPosition() + sf::Vector2f(x, y)); mText.setPosition(mText.getPosition() + sf::Vector2f(x, y)); mBackground.first.setPosition(mBackground.first.getPosition() + sf::Vector2f(x, y)); mTextArea.first.setPosition(mTextArea.first.getPosition() + sf::Vector2f(x, y)); mCaret.first.setPosition(mCaret.first.getPosition() + sf::Vector2f(x, y)); mHighlight.first.setPosition(mHighlight.first.getPosition() + sf::Vector2f(x, y)); for (int i = 0; i < 4; i++) { (*mBoundary[i]).first.setPosition((*mBoundary[i]).first.getPosition() + sf::Vector2f(x, y)); } } string TextBox::GetValue() { return mValue; } bool TextBox::SetValue(string v) { if (v != mValue && v.size() <= mMaxChars) { mCharWidths.clear(); mCharWidths.push_back(0); sf::Text t(mValueText); t.setString(v[0]); for (int i = 0; i < v.size(); i++, t.setString(v.substr(0, i + 1))) mCharWidths.push_back(t.getLocalBounds().width); mValue = v; mValueText.setString(mValue); mChanged = true; return true; } else return false; } sf::FloatRect TextBox::Rect() { return mRect; } bool TextBox::ValueChanged() { bool ans = mChanged; mChanged = false; return ans; } void TextBox::InitBoundary(Renderer* ren) { for (int i = 0; i < 4; i++) { mBoundary.push_back(new std::pair<sf::RectangleShape, bool >); mBoundary[i]->first.setFillColor(sf::Color(120, 120, 120, 255)); ren->Add(mBoundary[i]); } mBoundary[0]->first.setPosition(mRect.left, mRect.top); mBoundary[0]->first.setSize(sf::Vector2f(mRect.width, 1)); mBoundary[1]->first.setPosition(mRect.left, mRect.top + mRect.height - 1); mBoundary[1]->first.setSize(sf::Vector2f(mRect.width, 1)); mBoundary[2]->first.setPosition(mRect.left, mRect.top); mBoundary[2]->first.setSize(sf::Vector2f(1, mRect.height)); mBoundary[3]->first.setPosition(mRect.left + mRect.width - 1, mRect.top); mBoundary[3]->first.setSize(sf::Vector2f(1, mRect.height)); } void TextBox::Offset(sf::Vector2f o) { mRect.left += o.x; mRect.top += o.y; for (int i = 0; i < 4; i++) mBoundary[i]->first.setPosition(mBoundary[i]->first.getPosition() + o); mBackground.first.setPosition(mBackground.first.getPosition() + o); mValueText.setPosition(mValueText.getPosition() + o); mText.setPosition(mText.getPosition() + o); mTextArea.first.setPosition(mTextArea.first.getPosition() + o); mCaret.first.setPosition(mCaret.first.getPosition() + o); mHighlight.first.setPosition(mHighlight.first.getPosition() + o); } //checks if mouse was first down and then up on the button //for button to be clicked void TextBox::Update(sf::Vector2i m, bool down) { if (mVisible) { bool contained = mTextRect.contains(sf::Vector2f(m)); if (mSelected) { if (mBlink.getElapsedTime().asSeconds() > .5f){ mCaret.second = !mCaret.second; mBlink.restart(); } if (down && mDown) { unsigned int i = 0; for (; i < mCharWidths.size(); i++) { int width = mCharWidths[i] + (mCharWidths[min(i + 1, mCharWidths.size() - 1)] - mCharWidths[i]) / 2; if (mValueText.getGlobalBounds().left + width > m.x) break; } i = min(i, mCharWidths.size() - 1); int index = mIndex, length = mSelectLength; if (length < -500) return; length += mIndex - i; index = i; SetSelected(index, length); } } if (down) { if (!contained) { mOut = true; if (!mDown){ mSelected = false; mCaret.second = false; mHighlight.second = false; } } } else mOut = false; if (!mOut) { if (mDown && !down) { if(contained) mSelected = true; else mCaret.second = false; } else if (down && !mDown && contained) { unsigned int i = 0; for (; i < mCharWidths.size(); i++) { int width = mCharWidths[i] + (mCharWidths[min(i + 1, mCharWidths.size() - 1)] - mCharWidths[i]) / 2; if (mValueText.getGlobalBounds().left + width > m.x) break; } int length = 0; SetSelected(i, length); } mDown = down; } } } void toClipboard(const std::string &s){ OpenClipboard(0); EmptyClipboard(); HGLOBAL hg = GlobalAlloc(GMEM_MOVEABLE, s.size()); if (!hg){ CloseClipboard(); return; } memcpy(GlobalLock(hg), s.c_str(), s.size()); GlobalUnlock(hg); SetClipboardData(CF_TEXT, hg); CloseClipboard(); GlobalFree(hg); } std::string fromClipboard() { if (!OpenClipboard(nullptr)) return ""; HANDLE hData = GetClipboardData(CF_TEXT); if (hData == nullptr) return ""; char * pszText = static_cast<char*>(GlobalLock(hData)); if (pszText == nullptr) return ""; std::string text(pszText); GlobalUnlock(hData); CloseClipboard(); return text; } void TextBox::InputKey(sf::Keyboard::Key keyCode, int modifierKeys) { if (mSelected) { int index = mIndex, length = mSelectLength; string value = mValue; string c = ""; int start = mIndex, len = mSelectLength; if (len < 0) { start += len; len *= -1; } if ((mSelectLength != 0 && keyCode < 36 || keyCode == sf::Keyboard::BackSpace || keyCode == sf::Keyboard::Delete) && !(modifierKeys == ModifierKeys::Control && (keyCode == sf::Keyboard::C || keyCode == sf::Keyboard::A))) { value.erase(start, len); length = 0; index = start; } if (keyCode >= 0 && keyCode < 36) { if (modifierKeys == 0){ if (keyCode < 26) c += (char)(65 + keyCode); else c = std::to_string(keyCode - 26); if (value.size() + c.size() <= mMaxChars) index++; else c = ""; } else { if (modifierKeys == ModifierKeys::Control) { if (keyCode == sf::Keyboard::C) { toClipboard(value.substr(start, len) + " "); } else if (keyCode == sf::Keyboard::V) { c = fromClipboard(); if (value.size() + c.size() <= mMaxChars) index += c.size(); else c = ""; } else if (keyCode == sf::Keyboard::A) { index = value.size(); length = value.size(); length *= -1; } } } } else if (keyCode == sf::Keyboard::Space) { c = " "; if (value.size() + c.size() <= mMaxChars) index++; else c = ""; } else if (keyCode == sf::Keyboard::Left) { if (index - 1 >= 0) { index = mIndex - 1; if (modifierKeys == ModifierKeys::Shift) length++; } } else if (keyCode == sf::Keyboard::Right) { if (index + 1 <= mValue.size()) { index = mIndex + 1; if (modifierKeys == ModifierKeys::Shift) length--; } } else if (keyCode == sf::Keyboard::BackSpace) { if (mIndex > 0 && mSelectLength == 0) { value.erase(mIndex - 1, 1); index--; } } else if (keyCode == sf::Keyboard::Delete && mSelectLength == 0) value.erase(mIndex, 1); if (value.size() <= mMaxChars && c != "") value.insert(index - c.size(), c); SetValue(value); SetSelected(index, length); } } void TextBox::SetSelected(int i, int l) { int index = mIndex, length = mSelectLength; mIndex = max(min(i, (int)mValue.size()), 0); mSelectLength = l; if (mIndex != index || mSelectLength != length) { mCaretRect.left = max(mValueText.getGlobalBounds().left + mCharWidths[mIndex] - (mCaretRect.width / 2), mValueText.getGlobalBounds().left); mCaret.first.setPosition(sf::Vector2f(mCaretRect.left, mCaretRect.top)); mCaret.second = true; mHighlight.second = true; mHighlight.first.setPosition(sf::Vector2f(mValueText.getGlobalBounds().left + mCharWidths[mIndex], mCaretRect.top)); int size = 0; if (mSelectLength != 0) { int dir = (mSelectLength / abs(mSelectLength)); for (int i2 = mIndex; i2 != mIndex + mSelectLength; i2 += dir) size += (mCharWidths[min(i2 - ((-dir + 1) / 2) + 1, (int)mCharWidths.size() - 1)] - mCharWidths[i2 - ((-dir + 1) / 2)]) * dir; } mHighlight.first.setSize(sf::Vector2f(size, mCaretRect.height)); mBlink.restart(); } } void TextBox::SetVisible(bool v) { mVisible = v; for each (std::pair<sf::RectangleShape, bool >* s in mBoundary) { s->second = v; } mValueText.SetVisible(v); mText.SetVisible(v); mBackground.second = v; mTextArea.second = v; mCaret.second = v; } string TextBox::GetText() { return mString; } TextBox::~TextBox() { for each(std::pair<sf::RectangleShape, bool >* b in mBoundary) { mRen->Remove(b); delete(b); } mRen->Remove(&mBackground); mRen->Remove(&mTextArea); mRen->Remove(&mCaret); mRen->Remove(&mValueText); mRen->Remove(&mText); }
[ "richie98521@gmail.com" ]
richie98521@gmail.com
77ca718c7e79a844735da4ca3b32e5dc7dd6cff2
bcd30d9e7f89a54c0eff1cf2bb52fbb9c37aa3c7
/lib/IMU/ITG3200.cpp
54e6b558ca08e323e0c4f67b87329c173f9c4e91
[]
no_license
tbhsm/Flight_controller
c93481eef8471f38039b8f46c8ed5b0d175b3be8
61c97e6c576681c26dd07117bfbfb3159f6f2e4b
refs/heads/master
2021-09-25T13:41:31.091284
2018-10-22T18:12:45
2018-10-22T18:12:45
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,321
cpp
#include "ITG3200.h" int ITG3200::initialize(ITG3200ConfigStruct config) { i2c.frequency(400000); // set sample rate and filter frequency buffer[0] = REG_CONFIG; buffer[1] = (FS_SELECT << FS_OFFSET) | SAMPLE_RATE_1KHZ_188; i2c.write(ITG3200_ADDRESS, buffer, 2); // set sample divider buffer[0] = REG_SAMPLE_DIVIDER; buffer[1] = 0x00; i2c.write(ITG3200_ADDRESS, buffer, 2); buffer[0] = REG_POWER_MANAGEMENT; buffer[1] = PLL_GYRO_X << CLOCK_SELECT_OFFSET; a = config.a; b = config.b; c = config.c; return 0; } int ITG3200::read(float *temp, float *roll, float *pitch, float *yaw) { // write register address to device buffer[0] = REG_DATA_X; i2c.write(ITG3200_ADDRESS, buffer, 1, true); // request read from device i2c.read(ITG3200_ADDRESS, buffer, 6); // calculate data from raw readings // *temp = (float)(35 + ((int16_t)((buffer[0]<<8) + buffer[1])+13200.0)/280.0); *roll = (1 - a) * *roll + a * ((float)((int16_t)((buffer[0] << 8) + buffer[1])) / scaleFactor - rollOffset); *pitch = (1 - b) * *pitch + b * ((float)((int16_t)((buffer[2] << 8) + buffer[3])) / scaleFactor - pitchOffset); *yaw = (1 - c) * *yaw + c * ((float)((int16_t)((buffer[4] << 8) + buffer[5])) / scaleFactor - yawOffset); return 0; }
[ "timhosman@hotmail.com" ]
timhosman@hotmail.com
55ac74311286eb68a1d37ac538498d57b8e2efe1
89cc3c6cf2f986214e0da91b456c8676d8797dda
/Strings/Implement StrStr.cpp
42b76c0a25f82733db47262a8cb360d403d36503
[]
no_license
Hemant-Sadana/Competitive-Programming
c3129f684c42614cdd4a3920edcf23e5824a8ab9
7dd9e7fbe60ecbea182ebf1fc1ae9d794644ca5f
refs/heads/master
2022-11-06T18:10:54.541113
2020-06-22T07:45:25
2020-06-22T07:45:25
260,935,641
0
0
null
null
null
null
UTF-8
C++
false
false
887
cpp
int Solution::strStr(const string A, const string B) { int n = A.size(),m = B.size(),flag = 0,i,j; if(m==0) return -1; if(n==0) return 0; /*KMP ALGORITHM*/ vector<int> preprocess(m,0); i = 1;j = 0; while(i<m) { if(B[j] == B[i]) { preprocess[i] = j+1; j++; i++; } else { if(j!=0) { j = preprocess[j-1]; } else { preprocess[i] = 0; i++; } } } i = 0;j = 0; while(i<n && j<m) { if(A[i]==B[j]) { i++;j++; if(j==m) return i-m; } else { if(j!=0) j = preprocess[j-1]; else i++; } } return -1; }
[ "noreply@github.com" ]
Hemant-Sadana.noreply@github.com
a760477cc586bd62990f86660e9477d935014032
7e112d201abfcb60fbc97d1deb7b4cfa402cda40
/src/main.cpp
6d13d46d503f8eb533ce60ee8aa8db9a28e79622
[ "BSD-2-Clause" ]
permissive
panxiaosen/esp32-lora-mqtt
a98f01df2db12accc20917df8e35f06071d6c20e
dc2cb75430aef4e0879c856be512f3821a7799f3
refs/heads/master
2023-03-17T21:22:23.788369
2020-01-22T18:38:53
2020-01-22T20:21:21
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,953
cpp
#include "config.h" #include <heltec.h> #include <AES.h> #include <EEPROM.h> #include <PubSubClient.h> #include <WiFi.h> #include <WiFiMulti.h> #include <esp_system.h> using namespace LoRaGateway; constexpr LoRaNodeID const LORA_GW_ID = 0xffff; static Config config; static WiFiMulti wiFiMulti; static WiFiClient wiFiClient; static PubSubClient pubSubClient(wiFiClient); static size_t counterRecv; static size_t counterSend; static LoRaMessage lastMessage; static AES256 aes256; static void messageReceived(LoRaMessage const& msg); static void buttonPressed(ButtonState state); static void displayInfo(SSD1306Wire* display); void setup() { EEPROM.begin(512); #if 0 EEPROM.put(0, config); EEPROM.commit(); #else EEPROM.get(0, config); if (!config.signatureOK()) { config = Config(); } #endif Heltec.begin(&messageReceived, &buttonPressed, &displayInfo); Serial.println("WiFi configuration: "); for (auto const& cred : config.wifi_credentials) { if (cred.ssid[0] == '\0') { break; } Serial.print(" Adding AP ssid="); Serial.print(cred.ssid); Serial.print(", pass="); Serial.println(cred.password); wiFiMulti.addAP(cred.ssid, cred.password); } pubSubClient.setServer(config.mqtt_broker, config.mqtt_port); aes256.setKey(&config.aes_key[0], sizeof(config.aes_key)); } void loop() { static bool connConfigured = false; if (wiFiMulti.run() == WL_CONNECTED) { if (!connConfigured) { Serial.println(""); Serial.println("WiFi connected"); Serial.println("IP address: "); Serial.println(WiFi.localIP()); connConfigured = true; } if (!pubSubClient.connected()) { if (pubSubClient.connect(config.mqtt_clientid)) { Serial.print("MQTT connected. Publishing to "); Serial.print(config.mqtt_topic); Serial.println("."); } } Heltec.loop(); if (pubSubClient.connected()) { pubSubClient.loop(); } } else { connConfigured = false; Heltec.loop(); } delay(20); } static void messageReceived(LoRaMessage const& msg) { counterRecv++; lastMessage = msg; if (msg.len != LoRaPayload::size()) { Serial.print("Message with length != "); Serial.print(LoRaPayload::size(), DEC); Serial.print(" received: '"); Serial.write(msg.buf, msg.len); Serial.println("'"); if (pubSubClient.connected()) { pubSubClient.publish(config.mqtt_topic_other, &msg.buf[0], msg.len); } return; } uint8_t cleartext[LoRaPayload::size()]; LoRaPayload payload; aes256.decryptBlock(cleartext, &msg.buf[0]); LoRaPayload::fromByteStream(cleartext, sizeof(cleartext), payload); if (!payload.signatureOK()) { if (pubSubClient.connected()) { pubSubClient.publish(config.mqtt_topic_other, &msg.buf[0], msg.len); } Serial.println("Message with incorrect signature received."); return; } if (payload.cmd == GetNonce) { LoRaPayload response(LORA_GW_ID); response.cmd = PutNonce; response.nonce = esp_random(); // TODO: store nonce for given payload->nodeID uint8_t encrypted[LoRaPayload::size()]; uint8_t cleartext[LoRaPayload::size()]; LoRaPayload::toByteStream(cleartext, sizeof(cleartext), response); aes256.encryptBlock(encrypted, cleartext); delay(1000); Serial.print("Sending nonce: "); Serial.println(response.nonce, HEX); Heltec.send(encrypted, sizeof(encrypted)); } else if (payload.cmd == SensorData) { Serial.println("Received sensor data."); String mqttPayload("Node "); // TODO: check whether payload->sensordata.nonce is valid mqttPayload += payload.nodeID; mqttPayload += ": "; mqttPayload += payload.sensordata.value; if (pubSubClient.connected()) { pubSubClient.publish(config.mqtt_topic, mqttPayload.c_str(), mqttPayload.length() + 1); } ::strncpy(reinterpret_cast<char*>(&lastMessage.buf[0]), mqttPayload.c_str(), mqttPayload.length() + 1 /* TODO: check */); // TODO: invalidate nonce } } static void buttonPressed(ButtonState state) { counterSend++; Heltec.send(counterSend); } static void displayInfo(SSD1306Wire* display) { if (counterRecv == 0) { display->drawString(0, 0, "No packet received yet."); } else { display->drawString(0, 0, "Packet " + String(counterRecv, DEC) + ", size " + String(lastMessage.len, DEC) + ":"); display->drawString(0, 10, reinterpret_cast<char const*>(lastMessage.buf)); display->drawString(0, 20, "With RSSI: " + String(lastMessage.rssi, DEC)); } display->drawString(0, 30, pubSubClient.connected() ? "MQTT connected." : "MQTT disconnected."); if (counterSend == 0) { display->drawString(0, 50, "No packet sent yet."); } else { display->drawString(0, 50, "Packet " + String(counterSend, DEC) + " sent done"); } }
[ "rainer.poisel@gmail.com" ]
rainer.poisel@gmail.com
1a393d7de70c5ac0263877338eb12495492be954
e930d82add91242f721caf51a9b8857114b5481d
/src/nimble/app.cpp
6eaa5f9eb2ff51f80c8dfd0c000cc416531d6e9b
[ "MIT" ]
permissive
nimbletools/nimble-app
bc98c26a0018410abda267487487e44e35efb3f5
9d1008f3db46b9e020fe2a76b0722dedf3a97e7b
refs/heads/master
2020-12-07T13:38:52.781676
2017-08-05T14:44:36
2017-08-05T14:44:36
95,582,592
9
1
null
2017-06-28T15:33:51
2017-06-27T17:13:27
C++
UTF-8
C++
false
false
11,743
cpp
#include <nimble/common.h> #include <nimble/app.h> #include <nimble/widgets/rect.h> #include <nimble/widgets/button.h> #include <nimble/widgets/label.h> #include <nimble/widgets/text.h> #include <nimble/utils/ini.h> #include <GL/glew.h> #ifdef __APPLE__ #define GLFW_INCLUDE_GLCOREARB #endif #define GLFW_INCLUDE_GLEXT #include <GLFW/glfw3.h> #include <nanovg.h> #define NANOVG_GL3 #include <nanovg_gl.h> #include <layout.h> static void cursor_position_callback(GLFWwindow* window, double xpos, double ypos) { na::Application* app = (na::Application*)glfwGetWindowUserPointer(window); if (app == nullptr) { return; } app->CallbackCursorPosition(glm::ivec2((int)xpos, (int)ypos)); } static void mouse_button_callback(GLFWwindow* window, int button, int action, int mods) { na::Application* app = (na::Application*)glfwGetWindowUserPointer(window); if (app == nullptr) { return; } app->CallbackMouseButton(button, action, mods); } static void window_size_callback(GLFWwindow* window, int width, int height) { na::Application* app = (na::Application*)glfwGetWindowUserPointer(window); if (app == nullptr) { return; } app->CallbackWindowResized(width, height); } static void framebuffer_size_callback(GLFWwindow* window, int width, int height) { na::Application* app = (na::Application*)glfwGetWindowUserPointer(window); if (app == nullptr) { return; } app->CallbackFramebufferResized(width, height); } static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { na::Application* app = (na::Application*)glfwGetWindowUserPointer(window); if (app == nullptr) { return; } app->CallbackKey(key, scancode, action, mods); } static void char_mods_callback(GLFWwindow* window, unsigned int codepoint, int mods) { na::Application* app = (na::Application*)glfwGetWindowUserPointer(window); if (app == nullptr) { return; } app->CallbackCharMods(codepoint, mods); } na::Application::Application() : Content(this) { m_windowSize = glm::ivec2(1024, 768); InitializeLayout(); //TODO: Move these WidgetFactories.add("rect", [this]() { return new RectWidget(this); }); WidgetFactories.add("hbox", [this]() { RectWidget* ret = new RectWidget(this); ret->SetLayoutDirection(WidgetDirection::Horizontal); return ret; }); WidgetFactories.add("vbox", [this]() { RectWidget* ret = new RectWidget(this); ret->SetLayoutDirection(WidgetDirection::Vertical); return ret; }); WidgetFactories.add("label", [this]() { return new LabelWidget(this); }); WidgetFactories.add("button", [this]() { ButtonWidget* ret = new ButtonWidget(this); ret->SetLayoutAnchor(AnchorFillH); ret->SetSize(glm::ivec2(0, 26)); return ret; }); WidgetFactories.add("text", [this]() { return new TextWidget(this); }); } na::Application::~Application() { CleanupLayout(); CleanupRendering(); } void na::Application::Run() { InitializeRendering(); InitializeWindow(); OnLoad(); while (!glfwWindowShouldClose(m_window)) { Frame(); if (IsInvalidated()) { glfwPollEvents(); } else { glfwWaitEvents(); // interrupt using glfwPostEmptyEvent } } } void na::Application::DoLayout() { static int _layoutCount = 0; printf("Layout %d\n", _layoutCount++); float pixelScale = GetPixelScale(); lay_reset_context(m_layout); lay_id root = lay_item(m_layout); lay_set_size_xy(m_layout, root, (lay_scalar)(m_bufferSize.x / pixelScale), (lay_scalar)(m_bufferSize.y / pixelScale)); for (int i = m_pages.len() - 1; i >= 0; i--) { PageWidget* page = m_pages[i]; page->DoLayout(m_layout, root); if (!page->DrawBehind() && !page->InputBehind()) { break; } } lay_run_context(m_layout); } void na::Application::Draw() { static int _renderCount = 0; printf("Render %d\n", _renderCount++); glClear(GL_COLOR_BUFFER_BIT); glViewport(0, 0, m_bufferSize.x, m_bufferSize.y); nvgBeginFrame(m_nvg, m_bufferSize.x, m_bufferSize.y, 1.0f); float pixelScale = GetPixelScale(); nvgScale(m_nvg, pixelScale, pixelScale); int pageStartIndex = m_pages.len() - 1; for (; pageStartIndex > 0; pageStartIndex--) { if (!m_pages[pageStartIndex]->DrawBehind()) { break; } } if (pageStartIndex >= 0) { for (int i = pageStartIndex; i < (int)m_pages.len(); i++) { PageWidget* page = m_pages[i]; page->Draw(m_nvg); } } nvgEndFrame(m_nvg); glfwSwapBuffers(m_window); } void na::Application::UpdateCursor() { if (m_hoveringWidgets.len() == 0) { m_currentCursor = Cursor::Arrow; glfwSetCursor(m_window, nullptr); return; } Cursor cursor = m_hoveringWidgets.top()->GetCursor(); if (m_currentCursor == cursor) { return; } GLFWcursor* p = nullptr; switch (cursor) { case Cursor::Arrow: p = m_cursorArrow; break; case Cursor::Ibeam: p = m_cursorIbeam; break; case Cursor::Crosshair: p = m_cursorCrosshair; break; case Cursor::Hand: p = m_cursorHand; break; case Cursor::HResize: p = m_cursorHResize; break; case Cursor::VResize: p = m_cursorVResize; break; } m_currentCursor = cursor; glfwSetCursor(m_window, p); } void na::Application::Frame() { HandlePageQueue(); if (m_invalidatedLayout) { m_invalidatedLayout = false; DoLayout(); m_invalidatedRendering = true; } if (m_invalidatedRendering) { m_invalidatedRendering = false; Draw(); } if (m_invalidatedCursor) { m_invalidatedCursor = false; UpdateCursor(); } } void na::Application::OnLoad() { } void na::Application::SetWindowSize(const glm::ivec2 &size) { if (m_windowSize != size) { InvalidateLayout(); } m_windowSize = size; glfwSetWindowSize(m_window, size.x, size.y); glfwGetFramebufferSize(m_window, &m_bufferSize.x, &m_bufferSize.y); } float na::Application::GetPixelScale() { return m_bufferSize.x / (float)m_windowSize.x; } void na::Application::HandlePageQueue() { for (PageAction &pa : m_pageQueue) { if (pa.m_type == PageActionType::Push) { InvalidateInputWidgets(); m_pages.push() = pa.m_page; InvalidateLayout(); } else if (pa.m_type == PageActionType::Pop) { InvalidateInputWidgets(); delete m_pages.pop(); InvalidateLayout(); } } m_pageQueue.clear(); } void na::Application::PushPage(PageWidget* page) { m_pageQueue.add(PageAction(PageActionType::Push, page)); } void na::Application::PopPage() { if (m_pages.len() == 1) { printf("Can't pop page if there is only 1 page left!\n"); return; } m_pageQueue.add(PageAction(PageActionType::Pop)); } bool na::Application::IsInvalidated() { return m_invalidatedLayout || m_invalidatedRendering; } void na::Application::InvalidateLayout() { m_invalidatedLayout = true; } void na::Application::InvalidateRendering() { m_invalidatedRendering = true; } void na::Application::InvalidateCursor() { m_invalidatedCursor = true; } void na::Application::HandleHoverWidgets(Widget* w, const glm::ivec2 &point) { if (!w->Contains(point)) { return; } if (!w->IsHovering()) { InvalidateCursor(); m_hoveringWidgets.add(w); w->OnMouseEnter(); } for (Widget* child : w->GetChildren()) { HandleHoverWidgets(child, point); } } void na::Application::InvalidateInputWidgets() { for (auto w : m_hoveringWidgets) { w->OnMouseLeave(); } m_hoveringWidgets.clear(); InvalidateCursor(); SetFocusWidget(nullptr); } void na::Application::SetFocusWidget(Widget* w) { Widget* focusBefore = m_focusWidget; m_focusWidget = w; if (focusBefore != nullptr) { focusBefore->OnFocusLost(); } if (w != nullptr) { w->OnFocus(); } } void na::Application::CallbackCursorPosition(const glm::ivec2 &point) { m_lastCursorPos = point; for (int i = (int)m_hoveringWidgets.len() - 1; i >= 0; i--) { Widget* w = m_hoveringWidgets[i]; if (!w->IsHovering() || w->Contains(point)) { w->OnMouseMove(w->ToRelativePoint(point)); continue; } w->OnMouseLeave(); m_hoveringWidgets.remove(i); InvalidateCursor(); } for (int i = m_pages.len() - 1; i >= 0; i--) { PageWidget* page = m_pages[i]; HandleHoverWidgets(page, point); if (!page->InputBehind()) { break; } } } void na::Application::CallbackMouseButton(int button, int action, int mods) { if (m_hoveringWidgets.len() == 0) { return; } Widget* w = m_hoveringWidgets.top(); if (action == GLFW_PRESS) { w->OnMouseDown(button, w->ToRelativePoint(m_lastCursorPos)); if (w->CanHaveFocus()) { if (!w->HasFocus()) { SetFocusWidget(w); } } else { SetFocusWidget(nullptr); } } else if (action == GLFW_RELEASE) { w->OnMouseUp(button, w->ToRelativePoint(m_lastCursorPos)); } } void na::Application::CallbackWindowResized(int width, int height) { InvalidateLayout(); m_windowSize = glm::ivec2(width, height); } void na::Application::CallbackFramebufferResized(int width, int height) { if (m_bufferSize.x == width && m_bufferSize.y == height) { return; } InvalidateLayout(); m_bufferSize = glm::ivec2(width, height); } void na::Application::CallbackKey(int key, int scancode, int action, int mods) { if (m_focusWidget == nullptr) { return; } if (action == GLFW_PRESS) { m_focusWidget->OnKeyDown(key, scancode, mods); m_focusWidget->OnKeyPress(key, scancode, mods); } else if (action == GLFW_REPEAT) { m_focusWidget->OnKeyPress(key, scancode, mods); } else if (action == GLFW_RELEASE) { m_focusWidget->OnKeyUp(key, scancode, mods); } } void na::Application::CallbackCharMods(unsigned int ch, int mods) { if (m_focusWidget != nullptr) { m_focusWidget->OnChar(ch, mods); } } void na::Application::InitializeLayout() { m_layout = new lay_context; lay_init_context(m_layout); m_initializedLayout = true; } void na::Application::InitializeRendering() { if (!glfwInit()) { printf("Glfw failed\n"); return; } glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_SAMPLES, 4); m_initializedRendering = true; } void na::Application::InitializeWindow() { m_window = glfwCreateWindow(m_windowSize.x, m_windowSize.y, "Nimble App", nullptr, nullptr); if (m_window == nullptr) { printf("No window\n"); CleanupRendering(); return; } glfwGetFramebufferSize(m_window, &m_bufferSize.x, &m_bufferSize.y); glfwSetWindowUserPointer(m_window, this); glfwSetCursorPosCallback(m_window, cursor_position_callback); glfwSetMouseButtonCallback(m_window, mouse_button_callback); glfwSetWindowSizeCallback(m_window, window_size_callback); glfwSetFramebufferSizeCallback(m_window, framebuffer_size_callback); glfwSetKeyCallback(m_window, key_callback); glfwSetCharModsCallback(m_window, char_mods_callback); glfwMakeContextCurrent(m_window); m_cursorArrow = glfwCreateStandardCursor(GLFW_ARROW_CURSOR); m_cursorIbeam = glfwCreateStandardCursor(GLFW_IBEAM_CURSOR); m_cursorCrosshair = glfwCreateStandardCursor(GLFW_CROSSHAIR_CURSOR); m_cursorHand = glfwCreateStandardCursor(GLFW_HAND_CURSOR); m_cursorHResize = glfwCreateStandardCursor(GLFW_HRESIZE_CURSOR); m_cursorVResize = glfwCreateStandardCursor(GLFW_VRESIZE_CURSOR); glewExperimental = GL_TRUE; if (glewInit() != GLEW_OK) { printf("Glew failed\n"); CleanupRendering(); return; } glGetError(); m_nvg = nvgCreateGL3(/*NVG_ANTIALIAS | */NVG_STENCIL_STROKES); if (m_nvg == nullptr) { printf("Nvg failed\n"); CleanupRendering(); return; } m_initializedWindow = true; } void na::Application::CleanupLayout() { if (!m_initializedLayout) { return; } lay_destroy_context(m_layout); delete m_layout; m_layout = nullptr; m_initializedLayout = false; } void na::Application::CleanupRendering() { if (!m_initializedRendering) { return; } glfwTerminate(); m_initializedRendering = false; m_initializedWindow = false; }
[ "spansjh@gmail.com" ]
spansjh@gmail.com
ee39d1b71c1862b873e28c06d8019ab33ec8ea41
a5c0ecb91a259adf14cc803346497bb305bf47ed
/include/experimental/__p1673_bits/blas1_linalg_add.hpp
97d95b8190c300462cc1c1e44873eaafcbe7315c
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
bdhss/stdBLAS
23d791525631b1068a4f51f1f97142de931d1b63
d3a45e34efa041b165404b5ec9c5337816e8477f
refs/heads/main
2022-10-31T04:13:50.951849
2020-06-19T00:16:25
2020-06-19T00:16:25
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,846
hpp
/* //@HEADER // ************************************************************************ // // Kokkos v. 2.0 // Copyright (2019) Sandia Corporation // // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, // the U.S. Government retains certain rights in this software. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // 1. Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // 3. Neither the name of the Corporation nor the names of the // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Questions? Contact Christian R. Trott (crtrott@sandia.gov) // // ************************************************************************ //@HEADER */ #ifndef LINALG_INCLUDE_EXPERIMENTAL___P1673_BITS_BLAS1_LINALG_ADD_HPP_ #define LINALG_INCLUDE_EXPERIMENTAL___P1673_BITS_BLAS1_LINALG_ADD_HPP_ namespace std { namespace experimental { inline namespace __p1673_version_0 { namespace { template<class in_vector_1_t, class in_vector_2_t, class out_vector_t> void linalg_add_rank_1(in_vector_1_t x, in_vector_2_t y, out_vector_t z) { for (ptrdiff_t i = 0; i < z.extent(0); ++i) { z(i) = x(i) + y(i); } } template<class in_matrix_1_t, class in_matrix_2_t, class out_matrix_t> void linalg_add_rank_2(in_matrix_1_t x, in_matrix_2_t y, out_matrix_t z) { for (ptrdiff_t j = 0; j < x.extent(1); ++j) { for (ptrdiff_t i = 0; i < x.extent(0); ++i) { z(i,j) = x(i,j) + y(i,j); } } } // TODO add mdarray specializations; needed so that out_*_t is // not passed by value (which would be wrong for a container type like // mdarray). } template<class in_object_1_t, class in_object_2_t, class out_object_t> void linalg_add(in_object_1_t x, in_object_2_t y, out_object_t z) { if constexpr (z.rank() == 1) { linalg_add_rank_1 (x, y, z); } else if constexpr (z.rank() == 2) { linalg_add_rank_2 (x, y, z); } else { static_assert("Not implemented"); } } template<class ExecutionPolicy, class in_object_1_t, class in_object_2_t, class out_object_t> void linalg_add(ExecutionPolicy&& /* exec */, in_object_1_t x, in_object_2_t y, out_object_t z) { linalg_add(x, y, z); } } // end inline namespace __p1673_version_0 } // end namespace experimental } // end namespace std #endif //LINALG_INCLUDE_EXPERIMENTAL___P1673_BITS_BLAS1_LINALG_ADD_HPP_
[ "mhoemme@sandia.gov" ]
mhoemme@sandia.gov
aa8500cfc0702e3bf1b2a0a1678f6e8d6b02ee25
6eb7f67e2d69a1adf45b123fd7d2e8f8ee3058b7
/src/lib/geogram/delaunay/periodic.h
66dafb68eb35af20cf74f99f011536cacfc83269
[ "BSD-3-Clause" ]
permissive
nyorem/geogram
e779a1e574cff2ac1796ebf7569315dceb57ba33
1bd64a158101626cf7ce7c04153f48c45b245f17
refs/heads/main
2022-11-24T12:41:42.234938
2022-11-17T21:37:55
2022-11-17T21:37:55
567,473,547
0
0
NOASSERTION
2022-11-17T21:40:38
2022-11-17T21:40:37
null
UTF-8
C++
false
false
6,361
h
/* * Copyright (c) 2000-2022 Inria * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of the ALICE Project-Team nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * Contact: Bruno Levy * * https://www.inria.fr/fr/bruno-levy * * Inria, * Domaine de Voluceau, * 78150 Le Chesnay - Rocquencourt * FRANCE * */ #ifndef GEOGRAM_DELAUNAY_PERIODIC #define GEOGRAM_DELAUNAY_PERIODIC #include <geogram/basic/common.h> #include <geogram/basic/string.h> #include <geogram/basic/assert.h> /** * \file geogram/delaunay/periodic.h * \brief Manipulation of indices for 3D periodic space. */ namespace GEO { /** * \brief Utilities for managing 3D periodic space. */ class GEOGRAM_API Periodic { public: /** * \brief Gets the instance from a periodic vertex. * \return the instance in 0..26 */ index_t periodic_vertex_instance(index_t pv) const { geo_debug_assert(pv < nb_vertices_non_periodic_ * 27); return pv / nb_vertices_non_periodic_; } /** * \brief Gets the real vertex from a periodic vertex. * \return the real vertex, in 0..nb_vertices_non_periodic_-1 */ index_t periodic_vertex_real(index_t pv) const { geo_debug_assert(pv < nb_vertices_non_periodic_ * 27); return pv % nb_vertices_non_periodic_; } /** * \brief Gets the real vertex from a periodic vertex. * \return the real vertex, in 0..nb_vertices_non_periodic_-1 */ signed_index_t periodic_vertex_real(signed_index_t pv) const { geo_debug_assert(pv < signed_index_t(nb_vertices_non_periodic_ * 27)); geo_debug_assert(pv != -1); return pv % signed_index_t(nb_vertices_non_periodic_); } /** * \brief Makes a periodic vertex from a real vertex and instance. * \param[in] real the real vertex, in 0..nb_vertices_non_periodic_-1 * \param[in] instance the instance, in 0..26 */ index_t make_periodic_vertex(index_t real, index_t instance) const { geo_debug_assert(real < nb_vertices_non_periodic_); geo_debug_assert(instance < 27); return real + nb_vertices_non_periodic_*instance; } /** * \brief Gets the instance from a translation. * \param[in] Tx , Ty , Tz the translation coordinates, in {-1, 0, 1} * \return the instance, in 0..26 */ static index_t T_to_instance(int Tx, int Ty, int Tz) { geo_debug_assert(Tx >= -1 && Tx <= 1); geo_debug_assert(Ty >= -1 && Ty <= 1); geo_debug_assert(Tz >= -1 && Tz <= 1); int i = (Tz+1) + 3*(Ty+1) + 9*(Tx+1); geo_debug_assert(i >= 0 && i < 27); return index_t(reorder_instances[i]); } /** * \brief Gets the translation from a periodic vertex. * \param[in] pv the periodic vertex * \param[out] Tx , Ty , Tz the translation coordinates, in {-1, 0, 1} */ void periodic_vertex_get_T(index_t pv, int& Tx, int& Ty, int& Tz) const { geo_debug_assert(pv < nb_vertices_non_periodic_ * 27); index_t instance = periodic_vertex_instance(pv); Tx = translation[instance][0]; Ty = translation[instance][1]; Tz = translation[instance][2]; } /** * \brief Sets the translation in a periodic vertex. * \param[in,out] pv the periodic vertex * \param[in] Tx , Ty , Tz the translation coordinates, in {-1, 0, 1} */ void periodic_vertex_set_T(index_t& pv, int Tx, int Ty, int Tz) const { geo_debug_assert(pv < nb_vertices_non_periodic_ * 27); geo_debug_assert(Tx >= -1 && Tx <= 1); geo_debug_assert(Ty >= -1 && Ty <= 1); geo_debug_assert(Tz >= -1 && Tz <= 1); pv = make_periodic_vertex( periodic_vertex_real(pv), T_to_instance(Tx, Ty, Tz) ); } std::string periodic_vertex_to_string(index_t v) const { return String::to_string(periodic_vertex_real(v)) + ":" + String::to_string(periodic_vertex_instance(v)) ; } std::string binary_to_string(index_t m) const { std::string s(32,' '); for(index_t i=0; i<32; ++i) { s[i] = ((m & (1u << (31u-i))) != 0) ? '1' : '0'; } return s; } /** * \brief Gives for each instance the integer translation coordinates * in {-1,0,1}. * \details The zero translation is the first one (instance 0). */ static int translation[27][3]; /** * \brief Used to back-map an integer translation to an instance. * \details This maps (Tx+1) + 3*(Ty+1) + 9*(Tz+1) to the associated * instance id. This indirection is required because we wanted * instance 0 to correspond to the 0 translation * (rather than (-1,-1,-1) that would require no indirection). */ static int reorder_instances[27]; /** * \brief Tests whether all the coordinates of the translation vector * associated with an instance are 0 or 1. */ static bool instance_is_positive[27]; /** * \brief Number of real vertices. */ index_t nb_vertices_non_periodic_; }; } #endif
[ "Bruno.Levy@inria.fr" ]
Bruno.Levy@inria.fr
38fb8fc78520a24e707b592a5560fa98b7d313bc
b11c1346faff5041bf94d300e821448fbe2a18f2
/01HelloWinRT/Debug/Generated Files/winrt/Windows.Gaming.Input.ForceFeedback.h
ce33b3d0719e5f0efe308f7ae0580dfcf9aafbc5
[]
no_license
ShiverZm/CxxWinRT_Learn
72fb11742e992d1f60b86a0eab558ee2f244d8f1
66d1ec85500c5c8750f826ed1b6a2199f7b72bbe
refs/heads/main
2023-01-19T12:09:59.872143
2020-11-29T16:15:54
2020-11-29T16:15:54
316,984,477
0
0
null
null
null
null
UTF-8
C++
false
false
30,351
h
// WARNING: Please don't edit this file. It was generated by C++/WinRT v2.0.190404.8 #ifndef WINRT_Windows_Gaming_Input_ForceFeedback_H #define WINRT_Windows_Gaming_Input_ForceFeedback_H #include "winrt/base.h" static_assert(winrt::check_version(CPPWINRT_VERSION, "2.0.190404.8"), "Mismatched C++/WinRT headers."); #include "winrt/Windows.Gaming.Input.h" #include "winrt/impl/Windows.Foundation.2.h" #include "winrt/impl/Windows.Foundation.Numerics.2.h" #include "winrt/impl/Windows.Gaming.Input.ForceFeedback.2.h" namespace winrt::impl { template <typename D> Windows::Gaming::Input::ForceFeedback::ConditionForceEffectKind consume_Windows_Gaming_Input_ForceFeedback_IConditionForceEffect<D>::Kind() const { Windows::Gaming::Input::ForceFeedback::ConditionForceEffectKind value; check_hresult(WINRT_SHIM(Windows::Gaming::Input::ForceFeedback::IConditionForceEffect)->get_Kind(put_abi(value))); return value; } template <typename D> void consume_Windows_Gaming_Input_ForceFeedback_IConditionForceEffect<D>::SetParameters(Windows::Foundation::Numerics::float3 const& direction, float positiveCoefficient, float negativeCoefficient, float maxPositiveMagnitude, float maxNegativeMagnitude, float deadZone, float bias) const { check_hresult(WINRT_SHIM(Windows::Gaming::Input::ForceFeedback::IConditionForceEffect)->SetParameters(get_abi(direction), positiveCoefficient, negativeCoefficient, maxPositiveMagnitude, maxNegativeMagnitude, deadZone, bias)); } template <typename D> Windows::Gaming::Input::ForceFeedback::ConditionForceEffect consume_Windows_Gaming_Input_ForceFeedback_IConditionForceEffectFactory<D>::CreateInstance(Windows::Gaming::Input::ForceFeedback::ConditionForceEffectKind const& effectKind) const { void* value{}; check_hresult(WINRT_SHIM(Windows::Gaming::Input::ForceFeedback::IConditionForceEffectFactory)->CreateInstance(get_abi(effectKind), &value)); return { value, take_ownership_from_abi }; } template <typename D> void consume_Windows_Gaming_Input_ForceFeedback_IConstantForceEffect<D>::SetParameters(Windows::Foundation::Numerics::float3 const& vector, Windows::Foundation::TimeSpan const& duration) const { check_hresult(WINRT_SHIM(Windows::Gaming::Input::ForceFeedback::IConstantForceEffect)->SetParameters(get_abi(vector), get_abi(duration))); } template <typename D> void consume_Windows_Gaming_Input_ForceFeedback_IConstantForceEffect<D>::SetParametersWithEnvelope(Windows::Foundation::Numerics::float3 const& vector, float attackGain, float sustainGain, float releaseGain, Windows::Foundation::TimeSpan const& startDelay, Windows::Foundation::TimeSpan const& attackDuration, Windows::Foundation::TimeSpan const& sustainDuration, Windows::Foundation::TimeSpan const& releaseDuration, uint32_t repeatCount) const { check_hresult(WINRT_SHIM(Windows::Gaming::Input::ForceFeedback::IConstantForceEffect)->SetParametersWithEnvelope(get_abi(vector), attackGain, sustainGain, releaseGain, get_abi(startDelay), get_abi(attackDuration), get_abi(sustainDuration), get_abi(releaseDuration), repeatCount)); } template <typename D> double consume_Windows_Gaming_Input_ForceFeedback_IForceFeedbackEffect<D>::Gain() const { double value; check_hresult(WINRT_SHIM(Windows::Gaming::Input::ForceFeedback::IForceFeedbackEffect)->get_Gain(&value)); return value; } template <typename D> void consume_Windows_Gaming_Input_ForceFeedback_IForceFeedbackEffect<D>::Gain(double value) const { check_hresult(WINRT_SHIM(Windows::Gaming::Input::ForceFeedback::IForceFeedbackEffect)->put_Gain(value)); } template <typename D> Windows::Gaming::Input::ForceFeedback::ForceFeedbackEffectState consume_Windows_Gaming_Input_ForceFeedback_IForceFeedbackEffect<D>::State() const { Windows::Gaming::Input::ForceFeedback::ForceFeedbackEffectState value; check_hresult(WINRT_SHIM(Windows::Gaming::Input::ForceFeedback::IForceFeedbackEffect)->get_State(put_abi(value))); return value; } template <typename D> void consume_Windows_Gaming_Input_ForceFeedback_IForceFeedbackEffect<D>::Start() const { check_hresult(WINRT_SHIM(Windows::Gaming::Input::ForceFeedback::IForceFeedbackEffect)->Start()); } template <typename D> void consume_Windows_Gaming_Input_ForceFeedback_IForceFeedbackEffect<D>::Stop() const { check_hresult(WINRT_SHIM(Windows::Gaming::Input::ForceFeedback::IForceFeedbackEffect)->Stop()); } template <typename D> bool consume_Windows_Gaming_Input_ForceFeedback_IForceFeedbackMotor<D>::AreEffectsPaused() const { bool value; check_hresult(WINRT_SHIM(Windows::Gaming::Input::ForceFeedback::IForceFeedbackMotor)->get_AreEffectsPaused(&value)); return value; } template <typename D> double consume_Windows_Gaming_Input_ForceFeedback_IForceFeedbackMotor<D>::MasterGain() const { double value; check_hresult(WINRT_SHIM(Windows::Gaming::Input::ForceFeedback::IForceFeedbackMotor)->get_MasterGain(&value)); return value; } template <typename D> void consume_Windows_Gaming_Input_ForceFeedback_IForceFeedbackMotor<D>::MasterGain(double value) const { check_hresult(WINRT_SHIM(Windows::Gaming::Input::ForceFeedback::IForceFeedbackMotor)->put_MasterGain(value)); } template <typename D> bool consume_Windows_Gaming_Input_ForceFeedback_IForceFeedbackMotor<D>::IsEnabled() const { bool value; check_hresult(WINRT_SHIM(Windows::Gaming::Input::ForceFeedback::IForceFeedbackMotor)->get_IsEnabled(&value)); return value; } template <typename D> Windows::Gaming::Input::ForceFeedback::ForceFeedbackEffectAxes consume_Windows_Gaming_Input_ForceFeedback_IForceFeedbackMotor<D>::SupportedAxes() const { Windows::Gaming::Input::ForceFeedback::ForceFeedbackEffectAxes value; check_hresult(WINRT_SHIM(Windows::Gaming::Input::ForceFeedback::IForceFeedbackMotor)->get_SupportedAxes(put_abi(value))); return value; } template <typename D> Windows::Foundation::IAsyncOperation<Windows::Gaming::Input::ForceFeedback::ForceFeedbackLoadEffectResult> consume_Windows_Gaming_Input_ForceFeedback_IForceFeedbackMotor<D>::LoadEffectAsync(Windows::Gaming::Input::ForceFeedback::IForceFeedbackEffect const& effect) const { void* asyncOperation{}; check_hresult(WINRT_SHIM(Windows::Gaming::Input::ForceFeedback::IForceFeedbackMotor)->LoadEffectAsync(get_abi(effect), &asyncOperation)); return { asyncOperation, take_ownership_from_abi }; } template <typename D> void consume_Windows_Gaming_Input_ForceFeedback_IForceFeedbackMotor<D>::PauseAllEffects() const { check_hresult(WINRT_SHIM(Windows::Gaming::Input::ForceFeedback::IForceFeedbackMotor)->PauseAllEffects()); } template <typename D> void consume_Windows_Gaming_Input_ForceFeedback_IForceFeedbackMotor<D>::ResumeAllEffects() const { check_hresult(WINRT_SHIM(Windows::Gaming::Input::ForceFeedback::IForceFeedbackMotor)->ResumeAllEffects()); } template <typename D> void consume_Windows_Gaming_Input_ForceFeedback_IForceFeedbackMotor<D>::StopAllEffects() const { check_hresult(WINRT_SHIM(Windows::Gaming::Input::ForceFeedback::IForceFeedbackMotor)->StopAllEffects()); } template <typename D> Windows::Foundation::IAsyncOperation<bool> consume_Windows_Gaming_Input_ForceFeedback_IForceFeedbackMotor<D>::TryDisableAsync() const { void* asyncOperation{}; check_hresult(WINRT_SHIM(Windows::Gaming::Input::ForceFeedback::IForceFeedbackMotor)->TryDisableAsync(&asyncOperation)); return { asyncOperation, take_ownership_from_abi }; } template <typename D> Windows::Foundation::IAsyncOperation<bool> consume_Windows_Gaming_Input_ForceFeedback_IForceFeedbackMotor<D>::TryEnableAsync() const { void* asyncOperation{}; check_hresult(WINRT_SHIM(Windows::Gaming::Input::ForceFeedback::IForceFeedbackMotor)->TryEnableAsync(&asyncOperation)); return { asyncOperation, take_ownership_from_abi }; } template <typename D> Windows::Foundation::IAsyncOperation<bool> consume_Windows_Gaming_Input_ForceFeedback_IForceFeedbackMotor<D>::TryResetAsync() const { void* asyncOperation{}; check_hresult(WINRT_SHIM(Windows::Gaming::Input::ForceFeedback::IForceFeedbackMotor)->TryResetAsync(&asyncOperation)); return { asyncOperation, take_ownership_from_abi }; } template <typename D> Windows::Foundation::IAsyncOperation<bool> consume_Windows_Gaming_Input_ForceFeedback_IForceFeedbackMotor<D>::TryUnloadEffectAsync(Windows::Gaming::Input::ForceFeedback::IForceFeedbackEffect const& effect) const { void* asyncOperation{}; check_hresult(WINRT_SHIM(Windows::Gaming::Input::ForceFeedback::IForceFeedbackMotor)->TryUnloadEffectAsync(get_abi(effect), &asyncOperation)); return { asyncOperation, take_ownership_from_abi }; } template <typename D> Windows::Gaming::Input::ForceFeedback::PeriodicForceEffectKind consume_Windows_Gaming_Input_ForceFeedback_IPeriodicForceEffect<D>::Kind() const { Windows::Gaming::Input::ForceFeedback::PeriodicForceEffectKind value; check_hresult(WINRT_SHIM(Windows::Gaming::Input::ForceFeedback::IPeriodicForceEffect)->get_Kind(put_abi(value))); return value; } template <typename D> void consume_Windows_Gaming_Input_ForceFeedback_IPeriodicForceEffect<D>::SetParameters(Windows::Foundation::Numerics::float3 const& vector, float frequency, float phase, float bias, Windows::Foundation::TimeSpan const& duration) const { check_hresult(WINRT_SHIM(Windows::Gaming::Input::ForceFeedback::IPeriodicForceEffect)->SetParameters(get_abi(vector), frequency, phase, bias, get_abi(duration))); } template <typename D> void consume_Windows_Gaming_Input_ForceFeedback_IPeriodicForceEffect<D>::SetParametersWithEnvelope(Windows::Foundation::Numerics::float3 const& vector, float frequency, float phase, float bias, float attackGain, float sustainGain, float releaseGain, Windows::Foundation::TimeSpan const& startDelay, Windows::Foundation::TimeSpan const& attackDuration, Windows::Foundation::TimeSpan const& sustainDuration, Windows::Foundation::TimeSpan const& releaseDuration, uint32_t repeatCount) const { check_hresult(WINRT_SHIM(Windows::Gaming::Input::ForceFeedback::IPeriodicForceEffect)->SetParametersWithEnvelope(get_abi(vector), frequency, phase, bias, attackGain, sustainGain, releaseGain, get_abi(startDelay), get_abi(attackDuration), get_abi(sustainDuration), get_abi(releaseDuration), repeatCount)); } template <typename D> Windows::Gaming::Input::ForceFeedback::PeriodicForceEffect consume_Windows_Gaming_Input_ForceFeedback_IPeriodicForceEffectFactory<D>::CreateInstance(Windows::Gaming::Input::ForceFeedback::PeriodicForceEffectKind const& effectKind) const { void* value{}; check_hresult(WINRT_SHIM(Windows::Gaming::Input::ForceFeedback::IPeriodicForceEffectFactory)->CreateInstance(get_abi(effectKind), &value)); return { value, take_ownership_from_abi }; } template <typename D> void consume_Windows_Gaming_Input_ForceFeedback_IRampForceEffect<D>::SetParameters(Windows::Foundation::Numerics::float3 const& startVector, Windows::Foundation::Numerics::float3 const& endVector, Windows::Foundation::TimeSpan const& duration) const { check_hresult(WINRT_SHIM(Windows::Gaming::Input::ForceFeedback::IRampForceEffect)->SetParameters(get_abi(startVector), get_abi(endVector), get_abi(duration))); } template <typename D> void consume_Windows_Gaming_Input_ForceFeedback_IRampForceEffect<D>::SetParametersWithEnvelope(Windows::Foundation::Numerics::float3 const& startVector, Windows::Foundation::Numerics::float3 const& endVector, float attackGain, float sustainGain, float releaseGain, Windows::Foundation::TimeSpan const& startDelay, Windows::Foundation::TimeSpan const& attackDuration, Windows::Foundation::TimeSpan const& sustainDuration, Windows::Foundation::TimeSpan const& releaseDuration, uint32_t repeatCount) const { check_hresult(WINRT_SHIM(Windows::Gaming::Input::ForceFeedback::IRampForceEffect)->SetParametersWithEnvelope(get_abi(startVector), get_abi(endVector), attackGain, sustainGain, releaseGain, get_abi(startDelay), get_abi(attackDuration), get_abi(sustainDuration), get_abi(releaseDuration), repeatCount)); } template <typename D> struct produce<D, Windows::Gaming::Input::ForceFeedback::IConditionForceEffect> : produce_base<D, Windows::Gaming::Input::ForceFeedback::IConditionForceEffect> { int32_t WINRT_CALL get_Kind(int32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from<Windows::Gaming::Input::ForceFeedback::ConditionForceEffectKind>(this->shim().Kind()); return 0; } catch (...) { return to_hresult(); } int32_t WINRT_CALL SetParameters(Windows::Foundation::Numerics::float3 direction, float positiveCoefficient, float negativeCoefficient, float maxPositiveMagnitude, float maxNegativeMagnitude, float deadZone, float bias) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().SetParameters(*reinterpret_cast<Windows::Foundation::Numerics::float3 const*>(&direction), positiveCoefficient, negativeCoefficient, maxPositiveMagnitude, maxNegativeMagnitude, deadZone, bias); return 0; } catch (...) { return to_hresult(); } }; template <typename D> struct produce<D, Windows::Gaming::Input::ForceFeedback::IConditionForceEffectFactory> : produce_base<D, Windows::Gaming::Input::ForceFeedback::IConditionForceEffectFactory> { int32_t WINRT_CALL CreateInstance(int32_t effectKind, void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from<Windows::Gaming::Input::ForceFeedback::ConditionForceEffect>(this->shim().CreateInstance(*reinterpret_cast<Windows::Gaming::Input::ForceFeedback::ConditionForceEffectKind const*>(&effectKind))); return 0; } catch (...) { return to_hresult(); } }; template <typename D> struct produce<D, Windows::Gaming::Input::ForceFeedback::IConstantForceEffect> : produce_base<D, Windows::Gaming::Input::ForceFeedback::IConstantForceEffect> { int32_t WINRT_CALL SetParameters(Windows::Foundation::Numerics::float3 vector, int64_t duration) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().SetParameters(*reinterpret_cast<Windows::Foundation::Numerics::float3 const*>(&vector), *reinterpret_cast<Windows::Foundation::TimeSpan const*>(&duration)); return 0; } catch (...) { return to_hresult(); } int32_t WINRT_CALL SetParametersWithEnvelope(Windows::Foundation::Numerics::float3 vector, float attackGain, float sustainGain, float releaseGain, int64_t startDelay, int64_t attackDuration, int64_t sustainDuration, int64_t releaseDuration, uint32_t repeatCount) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().SetParametersWithEnvelope(*reinterpret_cast<Windows::Foundation::Numerics::float3 const*>(&vector), attackGain, sustainGain, releaseGain, *reinterpret_cast<Windows::Foundation::TimeSpan const*>(&startDelay), *reinterpret_cast<Windows::Foundation::TimeSpan const*>(&attackDuration), *reinterpret_cast<Windows::Foundation::TimeSpan const*>(&sustainDuration), *reinterpret_cast<Windows::Foundation::TimeSpan const*>(&releaseDuration), repeatCount); return 0; } catch (...) { return to_hresult(); } }; template <typename D> struct produce<D, Windows::Gaming::Input::ForceFeedback::IForceFeedbackEffect> : produce_base<D, Windows::Gaming::Input::ForceFeedback::IForceFeedbackEffect> { int32_t WINRT_CALL get_Gain(double* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from<double>(this->shim().Gain()); return 0; } catch (...) { return to_hresult(); } int32_t WINRT_CALL put_Gain(double value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Gain(value); return 0; } catch (...) { return to_hresult(); } int32_t WINRT_CALL get_State(int32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from<Windows::Gaming::Input::ForceFeedback::ForceFeedbackEffectState>(this->shim().State()); return 0; } catch (...) { return to_hresult(); } int32_t WINRT_CALL Start() noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Start(); return 0; } catch (...) { return to_hresult(); } int32_t WINRT_CALL Stop() noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Stop(); return 0; } catch (...) { return to_hresult(); } }; template <typename D> struct produce<D, Windows::Gaming::Input::ForceFeedback::IForceFeedbackMotor> : produce_base<D, Windows::Gaming::Input::ForceFeedback::IForceFeedbackMotor> { int32_t WINRT_CALL get_AreEffectsPaused(bool* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from<bool>(this->shim().AreEffectsPaused()); return 0; } catch (...) { return to_hresult(); } int32_t WINRT_CALL get_MasterGain(double* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from<double>(this->shim().MasterGain()); return 0; } catch (...) { return to_hresult(); } int32_t WINRT_CALL put_MasterGain(double value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().MasterGain(value); return 0; } catch (...) { return to_hresult(); } int32_t WINRT_CALL get_IsEnabled(bool* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from<bool>(this->shim().IsEnabled()); return 0; } catch (...) { return to_hresult(); } int32_t WINRT_CALL get_SupportedAxes(uint32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from<Windows::Gaming::Input::ForceFeedback::ForceFeedbackEffectAxes>(this->shim().SupportedAxes()); return 0; } catch (...) { return to_hresult(); } int32_t WINRT_CALL LoadEffectAsync(void* effect, void** asyncOperation) noexcept final try { clear_abi(asyncOperation); typename D::abi_guard guard(this->shim()); *asyncOperation = detach_from<Windows::Foundation::IAsyncOperation<Windows::Gaming::Input::ForceFeedback::ForceFeedbackLoadEffectResult>>(this->shim().LoadEffectAsync(*reinterpret_cast<Windows::Gaming::Input::ForceFeedback::IForceFeedbackEffect const*>(&effect))); return 0; } catch (...) { return to_hresult(); } int32_t WINRT_CALL PauseAllEffects() noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().PauseAllEffects(); return 0; } catch (...) { return to_hresult(); } int32_t WINRT_CALL ResumeAllEffects() noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().ResumeAllEffects(); return 0; } catch (...) { return to_hresult(); } int32_t WINRT_CALL StopAllEffects() noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().StopAllEffects(); return 0; } catch (...) { return to_hresult(); } int32_t WINRT_CALL TryDisableAsync(void** asyncOperation) noexcept final try { clear_abi(asyncOperation); typename D::abi_guard guard(this->shim()); *asyncOperation = detach_from<Windows::Foundation::IAsyncOperation<bool>>(this->shim().TryDisableAsync()); return 0; } catch (...) { return to_hresult(); } int32_t WINRT_CALL TryEnableAsync(void** asyncOperation) noexcept final try { clear_abi(asyncOperation); typename D::abi_guard guard(this->shim()); *asyncOperation = detach_from<Windows::Foundation::IAsyncOperation<bool>>(this->shim().TryEnableAsync()); return 0; } catch (...) { return to_hresult(); } int32_t WINRT_CALL TryResetAsync(void** asyncOperation) noexcept final try { clear_abi(asyncOperation); typename D::abi_guard guard(this->shim()); *asyncOperation = detach_from<Windows::Foundation::IAsyncOperation<bool>>(this->shim().TryResetAsync()); return 0; } catch (...) { return to_hresult(); } int32_t WINRT_CALL TryUnloadEffectAsync(void* effect, void** asyncOperation) noexcept final try { clear_abi(asyncOperation); typename D::abi_guard guard(this->shim()); *asyncOperation = detach_from<Windows::Foundation::IAsyncOperation<bool>>(this->shim().TryUnloadEffectAsync(*reinterpret_cast<Windows::Gaming::Input::ForceFeedback::IForceFeedbackEffect const*>(&effect))); return 0; } catch (...) { return to_hresult(); } }; template <typename D> struct produce<D, Windows::Gaming::Input::ForceFeedback::IPeriodicForceEffect> : produce_base<D, Windows::Gaming::Input::ForceFeedback::IPeriodicForceEffect> { int32_t WINRT_CALL get_Kind(int32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from<Windows::Gaming::Input::ForceFeedback::PeriodicForceEffectKind>(this->shim().Kind()); return 0; } catch (...) { return to_hresult(); } int32_t WINRT_CALL SetParameters(Windows::Foundation::Numerics::float3 vector, float frequency, float phase, float bias, int64_t duration) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().SetParameters(*reinterpret_cast<Windows::Foundation::Numerics::float3 const*>(&vector), frequency, phase, bias, *reinterpret_cast<Windows::Foundation::TimeSpan const*>(&duration)); return 0; } catch (...) { return to_hresult(); } int32_t WINRT_CALL SetParametersWithEnvelope(Windows::Foundation::Numerics::float3 vector, float frequency, float phase, float bias, float attackGain, float sustainGain, float releaseGain, int64_t startDelay, int64_t attackDuration, int64_t sustainDuration, int64_t releaseDuration, uint32_t repeatCount) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().SetParametersWithEnvelope(*reinterpret_cast<Windows::Foundation::Numerics::float3 const*>(&vector), frequency, phase, bias, attackGain, sustainGain, releaseGain, *reinterpret_cast<Windows::Foundation::TimeSpan const*>(&startDelay), *reinterpret_cast<Windows::Foundation::TimeSpan const*>(&attackDuration), *reinterpret_cast<Windows::Foundation::TimeSpan const*>(&sustainDuration), *reinterpret_cast<Windows::Foundation::TimeSpan const*>(&releaseDuration), repeatCount); return 0; } catch (...) { return to_hresult(); } }; template <typename D> struct produce<D, Windows::Gaming::Input::ForceFeedback::IPeriodicForceEffectFactory> : produce_base<D, Windows::Gaming::Input::ForceFeedback::IPeriodicForceEffectFactory> { int32_t WINRT_CALL CreateInstance(int32_t effectKind, void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from<Windows::Gaming::Input::ForceFeedback::PeriodicForceEffect>(this->shim().CreateInstance(*reinterpret_cast<Windows::Gaming::Input::ForceFeedback::PeriodicForceEffectKind const*>(&effectKind))); return 0; } catch (...) { return to_hresult(); } }; template <typename D> struct produce<D, Windows::Gaming::Input::ForceFeedback::IRampForceEffect> : produce_base<D, Windows::Gaming::Input::ForceFeedback::IRampForceEffect> { int32_t WINRT_CALL SetParameters(Windows::Foundation::Numerics::float3 startVector, Windows::Foundation::Numerics::float3 endVector, int64_t duration) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().SetParameters(*reinterpret_cast<Windows::Foundation::Numerics::float3 const*>(&startVector), *reinterpret_cast<Windows::Foundation::Numerics::float3 const*>(&endVector), *reinterpret_cast<Windows::Foundation::TimeSpan const*>(&duration)); return 0; } catch (...) { return to_hresult(); } int32_t WINRT_CALL SetParametersWithEnvelope(Windows::Foundation::Numerics::float3 startVector, Windows::Foundation::Numerics::float3 endVector, float attackGain, float sustainGain, float releaseGain, int64_t startDelay, int64_t attackDuration, int64_t sustainDuration, int64_t releaseDuration, uint32_t repeatCount) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().SetParametersWithEnvelope(*reinterpret_cast<Windows::Foundation::Numerics::float3 const*>(&startVector), *reinterpret_cast<Windows::Foundation::Numerics::float3 const*>(&endVector), attackGain, sustainGain, releaseGain, *reinterpret_cast<Windows::Foundation::TimeSpan const*>(&startDelay), *reinterpret_cast<Windows::Foundation::TimeSpan const*>(&attackDuration), *reinterpret_cast<Windows::Foundation::TimeSpan const*>(&sustainDuration), *reinterpret_cast<Windows::Foundation::TimeSpan const*>(&releaseDuration), repeatCount); return 0; } catch (...) { return to_hresult(); } }; } namespace winrt::Windows::Gaming::Input::ForceFeedback { inline ConditionForceEffect::ConditionForceEffect(Windows::Gaming::Input::ForceFeedback::ConditionForceEffectKind const& effectKind) : ConditionForceEffect(impl::call_factory<ConditionForceEffect, Windows::Gaming::Input::ForceFeedback::IConditionForceEffectFactory>([&](auto&& f) { return f.CreateInstance(effectKind); })) { } inline ConstantForceEffect::ConstantForceEffect() : ConstantForceEffect(impl::call_factory<ConstantForceEffect>([](auto&& f) { return f.template ActivateInstance<ConstantForceEffect>(); })) { } inline PeriodicForceEffect::PeriodicForceEffect(Windows::Gaming::Input::ForceFeedback::PeriodicForceEffectKind const& effectKind) : PeriodicForceEffect(impl::call_factory<PeriodicForceEffect, Windows::Gaming::Input::ForceFeedback::IPeriodicForceEffectFactory>([&](auto&& f) { return f.CreateInstance(effectKind); })) { } inline RampForceEffect::RampForceEffect() : RampForceEffect(impl::call_factory<RampForceEffect>([](auto&& f) { return f.template ActivateInstance<RampForceEffect>(); })) { } } namespace std { template<> struct hash<winrt::Windows::Gaming::Input::ForceFeedback::IConditionForceEffect> : winrt::impl::hash_base<winrt::Windows::Gaming::Input::ForceFeedback::IConditionForceEffect> {}; template<> struct hash<winrt::Windows::Gaming::Input::ForceFeedback::IConditionForceEffectFactory> : winrt::impl::hash_base<winrt::Windows::Gaming::Input::ForceFeedback::IConditionForceEffectFactory> {}; template<> struct hash<winrt::Windows::Gaming::Input::ForceFeedback::IConstantForceEffect> : winrt::impl::hash_base<winrt::Windows::Gaming::Input::ForceFeedback::IConstantForceEffect> {}; template<> struct hash<winrt::Windows::Gaming::Input::ForceFeedback::IForceFeedbackEffect> : winrt::impl::hash_base<winrt::Windows::Gaming::Input::ForceFeedback::IForceFeedbackEffect> {}; template<> struct hash<winrt::Windows::Gaming::Input::ForceFeedback::IForceFeedbackMotor> : winrt::impl::hash_base<winrt::Windows::Gaming::Input::ForceFeedback::IForceFeedbackMotor> {}; template<> struct hash<winrt::Windows::Gaming::Input::ForceFeedback::IPeriodicForceEffect> : winrt::impl::hash_base<winrt::Windows::Gaming::Input::ForceFeedback::IPeriodicForceEffect> {}; template<> struct hash<winrt::Windows::Gaming::Input::ForceFeedback::IPeriodicForceEffectFactory> : winrt::impl::hash_base<winrt::Windows::Gaming::Input::ForceFeedback::IPeriodicForceEffectFactory> {}; template<> struct hash<winrt::Windows::Gaming::Input::ForceFeedback::IRampForceEffect> : winrt::impl::hash_base<winrt::Windows::Gaming::Input::ForceFeedback::IRampForceEffect> {}; template<> struct hash<winrt::Windows::Gaming::Input::ForceFeedback::ConditionForceEffect> : winrt::impl::hash_base<winrt::Windows::Gaming::Input::ForceFeedback::ConditionForceEffect> {}; template<> struct hash<winrt::Windows::Gaming::Input::ForceFeedback::ConstantForceEffect> : winrt::impl::hash_base<winrt::Windows::Gaming::Input::ForceFeedback::ConstantForceEffect> {}; template<> struct hash<winrt::Windows::Gaming::Input::ForceFeedback::ForceFeedbackMotor> : winrt::impl::hash_base<winrt::Windows::Gaming::Input::ForceFeedback::ForceFeedbackMotor> {}; template<> struct hash<winrt::Windows::Gaming::Input::ForceFeedback::PeriodicForceEffect> : winrt::impl::hash_base<winrt::Windows::Gaming::Input::ForceFeedback::PeriodicForceEffect> {}; template<> struct hash<winrt::Windows::Gaming::Input::ForceFeedback::RampForceEffect> : winrt::impl::hash_base<winrt::Windows::Gaming::Input::ForceFeedback::RampForceEffect> {}; } #endif
[ "1113673178@qq.com" ]
1113673178@qq.com
112663d693967de7b71b50023706017ea8f59851
1c216ea07d9cf0ddcadc479e848472bb712438ce
/eval_postfix.h
e5a0cacdc62658ed57f0040f64d0c89add0b1721
[]
no_license
rod41732/2110211-Intro-Data-Struct
1181ee7c4f3e857678403d2d2832ae4c0e3549cb
cf7b13f172b00eb9b7db724fe1996bf72d403743
refs/heads/master
2020-03-29T21:49:09.749082
2018-09-26T07:57:05
2018-09-26T07:57:05
150,389,276
0
0
null
null
null
null
UTF-8
C++
false
false
771
h
#include <vector> #include <algorithm> #include <stack> #include <map> using namespace std; int eval_postfix(const vector<pair<int,int> > &v){ stack<int> op; for (pair<int, int> p: v){ if (p.first == 1) op.push(p.second); else { int t1 = op.top(); op.pop(); int t2 = op.top(); op.pop(); switch (p.second){ case 0: op.push(t2+t1); break; case 1: op.push(t2-t1); break; case 2: op.push(t2*t1); break; case 3: op.push(t2/t1); break; } } } return op.top(); }
[ "rod8711@gmail.com" ]
rod8711@gmail.com
7fdbe0519effb9318907b4041b6808e126fad44f
e1e5d6f0a6b4b55697cc2226b8582980f054697a
/src/NodeEngine/Core/ActionTarget.hpp
401030085d66e34b629c918a46131f4a9b2a794a
[]
no_license
gitter-badger/Delmia
3b736c9ae422c0e6fa33ba1002040d76fff7d3a6
488ae6a8ff5d5a1dea8111955722b1a8cddbf8d6
refs/heads/master
2021-01-12T14:45:18.438239
2016-03-24T06:56:48
2016-03-24T06:56:48
54,749,140
0
0
null
2016-03-25T21:41:48
2016-03-25T21:41:48
null
UTF-8
C++
false
false
890
hpp
#ifndef NACTIONTARGET_HPP #define NACTIONTARGET_HPP #include "ActionMap.hpp" #include "Tickable.hpp" class NActionTarget : public NActionMap, public NTickable { public: NActionTarget(); typedef std::function<void(sf::Time dt)> ActionCallback; void bind(std::string const& id, ActionCallback function); void unbind(std::string const& id); bool isActive(std::string const& id); void tick(sf::Time dt); template <typename ... Args> void bind(std::string const& id, ActionCallback function, Args&& ... args); protected: NMap<std::string,ActionCallback> mFunctions; }; template <typename ... Args> void NActionTarget::bind(std::string const& id, NActionTarget::ActionCallback function, Args&& ... args) { setAction(id,std::forward<Args>(args)...); bind(id,function); } #endif // NACTIONTARGET_HPP
[ "charles.mailly@free.fr" ]
charles.mailly@free.fr
65e8ac0a732813cf57341f71affeb6c1b265b05e
de75b4493f17881081edc02852b094d3b902418f
/final_challenge-master/path_planning/src/scan_simulator_2d.cpp
ead753fbc47ebe704ec2094c0d2ff720a2741190
[]
no_license
ccschillinger/Sample-Work
7f5fe4abf941344dbb08428eff517949027a09fe
b8fef25befb7e76259851f9b9b98da652701ca55
refs/heads/main
2023-02-21T00:51:44.288960
2021-01-21T18:58:42
2021-01-21T18:58:42
328,033,174
0
0
null
null
null
null
UTF-8
C++
false
true
360,501
cpp
/* Generated by Cython 0.25.2 */ /* BEGIN: Cython Metadata { "distutils": { "depends": [ "/home/racecar/.local/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h", "/home/racecar/.local/lib/python2.7/site-packages/numpy/core/include/numpy/ufuncobject.h", "/home/racecar/racecar_ws/install/include/racecar_simulator/pose_2d.hpp", "/home/racecar/racecar_ws/install/include/racecar_simulator/scan_simulator_2d.hpp" ], "extra_compile_args": [ "-std=c++11", "-O2", "-O3" ], "extra_link_args": [ "-std=c++11" ], "include_dirs": [ "/usr/local/include", "/home/racecar/.local/lib/python2.7/site-packages/numpy/core/include", "/home/racecar/challenge_ws/install/include", "/home/racecar/racecar_ws/install/include", "/opt/ros/melodic/install/include" ], "language": "c++", "libraries": [ "racecar_simulator" ], "library_dirs": [ "/usr/local/lib", "/home/racecar/challenge_ws/devel/lib", "/home/racecar/racecar_ws/devel/lib", "/opt/ros/melodic/devel/lib" ] }, "module_name": "scan_simulator_2d" } END: Cython Metadata */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) #error Cython requires Python 2.6+ or Python 3.2+. #else #define CYTHON_ABI "0_25_2" #include <stddef.h> #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #ifndef HAVE_LONG_LONG #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000) #define HAVE_LONG_LONG #endif #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif #ifdef PYPY_VERSION #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 #undef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 0 #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 #undef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 0 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #undef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 0 #undef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 1 #undef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 0 #undef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 #elif defined(PYSTON_VERSION) #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 1 #define CYTHON_COMPILING_IN_CPYTHON 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif #undef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 0 #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #undef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 0 #ifndef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 0 #endif #ifndef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 1 #endif #ifndef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 1 #endif #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 1 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif #if PY_MAJOR_VERSION < 3 #undef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 0 #elif !defined(CYTHON_USE_ASYNC_SLOTS) #define CYTHON_USE_ASYNC_SLOTS 1 #endif #if PY_VERSION_HEX < 0x02070000 #undef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 0 #elif !defined(CYTHON_USE_PYLONG_INTERNALS) #define CYTHON_USE_PYLONG_INTERNALS 1 #endif #ifndef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 1 #endif #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif #if PY_VERSION_HEX < 0x030300F0 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #elif !defined(CYTHON_USE_UNICODE_WRITER) #define CYTHON_USE_UNICODE_WRITER 1 #endif #ifndef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 0 #endif #ifndef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 1 #endif #ifndef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 1 #endif #ifndef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 1 #endif #ifndef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 1 #endif #endif #if !defined(CYTHON_FAST_PYCCALL) #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #undef SHIFT #undef BASE #undef MASK #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) #define Py_OptimizeFlag 0 #endif #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyType_Type #endif #ifndef Py_TPFLAGS_CHECKTYPES #define Py_TPFLAGS_CHECKTYPES 0 #endif #ifndef Py_TPFLAGS_HAVE_INDEX #define Py_TPFLAGS_HAVE_INDEX 0 #endif #ifndef Py_TPFLAGS_HAVE_NEWBUFFER #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif #ifndef METH_FASTCALL #define METH_FASTCALL 0x80 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames); #else #define __Pyx_PyCFunctionFast _PyCFunctionFast #endif #if CYTHON_FAST_PYCCALL #define __Pyx_PyFastCFunction_Check(func)\ ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))))) #else #define __Pyx_PyFastCFunction_Check(func) 0 #endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ 0 : _PyUnicode_Ready((PyObject *)(op))) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) #else #define CYTHON_PEP393_ENABLED 0 #define PyUnicode_1BYTE_KIND 1 #define PyUnicode_2BYTE_KIND 2 #define PyUnicode_4BYTE_KIND 4 #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) #endif #if CYTHON_COMPILING_IN_PYPY #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) #else #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) #define PyObject_Malloc(s) PyMem_Malloc(s) #define PyObject_Free(p) PyMem_Free(p) #define PyObject_Realloc(p) PyMem_Realloc(p) #endif #if CYTHON_COMPILING_IN_PYSTON #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) #else #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) #endif #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) #else #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) #endif #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) #define PyObject_ASCII(o) PyObject_Repr(o) #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) #else #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong #define PyInt_FromSize_t PyLong_FromSize_t #define PyInt_FromSsize_t PyLong_FromSsize_t #define PyInt_AsLong PyLong_AsLong #define PyInt_AS_LONG PyLong_AS_LONG #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define PyNumber_Int PyNumber_Long #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY #ifndef PyUnicode_InternFromString #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) #endif #endif #if PY_VERSION_HEX < 0x030200A4 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #else #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) #endif #if CYTHON_USE_ASYNC_SLOTS #if PY_VERSION_HEX >= 0x030500B1 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) #else typedef struct { unaryfunc am_await; unaryfunc am_aiter; unaryfunc am_anext; } __Pyx_PyAsyncMethodsStruct; #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) #endif #else #define __Pyx_PyType_AsAsync(obj) NULL #endif #ifndef CYTHON_RESTRICT #if defined(__GNUC__) #define CYTHON_RESTRICT __restrict__ #elif defined(_MSC_VER) && _MSC_VER >= 1400 #define CYTHON_RESTRICT __restrict #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_RESTRICT restrict #else #define CYTHON_RESTRICT #endif #endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif #endif #ifndef CYTHON_MAYBE_UNUSED_VAR # if defined(__cplusplus) template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } # else # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) # endif #endif #ifndef CYTHON_NCP_UNUSED # if CYTHON_COMPILING_IN_CPYTHON # define CYTHON_NCP_UNUSED # else # define CYTHON_NCP_UNUSED CYTHON_UNUSED # endif #endif #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) #ifndef __cplusplus #error "Cython files generated with the C++ option must be compiled with a C++ compiler." #endif #ifndef CYTHON_INLINE #if defined(__clang__) #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) #else #define CYTHON_INLINE inline #endif #endif template<typename T> void __Pyx_call_destructor(T& x) { x.~T(); } template<typename T> class __Pyx_FakeReference { public: __Pyx_FakeReference() : ptr(NULL) { } __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { } T *operator->() { return ptr; } T *operator&() { return ptr; } operator T&() { return *ptr; } template<typename U> bool operator ==(U other) { return *ptr == other; } template<typename U> bool operator !=(U other) { return *ptr != other; } private: T *ptr; }; #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include <math.h> #ifdef NAN #define __PYX_NAN() ((float) NAN) #else static CYTHON_INLINE float __PYX_NAN() { float value; memset(&value, 0xFF, sizeof(value)); return value; } #endif #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) #define __Pyx_truncl trunc #else #define __Pyx_truncl truncl #endif #define __PYX_ERR(f_index, lineno, Ln_error) \ { \ __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ } #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #define __PYX_HAVE__scan_simulator_2d #define __PYX_HAVE_API__scan_simulator_2d #include <string.h> #include <stdio.h> #include <stdlib.h> #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" #include <vector> #include "ios" #include "new" #include "stdexcept" #include "typeinfo" #include "racecar_simulator/pose_2d.hpp" #include "racecar_simulator/scan_simulator_2d.hpp" #ifdef _OPENMP #include <omp.h> #endif /* _OPENMP */ #ifdef PYREX_WITHOUT_ASSERTIONS #define CYTHON_WITHOUT_ASSERTIONS #endif typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 #define __PYX_DEFAULT_STRING_ENCODING "" #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize #define __Pyx_uchar_cast(c) ((unsigned char)c) #define __Pyx_long_cast(x) ((long)x) #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ (sizeof(type) < sizeof(Py_ssize_t)) ||\ (sizeof(type) > sizeof(Py_ssize_t) &&\ likely(v < (type)PY_SSIZE_T_MAX ||\ v == (type)PY_SSIZE_T_MAX) &&\ (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ v == (type)PY_SSIZE_T_MIN))) ||\ (sizeof(type) == sizeof(Py_ssize_t) &&\ (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ v == (type)PY_SSIZE_T_MAX))) ) #if defined (__cplusplus) && __cplusplus >= 201103L #include <cstdlib> #define __Pyx_sst_abs(value) std::abs(value) #elif SIZEOF_INT >= SIZEOF_SIZE_T #define __Pyx_sst_abs(value) abs(value) #elif SIZEOF_LONG >= SIZEOF_SIZE_T #define __Pyx_sst_abs(value) labs(value) #elif defined (_MSC_VER) && defined (_M_X64) #define __Pyx_sst_abs(value) _abs64(value) #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define __Pyx_sst_abs(value) llabs(value) #elif defined (__GNUC__) #define __Pyx_sst_abs(value) __builtin_llabs(value) #else #define __Pyx_sst_abs(value) ((value<0) ? -value : value) #endif static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) #define __Pyx_PyBytes_FromString PyBytes_FromString #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #if PY_MAJOR_VERSION < 3 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize #else #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize #endif #define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) #if PY_MAJOR_VERSION < 3 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { const Py_UNICODE *u_end = u; while (*u_end++) ; return (size_t)(u_end - u - 1); } #else #define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen #endif #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); #if CYTHON_ASSUME_SAFE_MACROS #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) #endif #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) #else #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) #endif #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; static int __Pyx_init_sys_getdefaultencoding_params(void) { PyObject* sys; PyObject* default_encoding = NULL; PyObject* ascii_chars_u = NULL; PyObject* ascii_chars_b = NULL; const char* default_encoding_c; sys = PyImport_ImportModule("sys"); if (!sys) goto bad; default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); Py_DECREF(sys); if (!default_encoding) goto bad; default_encoding_c = PyBytes_AsString(default_encoding); if (!default_encoding_c) goto bad; if (strcmp(default_encoding_c, "ascii") == 0) { __Pyx_sys_getdefaultencoding_not_ascii = 0; } else { char ascii_chars[128]; int c; for (c = 0; c < 128; c++) { ascii_chars[c] = c; } __Pyx_sys_getdefaultencoding_not_ascii = 1; ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); if (!ascii_chars_u) goto bad; ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { PyErr_Format( PyExc_ValueError, "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", default_encoding_c); goto bad; } Py_DECREF(ascii_chars_u); Py_DECREF(ascii_chars_b); } Py_DECREF(default_encoding); return 0; bad: Py_XDECREF(default_encoding); Py_XDECREF(ascii_chars_u); Py_XDECREF(ascii_chars_b); return -1; } #endif #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) #else #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT static char* __PYX_DEFAULT_STRING_ENCODING; static int __Pyx_init_sys_getdefaultencoding_params(void) { PyObject* sys; PyObject* default_encoding = NULL; char* default_encoding_c; sys = PyImport_ImportModule("sys"); if (!sys) goto bad; default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); Py_DECREF(sys); if (!default_encoding) goto bad; default_encoding_c = PyBytes_AsString(default_encoding); if (!default_encoding_c) goto bad; __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); Py_DECREF(default_encoding); return 0; bad: Py_XDECREF(default_encoding); return -1; } #endif #endif /* Test for GCC > 2.95 */ #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else /* !__GNUC__ or GCC < 2.95 */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; static PyObject *__pyx_d; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static PyObject *__pyx_empty_unicode; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; /* Header.proto */ #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 #elif defined(_Complex_I) #define CYTHON_CCOMPLEX 1 #else #define CYTHON_CCOMPLEX 0 #endif #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus #include <complex> #else #include <complex.h> #endif #endif #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif static const char *__pyx_f[] = { "scan_simulator_2d.pyx", "__init__.pxd", "stringsource", "type.pxd", }; /* BufferFormatStructs.proto */ #define IS_UNSIGNED(type) (((type) -1) > 0) struct __Pyx_StructField_; #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) typedef struct { const char* name; struct __Pyx_StructField_* fields; size_t size; size_t arraysize[8]; int ndim; char typegroup; char is_unsigned; int flags; } __Pyx_TypeInfo; typedef struct __Pyx_StructField_ { __Pyx_TypeInfo* type; const char* name; size_t offset; } __Pyx_StructField; typedef struct { __Pyx_StructField* field; size_t parent_offset; } __Pyx_BufFmt_StackElem; typedef struct { __Pyx_StructField root; __Pyx_BufFmt_StackElem* head; size_t fmt_offset; size_t new_count, enc_count; size_t struct_alignment; int is_complex; char enc_type; char new_packmode; char enc_packmode; char is_valid_array; } __Pyx_BufFmt_Context; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":725 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t */ typedef npy_int8 __pyx_t_5numpy_int8_t; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":726 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t */ typedef npy_int16 __pyx_t_5numpy_int16_t; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":727 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< * ctypedef npy_int64 int64_t * #ctypedef npy_int96 int96_t */ typedef npy_int32 __pyx_t_5numpy_int32_t; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":728 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< * #ctypedef npy_int96 int96_t * #ctypedef npy_int128 int128_t */ typedef npy_int64 __pyx_t_5numpy_int64_t; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":732 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":733 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":734 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< * ctypedef npy_uint64 uint64_t * #ctypedef npy_uint96 uint96_t */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":735 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< * #ctypedef npy_uint96 uint96_t * #ctypedef npy_uint128 uint128_t */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":739 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< * ctypedef npy_float64 float64_t * #ctypedef npy_float80 float80_t */ typedef npy_float32 __pyx_t_5numpy_float32_t; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":740 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< * #ctypedef npy_float80 float80_t * #ctypedef npy_float128 float128_t */ typedef npy_float64 __pyx_t_5numpy_float64_t; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":749 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t */ typedef npy_long __pyx_t_5numpy_int_t; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":750 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< * ctypedef npy_longlong longlong_t * */ typedef npy_longlong __pyx_t_5numpy_long_t; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":751 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< * * ctypedef npy_ulong uint_t */ typedef npy_longlong __pyx_t_5numpy_longlong_t; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":753 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t */ typedef npy_ulong __pyx_t_5numpy_uint_t; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":754 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< * ctypedef npy_ulonglong ulonglong_t * */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":755 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< * * ctypedef npy_intp intp_t */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":757 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< * ctypedef npy_uintp uintp_t * */ typedef npy_intp __pyx_t_5numpy_intp_t; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":758 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< * * ctypedef npy_double float_t */ typedef npy_uintp __pyx_t_5numpy_uintp_t; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":760 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t */ typedef npy_double __pyx_t_5numpy_float_t; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":761 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< * ctypedef npy_longdouble longdouble_t * */ typedef npy_double __pyx_t_5numpy_double_t; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":762 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< * * ctypedef npy_cfloat cfloat_t */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; /* Declarations.proto */ #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; #else typedef float _Complex __pyx_t_float_complex; #endif #else typedef struct { float real, imag; } __pyx_t_float_complex; #endif static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); /* Declarations.proto */ #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< double > __pyx_t_double_complex; #else typedef double _Complex __pyx_t_double_complex; #endif #else typedef struct { double real, imag; } __pyx_t_double_complex; #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); /*--- Type declarations ---*/ struct __pyx_obj_17scan_simulator_2d_PyScanSimulator2D; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":764 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":765 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< * ctypedef npy_clongdouble clongdouble_t * */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":766 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< * * ctypedef npy_cdouble complex_t */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":768 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew1(a): */ typedef npy_cdouble __pyx_t_5numpy_complex_t; struct __pyx_ctuple_double__and_double__and_double; typedef struct __pyx_ctuple_double__and_double__and_double __pyx_ctuple_double__and_double__and_double; /* "scan_simulator_2d.pyx":61 * size_t width, * double resolution, * (double, double, double) origin_tuple, # <<<<<<<<<<<<<< * double free_threshold): * */ struct __pyx_ctuple_double__and_double__and_double { double f0; double f1; double f2; }; /* "scan_simulator_2d.pyx":33 * void scan(Pose2D & pose, double * scan_data) * * cdef class PyScanSimulator2D: # <<<<<<<<<<<<<< * cdef ScanSimulator2D * thisptr; * cdef int num_beams */ struct __pyx_obj_17scan_simulator_2d_PyScanSimulator2D { PyObject_HEAD racecar_simulator::ScanSimulator2D *thisptr; int num_beams; }; /* --- Runtime support code (head) --- */ /* Refnanny.proto */ #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); void (*DECREF)(void*, PyObject*, int); void (*GOTREF)(void*, PyObject*, int); void (*GIVEREF)(void*, PyObject*, int); void* (*SetupContext)(const char*, int, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; #ifdef WITH_THREAD #define __Pyx_RefNannySetupContext(name, acquire_gil)\ if (acquire_gil) {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ PyGILState_Release(__pyx_gilstate_save);\ } else {\ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil)\ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) #endif #define __Pyx_RefNannyFinishContext()\ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif #define __Pyx_XDECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_XDECREF(tmp);\ } while (0) #define __Pyx_DECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_DECREF(tmp);\ } while (0) #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) /* PyObjectGetAttrStr.proto */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { PyTypeObject* tp = Py_TYPE(obj); if (likely(tp->tp_getattro)) return tp->tp_getattro(obj, attr_name); #if PY_MAJOR_VERSION < 3 if (likely(tp->tp_getattr)) return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); #endif return PyObject_GetAttr(obj, attr_name); } #else #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif /* GetBuiltinName.proto */ static PyObject *__Pyx_GetBuiltinName(PyObject *name); /* RaiseArgTupleInvalid.proto */ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /* RaiseDoubleKeywords.proto */ static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /* ParseKeywords.proto */ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ const char* function_name); /* ArgTypeTest.proto */ static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /* BufferFormatCheck.proto */ static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts); static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, __Pyx_BufFmt_StackElem* stack, __Pyx_TypeInfo* type); // PROTO /* BufferIndexError.proto */ static void __Pyx_RaiseBufferIndexError(int axis); #define __Pyx_BufPtrCContig1d(type, buf, i0, s0) ((type)buf + i0) /* PyThreadStateGet.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; #define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET(); #else #define __Pyx_PyThreadState_declare #define __Pyx_PyThreadState_assign #endif /* PyErrFetchRestore.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #else #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) #endif /* GetModuleGlobalName.proto */ static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /* PyFunctionFastCall.proto */ #if CYTHON_FAST_PYCALL #define __Pyx_PyFunction_FastCall(func, args, nargs)\ __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) #if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs); #else #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) #endif #endif /* PyCFunctionFastCall.proto */ #if CYTHON_FAST_PYCCALL static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); #else #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) #endif /* PyObjectCall.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); #else #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) #endif /* ExtTypeTest.proto */ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); #define __Pyx_BufPtrCContig2d(type, buf, i0, s0, i1, s1) ((type)((char*)buf + i0 * s0) + i1) /* RaiseException.proto */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /* DictGetItem.proto */ #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { PyObject *value; value = PyDict_GetItemWithError(d, key); if (unlikely(!value)) { if (!PyErr_Occurred()) { PyObject* args = PyTuple_Pack(1, key); if (likely(args)) PyErr_SetObject(PyExc_KeyError, args); Py_XDECREF(args); } return NULL; } Py_INCREF(value); return value; } #else #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) #endif /* RaiseTooManyValuesToUnpack.proto */ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); /* RaiseNeedMoreValuesToUnpack.proto */ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); /* RaiseNoneIterError.proto */ static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); /* SaveResetException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); #else #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) #endif /* PyErrExceptionMatches.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); #else #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) #endif /* GetException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #else static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); #endif /* Import.proto */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /* CodeObjectCache.proto */ typedef struct { PyCodeObject* code_object; int code_line; } __Pyx_CodeObjectCacheEntry; struct __Pyx_CodeObjectCache { int count; int max_count; __Pyx_CodeObjectCacheEntry* entries; }; static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); /* AddTraceback.proto */ static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /* BufferStructDeclare.proto */ typedef struct { Py_ssize_t shape, strides, suboffsets; } __Pyx_Buf_DimInfo; typedef struct { size_t refcount; Py_buffer pybuffer; } __Pyx_Buffer; typedef struct { __Pyx_Buffer *rcbuffer; char *data; __Pyx_Buf_DimInfo diminfo[8]; } __Pyx_LocalBuf_ND; #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); static void __Pyx_ReleaseBuffer(Py_buffer *view); #else #define __Pyx_GetBuffer PyObject_GetBuffer #define __Pyx_ReleaseBuffer PyBuffer_Release #endif /* None.proto */ static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0}; static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1}; /* FromPyCTupleUtility.proto */ static __pyx_ctuple_double__and_double__and_double __pyx_convert__from_py___pyx_ctuple_double__and_double__and_double(PyObject *); /* CppExceptionConversion.proto */ #ifndef __Pyx_CppExn2PyErr #include <new> #include <typeinfo> #include <stdexcept> #include <ios> static void __Pyx_CppExn2PyErr() { try { if (PyErr_Occurred()) ; // let the latest Python exn pass through and ignore the current one else throw; } catch (const std::bad_alloc& exn) { PyErr_SetString(PyExc_MemoryError, exn.what()); } catch (const std::bad_cast& exn) { PyErr_SetString(PyExc_TypeError, exn.what()); } catch (const std::bad_typeid& exn) { PyErr_SetString(PyExc_TypeError, exn.what()); } catch (const std::domain_error& exn) { PyErr_SetString(PyExc_ValueError, exn.what()); } catch (const std::invalid_argument& exn) { PyErr_SetString(PyExc_ValueError, exn.what()); } catch (const std::ios_base::failure& exn) { PyErr_SetString(PyExc_IOError, exn.what()); } catch (const std::out_of_range& exn) { PyErr_SetString(PyExc_IndexError, exn.what()); } catch (const std::overflow_error& exn) { PyErr_SetString(PyExc_OverflowError, exn.what()); } catch (const std::range_error& exn) { PyErr_SetString(PyExc_ArithmeticError, exn.what()); } catch (const std::underflow_error& exn) { PyErr_SetString(PyExc_ArithmeticError, exn.what()); } catch (const std::exception& exn) { PyErr_SetString(PyExc_RuntimeError, exn.what()); } catch (...) { PyErr_SetString(PyExc_RuntimeError, "Unknown exception"); } } #endif /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); /* RealImag.proto */ #if CYTHON_CCOMPLEX #ifdef __cplusplus #define __Pyx_CREAL(z) ((z).real()) #define __Pyx_CIMAG(z) ((z).imag()) #else #define __Pyx_CREAL(z) (__real__(z)) #define __Pyx_CIMAG(z) (__imag__(z)) #endif #else #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif #if defined(__cplusplus) && CYTHON_CCOMPLEX\ && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103) #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) #else #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) #endif /* Arithmetic.proto */ #if CYTHON_CCOMPLEX #define __Pyx_c_eq_float(a, b) ((a)==(b)) #define __Pyx_c_sum_float(a, b) ((a)+(b)) #define __Pyx_c_diff_float(a, b) ((a)-(b)) #define __Pyx_c_prod_float(a, b) ((a)*(b)) #define __Pyx_c_quot_float(a, b) ((a)/(b)) #define __Pyx_c_neg_float(a) (-(a)) #ifdef __cplusplus #define __Pyx_c_is_zero_float(z) ((z)==(float)0) #define __Pyx_c_conj_float(z) (::std::conj(z)) #if 1 #define __Pyx_c_abs_float(z) (::std::abs(z)) #define __Pyx_c_pow_float(a, b) (::std::pow(a, b)) #endif #else #define __Pyx_c_is_zero_float(z) ((z)==0) #define __Pyx_c_conj_float(z) (conjf(z)) #if 1 #define __Pyx_c_abs_float(z) (cabsf(z)) #define __Pyx_c_pow_float(a, b) (cpowf(a, b)) #endif #endif #else static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex); static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex); #if 1 static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex); #endif #endif /* Arithmetic.proto */ #if CYTHON_CCOMPLEX #define __Pyx_c_eq_double(a, b) ((a)==(b)) #define __Pyx_c_sum_double(a, b) ((a)+(b)) #define __Pyx_c_diff_double(a, b) ((a)-(b)) #define __Pyx_c_prod_double(a, b) ((a)*(b)) #define __Pyx_c_quot_double(a, b) ((a)/(b)) #define __Pyx_c_neg_double(a) (-(a)) #ifdef __cplusplus #define __Pyx_c_is_zero_double(z) ((z)==(double)0) #define __Pyx_c_conj_double(z) (::std::conj(z)) #if 1 #define __Pyx_c_abs_double(z) (::std::abs(z)) #define __Pyx_c_pow_double(a, b) (::std::pow(a, b)) #endif #else #define __Pyx_c_is_zero_double(z) ((z)==0) #define __Pyx_c_conj_double(z) (conj(z)) #if 1 #define __Pyx_c_abs_double(z) (cabs(z)) #define __Pyx_c_pow_double(a, b) (cpow(a, b)) #endif #endif #else static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex); static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex); #if 1 static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex); #endif #endif /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value); /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); /* CIntFromPy.proto */ static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *); /* CIntFromPy.proto */ static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_As_Py_intptr_t(PyObject *); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); /* PyIdentifierFromString.proto */ #if !defined(__Pyx_PyIdentifier_FromString) #if PY_MAJOR_VERSION < 3 #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) #else #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) #endif #endif /* ModuleImport.proto */ static PyObject *__Pyx_ImportModule(const char *name); /* TypeImport.proto */ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'cython' */ /* Module declarations from 'cpython.buffer' */ /* Module declarations from 'libc.string' */ /* Module declarations from 'libc.stdio' */ /* Module declarations from '__builtin__' */ /* Module declarations from 'cpython.type' */ static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; /* Module declarations from 'cpython' */ /* Module declarations from 'cpython.object' */ /* Module declarations from 'cpython.ref' */ /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'numpy' */ /* Module declarations from 'numpy' */ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ /* Module declarations from 'libcpp.vector' */ /* Module declarations from 'scan_simulator_2d' */ static PyTypeObject *__pyx_ptype_17scan_simulator_2d_PyScanSimulator2D = 0; static struct racecar_simulator::Pose2D __pyx_convert__from_py_struct__racecar_simulator_3a__3a_Pose2D(PyObject *); /*proto*/ static __Pyx_TypeInfo __Pyx_TypeInfo_double = { "double", NULL, sizeof(double), { 0 }, 0, 'R', 0, 0 }; #define __Pyx_MODULE_NAME "scan_simulator_2d" int __pyx_module_is_main_scan_simulator_2d = 0; /* Implementation of 'scan_simulator_2d' */ static PyObject *__pyx_builtin_xrange; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_RuntimeError; static PyObject *__pyx_builtin_ImportError; static PyObject *__pyx_builtin_TypeError; static PyObject *__pyx_builtin_KeyError; static const char __pyx_k_x[] = "x"; static const char __pyx_k_y[] = "y"; static const char __pyx_k_np[] = "np"; static const char __pyx_k_main[] = "__main__"; static const char __pyx_k_test[] = "__test__"; static const char __pyx_k_empty[] = "empty"; static const char __pyx_k_numpy[] = "numpy"; static const char __pyx_k_range[] = "range"; static const char __pyx_k_theta[] = "theta"; static const char __pyx_k_width[] = "width"; static const char __pyx_k_double[] = "double"; static const char __pyx_k_height[] = "height"; static const char __pyx_k_import[] = "__import__"; static const char __pyx_k_map_np[] = "map_np"; static const char __pyx_k_xrange[] = "xrange"; static const char __pyx_k_KeyError[] = "KeyError"; static const char __pyx_k_TypeError[] = "TypeError"; static const char __pyx_k_num_beams[] = "num_beams_"; static const char __pyx_k_ValueError[] = "ValueError"; static const char __pyx_k_resolution[] = "resolution"; static const char __pyx_k_ImportError[] = "ImportError"; static const char __pyx_k_RuntimeError[] = "RuntimeError"; static const char __pyx_k_origin_tuple[] = "origin_tuple"; static const char __pyx_k_scan_std_dev[] = "scan_std_dev_"; static const char __pyx_k_field_of_view[] = "field_of_view_"; static const char __pyx_k_free_threshold[] = "free_threshold"; static const char __pyx_k_ray_tracing_epsilon[] = "ray_tracing_epsilon_"; static const char __pyx_k_theta_discretization[] = "theta_discretization_"; static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous"; static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import"; static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)"; static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd"; static const char __pyx_k_No_value_specified_for_struct_at[] = "No value specified for struct attribute 'x'"; static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported"; static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous"; static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import"; static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short."; static const char __pyx_k_No_value_specified_for_struct_at_2[] = "No value specified for struct attribute 'y'"; static const char __pyx_k_No_value_specified_for_struct_at_3[] = "No value specified for struct attribute 'theta'"; static PyObject *__pyx_kp_u_Format_string_allocated_too_shor; static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2; static PyObject *__pyx_n_s_ImportError; static PyObject *__pyx_n_s_KeyError; static PyObject *__pyx_kp_s_No_value_specified_for_struct_at; static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_2; static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_3; static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor; static PyObject *__pyx_n_s_RuntimeError; static PyObject *__pyx_n_s_TypeError; static PyObject *__pyx_n_s_ValueError; static PyObject *__pyx_n_s_double; static PyObject *__pyx_n_s_empty; static PyObject *__pyx_n_s_field_of_view; static PyObject *__pyx_n_s_free_threshold; static PyObject *__pyx_n_s_height; static PyObject *__pyx_n_s_import; static PyObject *__pyx_n_s_main; static PyObject *__pyx_n_s_map_np; static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous; static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou; static PyObject *__pyx_n_s_np; static PyObject *__pyx_n_s_num_beams; static PyObject *__pyx_n_s_numpy; static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to; static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor; static PyObject *__pyx_n_s_origin_tuple; static PyObject *__pyx_n_s_range; static PyObject *__pyx_n_s_ray_tracing_epsilon; static PyObject *__pyx_n_s_resolution; static PyObject *__pyx_n_s_scan_std_dev; static PyObject *__pyx_n_s_test; static PyObject *__pyx_n_s_theta; static PyObject *__pyx_n_s_theta_discretization; static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd; static PyObject *__pyx_n_s_width; static PyObject *__pyx_n_s_x; static PyObject *__pyx_n_s_xrange; static PyObject *__pyx_n_s_y; static int __pyx_pf_17scan_simulator_2d_17PyScanSimulator2D___init__(struct __pyx_obj_17scan_simulator_2d_PyScanSimulator2D *__pyx_v_self, int __pyx_v_num_beams_, double __pyx_v_field_of_view_, double __pyx_v_scan_std_dev_, double __pyx_v_ray_tracing_epsilon_, int __pyx_v_theta_discretization_); /* proto */ static void __pyx_pf_17scan_simulator_2d_17PyScanSimulator2D_2__dealloc__(struct __pyx_obj_17scan_simulator_2d_PyScanSimulator2D *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_17scan_simulator_2d_17PyScanSimulator2D_4set_map(struct __pyx_obj_17scan_simulator_2d_PyScanSimulator2D *__pyx_v_self, PyArrayObject *__pyx_v_map_np, size_t __pyx_v_height, size_t __pyx_v_width, double __pyx_v_resolution, __pyx_ctuple_double__and_double__and_double __pyx_v_origin_tuple, double __pyx_v_free_threshold); /* proto */ static PyObject *__pyx_pf_17scan_simulator_2d_17PyScanSimulator2D_6scan(struct __pyx_obj_17scan_simulator_2d_PyScanSimulator2D *__pyx_v_self, PyArrayObject *__pyx_v_poses); /* proto */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static PyObject *__pyx_tp_new_17scan_simulator_2d_PyScanSimulator2D(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tuple_; static PyObject *__pyx_tuple__2; static PyObject *__pyx_tuple__3; static PyObject *__pyx_tuple__4; static PyObject *__pyx_tuple__5; static PyObject *__pyx_tuple__6; static PyObject *__pyx_tuple__7; static PyObject *__pyx_tuple__8; static PyObject *__pyx_tuple__9; static PyObject *__pyx_tuple__10; static PyObject *__pyx_tuple__11; static PyObject *__pyx_tuple__12; /* "scan_simulator_2d.pyx":37 * cdef int num_beams * * def __init__( # <<<<<<<<<<<<<< * self, * int num_beams_, */ /* Python wrapper */ static int __pyx_pw_17scan_simulator_2d_17PyScanSimulator2D_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_17scan_simulator_2d_17PyScanSimulator2D_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_num_beams_; double __pyx_v_field_of_view_; double __pyx_v_scan_std_dev_; double __pyx_v_ray_tracing_epsilon_; int __pyx_v_theta_discretization_; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_num_beams,&__pyx_n_s_field_of_view,&__pyx_n_s_scan_std_dev,&__pyx_n_s_ray_tracing_epsilon,&__pyx_n_s_theta_discretization,0}; PyObject* values[5] = {0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_num_beams)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_field_of_view)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 1); __PYX_ERR(0, 37, __pyx_L3_error) } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_scan_std_dev)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 2); __PYX_ERR(0, 37, __pyx_L3_error) } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ray_tracing_epsilon)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 3); __PYX_ERR(0, 37, __pyx_L3_error) } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_theta_discretization)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 4); __PYX_ERR(0, 37, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 37, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } __pyx_v_num_beams_ = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_num_beams_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 39, __pyx_L3_error) __pyx_v_field_of_view_ = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_field_of_view_ == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 40, __pyx_L3_error) __pyx_v_scan_std_dev_ = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_scan_std_dev_ == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L3_error) __pyx_v_ray_tracing_epsilon_ = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_ray_tracing_epsilon_ == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 42, __pyx_L3_error) __pyx_v_theta_discretization_ = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_theta_discretization_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 43, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 37, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("scan_simulator_2d.PyScanSimulator2D.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_17scan_simulator_2d_17PyScanSimulator2D___init__(((struct __pyx_obj_17scan_simulator_2d_PyScanSimulator2D *)__pyx_v_self), __pyx_v_num_beams_, __pyx_v_field_of_view_, __pyx_v_scan_std_dev_, __pyx_v_ray_tracing_epsilon_, __pyx_v_theta_discretization_); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_17scan_simulator_2d_17PyScanSimulator2D___init__(struct __pyx_obj_17scan_simulator_2d_PyScanSimulator2D *__pyx_v_self, int __pyx_v_num_beams_, double __pyx_v_field_of_view_, double __pyx_v_scan_std_dev_, double __pyx_v_ray_tracing_epsilon_, int __pyx_v_theta_discretization_) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); /* "scan_simulator_2d.pyx":44 * double ray_tracing_epsilon_, * int theta_discretization_): * self.num_beams = num_beams_ # <<<<<<<<<<<<<< * self.thisptr = new ScanSimulator2D( * num_beams_, */ __pyx_v_self->num_beams = __pyx_v_num_beams_; /* "scan_simulator_2d.pyx":45 * int theta_discretization_): * self.num_beams = num_beams_ * self.thisptr = new ScanSimulator2D( # <<<<<<<<<<<<<< * num_beams_, * field_of_view_, */ __pyx_v_self->thisptr = new racecar_simulator::ScanSimulator2D(__pyx_v_num_beams_, __pyx_v_field_of_view_, __pyx_v_scan_std_dev_, __pyx_v_ray_tracing_epsilon_, __pyx_v_theta_discretization_); /* "scan_simulator_2d.pyx":37 * cdef int num_beams * * def __init__( # <<<<<<<<<<<<<< * self, * int num_beams_, */ /* function exit code */ __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "scan_simulator_2d.pyx":52 * theta_discretization_) * * def __dealloc__(self): # <<<<<<<<<<<<<< * del self.thisptr * */ /* Python wrapper */ static void __pyx_pw_17scan_simulator_2d_17PyScanSimulator2D_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_17scan_simulator_2d_17PyScanSimulator2D_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_17scan_simulator_2d_17PyScanSimulator2D_2__dealloc__(((struct __pyx_obj_17scan_simulator_2d_PyScanSimulator2D *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_17scan_simulator_2d_17PyScanSimulator2D_2__dealloc__(struct __pyx_obj_17scan_simulator_2d_PyScanSimulator2D *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); /* "scan_simulator_2d.pyx":53 * * def __dealloc__(self): * del self.thisptr # <<<<<<<<<<<<<< * * def set_map( */ delete __pyx_v_self->thisptr; /* "scan_simulator_2d.pyx":52 * theta_discretization_) * * def __dealloc__(self): # <<<<<<<<<<<<<< * del self.thisptr * */ /* function exit code */ __Pyx_RefNannyFinishContext(); } /* "scan_simulator_2d.pyx":55 * del self.thisptr * * def set_map( # <<<<<<<<<<<<<< * self, * np.ndarray[double, ndim=1, mode='c'] map_np, */ /* Python wrapper */ static PyObject *__pyx_pw_17scan_simulator_2d_17PyScanSimulator2D_5set_map(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pw_17scan_simulator_2d_17PyScanSimulator2D_5set_map(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_map_np = 0; size_t __pyx_v_height; size_t __pyx_v_width; double __pyx_v_resolution; __pyx_ctuple_double__and_double__and_double __pyx_v_origin_tuple; double __pyx_v_free_threshold; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_map (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_map_np,&__pyx_n_s_height,&__pyx_n_s_width,&__pyx_n_s_resolution,&__pyx_n_s_origin_tuple,&__pyx_n_s_free_threshold,0}; PyObject* values[6] = {0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_map_np)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_height)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("set_map", 1, 6, 6, 1); __PYX_ERR(0, 55, __pyx_L3_error) } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_width)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("set_map", 1, 6, 6, 2); __PYX_ERR(0, 55, __pyx_L3_error) } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_resolution)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("set_map", 1, 6, 6, 3); __PYX_ERR(0, 55, __pyx_L3_error) } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_origin_tuple)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("set_map", 1, 6, 6, 4); __PYX_ERR(0, 55, __pyx_L3_error) } case 5: if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_free_threshold)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("set_map", 1, 6, 6, 5); __PYX_ERR(0, 55, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_map") < 0)) __PYX_ERR(0, 55, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); values[5] = PyTuple_GET_ITEM(__pyx_args, 5); } __pyx_v_map_np = ((PyArrayObject *)values[0]); __pyx_v_height = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_height == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 58, __pyx_L3_error) __pyx_v_width = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_width == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L3_error) __pyx_v_resolution = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_resolution == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 60, __pyx_L3_error) __pyx_v_origin_tuple = __pyx_convert__from_py___pyx_ctuple_double__and_double__and_double(values[4]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 61, __pyx_L3_error) __pyx_v_free_threshold = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_free_threshold == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 62, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("set_map", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 55, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("scan_simulator_2d.PyScanSimulator2D.set_map", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_map_np), __pyx_ptype_5numpy_ndarray, 1, "map_np", 0))) __PYX_ERR(0, 57, __pyx_L1_error) __pyx_r = __pyx_pf_17scan_simulator_2d_17PyScanSimulator2D_4set_map(((struct __pyx_obj_17scan_simulator_2d_PyScanSimulator2D *)__pyx_v_self), __pyx_v_map_np, __pyx_v_height, __pyx_v_width, __pyx_v_resolution, __pyx_v_origin_tuple, __pyx_v_free_threshold); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_17scan_simulator_2d_17PyScanSimulator2D_4set_map(struct __pyx_obj_17scan_simulator_2d_PyScanSimulator2D *__pyx_v_self, PyArrayObject *__pyx_v_map_np, size_t __pyx_v_height, size_t __pyx_v_width, double __pyx_v_resolution, __pyx_ctuple_double__and_double__and_double __pyx_v_origin_tuple, double __pyx_v_free_threshold) { PyObject *__pyx_v_origin = 0; std::vector<double> __pyx_v_map_; __Pyx_LocalBuf_ND __pyx_pybuffernd_map_np; __Pyx_Buffer __pyx_pybuffer_map_np; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; Py_ssize_t __pyx_t_3; int __pyx_t_4; Py_ssize_t __pyx_t_5; struct racecar_simulator::Pose2D __pyx_t_6; __Pyx_RefNannySetupContext("set_map", 0); __pyx_pybuffer_map_np.pybuffer.buf = NULL; __pyx_pybuffer_map_np.refcount = 0; __pyx_pybuffernd_map_np.data = NULL; __pyx_pybuffernd_map_np.rcbuffer = &__pyx_pybuffer_map_np; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_map_np.rcbuffer->pybuffer, (PyObject*)__pyx_v_map_np, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 55, __pyx_L1_error) } __pyx_pybuffernd_map_np.diminfo[0].strides = __pyx_pybuffernd_map_np.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_map_np.diminfo[0].shape = __pyx_pybuffernd_map_np.rcbuffer->pybuffer.shape[0]; /* "scan_simulator_2d.pyx":64 * double free_threshold): * * cdef origin = Pose2D(origin_tuple[0], origin_tuple[1], origin_tuple[2]) # <<<<<<<<<<<<<< * * cdef vector[double] map_ */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyFloat_FromDouble(__pyx_v_origin_tuple.f0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_x, __pyx_t_2) < 0) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyFloat_FromDouble(__pyx_v_origin_tuple.f1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_y, __pyx_t_2) < 0) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyFloat_FromDouble(__pyx_v_origin_tuple.f2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_theta, __pyx_t_2) < 0) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_origin = __pyx_t_1; __pyx_t_1 = 0; /* "scan_simulator_2d.pyx":67 * * cdef vector[double] map_ * map_.assign(&map_np[0], &map_np[0] + map_np.shape[0]) # <<<<<<<<<<<<<< * * self.thisptr.set_map( */ __pyx_t_3 = 0; __pyx_t_4 = -1; if (__pyx_t_3 < 0) { __pyx_t_3 += __pyx_pybuffernd_map_np.diminfo[0].shape; if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0; } else if (unlikely(__pyx_t_3 >= __pyx_pybuffernd_map_np.diminfo[0].shape)) __pyx_t_4 = 0; if (unlikely(__pyx_t_4 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_4); __PYX_ERR(0, 67, __pyx_L1_error) } __pyx_t_5 = 0; __pyx_t_4 = -1; if (__pyx_t_5 < 0) { __pyx_t_5 += __pyx_pybuffernd_map_np.diminfo[0].shape; if (unlikely(__pyx_t_5 < 0)) __pyx_t_4 = 0; } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_map_np.diminfo[0].shape)) __pyx_t_4 = 0; if (unlikely(__pyx_t_4 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_4); __PYX_ERR(0, 67, __pyx_L1_error) } try { __pyx_v_map_.assign((&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_map_np.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_map_np.diminfo[0].strides))), ((&(*__Pyx_BufPtrCContig1d(double *, __pyx_pybuffernd_map_np.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_map_np.diminfo[0].strides))) + (__pyx_v_map_np->dimensions[0]))); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 67, __pyx_L1_error) } /* "scan_simulator_2d.pyx":74 * width, * resolution, * origin, # <<<<<<<<<<<<<< * free_threshold) * */ __pyx_t_6 = __pyx_convert__from_py_struct__racecar_simulator_3a__3a_Pose2D(__pyx_v_origin); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 74, __pyx_L1_error) /* "scan_simulator_2d.pyx":69 * map_.assign(&map_np[0], &map_np[0] + map_np.shape[0]) * * self.thisptr.set_map( # <<<<<<<<<<<<<< * map_, * height, */ __pyx_v_self->thisptr->set_map(__pyx_v_map_, __pyx_v_height, __pyx_v_width, __pyx_v_resolution, __pyx_t_6, __pyx_v_free_threshold); /* "scan_simulator_2d.pyx":55 * del self.thisptr * * def set_map( # <<<<<<<<<<<<<< * self, * np.ndarray[double, ndim=1, mode='c'] map_np, */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_map_np.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("scan_simulator_2d.PyScanSimulator2D.set_map", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_map_np.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF(__pyx_v_origin); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "scan_simulator_2d.pyx":77 * free_threshold) * * def scan(self, np.ndarray[double, ndim=2, mode="c"] poses): # <<<<<<<<<<<<<< * # Allocate the output vector * cdef np.ndarray[double, ndim=2, mode="c"] scans = \ */ /* Python wrapper */ static PyObject *__pyx_pw_17scan_simulator_2d_17PyScanSimulator2D_7scan(PyObject *__pyx_v_self, PyObject *__pyx_v_poses); /*proto*/ static PyObject *__pyx_pw_17scan_simulator_2d_17PyScanSimulator2D_7scan(PyObject *__pyx_v_self, PyObject *__pyx_v_poses) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("scan (wrapper)", 0); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_poses), __pyx_ptype_5numpy_ndarray, 1, "poses", 0))) __PYX_ERR(0, 77, __pyx_L1_error) __pyx_r = __pyx_pf_17scan_simulator_2d_17PyScanSimulator2D_6scan(((struct __pyx_obj_17scan_simulator_2d_PyScanSimulator2D *)__pyx_v_self), ((PyArrayObject *)__pyx_v_poses)); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_17scan_simulator_2d_17PyScanSimulator2D_6scan(struct __pyx_obj_17scan_simulator_2d_PyScanSimulator2D *__pyx_v_self, PyArrayObject *__pyx_v_poses) { PyArrayObject *__pyx_v_scans = 0; struct racecar_simulator::Pose2D __pyx_v_p; npy_intp __pyx_v_i; __Pyx_LocalBuf_ND __pyx_pybuffernd_poses; __Pyx_Buffer __pyx_pybuffer_poses; __Pyx_LocalBuf_ND __pyx_pybuffernd_scans; __Pyx_Buffer __pyx_pybuffer_scans; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; PyArrayObject *__pyx_t_8 = NULL; npy_intp __pyx_t_9; npy_intp __pyx_t_10; struct racecar_simulator::Pose2D __pyx_t_11; Py_ssize_t __pyx_t_12; Py_ssize_t __pyx_t_13; Py_ssize_t __pyx_t_14; Py_ssize_t __pyx_t_15; Py_ssize_t __pyx_t_16; Py_ssize_t __pyx_t_17; Py_ssize_t __pyx_t_18; Py_ssize_t __pyx_t_19; __Pyx_RefNannySetupContext("scan", 0); __pyx_pybuffer_scans.pybuffer.buf = NULL; __pyx_pybuffer_scans.refcount = 0; __pyx_pybuffernd_scans.data = NULL; __pyx_pybuffernd_scans.rcbuffer = &__pyx_pybuffer_scans; __pyx_pybuffer_poses.pybuffer.buf = NULL; __pyx_pybuffer_poses.refcount = 0; __pyx_pybuffernd_poses.data = NULL; __pyx_pybuffernd_poses.rcbuffer = &__pyx_pybuffer_poses; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_poses.rcbuffer->pybuffer, (PyObject*)__pyx_v_poses, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 77, __pyx_L1_error) } __pyx_pybuffernd_poses.diminfo[0].strides = __pyx_pybuffernd_poses.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_poses.diminfo[0].shape = __pyx_pybuffernd_poses.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_poses.diminfo[1].strides = __pyx_pybuffernd_poses.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_poses.diminfo[1].shape = __pyx_pybuffernd_poses.rcbuffer->pybuffer.shape[1]; /* "scan_simulator_2d.pyx":80 * # Allocate the output vector * cdef np.ndarray[double, ndim=2, mode="c"] scans = \ * np.empty([poses.shape[0], self.num_beams], np.double) # <<<<<<<<<<<<<< * * # Allocate the for loops */ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_poses->dimensions[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->num_beams); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_2); PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_4); PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_4); __pyx_t_2 = 0; __pyx_t_4 = 0; __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_double); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_6 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_t_2}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_t_2}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else #endif { __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL; } __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_2); __pyx_t_5 = 0; __pyx_t_2 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 80, __pyx_L1_error) __pyx_t_8 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_scans.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) { __pyx_v_scans = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_scans.rcbuffer->pybuffer.buf = NULL; __PYX_ERR(0, 79, __pyx_L1_error) } else {__pyx_pybuffernd_scans.diminfo[0].strides = __pyx_pybuffernd_scans.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_scans.diminfo[0].shape = __pyx_pybuffernd_scans.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_scans.diminfo[1].strides = __pyx_pybuffernd_scans.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_scans.diminfo[1].shape = __pyx_pybuffernd_scans.rcbuffer->pybuffer.shape[1]; } } __pyx_t_8 = 0; __pyx_v_scans = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; /* "scan_simulator_2d.pyx":85 * cdef Pose2D p * * for i in xrange(poses.shape[0]): # <<<<<<<<<<<<<< * p = Pose2D(poses[i,0], poses[i,1], poses[i,2]) * self.thisptr.scan(p, &scans[i,0]) */ __pyx_t_9 = (__pyx_v_poses->dimensions[0]); for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_i = __pyx_t_10; /* "scan_simulator_2d.pyx":86 * * for i in xrange(poses.shape[0]): * p = Pose2D(poses[i,0], poses[i,1], poses[i,2]) # <<<<<<<<<<<<<< * self.thisptr.scan(p, &scans[i,0]) * */ __pyx_t_12 = __pyx_v_i; __pyx_t_13 = 0; __pyx_t_6 = -1; if (__pyx_t_12 < 0) { __pyx_t_12 += __pyx_pybuffernd_poses.diminfo[0].shape; if (unlikely(__pyx_t_12 < 0)) __pyx_t_6 = 0; } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_poses.diminfo[0].shape)) __pyx_t_6 = 0; if (__pyx_t_13 < 0) { __pyx_t_13 += __pyx_pybuffernd_poses.diminfo[1].shape; if (unlikely(__pyx_t_13 < 0)) __pyx_t_6 = 1; } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_poses.diminfo[1].shape)) __pyx_t_6 = 1; if (unlikely(__pyx_t_6 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_6); __PYX_ERR(0, 86, __pyx_L1_error) } __pyx_t_11.x = (*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_poses.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_poses.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_poses.diminfo[1].strides)); __pyx_t_14 = __pyx_v_i; __pyx_t_15 = 1; __pyx_t_6 = -1; if (__pyx_t_14 < 0) { __pyx_t_14 += __pyx_pybuffernd_poses.diminfo[0].shape; if (unlikely(__pyx_t_14 < 0)) __pyx_t_6 = 0; } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_poses.diminfo[0].shape)) __pyx_t_6 = 0; if (__pyx_t_15 < 0) { __pyx_t_15 += __pyx_pybuffernd_poses.diminfo[1].shape; if (unlikely(__pyx_t_15 < 0)) __pyx_t_6 = 1; } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_poses.diminfo[1].shape)) __pyx_t_6 = 1; if (unlikely(__pyx_t_6 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_6); __PYX_ERR(0, 86, __pyx_L1_error) } __pyx_t_11.y = (*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_poses.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_poses.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_poses.diminfo[1].strides)); __pyx_t_16 = __pyx_v_i; __pyx_t_17 = 2; __pyx_t_6 = -1; if (__pyx_t_16 < 0) { __pyx_t_16 += __pyx_pybuffernd_poses.diminfo[0].shape; if (unlikely(__pyx_t_16 < 0)) __pyx_t_6 = 0; } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_poses.diminfo[0].shape)) __pyx_t_6 = 0; if (__pyx_t_17 < 0) { __pyx_t_17 += __pyx_pybuffernd_poses.diminfo[1].shape; if (unlikely(__pyx_t_17 < 0)) __pyx_t_6 = 1; } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_poses.diminfo[1].shape)) __pyx_t_6 = 1; if (unlikely(__pyx_t_6 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_6); __PYX_ERR(0, 86, __pyx_L1_error) } __pyx_t_11.theta = (*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_poses.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_poses.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_poses.diminfo[1].strides)); __pyx_v_p = __pyx_t_11; /* "scan_simulator_2d.pyx":87 * for i in xrange(poses.shape[0]): * p = Pose2D(poses[i,0], poses[i,1], poses[i,2]) * self.thisptr.scan(p, &scans[i,0]) # <<<<<<<<<<<<<< * * return scans */ __pyx_t_18 = __pyx_v_i; __pyx_t_19 = 0; __pyx_t_6 = -1; if (__pyx_t_18 < 0) { __pyx_t_18 += __pyx_pybuffernd_scans.diminfo[0].shape; if (unlikely(__pyx_t_18 < 0)) __pyx_t_6 = 0; } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_scans.diminfo[0].shape)) __pyx_t_6 = 0; if (__pyx_t_19 < 0) { __pyx_t_19 += __pyx_pybuffernd_scans.diminfo[1].shape; if (unlikely(__pyx_t_19 < 0)) __pyx_t_6 = 1; } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_scans.diminfo[1].shape)) __pyx_t_6 = 1; if (unlikely(__pyx_t_6 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_6); __PYX_ERR(0, 87, __pyx_L1_error) } __pyx_v_self->thisptr->scan(__pyx_v_p, (&(*__Pyx_BufPtrCContig2d(double *, __pyx_pybuffernd_scans.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_scans.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_scans.diminfo[1].strides)))); } /* "scan_simulator_2d.pyx":89 * self.thisptr.scan(p, &scans[i,0]) * * return scans # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_scans)); __pyx_r = ((PyObject *)__pyx_v_scans); goto __pyx_L0; /* "scan_simulator_2d.pyx":77 * free_threshold) * * def scan(self, np.ndarray[double, ndim=2, mode="c"] poses): # <<<<<<<<<<<<<< * # Allocate the output vector * cdef np.ndarray[double, ndim=2, mode="c"] scans = \ */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_7); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_poses.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_scans.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("scan_simulator_2d.PyScanSimulator2D.scan", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_poses.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_scans.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_scans); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":197 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< * # This implementation of getbuffer is geared towards Cython * # requirements, and does not yet fullfill the PEP. */ /* Python wrapper */ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; int __pyx_v_endian_detector; int __pyx_v_little_endian; int __pyx_v_t; char *__pyx_v_f; PyArray_Descr *__pyx_v_descr = 0; int __pyx_v_offset; int __pyx_v_hasfields; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; int __pyx_t_5; PyObject *__pyx_t_6 = NULL; char *__pyx_t_7; __Pyx_RefNannySetupContext("__getbuffer__", 0); if (__pyx_v_info != NULL) { __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":203 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< * * cdef int copy_shape, i, ndim */ __pyx_t_1 = ((__pyx_v_info == NULL) != 0); if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":206 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) * */ __pyx_v_endian_detector = 1; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":207 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * * ndim = PyArray_NDIM(self) */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":209 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":211 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * copy_shape = 1 * else: */ __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":212 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< * else: * copy_shape = 0 */ __pyx_v_copy_shape = 1; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":211 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * copy_shape = 1 * else: */ goto __pyx_L4; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":214 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) */ /*else*/ { __pyx_v_copy_shape = 0; } __pyx_L4:; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":216 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0); if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L6_bool_binop_done; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":217 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0); __pyx_t_1 = __pyx_t_2; __pyx_L6_bool_binop_done:; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":216 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ if (__pyx_t_1) { /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":218 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(1, 218, __pyx_L1_error) /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":216 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":220 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0); if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L9_bool_binop_done; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":221 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0); __pyx_t_1 = __pyx_t_2; __pyx_L9_bool_binop_done:; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":220 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ if (__pyx_t_1) { /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":222 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(1, 222, __pyx_L1_error) /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":220 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":224 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":225 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< * if copy_shape: * # Allocate new buffer for strides and shape info. */ __pyx_v_info->ndim = __pyx_v_ndim; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":226 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. */ __pyx_t_1 = (__pyx_v_copy_shape != 0); if (__pyx_t_1) { /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":229 * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. * info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2) # <<<<<<<<<<<<<< * info.shape = info.strides + ndim * for i in range(ndim): */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":230 * # This is allocated as one block, strides first. * info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":231 * info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ __pyx_t_4 = __pyx_v_ndim; for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { __pyx_v_i = __pyx_t_5; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":232 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":233 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = <Py_ssize_t*>PyArray_STRIDES(self) */ (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":226 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. */ goto __pyx_L11; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":235 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = <Py_ssize_t*>PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = <Py_ssize_t*>PyArray_DIMS(self) * info.suboffsets = NULL */ /*else*/ { __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":236 * else: * info.strides = <Py_ssize_t*>PyArray_STRIDES(self) * info.shape = <Py_ssize_t*>PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } __pyx_L11:; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":237 * info.strides = <Py_ssize_t*>PyArray_STRIDES(self) * info.shape = <Py_ssize_t*>PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) */ __pyx_v_info->suboffsets = NULL; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":238 * info.shape = <Py_ssize_t*>PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":239 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0)); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":242 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< * cdef dtype descr = self.descr * cdef int offset */ __pyx_v_f = NULL; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":243 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef int offset * */ __pyx_t_3 = ((PyObject *)__pyx_v_self->descr); __Pyx_INCREF(__pyx_t_3); __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":246 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< * * if not hasfields and not copy_shape: */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":248 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< * # do not call releasebuffer * info.obj = None */ __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0); if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L15_bool_binop_done; } __pyx_t_2 = ((!(__pyx_v_copy_shape != 0)) != 0); __pyx_t_1 = __pyx_t_2; __pyx_L15_bool_binop_done:; if (__pyx_t_1) { /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":250 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< * else: * # need to call releasebuffer */ __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":248 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< * # do not call releasebuffer * info.obj = None */ goto __pyx_L14; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":253 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ /*else*/ { __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } __pyx_L14:; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":255 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0); if (__pyx_t_1) { /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":256 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): */ __pyx_t_4 = __pyx_v_descr->type_num; __pyx_v_t = __pyx_t_4; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":257 * if not hasfields: * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0); if (!__pyx_t_2) { goto __pyx_L20_next_or; } else { } __pyx_t_2 = (__pyx_v_little_endian != 0); if (!__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L19_bool_binop_done; } __pyx_L20_next_or:; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":258 * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0); if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L19_bool_binop_done; } __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0); __pyx_t_1 = __pyx_t_2; __pyx_L19_bool_binop_done:; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":257 * if not hasfields: * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ if (__pyx_t_1) { /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":259 * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(1, 259, __pyx_L1_error) /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":257 * if not hasfields: * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":260 * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" */ switch (__pyx_v_t) { case NPY_BYTE: __pyx_v_f = ((char *)"b"); break; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":261 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" */ case NPY_UBYTE: __pyx_v_f = ((char *)"B"); break; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":262 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" */ case NPY_SHORT: __pyx_v_f = ((char *)"h"); break; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":263 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" */ case NPY_USHORT: __pyx_v_f = ((char *)"H"); break; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":264 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" */ case NPY_INT: __pyx_v_f = ((char *)"i"); break; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":265 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" */ case NPY_UINT: __pyx_v_f = ((char *)"I"); break; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":266 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" */ case NPY_LONG: __pyx_v_f = ((char *)"l"); break; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":267 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" */ case NPY_ULONG: __pyx_v_f = ((char *)"L"); break; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":268 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" */ case NPY_LONGLONG: __pyx_v_f = ((char *)"q"); break; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":269 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" */ case NPY_ULONGLONG: __pyx_v_f = ((char *)"Q"); break; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":270 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" */ case NPY_FLOAT: __pyx_v_f = ((char *)"f"); break; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":271 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" */ case NPY_DOUBLE: __pyx_v_f = ((char *)"d"); break; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":272 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" */ case NPY_LONGDOUBLE: __pyx_v_f = ((char *)"g"); break; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":273 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" */ case NPY_CFLOAT: __pyx_v_f = ((char *)"Zf"); break; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":274 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" */ case NPY_CDOUBLE: __pyx_v_f = ((char *)"Zd"); break; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":275 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f = "O" * else: */ case NPY_CLONGDOUBLE: __pyx_v_f = ((char *)"Zg"); break; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":276 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ case NPY_OBJECT: __pyx_v_f = ((char *)"O"); break; default: /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":278 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 278, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 278, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 278, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 278, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_6, 0, 0, 0); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __PYX_ERR(1, 278, __pyx_L1_error) break; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":279 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< * return * else: */ __pyx_v_info->format = __pyx_v_f; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":280 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< * else: * info.format = <char*>stdlib.malloc(_buffer_format_string_len) */ __pyx_r = 0; goto __pyx_L0; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":255 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or */ } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":282 * return * else: * info.format = <char*>stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ /*else*/ { __pyx_v_info->format = ((char *)malloc(0xFF)); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":283 * else: * info.format = <char*>stdlib.malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":284 * info.format = <char*>stdlib.malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":285 * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 * f = _util_dtypestring(descr, info.format + 1, # <<<<<<<<<<<<<< * info.format + _buffer_format_string_len, * &offset) */ __pyx_t_7 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_7 == NULL)) __PYX_ERR(1, 285, __pyx_L1_error) __pyx_v_f = __pyx_t_7; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":288 * info.format + _buffer_format_string_len, * &offset) * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ (__pyx_v_f[0]) = '\x00'; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":197 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< * # This implementation of getbuffer is geared towards Cython * # requirements, and does not yet fullfill the PEP. */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; } goto __pyx_L2; __pyx_L0:; if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { __Pyx_GOTREF(Py_None); __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; } __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_descr); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":290 * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): * stdlib.free(info.format) */ /* Python wrapper */ static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__releasebuffer__", 0); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":291 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0); if (__pyx_t_1) { /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":292 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) */ free(__pyx_v_info->format); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":291 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":293 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * stdlib.free(info.strides) * # info.shape was stored after info.strides in the same block */ __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":294 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< * # info.shape was stored after info.strides in the same block * */ free(__pyx_v_info->strides); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":293 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * stdlib.free(info.strides) * # info.shape was stored after info.strides in the same block */ } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":290 * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): * stdlib.free(info.format) */ /* function exit code */ __Pyx_RefNannyFinishContext(); } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":770 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(1, <void*>a) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":771 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 771, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":770 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(1, <void*>a) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":773 * return PyArray_MultiIterNew(1, <void*>a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(2, <void*>a, <void*>b) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":774 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 774, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":773 * return PyArray_MultiIterNew(1, <void*>a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(2, <void*>a, <void*>b) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":776 * return PyArray_MultiIterNew(2, <void*>a, <void*>b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":777 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 777, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":776 * return PyArray_MultiIterNew(2, <void*>a, <void*>b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":779 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) * */ 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) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":780 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 780, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":779 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":782 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) * */ 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) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":783 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<< * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 783, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":782 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":785 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< * # Recursive utility function used in __getbuffer__ to get format * # string. The new location in the format string is returned. */ 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) { PyArray_Descr *__pyx_v_child = 0; int __pyx_v_endian_detector; int __pyx_v_little_endian; PyObject *__pyx_v_fields = 0; PyObject *__pyx_v_childname = NULL; PyObject *__pyx_v_new_offset = NULL; PyObject *__pyx_v_t = NULL; char *__pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; long __pyx_t_8; char *__pyx_t_9; __Pyx_RefNannySetupContext("_util_dtypestring", 0); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":790 * * cdef dtype child * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) * cdef tuple fields */ __pyx_v_endian_detector = 1; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":791 * cdef dtype child * cdef int endian_detector = 1 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * cdef tuple fields * */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ if (unlikely(__pyx_v_descr->names == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); __PYX_ERR(1, 794, __pyx_L1_error) } __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 794, __pyx_L1_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 794, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3); __pyx_t_3 = 0; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":795 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ if (unlikely(__pyx_v_descr->fields == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 795, __pyx_L1_error) } __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 795, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(1, 795, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3)); __pyx_t_3 = 0; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< * * if (end - f) - <int>(new_offset - offset[0]) < 15: */ if (likely(__pyx_v_fields != Py_None)) { PyObject* sequence = __pyx_v_fields; #if !CYTHON_COMPILING_IN_PYPY Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(1, 796, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); #else __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 796, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 796, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } else { __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 796, __pyx_L1_error) } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 796, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4); __pyx_t_4 = 0; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":798 * child, new_offset = fields * * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 798, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 798, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 798, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0); if (__pyx_t_6) { /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":799 * * if (end - f) - <int>(new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 799, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(1, 799, __pyx_L1_error) /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":798 * child, new_offset = fields * * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0); if (!__pyx_t_7) { goto __pyx_L8_next_or; } else { } __pyx_t_7 = (__pyx_v_little_endian != 0); if (!__pyx_t_7) { } else { __pyx_t_6 = __pyx_t_7; goto __pyx_L7_bool_binop_done; } __pyx_L8_next_or:; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":802 * * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0); if (__pyx_t_7) { } else { __pyx_t_6 = __pyx_t_7; goto __pyx_L7_bool_binop_done; } __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0); __pyx_t_6 = __pyx_t_7; __pyx_L7_bool_binop_done:; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ if (__pyx_t_6) { /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":803 * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 803, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(1, 803, __pyx_L1_error) /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< * f[0] = 120 # "x"; pad byte * f += 1 */ while (1) { __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 813, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 813, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 813, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (!__pyx_t_6) break; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< * f += 1 * offset[0] += 1 */ (__pyx_v_f[0]) = 0x78; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< * offset[0] += 1 * */ __pyx_v_f = (__pyx_v_f + 1); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ __pyx_t_8 = 0; (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1); } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ __pyx_t_8 = 0; (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0); if (__pyx_t_6) { /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":821 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 821, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4); __pyx_t_4 = 0; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":822 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0); if (__pyx_t_6) { /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 823, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(1, 823, __pyx_L1_error) /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":822 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":826 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 826, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 826, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 826, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 98; goto __pyx_L15; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":827 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 827, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 827, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 827, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 66; goto __pyx_L15; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":828 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 828, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 828, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 828, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x68; goto __pyx_L15; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":829 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 829, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 829, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 829, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 72; goto __pyx_L15; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":830 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 830, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 830, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 830, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x69; goto __pyx_L15; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":831 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 831, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 831, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 831, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 73; goto __pyx_L15; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":832 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 832, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 832, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 832, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x6C; goto __pyx_L15; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":833 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 833, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 833, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 833, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 76; goto __pyx_L15; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":834 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 834, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 834, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 834, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x71; goto __pyx_L15; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":835 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 835, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 835, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 835, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 81; goto __pyx_L15; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":836 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 836, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 836, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 836, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x66; goto __pyx_L15; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":837 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 837, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 837, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 837, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x64; goto __pyx_L15; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":838 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 838, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 838, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 838, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x67; goto __pyx_L15; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":839 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 839, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 839, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 839, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 0x66; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L15; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":840 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 840, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 840, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 840, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 0x64; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L15; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":841 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 841, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 841, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 841, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 0x67; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L15; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":842 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 842, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 842, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 842, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 79; goto __pyx_L15; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":844 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ /*else*/ { __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 844, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 844, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 844, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(1, 844, __pyx_L1_error) } __pyx_L15:; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< * else: * # Cython ignores struct boundary information ("T{...}"), */ __pyx_v_f = (__pyx_v_f + 1); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ goto __pyx_L13; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ /*else*/ { __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_ERR(1, 849, __pyx_L1_error) __pyx_v_f = __pyx_t_9; } __pyx_L13:; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< * * */ __pyx_r = __pyx_v_f; goto __pyx_L0; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":785 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< * # Recursive utility function used in __getbuffer__ to get format * # string. The new location in the format string is returned. */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_child); __Pyx_XDECREF(__pyx_v_fields); __Pyx_XDECREF(__pyx_v_childname); __Pyx_XDECREF(__pyx_v_new_offset); __Pyx_XDECREF(__pyx_v_t); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":966 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< * cdef PyObject* baseptr * if base is None: */ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; __Pyx_RefNannySetupContext("set_array_base", 0); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":968 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< * baseptr = NULL * else: */ __pyx_t_1 = (__pyx_v_base == Py_None); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":969 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< * else: * Py_INCREF(base) # important to do this before decref below! */ __pyx_v_baseptr = NULL; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":968 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< * baseptr = NULL * else: */ goto __pyx_L3; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":971 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< * baseptr = <PyObject*>base * Py_XDECREF(arr.base) */ /*else*/ { Py_INCREF(__pyx_v_base); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":972 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = <PyObject*>base # <<<<<<<<<<<<<< * Py_XDECREF(arr.base) * arr.base = baseptr */ __pyx_v_baseptr = ((PyObject *)__pyx_v_base); } __pyx_L3:; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":973 * Py_INCREF(base) # important to do this before decref below! * baseptr = <PyObject*>base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< * arr.base = baseptr * */ Py_XDECREF(__pyx_v_arr->base); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":974 * baseptr = <PyObject*>base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< * * cdef inline object get_array_base(ndarray arr): */ __pyx_v_arr->base = __pyx_v_baseptr; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":966 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< * cdef PyObject* baseptr * if base is None: */ /* function exit code */ __Pyx_RefNannyFinishContext(); } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":976 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * if arr.base is NULL: * return None */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("get_array_base", 0); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":977 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< * return None * else: */ __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0); if (__pyx_t_1) { /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":978 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< * else: * return <object>arr.base */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":977 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< * return None * else: */ } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":980 * return None * else: * return <object>arr.base # <<<<<<<<<<<<<< * * */ /*else*/ { __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); __pyx_r = ((PyObject *)__pyx_v_arr->base); goto __pyx_L0; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":976 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * if arr.base is NULL: * return None */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":985 * # Versions of the import_* functions which are more suitable for * # Cython code. * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< * try: * _import_array() */ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; __Pyx_RefNannySetupContext("import_array", 0); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":986 * # Cython code. * cdef inline int import_array() except -1: * try: # <<<<<<<<<<<<<< * _import_array() * except Exception: */ { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); __Pyx_XGOTREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":987 * cdef inline int import_array() except -1: * try: * _import_array() # <<<<<<<<<<<<<< * except Exception: * raise ImportError("numpy.core.multiarray failed to import") */ __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(1, 987, __pyx_L3_error) /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":986 * # Cython code. * cdef inline int import_array() except -1: * try: # <<<<<<<<<<<<<< * _import_array() * except Exception: */ } __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L10_try_end; __pyx_L3_error:; __Pyx_PyThreadState_assign /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":988 * try: * _import_array() * except Exception: # <<<<<<<<<<<<<< * raise ImportError("numpy.core.multiarray failed to import") * */ __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_4) { __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 988, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":989 * _import_array() * except Exception: * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_umath() except -1: */ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 989, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __PYX_ERR(1, 989, __pyx_L5_except_error) } goto __pyx_L5_except_error; __pyx_L5_except_error:; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":986 * # Cython code. * cdef inline int import_array() except -1: * try: # <<<<<<<<<<<<<< * _import_array() * except Exception: */ __Pyx_PyThreadState_assign __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); goto __pyx_L1_error; __pyx_L10_try_end:; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":985 * # Versions of the import_* functions which are more suitable for * # Cython code. * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< * try: * _import_array() */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":991 * raise ImportError("numpy.core.multiarray failed to import") * * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< * try: * _import_umath() */ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; __Pyx_RefNannySetupContext("import_umath", 0); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":992 * * cdef inline int import_umath() except -1: * try: # <<<<<<<<<<<<<< * _import_umath() * except Exception: */ { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); __Pyx_XGOTREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":993 * cdef inline int import_umath() except -1: * try: * _import_umath() # <<<<<<<<<<<<<< * except Exception: * raise ImportError("numpy.core.umath failed to import") */ __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(1, 993, __pyx_L3_error) /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":992 * * cdef inline int import_umath() except -1: * try: # <<<<<<<<<<<<<< * _import_umath() * except Exception: */ } __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L10_try_end; __pyx_L3_error:; __Pyx_PyThreadState_assign /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":994 * try: * _import_umath() * except Exception: # <<<<<<<<<<<<<< * raise ImportError("numpy.core.umath failed to import") * */ __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_4) { __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 994, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":995 * _import_umath() * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_ufunc() except -1: */ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 995, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __PYX_ERR(1, 995, __pyx_L5_except_error) } goto __pyx_L5_except_error; __pyx_L5_except_error:; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":992 * * cdef inline int import_umath() except -1: * try: # <<<<<<<<<<<<<< * _import_umath() * except Exception: */ __Pyx_PyThreadState_assign __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); goto __pyx_L1_error; __pyx_L10_try_end:; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":991 * raise ImportError("numpy.core.multiarray failed to import") * * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< * try: * _import_umath() */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":997 * raise ImportError("numpy.core.umath failed to import") * * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< * try: * _import_umath() */ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; __Pyx_RefNannySetupContext("import_ufunc", 0); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":998 * * cdef inline int import_ufunc() except -1: * try: # <<<<<<<<<<<<<< * _import_umath() * except Exception: */ { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); __Pyx_XGOTREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":999 * cdef inline int import_ufunc() except -1: * try: * _import_umath() # <<<<<<<<<<<<<< * except Exception: * raise ImportError("numpy.core.umath failed to import") */ __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(1, 999, __pyx_L3_error) /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":998 * * cdef inline int import_ufunc() except -1: * try: # <<<<<<<<<<<<<< * _import_umath() * except Exception: */ } __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L10_try_end; __pyx_L3_error:; __Pyx_PyThreadState_assign /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":1000 * try: * _import_umath() * except Exception: # <<<<<<<<<<<<<< * raise ImportError("numpy.core.umath failed to import") */ __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_4) { __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1000, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":1001 * _import_umath() * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< */ __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1001, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __PYX_ERR(1, 1001, __pyx_L5_except_error) } goto __pyx_L5_except_error; __pyx_L5_except_error:; /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":998 * * cdef inline int import_ufunc() except -1: * try: # <<<<<<<<<<<<<< * _import_umath() * except Exception: */ __Pyx_PyThreadState_assign __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); goto __pyx_L1_error; __pyx_L10_try_end:; } /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":997 * raise ImportError("numpy.core.umath failed to import") * * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< * try: * _import_umath() */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "FromPyStructUtility":11 * * @cname("__pyx_convert__from_py_struct__racecar_simulator_3a__3a_Pose2D") * cdef Pose2D __pyx_convert__from_py_struct__racecar_simulator_3a__3a_Pose2D(obj) except *: # <<<<<<<<<<<<<< * cdef Pose2D result * if not PyMapping_Check(obj): */ static struct racecar_simulator::Pose2D __pyx_convert__from_py_struct__racecar_simulator_3a__3a_Pose2D(PyObject *__pyx_v_obj) { struct racecar_simulator::Pose2D __pyx_v_result; PyObject *__pyx_v_value = NULL; struct racecar_simulator::Pose2D __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; double __pyx_t_10; __Pyx_RefNannySetupContext("__pyx_convert__from_py_struct__racecar_simulator_3a__3a_Pose2D", 0); /* "FromPyStructUtility":13 * cdef Pose2D __pyx_convert__from_py_struct__racecar_simulator_3a__3a_Pose2D(obj) except *: * cdef Pose2D result * if not PyMapping_Check(obj): # <<<<<<<<<<<<<< * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) * */ __pyx_t_1 = ((!(PyMapping_Check(__pyx_v_obj) != 0)) != 0); if (__pyx_t_1) { /* "FromPyStructUtility":14 * cdef Pose2D result * if not PyMapping_Check(obj): * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) # <<<<<<<<<<<<<< * * try: */ __pyx_t_2 = PyErr_Format(__pyx_builtin_TypeError, ((char const *)"Expected %.16s, got %.200s"), ((char *)"a mapping"), Py_TYPE(__pyx_v_obj)->tp_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "FromPyStructUtility":13 * cdef Pose2D __pyx_convert__from_py_struct__racecar_simulator_3a__3a_Pose2D(obj) except *: * cdef Pose2D result * if not PyMapping_Check(obj): # <<<<<<<<<<<<<< * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) * */ } /* "FromPyStructUtility":16 * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) * * try: # <<<<<<<<<<<<<< * value = obj['x'] * except KeyError: */ { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); __Pyx_XGOTREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_t_4); __Pyx_XGOTREF(__pyx_t_5); /*try:*/ { /* "FromPyStructUtility":17 * * try: * value = obj['x'] # <<<<<<<<<<<<<< * except KeyError: * raise ValueError("No value specified for struct attribute 'x'") */ __pyx_t_2 = PyObject_GetItem(__pyx_v_obj, __pyx_n_s_x); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 17, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_value = __pyx_t_2; __pyx_t_2 = 0; /* "FromPyStructUtility":16 * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) * * try: # <<<<<<<<<<<<<< * value = obj['x'] * except KeyError: */ } __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L11_try_end; __pyx_L4_error:; __Pyx_PyThreadState_assign __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; /* "FromPyStructUtility":18 * try: * value = obj['x'] * except KeyError: # <<<<<<<<<<<<<< * raise ValueError("No value specified for struct attribute 'x'") * result.x = value */ __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError); if (__pyx_t_6) { __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__racecar_simulator_3a__3a_Pose2D", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(2, 18, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_8); /* "FromPyStructUtility":19 * value = obj['x'] * except KeyError: * raise ValueError("No value specified for struct attribute 'x'") # <<<<<<<<<<<<<< * result.x = value * try: */ __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 19, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_Raise(__pyx_t_9, 0, 0, 0); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __PYX_ERR(2, 19, __pyx_L6_except_error) } goto __pyx_L6_except_error; __pyx_L6_except_error:; /* "FromPyStructUtility":16 * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) * * try: # <<<<<<<<<<<<<< * value = obj['x'] * except KeyError: */ __Pyx_PyThreadState_assign __Pyx_XGIVEREF(__pyx_t_3); __Pyx_XGIVEREF(__pyx_t_4); __Pyx_XGIVEREF(__pyx_t_5); __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); goto __pyx_L1_error; __pyx_L11_try_end:; } /* "FromPyStructUtility":20 * except KeyError: * raise ValueError("No value specified for struct attribute 'x'") * result.x = value # <<<<<<<<<<<<<< * try: * value = obj['y'] */ __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(2, 20, __pyx_L1_error) __pyx_v_result.x = __pyx_t_10; /* "FromPyStructUtility":21 * raise ValueError("No value specified for struct attribute 'x'") * result.x = value * try: # <<<<<<<<<<<<<< * value = obj['y'] * except KeyError: */ { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3); __Pyx_XGOTREF(__pyx_t_5); __Pyx_XGOTREF(__pyx_t_4); __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { /* "FromPyStructUtility":22 * result.x = value * try: * value = obj['y'] # <<<<<<<<<<<<<< * except KeyError: * raise ValueError("No value specified for struct attribute 'y'") */ __pyx_t_8 = PyObject_GetItem(__pyx_v_obj, __pyx_n_s_y); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 22, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_8); __pyx_t_8 = 0; /* "FromPyStructUtility":21 * raise ValueError("No value specified for struct attribute 'x'") * result.x = value * try: # <<<<<<<<<<<<<< * value = obj['y'] * except KeyError: */ } __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L21_try_end; __pyx_L14_error:; __Pyx_PyThreadState_assign __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; /* "FromPyStructUtility":23 * try: * value = obj['y'] * except KeyError: # <<<<<<<<<<<<<< * raise ValueError("No value specified for struct attribute 'y'") * result.y = value */ __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError); if (__pyx_t_6) { __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__racecar_simulator_3a__3a_Pose2D", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_2) < 0) __PYX_ERR(2, 23, __pyx_L16_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_2); /* "FromPyStructUtility":24 * value = obj['y'] * except KeyError: * raise ValueError("No value specified for struct attribute 'y'") # <<<<<<<<<<<<<< * result.y = value * try: */ __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 24, __pyx_L16_except_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_Raise(__pyx_t_9, 0, 0, 0); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __PYX_ERR(2, 24, __pyx_L16_except_error) } goto __pyx_L16_except_error; __pyx_L16_except_error:; /* "FromPyStructUtility":21 * raise ValueError("No value specified for struct attribute 'x'") * result.x = value * try: # <<<<<<<<<<<<<< * value = obj['y'] * except KeyError: */ __Pyx_PyThreadState_assign __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_4); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3); goto __pyx_L1_error; __pyx_L21_try_end:; } /* "FromPyStructUtility":25 * except KeyError: * raise ValueError("No value specified for struct attribute 'y'") * result.y = value # <<<<<<<<<<<<<< * try: * value = obj['theta'] */ __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(2, 25, __pyx_L1_error) __pyx_v_result.y = __pyx_t_10; /* "FromPyStructUtility":26 * raise ValueError("No value specified for struct attribute 'y'") * result.y = value * try: # <<<<<<<<<<<<<< * value = obj['theta'] * except KeyError: */ { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); __Pyx_XGOTREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_t_4); __Pyx_XGOTREF(__pyx_t_5); /*try:*/ { /* "FromPyStructUtility":27 * result.y = value * try: * value = obj['theta'] # <<<<<<<<<<<<<< * except KeyError: * raise ValueError("No value specified for struct attribute 'theta'") */ __pyx_t_2 = PyObject_GetItem(__pyx_v_obj, __pyx_n_s_theta); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 27, __pyx_L24_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2); __pyx_t_2 = 0; /* "FromPyStructUtility":26 * raise ValueError("No value specified for struct attribute 'y'") * result.y = value * try: # <<<<<<<<<<<<<< * value = obj['theta'] * except KeyError: */ } __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L31_try_end; __pyx_L24_error:; __Pyx_PyThreadState_assign __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; /* "FromPyStructUtility":28 * try: * value = obj['theta'] * except KeyError: # <<<<<<<<<<<<<< * raise ValueError("No value specified for struct attribute 'theta'") * result.theta = value */ __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError); if (__pyx_t_6) { __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__racecar_simulator_3a__3a_Pose2D", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(2, 28, __pyx_L26_except_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_8); /* "FromPyStructUtility":29 * value = obj['theta'] * except KeyError: * raise ValueError("No value specified for struct attribute 'theta'") # <<<<<<<<<<<<<< * result.theta = value * return result */ __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 29, __pyx_L26_except_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_Raise(__pyx_t_9, 0, 0, 0); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __PYX_ERR(2, 29, __pyx_L26_except_error) } goto __pyx_L26_except_error; __pyx_L26_except_error:; /* "FromPyStructUtility":26 * raise ValueError("No value specified for struct attribute 'y'") * result.y = value * try: # <<<<<<<<<<<<<< * value = obj['theta'] * except KeyError: */ __Pyx_PyThreadState_assign __Pyx_XGIVEREF(__pyx_t_3); __Pyx_XGIVEREF(__pyx_t_4); __Pyx_XGIVEREF(__pyx_t_5); __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); goto __pyx_L1_error; __pyx_L31_try_end:; } /* "FromPyStructUtility":30 * except KeyError: * raise ValueError("No value specified for struct attribute 'theta'") * result.theta = value # <<<<<<<<<<<<<< * return result * */ __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(2, 30, __pyx_L1_error) __pyx_v_result.theta = __pyx_t_10; /* "FromPyStructUtility":31 * raise ValueError("No value specified for struct attribute 'theta'") * result.theta = value * return result # <<<<<<<<<<<<<< * * */ __pyx_r = __pyx_v_result; goto __pyx_L0; /* "FromPyStructUtility":11 * * @cname("__pyx_convert__from_py_struct__racecar_simulator_3a__3a_Pose2D") * cdef Pose2D __pyx_convert__from_py_struct__racecar_simulator_3a__3a_Pose2D(obj) except *: # <<<<<<<<<<<<<< * cdef Pose2D result * if not PyMapping_Check(obj): */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__racecar_simulator_3a__3a_Pose2D", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_v_value); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_tp_new_17scan_simulator_2d_PyScanSimulator2D(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { o = (*t->tp_alloc)(t, 0); } else { o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; return o; } static void __pyx_tp_dealloc_17scan_simulator_2d_PyScanSimulator2D(PyObject *o) { #if PY_VERSION_HEX >= 0x030400a1 if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); __pyx_pw_17scan_simulator_2d_17PyScanSimulator2D_3__dealloc__(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } (*Py_TYPE(o)->tp_free)(o); } static PyMethodDef __pyx_methods_17scan_simulator_2d_PyScanSimulator2D[] = { {"set_map", (PyCFunction)__pyx_pw_17scan_simulator_2d_17PyScanSimulator2D_5set_map, METH_VARARGS|METH_KEYWORDS, 0}, {"scan", (PyCFunction)__pyx_pw_17scan_simulator_2d_17PyScanSimulator2D_7scan, METH_O, 0}, {0, 0, 0, 0} }; static PyTypeObject __pyx_type_17scan_simulator_2d_PyScanSimulator2D = { PyVarObject_HEAD_INIT(0, 0) "scan_simulator_2d.PyScanSimulator2D", /*tp_name*/ sizeof(struct __pyx_obj_17scan_simulator_2d_PyScanSimulator2D), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_17scan_simulator_2d_PyScanSimulator2D, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #endif #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_17scan_simulator_2d_PyScanSimulator2D, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_pw_17scan_simulator_2d_17PyScanSimulator2D_1__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_17scan_simulator_2d_PyScanSimulator2D, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { #if PY_VERSION_HEX < 0x03020000 { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, #else PyModuleDef_HEAD_INIT, #endif "scan_simulator_2d", 0, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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}, {&__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}, {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1}, {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1}, {&__pyx_kp_s_No_value_specified_for_struct_at, __pyx_k_No_value_specified_for_struct_at, sizeof(__pyx_k_No_value_specified_for_struct_at), 0, 0, 1, 0}, {&__pyx_kp_s_No_value_specified_for_struct_at_2, __pyx_k_No_value_specified_for_struct_at_2, sizeof(__pyx_k_No_value_specified_for_struct_at_2), 0, 0, 1, 0}, {&__pyx_kp_s_No_value_specified_for_struct_at_3, __pyx_k_No_value_specified_for_struct_at_3, sizeof(__pyx_k_No_value_specified_for_struct_at_3), 0, 0, 1, 0}, {&__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}, {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, {&__pyx_n_s_double, __pyx_k_double, sizeof(__pyx_k_double), 0, 0, 1, 1}, {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1}, {&__pyx_n_s_field_of_view, __pyx_k_field_of_view, sizeof(__pyx_k_field_of_view), 0, 0, 1, 1}, {&__pyx_n_s_free_threshold, __pyx_k_free_threshold, sizeof(__pyx_k_free_threshold), 0, 0, 1, 1}, {&__pyx_n_s_height, __pyx_k_height, sizeof(__pyx_k_height), 0, 0, 1, 1}, {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, {&__pyx_n_s_map_np, __pyx_k_map_np, sizeof(__pyx_k_map_np), 0, 0, 1, 1}, {&__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}, {&__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}, {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, {&__pyx_n_s_num_beams, __pyx_k_num_beams, sizeof(__pyx_k_num_beams), 0, 0, 1, 1}, {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0}, {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0}, {&__pyx_n_s_origin_tuple, __pyx_k_origin_tuple, sizeof(__pyx_k_origin_tuple), 0, 0, 1, 1}, {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, {&__pyx_n_s_ray_tracing_epsilon, __pyx_k_ray_tracing_epsilon, sizeof(__pyx_k_ray_tracing_epsilon), 0, 0, 1, 1}, {&__pyx_n_s_resolution, __pyx_k_resolution, sizeof(__pyx_k_resolution), 0, 0, 1, 1}, {&__pyx_n_s_scan_std_dev, __pyx_k_scan_std_dev, sizeof(__pyx_k_scan_std_dev), 0, 0, 1, 1}, {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, {&__pyx_n_s_theta, __pyx_k_theta, sizeof(__pyx_k_theta), 0, 0, 1, 1}, {&__pyx_n_s_theta_discretization, __pyx_k_theta_discretization, sizeof(__pyx_k_theta_discretization), 0, 0, 1, 1}, {&__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}, {&__pyx_n_s_width, __pyx_k_width, sizeof(__pyx_k_width), 0, 0, 1, 1}, {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1}, {&__pyx_n_s_xrange, __pyx_k_xrange, sizeof(__pyx_k_xrange), 0, 0, 1, 1}, {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { #if PY_MAJOR_VERSION >= 3 __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_xrange) __PYX_ERR(0, 85, __pyx_L1_error) #else __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s_xrange); if (!__pyx_builtin_xrange) __PYX_ERR(0, 85, __pyx_L1_error) #endif __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 218, __pyx_L1_error) __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(1, 231, __pyx_L1_error) __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 799, __pyx_L1_error) __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 989, __pyx_L1_error) __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(2, 14, __pyx_L1_error) __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(2, 18, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":218 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 218, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":222 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":259 * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 259, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":799 * * if (end - f) - <int>(new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 799, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":803 * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 803, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__5); __Pyx_GIVEREF(__pyx_tuple__5); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 823, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__6); __Pyx_GIVEREF(__pyx_tuple__6); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":989 * _import_array() * except Exception: * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_umath() except -1: */ __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 989, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__7); __Pyx_GIVEREF(__pyx_tuple__7); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":995 * _import_umath() * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_ufunc() except -1: */ __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 995, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8); /* "../../../../../../../usr/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":1001 * _import_umath() * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< */ __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 1001, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9); /* "FromPyStructUtility":19 * value = obj['x'] * except KeyError: * raise ValueError("No value specified for struct attribute 'x'") # <<<<<<<<<<<<<< * result.x = value * try: */ __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); /* "FromPyStructUtility":24 * value = obj['y'] * except KeyError: * raise ValueError("No value specified for struct attribute 'y'") # <<<<<<<<<<<<<< * result.y = value * try: */ __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_2); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(2, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__11); __Pyx_GIVEREF(__pyx_tuple__11); /* "FromPyStructUtility":29 * value = obj['theta'] * except KeyError: * raise ValueError("No value specified for struct attribute 'theta'") # <<<<<<<<<<<<<< * result.theta = value * return result */ __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_3); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(2, 29, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12); __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); return 0; __pyx_L1_error:; return -1; } #if PY_MAJOR_VERSION < 3 PyMODINIT_FUNC initscan_simulator_2d(void); /*proto*/ PyMODINIT_FUNC initscan_simulator_2d(void) #else PyMODINIT_FUNC PyInit_scan_simulator_2d(void); /*proto*/ PyMODINIT_FUNC PyInit_scan_simulator_2d(void) #endif { PyObject *__pyx_t_1 = NULL; __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } #endif __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_scan_simulator_2d(void)", 0); if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) #ifdef __Pyx_CyFunction_USED if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_FusedFunction_USED if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Coroutine_USED if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Generator_USED if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_StopAsyncIteration_USED if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS #ifdef WITH_THREAD /* Python build with threading support? */ PyEval_InitThreads(); #endif #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4("scan_simulator_2d", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) Py_INCREF(__pyx_d); __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) #if CYTHON_COMPILING_IN_PYPY Py_INCREF(__pyx_b); #endif if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); /*--- Initialize various global constants etc. ---*/ if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif if (__pyx_module_is_main_scan_simulator_2d) { if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) } #if PY_MAJOR_VERSION >= 3 { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) if (!PyDict_GetItemString(modules, "scan_simulator_2d")) { if (unlikely(PyDict_SetItemString(modules, "scan_simulator_2d", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) } } #endif /*--- Builtin init code ---*/ if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Constants init code ---*/ if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Global init code ---*/ /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ if (PyType_Ready(&__pyx_type_17scan_simulator_2d_PyScanSimulator2D) < 0) __PYX_ERR(0, 33, __pyx_L1_error) __pyx_type_17scan_simulator_2d_PyScanSimulator2D.tp_print = 0; if (PyObject_SetAttrString(__pyx_m, "PyScanSimulator2D", (PyObject *)&__pyx_type_17scan_simulator_2d_PyScanSimulator2D) < 0) __PYX_ERR(0, 33, __pyx_L1_error) __pyx_ptype_17scan_simulator_2d_PyScanSimulator2D = &__pyx_type_17scan_simulator_2d_PyScanSimulator2D; /*--- Type import code ---*/ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", #if CYTHON_COMPILING_IN_PYPY sizeof(PyTypeObject), #else sizeof(PyHeapTypeObject), #endif 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(3, 9, __pyx_L1_error) __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) __PYX_ERR(1, 155, __pyx_L1_error) __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) __PYX_ERR(1, 168, __pyx_L1_error) __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) __PYX_ERR(1, 172, __pyx_L1_error) __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) __PYX_ERR(1, 181, __pyx_L1_error) __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) __PYX_ERR(1, 861, __pyx_L1_error) /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif /* "scan_simulator_2d.pyx":2 * import cython * import numpy as np # <<<<<<<<<<<<<< * cimport numpy as np * from libcpp.vector cimport vector */ __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "scan_simulator_2d.pyx":1 * import cython # <<<<<<<<<<<<<< * import numpy as np * cimport numpy as np */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "FromPyStructUtility":11 * * @cname("__pyx_convert__from_py_struct__racecar_simulator_3a__3a_Pose2D") * cdef Pose2D __pyx_convert__from_py_struct__racecar_simulator_3a__3a_Pose2D(obj) except *: # <<<<<<<<<<<<<< * cdef Pose2D result * if not PyMapping_Check(obj): */ /*--- Wrapped vars code ---*/ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); if (__pyx_m) { if (__pyx_d) { __Pyx_AddTraceback("init scan_simulator_2d", __pyx_clineno, __pyx_lineno, __pyx_filename); } Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init scan_simulator_2d"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif } /* --- Runtime support code --- */ /* Refnanny */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule((char *)modname); if (!m) goto end; p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #endif /* GetBuiltinName */ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); if (unlikely(!result)) { PyErr_Format(PyExc_NameError, #if PY_MAJOR_VERSION >= 3 "name '%U' is not defined", name); #else "name '%.200s' is not defined", PyString_AS_STRING(name)); #endif } return result; } /* RaiseArgTupleInvalid */ static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found) { Py_ssize_t num_expected; const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; } else { num_expected = num_max; more_or_less = "at most"; } if (exact) { more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } /* RaiseDoubleKeywords */ static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION >= 3 "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, PyString_AsString(kw_name)); #endif } /* ParseKeywords */ static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject *key = 0, *value = 0; Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; continue; } name = first_kw_arg; #if PY_MAJOR_VERSION < 3 if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { while (*name) { if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) && _PyString_Eq(**name, key)) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { if ((**argname == key) || ( (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) && _PyString_Eq(**argname, key))) { goto arg_passed_twice; } argname++; } } } else #endif if (likely(PyUnicode_Check(key))) { while (*name) { int cmp = (**name == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**name, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { int cmp = (**argname == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**argname, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) goto arg_passed_twice; argname++; } } } else goto invalid_keyword_type; if (kwds2) { if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else { goto invalid_keyword; } } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%.200s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%.200s() got an unexpected keyword argument '%.200s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: return -1; } /* ArgTypeTest */ static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) { PyErr_Format(PyExc_TypeError, "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", name, type->tp_name, Py_TYPE(obj)->tp_name); } static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact) { if (unlikely(!type)) { PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; } if (none_allowed && obj == Py_None) return 1; else if (exact) { if (likely(Py_TYPE(obj) == type)) return 1; #if PY_MAJOR_VERSION == 2 else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; #endif } else { if (likely(PyObject_TypeCheck(obj, type))) return 1; } __Pyx_RaiseArgumentTypeInvalid(name, obj, type); return 0; } /* BufferFormatCheck */ static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { unsigned int n = 1; return *(unsigned char*)(&n) != 0; } static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, __Pyx_BufFmt_StackElem* stack, __Pyx_TypeInfo* type) { stack[0].field = &ctx->root; stack[0].parent_offset = 0; ctx->root.type = type; ctx->root.name = "buffer dtype"; ctx->root.offset = 0; ctx->head = stack; ctx->head->field = &ctx->root; ctx->fmt_offset = 0; ctx->head->parent_offset = 0; ctx->new_packmode = '@'; ctx->enc_packmode = '@'; ctx->new_count = 1; ctx->enc_count = 0; ctx->enc_type = 0; ctx->is_complex = 0; ctx->is_valid_array = 0; ctx->struct_alignment = 0; while (type->typegroup == 'S') { ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = 0; type = type->fields->type; } } static int __Pyx_BufFmt_ParseNumber(const char** ts) { int count; const char* t = *ts; if (*t < '0' || *t > '9') { return -1; } else { count = *t++ - '0'; while (*t >= '0' && *t < '9') { count *= 10; count += *t++ - '0'; } } *ts = t; return count; } static int __Pyx_BufFmt_ExpectNumber(const char **ts) { int number = __Pyx_BufFmt_ParseNumber(ts); if (number == -1) PyErr_Format(PyExc_ValueError,\ "Does not understand character buffer dtype format string ('%c')", **ts); return number; } static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%c'", ch); } static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { switch (ch) { case 'c': return "'char'"; case 'b': return "'signed char'"; case 'B': return "'unsigned char'"; case 'h': return "'short'"; case 'H': return "'unsigned short'"; case 'i': return "'int'"; case 'I': return "'unsigned int'"; case 'l': return "'long'"; case 'L': return "'unsigned long'"; case 'q': return "'long long'"; case 'Q': return "'unsigned long long'"; case 'f': return (is_complex ? "'complex float'" : "'float'"); case 'd': return (is_complex ? "'complex double'" : "'double'"); case 'g': return (is_complex ? "'complex long double'" : "'long double'"); case 'T': return "a struct"; case 'O': return "Python object"; case 'P': return "a pointer"; case 's': case 'p': return "a string"; case 0: return "end"; default: return "unparseable format string"; } } static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return 2; case 'i': case 'I': case 'l': case 'L': return 4; case 'q': case 'Q': return 8; case 'f': return (is_complex ? 8 : 4); case 'd': return (is_complex ? 16 : 8); case 'g': { PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); return 0; } case 'O': case 'P': return sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { switch (ch) { case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(short); case 'i': case 'I': return sizeof(int); case 'l': case 'L': return sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(float) * (is_complex ? 2 : 1); case 'd': return sizeof(double) * (is_complex ? 2 : 1); case 'g': return sizeof(long double) * (is_complex ? 2 : 1); case 'O': case 'P': return sizeof(void*); default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } } typedef struct { char c; short x; } __Pyx_st_short; typedef struct { char c; int x; } __Pyx_st_int; typedef struct { char c; long x; } __Pyx_st_long; typedef struct { char c; float x; } __Pyx_st_float; typedef struct { char c; double x; } __Pyx_st_double; typedef struct { char c; long double x; } __Pyx_st_longdouble; typedef struct { char c; void *x; } __Pyx_st_void_p; #ifdef HAVE_LONG_LONG typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; #endif static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(__Pyx_st_float) - sizeof(float); case 'd': return sizeof(__Pyx_st_double) - sizeof(double); case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } /* These are for computing the padding at the end of the struct to align on the first member of the struct. This will probably the same as above, but we don't have any guarantees. */ typedef struct { short x; char c; } __Pyx_pad_short; typedef struct { int x; char c; } __Pyx_pad_int; typedef struct { long x; char c; } __Pyx_pad_long; typedef struct { float x; char c; } __Pyx_pad_float; typedef struct { double x; char c; } __Pyx_pad_double; typedef struct { long double x; char c; } __Pyx_pad_longdouble; typedef struct { void *x; char c; } __Pyx_pad_void_p; #ifdef HAVE_LONG_LONG typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; #endif static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { switch (ch) { case 'c': return 'H'; case 'b': case 'h': case 'i': case 'l': case 'q': case 's': case 'p': return 'I'; case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U'; case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R'); case 'O': return 'O'; case 'P': return 'P'; default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } } static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { if (ctx->head == NULL || ctx->head->field == &ctx->root) { const char* expected; const char* quote; if (ctx->head == NULL) { expected = "end"; quote = ""; } else { expected = ctx->head->field->type->name; quote = "'"; } PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch, expected %s%s%s but got %s", quote, expected, quote, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); } else { __Pyx_StructField* field = ctx->head->field; __Pyx_StructField* parent = (ctx->head - 1)->field; PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), parent->type->name, field->name); } } static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { char group; size_t size, offset, arraysize = 1; if (ctx->enc_type == 0) return 0; if (ctx->head->field->type->arraysize[0]) { int i, ndim = 0; if (ctx->enc_type == 's' || ctx->enc_type == 'p') { ctx->is_valid_array = ctx->head->field->type->ndim == 1; ndim = 1; if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { PyErr_Format(PyExc_ValueError, "Expected a dimension of size %zu, got %zu", ctx->head->field->type->arraysize[0], ctx->enc_count); return -1; } } if (!ctx->is_valid_array) { PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", ctx->head->field->type->ndim, ndim); return -1; } for (i = 0; i < ctx->head->field->type->ndim; i++) { arraysize *= ctx->head->field->type->arraysize[i]; } ctx->is_valid_array = 0; ctx->enc_count = 1; } group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); do { __Pyx_StructField* field = ctx->head->field; __Pyx_TypeInfo* type = field->type; if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); } else { size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); } if (ctx->enc_packmode == '@') { size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); size_t align_mod_offset; if (align_at == 0) return -1; align_mod_offset = ctx->fmt_offset % align_at; if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; if (ctx->struct_alignment == 0) ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, ctx->is_complex); } if (type->size != size || type->typegroup != group) { if (type->typegroup == 'C' && type->fields != NULL) { size_t parent_offset = ctx->head->parent_offset + field->offset; ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = parent_offset; continue; } if ((type->typegroup == 'H' || group == 'H') && type->size == size) { } else { __Pyx_BufFmt_RaiseExpected(ctx); return -1; } } offset = ctx->head->parent_offset + field->offset; if (ctx->fmt_offset != offset) { PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); return -1; } ctx->fmt_offset += size; if (arraysize) ctx->fmt_offset += (arraysize - 1) * size; --ctx->enc_count; while (1) { if (field == &ctx->root) { ctx->head = NULL; if (ctx->enc_count != 0) { __Pyx_BufFmt_RaiseExpected(ctx); return -1; } break; } ctx->head->field = ++field; if (field->type == NULL) { --ctx->head; field = ctx->head->field; continue; } else if (field->type->typegroup == 'S') { size_t parent_offset = ctx->head->parent_offset + field->offset; if (field->type->fields->type == NULL) continue; field = field->type->fields; ++ctx->head; ctx->head->field = field; ctx->head->parent_offset = parent_offset; break; } else { break; } } } while (ctx->enc_count); ctx->enc_type = 0; ctx->is_complex = 0; return 0; } static CYTHON_INLINE PyObject * __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) { const char *ts = *tsp; int i = 0, number; int ndim = ctx->head->field->type->ndim; ; ++ts; if (ctx->new_count != 1) { PyErr_SetString(PyExc_ValueError, "Cannot handle repeated arrays in format string"); return NULL; } if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; while (*ts && *ts != ')') { switch (*ts) { case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue; default: break; } number = __Pyx_BufFmt_ExpectNumber(&ts); if (number == -1) return NULL; if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) return PyErr_Format(PyExc_ValueError, "Expected a dimension of size %zu, got %d", ctx->head->field->type->arraysize[i], number); if (*ts != ',' && *ts != ')') return PyErr_Format(PyExc_ValueError, "Expected a comma in format string, got '%c'", *ts); if (*ts == ',') ts++; i++; } if (i != ndim) return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", ctx->head->field->type->ndim, i); if (!*ts) { PyErr_SetString(PyExc_ValueError, "Unexpected end of format string, expected ')'"); return NULL; } ctx->is_valid_array = 1; ctx->new_count = 1; *tsp = ++ts; return Py_None; } static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { int got_Z = 0; while (1) { switch(*ts) { case 0: if (ctx->enc_type != 0 && ctx->head == NULL) { __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; if (ctx->head != NULL) { __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } return ts; case ' ': case '\r': case '\n': ++ts; break; case '<': if (!__Pyx_IsLittleEndian()) { PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); return NULL; } ctx->new_packmode = '='; ++ts; break; case '>': case '!': if (__Pyx_IsLittleEndian()) { PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); return NULL; } ctx->new_packmode = '='; ++ts; break; case '=': case '@': case '^': ctx->new_packmode = *ts++; break; case 'T': { const char* ts_after_sub; size_t i, struct_count = ctx->new_count; size_t struct_alignment = ctx->struct_alignment; ctx->new_count = 1; ++ts; if (*ts != '{') { PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); return NULL; } if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_type = 0; ctx->enc_count = 0; ctx->struct_alignment = 0; ++ts; ts_after_sub = ts; for (i = 0; i != struct_count; ++i) { ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); if (!ts_after_sub) return NULL; } ts = ts_after_sub; if (struct_alignment) ctx->struct_alignment = struct_alignment; } break; case '}': { size_t alignment = ctx->struct_alignment; ++ts; if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_type = 0; if (alignment && ctx->fmt_offset % alignment) { ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); } } return ts; case 'x': if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->fmt_offset += ctx->new_count; ctx->new_count = 1; ctx->enc_count = 0; ctx->enc_type = 0; ctx->enc_packmode = ctx->new_packmode; ++ts; break; case 'Z': got_Z = 1; ++ts; if (*ts != 'f' && *ts != 'd' && *ts != 'g') { __Pyx_BufFmt_RaiseUnexpectedChar('Z'); return NULL; } case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': case 'l': case 'L': case 'q': case 'Q': case 'f': case 'd': case 'g': case 'O': case 'p': if (ctx->enc_type == *ts && got_Z == ctx->is_complex && ctx->enc_packmode == ctx->new_packmode) { ctx->enc_count += ctx->new_count; ctx->new_count = 1; got_Z = 0; ++ts; break; } case 's': if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_count = ctx->new_count; ctx->enc_packmode = ctx->new_packmode; ctx->enc_type = *ts; ctx->is_complex = got_Z; ++ts; ctx->new_count = 1; got_Z = 0; break; case ':': ++ts; while(*ts != ':') ++ts; ++ts; break; case '(': if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; break; default: { int number = __Pyx_BufFmt_ExpectNumber(&ts); if (number == -1) return NULL; ctx->new_count = (size_t)number; } } } } static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { buf->buf = NULL; buf->obj = NULL; buf->strides = __Pyx_zeros; buf->shape = __Pyx_zeros; buf->suboffsets = __Pyx_minusones; } static CYTHON_INLINE int __Pyx_GetBufferAndValidate( Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) { if (obj == Py_None || obj == NULL) { __Pyx_ZeroBuffer(buf); return 0; } buf->buf = NULL; if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; if (buf->ndim != nd) { PyErr_Format(PyExc_ValueError, "Buffer has wrong number of dimensions (expected %d, got %d)", nd, buf->ndim); goto fail; } if (!cast) { __Pyx_BufFmt_Context ctx; __Pyx_BufFmt_Init(&ctx, stack, dtype); if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; } if ((unsigned)buf->itemsize != dtype->size) { PyErr_Format(PyExc_ValueError, "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", buf->itemsize, (buf->itemsize > 1) ? "s" : "", dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); goto fail; } if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; return 0; fail:; __Pyx_ZeroBuffer(buf); return -1; } static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { if (info->buf == NULL) return; if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; __Pyx_ReleaseBuffer(info); } /* BufferIndexError */ static void __Pyx_RaiseBufferIndexError(int axis) { PyErr_Format(PyExc_IndexError, "Out of bounds on buffer access (axis %d)", axis); } /* PyErrFetchRestore */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; tstate->curexc_type = type; tstate->curexc_value = value; tstate->curexc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); } static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; } #endif /* GetModuleGlobalName */ static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { PyObject *result; #if !CYTHON_AVOID_BORROWED_REFS result = PyDict_GetItem(__pyx_d, name); if (likely(result)) { Py_INCREF(result); } else { #else result = PyObject_GetItem(__pyx_d, name); if (!result) { PyErr_Clear(); #endif result = __Pyx_GetBuiltinName(name); } return result; } /* PyFunctionFastCall */ #if CYTHON_FAST_PYCALL #include "frameobject.h" static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, PyObject *globals) { PyFrameObject *f; PyThreadState *tstate = PyThreadState_GET(); PyObject **fastlocals; Py_ssize_t i; PyObject *result; assert(globals != NULL); /* XXX Perhaps we should create a specialized PyFrame_New() that doesn't take locals, but does take builtins without sanity checking them. */ assert(tstate != NULL); f = PyFrame_New(tstate, co, globals, NULL); if (f == NULL) { return NULL; } fastlocals = f->f_localsplus; for (i = 0; i < na; i++) { Py_INCREF(*args); fastlocals[i] = *args++; } result = PyEval_EvalFrameEx(f,0); ++tstate->recursion_depth; Py_DECREF(f); --tstate->recursion_depth; return result; } #if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) { PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); PyObject *globals = PyFunction_GET_GLOBALS(func); PyObject *argdefs = PyFunction_GET_DEFAULTS(func); PyObject *closure; #if PY_MAJOR_VERSION >= 3 PyObject *kwdefs; #endif PyObject *kwtuple, **k; PyObject **d; Py_ssize_t nd; Py_ssize_t nk; PyObject *result; assert(kwargs == NULL || PyDict_Check(kwargs)); nk = kwargs ? PyDict_Size(kwargs) : 0; if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { return NULL; } if ( #if PY_MAJOR_VERSION >= 3 co->co_kwonlyargcount == 0 && #endif likely(kwargs == NULL || nk == 0) && co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { if (argdefs == NULL && co->co_argcount == nargs) { result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); goto done; } else if (nargs == 0 && argdefs != NULL && co->co_argcount == Py_SIZE(argdefs)) { /* function called with no arguments, but all parameters have a default value: use default values as arguments .*/ args = &PyTuple_GET_ITEM(argdefs, 0); result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); goto done; } } if (kwargs != NULL) { Py_ssize_t pos, i; kwtuple = PyTuple_New(2 * nk); if (kwtuple == NULL) { result = NULL; goto done; } k = &PyTuple_GET_ITEM(kwtuple, 0); pos = i = 0; while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { Py_INCREF(k[i]); Py_INCREF(k[i+1]); i += 2; } nk = i / 2; } else { kwtuple = NULL; k = NULL; } closure = PyFunction_GET_CLOSURE(func); #if PY_MAJOR_VERSION >= 3 kwdefs = PyFunction_GET_KW_DEFAULTS(func); #endif if (argdefs != NULL) { d = &PyTuple_GET_ITEM(argdefs, 0); nd = Py_SIZE(argdefs); } else { d = NULL; nd = 0; } #if PY_MAJOR_VERSION >= 3 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, args, nargs, k, (int)nk, d, (int)nd, kwdefs, closure); #else result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, args, nargs, k, (int)nk, d, (int)nd, closure); #endif Py_XDECREF(kwtuple); done: Py_LeaveRecursiveCall(); return result; } #endif // CPython < 3.6 #endif // CYTHON_FAST_PYCALL /* PyCFunctionFastCall */ #if CYTHON_FAST_PYCCALL static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { PyCFunctionObject *func = (PyCFunctionObject*)func_obj; PyCFunction meth = PyCFunction_GET_FUNCTION(func); PyObject *self = PyCFunction_GET_SELF(func); assert(PyCFunction_Check(func)); assert(METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))); assert(nargs >= 0); assert(nargs == 0 || args != NULL); /* _PyCFunction_FastCallDict() must not be called with an exception set, because it may clear it (directly or indirectly) and so the caller loses its exception */ assert(!PyErr_Occurred()); return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL); } #endif // CYTHON_FAST_PYCCALL /* PyObjectCall */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { PyObject *result; ternaryfunc call = func->ob_type->tp_call; if (unlikely(!call)) return PyObject_Call(func, arg, kw); if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) return NULL; result = (*call)(func, arg, kw); Py_LeaveRecursiveCall(); if (unlikely(!result) && unlikely(!PyErr_Occurred())) { PyErr_SetString( PyExc_SystemError, "NULL result without error in PyObject_Call"); } return result; } #endif /* ExtTypeTest */ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; } if (likely(PyObject_TypeCheck(obj, type))) return 1; PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", Py_TYPE(obj)->tp_name, type->tp_name); return 0; } /* RaiseException */ #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { __Pyx_PyThreadState_declare Py_XINCREF(type); if (!value || value == Py_None) value = NULL; else Py_INCREF(value); if (!tb || tb == Py_None) tb = NULL; else { Py_INCREF(tb); if (!PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto raise_error; } } if (PyType_Check(type)) { #if CYTHON_COMPILING_IN_PYPY if (!value) { Py_INCREF(Py_None); value = Py_None; } #endif PyErr_NormalizeException(&type, &value, &tb); } else { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } value = type; type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto raise_error; } } __Pyx_PyThreadState_assign __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } #else static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto bad; } if (value == Py_None) value = 0; if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto bad; } value = type; type = (PyObject*) Py_TYPE(value); } else if (PyExceptionClass_Check(type)) { PyObject *instance_class = NULL; if (value && PyExceptionInstance_Check(value)) { instance_class = (PyObject*) Py_TYPE(value); if (instance_class != type) { int is_subclass = PyObject_IsSubclass(instance_class, type); if (!is_subclass) { instance_class = NULL; } else if (unlikely(is_subclass == -1)) { goto bad; } else { type = instance_class; } } } if (!instance_class) { PyObject *args; if (!value) args = PyTuple_New(0); else if (PyTuple_Check(value)) { Py_INCREF(value); args = value; } else args = PyTuple_Pack(1, value); if (!args) goto bad; owned_instance = PyObject_Call(type, args, NULL); Py_DECREF(args); if (!owned_instance) goto bad; value = owned_instance; if (!PyExceptionInstance_Check(value)) { PyErr_Format(PyExc_TypeError, "calling %R should have returned an instance of " "BaseException, not %R", type, Py_TYPE(value)); goto bad; } } } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } #if PY_VERSION_HEX >= 0x03030000 if (cause) { #else if (cause && cause != Py_None) { #endif PyObject *fixed_cause; if (cause == Py_None) { fixed_cause = NULL; } else if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); if (fixed_cause == NULL) goto bad; } else if (PyExceptionInstance_Check(cause)) { fixed_cause = cause; Py_INCREF(fixed_cause); } else { PyErr_SetString(PyExc_TypeError, "exception causes must derive from " "BaseException"); goto bad; } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); if (tb) { #if CYTHON_COMPILING_IN_PYPY PyObject *tmp_type, *tmp_value, *tmp_tb; PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); Py_INCREF(tb); PyErr_Restore(tmp_type, tmp_value, tb); Py_XDECREF(tmp_tb); #else PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } #endif } bad: Py_XDECREF(owned_instance); return; } #endif /* RaiseTooManyValuesToUnpack */ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } /* RaiseNeedMoreValuesToUnpack */ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", index, (index == 1) ? "" : "s"); } /* RaiseNoneIterError */ static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } /* SaveResetException */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { *type = tstate->exc_type; *value = tstate->exc_value; *tb = tstate->exc_traceback; Py_XINCREF(*type); Py_XINCREF(*value); Py_XINCREF(*tb); } static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = type; tstate->exc_value = value; tstate->exc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); } #endif /* PyErrExceptionMatches */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) { PyObject *exc_type = tstate->curexc_type; if (exc_type == err) return 1; if (unlikely(!exc_type)) return 0; return PyErr_GivenExceptionMatches(exc_type, err); } #endif /* GetException */ #if CYTHON_FAST_THREAD_STATE static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { #else static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { #endif PyObject *local_type, *local_value, *local_tb; #if CYTHON_FAST_THREAD_STATE PyObject *tmp_type, *tmp_value, *tmp_tb; local_type = tstate->curexc_type; local_value = tstate->curexc_value; local_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; #else PyErr_Fetch(&local_type, &local_value, &local_tb); #endif PyErr_NormalizeException(&local_type, &local_value, &local_tb); #if CYTHON_FAST_THREAD_STATE if (unlikely(tstate->curexc_type)) #else if (unlikely(PyErr_Occurred())) #endif goto bad; #if PY_MAJOR_VERSION >= 3 if (local_tb) { if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) goto bad; } #endif Py_XINCREF(local_tb); Py_XINCREF(local_type); Py_XINCREF(local_value); *type = local_type; *value = local_value; *tb = local_tb; #if CYTHON_FAST_THREAD_STATE tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = local_type; tstate->exc_value = local_value; tstate->exc_traceback = local_tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); #else PyErr_SetExcInfo(local_type, local_value, local_tb); #endif return 0; bad: *type = 0; *value = 0; *tb = 0; Py_XDECREF(local_type); Py_XDECREF(local_value); Py_XDECREF(local_tb); return -1; } /* Import */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; #if PY_VERSION_HEX < 0x03030000 PyObject *py_import; py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); if (!py_import) goto bad; #endif if (from_list) list = from_list; else { empty_list = PyList_New(0); if (!empty_list) goto bad; list = empty_list; } global_dict = PyModule_GetDict(__pyx_m); if (!global_dict) goto bad; empty_dict = PyDict_New(); if (!empty_dict) goto bad; { #if PY_MAJOR_VERSION >= 3 if (level == -1) { if (strchr(__Pyx_MODULE_NAME, '.')) { #if PY_VERSION_HEX < 0x03030000 PyObject *py_level = PyInt_FromLong(1); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, 1); #endif if (!module) { if (!PyErr_ExceptionMatches(PyExc_ImportError)) goto bad; PyErr_Clear(); } } level = 0; } #endif if (!module) { #if PY_VERSION_HEX < 0x03030000 PyObject *py_level = PyInt_FromLong(level); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, level); #endif } } bad: #if PY_VERSION_HEX < 0x03030000 Py_XDECREF(py_import); #endif Py_XDECREF(empty_list); Py_XDECREF(empty_dict); return module; } /* CodeObjectCache */ static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; } while (start < end) { mid = start + (end - start) / 2; if (code_line < entries[mid].code_line) { end = mid; } else if (code_line > entries[mid].code_line) { start = mid + 1; } else { return mid; } } if (code_line <= entries[mid].code_line) { return mid; } else { return mid + 1; } } static PyCodeObject *__pyx_find_code_object(int code_line) { PyCodeObject* code_object; int pos; if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { return NULL; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { return NULL; } code_object = __pyx_code_cache.entries[pos].code_object; Py_INCREF(code_object); return code_object; } static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { int pos, i; __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; if (unlikely(!code_line)) { return; } if (unlikely(!entries)) { entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); if (likely(entries)) { __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = 64; __pyx_code_cache.count = 1; entries[0].code_line = code_line; entries[0].code_object = code_object; Py_INCREF(code_object); } return; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { PyCodeObject* tmp = entries[pos].code_object; entries[pos].code_object = code_object; Py_DECREF(tmp); return; } if (__pyx_code_cache.count == __pyx_code_cache.max_count) { int new_max = __pyx_code_cache.max_count + 64; entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); if (unlikely(!entries)) { return; } __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = new_max; } for (i=__pyx_code_cache.count; i>pos; i--) { entries[i] = entries[i-1]; } entries[pos].code_line = code_line; entries[pos].code_object = code_object; __pyx_code_cache.count++; Py_INCREF(code_object); } /* AddTraceback */ #include "compile.h" #include "frameobject.h" #include "traceback.h" static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; #if PY_MAJOR_VERSION < 3 py_srcfile = PyString_FromString(filename); #else py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); #else py_funcname = PyUnicode_FromString(funcname); #endif } if (!py_funcname) goto bad; py_code = __Pyx_PyCode_New( 0, 0, 0, 0, 0, __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ __pyx_empty_tuple, /*PyObject *freevars,*/ __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ py_line, __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); Py_DECREF(py_funcname); return py_code; bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; py_code = __pyx_find_code_object(c_line ? c_line : py_line); if (!py_code) { py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); if (!py_code) goto bad; __pyx_insert_code_object(c_line ? c_line : py_line, py_code); } py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ __pyx_d, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; __Pyx_PyFrame_SetLineNumber(py_frame, py_line); PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_code); Py_XDECREF(py_frame); } #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags); PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name); return -1; } static void __Pyx_ReleaseBuffer(Py_buffer *view) { PyObject *obj = view->obj; if (!obj) return; if (PyObject_CheckBuffer(obj)) { PyBuffer_Release(view); return; } if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; } Py_DECREF(obj); view->obj = NULL; } #endif /* CIntFromPyVerify */ #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ {\ func_type value = func_value;\ if (sizeof(target_type) < sizeof(func_type)) {\ if (unlikely(value != (func_type) (target_type) value)) {\ func_type zero = 0;\ if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ return (target_type) -1;\ if (is_unsigned && unlikely(value < zero))\ goto raise_neg_overflow;\ else\ goto raise_overflow;\ }\ }\ return (target_type) value;\ } /* FromPyCTupleUtility */ static __pyx_ctuple_double__and_double__and_double __pyx_convert__from_py___pyx_ctuple_double__and_double__and_double(PyObject * o) { __pyx_ctuple_double__and_double__and_double result; if (!PyTuple_Check(o) || PyTuple_GET_SIZE(o) != 3) { PyErr_Format(PyExc_TypeError, "Expected %.16s of size %d, got %.200s", "a tuple", 3, Py_TYPE(o)->tp_name); goto bad; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS result.f0 = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(o, 0)); if ((result.f0 == (double)-1) && PyErr_Occurred()) goto bad; result.f1 = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(o, 1)); if ((result.f1 == (double)-1) && PyErr_Occurred()) goto bad; result.f2 = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(o, 2)); if ((result.f2 == (double)-1) && PyErr_Occurred()) goto bad; #else { PyObject *item; item = PySequence_ITEM(o, 0); if (unlikely(!item)) goto bad; result.f0 = __pyx_PyFloat_AsDouble(item); Py_DECREF(item); if ((result.f0 == (double)-1) && PyErr_Occurred()) goto bad; item = PySequence_ITEM(o, 1); if (unlikely(!item)) goto bad; result.f1 = __pyx_PyFloat_AsDouble(item); Py_DECREF(item); if ((result.f1 == (double)-1) && PyErr_Occurred()) goto bad; item = PySequence_ITEM(o, 2); if (unlikely(!item)) goto bad; result.f2 = __pyx_PyFloat_AsDouble(item); Py_DECREF(item); if ((result.f2 == (double)-1) && PyErr_Occurred()) goto bad; } #endif return result; bad: return result; } /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) { const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = (Py_intptr_t) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(Py_intptr_t) < sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { if (sizeof(Py_intptr_t) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } } { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t), little, !is_unsigned); } } /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { const int neg_one = (int) -1, const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(int) < sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(int) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { if (sizeof(int) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } } { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; return _PyLong_FromByteArray(bytes, sizeof(int), little, !is_unsigned); } } /* Declarations */ #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return ::std::complex< float >(x, y); } #else static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return x + y*(__pyx_t_float_complex)_Complex_I; } #endif #else static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { __pyx_t_float_complex z; z.real = x; z.imag = y; return z; } #endif /* Arithmetic */ #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { return (a.real == b.real) && (a.imag == b.imag); } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } #if 1 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { if (b.imag == 0) { return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); } else if (fabsf(b.real) >= fabsf(b.imag)) { if (b.real == 0 && b.imag == 0) { return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag); } else { float r = b.imag / b.real; float s = 1.0 / (b.real + b.imag * r); return __pyx_t_float_complex_from_parts( (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); } } else { float r = b.real / b.imag; float s = 1.0 / (b.imag + b.real * r); return __pyx_t_float_complex_from_parts( (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); } } #else static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { if (b.imag == 0) { return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real); } else { float denom = b.real * b.real + b.imag * b.imag; return __pyx_t_float_complex_from_parts( (a.real * b.real + a.imag * b.imag) / denom, (a.imag * b.real - a.real * b.imag) / denom); } } #endif static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = -a.real; z.imag = -a.imag; return z; } static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) { return (a.real == 0) && (a.imag == 0); } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) return sqrtf(z.real*z.real + z.imag*z.imag); #else return hypotf(z.real, z.imag); #endif } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; float r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { float denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; } switch ((int)b.real) { case 0: z.real = 1; z.imag = 0; return z; case 1: return a; case 2: z = __Pyx_c_prod_float(a, a); return __Pyx_c_prod_float(a, a); case 3: z = __Pyx_c_prod_float(a, a); return __Pyx_c_prod_float(z, a); case 4: z = __Pyx_c_prod_float(a, a); return __Pyx_c_prod_float(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } else if (b.imag == 0) { z.real = powf(a.real, b.real); z.imag = 0; return z; } else if (a.real > 0) { r = a.real; theta = 0; } else { r = -a.real; theta = atan2f(0, -1); } } else { r = __Pyx_c_abs_float(a); theta = atan2f(a.imag, a.real); } lnr = logf(r); z_r = expf(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; z.real = z_r * cosf(z_theta); z.imag = z_r * sinf(z_theta); return z; } #endif #endif /* Declarations */ #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return ::std::complex< double >(x, y); } #else static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return x + y*(__pyx_t_double_complex)_Complex_I; } #endif #else static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { __pyx_t_double_complex z; z.real = x; z.imag = y; return z; } #endif /* Arithmetic */ #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } #if 1 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { if (b.imag == 0) { return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); } else if (fabs(b.real) >= fabs(b.imag)) { if (b.real == 0 && b.imag == 0) { return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag); } else { double r = b.imag / b.real; double s = 1.0 / (b.real + b.imag * r); return __pyx_t_double_complex_from_parts( (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); } } else { double r = b.real / b.imag; double s = 1.0 / (b.imag + b.real * r); return __pyx_t_double_complex_from_parts( (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); } } #else static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { if (b.imag == 0) { return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real); } else { double denom = b.real * b.real + b.imag * b.imag; return __pyx_t_double_complex_from_parts( (a.real * b.real + a.imag * b.imag) / denom, (a.imag * b.real - a.real * b.imag) / denom); } } #endif static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = -a.real; z.imag = -a.imag; return z; } static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) { return (a.real == 0) && (a.imag == 0); } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) return sqrt(z.real*z.real + z.imag*z.imag); #else return hypot(z.real, z.imag); #endif } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { double denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; } switch ((int)b.real) { case 0: z.real = 1; z.imag = 0; return z; case 1: return a; case 2: z = __Pyx_c_prod_double(a, a); return __Pyx_c_prod_double(a, a); case 3: z = __Pyx_c_prod_double(a, a); return __Pyx_c_prod_double(z, a); case 4: z = __Pyx_c_prod_double(a, a); return __Pyx_c_prod_double(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } else if (b.imag == 0) { z.real = pow(a.real, b.real); z.imag = 0; return z; } else if (a.real > 0) { r = a.real; theta = 0; } else { r = -a.real; theta = atan2(0, -1); } } else { r = __Pyx_c_abs_double(a); theta = atan2(a.imag, a.real); } lnr = log(r); z_r = exp(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; z.real = z_r * cos(z_theta); z.imag = z_r * sin(z_theta); return z; } #endif #endif /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) { const enum NPY_TYPES neg_one = (enum NPY_TYPES) -1, const_zero = (enum NPY_TYPES) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(enum NPY_TYPES) < sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { if (sizeof(enum NPY_TYPES) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } } { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES), little, !is_unsigned); } } /* CIntFromPy */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { const int neg_one = (int) -1, const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(int) < sizeof(long)) { __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } return (int) val; } } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (int) 0; case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) case 2: if (8 * sizeof(int) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); } } break; case 3: if (8 * sizeof(int) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); } } break; case 4: if (8 * sizeof(int) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); } } break; } #endif #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (int) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if (sizeof(int) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (int) 0; case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) case -2: if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 2: if (8 * sizeof(int) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case -3: if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 3: if (8 * sizeof(int) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case -4: if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 4: if (8 * sizeof(int) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; } #endif if (sizeof(int) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else int val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } #endif if (likely(v)) { int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; int ret = _PyLong_AsByteArray((PyLongObject *)v, bytes, sizeof(val), is_little, !is_unsigned); Py_DECREF(v); if (likely(!ret)) return val; } #endif return (int) -1; } } else { int val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (int) -1; val = __Pyx_PyInt_As_int(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to int"); return (int) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to int"); return (int) -1; } /* CIntFromPy */ static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { const size_t neg_one = (size_t) -1, const_zero = (size_t) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(size_t) < sizeof(long)) { __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } return (size_t) val; } } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (size_t) 0; case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0]) case 2: if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) { return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } } break; case 3: if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) { return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } } break; case 4: if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) { return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } } break; } #endif #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (size_t) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if (sizeof(size_t) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (size_t) 0; case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, +digits[0]) case -2: if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); } } break; case 2: if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); } } break; case -3: if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); } } break; case 3: if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); } } break; case -4: if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) { return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); } } break; case 4: if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) { return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); } } break; } #endif if (sizeof(size_t) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else size_t val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } #endif if (likely(v)) { int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; int ret = _PyLong_AsByteArray((PyLongObject *)v, bytes, sizeof(val), is_little, !is_unsigned); Py_DECREF(v); if (likely(!ret)) return val; } #endif return (size_t) -1; } } else { size_t val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (size_t) -1; val = __Pyx_PyInt_As_size_t(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to size_t"); return (size_t) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to size_t"); return (size_t) -1; } /* CIntFromPy */ static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_As_Py_intptr_t(PyObject *x) { const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = (Py_intptr_t) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(Py_intptr_t) < sizeof(long)) { __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } return (Py_intptr_t) val; } } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (Py_intptr_t) 0; case 1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, digit, digits[0]) case 2: if (8 * sizeof(Py_intptr_t) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(Py_intptr_t) >= 2 * PyLong_SHIFT) { return (Py_intptr_t) (((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])); } } break; case 3: if (8 * sizeof(Py_intptr_t) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(Py_intptr_t) >= 3 * PyLong_SHIFT) { return (Py_intptr_t) (((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])); } } break; case 4: if (8 * sizeof(Py_intptr_t) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(Py_intptr_t) >= 4 * PyLong_SHIFT) { return (Py_intptr_t) (((((((((Py_intptr_t)digits[3]) << PyLong_SHIFT) | (Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])); } } break; } #endif #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (Py_intptr_t) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (Py_intptr_t) 0; case -1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, digit, +digits[0]) case -2: if (8 * sizeof(Py_intptr_t) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) { return (Py_intptr_t) (((Py_intptr_t)-1)*(((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]))); } } break; case 2: if (8 * sizeof(Py_intptr_t) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) { return (Py_intptr_t) ((((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]))); } } break; case -3: if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) { return (Py_intptr_t) (((Py_intptr_t)-1)*(((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]))); } } break; case 3: if (8 * sizeof(Py_intptr_t) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) { return (Py_intptr_t) ((((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]))); } } break; case -4: if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(Py_intptr_t) - 1 > 4 * PyLong_SHIFT) { return (Py_intptr_t) (((Py_intptr_t)-1)*(((((((((Py_intptr_t)digits[3]) << PyLong_SHIFT) | (Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]))); } } break; case 4: if (8 * sizeof(Py_intptr_t) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(Py_intptr_t) - 1 > 4 * PyLong_SHIFT) { return (Py_intptr_t) ((((((((((Py_intptr_t)digits[3]) << PyLong_SHIFT) | (Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]))); } } break; } #endif if (sizeof(Py_intptr_t) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else Py_intptr_t val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } #endif if (likely(v)) { int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; int ret = _PyLong_AsByteArray((PyLongObject *)v, bytes, sizeof(val), is_little, !is_unsigned); Py_DECREF(v); if (likely(!ret)) return val; } #endif return (Py_intptr_t) -1; } } else { Py_intptr_t val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (Py_intptr_t) -1; val = __Pyx_PyInt_As_Py_intptr_t(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to Py_intptr_t"); return (Py_intptr_t) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to Py_intptr_t"); return (Py_intptr_t) -1; } /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(long) < sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(long) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { if (sizeof(long) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } } { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; return _PyLong_FromByteArray(bytes, sizeof(long), little, !is_unsigned); } } /* CIntFromPy */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(long) < sizeof(long)) { __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } return (long) val; } } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (long) 0; case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) case 2: if (8 * sizeof(long) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; case 3: if (8 * sizeof(long) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; case 4: if (8 * sizeof(long) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; } #endif #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (long) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if (sizeof(long) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (long) 0; case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) case -2: if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 2: if (8 * sizeof(long) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -3: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 3: if (8 * sizeof(long) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -4: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 4: if (8 * sizeof(long) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; } #endif if (sizeof(long) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else long val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } #endif if (likely(v)) { int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; int ret = _PyLong_AsByteArray((PyLongObject *)v, bytes, sizeof(val), is_little, !is_unsigned); Py_DECREF(v); if (likely(!ret)) return val; } #endif return (long) -1; } } else { long val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (long) -1; val = __Pyx_PyInt_As_long(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to long"); return (long) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long) -1; } /* CheckBinaryVersion */ static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { char message[200]; PyOS_snprintf(message, sizeof(message), "compiletime version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); return PyErr_WarnEx(NULL, message, 1); } return 0; } /* ModuleImport */ #ifndef __PYX_HAVE_RT_ImportModule #define __PYX_HAVE_RT_ImportModule static PyObject *__Pyx_ImportModule(const char *name) { PyObject *py_name = 0; PyObject *py_module = 0; py_name = __Pyx_PyIdentifier_FromString(name); if (!py_name) goto bad; py_module = PyImport_Import(py_name); Py_DECREF(py_name); return py_module; bad: Py_XDECREF(py_name); return 0; } #endif /* TypeImport */ #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; char warning[200]; Py_ssize_t basicsize; #ifdef Py_LIMITED_API PyObject *py_basicsize; #endif py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); Py_DECREF(py_name); py_name = 0; Py_DECREF(py_module); py_module = 0; if (!result) goto bad; if (!PyType_Check(result)) { PyErr_Format(PyExc_TypeError, "%.200s.%.200s is not a type object", module_name, class_name); goto bad; } #ifndef Py_LIMITED_API basicsize = ((PyTypeObject *)result)->tp_basicsize; #else py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); if (!py_basicsize) goto bad; basicsize = PyLong_AsSsize_t(py_basicsize); Py_DECREF(py_basicsize); py_basicsize = 0; if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) goto bad; #endif if (!strict && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd", module_name, class_name, basicsize, size); if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; } else if ((size_t)basicsize != size) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd", module_name, class_name, basicsize, size); goto bad; } return (PyTypeObject *)result; bad: Py_XDECREF(py_module); Py_XDECREF(result); return NULL; } #endif /* InitStrings */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else if (t->is_unicode | t->is_str) { if (t->intern) { *t->p = PyUnicode_InternFromString(t->s); } else if (t->encoding) { *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); } else { *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } #endif if (!*t->p) return -1; ++t; } return 0; } static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); } static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { Py_ssize_t ignore; return __Pyx_PyObject_AsStringAndSize(o, &ignore); } static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { #if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if ( #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII __Pyx_sys_getdefaultencoding_not_ascii && #endif PyUnicode_Check(o)) { #if PY_VERSION_HEX < 0x03030000 char* defenc_c; PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); if (!defenc) return NULL; defenc_c = PyBytes_AS_STRING(defenc); #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII { char* end = defenc_c + PyBytes_GET_SIZE(defenc); char* c; for (c = defenc_c; c < end; c++) { if ((unsigned char) (*c) >= 128) { PyUnicode_AsASCIIString(o); return NULL; } } } #endif *length = PyBytes_GET_SIZE(defenc); return defenc_c; #else if (__Pyx_PyUnicode_READY(o) == -1) return NULL; #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII if (PyUnicode_IS_ASCII(o)) { *length = PyUnicode_GET_LENGTH(o); return PyUnicode_AsUTF8(o); } else { PyUnicode_AsASCIIString(o); return NULL; } #else return PyUnicode_AsUTF8AndSize(o, length); #endif #endif } else #endif #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) if (PyByteArray_Check(o)) { *length = PyByteArray_GET_SIZE(o); return PyByteArray_AS_STRING(o); } else #endif { char* result; int r = PyBytes_AsStringAndSize(o, &result, length); if (unlikely(r < 0)) { return NULL; } else { return result; } } } static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { #if CYTHON_USE_TYPE_SLOTS PyNumberMethods *m; #endif const char *name = NULL; PyObject *res = NULL; #if PY_MAJOR_VERSION < 3 if (PyInt_Check(x) || PyLong_Check(x)) #else if (PyLong_Check(x)) #endif return __Pyx_NewRef(x); #if CYTHON_USE_TYPE_SLOTS m = Py_TYPE(x)->tp_as_number; #if PY_MAJOR_VERSION < 3 if (m && m->nb_int) { name = "int"; res = PyNumber_Int(x); } else if (m && m->nb_long) { name = "long"; res = PyNumber_Long(x); } #else if (m && m->nb_int) { name = "int"; res = PyNumber_Long(x); } #endif #else res = PyNumber_Int(x); #endif if (res) { #if PY_MAJOR_VERSION < 3 if (!PyInt_Check(res) && !PyLong_Check(res)) { #else if (!PyLong_Check(res)) { #endif PyErr_Format(PyExc_TypeError, "__%.4s__ returned non-%.4s (type %.200s)", name, name, Py_TYPE(res)->tp_name); Py_DECREF(res); return NULL; } } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "an integer is required"); } return res; } static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject *x; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_CheckExact(b))) { if (sizeof(Py_ssize_t) >= sizeof(long)) return PyInt_AS_LONG(b); else return PyInt_AsSsize_t(x); } #endif if (likely(PyLong_CheckExact(b))) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)b)->ob_digit; const Py_ssize_t size = Py_SIZE(b); if (likely(__Pyx_sst_abs(size) <= 1)) { ival = likely(size) ? digits[0] : 0; if (size == -1) ival = -ival; return ival; } else { switch (size) { case 2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case -2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case 3: if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case -3: if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case 4: if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case -4: if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; } } #endif return PyLong_AsSsize_t(b); } x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { return PyInt_FromSize_t(ival); } #endif /* Py_PYTHON_H */
[ "noreply@github.com" ]
ccschillinger.noreply@github.com
4780e4bf593c3fa0a4aa0dd61e2f2da0bd2ac49a
37b5230d6fcd00b432bb9202ee9299977b11b5bf
/lib/interop-1.1.8/include/interop/util/string.h
455324f7d112b30c4fdc37f6ef8a2b21b9d431b5
[ "MIT" ]
permissive
guillaume-gricourt/HmnIllumina
f1a19880ad969282ce3fe1265f50c0a001287e44
2a925bcb62f0595e668c324906941ab7d3064c11
refs/heads/main
2023-04-28T18:15:56.440126
2023-04-17T17:10:57
2023-04-17T17:10:57
577,830,976
0
0
MIT
2023-09-08T21:56:15
2022-12-13T16:14:48
C++
UTF-8
C++
false
false
1,857
h
/** String utilities * * @file * @date 5/16/16 * @version 1.0 * @copyright GNU Public License. */ #pragma once #include <cctype> namespace illumina { namespace interop { namespace util { // replace, camel_to_space // /** Replace any first occurence of substring from with substring to * * @param str source/destination string * @param from search string * @param to replacement string * @return true if substring was found and replaced */ inline bool replace(std::string& str, const std::string& from, const std::string& to) { const size_t start_pos = str.find(from); if(start_pos == std::string::npos) return false; str.replace(start_pos, from.length(), to); return true; } /** Split string based on upper case characters and separate with separator string * * E.g. "SignalToNoise" -> "Signal To Noise" * * * @param str source/destination string * @param sep seperator string */ inline void camel_to(std::string& str, const std::string& sep=" ") { for(size_t i=1;i<str.length()-1;++i) { if(std::isupper(str[i])) { str.insert(i, sep); ++i; } } } /** Split string based on space characters and delineate with camel case * * E.g. "Signal To Noise" -> "SignalToNoise" * * * @param str source/destination string * @param sep separator string */ inline void camel_from(std::string& str, const char sep=' ') { for(size_t i=1;i<str.length()-1;) { if(str[i] == sep) { str.erase(str.begin() + i); str[i] = static_cast<char>(::toupper(str[i])); } else ++i; } } }}}
[ "guipagui@gmail.com" ]
guipagui@gmail.com
c9c8fee6b2dc26b013702a70c82782992c761467
7e48d392300fbc123396c6a517dfe8ed1ea7179f
/RodentVR/Intermediate/Build/Win64/RodentVR/Inc/Engine/HitProxies.gen.cpp
be6b37dac2cd41b288ed87f502c160e4f00e1e41
[]
no_license
WestRyanK/Rodent-VR
f4920071b716df6a006b15c132bc72d3b0cba002
2033946f197a07b8c851b9a5075f0cb276033af6
refs/heads/master
2021-06-14T18:33:22.141793
2020-10-27T03:25:33
2020-10-27T03:25:33
154,956,842
1
1
null
2018-11-29T09:56:21
2018-10-27T11:23:11
C++
UTF-8
C++
false
false
3,660
cpp
// Copyright Epic Games, Inc. All Rights Reserved. /*=========================================================================== Generated code exported from UnrealHeaderTool. DO NOT modify this manually! Edit the corresponding .h files instead! ===========================================================================*/ #include "UObject/GeneratedCppIncludes.h" #include "Engine/Public/HitProxies.h" #ifdef _MSC_VER #pragma warning (push) #pragma warning (disable : 4883) #endif PRAGMA_DISABLE_DEPRECATION_WARNINGS void EmptyLinkFunctionForGeneratedCodeHitProxies() {} // Cross Module References ENGINE_API UEnum* Z_Construct_UEnum_Engine_EHitProxyPriority(); UPackage* Z_Construct_UPackage__Script_Engine(); // End Cross Module References static UEnum* EHitProxyPriority_StaticEnum() { static UEnum* Singleton = nullptr; if (!Singleton) { Singleton = GetStaticEnum(Z_Construct_UEnum_Engine_EHitProxyPriority, Z_Construct_UPackage__Script_Engine(), TEXT("EHitProxyPriority")); } return Singleton; } template<> ENGINE_API UEnum* StaticEnum<EHitProxyPriority>() { return EHitProxyPriority_StaticEnum(); } static FCompiledInDeferEnum Z_CompiledInDeferEnum_UEnum_EHitProxyPriority(EHitProxyPriority_StaticEnum, TEXT("/Script/Engine"), TEXT("EHitProxyPriority"), false, nullptr, nullptr); uint32 Get_Z_Construct_UEnum_Engine_EHitProxyPriority_Hash() { return 3048321180U; } UEnum* Z_Construct_UEnum_Engine_EHitProxyPriority() { #if WITH_HOT_RELOAD UPackage* Outer = Z_Construct_UPackage__Script_Engine(); static UEnum* ReturnEnum = FindExistingEnumIfHotReloadOrDynamic(Outer, TEXT("EHitProxyPriority"), 0, Get_Z_Construct_UEnum_Engine_EHitProxyPriority_Hash(), false); #else static UEnum* ReturnEnum = nullptr; #endif // WITH_HOT_RELOAD if (!ReturnEnum) { static const UE4CodeGen_Private::FEnumeratorParam Enumerators[] = { { "HPP_World", (int64)HPP_World }, { "HPP_Wireframe", (int64)HPP_Wireframe }, { "HPP_Foreground", (int64)HPP_Foreground }, { "HPP_UI", (int64)HPP_UI }, }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Enum_MetaDataParams[] = { { "Comment", "/**\n * The priority a hit proxy has when choosing between several hit proxies near the point the user clicked.\n * HPP_World - this is the default priority\n * HPP_Wireframe - the priority of items that are drawn in wireframe, such as volumes\n * HPP_UI - the priority of the UI components such as the translation widget\n */" }, { "HPP_Foreground.Name", "HPP_Foreground" }, { "HPP_UI.Name", "HPP_UI" }, { "HPP_Wireframe.Name", "HPP_Wireframe" }, { "HPP_World.Name", "HPP_World" }, { "ModuleRelativePath", "Public/HitProxies.h" }, { "ToolTip", "The priority a hit proxy has when choosing between several hit proxies near the point the user clicked.\nHPP_World - this is the default priority\nHPP_Wireframe - the priority of items that are drawn in wireframe, such as volumes\nHPP_UI - the priority of the UI components such as the translation widget" }, }; #endif static const UE4CodeGen_Private::FEnumParams EnumParams = { (UObject*(*)())Z_Construct_UPackage__Script_Engine, nullptr, "EHitProxyPriority", "EHitProxyPriority", Enumerators, UE_ARRAY_COUNT(Enumerators), RF_Public|RF_Transient|RF_MarkAsNative, UE4CodeGen_Private::EDynamicType::NotDynamic, (uint8)UEnum::ECppForm::Regular, METADATA_PARAMS(Enum_MetaDataParams, UE_ARRAY_COUNT(Enum_MetaDataParams)) }; UE4CodeGen_Private::ConstructUEnum(ReturnEnum, EnumParams); } return ReturnEnum; } PRAGMA_ENABLE_DEPRECATION_WARNINGS #ifdef _MSC_VER #pragma warning (pop) #endif
[ "west.ryan.k@gmail.com" ]
west.ryan.k@gmail.com
2b3f99fd50acb87d09762d1a4281d262f84c66d1
9a4fe73a39bf7912d4480f88933d11ba139b0c34
/src/lib/libc++/libcxx/include/iostream
348ec0a0034ce9971ebe96605faa79cfbef418f7
[ "MIT", "NCSA", "LicenseRef-scancode-mit-nagy", "LicenseRef-scancode-other-permissive", "BSD-3-Clause", "BSL-1.0", "LicenseRef-scancode-musl-exception", "LicenseRef-scancode-public-domain", "BSD-2-Clause" ]
permissive
JasonZhouPW/ontology-wasm-cdt-cpp
ddd4bd67342d37692ea78a991618a9b52494c83e
488fc0fd8623d95ab570947630aaa54c8fe4bce2
refs/heads/master
2020-05-02T12:30:25.100024
2019-03-27T08:54:39
2019-03-27T09:02:19
177,959,753
0
0
null
2019-03-27T09:21:02
2019-03-27T09:21:01
null
UTF-8
C++
false
false
1,463
// -*- C++ -*- //===--------------------------- iostream ---------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef _LIBCPP_IOSTREAM #define _LIBCPP_IOSTREAM //#error "iostreams currently clash with ont::datastream" #include<remove_wasm_float> /* iostream synopsis #include <ios> #include <streambuf> #include <istream> #include <ostream> namespace std { extern istream cin; extern ostream cout; extern ostream cerr; extern ostream clog; extern wistream wcin; extern wostream wcout; extern wostream wcerr; extern wostream wclog; } // std */ #include <__config> #include <ios> #include <streambuf> #include <istream> #include <ostream> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif _LIBCPP_BEGIN_NAMESPACE_STD #ifndef _LIBCPP_HAS_NO_STDIN extern _LIBCPP_FUNC_VIS istream cin; extern _LIBCPP_FUNC_VIS wistream wcin; #endif #ifndef _LIBCPP_HAS_NO_STDOUT extern _LIBCPP_FUNC_VIS ostream cout; extern _LIBCPP_FUNC_VIS wostream wcout; #endif extern _LIBCPP_FUNC_VIS ostream cerr; extern _LIBCPP_FUNC_VIS wostream wcerr; extern _LIBCPP_FUNC_VIS ostream clog; extern _LIBCPP_FUNC_VIS wostream wclog; _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_IOSTREAM
[ "chenglin.cn@163.com" ]
chenglin.cn@163.com
df25b8c2daee452f8bebe3a342eb2111b3c917ae
8bec7effc5893a09421b9cfa7877d1f566d12069
/Source/CubeSurvival/Private/Character/CSPlayerCharacter.cpp
0adcd2f11398aca9eae23a4ef7dc4caa58a1b3b0
[]
no_license
ShinChanhun/CubeSurvival
eb2c9fc46894cdd2ce58e34292656622ae822fad
c53eedbd690a54ca0f0e52bbf5c75a186b049534
refs/heads/master
2021-07-14T17:16:31.053623
2020-08-05T11:14:30
2020-08-05T11:14:30
193,646,336
0
1
null
null
null
null
UTF-8
C++
false
false
199
cpp
// Fill out your copyright notice in the Description page of Project Settings. #include "CSPlayerCharacter.h" ACSPlayerCharacter::ACSPlayerCharacter() { PrimaryActorTick.bCanEverTick = false; }
[ "wjdwlrdhks@naver.com" ]
wjdwlrdhks@naver.com
16f43584dd3287e2aef2d88b1b77e409aace7a61
fbe68d84e97262d6d26dd65c704a7b50af2b3943
/third_party/retdec-3.2/include/retdec/llvmir2hll/optimizer/optimizers/simplify_arithm_expr/const_operator_const_sub_optimizer.h
a6f1abc2ad91b5022aaa22590fe6d1e349d9674e
[ "MIT", "GPL-1.0-or-later", "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "OpenSSL", "WTFPL", "LGPL-2.1-only", "LicenseRef-scancode-openssl", "LicenseRef-scancode-ssleay-windows", "LGPL-2.0-or-later", "JSON", "Zlib", "NCSA", "LicenseRef-scancode-proprietary-license", "G...
permissive
thalium/icebox
c4e6573f2b4f0973b6c7bb0bf068fe9e795fdcfb
6f78952d58da52ea4f0e55b2ab297f28e80c1160
refs/heads/master
2022-08-14T00:19:36.984579
2022-02-22T13:10:31
2022-02-22T13:10:31
190,019,914
585
109
MIT
2022-01-13T20:58:15
2019-06-03T14:18:12
C++
UTF-8
C++
false
false
3,782
h
/** * @file include/retdec/llvmir2hll/optimizer/optimizers/simplify_arithm_expr/const_operator_const_sub_optimizer.h * @brief A sub-optimization class that optimize expression like Constant operator * constant * @copyright (c) 2017 Avast Software, licensed under the MIT license */ #ifndef RETDEC_LLVMIR2HLL_OPTIMIZER_OPTIMIZERS_SIMPLIFY_ARITHM_EXPR_CONST_OPERATOR_CONST_SUB_OPTIMIZER_H #define RETDEC_LLVMIR2HLL_OPTIMIZER_OPTIMIZERS_SIMPLIFY_ARITHM_EXPR_CONST_OPERATOR_CONST_SUB_OPTIMIZER_H #include <string> #include "retdec/llvmir2hll/ir/binary_op_expr.h" #include "retdec/llvmir2hll/ir/expression.h" #include "retdec/llvmir2hll/optimizer/optimizers/simplify_arithm_expr/sub_optimizer.h" #include "retdec/llvmir2hll/support/types.h" namespace retdec { namespace llvmir2hll { /** * @brief This optimizer optimizes expressions where the first and the second * operand is a constant. Examples are mentioned below. * * Optimizations are now only on these operators: +, -, *, /, &, |, ^. * * List of performed simplifications (by examples): * * @par Operator + * (ConstInt/ConstFloat) + (ConstInt/ConstFloat). * @code * return 2 + 5; * @endcode * can be optimized to * @code * return 7; * @endcode * * @par Operator & * ConstInt & ConstInt. * @code * return 10 & 22; * @endcode * can be optimized to * @code * return 2; * @endcode * * @par Operator | * ConstInt | ConstInt. * @code * return 10 | 22; * @endcode * can be optimized to * @code * return 30; * @endcode * * @par Operator ^ * ConstInt ^ ConstInt. * @code * return 10 ^ 22; * @endcode * can be optimized to * @code * return 28; * @endcode * * @par Operator - * (ConstInt/ConstFloat) - (ConstInt/ConstFloat). * @code * return 2 - 5; * @endcode * can be optimized to * @code * return -3; * @endcode * * @par Operator * * (ConstInt/ConstFloat) * (ConstInt/ConstFloat). * @code * return 2 * 5; * @endcode * can be optimized to * @code * return 10; * @endcode * * @par Operator / * (ConstInt/ConstFloat) / (ConstInt/ConstFloat). * @code * return 10 / 5; * @endcode * can be optimized to * @code * return 2; * @endcode * * @par Operator <, >, <=, >=, ==, !, &&, || * (ConstInt/ConstFloat/ConstBool) op (ConstInt/ConstFloat/ConstBool). * @code * return 2 == 5; * @endcode * can be optimized to * @code * return false; * @endcode * * Instances of this class have reference object semantics. * * This is a concrete sub-optimizer which should not be subclassed. */ class ConstOperatorConstSubOptimizer final: public SubOptimizer { public: ConstOperatorConstSubOptimizer( ShPtr<ArithmExprEvaluator> arithmExprEvaluator); virtual ~ConstOperatorConstSubOptimizer() override; static ShPtr<SubOptimizer> create(ShPtr<ArithmExprEvaluator> arithmExprEvaluator); virtual std::string getId() const override; private: /// @name Visitor Interface /// @{ using SubOptimizer::visit; virtual void visit(ShPtr<AddOpExpr> expr) override; virtual void visit(ShPtr<SubOpExpr> expr) override; virtual void visit(ShPtr<MulOpExpr> expr) override; virtual void visit(ShPtr<DivOpExpr> expr) override; virtual void visit(ShPtr<BitAndOpExpr> expr) override; virtual void visit(ShPtr<BitOrOpExpr> expr) override; virtual void visit(ShPtr<BitXorOpExpr> expr) override; virtual void visit(ShPtr<LtOpExpr> expr) override; virtual void visit(ShPtr<LtEqOpExpr> expr) override; virtual void visit(ShPtr<GtOpExpr> expr) override; virtual void visit(ShPtr<GtEqOpExpr> expr) override; virtual void visit(ShPtr<EqOpExpr> expr) override; virtual void visit(ShPtr<NeqOpExpr> expr) override; virtual void visit(ShPtr<AndOpExpr> expr) override; virtual void visit(ShPtr<OrOpExpr> expr) override; /// @} void tryOptimizeConstConstOperand(ShPtr<BinaryOpExpr> expr); }; } // namespace llvmir2hll } // namespace retdec #endif
[ "benoit.amiaux@gmail.com" ]
benoit.amiaux@gmail.com
615b2368a80efb83f380580221cdb738f8002b64
600d5ec32e3fe52a2fd589f036917470000e0d10
/monotone_increase_digits.cpp
a485e63a06945c1fc0aaec5eca1577ecf397423e
[]
no_license
Shubham-js/Codes
5a6ce3b33c35ff495cc7f4610c05bb97e829eeea
703a63e7e95e89ab9ed2f79da9b18d90a496220c
refs/heads/main
2023-05-28T17:07:57.214838
2021-06-12T20:33:10
2021-06-12T20:33:10
372,717,217
1
0
null
null
null
null
UTF-8
C++
false
false
1,000
cpp
#include<bits/stdc++.h> using namespace std; class Solution { public: int monotoneIncreasingDigits(int n) { if (n >= 0 and n <= 9) { return n; } vector<int>v; while (n > 0) { int r = n % 10; n /= 10; v.push_back(r); } for (auto x : v) { cout << x << " "; } cout << endl; int idx = -1; for (int i = 0; i < v.size() - 1; i++) { if (v[i] < v[i + 1]) { v[i + 1] -= 1; idx = i; } } int ans = 0; for (int i = v.size() - 1; i > idx; i--) { ans = ans * 10 + v[i]; } for (int i = idx; i >= 0; i--) { ans = ans * 10 + 9; } return ans; } }; int main() { Solution s; int n; cin >> n; cout << s.monotoneIncreasingDigits(n) << endl; return 0; }
[ "66121483+Shubham-js@users.noreply.github.com" ]
66121483+Shubham-js@users.noreply.github.com
db47238eb4637635615960bde837ed86eab23506
131223db8fe76478768e174d85828cf10862c0dc
/services/bluetooth_standard/service/src/avrcp_ct/avrcp_ct_notification.cpp
10068e467d2791ab0cc35732fa1074feed044419
[ "Apache-2.0" ]
permissive
openharmony-gitee-mirror/communication_bluetooth
e3c834043d8d96be666401ba6baa3f55e1f1f3d2
444309918cd00a65a10b8d798a0f5a78f8cf13be
refs/heads/master
2023-08-24T10:05:20.001354
2021-10-19T01:45:18
2021-10-19T01:45:18
400,050,270
0
0
null
null
null
null
UTF-8
C++
false
false
8,798
cpp
/* * Copyright (C) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "avrcp_ct_notification.h" namespace bluetooth { AvrcCtNotifyPacket::AvrcCtNotifyPacket(uint8_t eventId, uint32_t interval) : AvrcCtVendorPacket(), interval_(AVRC_PLAYBACK_INTERVAL_1_SEC), playStatus_(AVRC_PLAY_STATUS_ERROR), volume_(AVRC_ABSOLUTE_VOLUME_INVALID) { LOG_DEBUG("[AVRCP CT] AvrcCtNotifyPacket::%{public}s", __func__); crCode_ = AVRC_CT_CMD_CODE_NOTIFY; pduId_ = AVRC_CT_PDU_ID_REGISTER_NOTIFICATION; parameterLength_ = AVRC_CT_NOTIFY_PARAMETER_LENGTH; eventId_ = eventId; interval_ = interval; } AvrcCtNotifyPacket::AvrcCtNotifyPacket(Packet *pkt) : AvrcCtVendorPacket(), interval_(AVRC_PLAYBACK_INTERVAL_1_SEC), playStatus_(AVRC_PLAY_STATUS_ERROR), volume_(AVRC_ABSOLUTE_VOLUME_INVALID) { LOG_DEBUG("[AVRCP CT] AvrcCtNotifyPacket::%{public}s", __func__); crCode_ = AVRC_CT_CMD_CODE_NOTIFY; pduId_ = AVRC_CT_PDU_ID_REGISTER_NOTIFICATION; DisassemblePacket(pkt); } AvrcCtNotifyPacket::~AvrcCtNotifyPacket() { LOG_DEBUG("[AVRCP CT] AvrcCtNotifyPacket::%{public}s", __func__); attributes_.clear(); values_.clear(); } Packet *AvrcCtNotifyPacket::AssembleParameters(Packet *pkt) { LOG_DEBUG("[AVRCP CT] AvrcCtNotifyPacket::%{public}s", __func__); size_t bufferSize = AVRC_CT_VENDOR_PARAMETER_LENGTH_SIZE + AVRC_CT_NOTIFY_PARAMETER_LENGTH; LOG_DEBUG("[AVRCP CT] BufferMalloc[%{public}d]", bufferSize); auto buffer = BufferMalloc(bufferSize); auto bufferPtr = static_cast<uint8_t *>(BufferPtr(buffer)); uint16_t offset = 0x0000; offset += PushOctets2((bufferPtr + offset), parameterLength_); LOG_DEBUG("[AVRCP CT] parameterLength_[%{public}d]", parameterLength_); offset += PushOctets1((bufferPtr + offset), eventId_); LOG_DEBUG("[AVRCP CT] eventId_[%x]", eventId_); offset += PushOctets4((bufferPtr + offset), interval_); LOG_DEBUG("[AVRCP CT] interval_[%{public}d]", interval_); PacketPayloadAddLast(pkt, buffer); BufferFree(buffer); return pkt; } bool AvrcCtNotifyPacket::DisassembleParameters(uint8_t *buffer) { LOG_DEBUG("[AVRCP CT] AvrcCtNotifyPacket::%{public}s", __func__); isValid_ = false; uint16_t offset = AVRC_CT_VENDOR_PARAMETER_LENGTH_OFFSET; uint64_t payload = 0x00; offset += PopOctets2((buffer + offset), payload); parameterLength_ = static_cast<uint16_t>(payload); LOG_DEBUG("[AVRCP CT] parameterLength_[%{public}d]", parameterLength_); payload = 0x00; offset += PopOctets1((buffer + offset), payload); eventId_ = static_cast<uint8_t>(payload); LOG_DEBUG("[AVRCP CT] eventId_[%x]", eventId_); switch (eventId_) { case AVRC_CT_EVENT_ID_PLAYBACK_STATUS_CHANGED: isValid_ = DisassemblePlaybackStatus(buffer); break; case AVRC_CT_EVENT_ID_TRACK_CHANGED: isValid_ = DisassembleTrackChanged(buffer); break; case AVRC_CT_EVENT_ID_PLAYBACK_POS_CHANGED: isValid_ = DisassemblePlaybackPosChanged(buffer); break; case AVRC_CT_EVENT_ID_PLAYER_APPLICATION_SETTING_CHANGED: isValid_ = DisassemblePlayerApplicationSettingChanged(buffer); break; case AVRC_CT_EVENT_ID_ADDRESSED_PLAYER_CHANGED: isValid_ = DisassembleAddressedPlayerChanged(buffer); break; case AVRC_CT_EVENT_ID_UIDS_CHANGED: isValid_ = DisassembleUidsChanged(buffer); break; case AVRC_CT_EVENT_ID_VOLUME_CHANGED: isValid_ = DisassembleVolumeChanged(buffer); break; case AVRC_CT_EVENT_ID_TRACK_REACHED_END: case AVRC_CT_EVENT_ID_TRACK_REACHED_START: case AVRC_CT_EVENT_ID_NOW_PLAYING_CONTENT_CHANGED: case AVRC_CT_EVENT_ID_AVAILABLE_PLAYERS_CHANGED: /// FALL THROUGH default: /// Do nothing! isValid_ = true; break; } LOG_DEBUG("[AVRCP CT] isValid_[%{public}d]", isValid_); return isValid_; } bool AvrcCtNotifyPacket::DisassemblePlaybackStatus(uint8_t *buffer) { LOG_DEBUG("[AVRCP CT] AvrcCtNotifyPacket::%{public}s", __func__); isValid_ = false; uint16_t offset = AVRC_CT_NOTIFY_EVENT_ID_OFFSET + AVRC_CT_NOTIFY_EVENT_ID_SIZE; uint64_t payload = 0x00; offset += PopOctets1((buffer + offset), payload); playStatus_ = static_cast<uint8_t>(payload); LOG_DEBUG("[AVRCP CT] playStatus_[%x]", playStatus_); isValid_ = true; return isValid_; } bool AvrcCtNotifyPacket::DisassembleTrackChanged(uint8_t *buffer) { LOG_DEBUG("[AVRCP CT] AvrcCtNotifyPacket::%{public}s", __func__); isValid_ = false; uint16_t offset = AVRC_CT_NOTIFY_EVENT_ID_OFFSET + AVRC_CT_NOTIFY_EVENT_ID_SIZE; uint64_t payload = 0x00; offset += PopOctets8((buffer + offset), payload); uid_ = payload; LOG_DEBUG("[AVRCP CT] uid_[%llx]", uid_); isValid_ = true; return isValid_; } bool AvrcCtNotifyPacket::DisassemblePlaybackPosChanged(uint8_t *buffer) { LOG_DEBUG("[AVRCP CT] AvrcCtNotifyPacket::%{public}s", __func__); isValid_ = false; uint16_t offset = AVRC_CT_NOTIFY_EVENT_ID_OFFSET + AVRC_CT_NOTIFY_EVENT_ID_SIZE; uint64_t payload = 0x00; offset += PopOctets4((buffer + offset), payload); playbackPos_ = static_cast<uint32_t>(payload); LOG_DEBUG("[AVRCP CT] playbackPos_[%{public}d]", playbackPos_); isValid_ = true; return isValid_; } bool AvrcCtNotifyPacket::DisassemblePlayerApplicationSettingChanged(uint8_t *buffer) { LOG_DEBUG("[AVRCP CT] AvrcCtNotifyPacket::%{public}s", __func__); isValid_ = false; receivedFragments_++; LOG_DEBUG("[AVRCP CT] receivedFragments_[%{public}d]", receivedFragments_); uint16_t offset = AVRC_CT_NOTIFY_EVENT_ID_OFFSET + AVRC_CT_NOTIFY_EVENT_ID_SIZE; uint64_t payload = 0x00; offset += PopOctets1((buffer + offset), payload); auto numOfAttributes = static_cast<uint8_t>(payload); LOG_DEBUG("[AVRCP CT] numOfAttributes[%{public}d]", numOfAttributes); for (int i = 0; i < numOfAttributes; i++) { payload = 0x00; offset += PopOctets1((buffer + offset), payload); attributes_.push_back(static_cast<uint8_t>(payload)); LOG_DEBUG("[AVRCP CT] attribute[%x]", attributes_.back()); offset += PopOctets1((buffer + offset), payload); values_.push_back(static_cast<uint8_t>(payload)); LOG_DEBUG("[AVRCP CT] value[%x]", values_.back()); } return isValid_; } bool AvrcCtNotifyPacket::DisassembleAddressedPlayerChanged(uint8_t *buffer) { LOG_DEBUG("[AVRCP CT] AvrcCtNotifyPacket::%{public}s", __func__); isValid_ = false; uint16_t offset = AVRC_CT_NOTIFY_EVENT_ID_OFFSET + AVRC_CT_NOTIFY_EVENT_ID_SIZE; uint64_t payload = 0x00; offset += PopOctets2((buffer + offset), payload); playerId_ = static_cast<uint16_t>(payload); LOG_DEBUG("[AVRCP CT] playerId_[%x]", playerId_); payload = 0x00; offset += PopOctets2((buffer + offset), payload); uidCounter_ = static_cast<uint16_t>(payload); LOG_DEBUG("[AVRCP CT] uidCounter_[%x]", uidCounter_); isValid_ = true; return isValid_; } bool AvrcCtNotifyPacket::DisassembleUidsChanged(uint8_t *buffer) { LOG_DEBUG("[AVRCP CT] AvrcCtNotifyPacket::%{public}s", __func__); isValid_ = false; uint16_t offset = AVRC_CT_NOTIFY_EVENT_ID_OFFSET + AVRC_CT_NOTIFY_EVENT_ID_SIZE; uint64_t payload = 0x00; offset += PopOctets2((buffer + offset), payload); uidCounter_ = static_cast<uint16_t>(payload); LOG_DEBUG("[AVRCP CT] uidCounter_[%x]", uidCounter_); isValid_ = true; return isValid_; } bool AvrcCtNotifyPacket::DisassembleVolumeChanged(uint8_t *buffer) { LOG_DEBUG("[AVRCP CT] AvrcCtNotifyPacket::%{public}s", __func__); isValid_ = false; uint16_t offset = AVRC_CT_NOTIFY_EVENT_ID_OFFSET + AVRC_CT_NOTIFY_EVENT_ID_SIZE; uint64_t payload = 0x00; offset += PopOctets1((buffer + offset), payload); volume_ = static_cast<uint8_t>(payload) & 0b01111111; LOG_DEBUG("[AVRCP CT] volume_[%{public}d]", volume_); isValid_ = true; return isValid_; } }; // namespace bluetooth
[ "guohong.cheng@huawei.com" ]
guohong.cheng@huawei.com
a7d8329842a5c5e63f2d2d5745c7351a1c62da14
b4ea2e3422db249fec4e8696c76184629479aa87
/include/fcsc/sandwich_pose.hpp
be7196a92cd49452ee8dae1f9144ab0f31a741a2
[]
no_license
xmba15/fcsc
ed325a45ac24097caef8334a43e85245c60b275c
769e12f71e221712e0fcbb0070c9c350c6564ca8
refs/heads/master
2022-07-28T02:50:57.919062
2018-10-02T12:11:28
2018-10-02T12:11:28
151,177,940
0
0
null
2022-06-21T21:29:05
2018-10-02T00:10:32
Jupyter Notebook
UTF-8
C++
false
false
1,038
hpp
// Copyright (c) 2018 // All Rights Reserved. #pragma once #include <ros/ros.h> #include <pcl/point_cloud.h> #include <pcl/point_types.h> #include <pcl/conversions.h> #include <pcl_conversions/pcl_conversions.h> #include <pcl/features/moment_of_inertia_estimation.h> #include <sensor_msgs/PointCloud2.h> #include <geometry_msgs/Pose.h> #include <geometry_msgs/PoseArray.h> #include <fcsc/SandwichPose.h> typedef pcl::PointXYZRGB PointT; typedef pcl::Normal NormalT; typedef pcl::PointXYZRGBNormal PointNormalT; typedef pcl::PointCloud<PointT> PointCloud; typedef pcl::PointCloud<NormalT> PointNormal; typedef pcl::PointCloud<PointNormalT> PointCloudNormal; class PCAObjectPose { public: explicit PCAObjectPose(ros::NodeHandle* nodehandle); geometry_msgs::Pose getPose(PointCloud::Ptr); bool serviceCallback(fcsc::SandwichPoseRequest&, fcsc::SandwichPoseResponse&); protected: virtual void onInit(); virtual void subscribe(); virtual void unsubscribe(); private: ros::NodeHandle nh_; ros::ServiceServer service_; };
[ "thba1590@gmail.com" ]
thba1590@gmail.com
b41c91c1b7c51b311491a0ce77fc1eb46c211816
49bf571e8f5e9ee2e6119a7d4582f3d762b68a08
/gei zitent/testWebEngine/main.cpp
43da4c5e621b8465e7d2c31ce07ed51becaf8192
[]
no_license
a798447431/Qt_Project
a88e5b31e5175617787799d27c2a4603d8a09d0b
03c7518b59d56369df97582505e1729503fa1664
refs/heads/master
2020-12-27T12:24:42.999604
2020-02-03T06:45:41
2020-02-03T06:45:41
237,900,469
0
1
null
null
null
null
UTF-8
C++
false
false
264
cpp
#include <QApplication> #include <QQmlApplicationEngine> #include "mainform.h" #include "myform.h" int main(int argc, char *argv[]) { QApplication app(argc, argv); MyForm w ;//创建主界面对象 w.show();//显示主界面 return app.exec(); }
[ "253604653@qq.com" ]
253604653@qq.com
7fe538bbd5367db354155664c657bf6f9adbfe5c
05f3e15798584b737ff7a94cac4600e81230d69e
/HopfieldUser.h
77a7b0328f4d666885b5ce1c42229faf58256c5c
[]
no_license
jjawor/projects
4418b733f84987d641e2c586f27915f6b61a6789
cfda168da919e9aae3ac78b336502abcb4cd4292
refs/heads/master
2016-09-06T00:49:16.317950
2013-05-08T19:45:17
2013-05-08T19:45:17
9,944,268
1
0
null
null
null
null
UTF-8
C++
false
false
5,161
h
#include "HopfieldNetwork.h" class HopfieldUser{ private : int historySize; double margin; HopfieldNetwork * hpGood; HopfieldNetwork * hpBad; double * toBinnaryPattern(int * source,int where,int size){ double * pattern= new double [8*sizeof(int)*size]; for(int i=0;i<size;i++){ for(int j=0;j<8*sizeof(int);j++){ pattern[i*8*sizeof(int)+j]=((source[where-4+i]<<j>>(8*sizeof(int)-1))*(-1)-0.5)*2; //cout<<pattern[i*8*sizeof(int)+j]<<endl; } //cout<<source[where-4+i]<<endl; } return pattern; } int * toSource(double * pattern,int size){ int *source=new int[size]; for(int i=0;i<size;i++){ source[i]=0; for(int j=0;j<8*sizeof(int);j++){ source[i]=source[i]*2; source[i]+=(int)(pattern[i*8*sizeof(int)+j]/2+0.5); } } return source; } public: HopfieldUser(): margin(0.0625),historySize(5){ hpGood=new HopfieldNetwork(historySize*8*sizeof(int),HopfieldNetwork::ACTIVATION_SIGNUM_HOPFIELD); hpBad=new HopfieldNetwork(historySize*8*sizeof(int),HopfieldNetwork::ACTIVATION_SIGNUM_HOPFIELD); //margin=0.0625; //historySize=5; } void teach(double * vect, int count){ int maxPatterns=100; int goodCount=0; int badCount=0; double * (goodPatterns [maxPatterns]); double * (badPatterns [maxPatterns]); //points2 -> difrence beetwen two next points double points2 [count-1]; for(int i=1;i<count;i++) points2[i-1]=vect[i]-vect[i-1]; //points2W -> relative diffrence beetwen who next points double point2W[count-1]; for(int i=0;i<count-1;i++)point2W[i]=points2[i]/vect[i]; //inPoint -> relative diffrence in int scale int inPoint[count -1]; double max=vect[0]; double min=vect[0]; for(int i=1;i<count;i++){ if(vect[i]>max)max=vect[i]; else if(vect[i]<min)min=vect[i]; } for(int i=0;i<count -1;i++)inPoint[i]=(int)((vect[i]-min)/(max-min)*(INT_MAX)); //create teching patterns //cout<<min<<" "<<max<<endl; //for(int i=0;i<count-1;i++)cout<<vect[i]<<" "<<inPoint[i]<<endl; for(int i=4;i<count -1;i++)if(point2W[i]>margin){//cout<<"positive:"<<" point:"<<vect[i]<<"future point:"<<vect[i+1]<<"point diffrence]"<<points2[i]<<"point relative diffrence"<<point2W[i]<<" "<<i<<endl; for(int k=i;k<i+5;k++)cout<<inPoint[k]<<" ";cout<<endl; for(int k=i;k<i+5;k++)cout<<(inPoint[k]^INT_MAX)<<" ";cout<<endl; goodPatterns[goodCount++]=toBinnaryPattern(inPoint,i,historySize); } else if(point2W[i]<-margin){//cout<<"negative:"<<" point:"<<vect[i]<<"future point:"<<vect[i+1]<<"point diffrence]"<<points2[i]<<"point relative diffrence"<<point2W[i]<<" "<<i<<endl; badPatterns[badCount++]=toBinnaryPattern(inPoint,i,historySize); } //teach networks cout<<goodCount<<" "<<badCount<<endl; hpGood->teach(goodPatterns,goodCount); hpBad->teach(badPatterns,badCount); //create database->crate map i c //int * pattern:double effecity } int * test(double * vect,int count){ //inPoint -> relative diffrence in int scale int inPoint[count -1]; double max=vect[0]; double min=vect[0]; for(int i=1;i<count -1;i++){ if(vect[i]>max)max=vect[i]; else if(vect[i]<min)min=vect[i]; } for(int i=0;i<count -1;i++)inPoint[i]=(int)((vect[i]-min)/(max-min)*(INT_MAX)); //cout<<max<<" "<<min<<endl; //for(int i=0;i<count-1;i++)cout<<inPoint[i]<<endl; double *pat; double effent=100; int status=-1; for(int i=4;i<count-1;i++) { pat=toBinnaryPattern(inPoint,i,historySize); HopfieldResult* hr=hpGood->recognize(pat); HopfieldResult* hr2=hpBad->recognize(pat); /*if(i<12){ int * sss=toSource(hr->out,5); for(int k=0;k<5;k++)cout<<sss[k]<<" "; cout<<endl;}*/ cout<<hr->iteration<<" "<<hr2->iteration<<" "<<((vect[i+1]-vect[i])/vect[i])<<endl; if((hr2->iteration)<100)status=-1; else if((hr->iteration)<100)status=1; effent=(status==1?effent=effent*(vect[i+1]/vect[i]):effent); cout<<effent<<" "<<100*vect[i+1]/vect[4]<<endl; //if(i%20==0)system("pause"); //you can print out vector } //MatrixUtils::printVector(pat,32*5); } };
[ "jakubjawor@gmail.com" ]
jakubjawor@gmail.com
ec2ff327d46feb8abdea3f2664d9ec582e93ac87
c81a507a4c76db54e9e29a2a457a017a8725a8c2
/src/utils/blitz_cpu_function.cc
5d8a2e148b75762408f97d9de7dfe93fac2f2fa6
[]
no_license
CSWater/blitz
b8e5d1f5a69a64a9dc12be7252f95ed40f2178c5
cc5488f1623f5b3161fa334e6813d499918dcc5e
refs/heads/master
2020-06-11T00:27:52.466242
2016-12-27T07:49:22
2016-12-27T07:49:22
75,832,706
1
0
null
2016-12-07T12:11:00
2016-12-07T12:10:59
null
UTF-8
C++
false
false
1,261
cc
#include "utils/blitz_cpu_function.h" #include "utils/common.h" namespace blitz { template<> void BlitzCPUGemm<float>( float* A, float* B, float* C, bool transa, bool transb, float alpha, float beta, size_t M, size_t N, size_t K) { CBLAS_TRANSPOSE TransA = transa ? CblasTrans : CblasNoTrans; size_t lda = transa ? M : K; CBLAS_TRANSPOSE TransB = transb ? CblasTrans : CblasNoTrans; size_t ldb = transb ? K : N; cblas_sgemm(CblasRowMajor, TransA, TransB, M, N, K, alpha, A, lda, B, ldb, beta, C, N); } template<> void BlitzCPUGemm<double>( double* A, double* B, double* C, bool transa, bool transb, double alpha, double beta, size_t M, size_t N, size_t K) { CBLAS_TRANSPOSE TransA = transa ? CblasTrans : CblasNoTrans; size_t lda = transa ? M : K; CBLAS_TRANSPOSE TransB = transb ? CblasTrans : CblasNoTrans; size_t ldb = transb ? K : N; cblas_dgemm(CblasRowMajor, TransA, TransB, M, N, K, alpha, A, lda, B, ldb, beta, C, N); } template<> void BlitzCPUCopy<float>(const float* X, float* Y, size_t N) { cblas_scopy(N, X, 1, Y, 1); } template<> void BlitzCPUCopy<double>(const double* X, double* Y, size_t N) { cblas_dcopy(N, X, 1, Y, 1); } } // namespace blitz
[ "robinho364@gmail.com" ]
robinho364@gmail.com
c192c6a8cfc267172569b64b982a58028f448a1f
3a57f314980afec9af97395bbc7986f8819220aa
/Numeral system convertor.cpp
f68e2f3739eaeb547c2960bc6e3cb9c900696ee5
[]
no_license
aiborodin/DM-Algo
16efec6c7ce2a0c41b2e4f880bd2f3cdd86140a8
d656f4456af66d8ce253ba0d35b19925ce60ecdb
refs/heads/master
2022-01-06T05:59:29.755287
2019-05-31T14:58:59
2019-05-31T14:58:59
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,202
cpp
#include "iostream" #include "cmath" using namespace std; int main() { long int N,n; int G,b,Num=0; cout << "Please enter your number => "; cin >> N; cout << "Please enter the scale of notation => "; cin >> G; n=N; // Проверка соответствия введённых чисел их системе счисления while (N>0) { b=N%10; if ((0 <= b) && (b < G)){ N=N/10; } else { cout << "\nPlease enter correct number for your scale of notation!\n\n"; exit(0); } } // Перевод в десятичную систему счисления for (int j=0; n>0; j++) { Num+=n%10*pow(G,j); n/=10; } // Перевод из десятичной в 'P' систему счисления int P; long int rez=0; cout << "\nPlease enter the system to convert into => "; cin >> P; for (int d=0; Num>0; d++) { rez += Num%P*pow(10, d); Num/=P; } cout << rez << " <= your number in " << P << "x system" <<'\n'<<endl; return 0; }
[ "noreply@github.com" ]
aiborodin.noreply@github.com
89df48c02c2792c0fddcba6f493e6c5576462b61
63da17d9c6876e26c699dc084734d46686a2cb9e
/inf-2-practical/06. Object Lifetime, RAII, Rule of 3/Sources/beer.cpp
82e06f08c5b876ce1135338ad6fe6e55b790713d
[]
no_license
semerdzhiev/oop-2020-21
0e069b1c09f61a3d5b240883cfe18f182e79bb04
b5285b9508285907045b5f3f042fc56c3ef34c26
refs/heads/main
2023-06-10T20:49:45.051924
2021-06-13T21:07:36
2021-06-13T21:07:36
338,046,214
18
17
null
2021-07-06T12:26:18
2021-02-11T14:06:18
C++
UTF-8
C++
false
false
783
cpp
#include <iostream> #include <cstring> #include "../Headers/beer.hpp" void Beer::copyFrom(const Beer &other) { brand = new char[strlen(other.brand) + 1]; strcpy(brand, other.brand); volume = other.volume; abv = other.abv; } void Beer:: free() { delete[] brand; } Beer:: Beer() { brand = new char[1]; brand[0] = '\0'; } Beer:: Beer(const char *_brand, unsigned _volume, double _abv) : volume(_volume), abv(_abv) { brand = new char[strlen(_brand) + 1]; strcpy(brand, _brand); } Beer& Beer:: operator=(const Beer &other) { if (this != &other) { free(); copyFrom(other); } return *this; } Beer:: ~Beer() { free(); } void Beer:: print() { std::cout << brand << " " << volume << " " << abv << std::endl; }
[ "blagovesta.simonova@gmail.com" ]
blagovesta.simonova@gmail.com
5c51abe8009ebfc9a56e3fec7a9f02c9c942632b
9594717431a92058bc368a7c55e79c777119d8b1
/src/kalman_filter.cpp
2ba71d8200fbf0f505e8c837b8f87d461f8ff6a6
[]
no_license
dills003/Extended_Kalman_Filter
bf064e9b3ee3009ac151d08a3002a04b0989f73c
2c939302fc56663079efb56ab7be5f0b63f3aab8
refs/heads/master
2021-01-23T01:17:50.667637
2017-05-31T01:30:03
2017-05-31T01:30:03
92,864,522
0
0
null
null
null
null
UTF-8
C++
false
false
2,706
cpp
#include "kalman_filter.h" #include <iostream> #define PI 3.14159265359 #define TINY_NUMBER .2 //used to check if radar px py are close to an axis using Eigen::MatrixXd; using Eigen::VectorXd; using namespace std; KalmanFilter::KalmanFilter() {} KalmanFilter::~KalmanFilter() {} void KalmanFilter::Init(VectorXd &x_in, MatrixXd &P_in, MatrixXd &F_in, MatrixXd &H_in, MatrixXd &R_in, MatrixXd &Q_in) { x_ = x_in; P_ = P_in; F_ = F_in; H_ = H_in; R_ = R_in; Q_ = Q_in; } void KalmanFilter::Predict() { /** TODO: * predict the state */ x_ = F_ * x_; // new state prediction - From Quiz MatrixXd Ft = F_.transpose(); //to get math to work P_ = F_ * P_ * Ft + Q_; //new state covariance matrix //cout << "P_: " << endl << P_ << endl; } void KalmanFilter::Update(const VectorXd &z) { /** TODO: * update the state by using Kalman Filter equations */ VectorXd y = z - (H_ * x_); //raw measurement subtract the guess, called error //dump error into UpdateShared, got rid of duplicate code, all fancy nonlinear does //is find error UpdateShared(y); //cout << "y from KF: " << endl << y << endl; } void KalmanFilter::UpdateEKF(const VectorXd &z) { /** TODO: * update the state by using Extended Kalman Filter equations */ //we need to take the state(x) and convert it back into polar //opposite of what we did with initialize float Px = x_(0); //position of x float Py = x_(1); //position of y float Vx = x_(2); //velocity in x float Vy = x_(3); //velocity in y float rho = sqrt((Px * Px) + (Py * Py)); //from lecture math float theta = atan2(Py, Px); //help says to use atan2 float rhoDot = (((Px * Vx) + (Py * Vy)) / (rho)); //check if Px and Py are not near their 0 respective axis points if (fabs(Px) > TINY_NUMBER && fabs(Py) > TINY_NUMBER) { //atan2 can return values larger than PI or smaller than -PI, fix it here while (theta > PI || theta < -PI) { if (theta > PI) { theta = theta - (2 * PI); } else if (theta < -PI) { theta = theta + (2 * PI); } } VectorXd hx = VectorXd(3); //creating my H * x polar vector hx << rho, theta, rhoDot; VectorXd y = z - hx; //error UpdateShared(y); //finish my update } } void KalmanFilter::UpdateShared(const VectorXd &y) { //Copied from Quiz MatrixXd Ht = H_.transpose(); //for KF calculation MatrixXd S = H_ * P_ * Ht + R_; //for KF calculation MatrixXd Si = S.inverse(); //for KF calculation MatrixXd PHt = P_ * Ht; //for KF calculation MatrixXd K = PHt * Si; //Kalman Gain //new estimates x_ = x_ + (K * y); //state estimate long x_size = x_.size(); MatrixXd I = MatrixXd::Identity(x_size, x_size); P_ = (I - (K * H_)) * P_; //state covariance estimate }
[ "dills003@gmail.com" ]
dills003@gmail.com
c07c914375bc514eae39955a9e34b4c8ec833769
53392ccfdc49ffde0d0372c93e065857e944f58f
/backjoon/10828.cpp
964a5b757f76cf31de57c89ac46d91d35b92a558
[]
no_license
pthdud1123/Algorithm
4524bf79103b90960ce47cabd0c6749181b77685
e0a461280f9cd968709f8b120eed0c6198c52a55
refs/heads/main
2023-08-23T04:23:30.931923
2021-11-02T09:07:58
2021-11-02T09:07:58
299,723,052
0
0
null
null
null
null
UHC
C++
false
false
790
cpp
#include<iostream> #include<stack> #include<string> using namespace std; int main() { int N;//명령의 수 cin >> N; stack<int> s;//int형 자료형을 저장하는 스택 생성 string a; for (int i = 0;i < N;i++) { cin >> a; if (a == "push") { int number; cin >> number; s.push(number); } else if (a == "pop") { if (s.empty() == 1)//스택이 비어있으면 1 { cout << -1<<endl; } else if (s.empty() == 0) {//스택이 비어있지 않으면 0 cout << s.top()<<endl; s.pop(); } } else if (a == "top") { if (s.empty() == 1) { cout << -1 << endl; } else { cout << s.top() << endl; } } else if (a == "size") { cout << s.size()<<endl; } else if (a == "empty") { cout << s.empty()<<endl; } } }
[ "68340532+pthdud1123@users.noreply.github.com" ]
68340532+pthdud1123@users.noreply.github.com
636b8a3a256d8f0802f4b6018ca3b8a8b0cd9fc0
70fa0ad1dbc8326130f68309bd61b4e30f2d8a4d
/mosp/mosp-client/terrain.h
edd2d7764c30f820b4ff617f3d3155a70e594708
[]
no_license
alongubkin/mosp
cb21f9faa4b66f2cc6e1f6625c2ab0495b138ef1
bba6ab1a4cb78e75bcd2aa65d748601a355b0a1c
refs/heads/master
2020-04-07T05:54:44.149987
2015-04-10T11:05:50
2015-04-10T11:05:50
24,295,645
1
1
null
null
null
null
UTF-8
C++
false
false
131
h
#pragma once #include "stdafx.h" class Terrain { public: Terrain(Ogre::SceneManager* sceneManager); ~Terrain(); };
[ "guymor4@gmail.com" ]
guymor4@gmail.com
97bedaba838016a92f009995a52547b43fdd78ca
e9acf56f8545281397b5da70954c01f216080a1a
/Notes/Notes.ino
cf77179347b014eeb59f8ed75ddc5ee29a4a9edf
[]
no_license
melimathlete/Artduino
3ad4f1805ad03d8f9c6d9f9a57893ae9bbc9bf5f
1cf65c96fd1a0f8e9927b4debf75ecc7b84e77de
refs/heads/master
2020-04-11T09:59:42.481954
2018-12-14T00:20:43
2018-12-14T00:20:43
161,698,994
0
0
null
null
null
null
UTF-8
C++
false
false
3,880
ino
#include <Servo.h> class Eighth{ Servo finger1; // create servo object to control a servo // twelve servo objects can be created on most boards const byte pin; int pos = 0; // variable to store the servo position int count = 0; void setup() { // put your setup code here, to run once: finger1.attach(pin); } void loop() { for (pos = 0; pos <= 90; pos += 10) { finger1.write(pos); delay(10); } delay(90); for (pos = 90; pos >= 0; pos -= 10) { finger1.write(pos); delay(10); } } }; class Quarter { Servo finger1; // create servo object to control a servo // twelve servo objects can be created on most boards const byte pin; int pos = 0; // variable to store the servo position int count = 0; void setup() { // put your setup code here, to run once: finger1.attach(pin); } void loop() { for (pos = 0; pos <= 90; pos += 10) { finger1.write(pos); delay(10); } delay(180); for (pos = 90; pos >= 0; pos -= 10) { finger1.write(pos); delay(10); } } }; class Half{ Servo finger1; // create servo object to control a servo // twelve servo objects can be created on most boards const byte pin; int pos = 0; // variable to store the servo position int count = 0; void setup() { // put your setup code here, to run once: finger1.attach(pin); } void loop() { for (pos = 0; pos <= 90; pos += 10) { finger1.write(pos); delay(10); } delay(180 * 2); for (pos = 90; pos >= 0; pos -= 10) { finger1.write(pos); delay(10); } } }; class Whole{ Servo finger1; // create servo object to control a servo // twelve servo objects can be created on most boards const byte pin; int pos = 0; // variable to store the servo position int count = 0; void setup() { // put your setup code here, to run once: finger1.attach(pin); } void loop() { for (pos = 0; pos <= 90; pos += 10) { finger1.write(pos); delay(10); } delay(180 * 4); for (pos = 90; pos >= 0; pos -= 10) { finger1.write(pos); delay(10); } } }; class REighth{ Servo finger1; // create servo object to control a servo // twelve servo objects can be created on most boards const byte pin; int pos = 0; // variable to store the servo position int count = 0; void setup() { // put your setup code here, to run once: finger1.attach(pin); } void loop() { //180 msecond per eighth note delay(180); } }; class RQuarter{ Servo finger1; // create servo object to control a servo // twelve servo objects can be created on most boards const byte pin; int pos = 0; // variable to store the servo position int count = 0; void setup() { // put your setup code here, to run once: finger1.attach(pin); } void loop() { //180 msecond per eighth note delay(180*2); } }; class RHalf{ Servo finger1; // create servo object to control a servo // twelve servo objects can be created on most boards const byte pin; int pos = 0; // variable to store the servo position int count = 0; void setup() { // put your setup code here, to run once: finger1.attach(pin); } void loop() { //180 msecond per eighth note delay(180*4); } }; class RWhole{ Servo finger1; // create servo object to control a servo // twelve servo objects can be created on most boards const byte pin; int pos = 0; // variable to store the servo position int count = 0; void setup() { // put your setup code here, to run once: finger1.attach(pin); } void loop() { //180 msecond per eighth note delay(180*8); } }; //Jingle Bells //4 4 2 | 4 4 2 | 4 4 4 /8 8 | 2 /2| //180 msecond per eighth note Quarter(); Quarter(); Half();
[ "23112766+melimathlete@users.noreply.github.com" ]
23112766+melimathlete@users.noreply.github.com
463b08aa178a56a90e6ce90dbb61befd620a864a
357a90a4524b0b8450a2390577cbb41c20b78154
/JAMA firmware/include/SistemasdeControle/src/restrictedOptimization/quadprog.hpp
5dbdc8f827fef76e825646876248678d5e5fe29b
[ "MIT" ]
permissive
tuliofalmeida/jama
23b8709c2c92a933f35fae5ba847a9938c676f0f
6ec30ea23e79e8a95515f4a47519df9e8ac04b31
refs/heads/main
2023-08-18T07:07:49.108809
2021-09-28T13:26:33
2021-09-28T13:26:33
363,915,045
11
1
null
null
null
null
UTF-8
C++
false
false
261
hpp
#ifdef testModel #include "../../../headers/restrictedOptimization/quadprog.h" #else #include "SistemasdeControle/headers/restrictedOptimization/quadprog.h" #endif template<typename Type> restrictedOptimizationHandler::QuadProg<Type>::QuadProg() { }
[ "tuliofalmeida@hotmail.com" ]
tuliofalmeida@hotmail.com
fdf88e1db5361a69062b299597680d4e371f7091
9cc5f7d71dcf3fd486e040e0a0237d5320a4929b
/mslquad/include/mslquad/pose_track_controller.h
8540f82328d3b6af245a133bd4aa611d5c802296
[ "MIT" ]
permissive
IngTIKNA/msl_quad_GameTheoretic
8291b6741d7d31799a46844ab29d00efac024596
c319ecf4ba1063075221b67f12f4e017992f28fc
refs/heads/master
2023-03-21T20:10:48.132066
2020-12-14T23:46:35
2020-12-14T23:46:35
null
0
0
null
null
null
null
UTF-8
C++
false
false
897
h
/* copyright[2019] <msl> ************************************************************************** File Name : pose_track_controller.h Author : Kunal Shah Multi-Robot Systems Lab (MSL), Stanford University Contact : k2shah@stanford.edu Create Time : Dec 3, 2018. Description : Basic control + pose tracking **************************************************************************/ #ifndef __POSE_TRACK_CONTROLELR_H__ #define __POSE_TRACK_CONTROLELR_H__ #include<mslquad/px4_base_controller.h> class PoseTrackController : public PX4BaseController { public: PoseTrackController(); ~PoseTrackController(); protected: geometry_msgs::PoseStamped targetPoseSp_; void controlLoop(void) override; private: ros::Subscriber poseTargetSub_; // px4 pose sub void poseTargetCB(const geometry_msgs::Pose::ConstPtr& msg); }; #endif
[ "kshah.kunal@gmail.com" ]
kshah.kunal@gmail.com
4fed4c112ede12f6214d3c80c0ae55480efd56f7
2b60d3054c6c1ee01f5628b7745ef51f5cd3f07a
/Gemotry/days/MATRIX3.h
99eab52af07d63a179e0a1bbcf33e4764299de79
[]
no_license
LUOFQ5/NumericalProjectsCollections
01aa40e61747d0a38e9b3a3e05d8e6857f0e9b89
6e177a07d9f76b11beb0974c7b720cd9c521b47e
refs/heads/master
2023-08-17T09:28:45.415221
2021-10-04T15:32:48
2021-10-04T15:32:48
414,977,957
1
0
null
null
null
null
UTF-8
C++
false
false
6,905
h
/* QUIJIBO: Source code for the paper Symposium on Geometry Processing 2015 paper "Quaternion Julia Set Shape Optimization" Copyright (C) 2015 Theodore Kim This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _MAT3_H_ #define _MAT3_H_ #include <VEC3.h> #ifndef M_PI #define M_PI 3.14159265358979323846 #endif ////////////////////////////////////////////////////////////////////// // 3x3 Matrix class - adapted from libgfx by Michael Garland ////////////////////////////////////////////////////////////////////// class MATRIX3 { private: VEC3F row[3]; public: // Standard constructors MATRIX3() { *this = 0.0; } MATRIX3(const VEC3F& r0,const VEC3F& r1,const VEC3F& r2) { row[0]=r0; row[1]=r1; row[2]=r2; } MATRIX3(const MATRIX3& m) { *this = m; } MATRIX3(Real* data); // Access methods Real& operator()(int i, int j) { return row[i][j]; } Real operator()(int i, int j) const { return row[i][j]; } VEC3F& operator[](int i) { return row[i]; } const VEC3F& operator[](int i) const { return row[i]; } inline VEC3F col(int i) const {return VEC3F(row[0][i],row[1][i],row[2][i]);} operator Real*() { return row[0]; } operator const Real*() { return row[0]; } operator const Real*() const { return row[0]; } // Assignment methods inline MATRIX3& operator=(const MATRIX3& m); inline MATRIX3& operator=(Real s); inline MATRIX3& operator+=(const MATRIX3& m); inline MATRIX3& operator-=(const MATRIX3& m); inline MATRIX3& operator*=(Real s); inline MATRIX3& operator/=(Real s); // Construction of standard matrices static MATRIX3 I(); static MATRIX3 outer_product(const VEC3F& u, const VEC3F& v); static MATRIX3 outer_product(const VEC3F& v); static MATRIX3 cross(const VEC3F& v); MATRIX3& diag(Real d); MATRIX3& ident() { return diag(1.0); } MATRIX3 inverse() { MATRIX3 A = adjoint(); Real d = A[0] * row[0]; if (d == 0.0f) return ident(); A = A.transpose(); A /= d; return A; }; MATRIX3 adjoint() { return MATRIX3(row[1]^row[2], row[2]^row[0], row[0]^row[1]); }; MATRIX3 transpose() const { return MATRIX3(this->col(0), this->col(1), this->col(2)); }; void clear() { row[0].clear(); row[1].clear(); row[2].clear(); }; // theta is in RADIANS static MATRIX3 rotation(VEC3F axis, Real theta) { axis *= 1.0 / norm(axis); #ifdef QUAD_PRECISION Real cosTheta = cosq(theta); Real sinTheta = sinq(theta); #else Real cosTheta = cos(theta); Real sinTheta = sin(theta); #endif Real versine = (1.0 - cosTheta); MATRIX3 R; R(0,0) = axis[0] * axis[0] * versine + cosTheta; R(0,1) = axis[0] * axis[1] * versine - axis[2] * sinTheta; R(0,2) = axis[0] * axis[2] * versine + axis[1] * sinTheta; R(1,0) = axis[1] * axis[0] * versine + axis[2] * sinTheta; R(1,1) = axis[1] * axis[1] * versine + cosTheta; R(1,2) = axis[1] * axis[2] * versine - axis[0] * sinTheta; R(2,0) = axis[2] * axis[0] * versine - axis[1] * sinTheta; R(2,1) = axis[2] * axis[1] * versine + axis[0] * sinTheta; R(2,2) = axis[2] * axis[2] * versine + cosTheta; return R; }; static MATRIX3 exp(VEC3F omega); static MATRIX3 dexp(VEC3F omega); static MATRIX3 cayley(VEC3F omega); Real contraction(MATRIX3& rhs) { Real sum = 0.0; for (int y = 0; y < 3; y++) for (int x = 0; x < 3; x++) sum += (*this)(x,y) * rhs(x,y); return sum; }; Real squaredSum() { Real dot = 0; for (int x = 0; x < 3; x++) dot += row[x] * row[x]; return dot; }; Real absSum() { Real sum = 0.0; for (int y = 0; y < 3; y++) for (int x = 0; x < 3; x++) sum += (*this)(x,y); return sum; }; void setToIdentity() { this->clear(); (*this)(0,0) = 1.0; (*this)(1,1) = 1.0; (*this)(2,2) = 1.0; } void read(FILE* file); }; //////////////////////////////////////////////////////////////////////// // Method definitions //////////////////////////////////////////////////////////////////////// inline MATRIX3& MATRIX3::operator=(const MATRIX3& m) { row[0] = m[0]; row[1] = m[1]; row[2] = m[2]; return *this; } inline MATRIX3& MATRIX3::operator=(Real s) { row[0]=s; row[1]=s; row[2]=s; return *this; } inline MATRIX3& MATRIX3::operator+=(const MATRIX3& m) { row[0] += m[0]; row[1] += m[1]; row[2] += m[2]; return *this; } inline MATRIX3& MATRIX3::operator-=(const MATRIX3& m) { row[0] -= m[0]; row[1] -= m[1]; row[2] -= m[2]; return *this; } inline MATRIX3& MATRIX3::operator*=(Real s) { row[0] *= s; row[1] *= s; row[2] *= s; return *this; } inline MATRIX3& MATRIX3::operator/=(Real s) { row[0] /= s; row[1] /= s; row[2] /= s; return *this; } //////////////////////////////////////////////////////////////////////// // Operator definitions //////////////////////////////////////////////////////////////////////// inline MATRIX3 operator+(const MATRIX3& n, const MATRIX3& m) { return MATRIX3(n[0]+m[0], n[1]+m[1], n[2]+m[2]); } inline MATRIX3 operator-(const MATRIX3& n, const MATRIX3& m) { return MATRIX3(n[0]-m[0], n[1]-m[1], n[2]-m[2]); } inline MATRIX3 operator-(const MATRIX3& m) { return MATRIX3(-m[0], -m[1], -m[2]); } inline MATRIX3 operator*(Real s, const MATRIX3& m) { return MATRIX3(m[0]*s, m[1]*s, m[2]*s); } inline MATRIX3 operator*(const MATRIX3& m, Real s) { return s*m; } inline MATRIX3 operator/(const MATRIX3& m, Real s) { return MATRIX3(m[0]/s, m[1]/s, m[2]/s); } inline VEC3F operator*(const MATRIX3& m, const VEC3F& v) { return VEC3F(m[0]*v, m[1]*v, m[2]*v); } extern MATRIX3 operator*(const MATRIX3& n, const MATRIX3& m); inline std::ostream &operator<<(std::ostream &out, const MATRIX3& M) { return out << "[" << std::endl << M[0] << std::endl << M[1] << std::endl << M[2] << std::endl << "]" << std::endl; } #ifndef QUAD_PRECISION inline std::istream &operator>>(std::istream &in, MATRIX3& M) { return in >> M[0] >> M[1] >> M[2]; } #endif //////////////////////////////////////////////////////////////////////// // Misc. function definitions //////////////////////////////////////////////////////////////////////// inline Real det(const MATRIX3& m) { return m[0] * (m[1] ^ m[2]); } inline Real trace(const MATRIX3& m) { return m(0,0) + m(1,1) + m(2,2); } #endif
[ "1614345603@qq.com" ]
1614345603@qq.com
56f67949970c589a86b7e1e5936801baf6e9065f
877fff5bb313ccd23d1d01bf23b1e1f2b13bb85a
/app/src/main/cpp/dir7941/dir22441/dir22442/dir25702/file25728.cpp
de8c04788e3effc89bd4e4e9dd150143a722800e
[]
no_license
tgeng/HugeProject
829c3bdfb7cbaf57727c41263212d4a67e3eb93d
4488d3b765e8827636ce5e878baacdf388710ef2
refs/heads/master
2022-08-21T16:58:54.161627
2020-05-28T01:54:03
2020-05-28T01:54:03
267,468,475
0
0
null
null
null
null
UTF-8
C++
false
false
115
cpp
#ifndef file25728 #error "macro file25728 must be defined" #endif static const char* file25728String = "file25728";
[ "tgeng@google.com" ]
tgeng@google.com
d71df32120da785f048dadf8ac343d8199f9d6f8
2e37dcef53c5f5dbd8d3e5eec50884375bf02750
/src/Render/BlockData/BlockVolumeManager.hpp
526ab4467a068e414e068ffb24a3d601780e0578
[]
no_license
wyzwzz/NeuronAnnotation
2e121b5be02f9420caa3076d52de448c2e0802b4
994f3525ab69c1c65b93139e974265e9d16bc481
refs/heads/main
2023-04-25T11:23:32.268258
2021-05-18T08:21:55
2021-05-18T08:21:55
352,972,843
0
1
null
null
null
null
UTF-8
C++
false
false
2,239
hpp
// // Created by wyz on 2021/4/19. // #ifndef NEURONANNOTATION_BLOCKVOLUMEMANAGER_HPP #define NEURONANNOTATION_BLOCKVOLUMEMANAGER_HPP #include<VoxelCompression/voxel_uncompress/VoxelUncompress.h> #include<VoxelCompression/voxel_compress/VoxelCmpDS.h> #include<list> #include<Common/utils.hpp> #include<Common/help_cuda.hpp> #define WORKER_NUM 3 class Worker; class CUMemPool; class BlockDesc{ public: BlockDesc()=default; // BlockDesc(const BlockDesc&)=delete; BlockDesc(const std::array<uint32_t ,3>& idx):block_index(idx),data_ptr(0),size(0){} BlockDesc& operator=(const BlockDesc& block){ this->block_index=block.block_index; this->data_ptr=block.data_ptr; this->size=block.size; return *this; } void release(){ data_ptr=0; size=0; } std::array<uint32_t,3> block_index; CUdeviceptr data_ptr; int64_t size; }; class BlockReqInfo{ public: //uncompress and load new blocks std::vector<std::array<uint32_t,3>> request_blocks_queue; //stop task for no need blocks std::vector<std::array<uint32_t,3>> noneed_blocks_queue; }; class BlockVolumeManager { public: explicit BlockVolumeManager(const char* path); BlockVolumeManager(const BlockVolumeManager&)=delete; BlockVolumeManager(BlockVolumeManager&&)=delete; ~BlockVolumeManager(); public: auto getVolumeInfo()->std::tuple<uint32_t,uint32_t,std::array<uint32_t,3>> ; void setupBlockReqInfo(const BlockReqInfo&); bool getBlock(BlockDesc&); void updateCUMemPool(CUdeviceptr); private: void initResource(); void initCUResource(); void initUtilResource(); void startWorking(); private: CUcontext cu_context; std::unique_ptr<CUMemPool> cu_mem_pool; std::unique_ptr<sv::Reader> reader; std::vector<Worker> workers; std::list<BlockDesc> packages; std::unique_ptr<ThreadPool> jobs; ConcurrentQueue<BlockDesc> products; std::thread working_line; bool stop; std::mutex mtx; std::condition_variable worker_cv; std::condition_variable package_cv; uint32_t block_length; uint32_t padding; std::array<uint32_t,3> block_dim; }; #endif //NEURONANNOTATION_BLOCKVOLUMEMANAGER_HPP
[ "1076499338@qq.com" ]
1076499338@qq.com
794a8b1229fb1a1593f9dcce63cf516678633333
431afef3d33961f5ba15aeaa115bbeeeeae66257
/atcoder/abc/090/c/main.cpp
5bf486e6feaf1efe329dc7154c98496e21a4555b
[]
no_license
cashiwamochi/kyopro_shojin
55c1c3c300d403fff16f649a54d8fa0a0e3260de
4e8b38acc06279e9125ce1d49de92aad9194dee7
refs/heads/master
2022-11-06T13:35:07.644594
2020-06-21T14:57:54
2020-06-21T14:57:54
268,121,951
0
0
null
null
null
null
UTF-8
C++
false
false
205
cpp
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <vector> using namespace std; int main() { long long row, col; cin >> row >> col; cout << abs((row - 2) * (col - 2)) << endl; return 0; }
[ "ryo.cv.0311@gmail.com" ]
ryo.cv.0311@gmail.com
182392ea7489be2b62453fe1303726e2f7c5b71b
af525264bc4f1390358b00877eb932fa9a43bd76
/reference/variables.h
fb5d9f93b572ad943520ac7dad6cd9dce2282753
[ "BSD-3-Clause" ]
permissive
kohnakagawa/mdacp_oacc
2c274ab18e21b05f41b42f009dbc3a703b89b0d2
91655b9bce5c53292bbc494685c4e0c85f347bd3
refs/heads/master
2022-01-26T17:20:09.994213
2019-05-04T13:55:11
2019-05-04T13:55:11
105,779,808
0
0
null
null
null
null
UTF-8
C++
false
false
1,440
h
//---------------------------------------------------------------------- #ifndef variables_h #define variables_h //---------------------------------------------------------------------- #include <iostream> #include "mdconfig.h" #include "simulationinfo.h" //---------------------------------------------------------------------- class Variables { private: int particle_number; int total_particle_number; double C0, C2; public: Variables(void); int type[N]; __attribute__((aligned(64))) double q[N][D]; __attribute__((aligned(64))) double p[N][D]; double Zeta; double SimulationTime; double GetC0(void) {return C0;}; double GetC2(void) {return C2;}; int GetParticleNumber(void) {return particle_number;}; int GetTotalParticleNumber(void) {return total_particle_number;}; void AddParticle(double x[D], double v[D], int t = 0); void SaveToStream(std::ostream &fs); void LoadFromStream(std::istream &fs); void SaveConfiguration(std::ostream &fs); void SetParticleNumber(int pn) {particle_number = pn;}; void SetTotalParticleNumber(int pn) {total_particle_number = pn;}; void AdjustPeriodicBoundary(SimulationInfo *sinfo); void SetInitialVelocity(double V0, const int id); void ChangeScale(double alpha); // For Debug void Shuffle(void); }; //---------------------------------------------------------------------- #endif //----------------------------------------------------------------------
[ "tsunekou1019@gmail.com" ]
tsunekou1019@gmail.com
4f4f8b77ae5e5f840aef4811957c3f7b5f6864ae
7a3e3a3406bfd7fb6537a3b44c65a68daf2137af
/deps/v8/src/base/utils/random-number-generator.cc
3b38858192970e3f6e6d61ff7599a225dcf8d5e7
[ "MIT" ]
permissive
billywhizz/dv8
14346c0f98f47da20e5354b543c9b4393f138198
0304830e5252e9fa779acb619807834324ac3842
refs/heads/master
2020-03-28T19:12:46.047798
2019-12-30T00:19:04
2019-12-30T00:19:04
148,955,110
10
1
MIT
2019-12-30T00:19:05
2018-09-16T02:05:35
C++
UTF-8
C++
false
false
6,262
cc
// Copyright 2013 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "src/base/utils/random-number-generator.h" #include <stdio.h> #include <stdlib.h> #include <algorithm> #include <new> #include "src/base/bits.h" #include "src/base/macros.h" #include "src/base/platform/mutex.h" #include "src/base/platform/time.h" namespace v8 { namespace base { static LazyMutex entropy_mutex = LAZY_MUTEX_INITIALIZER; static RandomNumberGenerator::EntropySource entropy_source = nullptr; // static void RandomNumberGenerator::SetEntropySource(EntropySource source) { MutexGuard lock_guard(entropy_mutex.Pointer()); entropy_source = source; } RandomNumberGenerator::RandomNumberGenerator() { // Check if embedder supplied an entropy source. { MutexGuard lock_guard(entropy_mutex.Pointer()); if (entropy_source != nullptr) { int64_t seed; if (entropy_source(reinterpret_cast<unsigned char*>(&seed), sizeof(seed))) { SetSeed(seed); return; } } } #if V8_OS_CYGWIN || V8_OS_WIN // Use rand_s() to gather entropy on Windows. See: // https://code.google.com/p/v8/issues/detail?id=2905 unsigned first_half, second_half; errno_t result = rand_s(&first_half); DCHECK_EQ(0, result); result = rand_s(&second_half); DCHECK_EQ(0, result); SetSeed((static_cast<int64_t>(first_half) << 32) + second_half); #else // Gather entropy from /dev/urandom if available. FILE* fp = fopen("/dev/urandom", "rb"); if (fp != nullptr) { int64_t seed; size_t n = fread(&seed, sizeof(seed), 1, fp); fclose(fp); if (n == 1) { SetSeed(seed); return; } } // We cannot assume that random() or rand() were seeded // properly, so instead of relying on random() or rand(), // we just seed our PRNG using timing data as fallback. // This is weak entropy, but it's sufficient, because // it is the responsibility of the embedder to install // an entropy source using v8::V8::SetEntropySource(), // which provides reasonable entropy, see: // https://code.google.com/p/v8/issues/detail?id=2905 int64_t seed = Time::NowFromSystemTime().ToInternalValue() << 24; seed ^= TimeTicks::HighResolutionNow().ToInternalValue() << 16; seed ^= TimeTicks::Now().ToInternalValue() << 8; SetSeed(seed); #endif // V8_OS_CYGWIN || V8_OS_WIN } int RandomNumberGenerator::NextInt(int max) { DCHECK_LT(0, max); // Fast path if max is a power of 2. if (bits::IsPowerOfTwo(max)) { return static_cast<int>((max * static_cast<int64_t>(Next(31))) >> 31); } while (true) { int rnd = Next(31); int val = rnd % max; if (std::numeric_limits<int>::max() - (rnd - val) >= (max - 1)) { return val; } } } double RandomNumberGenerator::NextDouble() { XorShift128(&state0_, &state1_); return ToDouble(state0_); } int64_t RandomNumberGenerator::NextInt64() { XorShift128(&state0_, &state1_); return bit_cast<int64_t>(state0_ + state1_); } void RandomNumberGenerator::NextBytes(void* buffer, size_t buflen) { for (size_t n = 0; n < buflen; ++n) { static_cast<uint8_t*>(buffer)[n] = static_cast<uint8_t>(Next(8)); } } static std::vector<uint64_t> ComplementSample( const std::unordered_set<uint64_t>& set, uint64_t max) { std::vector<uint64_t> result; result.reserve(max - set.size()); for (uint64_t i = 0; i < max; i++) { if (!set.count(i)) { result.push_back(i); } } return result; } std::vector<uint64_t> RandomNumberGenerator::NextSample(uint64_t max, size_t n) { CHECK_LE(n, max); if (n == 0) { return std::vector<uint64_t>(); } // Choose to select or exclude, whatever needs fewer generator calls. size_t smaller_part = static_cast<size_t>( std::min(max - static_cast<uint64_t>(n), static_cast<uint64_t>(n))); std::unordered_set<uint64_t> selected; size_t counter = 0; while (selected.size() != smaller_part && counter / 3 < smaller_part) { uint64_t x = static_cast<uint64_t>(NextDouble() * max); CHECK_LT(x, max); selected.insert(x); counter++; } if (selected.size() == smaller_part) { if (smaller_part != n) { return ComplementSample(selected, max); } return std::vector<uint64_t>(selected.begin(), selected.end()); } // Failed to select numbers in smaller_part * 3 steps, try different approach. return NextSampleSlow(max, n, selected); } std::vector<uint64_t> RandomNumberGenerator::NextSampleSlow( uint64_t max, size_t n, const std::unordered_set<uint64_t>& excluded) { CHECK_GE(max - excluded.size(), n); std::vector<uint64_t> result; result.reserve(max - excluded.size()); for (uint64_t i = 0; i < max; i++) { if (!excluded.count(i)) { result.push_back(i); } } // Decrease result vector until it contains values to select or exclude, // whatever needs fewer generator calls. size_t larger_part = static_cast<size_t>( std::max(max - static_cast<uint64_t>(n), static_cast<uint64_t>(n))); // Excluded set may cause that initial result is already smaller than // larget_part. while (result.size() != larger_part && result.size() > n) { size_t x = static_cast<size_t>(NextDouble() * result.size()); CHECK_LT(x, result.size()); std::swap(result[x], result.back()); result.pop_back(); } if (result.size() != n) { return ComplementSample( std::unordered_set<uint64_t>(result.begin(), result.end()), max); } return result; } int RandomNumberGenerator::Next(int bits) { DCHECK_LT(0, bits); DCHECK_GE(32, bits); XorShift128(&state0_, &state1_); return static_cast<int>((state0_ + state1_) >> (64 - bits)); } void RandomNumberGenerator::SetSeed(int64_t seed) { initial_seed_ = seed; state0_ = MurmurHash3(bit_cast<uint64_t>(seed)); state1_ = MurmurHash3(~state0_); CHECK(state0_ != 0 || state1_ != 0); } uint64_t RandomNumberGenerator::MurmurHash3(uint64_t h) { h ^= h >> 33; h *= uint64_t{0xFF51AFD7ED558CCD}; h ^= h >> 33; h *= uint64_t{0xC4CEB9FE1A85EC53}; h ^= h >> 33; return h; } } // namespace base } // namespace v8
[ "apjohnsto@gmail.com" ]
apjohnsto@gmail.com
cf931824ea06e865c56fdd5197595529355c3058
7065ae03809c28f18acc5b0e32d7cb2c371ca2f9
/P147-P166 职工管理系统/employee.cpp
0d4af88386846ec2b35f7b812b20b547836a741c
[]
no_license
callmer00t/cpp_learning
63d6bd12879590d20da117cfe5c67cf8791b4252
703bf026a723c59a8dde592b0b3b0769086cbfd4
refs/heads/master
2023-07-22T02:38:40.705882
2021-08-17T07:07:33
2021-08-17T07:07:33
386,171,041
0
0
null
null
null
null
GB18030
C++
false
false
464
cpp
#include"employee.h" //构造函数 Employee::Employee(int id, string name, int dId) { this->m_Id = id; this->m_Name = name; this->m_DeptId = dId; } //显示个人信息 void Employee::showInfo() { cout << "职工编号:" << this->m_Id << "\t职工姓名:" << this->m_Name << "\t岗位:" << this->getDeptName() << "\t岗位职责:完成经理交付的任务" << endl; } //获取岗位名称 string Employee::getDeptName() { return string("员工"); }
[ "lastwinter07@gmail.com" ]
lastwinter07@gmail.com
61699bacaf9ce57e6a873b3f969ed14fe9ecb78f
74560ccbb4dc00a899d4092403434a6361b69ae4
/src/cmake_test/test_others/ADialog.cpp
9d75672617addef930ac50f9219c591dd0f41225
[]
no_license
crystalsky/my_test
4d76ed10da7b04d24bd0b58d16f44d26bb9e8a5e
0723a4e136cda5e9ddd0d49a091ff8a1e47ab751
refs/heads/master
2020-03-18T07:03:45.131476
2018-05-22T15:18:17
2018-05-22T15:18:17
134,430,003
1
0
null
null
null
null
UTF-8
C++
false
false
210
cpp
#include "ADialog.h" #include "ui_ADialog.h" ADialog::ADialog(QDialog* parent) : QDialog(parent) , m_pUI(new Ui::ADialog()) { m_pUI->setupUi(this); } ADialog::~ADialog() { delete m_pUI; m_pUI = NULL; }
[ "crystalsky@foxmail.com" ]
crystalsky@foxmail.com
87d4f7da3dd9772cb511aa92bf573cd0f308ef00
e117ebe47e11c7d6b5bc7f6fd406ff4d9d76a5fc
/Ultrasonic4.ino
bc61f1637b6bb437b9da94a7d122f6bad39430b9
[]
no_license
arindamgupta077/Obstacle_Detector
885688b75fdb2afd8610792cbb16e8c8e894d1c9
9f112dac6d00dbc573cb2d830a1ca870882f945e
refs/heads/master
2021-01-01T01:34:33.539150
2020-02-08T11:52:46
2020-02-08T11:52:46
239,123,677
0
0
null
null
null
null
UTF-8
C++
false
false
3,037
ino
const int trigPin1 = 2; const int echoPin1 = 3; const int trigPin2 = 4; const int echoPin2 = 5; const int trigPin3 = 6; const int echoPin3 = 7; const int trigPin4 = 8; const int echoPin4 = 9; const int buzzer=13; const int analogInPin = A0; long duration1,duration2,duration3,duration4; int distance1,distance2,distance3,distance4; void setup() { pinMode(trigPin1, OUTPUT); // Sets the trigPin as an Output pinMode(echoPin1, INPUT); // Sets the echoPin as an Input pinMode(trigPin2, OUTPUT); // Sets the trigPin as an Output pinMode(echoPin2, INPUT); // Sets the echoPin as an Input pinMode(trigPin3, OUTPUT); // Sets the trigPin as an Output pinMode(echoPin3, INPUT); // Sets the echoPin as an Input pinMode(trigPin4, OUTPUT); // Sets the trigPin as an Output pinMode(echoPin4, INPUT); // Sets the echoPin as an Input pinMode(buzzer, OUTPUT); Serial.begin (9600); } void loop() { int sensorValue,outputValue, i=0; sensorValue = analogRead(analogInPin); outputValue = map(sensorValue, 0, 1023, 0, 255); Serial.print("\t output = "); Serial.println(outputValue); digitalWrite(trigPin1, LOW); delayMicroseconds(2); digitalWrite(trigPin1, HIGH); delayMicroseconds(10); digitalWrite(trigPin1, LOW); duration1 = pulseIn(echoPin1, HIGH); distance1= duration1*0.034/2; Serial.print ( "Sensor1 "); Serial.print (distance1); Serial.println("cm"); if(distance1<outputValue) { do{ i++; tone(buzzer,800); delay(200); noTone(buzzer); delay(200); } while(i<=1); delay(2000); } digitalWrite(trigPin2, LOW); delayMicroseconds(2); digitalWrite(trigPin2, HIGH); delayMicroseconds(10); digitalWrite(trigPin2, LOW); duration2 = pulseIn(echoPin2, HIGH); distance2= duration2*0.034/2; Serial.print ( "Sensor2 "); Serial.print (distance2); Serial.println("cm"); i=0; if(distance2<outputValue) { do{ i++; tone(buzzer,800); delay(200); noTone(buzzer); delay(200); } while(i<=2); delay(2000); } digitalWrite(trigPin3, LOW); delayMicroseconds(2); digitalWrite(trigPin3, HIGH); delayMicroseconds(10); digitalWrite(trigPin3, LOW); duration3 = pulseIn(echoPin3, HIGH); distance3= duration3*0.034/2; Serial.print ( "Sensor3 "); Serial.print (distance3); Serial.println("cm"); i=0; if(distance3<outputValue) { do{ i++; tone(buzzer,800); delay(200); noTone(buzzer); delay(200); } while(i<=3); delay(2000); } digitalWrite(trigPin4, LOW); delayMicroseconds(2); digitalWrite(trigPin4, HIGH); delayMicroseconds(10); digitalWrite(trigPin4, LOW); duration4 = pulseIn(echoPin4, HIGH); distance4= duration4*0.034/2; Serial.print ( "Sensor4 "); Serial.print (distance4); Serial.println("cm"); i=0; if(distance4<outputValue) { do { i++; tone(buzzer,800); delay(200); noTone(buzzer); delay(200); } while(i<=4); delay(2000); } }
[ "noreply@github.com" ]
arindamgupta077.noreply@github.com
686d49b4137cda97205f536e7cec559958a73362
fe7150e6178a9d93baa720f1eb4fe2b8365613ae
/src/pConvexHullTest/main.cpp
c5292471cdf6293621945ee071cb8058cd7bb0e4
[]
no_license
nicrip/moos-ivp-marineswarm
2db0a327881a528e5b8914b795b0516590c7bfd7
f2e2043e278c9ca51d3aee37ed2ab31005d98ca1
refs/heads/master
2021-01-10T07:09:46.987103
2015-10-22T19:59:40
2015-10-22T19:59:40
44,127,701
6
2
null
2015-10-21T15:39:36
2015-10-12T18:56:24
C++
UTF-8
C++
false
false
1,571
cpp
/************************************************************/ /* NAME: */ /* ORGN: MIT */ /* FILE: main.cpp */ /* DATE: */ /************************************************************/ #include <string> #include "MBUtils.h" #include "ColorParse.h" #include "ConvexHullTest.h" #include "ConvexHullTest_Info.h" using namespace std; int main(int argc, char *argv[]) { string mission_file; string run_command = argv[0]; for(int i=1; i<argc; i++) { string argi = argv[i]; if((argi=="-v") || (argi=="--version") || (argi=="-version")) showReleaseInfoAndExit(); else if((argi=="-e") || (argi=="--example") || (argi=="-example")) showExampleConfigAndExit(); else if((argi == "-h") || (argi == "--help") || (argi=="-help")) showHelpAndExit(); else if((argi == "-i") || (argi == "--interface")) showInterfaceAndExit(); else if(strEnds(argi, ".moos") || strEnds(argi, ".moos++")) mission_file = argv[i]; else if(strBegins(argi, "--alias=")) run_command = argi.substr(8); else if(i==2) run_command = argi; } if(mission_file == "") showHelpAndExit(); cout << termColor("green"); cout << "pConvexHullTest launching as " << run_command << endl; cout << termColor() << endl; ConvexHullTest ConvexHullTest; ConvexHullTest.Run(run_command.c_str(), mission_file.c_str()); return(0); }
[ "nick.rypkema@gmail.com" ]
nick.rypkema@gmail.com
d78596c8d09e1050b0fad52ad0799b735700bba5
2af943fbfff74744b29e4a899a6e62e19dc63256
/IntelligentSI/Communication/otigtl/libs/ace/QoS/SOCK_Dgram_Mcast_QoS.cpp
16e34f6947792df806690c1fbfbf03128c0d993c
[]
no_license
lheckemann/namic-sandbox
c308ec3ebb80021020f98cf06ee4c3e62f125ad9
0c7307061f58c9d915ae678b7a453876466d8bf8
refs/heads/master
2021-08-24T12:40:01.331229
2014-02-07T21:59:29
2014-02-07T21:59:29
113,701,721
2
1
null
null
null
null
UTF-8
C++
false
false
8,909
cpp
// SOCK_Dgram_Mcast_QoS.cpp,v 1.16 2005/12/08 22:25:45 ossama Exp #include "SOCK_Dgram_Mcast_QoS.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_sys_socket.h" #if defined (ACE_WIN32) #include "ace/Sock_Connect.h" // needed for subscribe_ifs() #endif /* ACE_WIN32 */ #if !defined (__ACE_INLINE__) #include "SOCK_Dgram_Mcast_QoS.i" #endif /* __ACE_INLINE__ */ // This is a workaround for platforms with non-standard // definitions of the ip_mreq structure #if ! defined (IMR_MULTIADDR) #define IMR_MULTIADDR imr_multiaddr #endif /* ! defined (IMR_MULTIADDR) */ ACE_RCSID (QoS, SOCK_Dgram_Mcast_QoS, "SOCK_Dgram_Mcast_QoS.cpp,v 1.16 2005/12/08 22:25:45 ossama Exp") ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_Dgram_Mcast_QoS) // Dummy default constructor... ACE_SOCK_Dgram_Mcast_QoS::ACE_SOCK_Dgram_Mcast_QoS (options opts) : ACE_SOCK_Dgram_Mcast (opts) { ACE_TRACE ("ACE_SOCK_Dgram_Mcast_QoS::ACE_SOCK_Dgram_Mcast_QoS"); } int ACE_SOCK_Dgram_Mcast_QoS::open (const ACE_INET_Addr &addr, const ACE_QoS_Params &qos_params, int protocol_family, int protocol, ACE_Protocol_Info *protocolinfo, ACE_SOCK_GROUP g, u_long flags, int reuse_addr) { ACE_TRACE ("ACE_SOCK_Dgram_Mcast_QoS::open"); ACE_UNUSED_ARG (qos_params); // Only perform the <open> initialization if we haven't been opened // earlier. if (this->get_handle () != ACE_INVALID_HANDLE) return 0; ACE_DEBUG ((LM_DEBUG, "Get Handle Returns Invalid Handle\n")); if (ACE_SOCK::open (SOCK_DGRAM, protocol_family, protocol, protocolinfo, g, flags, reuse_addr) == -1) return -1; return this->open_i (addr, 0, reuse_addr); } int ACE_SOCK_Dgram_Mcast_QoS::subscribe_ifs (const ACE_INET_Addr &mcast_addr, const ACE_QoS_Params &qos_params, const ACE_TCHAR *net_if, int protocol_family, int protocol, int reuse_addr, ACE_Protocol_Info *protocolinfo) { ACE_TRACE ("ACE_SOCK_Dgram_Mcast_QoS::subscribe_ifs"); #if defined (ACE_WIN32) // Windows NT's winsock has trouble with multicast subscribes in the // presence of multiple network interfaces when the IP address is // given as INADDR_ANY. It will pick the first interface and only // accept mcast there. So, to work around this, cycle through all // of the interfaces known and subscribe to all the non-loopback // ones. // // Note that this only needs to be done on NT, but there's no way to // tell at this point if the code will be running on NT - only if it // is compiled for NT-only or for NT/95, and that doesn't really // help us. It doesn't hurt to do this on Win95, it's just a little // slower than it normally would be. // // NOTE - <ACE_Sock_Connect::get_ip_interfaces> doesn't always get all // of the interfaces. In particular, it may not get a PPP interface. This // is a limitation of the way <ACE_Sock_Connect::get_ip_interfaces> works // with MSVC. The reliable way of getting the interface list is // available only with MSVC 5. if (net_if == 0) { ACE_INET_Addr *if_addrs = 0; size_t if_cnt; if (ACE::get_ip_interfaces (if_cnt, if_addrs) != 0) return -1; size_t nr_subscribed = 0; if (if_cnt < 2) { if (this->subscribe (mcast_addr, qos_params, reuse_addr, ACE_LIB_TEXT ("0.0.0.0"), protocol_family, protocol, protocolinfo) == 0) ++nr_subscribed; } else // Iterate through all the interfaces, figure out which ones // offer multicast service, and subscribe to them. while (if_cnt > 0) { --if_cnt; // Convert to 0-based for indexing, next loop check. if (if_addrs[if_cnt].get_ip_address() == INADDR_LOOPBACK) continue; if (this->subscribe (mcast_addr, qos_params, reuse_addr, ACE_TEXT_CHAR_TO_TCHAR (if_addrs[if_cnt].get_host_addr()), protocol_family, protocol, protocolinfo) == 0) ++nr_subscribed; } delete [] if_addrs; if (nr_subscribed == 0) { errno = ENODEV; return -1; } else // 1 indicates a "short-circuit" return. This handles the // rather bizarre semantics of checking all the interfaces on // NT. return 1; } #else ACE_UNUSED_ARG (mcast_addr); ACE_UNUSED_ARG (qos_params); ACE_UNUSED_ARG (protocol_family); ACE_UNUSED_ARG (protocol); ACE_UNUSED_ARG (reuse_addr); ACE_UNUSED_ARG (protocolinfo); #endif /* ACE_WIN32 */ // Otherwise, do it like everyone else... // Create multicast request. if (this->make_multicast_ifaddr (0, mcast_addr, net_if) == -1) return -1; else return 0; } int ACE_SOCK_Dgram_Mcast_QoS::subscribe (const ACE_INET_Addr &mcast_addr, const ACE_QoS_Params &qos_params, int reuse_addr, const ACE_TCHAR *net_if, int protocol_family, int protocol, ACE_Protocol_Info *protocolinfo, ACE_SOCK_GROUP g, u_long flags, ACE_QoS_Session *qos_session) { ACE_TRACE ("ACE_SOCK_Dgram_Mcast_QoS::subscribe"); if (this->open (mcast_addr, qos_params, protocol_family, protocol, protocolinfo, g, flags, reuse_addr) == -1) return -1; // The following method call only applies to Win32 currently. int result = this->subscribe_ifs (mcast_addr, qos_params, net_if, protocol_family, protocol, reuse_addr, protocolinfo); // Check for the "short-circuit" return value of 1 (for NT). if (result != 0) return result; // Tell network device driver to read datagrams with a // <mcast_request_if_> IP interface. else { // Check if the mcast_addr passed into this method is the // same as the QoS session address. if (qos_session != 0 && mcast_addr == qos_session->dest_addr ()) { // Subscribe to the QoS session. if (this->qos_manager_.join_qos_session (qos_session) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_LIB_TEXT ("Unable to join QoS Session\n")), -1); } else { if (this->close () != 0) ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("Unable to close socket\n"))); ACE_ERROR_RETURN ((LM_ERROR, ACE_LIB_TEXT ("Dest Addr in the QoS Session does") ACE_LIB_TEXT (" not match the address passed into") ACE_LIB_TEXT (" subscribe\n")), -1); } ip_mreq ret_mreq; this->make_multicast_ifaddr (&ret_mreq, mcast_addr, net_if); // XX This is windows stuff only. fredk if (ACE_OS::join_leaf (this->get_handle (), reinterpret_cast<const sockaddr *> (&ret_mreq.IMR_MULTIADDR.s_addr), sizeof ret_mreq.IMR_MULTIADDR.s_addr, qos_params) == ACE_INVALID_HANDLE && errno != ENOTSUP) return -1; else if (qos_params.socket_qos () != 0 && qos_session != 0) qos_session->qos (*(qos_params.socket_qos ())); return 0; } } ACE_END_VERSIONED_NAMESPACE_DECL
[ "tokuda@5e132c66-7cf4-0310-b4ca-cd4a7079c2d8" ]
tokuda@5e132c66-7cf4-0310-b4ca-cd4a7079c2d8
7942cf35f5b26d4d33375c3e22be10d5365135c5
dd1cc8316c29707ee7a0f7333fcbb5ee17cb1c76
/src/spring.cpp
e18b4c480a780efef98410d2a8c02ff45e27892f
[]
no_license
KyleFung/jiggle
e96f0e77b1c8ff2713a5058748de0e5403795f44
029296043c7f651b0dbc52fb4bc18876c1082592
refs/heads/master
2021-01-19T00:15:18.238557
2019-04-07T01:53:06
2019-04-07T01:53:06
72,971,268
6
1
null
null
null
null
UTF-8
C++
false
false
2,194
cpp
#include "spring.h" #include <GLUT/glut.h> Spring::Spring(std::vector<PointMass>& points, int p, int q, float length, float k) : mPoints(points) { mP = p; mQ = q; mL = length; mK = k; } Spring::Spring(std::vector<PointMass>& points, int p, int q, float k) : mPoints(points) { mP = p; mQ = q; mL = (mPoints[mP].mPos - mPoints[mQ].mPos).norm(); mK = k; } void Spring::draw() { glBegin(GL_LINES); glColor4f(1.0, 1.0, 1.0, 1.0); glVertex3f(mPoints[mP].mPos(0), mPoints[mP].mPos(1), mPoints[mP].mPos(2)); glVertex3f(mPoints[mQ].mPos(0), mPoints[mQ].mPos(1), mPoints[mQ].mPos(2)); glEnd(); } void Spring::contributeImpulse(float h) { // Calculate hooke force Eigen::Vector3f diff = (mPoints[mP].mPos - mPoints[mQ].mPos); float distance = diff.norm(); // Record force into point Eigen::Vector3f qFrc = ((mK / distance) * diff) * (distance - mL); Eigen::Vector3f pFrc = -1 * qFrc; // Account for drag qFrc -= 0.01 * mPoints[mQ].mVel; pFrc -= 0.01 * mPoints[mP].mVel; Eigen::VectorXf dv(6); // Integrate for impulse // Explicit //dv << (pFrc * h) / mP->mMass, (qFrc * h) / mQ->mMass; // Implicit Eigen::MatrixXf dppE(3, 3); Eigen::Matrix3f I3 = Eigen::MatrixXf::Identity(3, 3); Eigen::MatrixXf outer = diff * diff.transpose(); dppE = outer / (distance * distance); dppE += (I3 - (outer / (distance * distance))) * (1 - (mL / distance)); dppE *= mK; Eigen::MatrixXf dfdx(6, 6); dfdx.block<3, 3>(0, 0) = -1 * dppE; dfdx.block<3, 3>(3, 3) = -1 * dppE; dfdx.block<3, 3>(0, 3) = dppE; dfdx.block<3, 3>(3, 0) = dppE; Eigen::MatrixXf dfdv(6, 6); Eigen::MatrixXf I6 = Eigen::MatrixXf::Identity(6, 6); dfdv = -0.01 * I6; Eigen::MatrixXf A(6, 6); A = (I6 - h * dfdv - h * h * dfdx); Eigen::VectorXf f0(6); Eigen::VectorXf v0(6); f0 << pFrc, qFrc; v0 << mPoints[mP].mVel, mPoints[mQ].mVel; Eigen::MatrixXf b(6, 6); b = h * (f0 + h * dfdx * v0); // Solve dv = A.colPivHouseholderQr().solve(b); // Integrate velocity mPoints[mP].mVel += dv.head(3); mPoints[mQ].mVel += dv.tail(3); }
[ "kyle_fung@outlook.com" ]
kyle_fung@outlook.com
70d392246ea109c95d9efb8b3cc3017356c74752
9c5d73ebee96e39f7311f8a29eb46f3aa82c9c34
/source/discovery/carla-discovery.cpp
f062b775ddeacfedc8745201f6ae3b024043b2af
[]
no_license
bagnz0r/Carla
4dcdb22e10e8ae0a620fb5b556fa17ef6d788b56
6347381f84dea5c0fda0d299f3786aae58a3d86b
refs/heads/master
2021-01-22T15:22:17.591706
2015-01-23T07:02:13
2015-01-23T07:02:13
29,738,354
1
0
null
2015-01-23T15:19:50
2015-01-23T15:19:50
null
UTF-8
C++
false
false
55,979
cpp
/* * Carla Plugin discovery * Copyright (C) 2011-2014 Filipe Coelho <falktx@falktx.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * For a full copy of the GNU General Public License see the doc/GPL.txt file. */ #include "CarlaBackendUtils.hpp" #include "CarlaLibUtils.hpp" #include "CarlaMathUtils.hpp" #include "CarlaMIDI.h" #if defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN) # define USE_JUCE_PROCESSORS # include "juce_audio_processors.h" #endif #ifdef BUILD_BRIDGE # undef HAVE_FLUIDSYNTH # undef HAVE_LINUXSAMPLER #endif #include "CarlaLadspaUtils.hpp" #include "CarlaDssiUtils.cpp" #include "CarlaLv2Utils.hpp" #include "CarlaVstUtils.hpp" #ifdef HAVE_FLUIDSYNTH # include <fluidsynth.h> #endif #ifdef HAVE_LINUXSAMPLER # include "linuxsampler/EngineFactory.h" #endif #include <iostream> #include "juce_core.h" using juce::CharPointer_UTF8; using juce::File; using juce::String; using juce::StringArray; #define DISCOVERY_OUT(x, y) std::cout << "\ncarla-discovery::" << x << "::" << y << std::endl; CARLA_BACKEND_USE_NAMESPACE // -------------------------------------------------------------------------- // Dummy values to test plugins with static const uint32_t kBufferSize = 512; static const double kSampleRate = 44100.0; static const int32_t kSampleRatei = 44100; static const float kSampleRatef = 44100.0f; // -------------------------------------------------------------------------- // Don't print ELF/EXE related errors since discovery can find multi-architecture binaries static void print_lib_error(const char* const filename) { const char* const error(lib_error(filename)); if (error != nullptr && std::strstr(error, "wrong ELF class") == nullptr && std::strstr(error, "Bad EXE format") == nullptr) DISCOVERY_OUT("error", error); } #ifndef CARLA_OS_MAC // -------------------------------------------------------------------------- // VST stuff // Check if plugin is currently processing static bool gVstIsProcessing = false; // Check if plugin needs idle static bool gVstNeedsIdle = false; // Check if plugin wants midi static bool gVstWantsMidi = false; // Check if plugin wants time static bool gVstWantsTime = false; // Current uniqueId for VST shell plugins static intptr_t gVstCurrentUniqueId = 0; // Supported Carla features static intptr_t vstHostCanDo(const char* const feature) { carla_debug("vstHostCanDo(\"%s\")", feature); if (std::strcmp(feature, "supplyIdle") == 0) return 1; if (std::strcmp(feature, "sendVstEvents") == 0) return 1; if (std::strcmp(feature, "sendVstMidiEvent") == 0) return 1; if (std::strcmp(feature, "sendVstMidiEventFlagIsRealtime") == 0) return 1; if (std::strcmp(feature, "sendVstTimeInfo") == 0) { gVstWantsTime = true; return 1; } if (std::strcmp(feature, "receiveVstEvents") == 0) return 1; if (std::strcmp(feature, "receiveVstMidiEvent") == 0) return 1; if (std::strcmp(feature, "receiveVstTimeInfo") == 0) return -1; if (std::strcmp(feature, "reportConnectionChanges") == 0) return -1; if (std::strcmp(feature, "acceptIOChanges") == 0) return 1; if (std::strcmp(feature, "sizeWindow") == 0) return 1; if (std::strcmp(feature, "offline") == 0) return -1; if (std::strcmp(feature, "openFileSelector") == 0) return -1; if (std::strcmp(feature, "closeFileSelector") == 0) return -1; if (std::strcmp(feature, "startStopProcess") == 0) return 1; if (std::strcmp(feature, "supportShell") == 0) return 1; if (std::strcmp(feature, "shellCategory") == 0) return 1; // non-official features found in some plugins: // "asyncProcessing" // "editFile" // unimplemented carla_stderr("vstHostCanDo(\"%s\") - unknown feature", feature); return 0; } // Host-side callback static intptr_t VSTCALLBACK vstHostCallback(AEffect* const effect, const int32_t opcode, const int32_t index, const intptr_t value, void* const ptr, const float opt) { carla_debug("vstHostCallback(%p, %i:%s, %i, " P_INTPTR ", %p, %f)", effect, opcode, vstMasterOpcode2str(opcode), index, value, ptr, opt); static VstTimeInfo timeInfo; intptr_t ret = 0; switch (opcode) { case audioMasterAutomate: ret = 1; break; case audioMasterVersion: ret = kVstVersion; break; case audioMasterCurrentId: if (gVstCurrentUniqueId == 0) DISCOVERY_OUT("warning", "Plugin asked for uniqueId, but it's currently 0"); ret = gVstCurrentUniqueId; break; case DECLARE_VST_DEPRECATED(audioMasterWantMidi): if (gVstWantsMidi) DISCOVERY_OUT("warning", "Plugin requested MIDI more than once"); gVstWantsMidi = true; ret = 1; break; case audioMasterGetTime: if (! gVstIsProcessing) DISCOVERY_OUT("warning", "Plugin requested timeInfo out of process"); if (! gVstWantsTime) DISCOVERY_OUT("warning", "Plugin requested timeInfo but didn't ask if host could do \"sendVstTimeInfo\""); carla_zeroStruct<VstTimeInfo>(timeInfo); timeInfo.sampleRate = kSampleRate; // Tempo timeInfo.tempo = 120.0; timeInfo.flags |= kVstTempoValid; // Time Signature timeInfo.timeSigNumerator = 4; timeInfo.timeSigDenominator = 4; timeInfo.flags |= kVstTimeSigValid; ret = (intptr_t)&timeInfo; break; case DECLARE_VST_DEPRECATED(audioMasterTempoAt): ret = 120 * 10000; break; case DECLARE_VST_DEPRECATED(audioMasterGetNumAutomatableParameters): ret = carla_minPositive(effect->numParams, static_cast<int>(MAX_DEFAULT_PARAMETERS)); break; case DECLARE_VST_DEPRECATED(audioMasterGetParameterQuantization): ret = 1; // full single float precision break; case DECLARE_VST_DEPRECATED(audioMasterNeedIdle): if (gVstNeedsIdle) DISCOVERY_OUT("warning", "Plugin requested idle more than once"); gVstNeedsIdle = true; ret = 1; break; case audioMasterGetSampleRate: ret = kSampleRatei; break; case audioMasterGetBlockSize: ret = kBufferSize; break; case DECLARE_VST_DEPRECATED(audioMasterWillReplaceOrAccumulate): ret = 1; // replace break; case audioMasterGetCurrentProcessLevel: ret = gVstIsProcessing ? kVstProcessLevelRealtime : kVstProcessLevelUser; break; case audioMasterGetAutomationState: ret = kVstAutomationOff; break; case audioMasterGetVendorString: CARLA_SAFE_ASSERT_BREAK(ptr != nullptr); std::strcpy((char*)ptr, "falkTX"); ret = 1; break; case audioMasterGetProductString: CARLA_SAFE_ASSERT_BREAK(ptr != nullptr); std::strcpy((char*)ptr, "Carla-Discovery"); ret = 1; break; case audioMasterGetVendorVersion: ret = CARLA_VERSION_HEX; break; case audioMasterCanDo: CARLA_SAFE_ASSERT_BREAK(ptr != nullptr); ret = vstHostCanDo((const char*)ptr); break; case audioMasterGetLanguage: ret = kVstLangEnglish; break; default: carla_stdout("vstHostCallback(%p, %i:%s, %i, " P_INTPTR ", %p, %f)", effect, opcode, vstMasterOpcode2str(opcode), index, value, ptr, opt); break; } return ret; } #endif // ! CARLA_OS_MAC #ifdef HAVE_LINUXSAMPLER // -------------------------------------------------------------------------- // LinuxSampler stuff class LinuxSamplerScopedEngine { public: LinuxSamplerScopedEngine(const char* const filename, const char* const stype) : fEngine(nullptr) { using namespace LinuxSampler; try { fEngine = EngineFactory::Create(stype); } catch (const Exception& e) { DISCOVERY_OUT("error", e.what()); return; } if (fEngine == nullptr) return; InstrumentManager* const insMan(fEngine->GetInstrumentManager()); if (insMan == nullptr) { DISCOVERY_OUT("error", "Failed to get LinuxSampler instrument manager"); return; } std::vector<InstrumentManager::instrument_id_t> ids; try { ids = insMan->GetInstrumentFileContent(filename); } catch (const InstrumentManagerException& e) { DISCOVERY_OUT("error", e.what()); return; } if (ids.size() == 0) { DISCOVERY_OUT("error", "Failed to find any instruments"); return; } InstrumentManager::instrument_info_t info; try { info = insMan->GetInstrumentInfo(ids[0]); } catch (const InstrumentManagerException& e) { DISCOVERY_OUT("error", e.what()); return; } outputInfo(&info, nullptr, ids.size() > 1); } ~LinuxSamplerScopedEngine() { if (fEngine != nullptr) { LinuxSampler::EngineFactory::Destroy(fEngine); fEngine = nullptr; } } static void outputInfo(const LinuxSampler::InstrumentManager::instrument_info_t* const info, const char* const basename, const bool has16Outs) { CarlaString name; const char* label; if (info != nullptr) { name = info->InstrumentName.c_str(); label = info->Product.c_str(); } else { name = basename; label = basename; } // 2 channels DISCOVERY_OUT("init", "-----------"); DISCOVERY_OUT("build", BINARY_NATIVE); DISCOVERY_OUT("hints", PLUGIN_IS_SYNTH); DISCOVERY_OUT("name", name.buffer()); DISCOVERY_OUT("label", label); if (info != nullptr) DISCOVERY_OUT("maker", info->Artists); DISCOVERY_OUT("audio.outs", 2); DISCOVERY_OUT("midi.ins", 1); DISCOVERY_OUT("end", "------------"); // 16 channels if (name.isEmpty() || ! has16Outs) return; name += " (16 outputs)"; DISCOVERY_OUT("init", "-----------"); DISCOVERY_OUT("build", BINARY_NATIVE); DISCOVERY_OUT("hints", PLUGIN_IS_SYNTH); DISCOVERY_OUT("name", name.buffer()); DISCOVERY_OUT("label", label); if (info != nullptr) DISCOVERY_OUT("maker", info->Artists); DISCOVERY_OUT("audio.outs", 32); DISCOVERY_OUT("midi.ins", 1); DISCOVERY_OUT("end", "------------"); } private: LinuxSampler::Engine* fEngine; CARLA_PREVENT_HEAP_ALLOCATION CARLA_DECLARE_NON_COPY_CLASS(LinuxSamplerScopedEngine) }; #endif // HAVE_LINUXSAMPLER // ------------------------------ Plugin Checks ----------------------------- static void do_ladspa_check(lib_t& libHandle, const char* const filename, const bool doInit) { LADSPA_Descriptor_Function descFn = lib_symbol<LADSPA_Descriptor_Function>(libHandle, "ladspa_descriptor"); if (descFn == nullptr) { DISCOVERY_OUT("error", "Not a LADSPA plugin"); return; } const LADSPA_Descriptor* descriptor; { descriptor = descFn(0); if (descriptor == nullptr) { DISCOVERY_OUT("error", "Binary doesn't contain any plugins"); return; } if (doInit && descriptor->instantiate != nullptr && descriptor->cleanup != nullptr) { LADSPA_Handle handle = descriptor->instantiate(descriptor, kSampleRatei); if (handle == nullptr) { DISCOVERY_OUT("error", "Failed to init first LADSPA plugin"); return; } descriptor->cleanup(handle); lib_close(libHandle); libHandle = lib_open(filename); if (libHandle == nullptr) { print_lib_error(filename); return; } descFn = lib_symbol<LADSPA_Descriptor_Function>(libHandle, "ladspa_descriptor"); if (descFn == nullptr) { DISCOVERY_OUT("error", "Not a LADSPA plugin (#2)"); return; } } } unsigned long i = 0; while ((descriptor = descFn(i++)) != nullptr) { if (descriptor->instantiate == nullptr) { DISCOVERY_OUT("error", "Plugin '" << descriptor->Name << "' has no instantiate()"); continue; } if (descriptor->cleanup == nullptr) { DISCOVERY_OUT("error", "Plugin '" << descriptor->Name << "' has no cleanup()"); continue; } if (descriptor->run == nullptr) { DISCOVERY_OUT("error", "Plugin '" << descriptor->Name << "' has no run()"); continue; } if (! LADSPA_IS_HARD_RT_CAPABLE(descriptor->Properties)) { DISCOVERY_OUT("warning", "Plugin '" << descriptor->Name << "' is not hard real-time capable"); } uint hints = 0x0; int audioIns = 0; int audioOuts = 0; int audioTotal = 0; int parametersIns = 0; int parametersOuts = 0; int parametersTotal = 0; if (LADSPA_IS_HARD_RT_CAPABLE(descriptor->Properties)) hints |= PLUGIN_IS_RTSAFE; for (unsigned long j=0; j < descriptor->PortCount; ++j) { CARLA_ASSERT(descriptor->PortNames[j] != nullptr); const LADSPA_PortDescriptor portDescriptor = descriptor->PortDescriptors[j]; if (LADSPA_IS_PORT_AUDIO(portDescriptor)) { if (LADSPA_IS_PORT_INPUT(portDescriptor)) audioIns += 1; else if (LADSPA_IS_PORT_OUTPUT(portDescriptor)) audioOuts += 1; audioTotal += 1; } else if (LADSPA_IS_PORT_CONTROL(portDescriptor)) { if (LADSPA_IS_PORT_INPUT(portDescriptor)) parametersIns += 1; else if (LADSPA_IS_PORT_OUTPUT(portDescriptor) && std::strcmp(descriptor->PortNames[j], "latency") != 0 && std::strcmp(descriptor->PortNames[j], "_latency") != 0) parametersOuts += 1; parametersTotal += 1; } } if (doInit) { // ----------------------------------------------------------------------- // start crash-free plugin test LADSPA_Handle handle = descriptor->instantiate(descriptor, kSampleRatei); if (handle == nullptr) { DISCOVERY_OUT("error", "Failed to init LADSPA plugin"); continue; } // Test quick init and cleanup descriptor->cleanup(handle); handle = descriptor->instantiate(descriptor, kSampleRatei); if (handle == nullptr) { DISCOVERY_OUT("error", "Failed to init LADSPA plugin (#2)"); continue; } LADSPA_Data bufferAudio[kBufferSize][audioTotal]; LADSPA_Data bufferParams[parametersTotal]; LADSPA_Data min, max, def; for (unsigned long j=0, iA=0, iC=0; j < descriptor->PortCount; ++j) { const LADSPA_PortDescriptor portDescriptor = descriptor->PortDescriptors[j]; const LADSPA_PortRangeHint portRangeHints = descriptor->PortRangeHints[j]; const char* const portName = descriptor->PortNames[j]; if (LADSPA_IS_PORT_AUDIO(portDescriptor)) { carla_zeroFloat(bufferAudio[iA], kBufferSize); descriptor->connect_port(handle, j, bufferAudio[iA++]); } else if (LADSPA_IS_PORT_CONTROL(portDescriptor)) { // min value if (LADSPA_IS_HINT_BOUNDED_BELOW(portRangeHints.HintDescriptor)) min = portRangeHints.LowerBound; else min = 0.0f; // max value if (LADSPA_IS_HINT_BOUNDED_ABOVE(portRangeHints.HintDescriptor)) max = portRangeHints.UpperBound; else max = 1.0f; if (min > max) { DISCOVERY_OUT("warning", "Parameter '" << portName << "' is broken: min > max"); max = min + 0.1f; } else if (carla_compareFloats(min, max)) { DISCOVERY_OUT("warning", "Parameter '" << portName << "' is broken: max == min"); max = min + 0.1f; } // default value def = get_default_ladspa_port_value(portRangeHints.HintDescriptor, min, max); if (LADSPA_IS_HINT_SAMPLE_RATE(portRangeHints.HintDescriptor)) { min *= kSampleRatef; max *= kSampleRatef; def *= kSampleRatef; } if (LADSPA_IS_PORT_OUTPUT(portDescriptor) && (std::strcmp(portName, "latency") == 0 || std::strcmp(portName, "_latency") == 0)) { // latency parameter def = 0.0f; } else { if (def < min) def = min; else if (def > max) def = max; } bufferParams[iC] = def; descriptor->connect_port(handle, j, &bufferParams[iC++]); } } if (descriptor->activate != nullptr) descriptor->activate(handle); descriptor->run(handle, kBufferSize); if (descriptor->deactivate != nullptr) descriptor->deactivate(handle); descriptor->cleanup(handle); // end crash-free plugin test // ----------------------------------------------------------------------- } DISCOVERY_OUT("init", "-----------"); DISCOVERY_OUT("build", BINARY_NATIVE); DISCOVERY_OUT("hints", hints); DISCOVERY_OUT("name", descriptor->Name); DISCOVERY_OUT("label", descriptor->Label); DISCOVERY_OUT("maker", descriptor->Maker); DISCOVERY_OUT("uniqueId", descriptor->UniqueID); DISCOVERY_OUT("audio.ins", audioIns); DISCOVERY_OUT("audio.outs", audioOuts); DISCOVERY_OUT("parameters.ins", parametersIns); DISCOVERY_OUT("parameters.outs", parametersOuts); DISCOVERY_OUT("end", "------------"); } } static void do_dssi_check(lib_t& libHandle, const char* const filename, const bool doInit) { DSSI_Descriptor_Function descFn = lib_symbol<DSSI_Descriptor_Function>(libHandle, "dssi_descriptor"); if (descFn == nullptr) { DISCOVERY_OUT("error", "Not a DSSI plugin"); return; } const DSSI_Descriptor* descriptor; { descriptor = descFn(0); if (descriptor == nullptr) { DISCOVERY_OUT("error", "Binary doesn't contain any plugins"); return; } const LADSPA_Descriptor* const ldescriptor(descriptor->LADSPA_Plugin); if (ldescriptor == nullptr) { DISCOVERY_OUT("error", "DSSI plugin doesn't provide the LADSPA interface"); return; } if (doInit && ldescriptor->instantiate != nullptr && ldescriptor->cleanup != nullptr) { LADSPA_Handle handle = ldescriptor->instantiate(ldescriptor, kSampleRatei); if (handle == nullptr) { DISCOVERY_OUT("error", "Failed to init first LADSPA plugin"); return; } ldescriptor->cleanup(handle); lib_close(libHandle); libHandle = lib_open(filename); if (libHandle == nullptr) { print_lib_error(filename); return; } descFn = lib_symbol<DSSI_Descriptor_Function>(libHandle, "dssi_descriptor"); if (descFn == nullptr) { DISCOVERY_OUT("error", "Not a DSSI plugin (#2)"); return; } } } unsigned long i = 0; while ((descriptor = descFn(i++)) != nullptr) { const LADSPA_Descriptor* const ldescriptor(descriptor->LADSPA_Plugin); if (ldescriptor == nullptr) { DISCOVERY_OUT("error", "Plugin '" << ldescriptor->Name << "' has no LADSPA interface"); continue; } if (descriptor->DSSI_API_Version != DSSI_VERSION_MAJOR) { DISCOVERY_OUT("error", "Plugin '" << ldescriptor->Name << "' uses an unsupported DSSI spec version " << descriptor->DSSI_API_Version); continue; } if (ldescriptor->instantiate == nullptr) { DISCOVERY_OUT("error", "Plugin '" << ldescriptor->Name << "' has no instantiate()"); continue; } if (ldescriptor->cleanup == nullptr) { DISCOVERY_OUT("error", "Plugin '" << ldescriptor->Name << "' has no cleanup()"); continue; } if (ldescriptor->run == nullptr && descriptor->run_synth == nullptr && descriptor->run_multiple_synths == nullptr) { DISCOVERY_OUT("error", "Plugin '" << ldescriptor->Name << "' has no run(), run_synth() or run_multiple_synths()"); continue; } if (! LADSPA_IS_HARD_RT_CAPABLE(ldescriptor->Properties)) { DISCOVERY_OUT("warning", "Plugin '" << ldescriptor->Name << "' is not hard real-time capable"); } uint hints = 0x0; int audioIns = 0; int audioOuts = 0; int audioTotal = 0; int midiIns = 0; int parametersIns = 0; int parametersOuts = 0; int parametersTotal = 0; if (LADSPA_IS_HARD_RT_CAPABLE(ldescriptor->Properties)) hints |= PLUGIN_IS_RTSAFE; for (unsigned long j=0; j < ldescriptor->PortCount; ++j) { CARLA_ASSERT(ldescriptor->PortNames[j] != nullptr); const LADSPA_PortDescriptor portDescriptor = ldescriptor->PortDescriptors[j]; if (LADSPA_IS_PORT_AUDIO(portDescriptor)) { if (LADSPA_IS_PORT_INPUT(portDescriptor)) audioIns += 1; else if (LADSPA_IS_PORT_OUTPUT(portDescriptor)) audioOuts += 1; audioTotal += 1; } else if (LADSPA_IS_PORT_CONTROL(portDescriptor)) { if (LADSPA_IS_PORT_INPUT(portDescriptor)) parametersIns += 1; else if (LADSPA_IS_PORT_OUTPUT(portDescriptor) && std::strcmp(ldescriptor->PortNames[j], "latency") != 0 && std::strcmp(ldescriptor->PortNames[j], "_latency") != 0) parametersOuts += 1; parametersTotal += 1; } } if (descriptor->run_synth != nullptr || descriptor->run_multiple_synths != nullptr) midiIns = 1; if (midiIns > 0 && audioIns == 0 && audioOuts > 0) hints |= PLUGIN_IS_SYNTH; if (const char* const ui = find_dssi_ui(filename, ldescriptor->Label)) { hints |= PLUGIN_HAS_CUSTOM_UI; delete[] ui; } if (doInit) { // ----------------------------------------------------------------------- // start crash-free plugin test LADSPA_Handle handle = ldescriptor->instantiate(ldescriptor, kSampleRatei); if (handle == nullptr) { DISCOVERY_OUT("error", "Failed to init DSSI plugin"); continue; } // Test quick init and cleanup ldescriptor->cleanup(handle); handle = ldescriptor->instantiate(ldescriptor, kSampleRatei); if (handle == nullptr) { DISCOVERY_OUT("error", "Failed to init DSSI plugin (#2)"); continue; } LADSPA_Data bufferAudio[kBufferSize][audioTotal]; LADSPA_Data bufferParams[parametersTotal]; LADSPA_Data min, max, def; for (unsigned long j=0, iA=0, iC=0; j < ldescriptor->PortCount; ++j) { const LADSPA_PortDescriptor portDescriptor = ldescriptor->PortDescriptors[j]; const LADSPA_PortRangeHint portRangeHints = ldescriptor->PortRangeHints[j]; const char* const portName = ldescriptor->PortNames[j]; if (LADSPA_IS_PORT_AUDIO(portDescriptor)) { carla_zeroFloat(bufferAudio[iA], kBufferSize); ldescriptor->connect_port(handle, j, bufferAudio[iA++]); } else if (LADSPA_IS_PORT_CONTROL(portDescriptor)) { // min value if (LADSPA_IS_HINT_BOUNDED_BELOW(portRangeHints.HintDescriptor)) min = portRangeHints.LowerBound; else min = 0.0f; // max value if (LADSPA_IS_HINT_BOUNDED_ABOVE(portRangeHints.HintDescriptor)) max = portRangeHints.UpperBound; else max = 1.0f; if (min > max) { DISCOVERY_OUT("warning", "Parameter '" << portName << "' is broken: min > max"); max = min + 0.1f; } else if (carla_compareFloats(min, max)) { DISCOVERY_OUT("warning", "Parameter '" << portName << "' is broken: max == min"); max = min + 0.1f; } // default value def = get_default_ladspa_port_value(portRangeHints.HintDescriptor, min, max); if (LADSPA_IS_HINT_SAMPLE_RATE(portRangeHints.HintDescriptor)) { min *= kSampleRatef; max *= kSampleRatef; def *= kSampleRatef; } if (LADSPA_IS_PORT_OUTPUT(portDescriptor) && (std::strcmp(portName, "latency") == 0 || std::strcmp(portName, "_latency") == 0)) { // latency parameter def = 0.0f; } else { if (def < min) def = min; else if (def > max) def = max; } bufferParams[iC] = def; ldescriptor->connect_port(handle, j, &bufferParams[iC++]); } } // select first midi-program if available if (descriptor->get_program != nullptr && descriptor->select_program != nullptr) { if (const DSSI_Program_Descriptor* const pDesc = descriptor->get_program(handle, 0)) descriptor->select_program(handle, pDesc->Bank, pDesc->Program); } if (ldescriptor->activate != nullptr) ldescriptor->activate(handle); if (descriptor->run_synth != nullptr || descriptor->run_multiple_synths != nullptr) { snd_seq_event_t midiEvents[2]; carla_zeroStruct<snd_seq_event_t>(midiEvents, 2); const unsigned long midiEventCount = 2; midiEvents[0].type = SND_SEQ_EVENT_NOTEON; midiEvents[0].data.note.note = 64; midiEvents[0].data.note.velocity = 100; midiEvents[1].type = SND_SEQ_EVENT_NOTEOFF; midiEvents[1].data.note.note = 64; midiEvents[1].data.note.velocity = 0; midiEvents[1].time.tick = kBufferSize/2; if (descriptor->run_multiple_synths != nullptr && descriptor->run_synth == nullptr) { LADSPA_Handle handlePtr[1] = { handle }; snd_seq_event_t* midiEventsPtr[1] = { midiEvents }; unsigned long midiEventCountPtr[1] = { midiEventCount }; descriptor->run_multiple_synths(1, handlePtr, kBufferSize, midiEventsPtr, midiEventCountPtr); } else descriptor->run_synth(handle, kBufferSize, midiEvents, midiEventCount); } else ldescriptor->run(handle, kBufferSize); if (ldescriptor->deactivate != nullptr) ldescriptor->deactivate(handle); ldescriptor->cleanup(handle); // end crash-free plugin test // ----------------------------------------------------------------------- } DISCOVERY_OUT("init", "-----------"); DISCOVERY_OUT("build", BINARY_NATIVE); DISCOVERY_OUT("hints", hints); DISCOVERY_OUT("name", ldescriptor->Name); DISCOVERY_OUT("label", ldescriptor->Label); DISCOVERY_OUT("maker", ldescriptor->Maker); DISCOVERY_OUT("uniqueId", ldescriptor->UniqueID); DISCOVERY_OUT("audio.ins", audioIns); DISCOVERY_OUT("audio.outs", audioOuts); DISCOVERY_OUT("midi.ins", midiIns); DISCOVERY_OUT("parameters.ins", parametersIns); DISCOVERY_OUT("parameters.outs", parametersOuts); DISCOVERY_OUT("end", "------------"); } } static void do_lv2_check(const char* const bundle, const bool doInit) { Lv2WorldClass& lv2World(Lv2WorldClass::getInstance()); Lilv::Node bundleNode(lv2World.new_file_uri(nullptr, bundle)); CARLA_SAFE_ASSERT_RETURN(bundleNode.is_uri(),); CarlaString sBundle(bundleNode.as_uri()); if (! sBundle.endsWith("/")) sBundle += "/"; // Load bundle lv2World.load_bundle(sBundle); // Load plugins in this bundle const Lilv::Plugins lilvPlugins(lv2World.get_all_plugins()); // Get all plugin URIs in this bundle StringArray URIs; LILV_FOREACH(plugins, it, lilvPlugins) { Lilv::Plugin lilvPlugin(lilv_plugins_get(lilvPlugins, it)); if (const char* const uri = lilvPlugin.get_uri().as_string()) URIs.addIfNotAlreadyThere(String(uri)); } if (URIs.size() == 0) { DISCOVERY_OUT("warning", "LV2 Bundle doesn't provide any plugins"); return; } // Get & check every plugin-instance for (int i=0, count=URIs.size(); i < count; ++i) { const LV2_RDF_Descriptor* const rdfDescriptor(lv2_rdf_new(URIs[i].toRawUTF8(), false)); if (rdfDescriptor == nullptr || rdfDescriptor->URI == nullptr) { DISCOVERY_OUT("error", "Failed to find LV2 plugin '" << URIs[i].toRawUTF8() << "'"); continue; } if (doInit) { // test if DLL is loadable, twice const lib_t libHandle1 = lib_open(rdfDescriptor->Binary); if (libHandle1 == nullptr) { print_lib_error(rdfDescriptor->Binary); delete rdfDescriptor; continue; } lib_close(libHandle1); const lib_t libHandle2 = lib_open(rdfDescriptor->Binary); if (libHandle2 == nullptr) { print_lib_error(rdfDescriptor->Binary); delete rdfDescriptor; continue; } lib_close(libHandle2); } // test if we support all required ports and features { bool supported = true; for (uint32_t j=0; j < rdfDescriptor->PortCount && supported; ++j) { const LV2_RDF_Port* const rdfPort(&rdfDescriptor->Ports[j]); if (is_lv2_port_supported(rdfPort->Types)) { pass(); } else if (! LV2_IS_PORT_OPTIONAL(rdfPort->Properties)) { DISCOVERY_OUT("error", "Plugin '" << rdfDescriptor->URI << "' requires a non-supported port type (portName: '" << rdfPort->Name << "')"); supported = false; break; } } for (uint32_t j=0; j < rdfDescriptor->FeatureCount && supported; ++j) { const LV2_RDF_Feature& feature(rdfDescriptor->Features[j]); if (std::strcmp(feature.URI, LV2_DATA_ACCESS_URI) == 0 || std::strcmp(feature.URI, LV2_INSTANCE_ACCESS_URI) == 0) { DISCOVERY_OUT("warning", "Plugin '" << rdfDescriptor->URI << "' DSP wants UI feature '" << feature.URI << "', ignoring this"); } else if (LV2_IS_FEATURE_REQUIRED(feature.Type) && ! is_lv2_feature_supported(feature.URI)) { DISCOVERY_OUT("error", "Plugin '" << rdfDescriptor->URI << "' requires a non-supported feature '" << feature.URI << "'"); supported = false; break; } } if (! supported) { delete rdfDescriptor; continue; } } uint hints = 0x0; int audioIns = 0; int audioOuts = 0; int midiIns = 0; int midiOuts = 0; int parametersIns = 0; int parametersOuts = 0; for (uint32_t j=0; j < rdfDescriptor->FeatureCount; ++j) { const LV2_RDF_Feature* const rdfFeature(&rdfDescriptor->Features[j]); if (std::strcmp(rdfFeature->URI, LV2_CORE__hardRTCapable) == 0) hints |= PLUGIN_IS_RTSAFE; } for (uint32_t j=0; j < rdfDescriptor->PortCount; ++j) { const LV2_RDF_Port* const rdfPort(&rdfDescriptor->Ports[j]); if (LV2_IS_PORT_AUDIO(rdfPort->Types)) { if (LV2_IS_PORT_INPUT(rdfPort->Types)) audioIns += 1; else if (LV2_IS_PORT_OUTPUT(rdfPort->Types)) audioOuts += 1; } else if (LV2_IS_PORT_CONTROL(rdfPort->Types)) { if (LV2_IS_PORT_DESIGNATION_LATENCY(rdfPort->Designation)) { pass(); } else if (LV2_IS_PORT_DESIGNATION_SAMPLE_RATE(rdfPort->Designation)) { pass(); } else if (LV2_IS_PORT_DESIGNATION_FREEWHEELING(rdfPort->Designation)) { pass(); } else if (LV2_IS_PORT_DESIGNATION_TIME(rdfPort->Designation)) { pass(); } else { if (LV2_IS_PORT_INPUT(rdfPort->Types)) parametersIns += 1; else if (LV2_IS_PORT_OUTPUT(rdfPort->Types)) parametersOuts += 1; } } else if (LV2_PORT_SUPPORTS_MIDI_EVENT(rdfPort->Types)) { if (LV2_IS_PORT_INPUT(rdfPort->Types)) midiIns += 1; else if (LV2_IS_PORT_OUTPUT(rdfPort->Types)) midiOuts += 1; } } if (LV2_IS_INSTRUMENT(rdfDescriptor->Type[0], rdfDescriptor->Type[1])) hints |= PLUGIN_IS_SYNTH; if (rdfDescriptor->UICount > 0) hints |= PLUGIN_HAS_CUSTOM_UI; DISCOVERY_OUT("init", "-----------"); DISCOVERY_OUT("build", BINARY_NATIVE); DISCOVERY_OUT("hints", hints); if (rdfDescriptor->Name != nullptr) DISCOVERY_OUT("name", rdfDescriptor->Name); if (rdfDescriptor->Author != nullptr) DISCOVERY_OUT("maker", rdfDescriptor->Author); DISCOVERY_OUT("uri", rdfDescriptor->URI); DISCOVERY_OUT("uniqueId", rdfDescriptor->UniqueID); DISCOVERY_OUT("audio.ins", audioIns); DISCOVERY_OUT("audio.outs", audioOuts); DISCOVERY_OUT("midi.ins", midiIns); DISCOVERY_OUT("midi.outs", midiOuts); DISCOVERY_OUT("parameters.ins", parametersIns); DISCOVERY_OUT("parameters.outs", parametersOuts); DISCOVERY_OUT("end", "------------"); delete rdfDescriptor; } } #ifndef CARLA_OS_MAC static void do_vst_check(lib_t& libHandle, const bool doInit) { VST_Function vstFn = lib_symbol<VST_Function>(libHandle, "VSTPluginMain"); if (vstFn == nullptr) { vstFn = lib_symbol<VST_Function>(libHandle, "main"); if (vstFn == nullptr) { DISCOVERY_OUT("error", "Not a VST plugin"); return; } } AEffect* const effect = vstFn(vstHostCallback); if (effect == nullptr || effect->magic != kEffectMagic) { DISCOVERY_OUT("error", "Failed to init VST plugin, or VST magic failed"); return; } if (effect->uniqueID == 0) { DISCOVERY_OUT("error", "Plugin doesn't have an Unique ID"); effect->dispatcher(effect, effClose, 0, 0, nullptr, 0.0f); return; } gVstCurrentUniqueId = effect->uniqueID; effect->dispatcher(effect, DECLARE_VST_DEPRECATED(effIdentify), 0, 0, nullptr, 0.0f); effect->dispatcher(effect, DECLARE_VST_DEPRECATED(effSetBlockSizeAndSampleRate), 0, kBufferSize, nullptr, kSampleRate); effect->dispatcher(effect, effSetSampleRate, 0, 0, nullptr, kSampleRate); effect->dispatcher(effect, effSetBlockSize, 0, kBufferSize, nullptr, 0.0f); effect->dispatcher(effect, effSetProcessPrecision, 0, kVstProcessPrecision32, nullptr, 0.0f); effect->dispatcher(effect, effOpen, 0, 0, nullptr, 0.0f); effect->dispatcher(effect, effSetProgram, 0, 0, nullptr, 0.0f); char strBuf[STR_MAX+1]; CarlaString cName; CarlaString cProduct; CarlaString cVendor; const intptr_t vstCategory = effect->dispatcher(effect, effGetPlugCategory, 0, 0, nullptr, 0.0f); //for (int32_t i = effect->numInputs; --i >= 0;) effect->dispatcher(effect, DECLARE_VST_DEPRECATED(effConnectInput), i, 1, 0, 0); //for (int32_t i = effect->numOutputs; --i >= 0;) effect->dispatcher(effect, DECLARE_VST_DEPRECATED(effConnectOutput), i, 1, 0, 0); carla_zeroChar(strBuf, STR_MAX+1); if (effect->dispatcher(effect, effGetVendorString, 0, 0, strBuf, 0.0f) == 1) cVendor = strBuf; carla_zeroChar(strBuf, STR_MAX+1); if (vstCategory == kPlugCategShell) { gVstCurrentUniqueId = effect->dispatcher(effect, effShellGetNextPlugin, 0, 0, strBuf, 0.0f); CARLA_SAFE_ASSERT_RETURN(gVstCurrentUniqueId != 0,); cName = strBuf; } else { if (effect->dispatcher(effect, effGetEffectName, 0, 0, strBuf, 0.0f) == 1) cName = strBuf; } for (;;) { carla_zeroChar(strBuf, STR_MAX+1); if (effect->dispatcher(effect, effGetProductString, 0, 0, strBuf, 0.0f) == 1) cProduct = strBuf; else cProduct.clear(); uint hints = 0x0; int audioIns = effect->numInputs; int audioOuts = effect->numOutputs; int midiIns = 0; int midiOuts = 0; int parameters = effect->numParams; if (effect->flags & effFlagsHasEditor) hints |= PLUGIN_HAS_CUSTOM_UI; if (effect->flags & effFlagsIsSynth) hints |= PLUGIN_IS_SYNTH; if (vstPluginCanDo(effect, "receiveVstEvents") || vstPluginCanDo(effect, "receiveVstMidiEvent") || (effect->flags & effFlagsIsSynth) != 0) midiIns = 1; if (vstPluginCanDo(effect, "sendVstEvents") || vstPluginCanDo(effect, "sendVstMidiEvent")) midiOuts = 1; // ----------------------------------------------------------------------- // start crash-free plugin test if (doInit) { if (gVstNeedsIdle) effect->dispatcher(effect, DECLARE_VST_DEPRECATED(effIdle), 0, 0, nullptr, 0.0f); effect->dispatcher(effect, effMainsChanged, 0, 1, nullptr, 0.0f); effect->dispatcher(effect, effStartProcess, 0, 0, nullptr, 0.0f); if (gVstNeedsIdle) effect->dispatcher(effect, DECLARE_VST_DEPRECATED(effIdle), 0, 0, nullptr, 0.0f); // Plugin might call wantMidi() during resume if (midiIns == 0 && gVstWantsMidi) { midiIns = 1; } float* bufferAudioIn[audioIns]; for (int j=0; j < audioIns; ++j) { bufferAudioIn[j] = new float[kBufferSize]; carla_zeroFloat(bufferAudioIn[j], kBufferSize); } float* bufferAudioOut[audioOuts]; for (int j=0; j < audioOuts; ++j) { bufferAudioOut[j] = new float[kBufferSize]; carla_zeroFloat(bufferAudioOut[j], kBufferSize); } struct VstEventsFixed { int32_t numEvents; intptr_t reserved; VstEvent* data[2]; VstEventsFixed() : numEvents(0), reserved(0) { data[0] = data[1] = nullptr; } } events; VstMidiEvent midiEvents[2]; carla_zeroStruct<VstMidiEvent>(midiEvents, 2); midiEvents[0].type = kVstMidiType; midiEvents[0].byteSize = sizeof(VstMidiEvent); midiEvents[0].midiData[0] = char(MIDI_STATUS_NOTE_ON); midiEvents[0].midiData[1] = 64; midiEvents[0].midiData[2] = 100; midiEvents[1].type = kVstMidiType; midiEvents[1].byteSize = sizeof(VstMidiEvent); midiEvents[1].midiData[0] = char(MIDI_STATUS_NOTE_OFF); midiEvents[1].midiData[1] = 64; midiEvents[1].deltaFrames = kBufferSize/2; events.numEvents = 2; events.data[0] = (VstEvent*)&midiEvents[0]; events.data[1] = (VstEvent*)&midiEvents[1]; // processing gVstIsProcessing = true; if (midiIns > 0) effect->dispatcher(effect, effProcessEvents, 0, 0, &events, 0.0f); if ((effect->flags & effFlagsCanReplacing) > 0 && effect->processReplacing != nullptr && effect->processReplacing != effect->DECLARE_VST_DEPRECATED(process)) effect->processReplacing(effect, bufferAudioIn, bufferAudioOut, kBufferSize); else if (effect->DECLARE_VST_DEPRECATED(process) != nullptr) effect->DECLARE_VST_DEPRECATED(process)(effect, bufferAudioIn, bufferAudioOut, kBufferSize); else DISCOVERY_OUT("error", "Plugin doesn't have a process function"); gVstIsProcessing = false; effect->dispatcher(effect, effStopProcess, 0, 0, nullptr, 0.0f); effect->dispatcher(effect, effMainsChanged, 0, 0, nullptr, 0.0f); if (gVstNeedsIdle) effect->dispatcher(effect, DECLARE_VST_DEPRECATED(effIdle), 0, 0, nullptr, 0.0f); for (int j=0; j < audioIns; ++j) delete[] bufferAudioIn[j]; for (int j=0; j < audioOuts; ++j) delete[] bufferAudioOut[j]; } // end crash-free plugin test // ----------------------------------------------------------------------- DISCOVERY_OUT("init", "-----------"); DISCOVERY_OUT("build", BINARY_NATIVE); DISCOVERY_OUT("hints", hints); DISCOVERY_OUT("name", cName.buffer()); DISCOVERY_OUT("label", cProduct.buffer()); DISCOVERY_OUT("maker", cVendor.buffer()); DISCOVERY_OUT("uniqueId", gVstCurrentUniqueId); DISCOVERY_OUT("audio.ins", audioIns); DISCOVERY_OUT("audio.outs", audioOuts); DISCOVERY_OUT("midi.ins", midiIns); DISCOVERY_OUT("midi.outs", midiOuts); DISCOVERY_OUT("parameters.ins", parameters); DISCOVERY_OUT("end", "------------"); if (vstCategory != kPlugCategShell) break; gVstWantsMidi = false; gVstWantsTime = false; carla_zeroChar(strBuf, STR_MAX+1); gVstCurrentUniqueId = effect->dispatcher(effect, effShellGetNextPlugin, 0, 0, strBuf, 0.0f); if (gVstCurrentUniqueId != 0) cName = strBuf; else break; } if (gVstNeedsIdle) effect->dispatcher(effect, DECLARE_VST_DEPRECATED(effIdle), 0, 0, nullptr, 0.0f); effect->dispatcher(effect, effClose, 0, 0, nullptr, 0.0f); } #endif // ! CARLA_OS_MAC #ifdef USE_JUCE_PROCESSORS static void do_juce_check(const char* const filename_, const char* const stype, const bool doInit) { CARLA_SAFE_ASSERT_RETURN(stype != nullptr && stype[0] != 0,) // FIXME carla_debug("do_juce_check(%s, %s, %s)", filename_, stype, bool2str(doInit)); using namespace juce; juce::String filename; #ifdef CARLA_OS_WIN // Fix for wine usage if (juce_isRunningInWine() && filename_[0] == '/') { filename = filename_; filename.replace("/", "\\"); filename = "Z:" + filename; } else #endif filename = File(filename_).getFullPathName(); juce::ScopedPointer<AudioPluginFormat> pluginFormat; /* */ if (std::strcmp(stype, "VST2") == 0) { #if JUCE_PLUGINHOST_VST pluginFormat = new VSTPluginFormat(); #else DISCOVERY_OUT("error", "VST support not available"); #endif } else if (std::strcmp(stype, "VST3") == 0) { #if JUCE_PLUGINHOST_VST3 pluginFormat = new VST3PluginFormat(); #else DISCOVERY_OUT("error", "VST3 support not available"); #endif } else if (std::strcmp(stype, "AU") == 0) { #if JUCE_PLUGINHOST_AU pluginFormat = new AudioUnitPluginFormat(); #else DISCOVERY_OUT("error", "AU support not available"); #endif } if (pluginFormat == nullptr) { DISCOVERY_OUT("error", stype << " support not available"); return; } #ifdef CARLA_OS_WIN CARLA_SAFE_ASSERT_RETURN(File(filename).existsAsFile(),); #endif CARLA_SAFE_ASSERT_RETURN(pluginFormat->fileMightContainThisPluginType(filename),); OwnedArray<PluginDescription> results; pluginFormat->findAllTypesForFile(results, filename); if (results.size() == 0) { DISCOVERY_OUT("error", "No plugins found"); return; } for (PluginDescription **it = results.begin(), **end = results.end(); it != end; ++it) { PluginDescription* const desc(*it); uint hints = 0x0; int audioIns = desc->numInputChannels; int audioOuts = desc->numOutputChannels; int midiIns = 0; int midiOuts = 0; int parameters = 0; if (desc->isInstrument) hints |= PLUGIN_IS_SYNTH; if (doInit) { if (AudioPluginInstance* const instance = pluginFormat->createInstanceFromDescription(*desc, kSampleRate, kBufferSize)) { instance->refreshParameterList(); parameters = instance->getNumParameters(); if (instance->hasEditor()) hints |= PLUGIN_HAS_CUSTOM_UI; if (instance->acceptsMidi()) midiIns = 1; if (instance->producesMidi()) midiOuts = 1; delete instance; } } DISCOVERY_OUT("init", "-----------"); DISCOVERY_OUT("build", BINARY_NATIVE); DISCOVERY_OUT("hints", hints); DISCOVERY_OUT("name", desc->descriptiveName); DISCOVERY_OUT("label", desc->name); DISCOVERY_OUT("maker", desc->manufacturerName); DISCOVERY_OUT("uniqueId", desc->uid); DISCOVERY_OUT("audio.ins", audioIns); DISCOVERY_OUT("audio.outs", audioOuts); DISCOVERY_OUT("midi.ins", midiIns); DISCOVERY_OUT("midi.outs", midiOuts); DISCOVERY_OUT("parameters.ins", parameters); DISCOVERY_OUT("end", "------------"); } } #endif static void do_fluidsynth_check(const char* const filename, const bool doInit) { #ifdef HAVE_FLUIDSYNTH const String jfilename = String(CharPointer_UTF8(filename)); const File file(jfilename); if (! file.existsAsFile()) { DISCOVERY_OUT("error", "Requested file is not valid or does not exist"); return; } if (! fluid_is_soundfont(filename)) { DISCOVERY_OUT("error", "Not a SF2 file"); return; } int programs = 0; if (doInit) { fluid_settings_t* const f_settings = new_fluid_settings(); CARLA_SAFE_ASSERT_RETURN(f_settings != nullptr,); fluid_synth_t* const f_synth = new_fluid_synth(f_settings); CARLA_SAFE_ASSERT_RETURN(f_synth != nullptr,); const int f_id = fluid_synth_sfload(f_synth, filename, 0); if (f_id < 0) { DISCOVERY_OUT("error", "Failed to load SF2 file"); return; } if (fluid_sfont_t* const f_sfont = fluid_synth_get_sfont_by_id(f_synth, static_cast<uint>(f_id))) { fluid_preset_t f_preset; f_sfont->iteration_start(f_sfont); for (; f_sfont->iteration_next(f_sfont, &f_preset);) ++programs; } delete_fluid_synth(f_synth); delete_fluid_settings(f_settings); } CarlaString name(file.getFileNameWithoutExtension().toRawUTF8()); CarlaString label(name); // 2 channels DISCOVERY_OUT("init", "-----------"); DISCOVERY_OUT("build", BINARY_NATIVE); DISCOVERY_OUT("hints", PLUGIN_IS_SYNTH); DISCOVERY_OUT("name", name.buffer()); DISCOVERY_OUT("label", label.buffer()); DISCOVERY_OUT("audio.outs", 2); DISCOVERY_OUT("midi.ins", 1); DISCOVERY_OUT("parameters.ins", 13); // defined in Carla DISCOVERY_OUT("parameters.outs", 1); DISCOVERY_OUT("end", "------------"); // 16 channels if (doInit && (name.isEmpty() || programs <= 1)) return; name += " (16 outputs)"; DISCOVERY_OUT("init", "-----------"); DISCOVERY_OUT("build", BINARY_NATIVE); DISCOVERY_OUT("hints", PLUGIN_IS_SYNTH); DISCOVERY_OUT("name", name.buffer()); DISCOVERY_OUT("label", label.buffer()); DISCOVERY_OUT("audio.outs", 32); DISCOVERY_OUT("midi.ins", 1); DISCOVERY_OUT("parameters.ins", 13); // defined in Carla DISCOVERY_OUT("parameters.outs", 1); DISCOVERY_OUT("end", "------------"); #else // HAVE_FLUIDSYNTH DISCOVERY_OUT("error", "SF2 support not available"); return; // unused (void)filename; (void)doInit; #endif } static void do_linuxsampler_check(const char* const filename, const char* const stype, const bool doInit) { #ifdef HAVE_LINUXSAMPLER const String jfilename = String(CharPointer_UTF8(filename)); const File file(jfilename); if (! file.existsAsFile()) { DISCOVERY_OUT("error", "Requested file is not valid or does not exist"); return; } if (doInit) const LinuxSamplerScopedEngine engine(filename, stype); else LinuxSamplerScopedEngine::outputInfo(nullptr, file.getFileNameWithoutExtension().toRawUTF8(), std::strcmp(stype, "gig") == 0); #else // HAVE_LINUXSAMPLER DISCOVERY_OUT("error", stype << " support not available"); return; // unused (void)filename; (void)doInit; #endif } // ------------------------------ main entry point ------------------------------ int main(int argc, char* argv[]) { if (argc != 3) { carla_stdout("usage: %s <type> </path/to/plugin>", argv[0]); return 1; } const char* const stype = argv[1]; const char* const filename = argv[2]; const PluginType type = getPluginTypeFromString(stype); CarlaString filenameCheck(filename); filenameCheck.toLower(); if (type != PLUGIN_GIG && type != PLUGIN_SF2 && type != PLUGIN_SFZ) { if (filenameCheck.contains("fluidsynth", true)) { DISCOVERY_OUT("info", "skipping fluidsynth based plugin"); return 0; } if (filenameCheck.contains("linuxsampler", true) || filenameCheck.endsWith("ls16.so")) { DISCOVERY_OUT("info", "skipping linuxsampler based plugin"); return 0; } } bool openLib = false; lib_t handle = nullptr; switch (type) { case PLUGIN_LADSPA: case PLUGIN_DSSI: #ifndef CARLA_OS_MAC case PLUGIN_VST2: openLib = true; #endif default: break; } if (openLib) { handle = lib_open(filename); if (handle == nullptr) { print_lib_error(filename); return 1; } } // never do init for dssi-vst, takes too long and it's crashy bool doInit = ! filenameCheck.contains("dssi-vst", true); if (doInit && getenv("CARLA_DISCOVERY_NO_PROCESSING_CHECKS") != nullptr) doInit = false; if (doInit && handle != nullptr) { // test fast loading & unloading DLL without initializing the plugin(s) if (! lib_close(handle)) { print_lib_error(filename); return 1; } handle = lib_open(filename); if (handle == nullptr) { print_lib_error(filename); return 1; } } switch (type) { case PLUGIN_LADSPA: do_ladspa_check(handle, filename, doInit); break; case PLUGIN_DSSI: do_dssi_check(handle, filename, doInit); break; case PLUGIN_LV2: do_lv2_check(filename, doInit); break; case PLUGIN_VST2: #ifdef CARLA_OS_MAC do_juce_check(filename, "VST2", doInit); #else do_vst_check(handle, doInit); #endif break; case PLUGIN_VST3: #ifdef USE_JUCE_PROCESSORS do_juce_check(filename, "VST3", doInit); #else DISCOVERY_OUT("error", "VST3 support not available"); #endif break; case PLUGIN_AU: #ifdef USE_JUCE_PROCESSORS do_juce_check(filename, "AU", doInit); #else DISCOVERY_OUT("error", "AU support not available"); #endif break; case PLUGIN_GIG: do_linuxsampler_check(filename, "gig", doInit); break; case PLUGIN_SF2: do_fluidsynth_check(filename, doInit); break; case PLUGIN_SFZ: do_linuxsampler_check(filename, "sfz", doInit); break; default: break; } if (openLib && handle != nullptr) lib_close(handle); return 0; } // --------------------------------------------------------------------------
[ "falktx@gmail.com" ]
falktx@gmail.com
5f932d9e7edebf596f8c89b675b520d0de968590
7098c3e563aff1e88cec7913d92a76f0d55c888d
/problemset/B/1217B.cpp
0dd38c0ddb004de458ac31cdead01e050ec63412
[]
no_license
cyyever/codeforces
3ae5e7749bd44d9b4d44c1a5620ecd4b5ea13a5b
51f8f205aeb3c20e5fe6453b90ce8ad6794526e8
refs/heads/master
2021-12-02T01:57:02.010834
2021-11-25T10:49:17
2021-11-25T10:49:17
93,985,452
0
0
null
null
null
null
UTF-8
C++
false
false
763
cpp
/*! * \file 1217B.cpp * * \brief http://codeforces.com/problemset/problem/1217/B * \author cyy */ #include <algorithm> #include <iostream> #include <utility> int main(void) { size_t t; std::cin >> t; for (size_t i = 0; i < t; i++) { size_t n; int64_t x; std::cin >> n >> x; int64_t max_d = 0; int64_t max_hurt = INT64_MIN; for (size_t j = 0; j < n; j++) { int64_t d, h; std::cin >> d >> h; max_d = std::max(d, max_d); max_hurt = std::max(max_hurt, d - h); } if (max_d >= x) { std::cout << 1 << std::endl; } else if (max_hurt <= 0) { std::cout << -1 << std::endl; } else { std::cout << ((x - max_d + max_hurt - 1) / max_hurt) + 1 << std::endl; } } return 0; }
[ "cyyever@outlook.com" ]
cyyever@outlook.com
36a6521d46642ba47c74d39e9939cb89021bee0d
593685202e5c670fa6ff0a658be68d7e25f48dae
/include/ProtonDistributionGenerator.hh
791267191ba739c5d3362b3b5a99f7cd1174a367
[]
no_license
takumi-yamaga/KNN_simple_polarimeter
cfbb81abf14413a25f718e5a38da7f6751d5d4be
d3ec250778d5889e36a681464507a7f83a85b47c
refs/heads/master
2023-06-05T08:10:31.280891
2021-03-31T00:06:21
2021-03-31T00:06:21
353,174,047
0
0
null
null
null
null
UTF-8
C++
false
false
1,279
hh
// ProtonDistributionGenerator.hh #ifndef ProtonDistributionGenerator_hh #define ProtonDistributionGenerator_hh #include"G4ThreeVector.hh" #include"TTree.h" #include"TFile.h" class ProtonDistributionGenerator { private: ProtonDistributionGenerator(); ~ProtonDistributionGenerator(); public: ProtonDistributionGenerator(const ProtonDistributionGenerator&) = delete; ProtonDistributionGenerator& operator=(const ProtonDistributionGenerator&) = delete; ProtonDistributionGenerator(ProtonDistributionGenerator&&) = delete; ProtonDistributionGenerator& operator=(ProtonDistributionGenerator&&) = delete; static ProtonDistributionGenerator& GetInstance() { static ProtonDistributionGenerator instance; return instance; } void Generate(); void GetEvent(G4double momentum[3], G4double normal[3], G4double reference[3]); G4int GetEventNumber(){ return _i_event;} private: TFile* _in_root_file; TTree* _in_tree; private: G4int _total_events; G4int _i_event; G4double _momentum_x; G4double _momentum_y; G4double _momentum_z; G4double _normal_x; G4double _normal_y; G4double _normal_z; G4double _reference_x; G4double _reference_y; G4double _reference_z; }; #endif
[ "takumi.yamaga@riken.jp" ]
takumi.yamaga@riken.jp
715474c31716358f4a5ee3fb0995067f501f44c1
24aafdc3272cccced6e00de27130f03d0c203b12
/library/Canvas.h
f57a948aa5b2f9ee3052fd353ec9ea3fed298e41
[]
no_license
bits-und-basteln/examples
2748d55bc9de8b2c19d74b94f98d5f20cdd1df0d
87d189b82573ceda72d9b547607bd61688d03376
refs/heads/master
2020-08-09T02:28:52.986461
2019-11-13T19:48:59
2019-11-13T19:48:59
213,977,899
0
0
null
null
null
null
UTF-8
C++
false
false
439
h
#ifndef Canvas_h #define Canvas_h #include "Arduino.h" #include <avr/pgmspace.h> // Needed to store stuff in Flash using PROGMEM #include "FastLED.h" // Fastled library to control the LEDs #include "Stamp.h" class Canvas { public: Canvas(); void setBrightness(int brightness); void pixel(int x, int y, long color); void draw(Stamp *stamp, int x, int y, long color); void show(); void clear(); }; #endif
[ "christoph.burnicki@gmail.com" ]
christoph.burnicki@gmail.com
b7256e4b5d472e06d7380e8a03dcb9a90fa8d04c
9f0627df2f8ff55bbf5a226bfa47726824f11ae5
/algorithms/containerMostWater/containerMostWater.cpp
4ea04faf6e6534d7252701fe1dc69e8cd9a26031
[]
no_license
SophiaXiaoxingFang/LeetCode
5413d2fbdf9467aebb700430b19253d03612d1bd
a952196066278b96964a3b3854cb12d141f962f2
refs/heads/master
2020-06-04T23:40:57.712022
2019-07-27T20:18:06
2019-07-27T20:18:06
192,236,807
0
0
null
2019-07-27T20:18:07
2019-06-16T21:05:11
C++
UTF-8
C++
false
false
315
cpp
class Solution { public: int maxArea(vector<int>& height) { int i = 0; int j = height.size()-1; int area = 0; while(i<j) { area = max(area, min(height[i],height[j])*(j-i)); height[i]<=height[j] ? i++ : j--; } return area; } };
[ "xiaoxing.fang.ca@gmail.com" ]
xiaoxing.fang.ca@gmail.com
499940709e037adbc94feac984e3e06629bcd2fb
323803788a843d35bb81c2b5377477f6b0f09e73
/nnnEdit/controldoc.h
4afc75958b4989a1fb9d84be0ba011c53ed943d4
[]
no_license
tinyan/SystemNNN_Editor
138384493986eb11714871237a4b31f28ddc342d
c8e9f5cf51b152817d855f6c01bc95465c2c5aa8
refs/heads/master
2023-03-04T18:22:47.794068
2023-02-26T10:51:03
2023-02-26T10:51:03
38,660,049
5
2
null
null
null
null
UTF-8
C++
false
false
401
h
// // controldoc.h // #if !defined __TINYAN_NNNEDIT_CONTROLDOC__ #define __TINYAN_NNNEDIT_CONTROLDOC__ #include "mydocument.h" class CControlDoc : public CMyDocument { public: CControlDoc(CMyApplicationBase* lpApp); ~CControlDoc(); void End(void); // void OnCloseButton(void); void OnControlButton(int n); int GetPlayCommand(void); int GetFilmPlayMode(void); private: }; #endif /*_*/
[ "tinyan@mri.biglobe.ne.jp" ]
tinyan@mri.biglobe.ne.jp
e672c736b5a7406d61296cc9c36d41d60c6e29c5
39c8b9523516d0759d126cbfd09ca4785e6355ab
/milestone_3/item.cpp
392836a830d6d38fea1624d82ceb90609411dd37
[]
no_license
NodeJSMongo/OOP345
7408f3b65551228ffd2642e0dd86406a394831b9
504a70514f3b70e3a2a92e13223b3b1574136a6e
refs/heads/master
2021-05-11T15:24:46.430892
2018-01-16T20:19:57
2018-01-16T20:19:57
117,728,458
0
0
null
null
null
null
UTF-8
C++
false
false
3,124
cpp
#include <iostream> #include <fstream> #include <vector> #include <string> #include "util.h" using namespace std; class item { string itemName, itemInstaller, itemRemover, itemSequence, itemDescription; public: item(vector <string> & row) { switch (row.size()) { case 5: itemDescription = row[4]; case 4: if (ValidItemSequence(row[3])) { itemSequence = row[3]; } else { throw string("Expected a sequence number, found >") + row[3] + "<"; } //case 3: if (ValidTaskName(row[2])) { itemRemover = row[2]; } else { throw string("Expected remover task name, found >") + row[2] + "<"; } //case 2: if (ValidTaskName(row[1])) { itemInstaller = row[1]; } else { throw string("Expected installer task name, found >") + row[1] + "<"; } //case 1: if (ValidItemName(row[0])) { itemName = row[0]; } else { throw string("Expected item name, found >") + row[0] + "<"; } break; default: throw string("Expected 1,2,3 or 4 fields, but found ") + to_string(row.size()); } } void Print() { cout << "[" << itemName << "] " << "[" << itemInstaller << "] " << "[" << itemRemover << "] " << "[" << itemSequence << "] " << "[" << itemDescription << "] " << "\n"; } void Graph(fstream& os) { os << '"' << "Item\n" << itemName << '"' << "->" << '"' << "Installer\n" << itemInstaller << '"' << "[color=green]" << ";\n"; os << '"' << "Item\n" << itemName << '"' << "->" << '"' << "Remover\n" << itemRemover << '"' << "[color=red]" << ";\n"; } }; class itemManager { vector <item> itemList; public: itemManager(vector <vector<string>>& csvitem) { int lineNumber = 0; for (auto &row : csvitem) { try { lineNumber++; itemList.push_back(move(item(row))); } catch (const string& e) { cerr << "Error on line " << lineNumber << ":" << e << "\n"; } } } void Print() { int lineNumber = 0; for (auto t : itemList) { lineNumber++; cout << lineNumber << ": "; t.Print(); } } void Graph(string& filename) { fstream os(filename, ios::out | ios::trunc); if (os.is_open()) { os << "digraph item {\n"; for (auto t : itemList) { t.Graph(os); } os << "}\n"; os.close(); string cmd = "dot -Tpng " + filename + " > " + filename + ".png"; //string cmd = "C:\\\"Program Files (x86)\"\\Graphviz2.38\\bin\\dot.exe -Tpng " + filename + " > " + filename + ".png"; cout << "running -->" << cmd << "\n"; cout << "command returned " << system(cmd.c_str()) << " (zero is good)\n"; } } }; int main(int argc, char* argv[]) { try { if (argc != 3) { throw string("Usage ") + argv[0] + string(" filename delimiter-char"); } string filename = argv[1]; // First arg is file name char delimiter = argv[2][0]; // Second arg, 1st char is delimiter vector <vector<string>> csvData; csvread(filename, delimiter, csvData); //csvPrint(csvData); itemManager im(csvData); im.Print(); string graphLine = filename + ".gv"; im.Graph(graphLine); } catch (const string& e) { cerr << e << "\n"; } }
[ "mahmud.smu@gmail.com" ]
mahmud.smu@gmail.com
1892c245f9e7da5368f04fa2db3c934f79a6886a
4867377e09dbe9ca6621c640326838d65a333862
/Platformer-master/Project3/Project3/LevelManager.cpp
2b87a3815d5b44e32743054aad3e844fb4b09b5f
[]
no_license
xephoran/Platformer
e3de0791af80429f64e899875b5be8953dae2166
39c48ee179b558a7c71a84e444ff18e4ffe0f386
refs/heads/master
2020-06-13T09:50:48.782639
2016-12-17T01:08:03
2016-12-17T01:08:03
75,424,859
0
0
null
null
null
null
UTF-8
C++
false
false
1,532
cpp
#include "LevelManager.h" #include <iostream> #include <fstream> #include <array> LevelManager::LevelManager() { } std::vector<sf::IntRect> LevelManager::loadLevel(int levelNumber) { //gets the number of the level texture file and changes the number to a string std::string textureString = std::to_string(levelNumber); //change the level file location to correct one if needed LevelManager::location = "levels/l" + textureString + ".jpg"; if (!LevelManager::levelTexture.loadFromFile(location)) { std::cout << "COULDNT LOAD TEXURE OH NO!!!"; } LevelManager::levelSprite.setTexture(LevelManager::levelTexture); //opening the txt file for the terrain sprite bounds std::array<int, 4> spriteBounds = { 0,0,0,0 }; std::ifstream infile; infile.open("levels/" + textureString + ".txt"); if (infile.fail()) { std::cout << "\n COULDNT OPEN FILE!!!"; } int lineCount = 0; int item = 0; std::vector<sf::IntRect> rectVect; for (int i = 0; !infile.eof(); i++) { //WORK HERE!!! PLZ ME DO IT!!!! infile >> item; if (i % 4 == 0) { spriteBounds[0] = item; } if (i % 4 == 1) { spriteBounds[1] = item; } if (i % 4 == 2) { spriteBounds[2] = item; } if (i % 4 == 3) { spriteBounds[3] = item; sf::IntRect terrain(spriteBounds[0], spriteBounds[1], spriteBounds[2], spriteBounds[3]); rectVect.push_back(terrain); } } //need to load the 1.txt into an array for the sprite return return rectVect; } sf::Sprite LevelManager::draw() { return LevelManager::levelSprite; }
[ "noreply@github.com" ]
xephoran.noreply@github.com
00281a9d0ef603d6c2e4753661470479bc5300e7
0f2b08b31fab269c77d4b14240b8746a3ba17d5e
/onnxruntime/contrib_ops/cuda/bert/multihead_attention.h
33fa3d50e4564eb349a146f472ccbc4be32a2e29
[ "MIT" ]
permissive
microsoft/onnxruntime
f75aa499496f4d0a07ab68ffa589d06f83b7db1d
5e747071be882efd6b54d7a7421042e68dcd6aff
refs/heads/main
2023-09-04T03:14:50.888927
2023-09-02T07:16:28
2023-09-02T07:16:28
156,939,672
9,912
2,451
MIT
2023-09-14T21:22:46
2018-11-10T02:22:53
C++
UTF-8
C++
false
false
1,429
h
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #pragma once #include <memory> #include "core/providers/cuda/cuda_kernel.h" #include "contrib_ops/cuda/bert/tensorrt_fused_multihead_attention/mha_runner.h" #include "contrib_ops/cuda/bert/tensorrt_fused_multihead_attention/cross_attention/fmha_cross_attention.h" #include "contrib_ops/cuda/bert/attention_impl.h" namespace onnxruntime { namespace contrib { namespace cuda { using namespace onnxruntime::cuda; template <typename T> class MultiHeadAttention final : public CudaKernel { public: MultiHeadAttention(const OpKernelInfo& info); Status ComputeInternal(OpKernelContext* context) const override; protected: int num_heads_; // number of attention heads float mask_filter_value_; float scale_; bool disable_fused_self_attention_; bool enable_trt_flash_attention_; bool disable_fused_cross_attention_; bool disable_flash_attention_; bool disable_memory_efficient_attention_; int min_seq_len_for_flash_attention_packed_qkv_; mutable std::unique_ptr<MHARunner> fused_fp16_runner_; mutable const FusedMultiHeadCrossAttentionKernel* fused_fp16_cross_attention_kernel_; mutable CumulatedSequenceLengthCache cumulated_sequence_length_q_cache_; mutable CumulatedSequenceLengthCache cumulated_sequence_length_kv_cache_; }; } // namespace cuda } // namespace contrib } // namespace onnxruntime
[ "noreply@github.com" ]
microsoft.noreply@github.com
0e1ced9dfef3ad5bb2fbac947d0fbababaa35153
d4ca6475faf8fec491288a4b5bbd26f090e2d14d
/src/arcemu-shared/Network/SocketMgrFreeBSD.cpp
f7bd4d01660315efadeaf4e36994b69900bead88
[]
no_license
saqar/Edge-of-Chaos
926b73ff934d677cee8922850040b8cf550372b0
b840a34849119f5ecd1e998a87c236e8624b01c7
refs/heads/master
2021-01-11T05:01:30.535195
2014-04-11T18:02:30
2014-04-11T18:02:30
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,974
cpp
/* * Multiplatform Async Network Library * Copyright (c) 2007 Burlex * * SocketMgr - epoll manager for Linux. * */ #include "Network.h" #ifdef CONFIG_USE_KQUEUE initialiseSingleton(SocketMgr); void SocketMgr::AddSocket(Socket* s) { assert(fds[s->GetFd()] == 0); fds[s->GetFd()] = s; struct kevent ev; if(s->writeBuffer.GetSize()) EV_SET(&ev, s->GetFd(), EVFILT_WRITE, EV_ADD | EV_ONESHOT, 0, 0, NULL); else EV_SET(&ev, s->GetFd(), EVFILT_READ, EV_ADD, 0, 0, NULL); if(kevent(kq, &ev, 1, 0, 0, NULL) < 0) { Log.Error("kqueue", "Could not add initial kevent for fd %u!", s->GetFd()); return; } } void SocketMgr::ShowStatus() { sLog.outString("Sockets: %d", 0); } void SocketMgr::AddListenSocket(ListenSocketBase* s) { assert(listenfds[s->GetFd()] == 0); listenfds[s->GetFd()] = s; struct kevent ev; EV_SET(&ev, s->GetFd(), EVFILT_READ, EV_ADD, 0, 0, NULL); if(kevent(kq, &ev, 1, 0, 0, NULL) < 0) { Log.Error("kqueue", "Could not add initial kevent for fd %u!", s->GetFd()); return; } } void SocketMgr::RemoveSocket(Socket* s) { if(fds[s->GetFd()] != s) { /* already removed */ Log.Warning("kqueue", "Duplicate removal of fd %u!", s->GetFd()); return; } fds[s->GetFd()] = 0; // remove kevent struct kevent ev, ev2; EV_SET(&ev, s->GetFd(), EVFILT_WRITE, EV_DELETE, 0, 0, NULL); EV_SET(&ev2, s->GetFd(), EVFILT_READ, EV_DELETE, 0, 0, NULL); if(kevent(kq, &ev, 1, 0, 0, NULL) && kevent(kq, &ev2, 1, 0, 0, NULL)) Log.Warning("kqueue", "Could not remove from kqueue: fd %u", s->GetFd()); } void SocketMgr::CloseAll() { for(uint32 i = 0; i < SOCKET_HOLDER_SIZE; ++i) if(fds[i] != NULL) fds[i]->Delete(); } void SocketMgr::SpawnWorkerThreads() { uint32 count = 1; for(uint32 i = 0; i < count; ++i) ThreadPool.ExecuteTask(new SocketWorkerThread()); } bool SocketWorkerThread::run() { //printf("Worker thread started.\n"); int fd_count; running = true; Socket* ptr; int i; struct kevent ev; struct timespec ts; ts.tv_nsec = 0; ts.tv_sec = 5; struct kevent ev2; SocketMgr* mgr = SocketMgr::getSingletonPtr(); int kq = mgr->GetKq(); while(running) { fd_count = kevent(kq, NULL, 0, &events[0], THREAD_EVENT_SIZE, &ts); for(i = 0; i < fd_count; ++i) { if(events[i].ident >= SOCKET_HOLDER_SIZE) { Log.Warning("kqueue", "Requested FD that is too high (%u)", events[i].ident); continue; } ptr = mgr->fds[events[i].ident]; if(ptr == NULL) { if((ptr = ((Socket*)mgr->listenfds[events[i].ident])) != NULL) { ((ListenSocketBase*)ptr)->OnAccept(); } else { Log.Warning("kqueue", "Returned invalid fd (no pointer) of FD %u", events[i].ident); /* make sure it removes so we don't go chasing it again */ EV_SET(&ev, events[i].ident, EVFILT_WRITE, EV_DELETE, 0, 0, NULL); EV_SET(&ev2, events[i].ident, EVFILT_READ, EV_DELETE, 0, 0, NULL); kevent(kq, &ev, 1, 0, 0, NULL); kevent(kq, &ev2, 1, 0, 0, NULL); } continue; } if(events[i].flags & EV_EOF || events[i].flags & EV_ERROR) { ptr->Disconnect(); continue; } else if(events[i].filter == EVFILT_WRITE) { ptr->BurstBegin(); // Lock receive mutex ptr->WriteCallback(); // Perform actual send() if(ptr->writeBuffer.GetSize() > 0) ptr->PostEvent(EVFILT_WRITE, true); // Still remaining data. else { ptr->DecSendLock(); ptr->PostEvent(EVFILT_READ, false); } ptr->BurstEnd(); // Unlock } else if(events[i].filter == EVFILT_READ) { ptr->ReadCallback(0); // Len is unknown at this point. if(ptr->writeBuffer.GetSize() > 0 && ptr->IsConnected() && !ptr->HasSendLock()) { ptr->PostEvent(EVFILT_WRITE, true); ptr->IncSendLock(); } } } } return true; } #endif
[ "admin@e2d0575d-2f82-4250-b8ec-0d5e7f3c5cc0" ]
admin@e2d0575d-2f82-4250-b8ec-0d5e7f3c5cc0
1e20ee9f0fafca81885b4ddc2784234e010052a2
2d935167f571b610b53635f16ab3b49f299f4bf5
/MobileTimes/source/Squad.cpp
6e8f5ab18b0ccd21d601a2151d9d5de69af9d3c0
[]
no_license
CXX20/Mobile-Times
9586c3391553e65efe4adda5654cb9f6595ffec4
ccbd276e9cf6bf4bd90b0e5e9b44808c4b1125fd
refs/heads/master
2020-12-10T17:28:44.056717
2020-01-13T18:18:24
2020-01-13T18:18:24
233,660,104
0
0
null
null
null
null
UTF-8
C++
false
false
512
cpp
#include "Squad.h" using ut::Squad; Squad::Squad() { mId = ut::glb::NegativeId::scError; mIsActive = false; mSpriteType = ut::SpriteType::error; mPosition = sf::Vector2<size_t>(0, 0); mMoney = 0; } Squad::Squad(const int& dcId, const bool& dcIsActive, const ut::SpriteType& dcSpriteType, const sf::Vector2<size_t>& dcPosition, const int& dcMoney) { mId = dcId; mIsActive = dcIsActive; mSpriteType = dcSpriteType; mPosition = dcPosition; mMoney = dcMoney; } Squad::~Squad() {}
[ "noreply@github.com" ]
CXX20.noreply@github.com
dc9fdaa0122a488483c3db81f82b3f6dbec6d19d
f1fee38fbc6e517f044851e47a55eb8519d43b30
/ECE231/CPP-source/stacks-queues/Chapter5/Stack/linked/StackDr.cpp
07fe8aa45f7284a63f61d119043bc1a0a253451d
[]
no_license
unm-ieee/ECE_Material
7876f5d83acb4280bbc90b8cd575ba3ee4a0f0ce
45ff92dacf48cb4c20fc8d90805d00b90fcfa042
refs/heads/master
2021-01-10T20:13:55.768764
2017-08-15T16:47:27
2017-08-15T16:47:27
24,461,853
15
11
null
null
null
null
UTF-8
C++
false
false
2,263
cpp
// Test driver #include <iostream> #include <fstream> #include <string> #include <cctype> #include <cstring> #include "StackType.h" using namespace std; int main() { ifstream inFile; // file containing operations ofstream outFile; // file containing output string inFileName; // input file external name string outFileName; // output file external name string outputLabel; string command; // operation to be executed char item; StackType stack; int numCommands; // Prompt for file names, read file names, and prepare files cout << "Enter name of input command file; press return." << endl; cin >> inFileName; inFile.open(inFileName.c_str()); cout << "Enter name of output file; press return." << endl; cin >> outFileName; outFile.open(outFileName.c_str()); cout << "Enter name of test run; press return." << endl; cin >> outputLabel; outFile << outputLabel << endl; inFile >> command; numCommands = 0; while (command != "Quit") { try { if (command == "Push") { inFile >> item >> item; stack.Push(item); } else if (command == "Pop") stack.Pop(); else if (command == "Top") { item = stack.Top(); outFile<< "Top element is " << item << endl; } else if (command == "IsEmpty") if (stack.IsEmpty()) outFile << "Stack is empty." << endl; else outFile << "Stack is not empty." << endl; else if (command == "IsFull") if (stack.IsFull()) outFile << "Stack is full." << endl; else outFile << "Stack is not full." << endl; else outFile << command << " not found" << endl; } catch (FullStack) { outFile << "FullStack exception thrown." << endl; } catch (EmptyStack) { outFile << "EmptyStack exception thrown." << endl; } numCommands++; cout << " Command number " << numCommands << " completed." << endl; inFile >> command; }; cout << "Testing completed." << endl; inFile.close(); outFile.close(); return 0; }
[ "steven.t.seppala@gmail.com" ]
steven.t.seppala@gmail.com
71bf9e64fdccfe7b376be6b2a09fdb239565a8d5
f1d1822867051ec3b745a668c51017abd4b6233d
/1433d_District_connection.cpp
a1c72e77808590261413071cffaf019fa058926a
[]
no_license
pravekotian123/codeforces
3b5b3d32fcc84ec526bf19856bdb72209fbe523f
6a348710e6f2526faeb93542a78cf792f50b3ff2
refs/heads/main
2023-06-12T05:53:07.433557
2021-07-09T11:49:35
2021-07-09T11:49:35
381,664,222
0
0
null
null
null
null
UTF-8
C++
false
false
858
cpp
#include<iostream> #include<vector> #include<map> #include<algorithm> #include<set> #include<string> using namespace std; int main() { int t; cin>>t; while(t--) { int n; cin>>n; map<int,vector<int>> mp; set<int> s; int x; for(int i=1;i<=n;i++) { cin>>x; mp[x].push_back(i); s.insert(x); } if(s.size()==1) { cout<<"NO"<<endl; continue; } cout<<"YES"<<endl; int temp,temp_next; auto i=s.begin(); temp=*i; ++i; temp_next=*i; while(i!=s.end()) { for(int j=0;j<mp[*i].size();j++) cout<<mp[temp][0]<<" "<<mp[*i][j]<<endl; if(temp_next==*i) { --i; if(mp[*i].size()>1) { for(int j=1;j<mp[*i].size();j++) cout<<mp[temp_next][0]<<" "<<mp[*i][j]<<endl; } ++i; } ++i; } } return 0; }
[ "noreply@github.com" ]
pravekotian123.noreply@github.com
2701d04d6246ba0d483121fc1fed6c21ab3aebcb
98f49e12468575aa763303acb98b002128ee2332
/pm2/pm2/pm2.cpp
ec4e05e2cdf56bb73dd28b179354b5d594e486ac
[]
no_license
madaschlesinger/codility
dc34bda7bcf4be2f84b8506b6ac1bd909d4b17e9
801effca452d6972d891e787b8e0fc8bdebcfc24
refs/heads/master
2021-01-22T19:40:44.050457
2019-07-30T14:33:03
2019-07-30T14:33:03
85,217,982
0
0
null
null
null
null
UTF-8
C++
false
false
122
cpp
// pm2.cpp : Defines the entry point for the console application. // #include "stdafx.h" int main() { return 0; }
[ "mada.schlesinger@gmail.com" ]
mada.schlesinger@gmail.com
2133d503d1ca811cb53831666517a287b9f2a9ca
6846f13b3fc593c6e5f6058bfc7d242f93d3ba7f
/HyperSonic.cpp
8eb9c6d9a3de3efda0fe2fb923da37402647fd20
[]
no_license
chelseajaculina/HyperSonic
f753e9bf050de2298387168e73320861777438a6
cd8bca3559df03894f7dd4e3d2b7d0afd554d69e
refs/heads/master
2020-03-31T02:04:36.007767
2019-06-04T22:23:39
2019-06-04T22:23:39
151,807,079
1
0
null
null
null
null
UTF-8
C++
false
false
10,179
cpp
//============================================================================ // Name : HyperSonic.cpp // Author : Chelsea Jaculina & Nick Dineros // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================ // Created on May 6, 2018 #include <iostream> // library for user input and output #include <cstdlib> // c++ standard general utilities library #include <string> // string library #include <fstream> // file library #include <sstream> // string streams #include <ctype.h> // c standard library declares a set of function to classify and transforms individual characters #include <stdio.h> // input and output operations #include <limits.h> // determines various properties of the various variable types using namespace std; // standard namespace. provides a scope to the identifiers const int numOfCities = 30; // constant for the number of airport and cities to be tested /* * minDistance * This function finds the vertex (airport) with the minimum distance * that has not yet been included in the shortest path tree * dist[] - array to check for distances * sptSet - spanning set tree. sets the particular value to be either true or false */ int minDistance(int dist[], bool sptSet[]) { int min = INT_MAX; int min_index; // initialize the min value // iterative to find the airport with minimum distance for (int v = 0; v < numOfCities; v++) { if (sptSet[v] == false && dist[v] <= min) { min = dist[v], min_index = v; } } return min_index; } /* * Print Path * Function that helps print out the flight path */ void printPath(int parent[], int j, string cities[numOfCities]){ // Base case: if j is source if (parent[j] == -1){ return; } printPath(parent, parent[j], cities); cout << " --> " << cities[j]; } /* * PrintDijkstra * Function that prints out information for the Djikstra's algorithm */ void printDijkstra(int dist[], int n, string destination, string cities[numOfCities], int parent[]) { for (int i = 1; i < numOfCities; i++) { while(destination == cities[i]){ cout << "\t\tSFO to " << destination << "'s Flight Information:" << endl; cout << "--------------------------------------------------------------------" << endl; cout << "DEPARTURE Airport: SFO" << endl; cout << "ARRIVAL Airport: " << destination << endl; cout << "FLIGHT PATH......................... SFO"; printPath(parent, i, cities); cout << endl; cout << "MINIMUM DISTANCE FOR FLIGHT........................ " << dist[i] << " " << "miles" << endl; cout << "MINIMUM COST FOR FLIGHT........................ $" << dist[i] * 0.20 << endl; break; } } } /* * Djikstra * Follows Djikstra's algorithm * Function that is implemented for Dijkstra's single source shortest path algorithm */ void dijkstra(int matrix[numOfCities][numOfCities], int src, string destination, string cities[30]) { int dist[numOfCities]; // The output array. dist[i] will hold // the shortest distance from src to i // sptSet[i] will be true if vertex i is included / in shortest path tree or shortest distance from src to i is finalized bool sptSet[numOfCities]; // Parent array to store shortest path tree int parent[numOfCities]; // Initialize all distances as INFINITE and stpSet[] as false for (int i = 0; i < numOfCities; i++) { parent[0] = -1; dist[i] = INT_MAX; sptSet[i] = false; } // Distance of source vertex from itself is always 0 dist[src] = 0; // Find shortest path for all vertices for (int count = 0; count < numOfCities-1; count++) { // Pick the minimum distance vertex from the set of // vertices not yet processed. u is always equal to src // in first iteration. int u = minDistance(dist, sptSet); // Mark the picked vertex as processed sptSet[u] = true; // Update dist value of the adjacent vertices of the // picked vertex. for (int v = 0; v < numOfCities; v++) // Update dist[v] only if is not in sptSet, there is // an edge from u to v, and total weight of path from // src to v through u is smaller than current value of // dist[v] if (!sptSet[v] && matrix[u][v] && dist[u] + matrix[u][v] < dist[v]) { parent[v] = u; dist[v] = dist[u] + matrix[u][v]; } } // print the constructed distance array printDijkstra(dist, numOfCities, destination, cities, parent); } /* * Finds the shortest path from the departure airport to the arrival airport */ void find_path(int u, int v, int dist[][numOfCities], int pred[][numOfCities], string cities[]) { if(u != v){ find_path(u, pred[u][v], dist, pred, cities); } cout << " --> " << cities[v]; } /* * Print Method * This functions prints for option #2: display the flight distances */ void printFlightDistances(string cities[numOfCities], int matrix[numOfCities][numOfCities]) { cout << " "; for(int i = 0; i < numOfCities; i++) // top row { cout << cities[i] << " "; } cout << "\n"; for (int a = 0; a < numOfCities; a++) { cout << cities[a] << "\t"; for (int b = 0; b < numOfCities; b++) { cout << matrix[a][b] << " "; if(matrix[a][b] == 0){ cout << " "; } } cout << endl; } } /* * MAIN METHOD * The function displays an interface so that users can select a flight destination. * It displays the shortest path from the departure airport to the arrival airport. * In addition, it provides the user the minimum cost for the flight. */ int main() { int x, y; // variables for the row and column int matrix[numOfCities][numOfCities]; // creates a 30 x 30 matrix int hold; int optionChoice = 0; // int variable for option choice string destination; // destination variable // an array of 30 cities of type string // this array contains the top 30 busiest airports in the world string cities[numOfCities] = {"SFO", "ATL", "PEK", "DXB", "HND", "LAX", "ORD", "LHR", "HKG", "PVG", "CDG","AMS", "DFW", "CAN", "FRA", "IST","DEL", "CGK", "SIN", "ICN", "DEN", "BKK", "JFK", "KUL", "MAD", "CTU", "LAS", "BCN", "BOM","YYZ"}; ifstream in("input.txt"); if (!in) { cout << "No file was found. Please make sure you have an input.txt file.\n"; return 0; } for (y = 0; y < numOfCities; y++) { for (x = 0; x < numOfCities; x++) { in >> matrix[y][x]; } } in.close(); while (optionChoice== 0) { cout << "--------------------------------------------------------------------" << endl; cout << "\t\tWELCOME TO HYPER SONIC - Flight Optimizer" << endl; cout << "--------------------------------------------------------------------" << endl; cout << "\t\t*HOME* Menu - Select an Option Number"<< endl; cout << "--------------------------------------------------------------------" << endl; cout << "0 - Terminate" << endl; cout << "1 - Select a Destination" << endl; cout << "2 - View Flight Distances (miles) "<< endl; cout << "Option Choice: "; cin >> optionChoice; // users's option choice if (optionChoice == 1) { cout << "--------------------------------------------------------------------" << endl; cout << "\t\t OPTION 1: SELECTING A DESTINATION" << endl; cout << "--------------------------------------------------------------------" << endl; cout <<"DEPARTURE: SFO"; cout << endl; cout << "CURRENT AVAILABLE AIRPORTS:\n"; for(int k = 0; k < numOfCities; k++){ cout << "\t" + cities[k] << " "; if ((k+1) % 6 == 0){ cout << "\n"; } } cout << endl; cout << "SELECT AN ARRIVAL AIRPORT: "; cin >> destination; for (int p = 0; p < destination.size(); p++){ destination.at(p) = toupper(destination.at(p)); } bool valid = false; int location; for (int s = 1; s < numOfCities; s++){ if(!destination.compare(cities[s])){ location = s; valid = true; hold = matrix[0][location]; matrix[0][location] = 99999; cout << "--------------------------------------------------------------------" << endl; dijkstra(matrix, 0, destination, cities); // prints out the minimum cost/shortest path using Djiikstra's algorithm cout << endl; //floydWarshall(matrix, destination, cities); // prints out the minimum cost/shortest path using Floyd Warshall's algorithm matrix[0][location] = hold; break; } } optionChoice = 0; } else if(optionChoice == 2) { cout << "--------------------------------------------------------------------" << endl; cout << "\t\t OPTION 2: VIEW FLIGHT DISTANCES (miles) " << endl; printFlightDistances(cities, matrix); optionChoice = 0; cout << endl << endl << endl; } else if (optionChoice == 0) { cout << "--------------------------------------------------------------------" << endl; cout << "\t\t OPTION 3: Program has terminated. " << endl; cout << "\t\t Thank you for using Hyper Sonic! " << endl; cout << "--------------------------------------------------------------------" << endl; break; return 0; } } }
[ "noreply@github.com" ]
chelseajaculina.noreply@github.com
543fbc868c2b37136b70944d5d376fe424bd11e4
748e5e68157bbc8644989f83019d443e4c183f29
/main.cpp
0402408b741955cfe62491f25a618a8f5914e09f
[]
no_license
volen17/Huffman-Project
67df580ef5168cbaefe9a880117842e33e8e0c0f
a42bfa875e81ed40b81bfef390b6af488a2cf08d
refs/heads/master
2023-03-07T10:06:46.011154
2021-02-06T05:32:13
2021-02-06T05:32:13
332,034,476
0
0
null
null
null
null
UTF-8
C++
false
false
7,534
cpp
#include <iostream> #include <fstream> #include <sstream> #include <string> #include <vector> #include "huffman.hpp" bool isTXT(std::string file) { std::string extension; int i = file.length() - 1; while (file[i] != '.') { extension = extension + file[i]; i--; } if (extension == "txt") { return true; } return false; } void printMenu() { std::cout << "Huffman Compressor\n" << std::endl; std::cout << "- c[ompress] - Compress mode (default)\n" << "- d[ecompress] - Decompress mode\n" << "- i <filename> - Input file\n" << "- o <filename> - Output file\n" << "- e[xit] - exits the program\n" << "* de[bug] - Debug mode\n" << "* l[evel] - Level of compression\n" << std::endl; } void system() { printMenu(); Huffman h; bool mode = true; // compress (true) / decompress (false) bool isLoadedFile = false; bool isSavedFile = false; while (true) { std::string command; std::getline(std::cin, command); if (command.compare("c") == 0 || command.compare("compress") == 0) { mode = true; isSavedFile = false; isLoadedFile = false; std::cout << std::endl << "Compress mode...\n" << std::endl; continue; } if (command.compare("d") == 0 || command.compare("decompress") == 0) { isSavedFile = false; isLoadedFile = false; mode = false; std::cout << std::endl << "Decompress mode...\n" << std::endl; continue; } if (command.substr(0, 2).compare("i ") == 0 && command.length() > 2) { if (!isTXT(command.substr(2))) { std::cout << std::endl << "This program works only with .txt files!\n" << std::endl; continue; } if (mode) // compress mode { try { std::string text; std::ifstream in(command.substr(2)); if (in.good()) { std::stringstream buffer; buffer << in.rdbuf(); text = buffer.str(); } in.close(); h = Huffman(text); } catch (...) { std::cout << std::endl << "Error reading file\n" << std::endl; } } else // decompress mode { try { std::string line; std::string compressedText; std::vector<std::pair<char, int>> frequencyTable; int frequencyTableSize; isLoadedFile = true; isSavedFile = false; std::ifstream in(command.substr(2)); if (in.good()) { getline(in, line); compressedText = line; getline(in, line); frequencyTableSize = std::stoi(line); for (int i = 0; i < frequencyTableSize; i++) { char c; std::string rest; getline(in, line); if (line.substr(0, 2).compare("\\n") == 0) { c = '\n'; rest = line.substr(3); } else { c = line[0]; rest = line.substr(2); } frequencyTable.push_back(std::make_pair(c, std::stoi(rest))); } } h = Huffman(compressedText, frequencyTable); in.close(); } catch (...) { std::cout << std::endl << "Error reading compressed file\n" << std::endl; } } isLoadedFile = true; isSavedFile = false; std::cout << std::endl; continue; } if (command.substr(0, 2).compare("o ") == 0 && command.length() > 2) { if (!isLoadedFile) { std::cout << std::endl << "There is no loaded file!\n" << std::endl; continue; } if (!isTXT(command.substr(2))) { std::cout << std::endl << "This program works only with .txt files!\n" << std::endl; continue; } std::ofstream out(command.substr(2)); if (mode) // compress mode { out << h; out.close(); } else // decompress mode { out << h.get_decompressedText(); out.close(); } isSavedFile = true; std::cout << std::endl; continue; } if (command.compare("exit") == 0) { if (!isSavedFile && isLoadedFile) { std::cout << std::endl << "Your file isn't saved in an output file!\n"; std::string yes_no; do { std::cout << std::endl << "Do you want to continue? (yes/no)\n" << std::endl; std::cin >> yes_no; } while (!(yes_no == "yes" || yes_no == "no")); if (yes_no == "no") { continue; } } std::cout << std::endl << "Exiting the program..."; exit(0); } if (command.compare("de") == 0 || command.compare("debug") == 0) { if (!isLoadedFile) { std::cout << std::endl << "There is no loaded file!\n" << std::endl; continue; } std::cout << h.debug() << std::endl; continue; } if (command.compare("l") == 0 || command.compare("level") == 0) { if (!isLoadedFile) { std::cout << std::endl << "There is no loaded file!\n" << std::endl; continue; } std::cout << h.level() << std::endl; continue; } std::cout << std::endl << "Wrong command!" << std::endl << std::endl; } } int main() { system(); return 0; }
[ "volen17@abv.bg" ]
volen17@abv.bg
21be9032406c3c90436993def032184b1f47ec9e
6b2a8dd202fdce77c971c412717e305e1caaac51
/solutions_5658068650033152_0/C++/TankEngineer/C.cpp
11a16b2d869bf7ac01c8b75316e0a08ce81b28f3
[]
no_license
alexandraback/datacollection
0bc67a9ace00abbc843f4912562f3a064992e0e9
076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf
refs/heads/master
2021-01-24T18:27:24.417992
2017-05-23T09:23:38
2017-05-23T09:23:38
84,313,442
2
4
null
null
null
null
UTF-8
C++
false
false
1,056
cpp
#include<deque> #include<vector> #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; int main() { int t; scanf("%d", &t); while (t--) { static int id = 0; printf("Case #%d: ", ++id); int n, m, k; scanf("%d%d%d", &n, &m, &k); if (min(n, m) <= 2) { printf("%d\n", k); continue; } else { int ans = k; for (int w = 1; w <= m; ++w) { for (int h = 1; h <= n; ++h) { int cost, area; if (min(w, h) <= 2) { cost = k; area = k; } else { cost = 2 * (h - 2) + 2 * (w - 2); area = h * w - 4; if (area < k) { cost += k - area; area += k - area; } } if (area >= k) { ans = min(ans, cost); } } } for (int w = 3; w <= m; ++w) { int cost = w + w - 2, area = w + w - 2; vector<int> up, down; up.push_back(w); down.push_back(w - 2); int lup = (n + 1) / 2, ldown = while (true) { ans = min(ans, cost + max(0, k - area)); } } printf("%d\n", ans); } } return 0; }
[ "eewestman@gmail.com" ]
eewestman@gmail.com
f750ef4e312cd8c53290339c5604a483531c56f7
fac3afeeb7be731a3c968b466bd69ae01e19606b
/zpar-0.7/src/chinese/segmentor/agendachart.cpp
fdccd858d2d5c673b8dfdca1057d05263e5af14b
[]
no_license
aminorex/nlp
3a03b280efa20f828bd13eabbcf4097e3daf29b9
e93eb2896213834c99cd1f4861ecff19c996382f
refs/heads/master
2021-01-19T19:35:05.786046
2015-07-18T00:34:00
2015-07-18T00:34:00
30,219,876
1
2
null
null
null
null
UTF-8
C++
false
false
15,037
cpp
// Copyright (C) University of Oxford 2010 /**************************************************************** * * * segmentor.cpp - the chinese segmentor * * * * This implementation uses beam search ageanda+chart * * * * Author: Yue Zhang * * * * Computing Laboratory, Oxford. 2006.10 * * * ****************************************************************/ #include "segmentor.h" using namespace chinese; using namespace chinese::segmentor; CWord g_emptyWord(""); /*=============================================================== * * CFeatureHandle - handles the features for the segmentor * *==============================================================*/ /*--------------------------------------------------------------- * * getGlobalScore - get the global score for sentence * *--------------------------------------------------------------*/ int CFeatureHandle::getGlobalScore(const CStringVector* sentence, const CStateItem* item){ int nReturn = 0; for (int i=0; i<item->m_nLength; ++i) nReturn += getLocalScore(sentence, item, i); return nReturn; } /*--------------------------------------------------------------- * * getLocalScore - get the local score for a word in sentence * * When bigram is needed from the beginning of sentence, the empty word are used. * * This implies that empty words should not be used in other * situations. * *--------------------------------------------------------------*/ int CFeatureHandle::getLocalScore(const CStringVector* sentence, const CStateItem* item, int index){ static int nReturn; static int score_index; static int tmp_i, tmp_j; static int length, last_length, word_length; static int start, end, last_start, last_end; score_index = m_bTrain ? CScore<SCORE_TYPE>::eNonAverage : CScore<SCORE_TYPE>::eAverage ; start = item->getWordStart(index); end = item->getWordEnd(index); length = item->getWordLength(index); last_start = index>0 ? item->getWordStart(index-1) : 0; // make sure that this is only used when index>0 last_end = index>0 ? item->getWordEnd(index-1) : 0; // make sure that this is only used when index>0 last_length = index>0 ? item->getWordLength(index-1) : 0; // similar to the above word_length = length ; // abstd::cout the words const CWord &word=m_parent->findWordFromCache(start, length, sentence); const CWord &last_word = index>0 ? m_parent->findWordFromCache(last_start, last_length, sentence) : g_emptyWord; // use empty word for sentence beginners. static CTwoWords two_word; two_word.refer(&word, &last_word); // abstd::cout the chars const CWord &first_char=m_parent->findWordFromCache(start, 1, sentence); const CWord &last_char=m_parent->findWordFromCache(end, 1, sentence); const CWord &first_char_last_word = index>0 ? m_parent->findWordFromCache(last_start, 1, sentence) : g_emptyWord; const CWord &last_char_last_word = index>0 ? m_parent->findWordFromCache(last_end, 1, sentence) : g_emptyWord; static CTwoWords first_and_last_char, lastword_firstchar, currentword_lastchar, firstcharlastword_word, lastword_lastchar; first_and_last_char.refer(&first_char, &last_char); const CWord &two_char = index>0 ? m_parent->findWordFromCache(last_end, 2, sentence) : g_emptyWord; if (index>0) { lastword_firstchar.refer(&last_word, &first_char); currentword_lastchar.refer(&word, &last_char_last_word); firstcharlastword_word.refer(&first_char_last_word, &first_char); lastword_lastchar.refer(&last_char_last_word, &last_char); } // abstd::cout the length if(length>LENGTH_MAX-1)length=LENGTH_MAX-1; if(last_length>LENGTH_MAX-1)last_length=LENGTH_MAX-1; // // adding scores with features // nReturn = m_weights.m_mapSeenWords.getScore(word, score_index); nReturn += m_weights.m_mapLastWordByWord.getScore(two_word, score_index); if (length==1) nReturn += m_weights.m_mapOneCharWord.getScore(word, score_index); else { nReturn += m_weights.m_mapFirstAndLastChars.getScore(first_and_last_char, score_index); for (int j=0; j<word_length-1; j++) nReturn += m_weights.m_mapConsecutiveChars.getScore(m_parent->findWordFromCache(start+j, 2, sentence), score_index); nReturn += m_weights.m_mapLengthByFirstChar.getScore(std::make_pair(first_char, length), score_index); nReturn += m_weights.m_mapLengthByLastChar.getScore(std::make_pair(last_char, length), score_index); } if (index>0) { nReturn += m_weights.m_mapSeparateChars.getScore(two_char, score_index); nReturn += m_weights.m_mapLastWordFirstChar.getScore(lastword_firstchar, score_index); nReturn += m_weights.m_mapCurrentWordLastChar.getScore(currentword_lastchar, score_index); nReturn += m_weights.m_mapFirstCharLastWordByWord.getScore(firstcharlastword_word, score_index); nReturn += m_weights.m_mapLastWordByLastChar.getScore(lastword_lastchar, score_index); nReturn += m_weights.m_mapLengthByLastWord.getScore(std::make_pair(last_word, length), score_index); nReturn += m_weights.m_mapLastLengthByWord.getScore(std::make_pair(word, last_length), score_index); } return nReturn; } /*--------------------------------------------------------------- * * updateScoreVector - update the score std::vector by input * this is used in training to adjust params * * Inputs: the outout and the correct examples * * Affects: m_bScoreModified, which leads to saveScores on destructor * *--------------------------------------------------------------*/ void CFeatureHandle::updateScoreVector(const CStringVector* outout, const CStringVector* correct, int round) { if ( *outout == *correct ) return; for (int i=0; i<outout->size(); ++i) updateLocalFeatureVector(eSubtract, outout, i, round); for (int j=0; j<correct->size(); ++j) updateLocalFeatureVector(eAdd, correct, j, round); m_bScoreModified = true; } /*--------------------------------------------------------------- * * updateLocalFeatureVector - update the given feature vector with * the local feature vector for a given * sentence. This is a private member only * used by updateGlobalFeatureVector and is * only used for training. * *--------------------------------------------------------------*/ void CFeatureHandle::updateLocalFeatureVector(SCORE_UPDATE method, const CStringVector* outout, int index, int round) { // abstd::cout words CWord word = outout->at(index); CWord last_word = index>0 ? outout->at(index-1) : g_emptyWord; CTwoWords two_word; two_word.allocate(word.str(), last_word.str()); CStringVector chars; chars.clear(); getCharactersFromUTF8String(word.str(), &chars); // abstd::cout length int length = getUTF8StringLength(word.str()); if (length > LENGTH_MAX-1) length = LENGTH_MAX-1; int last_length = getUTF8StringLength(last_word.str()); if (last_length > LENGTH_MAX-1) last_length = LENGTH_MAX-1; // abstd::cout chars CWord first_char = getFirstCharFromUTF8String(word.str()); CWord last_char = getLastCharFromUTF8String(word.str()); CWord first_char_last_word = index>0 ? getFirstCharFromUTF8String(last_word.str()) : g_emptyWord; CWord last_char_last_word = index>0 ? getLastCharFromUTF8String(last_word.str()) : g_emptyWord; CWord two_char = index>0 ? last_char_last_word.str() + first_char.str() : g_emptyWord; CTwoWords first_and_last_char, lastword_firstchar, currentword_lastchar, firstcharlastword_word, lastword_lastchar; first_and_last_char.allocate(first_char.str(), last_char.str()); if (index>0) { lastword_firstchar.allocate(last_word.str(), first_char.str()); currentword_lastchar.allocate(word.str(), last_char_last_word.str()); firstcharlastword_word.allocate(first_char_last_word.str(), first_char.str()); lastword_lastchar.allocate(last_char_last_word.str(), last_char.str()); } SCORE_TYPE amount = ( (method==eAdd) ? 1 : -1 ) ; m_weights.m_mapSeenWords.updateScore(word, amount, round); m_weights.m_mapLastWordByWord.updateScore(two_word, amount, round); if (length==1) m_weights.m_mapOneCharWord.updateScore(first_char, amount, round); else { m_weights.m_mapFirstAndLastChars.updateScore(first_and_last_char, amount, round); for (int j=0; j<chars.size()-1; j++) { m_weights.m_mapConsecutiveChars.updateScore(chars[j]+chars[j+1], amount, round); } m_weights.m_mapLengthByFirstChar.updateScore(std::make_pair(first_char, length), amount, round); m_weights.m_mapLengthByLastChar.updateScore(std::make_pair(last_char, length), amount, round); } if (index>0) { m_weights.m_mapSeparateChars.updateScore(two_char, amount, round); m_weights.m_mapLastWordFirstChar.updateScore(lastword_firstchar, amount, round); m_weights.m_mapCurrentWordLastChar.updateScore(currentword_lastchar, amount, round); m_weights.m_mapFirstCharLastWordByWord.updateScore(firstcharlastword_word, amount, round); m_weights.m_mapLastWordByLastChar.updateScore(lastword_lastchar, amount, round); m_weights.m_mapLengthByLastWord.updateScore(std::make_pair(last_word, length), amount, round); m_weights.m_mapLastLengthByWord.updateScore(std::make_pair(word, last_length), amount, round); } } /*=============================================================== * * CSegmentor - the segmentor for Chinese * *==============================================================*/ /*--------------------------------------------------------------- * * train - do automatic training process * [NOT USED] * *--------------------------------------------------------------*/ void CSegmentor::train(const CStringVector* sentence, const CStringVector* correct, int & round) { assert(1==0); // train by the configurable training algorithm } /*--------------------------------------------------------------- * * segment - do word segmentation on a sentence * *--------------------------------------------------------------*/ void CSegmentor::segment(const CStringVector* sentence_input, CStringVector *vReturn, double *out_scores, int nBest) { clock_t total_start_time = clock();; const CStateItem *pGenerator, *pCandidate; CStateItem tempState; unsigned index; // the index of the current char unsigned j, k; // temporary index int subtract_score; // the score to be subtracted (previous item) static CStateItem best_bigram; int start_index; int word_length; int generator_index; static CStringVector sentence; static CRule rules(m_Feature->m_bRule); rules.segment(sentence_input, &sentence); const unsigned length = sentence.size(); assert(length<MAX_SENTENCE_SIZE); assert(vReturn!=NULL); //clock_t start_time = clock(); TRACE("Initialising the segmentation process..."); vReturn->clear(); clearWordCache(); m_Chart.clear(); tempState.clear(); m_Chart[0]->insertItem(&tempState); TRACE("Segmenting started"); for (index=0; index<length; index++) { // m_Chart index 1 correspond to the first char m_Chart[index+1]; // control for the ending character of the candidate if ( index < length-1 && rules.canSeparate(index+1)==false ) continue ; start_index = index-1 ; // the end index of last word word_length = 1 ; // current word length // enumerating the start index // =========================== // the start index of the word is actually start_index + 1 while( start_index >= -1 && word_length <= MAX_WORD_SIZE ) { // control for the starting character of the candidate // --------------------------------------------------- while ( start_index >= 0 && rules.canSeparate(start_index+1)==false ) start_index-- ; // start the search process // ------------------------ for ( generator_index = 0 ; generator_index < m_Chart[ start_index+1 ]->size() ; ++ generator_index ) { pGenerator = m_Chart[ start_index+1 ]->item( generator_index ) ; tempState.copy( pGenerator ) ; tempState.append( index ) ; tempState.m_nScore += m_Feature->getLocalScore( &sentence, &tempState, tempState.m_nLength-1 ) ; if (nBest==1) { if ( generator_index == 0 || tempState.m_nScore > best_bigram.m_nScore ) { best_bigram.copy(&tempState); //@@@ } } else { m_Chart[ index+1 ]->insertItem( &tempState ); } } if (nBest==1) { m_Chart[ index+1 ]->insertItem( &best_bigram ); //@@@ } //@@@ // control the first character of the candidate if ( rules.canAppend(start_index+1)==false ) break ; // update start index and word len --start_index ; ++word_length ; }//start_index } // now generate outout sentence // n-best list will be stored in array // from the addr vReturn TRACE("Outputing sentence"); for (k=0; k<nBest; ++k) { // clear vReturn[k].clear(); if (out_scores!=NULL) out_scores[k] = 0; // assign retval if (k<m_Chart[length]->size()) { pGenerator = m_Chart[length]->bestItem(k); for (j=0; j<pGenerator->m_nLength; j++) { std::string temp = ""; for (unsigned l = pGenerator->getWordStart(j); l <= pGenerator->getWordEnd(j); ++l) { assert(sentence.at(l)!=" "); // [SPACE] temp += sentence.at(l); } vReturn[k].push_back(temp); } if (out_scores!=NULL) out_scores[k] = pGenerator->m_nScore; } } TRACE("Done, the best score: " << pGenerator->m_nScore); TRACE("total time spent: " << double(clock() - total_start_time)/CLOCKS_PER_SEC); }
[ "agit@southoftheclouds.net" ]
agit@southoftheclouds.net
abeac6127b691ec8c8ad320dfd25aacd9251a194
e16af72bb1f28d6f4ce0a0fe8bb03bea465f6486
/3.4/3.4.2/3.4.2/Line.cpp
269bc5ab90521cf27ff000c1d750b64fcb30044d
[]
no_license
tianyu-z/CPP_Programming_for_MFE
1c9c14fa6a6ffa25d50de27c167674b28669bf08
4391d288f4d03bee5284105c2b9e9f7285e6fb60
refs/heads/master
2020-12-04T00:54:19.221839
2020-01-03T09:00:55
2020-01-03T09:00:55
231,544,880
6
2
null
null
null
null
UTF-8
C++
false
false
1,970
cpp
//Purpose: The source file of Line //Author: Tianyu Zhang //Date: 06/12/18 #include <sstream> #include "Point.h" #include "Line.h" #include <cmath> using namespace std; //Line::Line() //{ // m_s = Point(0.0, 0.0); // m_e = Point(0.0, 0.0); //} Line::Line():Shape(),m_s(0,0),m_e(0,0) { } //Line::Line(const Line& line) //{ // m_s = line.m_s; // m_e = line.m_e; //} Line::Line(const Line &line):Shape(),m_s(line.m_s),m_e(line.m_e) { } //Line::Line(const Point& val1, const Point& val2) //{ // m_s = start; // m_e = end; //} Line::Line(Point start, Point end) : Shape(),m_s(start), m_e(end) { } Line::~Line() { } Point Line::P1() const { return m_s; } Point Line::P2() const { return m_e; } void Line::P1(const Point &newS) { m_s = newS; } void Line::P2(const Point &newE) { m_e = newE; } string Line::ToString() const { stringstream s0_string; s0_string << "Line:" << m_s.ToString() << "-" << m_e.ToString(); return s0_string.str(); } double Line::Length() { return m_s.Distance(m_e); } //If we regard lines as vectors in Cartesian coordinates, then -,*,+,*= are all applicable to lines. Line Line:: operator - () const // Negate the coordinates. { return Line(-m_s, -m_e); } Line Line:: operator * (double factor) const // Scale the coordinates. { return Line(m_s*factor, m_e*factor); } Line Line:: operator + (const Line& l) const // Add coordinates. { return Line(m_s + l.m_s, m_e + l.m_e); } bool Line:: operator == (const Line& l) const // Equally compare operator. { if (m_s == l.m_s&&m_e == l.m_e) { return true; } else { return false; } } Line& Line::operator = (const Line& source) // Assignment operator. { m_s = source.m_s; m_e = source.m_e; return *this; } Line& Line:: operator *= (double factor) // Scale the coordinates & assign. { m_s *= factor; m_e *= factor; return *this; } ostream& operator << (ostream& os, const Line& l) // Send to ostream { os << "Line:" << l.m_s << "-" << l.m_e << endl; return os; }
[ "tianyuzhang@outlook.com" ]
tianyuzhang@outlook.com
30e7f0ae3ca38a1014d1f7443b4c9a59fe36bfff
9d62896fb351ade6be2d27d823f6a8bd042f9a93
/ccc03s3.cpp
14faacee44f9397114f16f70561d858731e7ab73
[]
no_license
stevenbai0724/CCC-Solutions-
fc54b7b7bd5c0d6c6132ae9a9bed2f691b06ecb5
e6dc30bfe26f6f20e85fb9d5dac255bd9e5fb202
refs/heads/main
2023-07-11T05:00:45.626373
2021-08-24T18:58:00
2021-08-24T18:58:00
315,148,135
0
0
null
null
null
null
UTF-8
C++
false
false
1,941
cpp
#include <bits/stdc++.h> using namespace std; int main(){ cin.tie(nullptr)->sync_with_stdio(false); int f, n, m; cin>>f>>n>>m; vector<vector<char>>arr(n+1, vector<char>(m+1)); vector<vector<bool>>vis(n+1, vector<bool>(m+1)); vector<int>changeX{1,-1,0,0}; vector<int>changeY{0,0,-1,1}; queue<int>q; vector<int>roomSize; int sum =0; int ans = 0; for(int i =1;i<=n;i++){ string s; cin>>s; for(int j=1;j<=m;j++){ arr[i][j] = s[j-1]; } } for(int i =1;i<=n;i++){ for(int j=1;j<=m;j++){ if(arr[i][j]!='I' && !vis[i][j]){ int roomCount = 1; vis[i][j] = true; q.push(i*100+j); while(!q.empty()){ int x = q.front()/100; int y = q.front()%100; q.pop(); for(int k=0;k<4;k++){ int newx = x + changeX[k]; int newy = y + changeY[k]; if(newx>0 && newx<=n &&newy>0 && newy<=m){ if(!vis[newx][newy] && arr[newx][newy]!='I'){ vis[newx][newy] = true; roomCount++; q.push(newx*100+newy); } } } } sum+= roomCount; roomSize.push_back(roomCount); } } } sort(roomSize.begin(), roomSize.end(), greater<int>()); for(int i =0;i<roomSize.size();i++){ if(f-roomSize.at(i) <0) break; else if(f - roomSize.at(i)>=0){ ans ++; f -=roomSize.at(i); } } if(ans==1) cout<<"1 room, "<<f<<" square metre(s) left over"; else cout<<ans<<" rooms, "<<f<<" square metre(s) left over"; return 0; }
[ "noreply@github.com" ]
stevenbai0724.noreply@github.com
fe2cc8d97f446b2c73bc34030c1fe177e3dd63b0
4ad26968ff4256966992edb434570332b8cb5853
/HairChange/HairChange/boost/asio/detail/win_iocp_socket_recvmsg_op.hpp
cdacfecd22fed486d466cc6e6ee8a9e1f6edd188
[ "MIT" ]
permissive
daliborristic883/HairColorChange
582bcbe5dfd9f670438e1d770b8221c756929640
286ef0a8c89c4f63072ee8c8404178aac897cad5
refs/heads/master
2022-08-02T04:25:35.032365
2020-05-29T19:48:25
2020-05-29T19:48:25
267,933,189
19
4
null
null
null
null
UTF-8
C++
false
false
4,013
hpp
// // detail/win_iocp_socket_recvmsg_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #ifndef BOOST_ASIO_DETAIL_WIN_IOCP_SOCKET_RECVMSG_OP_HPP #define BOOST_ASIO_DETAIL_WIN_IOCP_SOCKET_RECVMSG_OP_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #if defined(BOOST_ASIO_HAS_IOCP) #include <boost/asio/detail/addressof.hpp> #include <boost/asio/detail/bind_handler.hpp> #include <boost/asio/detail/buffer_sequence_adapter.hpp> #include <boost/asio/detail/fenced_block.hpp> #include <boost/asio/detail/handler_alloc_helpers.hpp> #include <boost/asio/detail/handler_invoke_helpers.hpp> #include <boost/asio/detail/operation.hpp> #include <boost/asio/detail/socket_ops.hpp> #include <boost/asio/error.hpp> #include <boost/asio/socket_base.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { template <typename MutableBufferSequence, typename Handler> class win_iocp_socket_recvmsg_op : public operation { public: BOOST_ASIO_DEFINE_HANDLER_PTR(win_iocp_socket_recvmsg_op); win_iocp_socket_recvmsg_op( socket_ops::weak_cancel_token_type cancel_token, const MutableBufferSequence& buffers, socket_base::message_flags& out_flags, Handler& handler) : operation(&win_iocp_socket_recvmsg_op::do_complete), cancel_token_(cancel_token), buffers_(buffers), out_flags_(out_flags), handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } static void do_complete(io_service_impl* owner, operation* base, const boost::system::error_code& result_ec, std::size_t bytes_transferred) { boost::system::error_code ec(result_ec); // Take ownership of the operation object. win_iocp_socket_recvmsg_op* o( static_cast<win_iocp_socket_recvmsg_op*>(base)); ptr p = { boost::asio::detail::addressof(o->handler_), o, o }; BOOST_ASIO_HANDLER_COMPLETION((o)); #if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) // Check whether buffers are still valid. if (owner) { buffer_sequence_adapter<boost::asio::mutable_buffer, MutableBufferSequence>::validate(o->buffers_); } #endif // defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) socket_ops::complete_iocp_recvmsg(o->cancel_token_, ec); o->out_flags_ = 0; // Make a copy of the handler so that the memory can be deallocated before // the upcall is made. Even if we're not about to make an upcall, a // sub-object of the handler may be the true owner of the memory associated // with the handler. Consequently, a local copy of the handler is required // to ensure that any owning sub-object remains valid until after we have // deallocated the memory here. detail::binder2<Handler, boost::system::error_code, std::size_t> handler(o->handler_, ec, bytes_transferred); p.h = boost::asio::detail::addressof(handler.handler_); p.reset(); // Make the upcall if required. if (owner) { fenced_block b(fenced_block::half); BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); BOOST_ASIO_HANDLER_INVOCATION_END; } } private: socket_ops::weak_cancel_token_type cancel_token_; MutableBufferSequence buffers_; socket_base::message_flags& out_flags_; Handler handler_; }; } // namespace detail } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // defined(BOOST_ASIO_HAS_IOCP) #endif // BOOST_ASIO_DETAIL_WIN_IOCP_SOCKET_RECVMSG_OP_HPP
[ "daliborristic883@gmail.com" ]
daliborristic883@gmail.com
43e2df71c07cae82b6c6529a7461a45b4c948444
83921e08a63594fdeedcbe7866710b6f1a4c4d89
/main/Watchdog.cpp
33905c45f30ef09ac7f53a74af5d88795971fd01
[]
no_license
j3ven7/CurrentBikeCode
106accd21393af2c566740b1ff0c40a5477192f4
97e68a54524f8088ee62d00531f46ebdd488d2b3
refs/heads/master
2021-01-25T07:02:16.294395
2017-05-07T17:29:10
2017-05-07T17:29:10
null
0
0
null
null
null
null
UTF-8
C++
false
false
581
cpp
#include "Watchdog.h" void Watchdog::recordStartTime() { l_start = micros(); } void Watchdog::verifyEndTime() { l_diff = micros() - l_start; //Standardize the loop time by checking if it is currently less than the constant interval, if it is, add the differnce so the total loop time is standard if (l_diff < interval) { delayMicroseconds(interval - l_diff); } else { Serial.println("LOOP LENGTH WAS VIOLATED. LOOP TIME WAS: " + String(l_diff)); while (true) {} // cli(); //sleep_enable(); //sleep_cpu(); <Alternatives to while(true) } }
[ "kwf37@cornell.edu" ]
kwf37@cornell.edu
87555a590b7e0cc0a2622a756f766ad6dfd886f2
cc1add14dc392a4f082fc556200bb32194a536d6
/include/glm/gtx/compatibility.hpp
2bb74601dcf07a111a81c0c68ccc343d1624e738
[ "Apache-2.0" ]
permissive
Black-Photon/Tellas
31a072726f6d8821b1c8ae62f8ca3600bfc809c1
c5915f8c2cb92951635752c44f0ad3c81562223e
refs/heads/master
2020-05-05T04:19:13.501120
2020-02-23T03:42:29
2020-02-23T03:42:29
179,706,934
0
0
Apache-2.0
2019-07-05T13:37:51
2019-04-05T15:21:24
C
UTF-8
C++
false
false
14,990
hpp
/// @ref gtx_compatibility /// @file glm/gtx/compatibility.hpp /// /// @see core (dependence) /// /// @defgroup gtx_compatibility GLM_GTX_compatibility /// @ingroup gtx /// /// Include <glm/gtx/compatibility.hpp> to use the features of this extension. /// /// Provide functions to increase the compatibility with Cg and HLSL languages #pragma once // Dependency: #include "glm/glm.hpp" #include "../gtc/quaternion.hpp" #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) # ifndef GLM_ENABLE_EXPERIMENTAL # pragma message("GLM: GLM_GTX_compatibility is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.") # else # pragma message("GLM: GLM_GTX_compatibility extension included") # endif #endif #if GLM_COMPILER & GLM_COMPILER_VC # include <cfloat> #elif GLM_COMPILER & GLM_COMPILER_GCC # include <cmath> # if(GLM_PLATFORM & GLM_PLATFORM_ANDROID) # undef isfinite # endif #endif//GLM_COMPILER namespace glm { /// @addtogroup gtx_compatibility /// @{ template<typename T> GLM_FUNC_QUALIFIER T lerp(T x, T y, T a){return mix(x, y, a);} //!< \brief Returns x * (1.0 - a) + y * a, i.e., the linear blend of x and y using the floating-point value a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility) template<typename T, qualifier Q> GLM_FUNC_QUALIFIER vec<2, T, Q> lerp(const vec<2, T, Q>& x, const vec<2, T, Q>& y, T a){return mix(x, y, a);} //!< \brief Returns x * (1.0 - a) + y * a, i.e., the linear blend of x and y using the floating-point value a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility) template<typename T, qualifier Q> GLM_FUNC_QUALIFIER vec<3, T, Q> lerp(const vec<3, T, Q>& x, const vec<3, T, Q>& y, T a){return mix(x, y, a);} //!< \brief Returns x * (1.0 - a) + y * a, i.e., the linear blend of x and y using the floating-point value a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility) template<typename T, qualifier Q> GLM_FUNC_QUALIFIER vec<4, T, Q> lerp(const vec<4, T, Q>& x, const vec<4, T, Q>& y, T a){return mix(x, y, a);} //!< \brief Returns x * (1.0 - a) + y * a, i.e., the linear blend of x and y using the floating-point value a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility) template<typename T, qualifier Q> GLM_FUNC_QUALIFIER vec<2, T, Q> lerp(const vec<2, T, Q>& x, const vec<2, T, Q>& y, const vec<2, T, Q>& a){return mix(x, y, a);} //!< \brief Returns the component-wise result of x * (1.0 - a) + y * a, i.e., the linear blend of x and y using vector a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility) template<typename T, qualifier Q> GLM_FUNC_QUALIFIER vec<3, T, Q> lerp(const vec<3, T, Q>& x, const vec<3, T, Q>& y, const vec<3, T, Q>& a){return mix(x, y, a);} //!< \brief Returns the component-wise result of x * (1.0 - a) + y * a, i.e., the linear blend of x and y using vector a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility) template<typename T, qualifier Q> GLM_FUNC_QUALIFIER vec<4, T, Q> lerp(const vec<4, T, Q>& x, const vec<4, T, Q>& y, const vec<4, T, Q>& a){return mix(x, y, a);} //!< \brief Returns the component-wise result of x * (1.0 - a) + y * a, i.e., the linear blend of x and y using vector a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility) template<typename T, qualifier Q> GLM_FUNC_QUALIFIER T saturate(T x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility) template<typename T, qualifier Q> GLM_FUNC_QUALIFIER vec<2, T, Q> saturate(const vec<2, T, Q>& x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility) template<typename T, qualifier Q> GLM_FUNC_QUALIFIER vec<3, T, Q> saturate(const vec<3, T, Q>& x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility) template<typename T, qualifier Q> GLM_FUNC_QUALIFIER vec<4, T, Q> saturate(const vec<4, T, Q>& x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility) template<typename T, qualifier Q> GLM_FUNC_QUALIFIER T atan2(T x, T y){return atan(x, y);} //!< \brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility) template<typename T, qualifier Q> GLM_FUNC_QUALIFIER vec<2, T, Q> atan2(const vec<2, T, Q>& x, const vec<2, T, Q>& y){return atan(x, y);} //!< \brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility) template<typename T, qualifier Q> GLM_FUNC_QUALIFIER vec<3, T, Q> atan2(const vec<3, T, Q>& x, const vec<3, T, Q>& y){return atan(x, y);} //!< \brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility) template<typename T, qualifier Q> GLM_FUNC_QUALIFIER vec<4, T, Q> atan2(const vec<4, T, Q>& x, const vec<4, T, Q>& y){return atan(x, y);} //!< \brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility) template<typename genType> GLM_FUNC_DECL bool isfinite(genType const& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) template<typename T, qualifier Q> GLM_FUNC_DECL vec<1, bool, Q> isfinite(const vec<1, T, Q>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) template<typename T, qualifier Q> GLM_FUNC_DECL vec<2, bool, Q> isfinite(const vec<2, T, Q>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) template<typename T, qualifier Q> GLM_FUNC_DECL vec<3, bool, Q> isfinite(const vec<3, T, Q>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) template<typename T, qualifier Q> GLM_FUNC_DECL vec<4, bool, Q> isfinite(const vec<4, T, Q>& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) typedef bool bool1; //!< \brief boolean type with 1 component. (From GLM_GTX_compatibility extension) typedef vec<2, bool, highp> bool2; //!< \brief boolean type with 2 components. (From GLM_GTX_compatibility extension) typedef vec<3, bool, highp> bool3; //!< \brief boolean type with 3 components. (From GLM_GTX_compatibility extension) typedef vec<4, bool, highp> bool4; //!< \brief boolean type with 4 components. (From GLM_GTX_compatibility extension) typedef bool bool1x1; //!< \brief boolean matrix with 1 x 1 component. (From GLM_GTX_compatibility extension) typedef mat<2, 2, bool, highp> bool2x2; //!< \brief boolean matrix with 2 x 2 components. (From GLM_GTX_compatibility extension) typedef mat<2, 3, bool, highp> bool2x3; //!< \brief boolean matrix with 2 x 3 components. (From GLM_GTX_compatibility extension) typedef mat<2, 4, bool, highp> bool2x4; //!< \brief boolean matrix with 2 x 4 components. (From GLM_GTX_compatibility extension) typedef mat<3, 2, bool, highp> bool3x2; //!< \brief boolean matrix with 3 x 2 components. (From GLM_GTX_compatibility extension) typedef mat<3, 3, bool, highp> bool3x3; //!< \brief boolean matrix with 3 x 3 components. (From GLM_GTX_compatibility extension) typedef mat<3, 4, bool, highp> bool3x4; //!< \brief boolean matrix with 3 x 4 components. (From GLM_GTX_compatibility extension) typedef mat<4, 2, bool, highp> bool4x2; //!< \brief boolean matrix with 4 x 2 components. (From GLM_GTX_compatibility extension) typedef mat<4, 3, bool, highp> bool4x3; //!< \brief boolean matrix with 4 x 3 components. (From GLM_GTX_compatibility extension) typedef mat<4, 4, bool, highp> bool4x4; //!< \brief boolean matrix with 4 x 4 components. (From GLM_GTX_compatibility extension) typedef int int1; //!< \brief integer vector with 1 component. (From GLM_GTX_compatibility extension) typedef vec<2, int, highp> int2; //!< \brief integer vector with 2 components. (From GLM_GTX_compatibility extension) typedef vec<3, int, highp> int3; //!< \brief integer vector with 3 components. (From GLM_GTX_compatibility extension) typedef vec<4, int, highp> int4; //!< \brief integer vector with 4 components. (From GLM_GTX_compatibility extension) typedef int int1x1; //!< \brief integer matrix with 1 component. (From GLM_GTX_compatibility extension) typedef mat<2, 2, int, highp> int2x2; //!< \brief integer matrix with 2 x 2 components. (From GLM_GTX_compatibility extension) typedef mat<2, 3, int, highp> int2x3; //!< \brief integer matrix with 2 x 3 components. (From GLM_GTX_compatibility extension) typedef mat<2, 4, int, highp> int2x4; //!< \brief integer matrix with 2 x 4 components. (From GLM_GTX_compatibility extension) typedef mat<3, 2, int, highp> int3x2; //!< \brief integer matrix with 3 x 2 components. (From GLM_GTX_compatibility extension) typedef mat<3, 3, int, highp> int3x3; //!< \brief integer matrix with 3 x 3 components. (From GLM_GTX_compatibility extension) typedef mat<3, 4, int, highp> int3x4; //!< \brief integer matrix with 3 x 4 components. (From GLM_GTX_compatibility extension) typedef mat<4, 2, int, highp> int4x2; //!< \brief integer matrix with 4 x 2 components. (From GLM_GTX_compatibility extension) typedef mat<4, 3, int, highp> int4x3; //!< \brief integer matrix with 4 x 3 components. (From GLM_GTX_compatibility extension) typedef mat<4, 4, int, highp> int4x4; //!< \brief integer matrix with 4 x 4 components. (From GLM_GTX_compatibility extension) typedef float float1; //!< \brief single-qualifier floating-point vector with 1 component. (From GLM_GTX_compatibility extension) typedef vec<2, float, highp> float2; //!< \brief single-qualifier floating-point vector with 2 components. (From GLM_GTX_compatibility extension) typedef vec<3, float, highp> float3; //!< \brief single-qualifier floating-point vector with 3 components. (From GLM_GTX_compatibility extension) typedef vec<4, float, highp> float4; //!< \brief single-qualifier floating-point vector with 4 components. (From GLM_GTX_compatibility extension) typedef float float1x1; //!< \brief single-qualifier floating-point matrix with 1 component. (From GLM_GTX_compatibility extension) typedef mat<2, 2, float, highp> float2x2; //!< \brief single-qualifier floating-point matrix with 2 x 2 components. (From GLM_GTX_compatibility extension) typedef mat<2, 3, float, highp> float2x3; //!< \brief single-qualifier floating-point matrix with 2 x 3 components. (From GLM_GTX_compatibility extension) typedef mat<2, 4, float, highp> float2x4; //!< \brief single-qualifier floating-point matrix with 2 x 4 components. (From GLM_GTX_compatibility extension) typedef mat<3, 2, float, highp> float3x2; //!< \brief single-qualifier floating-point matrix with 3 x 2 components. (From GLM_GTX_compatibility extension) typedef mat<3, 3, float, highp> float3x3; //!< \brief single-qualifier floating-point matrix with 3 x 3 components. (From GLM_GTX_compatibility extension) typedef mat<3, 4, float, highp> float3x4; //!< \brief single-qualifier floating-point matrix with 3 x 4 components. (From GLM_GTX_compatibility extension) typedef mat<4, 2, float, highp> float4x2; //!< \brief single-qualifier floating-point matrix with 4 x 2 components. (From GLM_GTX_compatibility extension) typedef mat<4, 3, float, highp> float4x3; //!< \brief single-qualifier floating-point matrix with 4 x 3 components. (From GLM_GTX_compatibility extension) typedef mat<4, 4, float, highp> float4x4; //!< \brief single-qualifier floating-point matrix with 4 x 4 components. (From GLM_GTX_compatibility extension) typedef double double1; //!< \brief double-qualifier floating-point vector with 1 component. (From GLM_GTX_compatibility extension) typedef vec<2, double, highp> double2; //!< \brief double-qualifier floating-point vector with 2 components. (From GLM_GTX_compatibility extension) typedef vec<3, double, highp> double3; //!< \brief double-qualifier floating-point vector with 3 components. (From GLM_GTX_compatibility extension) typedef vec<4, double, highp> double4; //!< \brief double-qualifier floating-point vector with 4 components. (From GLM_GTX_compatibility extension) typedef double double1x1; //!< \brief double-qualifier floating-point matrix with 1 component. (From GLM_GTX_compatibility extension) typedef mat<2, 2, double, highp> double2x2; //!< \brief double-qualifier floating-point matrix with 2 x 2 components. (From GLM_GTX_compatibility extension) typedef mat<2, 3, double, highp> double2x3; //!< \brief double-qualifier floating-point matrix with 2 x 3 components. (From GLM_GTX_compatibility extension) typedef mat<2, 4, double, highp> double2x4; //!< \brief double-qualifier floating-point matrix with 2 x 4 components. (From GLM_GTX_compatibility extension) typedef mat<3, 2, double, highp> double3x2; //!< \brief double-qualifier floating-point matrix with 3 x 2 components. (From GLM_GTX_compatibility extension) typedef mat<3, 3, double, highp> double3x3; //!< \brief double-qualifier floating-point matrix with 3 x 3 components. (From GLM_GTX_compatibility extension) typedef mat<3, 4, double, highp> double3x4; //!< \brief double-qualifier floating-point matrix with 3 x 4 components. (From GLM_GTX_compatibility extension) typedef mat<4, 2, double, highp> double4x2; //!< \brief double-qualifier floating-point matrix with 4 x 2 components. (From GLM_GTX_compatibility extension) typedef mat<4, 3, double, highp> double4x3; //!< \brief double-qualifier floating-point matrix with 4 x 3 components. (From GLM_GTX_compatibility extension) typedef mat<4, 4, double, highp> double4x4; //!< \brief double-qualifier floating-point matrix with 4 x 4 components. (From GLM_GTX_compatibility extension) /// @} }//namespace glm #include "compatibility.inl"
[ "joseph_keane@live.co.uk" ]
joseph_keane@live.co.uk
4c8e11143f50f72caf3377d63b4917d3ca237ce0
ad47bc852e986b442e7040bb18bb7d6c13bf8d96
/URI/1068URI.cpp
54b2c66b61902017aa1e291550fe47fe803132ba
[]
no_license
iurisevero/Exercicios-PPC
bb94288ce33d72e7b69d00dc0d916cbf649f214f
a3d021ee87fe42dc5d8456d69c2c86867a9d4708
refs/heads/master
2023-07-23T13:43:20.718442
2023-07-12T23:31:50
2023-07-12T23:31:50
189,654,966
0
0
null
2019-10-02T21:07:28
2019-05-31T20:32:10
C++
UTF-8
C++
false
false
374
cpp
#include <bits/stdc++.h> using namespace std; int main(){ string expressao; while(cin >> expressao){ int correto=0; for(int i=0; i< expressao.size(); ++i){ if(expressao[i]=='(') correto++; if(expressao[i]==')') correto--; if(correto<0) break; } if(!correto) cout << "correct\n"; else cout << "incorrect\n"; } return 0; }
[ "noreply@github.com" ]
iurisevero.noreply@github.com
a26827b2ff207984dcec412d67bd7db20d3aa01d
244ec5370d56748826d672ee50fd2056feaf5f29
/Patient.hpp
4657b1d94038dd57b7acf94bb1d758c2977e7e93
[]
no_license
werd0n4/hospital-simulation
100d1bcc421ed2706b6876da66609472d19c8e73
0766f91f8444d0036094a61111144df302c8e826
refs/heads/master
2022-12-03T23:53:19.543835
2020-08-20T19:38:42
2020-08-20T19:38:42
277,548,092
0
0
null
null
null
null
UTF-8
C++
false
false
1,010
hpp
#pragma once #include "Rehabilitation.hpp" #include "Examination.hpp" #include "Reception.hpp" #include "OperatingRoom.hpp" extern std::mutex refresh_mtx; extern bool running; class Rehabilitation; class Reception; class Patient{ private: int time; const int y_max = getmaxy(stdscr); const int x_max = getmaxx(stdscr); const int win_height = 3; const int win_width = x_max/4; std::string status; WINDOW* status_window; std::vector<Examination>& exams; OperatingRoom& operating_room; Rehabilitation& rehab_room; Reception& reception; public: int id; int bed_id; Patient(int _id, std::vector<Examination>&, OperatingRoom&, Rehabilitation&, Reception&); void draw(); void clear_status_window(); void change_status(const std::string&); void registration(); void go_for_exam(); void undergo_surgery(); void rehabilitation(); void discharge(); void treatment(); bool operator==(const Patient&); };
[ "filipgajewski4@gmail.com" ]
filipgajewski4@gmail.com
d2d2fcc9b2b899a01c85086685f848532242d15b
5e124a2960591ac485359a52aeb7fef445d3116f
/JEngine/src/Platform/Windows/WindowsInput.h
726e0ba573d9aa1d2fc700559d4fde4ab7c77cff
[ "Apache-2.0" ]
permissive
peter-819/JEngine
858605202e9dd46fce2d1012674944fc86a97b7f
f4362cdaa5e781e3a973cf84b604bd055b1b3880
refs/heads/master
2021-02-28T06:40:32.231003
2020-04-24T14:22:31
2020-04-24T14:22:31
245,671,074
1
0
null
null
null
null
UTF-8
C++
false
false
417
h
#pragma once #include "JEngine/Core/core.h" #include "JEngine/Core/Input.h" namespace JEngine { class WindowsInput : public Input { protected: virtual bool IsKeyPressedImpl(int keycode) override; virtual bool IsMouseButtonPressedImpl(int button) override; virtual std::pair<float, float> GetMousePosImpl() override; virtual float GetMouseXImpl() override; virtual float GetMouseYImpl() override; }; }
[ "peter-819@outlook.com" ]
peter-819@outlook.com
e30d5bc4774ed18ef3fbf8c935eae8cf4214f29b
da5c9b96d42cc280e3866c6fc242c7f85bc891f7
/Source/Alimer/Base/HashMap.h
57c3ca6c30f39ca5efd57cf34e80ee077d3fd3fd
[ "MIT", "Zlib" ]
permissive
parhelia512/alimer
641699a65f07f5810527b1ae3785ea5d43b751bf
b46c8b7bdbf11f2f6305a10d5372dbc61b595ab1
refs/heads/master
2020-03-15T04:22:04.540043
2018-05-02T18:46:15
2018-05-02T18:46:15
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,454
h
// // Alimer is based on the Turso3D codebase. // Copyright (c) 2018 Amer Koleci and contributors. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #pragma once #include "../PlatformDef.h" #include <memory> #include <unordered_map> namespace Alimer { using Hash = uint64_t; struct UnityHasher { inline size_t operator()(uint64_t hash) const { return hash; } }; template <typename T> using HashMap = std::unordered_map<Hash, T, UnityHasher>; class Hasher { public: template <typename T> inline void Data(const T *data, size_t size) { size /= sizeof(*data); for (size_t i = 0; i < size; i++) { _value = (_value * 0x100000001b3ull) ^ data[i]; } } inline void UInt32(uint32_t value) { _value = (_value * 0x100000001b3ull) ^ value; } inline void SInt32(int32_t value) { UInt32(uint32_t(value)); } inline void Float(float value) { union { float f32; uint32_t u32; } u; u.f32 = value; UInt32(u.u32); } inline void UInt64(uint64_t value) { UInt32(value & 0xffffffffu); UInt32(value >> 32); } inline void Pointer(const void *ptr) { UInt64(reinterpret_cast<uintptr_t>(ptr)); } inline void String(const char *str) { char c; while ((c = *str++) != '\0') { UInt32(uint8_t(c)); } } inline Hash GetValue() const { return _value; } private: Hash _value = 0xcbf29ce484222325ull; }; }
[ "amerkoleci@gmail.com" ]
amerkoleci@gmail.com
395c4ec946fb09eff53dec58593cb0a0cb74e86d
d31aed88f751ec8f9dd0a51ea215dba4577b5a9b
/plugins/core/landscape_model/sources/ai/ai_goals/lm_defend_goal.hpp
f36cc4879b428b572316d1834f33b1e3875398d9
[]
no_license
valeriyr/Hedgehog
56a4f186286608140f0e4ce5ef962e9a10b123a8
c045f262ca036570416c793f589ba1650223edd9
refs/heads/master
2016-09-05T20:00:51.747169
2015-09-04T05:21:38
2015-09-04T05:21:38
3,336,071
0
0
null
null
null
null
UTF-8
C++
false
false
1,338
hpp
#ifndef __LM_DEFEND_GOAL_HPP__ #define __LM_DEFEND_GOAL_HPP__ /*---------------------------------------------------------------------------*/ #include "landscape_model/sources/ai/ai_goals/lm_igoal.hpp" /*---------------------------------------------------------------------------*/ namespace Plugins { namespace Core { namespace LandscapeModel { /*---------------------------------------------------------------------------*/ class DefendGoal : public Tools::Core::BaseWrapper< IGoal > { /*---------------------------------------------------------------------------*/ public: /*---------------------------------------------------------------------------*/ DefendGoal(); ~DefendGoal(); /*---------------------------------------------------------------------------*/ /*virtual*/ bool process(); /*---------------------------------------------------------------------------*/ private: /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ }; /*---------------------------------------------------------------------------*/ } // namespace LandscapeModel } // namespace Core } // namespace Plugins /*---------------------------------------------------------------------------*/ #endif // __LM_DEFEND_GOAL_HPP__
[ "valeriy.reutov@gmail.com" ]
valeriy.reutov@gmail.com
56643f1230a0ad45729dd5da76647b383938c62e
61c9cc83c6950382acbde8efb87ad4fd7d23db96
/graph_trans/load.cpp
4c352477d3a8129ec4568338369f967447e0a5c4
[]
no_license
MangoMaster/graph_theory
704607beb4a12d7900256ed665c673cb8fa15a26
f0b305ec5ef54e19c52250e727c9527bfc356ba5
refs/heads/master
2020-03-14T15:22:18.491985
2018-05-26T12:54:22
2018-05-26T12:54:22
null
0
0
null
null
null
null
UTF-8
C++
false
false
653
cpp
#include <iostream> #include <fstream> #include "func.h" using namespace std; void graph_trans::load() { ifstream fin; fin.open(inputfilename); if (!fin.is_open()) { cout << "error: input file is not properly open." << endl; return; } fin >> n; weight_matrix.resize(n); for (int i = 0; i < n; i++) { weight_matrix[i].reserve(n); } int temp; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { fin >> temp; weight_matrix[i].push_back(temp); if (temp != 0) m++; } } fin.close(); }
[ "weijd17@mails.tsinghua.edu.cn" ]
weijd17@mails.tsinghua.edu.cn
08a970b0822c32f4e494e5a5742837cd538528b7
5ec1b9ba37db5ff57a18627f946ec47ca36955ec
/include/285Z_Subsystems/pid.hpp
39863b27a17d1e06323aa64f062e9e17a9b931eb
[]
no_license
AmmaarK/285zTT4
288f023c8e40e72be19156cde523f5acce47420e
b6fbc055dbe3a499eb28a09d9347101953fb2d9c
refs/heads/master
2023-07-27T15:57:30.605914
2021-09-06T19:35:14
2021-09-06T19:35:14
257,171,971
0
0
null
null
null
null
UTF-8
C++
false
false
204
hpp
#pragma once #include "main.h" #include "../include/285z/initRobot.hpp" #define RELATIVE 0 #define ABSOLUTE 1 extern double kP; extern double kI; extern double kD; void calibrate(); void turn(double);
[ "ekintiu@gmail.com" ]
ekintiu@gmail.com
f67ac8d44ac127dd3694d3e394eefa98e0e63086
1b006ab86f764f8b13c1a63bb4e04eac28271f7b
/Peasant/PeasantHolder.h
ea7bd5c6f31fa8e60e03a9e7b2300d8af6b22555
[ "MIT" ]
permissive
RodrigoHolztrattner/Peasant
f710a57729e46d0619641d83cde563a4c95ea9f7
b614aa94ed94bfaa6fbec6d81f64ba105ca9324d
refs/heads/master
2020-03-07T15:02:56.169688
2018-09-06T14:38:03
2018-09-06T14:38:03
127,543,406
0
0
null
null
null
null
UTF-8
C++
false
false
1,302
h
//////////////////////////////////////////////////////////////////////////////// // Filename: PeasantHolder.h //////////////////////////////////////////////////////////////////////////////// #pragma once ////////////// // INCLUDES // ////////////// #include "PeasantConfig.h" #include "PeasantObject.h" #include <cstdint> #include <vector> #include <atomic> /////////////// // NAMESPACE // /////////////// ///////////// // DEFINES // ///////////// //////////// // GLOBAL // //////////// /////////////// // NAMESPACE // /////////////// // Peasant PeasantDevelopmentNamespaceBegin(Peasant) ////////////// // TYPEDEFS // ////////////// //////////////// // FORWARDING // //////////////// //////////////////////////////////////////////////////////////////////////////// // Class name: PeasantHolder //////////////////////////////////////////////////////////////////////////////// class PeasantHolder { public: ////////////////// // CONSTRUCTORS // public: ////////// // Constructor / destructor PeasantHolder(PeasantObject* _object); virtual ~PeasantHolder(); ////////////////// // MAIN METHODS // public: ////////// /////////////// // VARIABLES // private: ////// // The object we are referencing PeasantObject* m_ReferenceObject; }; // Peasant PeasantDevelopmentNamespaceEnd(Peasant)
[ "rodrigoholztrattner@gmail.com" ]
rodrigoholztrattner@gmail.com
863a3fd852c268a5811896ecccc206d5e47b4c15
2ad7f978210e0a4b090dd5bbb7739069d39c59bd
/RM6623-arduino-library/RM6623.h
b97bf153c914153b8c3e8b369314f4ac9e17dd27
[]
no_license
BGD-Libraries/RM-Libraries
780450897c9ff8214fb96ac9f7d86d61ee2df92c
b3a78094ae5773316e1864a6de7c6c180bcae986
refs/heads/master
2021-07-04T11:13:20.936077
2017-09-27T01:20:41
2017-09-27T01:20:41
104,956,070
0
0
null
null
null
null
UTF-8
C++
false
false
955
h
#ifndef _RM6623_H_ #define _RM6623_H_ #include <stdint.h> #if defined(ARDUINO)&&ARDUINO>=100 #include "Arduino.h" #else #include "WProgram.h" #endif class RM6623_ { public: RM6623_(); void pack(uint8_t *tx_data,int16_t yaw,int16_t pitch,int16_t roll); bool unpack(uint32_t ID,uint8_t len,uint8_t *rx_data); uint16_t encoder (uint32_t ID); double angle (uint32_t ID); int16_t real_current(uint32_t ID); int16_t set_current (uint32_t ID); uint8_t hall (uint32_t ID); const uint32_t yaw_ID =0x205; const uint32_t pitch_ID =0x206; const uint32_t roll_ID =0x207; const uint32_t tx_ID =0x1ff; private: typedef union { struct { unsigned encoder:16; int real_current:16; int set_current:16; unsigned hall:8; }; unsigned char buf[8]; }RM6623_rx_data; RM6623_rx_data _Pitch; RM6623_rx_data _Roll; RM6623_rx_data _Yaw; }; extern RM6623_ RM6623; #endif
[ "158964215@qq.com" ]
158964215@qq.com
d9fd14fd1f3d3a8331b79f8371ee316ee839a341
7e762e9dda12e72f96718ef7bec81bca85f3937a
/TowerOfBabylon.cpp
e436d0aa5da179a93018846bb44a64aa602a12f7
[]
no_license
ShravanCool/spoj-classical
b9bd563a28523ad8d626c867f54646d839302ce9
448bf7745c65f6552fb00b32a827044bd1528925
refs/heads/master
2020-05-31T06:48:59.737307
2019-03-30T16:46:07
2019-03-30T16:46:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,673
cpp
#include <iostream> #include <algorithm> #include <vector> using namespace std; struct Box { int L, B, H; }; int findMaxStackHt(vector<Box>& arr); bool myComp(Box a, Box b) { return a.L*a.B > b.L*b.B; } int main() { while(true) { int N; cin >> N; if(N == 0) break; vector<Box> arr(N); for(int i = 0; i < N; i++) cin >> arr[i].H >> arr[i].B >> arr[i].L; int ans = findMaxStackHt(arr); cout << ans << endl; } return 0; } int findMaxStackHt(vector<Box>& arr) { vector<Box> possibleRotations; for(int i = 0; i < arr.size(); i++) { Box aBox = arr[i]; possibleRotations.push_back(aBox); aBox.H = arr[i].B; aBox.L = std::max(arr[i].H, arr[i].L); aBox.B = std::min(arr[i].H, arr[i].L); possibleRotations.push_back(aBox); aBox.H = arr[i].L; aBox.L = std::max(arr[i].B, arr[i].H); aBox.B = std::min(arr[i].B, arr[i].H); possibleRotations.push_back(aBox); } std::sort(possibleRotations.begin(), possibleRotations.end(), myComp); vector<int> msh(possibleRotations.size()); for(int i = 0; i < msh.size(); i++) msh[i] = possibleRotations[i].H; for(int i = 1; i < msh.size(); i++) { for(int j = 0; j < i; j++) { if(((possibleRotations[i].B < possibleRotations[j].B && possibleRotations[i].L < possibleRotations[j].L)|| (possibleRotations[j].L > possibleRotations[i].B && possibleRotations[j].B > possibleRotations[i].L)) && msh[i] < msh[j] + possibleRotations[i].H) msh[i] = msh[j] + possibleRotations[i].H; } } int ans = -1; for(int i = 0; i < msh.size(); i++) ans = std::max(msh[i], ans); return ans; }
[ "rohankanojia420@gmail.com" ]
rohankanojia420@gmail.com
828513e14e1a79c7d306549a5d0c6aa9d69b6763
196fc6d52f1aece28818b85daefed7777b999099
/GUI/Ape/mainwindow.h
facd647757da272e0ea556e4a508a6a9c51411fa
[]
no_license
sehwan72/Ape
f29b11f8b29c6280f97a02889d84bb86c1abd1d0
0429daffed2d58665e064033373ea56ffa270cf7
refs/heads/master
2021-01-10T04:57:09.319444
2013-04-17T06:35:50
2013-04-17T06:35:50
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,975
h
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <sstream> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "../../src/Ape.h" #include "../../src/Process.h" #include "../../src/Sys.h" #include <QTimer> #include <QMenu> #include <QMessageBox> #include <QTableWidget> #include <QString> #include <condition_variable> #include <filesinusedialog.h> #include <aboutdialog.h> #include <math.h> #include <time.h> #include <asm/param.h> #include <QPropertyAnimation> #include <QShortcut> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); int addLine(Process *, int); Ape *ape; void clearTable(); private: Ui::MainWindow *ui; const char* itoa(int); QTimer *timer; SortBy sortSetting; bool sortReverse; void myUIInit(); void colorRows(); int getParentRow(int); Process *getProcessAtRow(int); Process *currentProcess; unsigned int currentPID; void setCurrentProcess(Process *); void resetCurrentProcess(); void showFilesInUse(); FilesInUseDialog filesInUseList; AboutDialog aboutApe; void showSysInfo(); void updateInfoTab(); void updateMemoryMap(); QPropertyAnimation *cmdFrame; QShortcut *cmdShortcut; void updateStatusBar(char* message = "No process selected"); protected: void closeEvent(QCloseEvent *); private slots: void updateUI(); void showProcessContextMenu(const QPoint&); void sortTable(int); void doubleClicked(QTableWidgetItem *); void toggleCmd(); void handleMenuBar(QAction*); void on_sigkillButton_clicked(); void on_memmapButton_clicked(); void on_sigintButton_clicked(); void on_sigtermButton_clicked(); void on_sigstopButton_clicked(); void on_sendsigButton_clicked(); void on_coredumpButton_clicked(); }; #endif // MAINWINDOW_H
[ "sehwan@2112-Ubuntu.(none)" ]
sehwan@2112-Ubuntu.(none)
efbeb3fae3b2bcc119f504d79c7e1d0692a32c46
d0c44dd3da2ef8c0ff835982a437946cbf4d2940
/cmake-build-debug/programs_tiling/function14552/function14552_schedule_45/function14552_schedule_45.cpp
f79ca16a477f7cd1d0f048ba702fafc65e89cead
[]
no_license
IsraMekki/tiramisu_code_generator
8b3f1d63cff62ba9f5242c019058d5a3119184a3
5a259d8e244af452e5301126683fa4320c2047a3
refs/heads/master
2020-04-29T17:27:57.987172
2019-04-23T16:50:32
2019-04-23T16:50:32
176,297,755
1
2
null
null
null
null
UTF-8
C++
false
false
1,687
cpp
#include <tiramisu/tiramisu.h> using namespace tiramisu; int main(int argc, char **argv){ tiramisu::init("function14552_schedule_45"); constant c0("c0", 128), c1("c1", 64), c2("c2", 128), c3("c3", 64); var i0("i0", 0, c0), i1("i1", 0, c1), i2("i2", 0, c2), i3("i3", 0, c3), i01("i01"), i02("i02"), i03("i03"), i04("i04"), i05("i05"), i06("i06"); input input00("input00", {i3}, p_int32); input input01("input01", {i0, i1}, p_int32); input input02("input02", {i0, i1, i2}, p_int32); input input03("input03", {i1}, p_int32); input input04("input04", {i3}, p_int32); input input05("input05", {i3}, p_int32); computation comp0("comp0", {i0, i1, i2, i3}, input00(i3) * input01(i0, i1) * input02(i0, i1, i2) + input03(i1) * input04(i3) + input05(i3)); comp0.tile(i0, i1, i2, 128, 64, 32, i01, i02, i03, i04, i05, i06); comp0.parallelize(i01); buffer buf00("buf00", {64}, p_int32, a_input); buffer buf01("buf01", {128, 64}, p_int32, a_input); buffer buf02("buf02", {128, 64, 128}, p_int32, a_input); buffer buf03("buf03", {64}, p_int32, a_input); buffer buf04("buf04", {64}, p_int32, a_input); buffer buf05("buf05", {64}, p_int32, a_input); buffer buf0("buf0", {128, 64, 128, 64}, p_int32, a_output); input00.store_in(&buf00); input01.store_in(&buf01); input02.store_in(&buf02); input03.store_in(&buf03); input04.store_in(&buf04); input05.store_in(&buf05); comp0.store_in(&buf0); tiramisu::codegen({&buf00, &buf01, &buf02, &buf03, &buf04, &buf05, &buf0}, "../data/programs/function14552/function14552_schedule_45/function14552_schedule_45.o"); return 0; }
[ "ei_mekki@esi.dz" ]
ei_mekki@esi.dz
9e43893d4a513c77ea6e089a4015839a201416a3
dd80a584130ef1a0333429ba76c1cee0eb40df73
/external/clang/include/clang/Basic/OpenMPKinds.h
5b4573124f21fe153d0f2c53b2bc433e86ececbe
[ "MIT", "NCSA" ]
permissive
karunmatharu/Android-4.4-Pay-by-Data
466f4e169ede13c5835424c78e8c30ce58f885c1
fcb778e92d4aad525ef7a995660580f948d40bc9
refs/heads/master
2021-03-24T13:33:01.721868
2017-02-18T17:48:49
2017-02-18T17:48:49
81,847,777
0
2
MIT
2020-03-09T00:02:12
2017-02-13T16:47:00
null
UTF-8
C++
false
false
1,809
h
//===--- OpenMPKinds.h - OpenMP enums ---------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines some OpenMP-specific enums and functions. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_OPENMPKINDS_H #define LLVM_CLANG_BASIC_OPENMPKINDS_H #include "llvm/ADT/StringRef.h" namespace clang { /// \brief OpenMP directives. enum OpenMPDirectiveKind { OMPD_unknown = 0, #define OPENMP_DIRECTIVE(Name) \ OMPD_##Name, #include "clang/Basic/OpenMPKinds.def" NUM_OPENMP_DIRECTIVES }; /// \brief OpenMP clauses. enum OpenMPClauseKind { OMPC_unknown = 0, #define OPENMP_CLAUSE(Name, Class) \ OMPC_##Name, #include "clang/Basic/OpenMPKinds.def" OMPC_threadprivate, NUM_OPENMP_CLAUSES }; /// \brief OpenMP attributes for 'default' clause. enum OpenMPDefaultClauseKind { OMPC_DEFAULT_unknown = 0, #define OPENMP_DEFAULT_KIND(Name) \ OMPC_DEFAULT_##Name, #include "clang/Basic/OpenMPKinds.def" NUM_OPENMP_DEFAULT_KINDS }; OpenMPDirectiveKind getOpenMPDirectiveKind(llvm::StringRef Str); const char *getOpenMPDirectiveName(OpenMPDirectiveKind Kind); OpenMPClauseKind getOpenMPClauseKind(llvm::StringRef Str); const char *getOpenMPClauseName(OpenMPClauseKind Kind); unsigned getOpenMPSimpleClauseType(OpenMPClauseKind Kind, llvm::StringRef Str); const char *getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, unsigned Type); bool isAllowedClauseForDirective(OpenMPDirectiveKind DKind, OpenMPClauseKind CKind); } #endif
[ "karun.matharu@gmail.com" ]
karun.matharu@gmail.com
aca87c97c4dcfcdb407febebae091c907e7b5d4b
ab25ea8270a860865a11dee70ef4ba351e8fd11a
/musicalkeyboard.ino
126528228a31a13557becf6f516df97129accc5a
[]
no_license
nic-tang/musical_instrument
a72af1d9d51e071d0c537039df74d1f6d82757fc
128c45dede879daacf5646ad68dd8285bd538cb9
refs/heads/master
2020-08-12T09:17:53.466124
2019-10-13T00:46:29
2019-10-13T00:46:29
214,737,569
0
0
null
null
null
null
UTF-8
C++
false
false
404
ino
int notes[] = {262, 294, 330, 349}; void setup() { Serial.begin(9600); } void loop() { int keyVal = analogRead(A0); Serial.println(keyVal); if(keyVal == 1023){ tone(8, notes[0]); } else if(keyVal >=990 && keyVal <= 1010) { tone(8, notes[1]); } else if(keyVal >=505 && keyVal <= 515){ tone(8, notes[2]); } else if(keyVal >= 5 && keyVal <= 10) { tone(8, notes[3]); } else{ noTone(8); } }
[ "noreply@github.com" ]
nic-tang.noreply@github.com
35e9edfd72c52c8d0b764e4671173e01e16e1663
8bfe95d68a3527854faa64a7a954b9b8a9948624
/assignment-4/include/global/promise.h
f6bb1438286d3fd808c68e4993323c0e1ae4c9f9
[ "Apache-2.0" ]
permissive
lherman-cs/cs4160
9b670a76e70510ebf9bfdcd40aca987e7cbbf3e0
abcc582e59f139ba8d8e74600ee028f321b308fd
refs/heads/master
2020-04-16T12:30:50.710928
2019-05-01T05:53:19
2019-05-01T05:53:19
165,582,495
2
0
null
null
null
null
UTF-8
C++
false
false
986
h
#pragma once #include <cstdint> #include <functional> #include <list> #include <memory> #include <queue> #include "core/interface.h" class Engine; class Global; class Promise : public std::enable_shared_from_this<Promise> { private: friend class PromiseScheduler; // return true if resolved using Action = std::function<bool()>; std::queue<Action> actions; Uint32 elapsed = 0; // return false if there's no more actions bool next(Uint32 ticks); Promise() : actions() {} public: Promise(const Promise&) = delete; Promise& operator=(const Promise&) = delete; Promise& then(Action); Promise& sleep(uint32_t ms); }; class PromiseScheduler { private: friend class Engine; friend class Global; std::list<std::shared_ptr<Promise>> promises; PromiseScheduler() : promises() {} void update(Uint32 ticks); public: PromiseScheduler(const PromiseScheduler&) = delete; PromiseScheduler& operator=(const PromiseScheduler&) = delete; Promise& add(); };
[ "lherman.cs@gmail.com" ]
lherman.cs@gmail.com
25975d8aebd927c5ec2b13d325d11ce20eeb9850
439d28f761c1774f759fdf720c14ab2108bb93b8
/Programming.in.th/11/1154.cpp
36dcb5e6719720007bbc2017867e835d5de785ee
[]
no_license
Chomtana/cptraining
19fec94cd489c6117f49bd6d80642d60079276f1
df380badd952dceb335525f03373738c35aa0b3a
refs/heads/master
2021-01-09T20:53:24.758998
2020-04-11T04:10:48
2020-04-11T04:10:48
56,289,132
0
0
null
null
null
null
UTF-8
C++
false
false
1,372
cpp
#include <bits/stdc++.h> #define for1(a,b,c) for(int (a)=(b);(a)<(c);(a)++) #define for2(i,a,b) for(int (i)=(a);((a)<=(b)?(i)<=(b):(i)>=(b));(i)+=((a)<=(b)?1:-1)) #define until(x) while(!(x)) #define all(x) x.begin(),x.end() #define mp make_pair #define subfunc(ret,name,args) function<ret args> name; name = [&] args #define hk 53 using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> pii; typedef vector<int> vi; int n,m; char data[15005]; bool check(int k) { if (k==0) return true; unordered_map<ll,int> c(1000000); ll h = 0; ll powmax = 1; for1(i,0,k) { h *= hk; h += data[i]-'a'; if (i>0) powmax *= hk; } c[h]++; //cerr<<h<<endl; //cerr<<"bbb "<<n<<endl; for1(i,1,n-k+1) { //cerr<<"aaa "<<i<<endl; h -= (data[i-1]-'a')*powmax; h *= hk; h += data[i+k-1]-'a'; c[h]++; //cerr<<h<<endl; } for(auto p:c) { if (p.second>=m) return true; } return false; } int main() { //ios::sync_with_stdio(false); cout<<fixed; cin>>n>>m; cin.ignore(); gets(data); int l = 0;int r = n; while (l<=r) { int mid = (l+r)/2; if (check(mid)) { l = mid+1; } else { r = mid-1; } } //cerr<<check(0)<<endl; cout<<l-1; return 0; }
[ "Chomtana001@gmail.com" ]
Chomtana001@gmail.com
d33307fae3a2d12dfd1f3b91cd57e8b31cf9bede
34a3a975a3a3c2e0c096d1dc948b0b7fa32d0c8b
/sorting algorithms/merge_sort.cpp
c5e54ee833ab2dc0f66f927eda6d2112d4e435e1
[]
no_license
andreox/algds
bac4fb97a577b130d9a782ad4c6ca6af1c2c9261
70c3ba46c0a1aeb29237a5a8a90842e9eea14d49
refs/heads/master
2022-02-07T22:15:43.456450
2022-02-05T17:27:17
2022-02-05T17:27:17
80,754,983
1
0
null
2022-01-23T22:39:43
2017-02-02T18:23:17
C++
UTF-8
C++
false
false
1,201
cpp
#include <iostream> #include <vector> using namespace std ; void merge( vector<int> &A , int p, int q, int r ) { int i,j ; int n1 = q - p + 1 ; int n2 = r - q ; vector<int> L ; vector<int> R ; for ( i = 0 ; i < n1 ; i++ ) { L.push_back(A[p+i]) ; } for ( j = 0 ; j < n2 ; j++ ) { R.push_back(A[q+j+1]) ; } i = 0 ; j = 0 ; int k ; for ( k = p ; k < r && i < n1 && j < n2 ; k++ ) { if ( L[i] <= R[j] ) { A[k] = L[i] ; i++ ; } else { A[k] = R[j] ; j++ ; } } //sentinella while (i < n1) { A[k] = L[i]; i++; k++; } while (j < n2) { A[k] = R[j]; j++; k++; } } void merge_sort( vector<int> &A, int p, int r) { if ( p < r ) { int q = (p+(r-1))/2 ; merge_sort( A, p, q) ; merge_sort( A, q+1, r) ; merge( A, p, q, r) ; } } int main( int argc, char** argv ) { vector<int> A ; A.push_back(7); A.push_back(5); A.push_back(4); A.push_back(2); A.push_back(6); A.push_back(3); A.push_back(2); A.push_back(1); int p = 0 ; int r = A.size() ; merge_sort( A, p, r-1 ) ; for ( int i = 0 ; i < A.size() ; i++ ) cout << A[i] << " " ; cout << endl ; return 0 ; }
[ "andreozzi.alessio@gmail.com" ]
andreozzi.alessio@gmail.com
b798be61ddb49955434da1bf182051f5099bc559
a964826c7d71c0b417157c3f56fced2936a17082
/Attic/ClockworkEditorReference/Source/UI/Modal/UINewProject.cpp
8e8d4096e9ffa66a962e347b8c98e9b43a17aca1
[ "LicenseRef-scancode-unknown-license-reference", "MIT", "LicenseRef-scancode-openssl", "BSD-3-Clause", "NTP", "BSL-1.0", "LicenseRef-scancode-khronos", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "Zlib" ]
permissive
gitter-badger/Clockwork
c95bcfc2066a11e2fcad0329a79cb69f0e7da4b5
ec489a090697fc8b0dc692c3466df352ee722a6b
refs/heads/master
2020-12-28T07:46:24.514590
2016-04-11T00:51:14
2016-04-11T00:51:14
55,931,507
0
0
null
2016-04-11T01:09:48
2016-04-11T01:09:48
null
UTF-8
C++
false
false
4,863
cpp
// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved // Please see LICENSE.md in repository root for license information // https://github.com/ClockworkGameEngine/ClockworkGameEngine #include "ClockworkEditor.h" #include <TurboBadger/tb_window.h> #include <TurboBadger/tb_select.h> #include <TurboBadger/tb_editfield.h> #include <Clockwork/Core/Context.h> #include <Clockwork/UI/UI.h> #include "License/CELicenseSystem.h" #include "Resources/CEResourceOps.h" #include "CEPreferences.h" #include "CEEditor.h" #include "CEEvents.h" #include "Project/CEProject.h" #include "Project/ProjectUtils.h" #include "UINewProject.h" namespace ClockworkEditor { UINewProject::UINewProject(Context* context): UIModalOpWindow(context) { Editor* editor = GetSubsystem<Editor>(); Project* project = editor->GetProject(); UI* tbui = GetSubsystem<UI>(); window_->SetText("Project Type"); tbui->LoadResourceFile(window_->GetContentRoot(), "ClockworkEditor/editor/ui/newproject.tb.txt"); window_->ResizeToFitContent(); Center(); } UINewProject::~UINewProject() { } bool UINewProject::Create2DProject(const String& projectPath, const String& filename) { FileSystem* fileSystem = GetSubsystem<FileSystem>(); #ifdef CLOCKWORK_PLATFORM_OSX String templateSourceDir = fileSystem->GetAppBundleResourceFolder(); #else String templateSourceDir = fileSystem->GetProgramDir(); #endif templateSourceDir += "/ProjectTemplates/Project2D"; fileSystem->CopyDir(templateSourceDir + "/Resources", projectPath + "/Resources"); File file(context_, projectPath + "/" + filename + ".clockwork", FILE_WRITE); file.Close(); return true; } bool UINewProject::CreateEmptyProject(const String& projectPath, const String &filename) { FileSystem* fileSystem = GetSubsystem<FileSystem>(); #ifdef CLOCKWORK_PLATFORM_OSX String templateSourceDir = fileSystem->GetAppBundleResourceFolder(); #else String templateSourceDir = fileSystem->GetProgramDir(); #endif templateSourceDir += "/ProjectTemplates/EmptyProject"; fileSystem->CopyDir(templateSourceDir + "/Resources", projectPath + "/Resources"); File file(context_, projectPath + "/" + filename + ".clockwork", FILE_WRITE); file.Close(); return true; } bool UINewProject::Create3DProject(const String& projectPath, const String &filename) { FileSystem* fileSystem = GetSubsystem<FileSystem>(); #ifdef CLOCKWORK_PLATFORM_OSX String templateSourceDir = fileSystem->GetAppBundleResourceFolder(); #else String templateSourceDir = fileSystem->GetProgramDir(); #endif templateSourceDir += "/ProjectTemplates/Project3D"; fileSystem->CopyDir(templateSourceDir + "/Resources", projectPath + "/Resources"); File file(context_, projectPath + "/" + filename + ".clockwork", FILE_WRITE); file.Close(); return true; } bool UINewProject::OnEvent(const TBWidgetEvent &ev) { Editor* editor = GetSubsystem<Editor>(); UIModalOps* ops = GetSubsystem<UIModalOps>(); if (ev.type == EVENT_TYPE_CLICK) { if (ev.target->GetID() == TBIDC("cancel")) { ops->Hide(); return true; } int projectType = -1; if (ev.target->GetID() == TBIDC("project_empty")) { projectType = 0; } else if (ev.target->GetID() == TBIDC("project_2d")) { projectType = 1; } else if (ev.target->GetID() == TBIDC("project_3d")) { // BEGIN LICENSE MANAGEMENT LicenseSystem* licenseSystem = GetSubsystem<LicenseSystem>(); if (licenseSystem->IsStandardLicense()) { SharedPtr<UINewProject> keepAlive(this); UIModalOps* ops = GetSubsystem<UIModalOps>(); ops->Hide(); ops->ShowInfoModule3D(); return true; } // END LICENSE MANAGEMENT projectType = 2; } if (projectType != -1) { FileSystem* fileSystem = GetSubsystem<FileSystem>(); #ifdef CLOCKWORK_PLATFORM_OSX String templateSourceDir = fileSystem->GetAppBundleResourceFolder(); #else String templateSourceDir = fileSystem->GetProgramDir(); #endif if (projectType == 0) templateSourceDir += "/ProjectTemplates/EmptyProject"; else if (projectType == 1) templateSourceDir += "/ProjectTemplates/Project2D"; else templateSourceDir += "/ProjectTemplates/Project3D"; SharedPtr<UINewProject> keepAlive(this); UIModalOps* ops = GetSubsystem<UIModalOps>(); ops->Hide(); ops->ShowCreateProject(templateSourceDir); return true; } } return false; } }
[ "dragonCASTjosh@gmail.com" ]
dragonCASTjosh@gmail.com
69f7268ac934dfe5cd8efdbe910a8b1267281d3f
dd80a584130ef1a0333429ba76c1cee0eb40df73
/external/chromium/net/base/net_test_suite.h
98c5bd511e49c49d721e1b5d89d8e892307b10b1
[ "MIT", "BSD-3-Clause" ]
permissive
karunmatharu/Android-4.4-Pay-by-Data
466f4e169ede13c5835424c78e8c30ce58f885c1
fcb778e92d4aad525ef7a995660580f948d40bc9
refs/heads/master
2021-03-24T13:33:01.721868
2017-02-18T17:48:49
2017-02-18T17:48:49
81,847,777
0
2
MIT
2020-03-09T00:02:12
2017-02-13T16:47:00
null
UTF-8
C++
false
false
1,244
h
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef NET_BASE_NET_TEST_SUITE_H_ #define NET_BASE_NET_TEST_SUITE_H_ #pragma once #include "base/memory/ref_counted.h" #include "base/test/test_suite.h" #include "build/build_config.h" #include "net/base/mock_host_resolver.h" class MessageLoop; namespace net { class NetworkChangeNotifier; } class NetTestSuite : public base::TestSuite { public: NetTestSuite(int argc, char** argv); virtual ~NetTestSuite(); virtual void Initialize(); virtual void Shutdown(); protected: // Called from within Initialize(), but separate so that derived classes // can initialize the NetTestSuite instance only and not // TestSuite::Initialize(). TestSuite::Initialize() performs some global // initialization that can only be done once. void InitializeTestThread(); private: scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; scoped_ptr<MessageLoop> message_loop_; scoped_refptr<net::RuleBasedHostResolverProc> host_resolver_proc_; net::ScopedDefaultHostResolverProc scoped_host_resolver_proc_; }; #endif // NET_BASE_NET_TEST_SUITE_H_
[ "karun.matharu@gmail.com" ]
karun.matharu@gmail.com
a3aea96e98dd1637e3d3b1566cf20ecf88f3313a
62331e1c4760fd204665e1e0f772eab97e88cfbb
/Code/include/eventScaler.h
589ed22df0e8af2fddc15cd2f7a96613ba86374b
[]
no_license
systrauss/Dissertation
180941d56418acbc1c313c4ada5483ed373ba221
3e1713cd3d51239900e6700102dab6ad78726b7d
refs/heads/master
2020-04-29T18:27:04.025699
2020-04-15T14:04:37
2020-04-15T14:04:37
176,324,565
0
0
null
null
null
null
UTF-8
C++
false
false
433
h
#ifndef EVENTSCALER_H #define EVENTSCALER_H #define NUM_OF_SCALER_CH 26 #include "TObject.h" class eventScaler : public TObject { public: UShort_t scalerStartTime; UShort_t scalerEndTime; UShort_t scalers[NUM_OF_SCALER_CH]; eventScaler(); void Reset(); void SetEndTime(unsigned int time); void SetStartTime(unsigned int time); void SetValue(int channel, unsigned int value); ClassDef(eventScaler,1) }; #endif
[ "sstrauss@nd.edu" ]
sstrauss@nd.edu
9f1aa514517a4d397f2038ec3a7d8f9c439cc1b8
24f26275ffcd9324998d7570ea9fda82578eeb9e
/third_party/blink/renderer/controller/user_level_memory_pressure_signal_generator.cc
c970967893109cc7d5df0219c785c1545211e437
[ "BSD-3-Clause", "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.1-only", "GPL-2.0-only", "LGPL-2.0-only", "BSD-2-Clause", "LicenseRef-scancode-other-copyleft" ]
permissive
Vizionnation/chromenohistory
70a51193c8538d7b995000a1b2a654e70603040f
146feeb85985a6835f4b8826ad67be9195455402
refs/heads/master
2022-12-15T07:02:54.461083
2019-10-25T15:07:06
2019-10-25T15:07:06
217,557,501
2
1
BSD-3-Clause
2022-11-19T06:53:07
2019-10-25T14:58:54
null
UTF-8
C++
false
false
5,883
cc
// Copyright 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "third_party/blink/renderer/controller/user_level_memory_pressure_signal_generator.h" #include <limits> #include "base/memory/memory_pressure_listener.h" #include "base/metrics/field_trial_params.h" #include "base/metrics/histogram_macros.h" #include "base/system/sys_info.h" #include "base/time/default_tick_clock.h" #include "third_party/blink/public/common/features.h" #include "third_party/blink/renderer/platform/bindings/v8_per_isolate_data.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" #include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h" #include "third_party/blink/renderer/platform/wtf/allocator/partitions.h" namespace blink { namespace { constexpr double kDefaultMemoryThresholdMB = std::numeric_limits<double>::infinity(); constexpr base::FeatureParam<double> k512MBDeviceMemoryThresholdParam{ &blink::features::kUserLevelMemoryPressureSignal, "param_512mb_device_memory_threshold_mb", kDefaultMemoryThresholdMB}; constexpr base::FeatureParam<double> k1GBDeviceMemoryThresholdParam{ &blink::features::kUserLevelMemoryPressureSignal, "param_1gb_device_memory_threshold_mb", kDefaultMemoryThresholdMB}; constexpr base::FeatureParam<double> k2GBDeviceMemoryThresholdParam{ &blink::features::kUserLevelMemoryPressureSignal, "param_2gb_device_memory_threshold_mb", kDefaultMemoryThresholdMB}; constexpr base::FeatureParam<double> k3GBDeviceMemoryThresholdParam{ &blink::features::kUserLevelMemoryPressureSignal, "param_3gb_device_memory_threshold_mb", kDefaultMemoryThresholdMB}; constexpr base::FeatureParam<double> k4GBDeviceMemoryThresholdParam{ &blink::features::kUserLevelMemoryPressureSignal, "param_4gb_device_memory_threshold_mb", kDefaultMemoryThresholdMB}; // Minimum time interval between generated memory pressure signals. constexpr double kDefaultMinimumIntervalSeconds = 10 * 60; constexpr base::FeatureParam<double> kMinimumIntervalSeconds{ &blink::features::kUserLevelMemoryPressureSignal, "minimum_interval_s", kDefaultMinimumIntervalSeconds}; } // namespace // static UserLevelMemoryPressureSignalGenerator& UserLevelMemoryPressureSignalGenerator::Instance() { DEFINE_STATIC_LOCAL(UserLevelMemoryPressureSignalGenerator, generator, ()); return generator; } UserLevelMemoryPressureSignalGenerator::UserLevelMemoryPressureSignalGenerator() : delayed_report_timer_( Thread::MainThread()->GetTaskRunner(), this, &UserLevelMemoryPressureSignalGenerator::OnTimerFired), clock_(base::DefaultTickClock::GetInstance()) { int64_t physical_memory = base::SysInfo::AmountOfPhysicalMemory(); if (physical_memory > 3.1 * 1024 * 1024 * 1024) memory_threshold_mb_ = k4GBDeviceMemoryThresholdParam.Get(); else if (physical_memory > 2.1 * 1024 * 1024 * 1024) memory_threshold_mb_ = k3GBDeviceMemoryThresholdParam.Get(); else if (physical_memory > 1.1 * 1024 * 1024 * 1024) memory_threshold_mb_ = k2GBDeviceMemoryThresholdParam.Get(); else if (physical_memory > 600 * 1024 * 1024) memory_threshold_mb_ = k1GBDeviceMemoryThresholdParam.Get(); else memory_threshold_mb_ = k512MBDeviceMemoryThresholdParam.Get(); minimum_interval_ = base::TimeDelta::FromSeconds(kMinimumIntervalSeconds.Get()); // Can be disabled for certain device classes by setting the field param to an // empty string. bool enabled = base::FeatureList::IsEnabled( blink::features::kUserLevelMemoryPressureSignal) && !std::isinf(memory_threshold_mb_); if (enabled) { monitoring_ = true; MemoryUsageMonitor::Instance().AddObserver(this); ThreadScheduler::Current()->AddRAILModeObserver(this); } } UserLevelMemoryPressureSignalGenerator:: ~UserLevelMemoryPressureSignalGenerator() { MemoryUsageMonitor::Instance().RemoveObserver(this); ThreadScheduler::Current()->RemoveRAILModeObserver(this); } void UserLevelMemoryPressureSignalGenerator::SetTickClockForTesting( const base::TickClock* clock) { clock_ = clock; } void UserLevelMemoryPressureSignalGenerator::OnRAILModeChanged( RAILMode rail_mode) { is_loading_ = rail_mode == RAILMode::kLoad; } void UserLevelMemoryPressureSignalGenerator::OnMemoryPing(MemoryUsage usage) { // Disabled during loading as we don't want to purge caches that has just been // created. if (is_loading_) return; if (usage.private_footprint_bytes / 1024 / 1024 < memory_threshold_mb_) return; base::TimeDelta elapsed = clock_->NowTicks() - last_generated_; if (elapsed >= base::TimeDelta::FromSeconds(kMinimumIntervalSeconds.Get())) Generate(usage); } void UserLevelMemoryPressureSignalGenerator::Generate(MemoryUsage usage) { UMA_HISTOGRAM_MEMORY_LARGE_MB( "Memory.Experimental.UserLevelMemoryPressureSignal." "RendererPrivateMemoryFootprintBefore", base::saturated_cast<base::Histogram::Sample>( usage.private_footprint_bytes / 1024 / 1024)); base::MemoryPressureListener::NotifyMemoryPressure( base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL); last_generated_ = clock_->NowTicks(); delayed_report_timer_.StartOneShot(base::TimeDelta::FromSeconds(10), FROM_HERE); } void UserLevelMemoryPressureSignalGenerator::OnTimerFired(TimerBase*) { MemoryUsage usage = MemoryUsageMonitor::Instance().GetCurrentMemoryUsage(); UMA_HISTOGRAM_MEMORY_LARGE_MB( "Memory.Experimental.UserLevelMemoryPressureSignal." "RendererPrivateMemoryFootprintAfter", base::saturated_cast<base::Histogram::Sample>( usage.private_footprint_bytes / 1024 / 1024)); } } // namespace blink
[ "rjkroege@chromium.org" ]
rjkroege@chromium.org