blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
2
247
content_id
stringlengths
40
40
detected_licenses
listlengths
0
57
license_type
stringclasses
2 values
repo_name
stringlengths
4
111
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
58
visit_date
timestamp[ns]date
2015-07-25 18:16:41
2023-09-06 10:45:08
revision_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
committer_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
github_id
int64
3.89k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
25 values
gha_event_created_at
timestamp[ns]date
2012-06-07 00:51:45
2023-09-14 21:58:52
gha_created_at
timestamp[ns]date
2008-03-27 23:40:48
2023-08-24 19:49:39
gha_language
stringclasses
159 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
10.5M
extension
stringclasses
111 values
filename
stringlengths
1
195
text
stringlengths
7
10.5M
38e42e311e3560ad1a63218bb4877251da8cc206
c9f2355d56fc130dbd591a7faa026a81d4cf22a3
/snippets/04-serial-out.ino
eb4234805d35b44b9f40efc603b6fc3d2b9a4133
[]
no_license
dubkov/arduinolabs-lyceum
f7d1d731d555a623ecee2c461c0cd07528196624
6aab01a5c1da9da830a7fca605cb731db080d827
refs/heads/master
2016-08-04T19:19:58.804667
2015-03-15T17:26:57
2015-03-15T17:26:57
30,665,368
8
14
null
null
null
null
UTF-8
C++
false
false
1,619
ino
04-serial-out.ino
/* * Сниппет: 01-blink.ino * Назначение: показывает вывод информации в терминал на ПК * Автор: Илья Дубков */ void setup(){ // Инициализируем последовательное соединение // на скорости 19200 бод. Эта скорость должна // соответствовать той, что вы выставили в терминале // в правом нижнем углу. Serial.begin(19200); } // Объявим переменную, значение которой будет выводиться // в терминал. int value = 0; void loop(){ // Выведем текст "value = " без переноса строки. Serial.print("value = "); // Выведем на той же строке значение нашей переменной, // после чего выполним перенос строки. От предыдущей // строки это отличается наличием символов ln в названии // метода. Serial.println(value); // Увеличим нашу переменную на один. Перед запуском // попробуйте догадаться, что произойдет, когда value // достигнет максимального значения, которое может содержать // тип int? value++; // Выполним задержку, чтобы данные не вываливались // в терминал слишком часто. delay(100); }
54fc83247b8205b88c6b634a5b2efb6ee1d75e46
0ad1250716e633d1472ae862eb87558f6000852e
/src/typedefine.h
64726ef125e5c26f234ff5a00ccb45e548c3faa5
[]
no_license
AuCson/Shanghai-Taxi-Analysis
dfe27407bf287bdb13c86b78d44d59564d01bddd
79ee55e015cdf8cbd5587358e9847b9d36849380
refs/heads/master
2021-01-11T22:37:42.808612
2017-01-15T05:36:45
2017-01-15T05:36:45
79,001,137
0
1
null
null
null
null
UTF-8
C++
false
false
2,791
h
typedefine.h
#pragma once #ifndef _GUARD_TYPEDEFINE_H #define _GUARD_TYPEDEFINE_H #include <vector> #include <string> #include <iostream> #include "RTree.h" using namespace std; #define LATITUDE x #define LONGTITUDE y struct Point { Point(){} bool operator == (const Point&b) { return x == b.x && y == b.y; } Point(double x_, double y_) :x(x_), y(y_){} double x; double y; }; struct Point3 { double x; double y; double t; }; struct Time { Time() :day(0),hour(0),min(0),sec(0){} Time(int d, int h, int m, int s) :day(d), hour(h), min(m), sec(s){} Time(int h, int m, int s) :hour(h), min(m), sec(s){ day = 0; } void operator += (const Time & a) { hour += a.hour; min += a.min; sec += a.sec; if (sec >= 60) { sec -= 60; min++; } if (min >= 60) { min -= 60; hour++; } if (hour >= 24) { hour -= 24; day++; } } void operator -= (const Time & a) { hour -= a.hour; min -= a.min; sec -= a.sec; if (sec < 0) { sec += 60; min--; } if (min < 0) { min += 60; hour--; } if (hour<0) { hour += 24; day--; } } int day; int hour; int min; int sec; }; struct Mappointdata { Mappointdata(){} Mappointdata(double x_, double y_) :x(x_), y(y_){} double x; double y; int id; vector<Point> edge; }; typedef Mappointdata* MAPDATA; struct Maproaddata { Point start; Point end; }; typedef Maproaddata* ROADDATA; struct TimePoint { TimePoint(){} TimePoint(double x_, double y_, int hour_, int min_, int sec_) :x(x_), y(y_){ time.day = 0; time.hour = hour_; time.min = min_; time.sec = sec_; } double x; double y; Time time; }; struct Point_info_withstr { Point_info_withstr():ismainpoint(0){} int ismainpoint; double x; double y; double dis; char str[1000]; char tag[100]; }; struct Taxiinoff { int id; Point pt; Time time; char tag[100]; }; class Taxi { public: Taxi():totaldist(0),profit(0){}; Taxi(int id_, int moneysum_ = 0):id(id_),moneysum(moneysum_),totaldist(0),profit(0){} int id; int moneysum; int posx; int posy; int notempty; double profit; double totaldist; void profitcalc(); void write_profit_log(FILE* wp); void write_takeoff_log(FILE* wp); vector<TimePoint> startpoint; vector<TimePoint> endpoint; vector<double> dist; }; struct Taxiquery { int taxiid; Time time; Point onroadsrc; Point vsrca; Point vsrcb; Point onroaddst; Point vdsta; Point vdstb; }; struct Featurepointdata { Point a; Point b; double sec; union { double speed; double delay; }; }; typedef RTree<Maproaddata*, double, 2> RTREE_WITH_ROAD; typedef RTree<Mappointdata*, double, 2> RTREE_WITH_POINT; typedef RTree<Featurepointdata*, double, 3> RTREE_WITH_FEA; #endif
15cd54ec1a139d5e25500dec0e53a919dd664c7c
711f9c743c8eddbe018decfcf4f27acebe641294
/hellomap3/Nuti.framework/Versions/A/Headers/utils/GeomUtils.h
1275f0ee04ef71cb616cde4c384121fd1dcf0e68
[ "BSD-2-Clause" ]
permissive
nutiteq/hellomap3d-ios
bb35b6599360b74357339f300a5b94e293bec9d3
b9b6e8a2f756937fb5f15538c560cff1115688c3
refs/heads/master
2020-04-12T02:22:51.387210
2016-12-23T14:27:13
2016-12-23T14:27:13
21,323,638
15
9
null
2016-11-28T10:11:06
2014-06-29T13:20:51
C
UTF-8
C++
false
false
1,661
h
GeomUtils.h
/* * Copyright 2014 Nutiteq Llc. All rights reserved. * Copying and using this code is allowed only according * to license terms, as given in https://www.nutiteq.com/license/ */ #ifndef _NUTI_GEOMUTILS_H_ #define _NUTI_GEOMUTILS_H_ #include <vector> namespace Nuti { class MapBounds; class MapPos; class MapVec; class GeomUtils { public: static bool IsConvexPolygonClockwise(const std::vector<MapPos>& polygon); static bool IsConcavePolygonClockwise(const std::vector<MapPos>& polygon); static bool PointInsidePolygon(const std::vector<MapPos>& polygon, const MapPos& point); static MapPos CalculatePointInsidePolygon(const std::vector<MapPos>& polygon, const std::vector<std::vector<MapPos> >& holes); static MapPos CalculatePointOnLine(const std::vector<MapPos>& line); static bool PolygonsIntersect(const std::vector<MapPos>& polygon1, const std::vector<MapPos>& polygon2); static std::vector<MapPos> CalculateConvexHull(std::vector<MapPos> points); static bool RayTriangleIntersect(const MapPos& rayOrig, const MapVec& rayDir, const MapPos& triPoint0, const MapPos& triPoint1, const MapPos& triPoint2, MapPos& result); static bool RayBoundingBoxIntersect(const MapPos& rayOrig, const MapVec& rayDir, const MapBounds& bbox); private: GeomUtils(); static bool LexicalComparator(const MapPos& mapPos1, const MapPos& mapPos2); static bool PointsInsidePolygonEdges(const std::vector<MapPos>& polygon, const std::vector<MapPos>& points); }; } #endif
b0a55b834cc5d948089e67bb9e2fc53b2e1430b3
cb7ac15343e3b38303334f060cf658e87946c951
/source/runtime/core/Private/IO/IoDispatcherPrivate.h
14ba2ed637835ae1ab65fcee42a61f349035442d
[]
no_license
523793658/Air2.0
ac07e33273454442936ce2174010ecd287888757
9e04d3729a9ce1ee214b58c2296188ec8bf69057
refs/heads/master
2021-11-10T16:08:51.077092
2021-11-04T13:11:59
2021-11-04T13:11:59
178,317,006
1
0
null
null
null
null
UTF-8
C++
false
false
1,382
h
IoDispatcherPrivate.h
// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "IO/IoDispatcher.h" #ifndef PLATFORM_IMPLEMENTS_IO #define PLATFORM_IMPLEMENTS_IO 0 #endif #if PLATFORM_IMPLEMENTS_IO #include COMPILED_PLATFORM_HEADER(PlatformIoDispatcher.h) #else #include "GenericPlatform/GenericPlatformIoDispatcher.h" typedef FGenericIoDispatcherEventQueue FIoDispatcherEventQueue; typedef FGenericFileIoStoreImpl FFileIoStoreImpl; #endif class FIoRequestImpl; enum EIoStoreResolveResult { IoStoreResolveResult_OK, IoStoreResolveResult_NotFound, }; class FIoBatchImpl { public: TFunction<void()> Callback; FEvent* Event = nullptr; FGraphEventRef GraphEvent; TAtomic<uint32> UnfinishedRequestsCount{ 0 }; }; class FIoRequestImpl { public: FIoRequestImpl(FIoDispatcherImpl& InDispatcher) : Dispatcher(InDispatcher) { } void AddRef() { RefCount.IncrementExchange(); } void ReleaseRef() { if (RefCount.DecrementExchange() == 1) { FreeRequest(); } } FIoDispatcherImpl& Dispatcher; FIoBatchImpl* Batch = nullptr; FIoRequestImpl* NextRequest = nullptr; FIoChunkId ChunkId; FIoReadOptions Options; FIoBuffer IoBuffer; FIoReadCallback Callback; uint32 UnfinishedReadsCount = 0; int32 Priority = 0; TAtomic<EIoErrorCode> ErrorCode{ EIoErrorCode::Unknown }; bool bFailed = false; private: void FreeRequest(); TAtomic<uint32> RefCount{ 0 }; };
976d486eb2c38be353dd9f640ea77e902098e265
740fdf1cca74bdb8f930a7907a48f9bdd9b5fbd3
/base/memory/discardable_memory_unittest.cc
fb1eba65d611422c315c06d9496eee38b554f8bf
[ "BSD-3-Clause" ]
permissive
hefen1/chromium
a1384249e2bb7669df189235a1ff49ac11fc5790
52f0b6830e000ca7c5e9aa19488af85be792cc88
refs/heads/master
2016-09-05T18:20:24.971432
2015-03-23T14:53:29
2015-03-23T14:53:29
32,579,801
0
2
null
null
null
null
UTF-8
C++
false
false
4,039
cc
discardable_memory_unittest.cc
// Copyright (c) 2013 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 "base/memory/discardable_memory.h" #include <algorithm> #include "testing/gtest/include/gtest/gtest.h" #if defined(OS_ANDROID) #include <limits> #endif namespace base { namespace { class DiscardableMemoryTest : public testing::TestWithParam<DiscardableMemoryType> { public: DiscardableMemoryTest() {} virtual ~DiscardableMemoryTest() { } protected: scoped_ptr<DiscardableMemory> CreateLockedMemory(size_t size) { return DiscardableMemory::CreateLockedMemoryWithType( GetParam(), size).Pass(); } }; const size_t kSize = 1024; TEST_P(DiscardableMemoryTest, IsNamed) { std::string type_name(DiscardableMemory::GetTypeName(GetParam())); EXPECT_NE("unknown", type_name); EXPECT_EQ(GetParam(), DiscardableMemory::GetNamedType(type_name)); } bool IsNativeType(DiscardableMemoryType type) { return type == DISCARDABLE_MEMORY_TYPE_ASHMEM || type == DISCARDABLE_MEMORY_TYPE_MACH; } TEST_P(DiscardableMemoryTest, SupportedNatively) { std::vector<DiscardableMemoryType> supported_types; DiscardableMemory::GetSupportedTypes(&supported_types); #if defined(DISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY) EXPECT_NE(0, std::count_if(supported_types.begin(), supported_types.end(), IsNativeType)); #else // If we ever have a platform that decides at runtime if it can support // discardable memory natively, then we'll have to add a 'never supported // natively' define for this case. At present, if it's not always supported // natively, it's never supported. EXPECT_EQ(0, std::count_if(supported_types.begin(), supported_types.end(), IsNativeType)); #endif } // Test Lock() and Unlock() functionalities. TEST_P(DiscardableMemoryTest, LockAndUnLock) { const scoped_ptr<DiscardableMemory> memory(CreateLockedMemory(kSize)); ASSERT_TRUE(memory); void* addr = memory->Memory(); ASSERT_NE(nullptr, addr); memory->Unlock(); EXPECT_NE(DISCARDABLE_MEMORY_LOCK_STATUS_FAILED, memory->Lock()); addr = memory->Memory(); ASSERT_NE(nullptr, addr); memory->Unlock(); } // Test delete a discardable memory while it is locked. TEST_P(DiscardableMemoryTest, DeleteWhileLocked) { const scoped_ptr<DiscardableMemory> memory(CreateLockedMemory(kSize)); ASSERT_TRUE(memory); } #if !defined(NDEBUG) && !defined(OS_ANDROID) // Death tests are not supported with Android APKs. TEST_P(DiscardableMemoryTest, UnlockedMemoryAccessCrashesInDebugMode) { const scoped_ptr<DiscardableMemory> memory(CreateLockedMemory(kSize)); ASSERT_TRUE(memory); memory->Unlock(); ASSERT_DEATH_IF_SUPPORTED( { *static_cast<int*>(memory->Memory()) = 0xdeadbeef; }, ".*"); } #endif // Test behavior when creating enough instances that could use up a 32-bit // address space. // This is disabled under AddressSanitizer on Windows as it crashes (by design) // on OOM. See http://llvm.org/PR22026 for the details. #if !defined(ADDRESS_SANITIZER) || !defined(OS_WIN) TEST_P(DiscardableMemoryTest, AddressSpace) { const size_t kLargeSize = 4 * 1024 * 1024; // 4MiB. const size_t kNumberOfInstances = 1024 + 1; // >4GiB total. scoped_ptr<DiscardableMemory> instances[kNumberOfInstances]; for (auto& memory : instances) { memory = CreateLockedMemory(kLargeSize); ASSERT_TRUE(memory); void* addr = memory->Memory(); ASSERT_NE(nullptr, addr); memory->Unlock(); } } #endif std::vector<DiscardableMemoryType> GetSupportedDiscardableMemoryTypes() { std::vector<DiscardableMemoryType> supported_types; DiscardableMemory::GetSupportedTypes(&supported_types); return supported_types; } INSTANTIATE_TEST_CASE_P( DiscardableMemoryTests, DiscardableMemoryTest, ::testing::ValuesIn(GetSupportedDiscardableMemoryTypes())); } // namespace } // namespace base
d54f5e9d93e33deebd3bc72eb047dbf11ea7b112
83ecaefd5aff0dfd16b1a962dbdf04c4eb2bce16
/src/FusionEKF.cpp
21901d88751b4f7ee7bace29b613cce8bb690906
[]
no_license
bexcite/CarND-Extended-Kalman-Filter-Project
8ef1130501ea97ddef1246bdb395558cb98bfa47
9a369d299a53f7a547d4b61d78581ba29998375a
refs/heads/master
2021-01-20T11:31:23.277369
2017-03-23T00:05:49
2017-03-23T00:05:49
83,955,293
1
0
null
2017-03-19T19:30:19
2017-03-05T08:18:04
C++
UTF-8
C++
false
false
6,453
cpp
FusionEKF.cpp
#include "FusionEKF.h" #include "tools.h" #include "Eigen/Dense" #include <iostream> using namespace std; using Eigen::MatrixXd; using Eigen::VectorXd; using std::vector; //#define DEBUG 1 /* * Constructor. */ FusionEKF::FusionEKF() { is_initialized_ = false; previous_timestamp_ = 0; // initializing matrices //measurement covariance matrix - laser R_laser_ = MatrixXd(2, 2); R_laser_ << 0.0225, 0, 0, 0.0225; //measurement covariance matrix - radar R_radar_ = MatrixXd(3, 3); R_radar_ << 0.09, 0, 0, 0, 0.0009, 0, 0, 0, 0.09; H_laser_ = MatrixXd(2, 4); H_laser_ << 1, 0, 0, 0, 0, 1, 0, 0; Hj_ = MatrixXd(3, 4); fmt_ = Eigen::IOFormat(Eigen::StreamPrecision, Eigen::DontAlignCols, ", ", ", ", "", "", " ", ""); /** TODO: * Finish initializing the FusionEKF. * Set the process and measurement noises */ ekf_.x_ = VectorXd(4); ekf_.x_ << 0, 0, 0, 0; ekf_.P_ = MatrixXd(4, 4); ekf_.P_ << 0.5, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 1000, 0, 0, 0, 0, 1000; ekf_.F_ = MatrixXd(4, 4); ekf_.F_ << 1, 0, 0, 0, // 0,2 = dt - will be changed on each step 0, 1, 0, 0, // 1,3 = dt - will be changed on each step 0, 0, 1, 0, 0, 0, 0, 1; ekf_.Q_ = MatrixXd(4, 4); ekf_.Q_ << 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0; //set the acceleration noise components noise_ax = 8; noise_ay = 8; } /** * Destructor. */ FusionEKF::~FusionEKF() {} void FusionEKF::ProcessMeasurement(const MeasurementPackage &measurement_pack) { #ifdef DEBUG cout << ">>>>>>>>>>>>>>>>>\nFEKF::ProcessMeasurement: measurement_pack = " << measurement_pack << endl; #endif /***************************************************************************** * Initialization ****************************************************************************/ if (!is_initialized_) { /** TODO: - DONE * Initialize the state ekf_.x_ with the first measurement. * Create the covariance matrix. * Remember: you'll need to convert radar from polar to cartesian coordinates. */ #ifdef DEBUG cout << "FEKF::ProcessMeasurement: Not initialized." << endl; #endif float x; float y; float vx = 0; float vy = 0; float v_var = 1000; if (measurement_pack.sensor_type_ == MeasurementPackage::LASER) { x = measurement_pack.raw_measurements_[0]; y = measurement_pack.raw_measurements_[1]; } else if (measurement_pack.sensor_type_ == MeasurementPackage::RADAR) { float ro = measurement_pack.raw_measurements_[0]; float phi = measurement_pack.raw_measurements_[1]; float ro_dot = measurement_pack.raw_measurements_[2]; x = ro * cos(phi); y = ro * sin(phi); vx = ro_dot * cos(phi); vy = ro_dot * sin(phi); v_var = 0.5; } // first measurement #ifdef DEBUG cout << "FEKF::ProcessMeasurement: EKF Initialization. " << endl; #endif // Init state from first measurement ekf_.x_ << x, y, vx, vy; cout << "init x_ = " << ekf_.x_.format(fmt_) << endl; // Init covariance matrix from first measurement ekf_.P_ << 0.5, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, v_var, 0, 0, 0, 0, v_var; cout << "init P_ = " << endl << ekf_.P_ << endl; // timestamp previous_timestamp_ = measurement_pack.timestamp_; // done initializing, no need to predict or update is_initialized_ = true; return; } //compute the time elapsed between the current and previous measurements float dt = (measurement_pack.timestamp_ - previous_timestamp_) / 1000000.0; //dt - expressed in seconds previous_timestamp_ = measurement_pack.timestamp_; float dt_2 = dt * dt; float dt_3 = dt_2 * dt; float dt_4 = dt_3 * dt; // cout << "dt = " << dt << " seconds" << endl; /***************************************************************************** * Prediction ****************************************************************************/ /** TODO: - DONE * Update the state transition matrix F according to the new elapsed time. - Time is measured in seconds. * Update the process noise covariance matrix. * Use noise_ax = 9 and noise_ay = 9 for your Q matrix. */ // Update F according to elapsed time. ekf_.F_(0, 2) = dt; ekf_.F_(1, 3) = dt; // cout << "ekf_.F_ =" << endl << ekf_.F_ << endl; // Update the process noise covariance matrix //set the process covariance matrix Q ekf_.Q_ << dt_4/4*noise_ax, 0, dt_3/2*noise_ax, 0, 0, dt_4/4*noise_ay, 0, dt_3/2*noise_ay, dt_3/2*noise_ax, 0, dt_2*noise_ax, 0, 0, dt_3/2*noise_ay, 0, dt_2*noise_ay; // cout << "ekf_.Q_ =" << endl << ekf_.Q_ << endl; // cout << "FEKF::ProcessMeasurement: Predict " << endl; ekf_.Predict(); // cout << "x_ = " << ekf_.x_.format(fmt_) << endl; // cout << "P_ = " << endl << ekf_.P_ << endl; /***************************************************************************** * Update ****************************************************************************/ /** TODO: - DONE * Use the sensor type to perform the update step. * Update the state and covariance matrices. */ // cout << "FEKF::ProcessMeasurement: Update " << endl; if (measurement_pack.sensor_type_ == MeasurementPackage::RADAR) { // Radar updates #ifdef DEBUG cout << "Radar Updates === : " << endl; #endif ekf_.R_ = R_radar_; ekf_.H_ = tools.CalculateJacobian(ekf_.x_); #ifdef DEBUG cout << "jacobian ekf_.H_ = " << endl << ekf_.H_ << endl; #endif ekf_.UpdateEKF(measurement_pack.raw_measurements_); } else { // Laser updates // cout << "Laser Updates === :" << endl; ekf_.R_ = R_laser_; ekf_.H_ = H_laser_; ekf_.Update(measurement_pack.raw_measurements_); } // print the output // Eigen::IOFormat CommaInitFmt(Eigen::StreamPrecision, Eigen::DontAlignCols, ", ", ", ", "", "", " ", ""); #ifdef DEBUG cout << "x_ = " << ekf_.x_.format(fmt_) << endl; cout << "P_ = " << endl << ekf_.P_ << endl; cout << "<<<<<<<<< ProcessMeasurement finished!" << endl; #endif }
744c36bb0a24fea645e7f2ad7368f1cb517feb8d
338794e6b5b04e6fb71eba425e2b56aca8113fcf
/Movie.h
9427ba35c153d1b9142345cebf3a69f90a3b542c
[]
no_license
ermado/GEN_Labo5
b3dbd94810b8186304423abc83f314a824d5d3d1
66710cacf88854e36ee68a19bc39661bbda12139
refs/heads/master
2020-05-26T21:40:23.294642
2019-06-16T21:18:05
2019-06-16T21:18:05
188,383,286
0
0
null
null
null
null
UTF-8
C++
false
false
1,976
h
Movie.h
// Movie.h #ifndef MOVIE_H #define MOVIE_H #include <string> /* * On a pris la decision d'implementer de cette facon les attributs des calculs des taxes (et * non comme attribut de classes) afin d'avoir dans le meme lieu toutes les "constantes" de base * liés aux calculs des prix pour une meilleure et plus rapide gestion. Sous forme d'enum, chaque * type de fil à accés aux constantes via sa position dans les autres tableaux */ #define BASETAX 1.5 enum movieType {REGULAR, NEW_RELEASE, CHILDRENS}; static double movieTypeBaseAmount[] = {2, 3, 1.5}; static double movieTypeDayLimit[] = {2, 0, 3}; static int movieTypeRenterPoints[] = {1, 2, 1}; /*************************************************************************************************** * MainClass **************************************************************************************************/ class Movie { public: Movie(); explicit Movie(const std::string& title); virtual std::string getTitle() const; virtual double getAmount(int daysRented) const = 0; virtual int getRenterPoints() const = 0; private: std::string _title; }; /*************************************************************************************************** * SubClasses **************************************************************************************************/ class RegularMovie : public Movie { public: explicit RegularMovie(const std::string& title); double getAmount(int daysRented) const override; int getRenterPoints() const override; }; class NewReleaseMovie : public Movie { public: explicit NewReleaseMovie(const std::string& title); double getAmount(int daysRented) const override; int getRenterPoints() const override; }; class ChildrenMovie : public Movie { public: explicit ChildrenMovie(const std::string& title); double getAmount(int daysRented) const override; int getRenterPoints() const override; }; #endif // MOVIE_H
f7c5bc645489cffd88c248eadd517b7c8fba757e
14810b309726e61cb1bc3fb72b111807397947cf
/code/src/widgets/imagegraphicsitem.cpp
c4d4efc91ac8f649414b0d0622702097a7fc4a06
[]
no_license
tohojo/image-processing
c07b7fd4107d9436412f317a7b52ae02c51972a5
1e5266b68f8cf47f8a2d8a03926326d3a99fe584
refs/heads/master
2019-01-01T12:37:22.187507
2012-06-06T00:02:33
2012-06-06T00:02:33
3,703,090
11
14
null
null
null
null
UTF-8
C++
false
false
2,141
cpp
imagegraphicsitem.cpp
/** * imagegraphicsitem.cpp * * Toke Høiland-Jørgensen * 2012-04-05 */ #include "imagegraphicsitem.h" #include <QtGui/QGraphicsScene> #include <QtGui/QGraphicsView> #include <QtGui/QTransform> #include <QtGui/QMenu> #include <QtGui/QGraphicsSceneMouseEvent> #include <QDebug> ImageGraphicsItem::ImageGraphicsItem(QGraphicsItem *parent) :QGraphicsPixmapItem(parent) { init(); } ImageGraphicsItem::ImageGraphicsItem(const QPixmap &pixmap, QGraphicsItem *parent) :QGraphicsPixmapItem(parent) { init(); setPixmap(pixmap); } void ImageGraphicsItem::init() { setFlags(QGraphicsItem::ItemIsSelectable); setCursor(Qt::CrossCursor); poi_lines = false; } ImageGraphicsItem::~ImageGraphicsItem() { } void ImageGraphicsItem::setPixmap(const QPixmap &pixmap) { QGraphicsPixmapItem::setPixmap(pixmap); QSize s = pixmap.size(); QPointF p(-s.width()/2.0f, -s.height()/2.0f); setPos(p); scene()->setSceneRect(sceneBoundingRect()); } void ImageGraphicsItem::removePOI(POIItem *poi) { QPoint p = poi->pos().toPoint(); delete poi; emit POIRemoved(p); } void ImageGraphicsItem::clearPOIs() { foreach(QGraphicsItem * item, childItems()) { POIItem * poi = static_cast<POIItem*>(item); removePOI(poi); } } void ImageGraphicsItem::addPOI(QPoint p) { emit newPOI(p); POIItem * poi = new POIItem(this); poi->setPos(p); poi->setLine(poi_lines); } void ImageGraphicsItem::removePOI(QPoint p) { foreach(QGraphicsItem * item, childItems()) { POIItem * poi = static_cast<POIItem*>(item); if(poi->pos().toPoint() == p) removePOI(poi); } } void ImageGraphicsItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) { QPoint p = event->pos().toPoint(); addPOI(p); } void ImageGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { event->ignore(); } void ImageGraphicsItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { scene()->clearSelection(); event->ignore(); } void ImageGraphicsItem::setPOILines(bool v) { poi_lines = v; foreach(QGraphicsItem * item, childItems()) { POIItem * poi = static_cast<POIItem*>(item); poi->setLine(poi_lines); } }
2889712555c3ae8e2c504d7958f904b08bc0d2ed
249474b1f68097cc31fc6b2c80539ecd291d2393
/reluplex/ReluplexGate.h
208ba79c0e0d6f801282381954cf6dbb3cb83b87
[ "MIT" ]
permissive
research-fork/python-reluplex
e0008acf3e6b8cfb389057ddc291e74c5b444975
42c23b010dbc28f1d0cb8faa9fbe635686adf264
refs/heads/master
2022-02-06T12:04:36.920585
2019-03-27T11:09:05
2019-03-27T11:09:05
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,343
h
ReluplexGate.h
#ifndef __ReluplexGate_h__ #define __ReluplexGate_h__ #include <Reluplex.h> #include <vector> #include <map> class ReluplexGate { public: ReluplexGate() : n_variable(0), cell_constraints(new std::vector<std::pair<std::pair<unsigned, unsigned>, double> > ()), relu_constraints(new std::vector<std::pair<unsigned, unsigned> >()), lb_constraints(new std::vector<std::pair<unsigned, double> >()), ub_constraints(new std::vector<std::pair<unsigned, double> >()), basic_constraints(new std::vector<unsigned>()) { auto one = get_new_variable(); set_bound(one, 1, 1); } inline unsigned get_new_variable() { return n_variable++; } inline unsigned get_basic_variable() { auto v = get_new_variable(); mark_basic(v); return v; } inline void set_cell_constraints(unsigned u, unsigned v, double w) { cell_constraints->push_back(std::make_pair(std::make_pair(u, v), w)); } unsigned relu(unsigned v) { auto rv = get_new_variable(); set_lower_bound(rv, 0); relu_constraints->push_back(std::make_pair(v, rv)); return rv; } inline void set_lower_bound(unsigned u, double b) { lb_constraints->push_back(std::make_pair(u, b)); } inline void set_upper_bound(unsigned u, double b) { ub_constraints->push_back(std::make_pair(u, b)); } inline void mark_basic(unsigned u) { basic_constraints->push_back(u); } inline void set_bound(unsigned a, double l, double u) { set_lower_bound(a, l); set_upper_bound(a, u); } unsigned get_constant(double c) { auto v = get_new_variable(); set_upper_bound(v, c); set_lower_bound(v, c); return v; } unsigned apply_linear_op(std::vector<unsigned> v, std::vector<double> w, double b) { auto a = get_new_variable(); auto a_b = get_basic_variable(); set_bound(a_b, 0, 0); set_cell_constraints(a_b, a_b, -1); set_cell_constraints(a_b, a, -1); for(auto i = 0u; i < v.size(); ++i) { if(w[i] != 0) { set_cell_constraints(a_b, v[i], w[i]); } } if(b != 0) { set_cell_constraints(a_b, get_one(), b); } return a; } inline unsigned neg(unsigned v) { return apply_linear_op({v}, {-1}, 0); } inline unsigned get_one() { return 0; } unsigned absolute(unsigned a) { auto a_p = relu(a); auto a_n = relu(neg(a)); return apply_linear_op({a_p, a_n}, {1, 1}, 0); } unsigned max_pair(unsigned a, unsigned b) { auto diff_a_b = apply_linear_op({a, b}, {1, -1}, 0); auto diff_b_a = apply_linear_op({b, a}, {1, -1}, 0); auto relu_diff_a_b = relu(diff_a_b); auto relu_diff_b_a = relu(diff_b_a); return apply_linear_op({a, b, relu_diff_a_b, relu_diff_b_a}, {.5, .5, .5, .5}, 0); } unsigned min_pair(unsigned a, unsigned b) { auto diff_a_b = apply_linear_op({a, b}, {1, -1}, 0); auto diff_b_a = apply_linear_op({b, a}, {1, -1}, 0); auto relu_diff_a_b = relu(diff_a_b); auto relu_diff_b_a = relu(diff_b_a); return apply_linear_op({a, b, relu_diff_a_b, relu_diff_b_a}, {.5, .5, -.5, -.5}, 0); } unsigned max(std::vector<unsigned> v) { auto r = *v.begin(); for(auto it = std::next(v.begin()); it != v.end(); ++it) { r = max_pair(r, *it); } return r; } unsigned min(std::vector<unsigned> v) { auto r = *v.begin(); for(auto it = std::next(v.begin()); it != v.end(); ++it) { r = min_pair(r, *it); } return r; } void greater_than_equal(unsigned a, unsigned b) { auto diff_a_b = apply_linear_op({a, b}, {1, -1}, 0); set_lower_bound(diff_a_b, 0); } void greater_than(unsigned a, unsigned b) { auto diff_a_b = apply_linear_op({a, b}, {1, -1}, 0); // bad hack set_lower_bound(diff_a_b, 0.01); } void from_interval_box(std::vector<unsigned> x, std::vector<double> l, std::vector<double> u) { std::vector<unsigned> y; for(auto i = 0u; i < x.size(); ++i) { set_lower_bound(x[i], l[i]); set_upper_bound(x[i], u[i]); } } void not_from_interval_box(std::vector<unsigned> x, std::vector<double> l, std::vector<double> u) { std::vector<unsigned> y; for(auto i = 0u; i < x.size(); ++i) { // x[i] - l[i] y.push_back(apply_linear_op({x[i]}, {1}, -l[i])); // u[i] - x[i] y.push_back(apply_linear_op({x[i]}, {-1}, u[i])); } // min(x[i] - l[i], u[i] - x[i]) auto y_min = min(y); // x[i] - l[i] <= 0 or u[i] - x[i] <= 0 set_upper_bound(y_min, 0); } Reluplex* get_reluplex() { Reluplex* r = new Reluplex(n_variable); for(auto v: *cell_constraints) { // printf("initializeCell(%u, %u, %lf)\n", v.first.first, v.first.second, v.second); r->initializeCell(v.first.first, v.first.second, v.second); } for(auto v: *relu_constraints) { // printf("setReluPair(%u, %u)\n", v.first, v.second); r->setReluPair(v.first, v.second); } for(auto v: *lb_constraints) { // printf("setLowerBound(%u, %lf)\n", v.first, v.second); r->setLowerBound(v.first, v.second); } for(auto v: *ub_constraints) { // printf("setUpperBound(%u, %lf)\n", v.first, v.second); r->setUpperBound(v.first, v.second); } for(auto v: *basic_constraints) { // printf("markBasic(%u)\n", v); r->markBasic(v); } return r; } ~ReluplexGate() { delete cell_constraints; delete relu_constraints; delete lb_constraints; delete ub_constraints; delete basic_constraints; } private: unsigned n_variable; std::vector<std::pair<std::pair<unsigned, unsigned>, double> > *cell_constraints; std::vector<std::pair<unsigned, unsigned> > *relu_constraints; std::vector<std::pair<unsigned, double> > *lb_constraints; std::vector<std::pair<unsigned, double> > *ub_constraints; std::vector<unsigned> *basic_constraints; }; #endif // __ReluplexGate_h__
59c35ae07847b033fb52772c529b77c34be5626f
422a42e3cd536b2a74e12721d27f0c3116524273
/sotukenGame/Sample_15_05/Sample_15_05/EnTest.cpp
235b6b713f2974abeb4ed825e68961a2eb02b222
[]
no_license
kyarameru1102/Phantasy-Star-Offline
98bd93c68f3c713a172591f2542664c4e221961c
fdd66914e3ca9e8907033f20f9b58e83ffb3333a
refs/heads/main
2023-02-17T11:56:20.498962
2021-01-14T04:27:46
2021-01-14T04:27:46
306,238,430
1
0
null
null
null
null
SHIFT_JIS
C++
false
false
2,791
cpp
EnTest.cpp
#include "stdafx.h" #include "EnTest.h" #include "Player.h" EnTest::EnTest() { } EnTest::~EnTest() { } bool EnTest::Start() { //プレイヤーのアニメーションのインスタンス作成。 m_enemyAnim = NewGO<EnemyAnimation>(0, "enemyAnim"); m_appearcolor = boarcolor[rand() % boarcolor.size()]; //モデルの初期化 if (m_appearcolor == 1 ) { m_EnTestSkinModel = NewGO<SkinModelRender>(0); m_EnTestSkinModel->Init("Assets/modelData/enemy/DragonBoar/Blue/DrBoarBl.tkm", m_enemyAnim->GetAnimationClip(), enAnimationClip_num); } else if (m_appearcolor == 2) { m_EnTestSkinModel = NewGO<SkinModelRender>(0); m_EnTestSkinModel->Init("Assets/modelData/enemy/DragonBoar/Gold/DrBoarGo.tkm", m_enemyAnim->GetAnimationClip(), enAnimationClip_num); } else if (m_appearcolor == 3) { m_EnTestSkinModel = NewGO<SkinModelRender>(0); m_EnTestSkinModel->Init("Assets/modelData/enemy/DragonBoar/Green/DrBoarGr.tkm", m_enemyAnim->GetAnimationClip(), enAnimationClip_num); } else if (m_appearcolor == 4) { m_EnTestSkinModel = NewGO<SkinModelRender>(0); m_EnTestSkinModel->Init("Assets/modelData/enemy/DragonBoar/Red/DrBoarRe.tkm", m_enemyAnim->GetAnimationClip(), enAnimationClip_num); } m_position = { 300.0f, 0.0f, 100.0f }; m_rotation.SetRotationDegY(90.0f); //キャラコン初期化。 m_charaCon.Init(145.0f, 100.0f, m_position); return true; } void EnTest::Move() { //プレイヤーを追いかける。 if (m_player != nullptr) { Vector3 playerLen = m_player->GetPosition() - m_position; playerLen.Normalize(); m_movespeed = playerLen * 1.2f; m_movespeed.y = m_speedY; m_position += m_movespeed; } } void EnTest::Turn() { //プレイヤーに向けて回転させる if (m_player != nullptr) { Vector3 playerLen = m_player->GetPosition() - m_position; float angle = atan2(playerLen.x, playerLen.z); m_rotation.SetRotation(Vector3::AxisY, angle); } } void EnTest::Attack() { if (m_status == Attack_state && m_player != nullptr) { Vector3 playerLen = m_player->GetPosition() - m_position; if (playerLen.Length() <= 190.0f) { m_animState = enHornattack; } } } void EnTest::Update() { if (m_status == Idle_state) { m_animState = enIdle; } if (m_status == Attack_state) { m_animState = enRun; } if (m_player == nullptr) { m_player = FindGO<Player>("player"); } if (m_player != nullptr) { Move(); Turn(); Attack(); } //turntimer++; /*if (turntimer < 50) { m_addrot.SetRotationDeg(Vector3::AxisY, 2.0f); m_rotation *= m_addrot; }*/ m_position = m_charaCon.Execute(1.0f, m_movespeed); m_EnTestSkinModel->SetScale({ 40.0, 40.0, 40.0 }); m_EnTestSkinModel->SetRotation(m_rotation); m_EnTestSkinModel->SetPosition(m_position); m_EnTestSkinModel->PlayAnimation(m_animState,0.0f); }
eea524885273aadacfee8c178bea8dc38fa55caf
d93e260d834948d99db86e8c3c97e5f298d8a071
/src/Engine/Graphics/Private/Texture.cpp
c670eeb6933b909605a54c644e5f7a95004e37b6
[]
no_license
matthiascy/MoteurDeJeux
f8a77428afc29e7fd5d699ae16f44b90a3c83307
f610862a5bba08e8b6279d6de3eba1ae1e83597d
refs/heads/master
2020-09-06T06:06:49.793016
2020-01-14T02:36:28
2020-01-14T02:36:28
220,345,046
2
0
null
null
null
null
UTF-8
C++
false
false
818
cpp
Texture.cpp
#include <Graphics/Public/Texture.hpp> Texture::Texture(const String& path, Image* image, ETextureType type) { m_name_path = path; m_type = type; //qDebug() << "Create Texture : " << path; m_ogl_texture = makeUnique<OglTexture>(image->mirrored()); } Texture::Texture(const String& path, ETextureType type) { m_name_path = path; m_type = type; //qDebug() << "Create Texture : " << path; m_ogl_texture = makeUnique<OglTexture>(Image(path).mirrored()); } Texture::~Texture() { m_ogl_texture.reset(nullptr); } bool Texture::isSamePathWith(const Texture& other) { return m_name_path == other.m_name_path; } OglTexture* Texture::oglTexture() const { return m_ogl_texture.get(); } ETextureType Texture::type() const { return m_type; } String Texture::namePath() const { return m_name_path; }
2aeeb7d4c8079a486fde37d20d435c816a172d9d
ec443f7499a07dce1e372208f3eca0f699a3522e
/src/object3d/bound.cpp
1d69c4da88f0720e85dc3dee4bee20372c905c35
[]
no_license
LumiOwO/6.837
a00d7f6ff8dca25a9360faf37834dcf62f7affce
94a1700a257467fc9bf21f9d3547ece45b5a47a3
refs/heads/master
2023-03-22T03:56:29.928389
2020-03-16T10:26:48
2020-03-16T10:26:48
242,447,354
0
0
null
null
null
null
UTF-8
C++
false
false
3,050
cpp
bound.cpp
#include "bound.h" #include <GL/glut.h> #include "ray.h" #include "raytracing_stats.h" #include "matrix.h" #include "hit.h" // ==================================================================== // ==================================================================== void Bound::paint() const { // draw a wireframe box to represent the boundingbox glColor3f(1,1,1); glDisable(GL_LIGHTING); glBegin(GL_LINES); glVertex3f(min.x(),min.y(),min.z()); glVertex3f(max.x(),min.y(),min.z()); glVertex3f(min.x(),min.y(),min.z()); glVertex3f(min.x(),max.y(),min.z()); glVertex3f(max.x(),max.y(),min.z()); glVertex3f(max.x(),min.y(),min.z()); glVertex3f(max.x(),max.y(),min.z()); glVertex3f(min.x(),max.y(),min.z()); glVertex3f(min.x(),min.y(),min.z()); glVertex3f(min.x(),min.y(),max.z()); glVertex3f(min.x(),max.y(),min.z()); glVertex3f(min.x(),max.y(),max.z()); glVertex3f(max.x(),min.y(),min.z()); glVertex3f(max.x(),min.y(),max.z()); glVertex3f(max.x(),max.y(),min.z()); glVertex3f(max.x(),max.y(),max.z()); glVertex3f(min.x(),min.y(),max.z()); glVertex3f(max.x(),min.y(),max.z()); glVertex3f(min.x(),min.y(),max.z()); glVertex3f(min.x(),max.y(),max.z()); glVertex3f(max.x(),max.y(),max.z()); glVertex3f(max.x(),min.y(),max.z()); glVertex3f(max.x(),max.y(),max.z()); glVertex3f(min.x(),max.y(),max.z()); glEnd(); glEnable(GL_LIGHTING); } // ==================================================================== // ==================================================================== Bound::Bound(const Bound &b) { min = b.min; max = b.max; valid = b.valid; } Bound& Bound::operator=(const Bound &b) { min = b.min; max = b.max; valid = b.valid; return *this; } bool Bound::cover(Vec3f point) const { return point.x() >= min.x() && point.x() <= max.x() && point.y() >= min.y() && point.y() <= max.y() && point.z() >= min.z() && point.z() <= max.z(); } bool Bound::intersect(const Bound &box) const { return min.x() <= box.max.x() && min.y() <= box.max.y() && min.z() <= box.max.z() && max.x() >= box.min.x() && max.y() >= box.min.y() && max.z() >= box.min.z(); } bool Bound::intersect(const Ray &r, Hit &h, float tmin) const { RayTracingStats::IncrementNumIntersections(); Vec3f d = r.getDirection(); Vec3f o = r.getOrigin(); Vec3f normal; float hit_min = 0; float hit_max = 1e6; for(int i = 0; i < 3; i ++) { float inv_dir = 1 / d[i]; float hit_near = (min[i] - o[i]) * inv_dir; float hit_far = (max[i] - o[i]) * inv_dir; if (hit_near > hit_far) { std::swap(hit_near, hit_far); } // make it more robust (reference: pbr-book 3.9.2) hit_far *= 1 + 2 * gamma(3); // update hit point if(hit_near > hit_min) { hit_min = hit_near; normal = Vec3f(0, 0, 0); normal[i] = d[i] > 0 ? -1.0f : 1.0f; } hit_max = hit_far < hit_max? hit_far: hit_max; if (hit_min > hit_max) { return false; } } float hitT = hit_min; if (hit_max < tmin) { return false; } h.set(hitT, nullptr, normal, r); return true; }
b1888a3ed1eed1257a67651b1dc0d5e657df79a2
10709121ed189fcbebd2e9225bc9070d5f4511a2
/DataStructures/BackwardIterator.h
64cbd9d8d1c3538ad49116ed7648dc524827b7b5
[]
no_license
shantahuja/DataStructures_ShantAhuja
34c10c223e8575ca2c082804cb72c0cb659e57e2
119a330c8bdb336f08e41dbb51764a94c5be7ce3
refs/heads/master
2020-04-01T12:33:16.585043
2018-10-16T03:36:41
2018-10-16T03:36:41
153,212,820
0
0
null
null
null
null
UTF-8
C++
false
false
1,678
h
BackwardIterator.h
#ifndef BACKWARDITERATOR_H #define BACKWARDITERATOR_H #include "ListIterator.h" template<class T> class BackwardIterator : public ListIterator<T> { public: void Reset(); bool IsDone(); void MoveNext(); DLLNode<T> operator=(DLLNode<T> * rhs); BackwardIterator<T> & operator++(); BackwardIterator<T> operator++(int); }; template<class T> inline void BackwardIterator<T>::Reset() { if (!_node) { throw Exception("this list has not been assigned an iterator"); } else { while (_node->getNext() != nullptr) { _node = _node->getNext(); } _done = false; } } template<class T> inline bool BackwardIterator<T>::IsDone() { if (!_node) { throw Exception("List has not been assigned an iterator"); } else { if (_node->getPrevious() == nullptr) return true; else return false; } } template<class T> inline void BackwardIterator<T>::MoveNext() { if (_node->getPrevious() != nullptr) { _node = _node->getPrevious(); } else throw Exception("You're at the beginning of the list and can't go backwards!"); } template<class T> inline DLLNode<T> BackwardIterator<T>::operator=(DLLNode<T>* rhs) { _node = rhs; return * _node; } template<class T> inline BackwardIterator<T> & BackwardIterator<T>::operator++() { if (_node->getPrevious() != nullptr) { MoveNext(); return *this; } else { throw Exception("already at beginning of list"); } } template<class T> inline BackwardIterator<T> BackwardIterator<T>::operator++(int) { if (_node->getPrevious() != nullptr) { BackwardIterator<T> temp = *this; MoveNext(); return temp; } else { throw Exception("already at beginning of list"); } } #endif // !BACKWARDITERATOR_H
500872a80ccd317a99c832b39fd7a90ec0888ac9
35a3a794c94fbe9a3d9b0bcb19eaeb60c7ca6a26
/sp703.cpp
1ecc5c2444759387f29de322c5da4650c691acfd
[]
no_license
jshky/CODE
be7eae06f8478706495ea1886233165995ba6f69
e78b61572953167091796b51a2c152780cf8c661
refs/heads/master
2021-07-06T23:55:00.038980
2020-09-20T05:44:42
2020-09-20T05:44:42
183,609,334
0
0
null
null
null
null
UTF-8
C++
false
false
1,035
cpp
sp703.cpp
#include<cstdio> #include<cstring> #include<algorithm> using namespace std; int T,n,m,f[2005][205][205],c[205][205],a[2005]; int main(){ scanf("%d",&T); while (T--){ scanf("%d%d",&n,&m); for (int i=1;i<=n;++i) for (int j=1;j<=n;++j) scanf("%d",&c[i][j]); for (int i=1;i<=m;++i) scanf("%d",&a[i]); memset(f,0x3f,sizeof f); f[0][1][2]=0; a[0]=3; int ans=0x7f7f7f7f; for (int i=1;i<=m;++i) for (int j=1;j<=n;++j) for (int k=1;k<=n;++k){ if (j!=a[i] && k!=a[i]) f[i][j][k]=min(f[i][j][k],f[i-1][j][k]+c[a[i-1]][a[i]]); if (a[i-1]!=a[i] && k!=a[i]) f[i][a[i-1]][k]=min(f[i][a[i-1]][k],f[i-1][j][k]+c[j][a[i]]); if (a[i-1]!=a[i] && j!=a[i]) f[i][j][a[i-1]]=min(f[i][j][a[i-1]],f[i-1][j][k]+c[k][a[i]]); } for (int i=1;i<=n;++i) for (int j=1;j<=n;++j) ans=min(ans,f[m][i][j]); printf("%d\n",ans); } return 0; }
8cca1959b51dc7634abe6e6608166481eb4d2683
f87302e58193507abafaef92efe2b3363135af83
/libs/model/include/model/modifications/expandnondet.hpp
c0d5e6b874a2d07bb266fd4a0740ec866b4957e7
[]
no_license
dannybpoulsen/minimc
7ccbb7a3ea9d73825db8730f2b04e92f967a7993
e496b903866a93436f561834e375197b68e16511
refs/heads/master
2023-09-05T19:22:44.325477
2023-08-10T18:49:44
2023-08-10T18:49:44
252,640,133
8
1
null
2023-04-20T09:44:47
2020-04-03T05:26:04
C++
UTF-8
C++
false
false
325
hpp
expandnondet.hpp
#ifndef _MODIFICATIAONS__EXPANDNONDET__ #define _MODIFICATIAONS__EXPANDNONDET__ #include "model/cfg.hpp" #include "support/feedback.hpp" namespace MiniMC { namespace Model { namespace Modifications { void expandNonDet (MiniMC::Model::Program& prgm, MiniMC::Support::Messager&); } } } #endif
445a8ca7f8003749283fb27cbcae8692883f0db9
47dc19810d07f9959b4e62e3d19534c63a7e6ff8
/LevelOne.cpp
d29411314d9dfa203e257214d89458839d0cf62c
[]
no_license
Cem-Alagozlu/Saheser-2D-platformer
f1965994bb09607ab233f6c314c7ae6935e01d6b
d1ceebb1e690528717fdb2bed87207fc312915a8
refs/heads/master
2020-08-24T00:45:14.727865
2019-10-22T06:09:27
2019-10-22T06:09:27
216,734,377
0
0
null
null
null
null
UTF-8
C++
false
false
9,919
cpp
LevelOne.cpp
#include "stdafx.h" #include "LevelOne.h" LevelOne::LevelOne(LevelManager& levelmanager, std::shared_ptr<Player> player) :LevelBase{ levelmanager,"Resources/Sprites/LevelOne/LevelOne.svg" } , m_pPlayer{ player } , m_LevelOneTextureFront{"Resources/Sprites/LevelOne/LevelOneFront.png"} , m_LevelOneTextureBack{"Resources/Sprites/LevelOne/LevelOneBack.png"} , m_HiddenTextureFront{"Resources/Sprites/LevelOne/hidden.png"} , m_HiddenTextureBack{"Resources/Sprites/LevelOne/hidden-back.png"} , m_HiddenTextureHiding{"Resources/Sprites/LevelOne/HiddenFont02.png"} , m_Hatch{{3568,910},{3775,1100},{3700,1050}} , m_CircleSaw{{ 3200,480 },0.35f} , m_DoorSwitch{ {3625,135},{2100,135} } { Initialize(); } void LevelOne::DrawFront() const { // Textures that will be drawn if player didn't reach second base if (m_IsHidden) { for (int i = 0; i < m_MovingPlatforms.size(); i++) { m_MovingPlatforms[i].Draw(); } m_Hatch.DrawFront(); m_LevelOneTextureBack.Draw(Rectf(0, 0, m_LevelOneTextureBack.GetWidth(), m_LevelOneTextureBack.GetHeight())); } // Textures that will be drawn if player reached the second base else { m_CircleSaw.Draw(); m_HiddenTextureFront.Draw(Rectf(0, 0, m_HiddenTextureFront.GetWidth(), m_HiddenTextureFront.GetHeight())); } // draws all coins for (int i = 0; i < m_pCoins.size(); i++) { m_pCoins[i]->Draw(); } // draws all enemies for (int i = 0; i < m_Enemies.size(); i++) { m_Enemies[i].Draw(); } // draws second layer if (m_IsHidden) { m_HiddenTextureHiding.Draw(Rectf(0, 0, m_HiddenTextureHiding.GetWidth(), m_HiddenTextureHiding.GetHeight())); } } void LevelOne::DrawLocal() const { //draws fade in if next level if (m_IsNextLevel) { utils::SetColor({ 0.0f,0.0f,0.0f,m_FadingOpacity }); utils::FillRect({ 0,0,1280,720 }); } } void LevelOne::DrawBack() const { // parallax images for (int i = 0; i < m_pParallax.size(); i++) { m_pParallax[i]->Draw({ -1000 + m_pPlayer->GetShape().left / (20- (i + 2)),0,m_pParallax[0]->GetWidth(),m_pParallax[0]->GetHeight() }); } // draws hatches and the background texture of level one (main one, for the back) m_Hatch.DrawBack(); m_LevelOneTextureFront.Draw(Rectf(0, 0, m_LevelOneTextureFront.GetWidth(), m_LevelOneTextureFront.GetHeight())); // draws levers for (int i = 0; i < m_Levers.size(); i++) { m_Levers[i].Draw(); } // draws textures if player reached second base if (m_IsHidden == false) { m_HiddenTextureBack.Draw(Rectf(0, 0, m_HiddenTextureBack.GetWidth(), m_HiddenTextureBack.GetHeight())); m_DoorSwitch.Draw(); } } void LevelOne::Update(float elapsedSec) { //player pos m_Pos.x = m_pPlayer->GetShape().left; m_Pos.y = m_pPlayer->GetShape().bottom; // checks lever state to activate platforms for (int i = 0; i < m_Levers.size(); i++) { if (m_Levers[i].GetLeverState() == true) { m_MovingPlatforms[i].Update(elapsedSec); } } // updates coin animation for (int i = 0; i < m_pCoins.size(); i++) { m_pCoins[i]->Update(elapsedSec); } // updates animation m_CircleSaw.Update(elapsedSec, m_pPlayer->GetPosition()); m_Hatch.Update(elapsedSec); // updates enemy animation && movement for (int i = 0; i < m_Enemies.size(); i++) { m_Enemies[i].Update(elapsedSec); } // updates player spawn point after base has been reached if (m_IsHidden == false) { m_pPlayer->SetLevelBeginPos({ 3658, 670 }); } for (int i = 0; i < m_Enemies.size(); i++) { m_Enemies[i].BulletCollision(m_pPlayer->GetBulletPosition(), m_Enemies[i].GetPosition()); // enemy damage collision if (m_Enemies[i].IsEnemyDead() == false) { if (utils::IsOverlapping(m_pPlayer->GetShape(), m_Enemies[i].GetPosition()) || m_Enemies[i].PlayerCollisionBullet(m_pPlayer->GetShape())) { m_TimerOverlapEnemyEasy += elapsedSec; if (m_TimerOverlapEnemyEasy <= 0.02f) { m_pPlayer->AddHealth(1); } if (m_TimerOverlapEnemyEasy >= 0.5f) { m_TimerOverlapEnemyEasy = 0.0f; } } } // deleting enemies if (m_Enemies[i].IsEnemyDestroyed()) { m_pPlayer->AddPoints(2); std::swap(m_Enemies[i], m_Enemies.back()); m_Enemies.pop_back(); } } // sets to level 2 if opacity > 2 && if door is open if (m_DoorSwitch.GetDoorOpenState() && m_DoorSwitch.CollisionDoor(m_pPlayer->GetShape())) { if (m_FadingOpacity >= 2.0f) { m_LevelManager.SetCurrentLevel(LevelManager::Level::levelTwo); } } //checks if next level is set.. (to freeze player) //fade in will start if (m_IsNextLevel == true) { m_pPlayer->SetMovement(false); m_FadingOpacity += elapsedSec; } } void LevelOne::PlayMusic() { SoundManager::PlaySoundStream("LevelOne", true); // plays level one song } void LevelOne::MouseMoved(const Point2f& mousePos) { } void LevelOne::MouseClick(const SDL_MouseButtonEvent& e) { } void LevelOne::HandleCollision(Rectf& actorShape, Vector2f& actorVelocity) { LevelBase::HandleCollision(actorShape, actorVelocity); // death collisions for (int i = 0; i < m_DeathRects.size(); i++) { if (utils::IsOverlapping(m_DeathRects[i], m_pPlayer->GetShape()) || m_CircleSaw.CircleCollision(m_pPlayer->GetShape()) || m_pPlayer->GetPlayerManager().GetHealth() <= 0) { m_pPlayer->SetMovement(false); m_pPlayer->SetSecondaryMovement(Player::SecondaryMovement::death); } } // platform collisionsq for (int i = 0; i < m_MovingPlatforms.size(); i++) { m_MovingPlatforms[i].HandleCollision(actorShape, actorVelocity); if (m_MovingPlatforms[i].PlatformCollision(actorShape)) { m_MovingPlatforms[i].PlatformPlayerChange(actorShape); } } // empty collisions for (int i = 1; i < m_CollisionBoxes.size(); i++) { m_CollisionBoxes[i].HandleCollision(actorShape, actorVelocity); } // collision for hatch ( second base ) if (!m_Hatch.IsHatchedOpen()) { m_CollisionBoxes[0].HandleCollision(actorShape, actorVelocity); } // collision for interaction between objects if (m_IsInteracting) { for (int i = 0; i < m_Levers.size(); i++) { if (m_Levers[i].Collision(actorShape)) { m_Levers[i].SetLeverPull(true); m_IsInteracting = false; } } if (m_DoorSwitch.CollisionSwitch(actorShape)) { m_DoorSwitch.SetSwitchActivated(true); m_IsInteracting = false; } if (m_DoorSwitch.CollisionDoor(actorShape) && m_DoorSwitch.GetSwitchState() == true) { m_DoorSwitch.SetDoorOpen(true); m_IsNextLevel = true; m_IsInteracting = false; } } // collision for coins for (size_t i = 0; i < m_pCoins.size(); i++) { if (m_pCoins[i]->IsOverlapping(actorShape)) { m_pCoins[i]->PlayCoinSound(); m_pPlayer->AddPoints(1); m_pCoins.erase(m_pCoins.begin() + i); } } // collision for second base hatch if (utils::IsOverlapping(m_HiddenRect,actorShape)) { m_IsHidden = false; } // collision between bullet & hatch meter m_Hatch.BulletCollision(m_pPlayer->GetBulletPosition(), m_Hatch.GetButtonRect()); } Rectf LevelOne::GetBoundaries() const { return m_Boundaries; // return level boundaries } void LevelOne::Initialize() { //sets boundaries for cam m_Boundaries = { 0,0,m_LevelOneTextureFront.GetWidth(),m_LevelOneTextureFront.GetHeight() }; m_BeginPos = Point2f{ 100,100 }; // begin pos of player //initializes the parallax img's for (int idx = 0; idx < 3; ++idx) { std::stringstream str; str << "Resources/Sprites/LevelOne/Parallax0" << idx << ".png"; m_pParallax.push_back(std::make_unique<Texture>(str.str())); } //places the levers // platforms// invisible collision boxes m_Levers.push_back(Lever{ { 1250,280 }, 0, 1.0f }); m_Levers.push_back(Lever{ { 2200,489 }, 0, 1.0f }); m_MovingPlatforms.push_back(PlatformMoving({ 1700,70 }, "Resources/Sprites/Platform/platform01.png", { 1700,570 }, 0.0f, 1.0f, 1, "Resources/Sprites/Platform/platform01.svg")); m_MovingPlatforms.push_back(PlatformMoving({ 2425,490 }, "Resources/Sprites/Platform/platform01.png", { 2425,880 }, 0.0f, 1.0f, 1, "Resources/Sprites/Platform/platform01.svg")); m_CollisionBoxes.push_back(EmptyCollision({ 3550,907,250,70})); m_CollisionBoxes.push_back(EmptyCollision({ 10,500,450,10 })); m_CollisionBoxes.push_back(EmptyCollision({ 950,610,400,10 })); m_CollisionBoxes.push_back(EmptyCollision({ 1935,1060,345,10 })); //places the coins m_pCoins.push_back(std::make_unique<Coin>(Point2f(0,490))); m_pCoins.push_back(std::make_unique<Coin>(Point2f(120, 490))); m_pCoins.push_back(std::make_unique<Coin>(Point2f(240, 490))); m_pCoins.push_back(std::make_unique<Coin>(Point2f(360, 490))); m_pCoins.push_back(std::make_unique<Coin>(Point2f(960, 620))); m_pCoins.push_back(std::make_unique<Coin>(Point2f(1080, 620))); m_pCoins.push_back(std::make_unique<Coin>(Point2f(1200, 620))); m_pCoins.push_back(std::make_unique<Coin>(Point2f(1910, 1070))); m_pCoins.push_back(std::make_unique<Coin>(Point2f(2030, 1070))); m_pCoins.push_back(std::make_unique<Coin>(Point2f(2150, 1070))); // DEEL TWO m_pCoins.push_back(std::make_unique<Coin>(Point2f(2710, 570))); m_pCoins.push_back(std::make_unique<Coin>(Point2f(2830, 570))); m_pCoins.push_back(std::make_unique<Coin>(Point2f(3160, 640))); m_pCoins.push_back(std::make_unique<Coin>(Point2f(3110, 100))); m_pCoins.push_back(std::make_unique<Coin>(Point2f(3230, 100))); m_pCoins.push_back(std::make_unique<Coin>(Point2f(3350, 100))); //deadzones for player m_DeathRects.push_back({840,0,140,80}); m_DeathRects.push_back({ 2435,0,140,120 }); m_DeathRects.push_back({ 3110,0,400,120 }); m_HiddenRect = { 3570,920,200,30 }; //creates the enemies m_Enemies.push_back(EnemyEasy(Point2f{ 2670,945 }, Point2f{ 3360,945 }, std::string("SlimyEasy"), { 10,100 }, 10.0f,0.5f)); m_Enemies.push_back(EnemyEasy(Point2f{ 2170,100 }, Point2f{ 2370,100 }, std::string("SlimyEasy"), { 10,100 }, 5.0f, 0.5f)); m_Enemies.push_back(EnemyEasy(Point2f{ 2580,100 }, Point2f{ 2900,100 }, std::string("SlimyEasy"), { 10,100 }, 5.0f, 0.5f)); }
49482bddd30904ab4a9783336b604fea5bef28af
29b28af8b398d25ea9e96e399b8eca145b32cf74
/utils.cc
2f5a09df432a531966dbb2b0049664e7addf0595
[]
no_license
suvayu/Velo-EB
075b647214222e9234f624914de847d8cebfeeb2
671c6a658fc3caf0955f18f63d72fc26d7b1eb85
refs/heads/master
2016-09-16T01:15:24.269658
2012-04-30T12:15:59
2012-04-30T12:17:04
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,707
cc
utils.cc
#include <iostream> #include <vector> #include <fstream> #include <cassert> #include <algorithm> #include <cctype> #include <bitset> #include <TRegexp.h> #include <TObjArray.h> #include <TObjString.h> #include "utils.hh" TStyle* Style::setStyle() { gStyle->SetOptStat(0); gStyle->SetOptTitle(1); gStyle->SetPalette(1); // "rainbow" color palette gStyle->SetNumberContours(256); // smooth color palette gStyle->SetTitleOffset( 1.2, "xy"); gStyle->SetCanvasPreferGL(true); return gStyle; } void Hist::rescale(TH1 *h, Double_t factor) { // change X scale Double_t xmin = h->GetXaxis()->GetXmin(); Double_t xmax = h->GetXaxis()->GetXmax(); h->GetXaxis()->SetLimits(xmin*factor,xmax*factor); return; } bool Parsers::PrintOpts(TString& opt, TString& format) { opt.ToLower(); bool doPrint(false); if ( opt.Contains("print") ) { doPrint = true; if ( opt.Contains("png") ) format = "png"; else if ( opt.Contains("jpg") ) format = "jpg"; else if ( opt.Contains("ps") ) format = "ps"; else if ( opt.Contains("pdf") ) format = "pdf"; else if ( opt.Contains("cscript") ) format = "C"; else { std::cout << "Error Parsers::PrintOpts(): Bad print option!" << " No known formats found.\n" << "Warning Parsers::PrintOpts(): Printing will be skipped." << std::endl; doPrint = false; } } return doPrint; } void Parsers::readconf(std::vector<TString> &var, std::vector<TString> &val, std::string fname) { ifstream inFile(fname.c_str()); while (! inFile.eof()) { TString tmp; tmp.ReadToken(inFile); if (tmp.BeginsWith("#") or tmp.IsWhitespace()) { tmp.ReadLine(inFile); continue; } var.push_back(tmp); tmp.ReadToken(inFile); val.push_back(tmp); } return; } void Parsers::readlist(std::vector<TString> &var, std::string fname) { ifstream inFile(fname.c_str()); while (! inFile.eof()) { TString tmp; tmp.ReadToken(inFile); if (tmp.BeginsWith("#") or tmp.IsWhitespace()) { tmp.ReadLine(inFile); continue; } var.push_back(tmp); } return; } std::string& Parsers::replaceAll(std::string& context, const std::string& from, const std::string& to) { size_t lookHere = 0; size_t foundHere; while((foundHere = context.find(from, lookHere)) != std::string::npos) { context.replace(foundHere, from.size(), to); lookHere = foundHere + to.size(); } return context; } void Parsers::readtable(std::string var, std::vector<std::string> &col, std::string fname) { ifstream inFile(fname.c_str()); int column(-1); while (! inFile.eof()) { TString tmp; tmp.ReadLine(inFile); TRegexp table("^ *|.+| *$"), separator("^ *|[-+]+| *$"), number("^[0-9 ]+$"); if (tmp.Contains(separator)) continue; if (tmp.Contains(table)) { TObjArray *tokenArray = tmp.Tokenize("|"); TString token(dynamic_cast<TObjString*>((*tokenArray)[0])->GetString()); assert(token); if (token.Contains(number) == false) { // check if header for(int i = 0; i < tokenArray->GetEntriesFast(); ++i) { // find column token = dynamic_cast<TObjString*>((*tokenArray)[i])->GetString(); if (token.Contains(var.c_str())) { column = i; break; } } // end of header loop } else { if (column < 0) continue; // first line of table has to be header token = dynamic_cast<TObjString*>((*tokenArray)[column])->GetString(); std::string nowspcstr(token.Data()); nowspcstr.erase(remove_if(nowspcstr.begin(), nowspcstr.end(), isspace), nowspcstr.end()); col.push_back(nowspcstr); } tokenArray->Delete(); } else { continue; } } return; }
ff95c53c39e84c62ad4973f2a4365ba68dc61f9e
c275d4dff2777093de4680a462176765abc750a5
/ACMP/1457.cpp
e8094459b50cbe31ff9477d88ecf1643885811d0
[]
no_license
alex-grandson/tramvaichik
185bf99ef6d00ac0f1dbea457b466ef36f9158fc
5473b610c1f81f9adbecda14e8bd28807a54c2be
refs/heads/master
2023-05-31T06:22:54.194898
2021-06-24T01:17:13
2021-06-24T01:17:13
301,530,435
0
0
null
null
null
null
UTF-8
C++
false
false
913
cpp
1457.cpp
// Калькулятор // http://acmp.ru/asp/do/index.asp?main=task&id_course=3&id_section=24&id_topic=181&id_problem=1187 #include <cstdio> #include <algorithm> #include <climits> using namespace std; int main() { long long n; int a0, b0, c0; long long num[64][64][64]; scanf("%lld %d %d %d", &n, &a0, &b0, &c0); for (int a = 0; a <= a0; a++) for (int b = 0; b <= b0; b++) for (int c = 0; c <= c0; c++) num[a][b][c] = LLONG_MAX; num[a0][b0][c0] = n; for (int a = a0; a >= 0; a--) { for (int b = b0; b >= 0; b--) { for (int c = c0; c >= 0; c--) { if (a > 0) { num[a-1][b][c] = min(num[a-1][b][c], num[a][b][c] / 2); } if (b > 0) { num[a][b-1][c] = min(num[a][b-1][c], (num[a][b][c] + 1) / 2); } if (c > 0) { num[a][b][c-1] = min(num[a][b][c-1], (num[a][b][c] - 1) / 2); } } } } printf("%lld", num[0][0][0]); return 0; }
2ee902de45c18a5e36cc301881ad6805417f3629
010279e2ba272d09e9d2c4e903722e5faba2cf7a
/util/generic/fwd.h
5cc2da40e51f2ec91a6d94a0732ad0b119909994
[ "Apache-2.0" ]
permissive
catboost/catboost
854c1a1f439a96f1ae6b48e16644be20aa04dba2
f5042e35b945aded77b23470ead62d7eacefde92
refs/heads/master
2023-09-01T12:14:14.174108
2023-09-01T10:01:01
2023-09-01T10:22:12
97,556,265
8,012
1,425
Apache-2.0
2023-09-11T03:32:32
2017-07-18T05:29:04
Python
UTF-8
C++
false
false
3,981
h
fwd.h
#pragma once #include <util/system/defaults.h> #include <stlfwd> template <typename TCharType, typename TTraits = std::char_traits<TCharType>> class TBasicString; using TString = TBasicString<char>; using TUtf16String = TBasicString<wchar16>; using TUtf32String = TBasicString<wchar32>; template <typename TCharType, typename TTraits = std::char_traits<TCharType>> class TBasicStringBuf; using TStringBuf = TBasicStringBuf<char>; using TWtringBuf = TBasicStringBuf<wchar16>; using TUtf32StringBuf = TBasicStringBuf<wchar32>; //misc class TBuffer; //functors template <class T = void> struct TLess; template <class T = void> struct TGreater; template <class T = void> struct TEqualTo; template <class T> struct THash; //intrusive containers struct TIntrusiveListDefaultTag; template <class T, class Tag = TIntrusiveListDefaultTag> class TIntrusiveList; template <class T, class D, class Tag = TIntrusiveListDefaultTag> class TIntrusiveListWithAutoDelete; template <class T, class Tag = TIntrusiveListDefaultTag> class TIntrusiveSList; template <class T, class C> class TAvlTree; template <class TValue, class TCmp> class TRbTree; //containers template <class T, class A = std::allocator<T>> class TVector; template <class T, class A = std::allocator<T>> class TDeque; template <class T, class S = TDeque<T>> class TQueue; template <class T, class S = TVector<T>, class C = TLess<T>> class TPriorityQueue; template <class Key, class T, class HashFcn = THash<Key>, class EqualKey = TEqualTo<Key>, class Alloc = std::allocator<Key>> class THashMap; template <class Key, class T, class HashFcn = THash<Key>, class EqualKey = TEqualTo<Key>, class Alloc = std::allocator<Key>> class THashMultiMap; template <class Value, class HashFcn = THash<Value>, class EqualKey = TEqualTo<Value>, class Alloc = std::allocator<Value>> class THashSet; template <class Value, class HashFcn = THash<Value>, class EqualKey = TEqualTo<Value>, class Alloc = std::allocator<Value>> class THashMultiSet; template <class T, class A = std::allocator<T>> class TList; template <class K, class V, class Less = TLess<K>, class A = std::allocator<K>> class TMap; template <class K, class V, class Less = TLess<K>, class A = std::allocator<K>> class TMultiMap; template <class K, class L = TLess<K>, class A = std::allocator<K>> class TSet; template <class K, class L = TLess<K>, class A = std::allocator<K>> class TMultiSet; template <class T, class S = TDeque<T>> class TStack; template <size_t BitCount, typename TChunkType = ui64> class TBitMap; //autopointers class TDelete; class TDeleteArray; class TFree; class TCopyNew; template <class T, class D = TDelete> class TAutoPtr; template <class T, class D = TDelete> class THolder; template <class T, class C, class D = TDelete> class TRefCounted; template <class T> class TDefaultIntrusivePtrOps; template <class T, class Ops> class TSimpleIntrusiveOps; template <class T, class Ops = TDefaultIntrusivePtrOps<T>> class TIntrusivePtr; template <class T, class Ops = TDefaultIntrusivePtrOps<T>> class TIntrusiveConstPtr; template <class T, class Ops = TDefaultIntrusivePtrOps<T>> using TSimpleIntrusivePtr = TIntrusivePtr<T, TSimpleIntrusiveOps<T, Ops>>; template <class T, class C, class D = TDelete> class TSharedPtr; template <class T, class C = TCopyNew, class D = TDelete> class TCopyPtr; template <class TPtr, class TCopy = TCopyNew> class TCowPtr; template <typename T> class TPtrArg; template <typename T> using TArrayHolder = THolder<T, TDeleteArray>; template <typename T> using TMallocHolder = THolder<T, TFree>; template <typename T> using TArrayPtr = TAutoPtr<T, TDeleteArray>; template <typename T> using TMallocPtr = TAutoPtr<T, TFree>; //maybe namespace NMaybe { struct TPolicyUndefinedExcept; } template <class T, class Policy = ::NMaybe::TPolicyUndefinedExcept> class TMaybe; struct TGUID; template <class T> class TArrayRef; template <class T> using TConstArrayRef = TArrayRef<const T>;
a7a2a40be366105ac60ded204034885679d51da0
77c0b69b3da92c46278da9cab9979b1f8efe01c3
/mpllibs/metamonad/v1/monad.hpp
0db0ad8f7625aa641f246f94a260e5b8ed49ccb2
[ "BSL-1.0" ]
permissive
sabel83/mpllibs
6e670ab0c23422c4ab80ccbe1ba0c2531619fbf5
8e245aedcf658fe77bb29537aeba1d4e1a619a19
refs/heads/master
2021-01-21T12:31:50.702386
2016-05-13T19:45:07
2016-05-13T19:45:07
691,824
82
7
null
2014-05-04T08:29:15
2010-05-28T21:13:03
C++
UTF-8
C++
false
false
1,121
hpp
monad.hpp
#ifndef MPLLIBS_METAMONAD_V1_MONAD_HPP #define MPLLIBS_METAMONAD_V1_MONAD_HPP // Copyright Abel Sinkovics (abel@sinkovics.hu) 2011. // 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) #include <mpllibs/metamonad/v1/fwd/monad.hpp> #include <mpllibs/metamonad/v1/fwd/exception.hpp> #include <mpllibs/metamonad/v1/bind.hpp> #include <mpllibs/metamonad/v1/typeclass.hpp> #include <mpllibs/metamonad/v1/lambda_c.hpp> #include <mpllibs/metamonad/v1/name.hpp> namespace mpllibs { namespace metamonad { namespace v1 { template <class Tag> struct monad { MPLLIBS_V1_TYPECLASS_EXPECT(return_); MPLLIBS_V1_TYPECLASS_EXPECT(bind); MPLLIBS_V1_TYPECLASS_EXPECT(bind_); }; template <class Tag> struct monad_defaults : monad<typeclass_expectations> { typedef lambda_c<a, b, mpllibs::metamonad::v1::bind<Tag, a, lambda_c<s, b> > > bind_; typedef exception<> fail; }; } } } #endif
50a44046bdc1331225dfeb6130d9a883c31fc821
31ac07ecd9225639bee0d08d00f037bd511e9552
/externals/OCCTLib/inc/DrawTrSurf_Polygon3D.hxx
3b5855e4eaa9c0b39445409a99a1fba45ec6f75a
[]
no_license
litao1009/SimpleRoom
4520e0034e4f90b81b922657b27f201842e68e8e
287de738c10b86ff8f61b15e3b8afdfedbcb2211
refs/heads/master
2021-01-20T19:56:39.507899
2016-07-29T08:01:57
2016-07-29T08:01:57
64,462,604
1
0
null
null
null
null
UTF-8
C++
false
false
2,176
hxx
DrawTrSurf_Polygon3D.hxx
// This file is generated by WOK (CPPExt). // Please do not edit this file; modify original file instead. // The copyright and license terms as defined for the original file apply to // this header file considered to be the "object code" form of the original source. #ifndef _DrawTrSurf_Polygon3D_HeaderFile #define _DrawTrSurf_Polygon3D_HeaderFile #ifndef _Standard_HeaderFile #include <Standard.hxx> #endif #ifndef _Standard_DefineHandle_HeaderFile #include <Standard_DefineHandle.hxx> #endif #ifndef _Handle_DrawTrSurf_Polygon3D_HeaderFile #include <Handle_DrawTrSurf_Polygon3D.hxx> #endif #ifndef _Handle_Poly_Polygon3D_HeaderFile #include <Handle_Poly_Polygon3D.hxx> #endif #ifndef _Standard_Boolean_HeaderFile #include <Standard_Boolean.hxx> #endif #ifndef _Draw_Drawable3D_HeaderFile #include <Draw_Drawable3D.hxx> #endif #ifndef _Handle_Draw_Drawable3D_HeaderFile #include <Handle_Draw_Drawable3D.hxx> #endif #ifndef _Standard_OStream_HeaderFile #include <Standard_OStream.hxx> #endif class Poly_Polygon3D; class Draw_Display; class Draw_Drawable3D; class Draw_Interpretor; //! Used to display a 3d polygon. <br> //! <br> //! Optional display of nodes. <br> class DrawTrSurf_Polygon3D : public Draw_Drawable3D { public: Standard_EXPORT DrawTrSurf_Polygon3D(const Handle(Poly_Polygon3D)& P); Standard_EXPORT Handle_Poly_Polygon3D Polygon3D() const; Standard_EXPORT void ShowNodes(const Standard_Boolean B) ; Standard_EXPORT Standard_Boolean ShowNodes() const; Standard_EXPORT void DrawOn(Draw_Display& dis) const; //! For variable copy. <br> Standard_EXPORT virtual Handle_Draw_Drawable3D Copy() const; //! For variable dump. <br> Standard_EXPORT virtual void Dump(Standard_OStream& S) const; //! For variable whatis command. Set as a result the <br> //! type of the variable. <br> Standard_EXPORT virtual void Whatis(Draw_Interpretor& I) const; DEFINE_STANDARD_RTTI(DrawTrSurf_Polygon3D) protected: private: Handle_Poly_Polygon3D myPolygon3D; Standard_Boolean myNodes; }; // other Inline functions and methods (like "C++: function call" methods) #endif
e61a9fdebcae346c9c744100e7ab7aea2e1aa1ee
5300738078b39f20eb77045bbb8652207e5611ca
/graphs/CCC_2019_juniorEF_questions/ecoo/ecoo.cpp
d2517092e07e43ee739c81dc68226ffe4d5a2f56
[]
no_license
raiyansayeed/CompSci12
2d7d7795c791d7bc76e94a3dedafedd42d55e184
1332907a2e0bdf78f6255da51fde44fcac4b1050
refs/heads/master
2022-04-01T16:04:44.640746
2020-01-21T23:00:49
2020-01-21T23:00:49
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,729
cpp
ecoo.cpp
#include <vector> #include <cstdlib> #include <fstream> #include <unordered_set> #include <iostream> #include <map> #include <iterator> using namespace std; struct Node { Node *motherNode; string name; int numSisters = 0; int numCousins = 0; }; bool isSister(Node one, Node two) { Node temp = *(one.motherNode); Node temp2 = *(two.motherNode); if (temp.name == temp2.name) { return true; } else { return false; } } bool isCousin(Node one, Node two) { Node temp = *(one.motherNode); Node temp2 = *(two.motherNode); Node temp3 = *(temp.motherNode); Node temp4 = *(temp2.motherNode); if (temp3.name == temp4.name) { return true; } else { return false; } } void quickSort(vector<string>& a, int start, int end) { int i = start; int j = end; if (j - i >= 1) { string pivot = a[i]; //cout << "comparing " << start << " with " << pivot << endl; while (j > i) { while (a[i].compare(pivot) <= 0 && i <= end && j > i) { i++; } while (a[j].compare(pivot) >= 0 && j >= start && j >= i) { j--; } if (j > i) swap(a[i], a[j]); } swap(a[start], a[j]); quickSort(a, start, j - 1); quickSort(a, j + 1, end); } } int binarySearch(vector<string>& vec, string x, int n) { //cout << "string comparing " << x << endl; int l = 0; int r = n - 1; while (l <= r) { int m = l + (r - l) / 2; int res = x.compare(vec[m]); //cout << "string being compared: " << vec[m].curr << " with index " << m << endl; // if (x == (vec[m])) { // //cout << "t1 " << vec[m] << endl; // res = 0; // } // Check if x is present at mid if (res == 0) { ////cout << "t2" << vec[m] << endl; //wordsf.push_back(vec[m]); return m; } // If x greater, ignore left half if (res > 0) { ////cout << "t3" << vec[m] << endl; l = m + 1; } // If x is smaller, ignore right half else { ////cout << "t4" << vec[m] << endl; r = m - 1; ////cout << vec[m].compare(x) << endl; /*//cout << l << endl; //cout << r << endl; //cout << m << endl; //cout << res << endl; //cout << x << endl; //cout << x.compare(vec[m]) << endl;*/ //if(x.compare(vec[m]) == 0) return m; } } return -1; } int main(int argc, char const *argv[]) { ifstream file; file.open("ECOO_DATA20.txt"); unordered_set<string> uniqueNames; int nodeNum; file >> nodeNum; //cout << "rurr" << endl; //cout << nodeNum << endl << endl; map<string, vector<string> > list; //Node ansArr [10]; string ansArr[10]; //Node nodeArr [nodeNum]; //vector<Node> nodeVec; for (int i = 0; i < nodeNum; i++) { Node mother; Node daughter; file >> mother.name; file >> daughter.name; list[mother.name].push_back(daughter.name); } // for (auto x : list) { // cout << x.first << "-->"; // for (auto y : x.second) { // cout << y << ", "; // } // cout << endl; // } // cout << endl; for (int i = 0; i < 10; i++) { file >> ansArr[i]; //cout << ansArr[i] << endl; } //cout << endl; map<string, vector<string> >::iterator itr; for (itr = list.begin(); itr != list.end(); ++itr) { //cout << "sorting " << itr->first << endl; quickSort(itr->second, 0, itr->second.size() - 1); // for (auto y : itr->second) { // cout << y << ", "; // } // cout << endl; } //cout << endl; // for (auto x : list) { // cout << x.first << "-->"; // for (auto y : x.second) { // cout << y << ", "; // } // cout << endl; // } // cout << endl; for (int j = 0; j < 10; j++) { //cout << endl << "searching for " << ansArr[j] << endl; for (auto x : list) { //if you find one of the ten names in a child vector of mother if (binarySearch(x.second, ansArr[j], x.second.size()) != -1) { //cout << ansArr[j] << ": sisters -> " << x.second.size() - 1 << ", "; //finding mother of mother for (auto y : list) { if (binarySearch(y.second, x.first, y.second.size()) != -1) { int count = 0; for (auto w : y.second) { //w = aunt name if (w == x.first) { continue; } else { //cout << "aunt " << w << endl; //cout << "cousins -> " << y.second.size() << " "; //trying to find aunt name in list for (auto l : list) { //cout << "l: " << l.first << endl; if (l.first == w) { //cout << "cousins -> " << l.second.size() << " "; //cout << "from " << l.first << endl; count+= l.second.size(); //cout << "count: " << count << endl; //goto aa; } } //goto aa; } } cout << "Cousins: " << count; } } aa: { cout << ", Sisters: " << x.second.size() - 1 << ", " << endl; } } } } }
07e751295ceb2c2c5f0f1f9c0182691eb7007745
36183993b144b873d4d53e7b0f0dfebedcb77730
/GameDevelopment/Game Programming Gems 3/Source Code/06 Audio/07 Luchs/src/lib/atomgaud/GAButterworthFilter.h
742cd0b60ca5fcf6873b062e786999ea80f4926f
[]
no_license
alecnunn/bookresources
b95bf62dda3eb9b0ba0fb4e56025c5c7b6d605c0
4562f6430af5afffde790c42d0f3a33176d8003b
refs/heads/master
2020-04-12T22:28:54.275703
2018-12-22T09:00:31
2018-12-22T09:00:31
162,790,540
20
14
null
null
null
null
WINDOWS-1252
C++
false
false
2,273
h
GAButterworthFilter.h
// GAButterworthFilter - Interface // -------------------------------------------------------------------------------------------------------- // System: ATOMGAUD // Description: ... // ... // ... // Location: http://www.visiomedia.com/rooms/labor/src/sphinxmmos/index.htm // Version: 0202 // Author: Frank Luchs // History: // 2001-10-03 first draft // -------------------------------------------------------------------------------------------------------- // This is part of Sphinx MMOS, the open source version of Sphinx Modular Media. // Copyright © 1985-2001 Visiomedia Software Corporation, All Rights Reserved. // -------------------------------------------------------------------------------------------------------- #ifndef _atomosGAButterworthFilter_ #define _atomosGAButterworthFilter_ #ifdef ATOMOS namespace atomos { #endif // ATOMOS // forward declarations: interface IGAButterworthFilter : public IGAProcessor { virtual void SetCutoff(FLOAT32 fCut)=0; virtual void SetFrequency(FLOAT32 fFreqHz)=0; virtual void SetFMAttenuation(FLOAT32 fAttenuation)=0; virtual void Update()=0; }; // interface class ATOMGAUD_DLLCLASS CGAButterworthFilter : public CGAProcessor { public: // IObject enum { CID = CID_GAButterworthFilter }; static const CClass classCGAButterworthFilter; virtual const IClass* GetClass(); virtual void Terminate(); // virtual BOOL Initialize(IObject* pob); virtual UINT32 Process(IObject* pob); // IGAObject virtual BOOL SetParameter(CHAR8* pszName, CHAR8* pszValue); // IGAButterworthFilter virtual void SetCutoff(FLOAT32 fCut); virtual void SetFrequency(FLOAT32 fFreqHz); virtual void SetFMAttenuation(FLOAT32 fAttenuation); virtual void Update(); // CTOR / DTOR CGAButterworthFilter(); ~CGAButterworthFilter(); protected: FLOAT32 m_fFMAttenuation; FLOAT32 m_fBaseFreq; FLOAT32 m_fCurrFreq; FLOAT32 m_bw; FLOAT32 m_C; FLOAT32 m_D; FLOAT32 m_a[3]; FLOAT32 m_b[2]; FLOAT32 m_buf_x0; FLOAT32 m_buf_x1; FLOAT32 m_buf_y0; FLOAT32 m_buf_y1; }; #ifdef ATOMOS } // namespace atomos #endif // ATOMOS #endif // _atomosGAButterworthFilter_ // --------------------------------------------------------------------------------------------------------
b0ac0db5c6ca5a94713b34749be716c2c8c78fe7
9f520bcbde8a70e14d5870fd9a88c0989a8fcd61
/pitzDaily/867/alphak
6dd93d3f9089905f8023af5461d4f8c1e7ec93ed
[]
no_license
asAmrita/adjoinShapOptimization
6d47c89fb14d090941da706bd7c39004f515cfea
079cbec87529be37f81cca3ea8b28c50b9ceb8c5
refs/heads/master
2020-08-06T21:32:45.429939
2019-10-06T09:58:20
2019-10-06T09:58:20
213,144,901
1
0
null
null
null
null
UTF-8
C++
false
false
68,810
alphak
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: v1806 | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "867"; object alphak; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 0 -1 0 0 0 0]; internalField nonuniform List<scalar> 6400 ( 0.908078501098 1.47711932509 2.36004863173 2.98990244341 3.5900217945 4.18328184813 4.90230586773 5.70186071524 6.24104422832 7.02904557438 8.3532190214 9.3516311575 10.2122581291 11.1555746323 12.2799133971 13.4665067192 14.5672609185 15.6087120291 16.4966545962 17.0825502758 17.4807499251 18.0419487112 18.9557967751 20.1849153528 21.5097023114 22.7292425632 23.7854182139 24.7810151855 25.8102746252 26.8885002555 27.9603692062 28.8490084497 29.4778720789 29.9548784009 30.3298547871 30.6200013805 31.0708348858 31.7045880134 32.0584046623 32.2151766353 32.7051622199 33.6410456724 34.5606697738 35.1163914608 35.3399356349 35.3258490452 35.1381962394 34.8160394333 34.3722030358 33.8252920039 33.104121324 32.0164925292 30.5365387647 28.7526860361 27.0576237374 25.4544876478 23.3817538589 20.6571029005 17.8146467767 15.2919876504 12.746920187 10.096989311 7.70051747098 7.12444488483 9.68145119271 14.0036931021 16.6757246128 16.1532210393 13.983016969 12.2633087374 11.3626512665 11.616980248 12.257787733 12.2095432613 14.4168195787 13.907786721 15.8851963446 9.7790950671 12.8513715768 4.79834985455 3.17903649686 2.57527275563 3.22865091031 4.51854421171 4.55157171282 4.58629885833 4.90763259163 5.44890466128 6.19920751597 7.14191367345 8.26015003477 9.3796452718 10.3867652243 11.3577257551 12.3556371491 13.4878262466 14.6823052645 15.8206855611 16.9399080494 17.36958461 17.6047206949 18.1539235284 19.0574341537 20.2795496532 21.704220887 22.8779146786 23.9096724851 24.9367157529 25.9775513511 27.0284684703 28.0769283704 29.0370210676 29.6594553519 30.1283414073 30.5288298891 30.7549526748 31.241838914 31.900482716 32.2234383835 32.2766554324 32.7436027764 34.0700188775 35.209279566 35.6883394073 35.8640004748 35.7954229983 35.5404481322 35.1718878271 34.6096571206 33.9346268191 33.2629190606 32.5597114049 31.2216910409 28.9747826689 27.3622807701 25.5964459273 23.1225357917 20.4559529914 17.7851961862 15.1235085741 12.5897580857 10.3627811971 8.06104661575 7.62662954469 9.99664697077 15.0667253881 18.4639068541 16.9686120482 14.6314413317 12.597291845 11.8777290539 12.3502965384 13.562257471 13.0293130734 12.9650368923 12.5192291008 11.3977740155 9.61300581933 8.11818811578 4.19779180919 3.32976495631 2.96917431066 3.49985071157 3.87345610511 4.52814256513 5.04288438455 5.08739698867 5.33578909611 6.09228048352 7.11242308919 8.24278920913 9.38140209855 10.4305067011 11.4009111482 12.2549338725 13.2920613017 15.8135130292 17.8275857072 18.429418091 18.1581398518 17.4109902446 17.8730138589 19.1588706304 20.426534083 21.6473707272 22.8723619965 23.9925090428 25.0214800269 26.0430803743 27.0868487626 28.1082050725 29.1420018812 29.7547157836 30.038025209 30.6807403388 30.9273577787 31.1783613985 31.9770890966 32.356115206 32.4783185813 32.959936552 33.869080619 34.7594686776 35.3148359141 35.563291195 35.5890514793 35.4344852357 35.1191196236 34.6462301307 34.0344530701 33.2794346395 32.2687075237 30.8803749255 29.3239575315 27.6837381175 25.5382762159 23.0487482186 20.433788418 17.7820952606 15.1712974181 12.6915339361 10.3109941283 8.61070900607 8.96341272814 12.3115035365 16.1142848121 17.9248194367 17.7917294422 16.068868403 14.3296909504 13.6298239497 13.5554998306 12.9086178721 12.3584119745 12.4231611106 12.1780959924 11.2799386951 9.69946928892 7.2636380252 7.47955975079 3.44319451869 5.6090550414 3.90935701279 4.0951226814 4.83949471925 11.9830038153 10.4249023063 5.82205996003 6.04483336365 7.09678478042 8.2595646762 9.42031301402 10.4440277047 11.4115215096 13.0821484579 15.1464556085 16.8934898662 17.5560393297 16.9809128173 16.6703129092 17.2572053121 18.0988142 19.159730697 20.4164173629 21.7178912018 22.9681210232 24.1109660617 25.1241909825 26.1569602647 27.1450294732 28.2594450283 29.1374369041 29.9650027159 30.2241408035 30.3352504007 30.986145082 31.3242322166 31.6866454516 32.2068118941 32.683964738 33.2592746616 34.0382571781 34.8156161475 35.3668312112 35.6525996151 35.71326437 35.5850761958 35.2892203249 34.8344575963 34.2257712748 33.443060942 32.4210589766 31.1150568802 29.5771441749 27.7755368222 25.5920315076 23.0976669574 20.4724298791 17.8356845985 15.2832889545 12.9302826617 11.0051673476 10.1177723051 10.5674204684 12.3021552302 16.6166653255 19.641788306 19.5760136157 17.775869742 15.33153836 13.671010497 12.860997796 13.0622980535 14.5662063832 14.5705635382 13.3088458467 13.2384495233 16.5980645231 12.9645097995 10.9528973609 5.87699764187 7.71714973484 4.79517673724 5.11829820732 6.82877352957 11.8845712195 8.54884524504 6.3854497539 6.57385547355 7.30947493336 8.39213840532 9.56260654936 11.0197066559 13.2009958517 14.3094151262 14.8976646639 15.2502965348 15.4839307928 15.9359620818 16.7053411484 17.3726176186 18.156342239 19.2469981903 20.5037878364 21.8131270393 23.0859070277 24.2085953572 25.3163773679 26.2515979958 27.3691666477 28.2965860512 29.600006941 29.9099153726 29.9448064878 30.3886128964 30.6522859522 31.1568009118 31.7639755711 32.3594353423 32.9204657139 33.5282450448 34.2369500931 34.9367015207 35.4733955129 35.7843346121 35.8767377678 35.7757041296 35.5022327819 35.0670660127 34.4687079391 33.6841944093 32.6707563547 31.3982176895 29.8555867089 27.984696571 25.7417295247 23.2297526724 20.6213170989 18.0564072166 15.6732666574 13.6662239579 12.3484400428 12.0340254542 12.0737639149 12.9806372379 16.4639303805 19.8684483785 20.9488671711 19.6286913043 16.771005386 14.2061336082 13.8324357574 16.1354519643 17.0405404856 16.0412845034 15.1706521467 17.9077516506 20.9703828373 16.2237131224 15.3297595452 10.1478742417 9.34182106496 5.98144793531 6.45818837907 12.1780690429 11.6909324514 7.17949985072 7.03050353519 7.22812576392 7.66540718728 8.61202372758 11.1342479393 14.2132686344 14.7813790833 14.6458525836 14.1277203266 14.2082365463 14.8971507302 15.9937543825 16.6552429424 17.2871968077 18.2227369402 19.3738593501 20.6506198558 21.8997514703 23.1768398355 24.4895955466 25.4088385626 26.6441141087 27.4200166836 28.9074366399 29.43281217 30.3536358451 30.090870458 29.9645201723 30.4608676642 31.1866157708 31.9045971387 32.5597033799 33.1710813461 33.7991821255 34.4716015312 35.1213449618 35.6418480217 35.9678543902 36.086816275 36.0124363941 35.7639694254 35.3529568651 34.7752883468 34.0079174504 33.0145601686 31.7575003235 30.1939848721 28.273244355 26.0066228306 23.5237052264 21.002074603 18.6069361785 16.5209811775 14.9649087114 14.2064642062 14.2499992754 13.5140227436 15.0201503383 18.6112028685 21.3854693663 22.3501197034 21.2287740269 17.7527472701 15.4484748321 17.1770637803 19.362612308 18.8331709703 17.863163475 17.970838767 22.6463417122 24.2736123812 19.201370754 19.0047883895 12.2982482998 9.33199350903 7.26223171493 6.80930036685 12.1730428482 8.82010614788 7.51793374529 7.66657708979 7.84323808023 8.57842271199 9.17393998975 13.793353755 14.6176838267 14.7983998495 13.7998422724 13.2683644471 13.86734608 15.2695185258 15.9203936014 16.3928959587 17.2879952329 18.3180581016 19.4726742771 20.7453435194 22.1346959769 23.4653585989 24.5056298925 26.0166946825 26.7371152981 28.3022986562 28.7118228657 29.8896191276 29.9408952862 29.9035606899 29.856042525 30.4487715766 31.2869246091 32.0814019052 32.7828356854 33.4329509926 34.0816967551 34.7400523377 35.3616079938 35.870063854 36.2060730943 36.3471938774 36.2993716974 36.0800115935 35.7005304014 35.1550138213 34.4185514065 33.4518919469 32.2064485464 30.6305721361 28.6977550932 26.4647633394 24.085144143 21.7430945975 19.6050994668 17.8356134162 16.6302809411 16.0505141327 15.6362294413 15.5604389035 17.0742217901 21.4866766152 23.0549807959 22.916576385 21.5844586909 19.1645240789 18.7202866341 21.13181016 21.4799911095 20.6233013294 20.0386883566 22.0821223009 24.9183141866 26.4477033381 21.8050031017 20.6582769816 12.0851048822 9.13217439434 8.45279011428 12.4212496967 12.3527638178 8.0806836551 8.21663863721 8.40196210925 8.50224915409 9.12009508301 13.4895540976 14.4790792048 14.7046630288 14.4150456938 12.8201595915 12.9328490835 14.5201627417 15.3561394348 15.5979784703 16.2637671859 17.3043189191 18.4532530334 19.6435783075 20.9609261882 22.2144795472 23.7375615453 24.560142688 26.0264931584 27.6827440023 28.4380970772 28.4668101463 29.4628533713 29.9593208407 29.5344706344 29.8724198247 30.5997513402 31.4482513239 32.2737993053 33.0201171926 33.7099418197 34.382804493 35.0431116541 35.6534821882 36.1561532365 36.5005768843 36.6618314173 36.6421224882 36.4574449014 36.1182495164 35.6163823814 34.923364878 33.9938737322 32.7728201168 31.2159693709 29.3306493308 27.2124079729 25.0237104733 22.9168446416 20.9997665688 19.4094165973 18.3353574957 17.7885771512 17.6062385117 17.8422309363 17.84561294 22.2609882899 25.2095159772 24.6798093144 23.7405519261 22.5315504525 23.0517231208 24.1732799118 23.3496690551 22.6079663558 22.8159974133 25.2553496462 26.0186796908 26.6872835398 23.7929503544 21.6379797357 11.4604496958 9.18001759189 9.14270321096 13.4401387606 11.4931029283 8.81131079828 8.97757040115 9.29669264091 10.3617365391 9.28356148035 14.2553900453 15.0349018161 14.7706119871 13.3504143846 12.5649850585 13.0583719229 14.5618967645 15.1079647134 15.4913687595 16.2637055316 17.2884459921 18.4961128937 19.7728252506 21.4355480966 22.8525446352 23.7035243184 25.6299123732 25.9627854422 27.8054856463 28.0556601251 29.3087918492 28.9624585746 29.1042842579 29.4786447594 30.0468441572 30.8027230248 31.6433102446 32.4844137035 33.2721346132 34.0059684143 34.7089311058 35.3820565807 35.9944304506 36.4990192977 36.8531986366 37.0352006243 37.0473594726 36.9043922888 36.6149714492 36.1688486681 35.5340774774 34.6607339967 33.4948956489 32.0119880422 30.2561600627 28.3453322286 26.406673673 24.4880970921 22.6290025189 21.084399217 20.1854234341 19.9571402226 20.0741874956 20.1488542484 19.9619244029 20.5880620596 25.8774328511 26.9943050906 26.4827990413 26.6344354893 27.2438691095 26.5518425458 25.3114837117 24.9873735661 25.9939656806 27.3162762988 27.29721017 26.7895990049 25.8211049231 24.4707737764 11.0579685985 9.71427751803 10.2904617826 13.5540679396 9.7979658752 9.84344771687 9.74350947326 10.0353261883 12.8850003535 11.7284610385 15.0885483423 15.3404776195 14.8933827122 12.8064309804 12.6379842806 14.1723722484 14.7586467647 14.8864800119 15.4447821518 16.3800568985 17.393046564 18.545032285 19.6816517229 21.5422976737 23.6978887941 23.6482174503 25.5589111378 27.0390140092 27.9994648426 28.909289316 28.7798880776 29.1133438328 28.8805001912 29.4144913363 30.2119604991 31.0280486627 31.8667713642 32.7161139877 33.5393204617 34.3209341802 35.0633896434 35.7598583729 36.3842390089 36.8983991047 37.266955257 37.4730417248 37.5222883542 37.4293336069 37.2003792375 36.8235877781 36.266276431 35.479049677 34.4182238165 33.0871646474 31.5601442135 29.937608091 28.2260701035 26.3118052676 24.3685374085 23.0363116605 22.6561401059 22.9043170327 23.158784043 23.0381662793 22.5120019968 21.0658700281 20.2264571235 29.0813577127 31.3311327397 31.6952337112 30.9486640217 29.0177885048 27.6999762604 27.7453790783 28.9131359187 29.4187882296 29.4046304248 29.3075044842 29.7731553115 30.0306432563 11.1743680137 10.6295032608 13.5827278013 13.8230921726 10.051014533 10.6410844468 10.5099458265 10.9387690982 12.5392886665 15.0836230334 15.9753591144 15.6702506963 15.2063911633 12.9294992898 12.8106499791 14.6363211102 14.878960273 14.8746392799 15.4509753135 16.4789191678 17.6929301074 18.8744550229 19.8176506858 21.1623404 23.8271920525 25.1868397228 25.2685109313 27.1086836787 27.1306059912 28.8973153644 29.5610605007 29.0959565343 28.8735239065 29.5183483999 30.4014206311 31.2617995598 32.1134752495 32.9733730206 33.8244841093 34.6538267075 35.44613427 36.1780160575 36.8242083802 37.3556033723 37.7450355264 37.9820404998 38.076093435 38.0419256725 37.8843391128 37.5922958711 37.1369288771 36.4773777578 35.5905686988 34.5108094693 33.3157741338 32.0042738209 30.3651599594 28.2775163683 26.4387199928 25.8154723603 26.3453680783 27.0569860445 27.3405216215 26.9837504713 25.984351704 24.1330825468 21.6090268627 21.4031027303 33.0570803865 37.514429781 35.5438173818 32.3489244983 30.8128820591 30.8181184162 31.5283662943 32.1685453251 32.9663445601 33.8680585011 34.6647377277 35.4460788723 11.6439200502 11.5571423033 15.2583637892 14.6402164794 12.8985050221 11.9048270538 11.5102628573 12.3739280331 12.1529001978 16.0620505134 16.693114671 16.0834712586 15.4008469148 13.6358983788 13.5629637716 15.068096151 14.9330434674 14.9691592415 15.5462855531 16.4927843433 17.7940403639 19.3003342596 21.0396448042 21.2351487241 23.3245440902 25.5005435862 25.1907700966 27.2896903287 28.4192856087 28.263453831 28.8453782232 28.6757062712 29.1307971139 29.8143677362 30.6443360423 31.5151365253 32.3861207431 33.2627986984 34.134496253 35.0026382928 35.8526858609 36.6376502126 37.3172794696 37.8729405947 38.2915765781 38.5697480601 38.7189228569 38.752997876 38.6771994248 38.4855149113 38.1598065539 37.6801536918 37.0557745772 36.3392771738 35.5417733511 34.437533618 32.7287616482 30.6975925006 29.355591403 30.1248708596 32.4586031022 33.4717374529 33.7547966255 33.2722725333 32.0577374847 29.784860022 26.394995694 21.650558567 28.5816238708 38.6969341705 40.8419344046 37.0177795338 35.1693574127 34.6625709758 34.9038974073 35.7085064105 37.6391447192 39.1182344115 39.3245389901 39.7066724866 12.3186423268 12.2502172754 15.0764436258 15.2075695217 15.2618612238 13.114769565 12.6365766016 15.1256746728 12.6293999713 16.9302868622 17.242176719 16.5027052782 15.5845926928 14.3158264697 15.9402255906 16.0938896811 15.173223546 15.2030512831 15.7773603828 16.5996644782 17.719878274 19.2757709426 22.1758332751 23.1920026815 22.8500668879 25.5000197059 26.6552462563 26.8792376719 28.347904779 29.0897996738 29.1028469635 28.7165115343 29.3163436386 30.117998019 30.9403921592 31.8015582216 32.6787200014 33.5824682289 34.489081045 35.3849908463 36.2801169019 37.1285578162 37.8622640612 38.4549432798 38.9122008724 39.2443036933 39.4620065105 39.5744540856 39.5884674779 39.5091610697 39.3407087405 39.1015397462 38.8393875699 38.5788750429 38.1361793585 37.0678812695 35.8203179285 34.9533095065 33.6662414584 36.0816702899 35.9732148456 34.5612128149 32.3131361326 29.76673396 25.9624600683 21.43615661 17.8844622284 7.72086262851 4.85494666552 29.0409458493 37.6526296926 36.6115821198 32.3017599634 31.9528344065 33.2518501842 36.9544474591 42.1028135302 44.5673130457 44.8941793415 45.2456623095 13.0436749532 12.9927314602 12.6431899426 15.5851499336 15.8553757588 13.9588589741 13.6406273916 16.1688628703 13.3615099646 17.8398549609 17.7441116685 16.934025805 15.8620167033 14.6798475065 17.0716908595 16.7453381928 15.6750224411 15.6213056774 16.1213076028 16.87684674 17.7658522794 19.1206151128 22.6081628472 24.2322190665 23.1612714291 25.4407418182 27.1092513852 26.4877925057 27.935404161 28.7136865818 28.4422196315 29.0279026431 29.7202146546 30.4716423465 31.2680862826 32.134683633 33.0193080038 33.9199249401 34.8643302399 35.8148333914 36.7518592945 37.6529713471 38.4498848201 39.0990089334 39.6122326949 40.0155055352 40.3176578077 40.5171044973 40.6244130437 40.6631103576 40.6721624216 40.7358632161 40.9296804344 41.1455974226 40.8209099372 39.9315323886 40.3893440274 33.5710343431 26.6129271159 13.7628792252 1.15606416129e-07 2.3477059049e-11 8.13133047387e-14 8.29621661407e-15 6.5835391396e-16 1.85445014784e-16 2.18282735635e-15 2.23031054813e-14 2.51937128007e-13 6.58036520457e-13 1.09272093102e-09 2.86833897225e-07 0.000261740463166 0.135577743525 30.4048036501 41.9668867748 43.5618638223 48.663408138 51.6522794365 51.9944991279 13.944434375 14.0446932812 16.2380834975 16.2841715029 16.367492089 14.679141132 14.7068847214 17.0803048595 14.417076897 18.643733834 18.2317820128 17.3906945176 16.2191156553 15.1025113022 17.3872961875 17.0270256075 16.1661363081 16.1029906407 16.5141267913 17.1865843919 17.9896057708 19.079181474 22.07376181 25.0048533944 25.27402018 24.8669684327 27.2665308076 28.3085094707 27.0623568413 27.5032926622 28.3659130019 29.235960828 30.0551444572 30.8402730898 31.6480712329 32.4975769009 33.3933353466 34.3193157978 35.2695253433 36.2680844096 37.2705326819 38.2276708637 39.083198913 39.7984298778 40.3908301997 40.8903166941 41.2974283818 41.5964954076 41.7917705098 41.931248094 42.1297681069 42.5519640875 43.2471218963 43.769470572 43.0410497056 40.6232516545 26.4969740748 2.75743024219e-17 3.03288732053e-20 5.68557951245e-22 9.63744689836e-24 2.7883525046e-26 7.92388915518e-29 1.37161021491e-33 1.07287757958e-33 2.60470005067e-33 1.75577376991e-32 8.22394631219e-32 3.03792987286e-31 1.93055695889e-30 1.51158300292e-30 1.31138043828e-28 7.46394587545e-26 7.50285827801e-24 5.69340200816e-22 1.31105290691e-19 2.20691460018e-15 43.6124358231 56.028424677 53.0477377537 14.7934523722 14.9886158662 17.8734825819 17.0233697722 16.5815168434 15.3932627892 15.7320256606 17.8712416742 17.8526601131 19.6472837441 18.7914716769 17.9442709383 16.6656183648 15.6614693277 17.7213292913 17.2329110943 16.6213274614 16.585929249 16.9176150789 17.4999941682 18.2559474254 19.2642160717 21.5888980754 25.2231150114 26.5673703372 24.6731324706 26.717637593 28.3810855986 28.5454184964 27.8406317399 28.398047563 29.4152077052 30.3798198312 31.2419493724 32.03069294 32.8904275826 33.792698745 34.7471982284 35.7295904491 36.7587577448 37.8253118003 38.8562459546 39.7703624369 40.5444644178 41.2324732198 41.8816134978 42.4437684918 42.8397669978 43.0657911868 43.2797357731 43.6978683031 44.5002351531 45.68717979 46.0353197378 37.437475434 14.3823015232 1.52483320309e-23 6.17483861147e-26 1.78566336929e-27 2.59959853921e-29 2.11211887837e-32 3.52427275618e-35 2.48427603988e-36 0 0 0 0 0 0 0 0 3.45520431522e-40 1.16536888458e-37 1.74314345458e-35 1.01131600973e-32 1.41256027156e-29 7.64937489354e-25 1.1616499206e-20 9.05666773343e-14 61.6742681303 15.48261163 15.6994259091 19.9686352207 17.6041032995 16.5582456623 16.0166017006 16.472180276 18.0115327136 19.4268443041 20.7863193139 19.5027960901 18.6323967345 17.3591014843 16.4995784548 18.2595541162 17.5831013014 17.1443513299 17.1091224784 17.3566163843 17.848598816 18.5268406917 19.4584009813 21.3727254459 25.0611457425 27.5112826532 26.9320507705 26.1956503521 27.7122166478 28.3521579094 27.9353497367 28.785884876 29.8162082938 30.8275583024 31.6893146349 32.504574508 33.3221302233 34.2399789214 35.206582009 36.2282871295 37.2987325707 38.4143262473 39.524014275 40.5313032526 41.3685781119 42.1538654449 42.9824209127 43.7366639549 44.2249794517 44.4613165342 44.7307175451 45.3596204198 46.5423151845 47.8600750837 36.4630366189 1.30889012126 2.20760893186e-26 7.23999608506e-30 2.92755540176e-31 3.99163366118e-33 1.09461443098e-35 0 0 0 0 0 0 0 0 0 0 0 0 0 4.45203036549e-39 4.42406038009e-38 9.69849890914e-37 4.70266800992e-35 2.61149945477e-31 2.17371710679e-22 4.19019058989e-27 16.009705984 16.2186479705 21.9746331433 18.0454830486 16.7483532694 16.5809554777 17.263086878 17.4970058112 20.3532233078 21.5982076538 20.1815857773 19.3294394908 18.2370883344 18.2969160403 19.0145366853 18.1714547857 17.85726363 17.8193398011 17.9013147281 18.2806245592 18.8481173951 19.694807285 21.3314463624 24.8647169938 27.8768638715 28.5127474817 26.1607948444 26.7653100806 27.2955694798 27.9950239387 29.0513106118 30.2403012601 31.2701996984 32.1832139828 33.0280798927 33.8992131764 34.751951961 35.7265362602 36.7704312598 37.8686621521 39.0627459264 40.2655153429 41.3571619037 42.2162200259 43.0482126298 44.3672410491 45.9416389701 46.6383825824 46.2822937271 46.4159675947 47.169996381 48.5050387077 35.7762823538 1.16822716289e-20 1.76067136622e-25 7.89864857616e-37 7.98168223644e-34 1.30239057965e-35 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6.87824733691e-38 4.6578354888e-37 8.58943481807e-35 96.8646586469 16.448390956 16.6241252713 21.8392679889 17.5683474083 16.9848285741 17.0598276303 18.1520021256 17.5599573006 21.1418668032 22.3424643447 20.8138234717 19.9655703257 18.9194186905 20.4102377993 20.0441787184 18.9559043952 18.6753624019 18.8571209661 18.6640340685 18.8788624894 19.2659389144 19.9785875643 21.4252357909 24.6560397897 27.7014568708 29.5548526983 28.5588796132 27.9000927139 27.9996731584 28.1591770343 29.2726552908 30.7601342713 31.6946033593 32.6900126161 33.7372823045 34.4913781701 35.3493007125 36.3394527367 37.4136908338 38.5365802471 39.728417924 41.0076320461 42.2418088692 43.4038540483 44.6540381635 46.3043691112 47.7859671651 48.2779711909 48.5297719887 48.8443506508 49.3625343625 39.2754026715 5.31264130429e-20 4.84938061272e-25 6.37364990697e-29 8.65663822319e-31 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2.11642561728e-37 1.54044805125e-26 16.9341692739 17.0854903496 21.5024280284 17.2894867328 17.2798711345 17.4428804776 18.9134313754 18.039321937 21.8387321732 23.0689812317 21.4302400206 20.5853408834 19.4772718576 21.1765340338 20.9873585193 19.7924784633 19.4740822841 19.747889871 19.5713134596 19.6900881808 19.8741706414 20.3221880038 21.6771658811 24.5812532911 27.365929405 29.8033634066 29.6915948921 28.4910478664 27.6329406091 28.5752243385 29.6741521301 31.1354487131 32.4000864448 33.5409548411 34.53099596 35.1972328543 36.030713158 37.0357652769 38.1387490729 39.3091357898 40.5316517838 41.9005809151 43.4082220966 45.037960088 46.3081290221 47.2669252678 48.5406542031 49.7190220855 51.4748220694 52.6798592282 43.8339055349 4.84084935768e-19 6.42772378539e-25 1.10842801198e-28 2.27344293373e-31 5.50444266354e-33 1.84765455983e-35 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3.55672443133e-38 4.70587128647e-38 17.6469425967 17.7975961793 21.2129559715 17.5761022872 17.815639463 17.9136543693 18.9569037393 18.7441087184 22.3524836535 23.7566953517 22.068834123 21.2398232644 20.1330248203 21.8577828506 21.8203810624 20.6915914116 20.3104914552 20.603092957 20.4535405269 20.6379314489 20.7364262857 20.8177750719 22.1210227287 24.7112365957 27.1744391065 29.8157135933 30.2122412238 29.292988203 28.1456307055 28.7468631508 30.1591576901 31.3006900125 32.4738604201 33.8002262266 35.3924349959 36.1932761281 36.9509418279 37.8444987749 38.9201711708 40.1666862875 41.5018321231 43.0035408317 45.0137057197 46.8007740087 47.5367670807 48.4112514611 50.2464711708 53.6919611643 58.9649709504 48.1607411811 1.38304573774e-19 2.29748180046e-26 9.5075169481e-31 3.11720278261e-34 1.95587757491e-36 3.96440533949e-36 6.08784727642e-37 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2.62887941052e-39 1.19369689371e-38 18.7281909969 18.8426661069 21.52510392 18.4812248958 18.9263672321 18.7410524785 19.2857946116 20.0035553433 22.4475649755 24.2795212099 22.7582668196 21.9522840361 20.8828933722 22.6327692878 22.6739757977 21.7347507003 21.3085681366 21.5873055173 21.3396871607 21.6719446188 21.8873554215 21.5200683593 22.6497300241 25.0525968027 27.1866955689 29.6311187412 30.4181475859 29.970452105 29.9687976441 29.5380754515 30.4658846321 31.9264395605 33.6287129769 34.3594034725 35.6975158138 37.16556633 37.9964701816 38.9384673455 39.9317931698 41.1127665787 42.5805193329 44.6727997605 47.1878078739 48.3678487663 48.7236582632 50.1982641649 54.3838622852 60.9622734101 54.5460225552 29.9664319453 3.48080894543e-28 3.24980976744e-33 2.22362697345e-35 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 20.2430104976 20.1399910735 22.3445053677 20.2905853202 20.8005791797 19.9604595347 20.2065898127 21.8213074867 22.6895564909 24.894514859 23.5484201324 22.7322139756 21.7013825392 23.4410955617 23.5210168303 22.8779678957 22.7509436967 22.8683137918 22.3167069402 22.7879465191 23.3145984612 22.5073904453 23.0677985468 25.4867209693 27.4105961326 29.4750151882 30.5272964105 30.12398122 31.1073921444 31.0480994945 31.4190685143 31.6866629016 33.4310033177 35.4406778811 36.608789534 37.9182316942 39.0407846426 40.0309456495 41.1426649117 42.3479740121 44.1460873167 47.0845001411 49.3404381891 50.0812849926 50.9650418736 54.2912876126 61.3085538925 57.6457838357 33.4321704982 3.10633420665e-30 5.43052783593e-33 2.48656945507e-35 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 21.8381527287 21.349239979 23.2142217171 22.6840441543 22.4442761499 21.3545213679 21.2024921399 22.909418468 22.0101635076 25.3722698296 24.4215215253 23.5703732718 22.5762608073 24.2514681363 24.3016304289 23.8285462335 24.7065822341 24.3977824581 23.3987943186 23.9970227947 24.590345773 23.7540504767 23.2371886389 25.4468169192 27.5421794495 29.3433033085 30.5282802912 30.149226737 31.4648798603 32.2765643797 32.7692407072 32.4110831032 33.5434331646 35.3821144763 37.4644975902 39.0897573674 40.3071504018 41.2852642353 42.388612116 43.9216923114 46.6758493887 49.8203138533 51.6800900328 52.812915625 55.1696648529 59.9815283251 58.0158986709 32.57475805 8.36407393544e-30 1.21087616816e-32 4.24072193927e-35 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 22.6029442897 22.1651228362 23.7444480836 23.6788780289 23.4457565773 22.6483068152 22.3186007644 24.2097211742 23.0054795923 25.9767467553 25.3009488274 24.4389749506 23.501180307 25.0754475741 25.0719618895 24.6053153613 25.6359972969 25.4606866153 24.4125336778 25.1502612886 25.2860984085 24.5174841941 24.1378583817 24.3582484609 26.9314037122 28.7318282097 30.2102775703 30.0083141019 31.4493682006 32.7642997133 33.8676932211 34.0974512233 33.9279385557 35.3867650682 37.6438847861 39.9202720866 41.6852580268 42.9206222402 44.0139701595 46.3773192793 49.8252714446 52.694716937 54.3828938982 56.3498804845 60.1473407047 56.8697195018 33.066437714 21.7277932488 3.98029295154e-32 1.13360803895e-34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 22.6303689284 22.6294128175 24.0268940525 23.8382985604 24.0422291314 23.6236444006 23.2687594904 25.4840787149 24.5954414862 26.7325872223 26.2225996922 25.321407582 24.470854303 25.9281759812 25.8919576635 25.4876381739 26.3923811414 26.362399538 25.4411111456 26.1011880693 25.1675946125 25.1950979362 25.0705463306 25.3063352839 26.0840182481 27.18311973 29.1941211961 29.5964899645 30.9241842644 32.6781965491 34.2280295906 35.3680543897 35.3631426585 36.1061248588 37.813548822 40.1021169818 42.587348148 44.6234982447 46.3393797278 49.5545170496 53.0598707616 55.5109898188 56.9643831883 58.94782945 54.7288222363 36.5614306404 39.0256277826 1.38257693213e-31 3.09710166218e-34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 22.7823758909 22.9130056916 24.2349377401 22.928279813 24.2479549088 24.1176708863 23.8677683921 26.0329512865 25.3679085746 27.471160873 27.1530989825 26.1829759555 25.4900054829 26.7968474216 26.7386491579 26.4917718204 27.2448896446 27.3717566074 26.5976814974 27.4293146767 26.4281984759 26.6982856728 26.2489660814 26.5452430201 27.7413056456 28.3577182713 28.6334728678 29.0799463626 30.2994942199 32.4185183236 34.0311293084 35.4704360078 36.491534757 37.1001893906 38.9442181401 40.7454970327 43.2941720679 46.1772328534 49.1826913871 53.0055941853 56.2062009118 58.0249194087 57.9686155619 55.6666574998 55.0038727315 33.8738152794 1.16015654449e-30 2.64115314322e-33 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 23.3524853929 23.4488471896 24.4414903561 23.2142342633 24.4031729047 24.3383889674 24.2417201403 26.160435613 25.8601271529 27.9839576873 28.0335159945 26.9631321857 26.5434565431 27.6294594887 27.5250706238 27.448962145 28.0559774867 28.4537224586 27.8000356435 28.78525652 28.1151173841 28.619339551 28.4885314022 27.5072179796 28.4744238045 29.3522220493 29.5697524268 28.6435975349 29.5725851162 32.06885757 33.9241786887 34.9632466656 36.151985219 37.2375312826 39.2098186704 41.3072856419 44.0809921308 47.7203537559 52.2066123966 56.5942635967 59.1775963554 59.7404024647 58.002050906 53.1977004116 34.1528497805 44.7090831747 1.84045934128e-32 7.46310354726e-35 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 24.0874912694 25.1003824986 24.7700553546 24.0158014301 24.801096028 24.5898400748 24.5728316442 26.2313150159 26.281111756 28.1395879129 28.8544081555 27.6207885422 27.4438578072 28.2724262111 28.2222451008 28.1364121921 28.3292871701 29.4073354609 29.0368389794 29.9439847295 29.9072577273 29.8748527284 29.7962258818 29.4503947745 28.7783741307 29.4060638843 30.2789993642 27.9241441141 28.7216999164 31.1025388776 33.6720487458 35.1540794571 36.4287136364 36.9229677785 38.7866967869 41.3097263571 44.4725911065 49.1255487149 55.246826833 60.1077270603 61.7744628725 58.7245344619 57.1746215793 59.4590661655 40.2588384384 1.24748003666e-31 3.18386910565e-34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 24.5805362296 25.641128942 25.2929799698 24.6970262936 25.3156946547 24.9763781146 24.9391528106 26.3472150495 26.6628546972 28.0107761028 29.5431343226 28.2052907234 27.9273966877 28.7463711996 28.9258927818 28.7029940769 28.4972080601 30.0470650563 30.2651832931 30.9216417383 31.1120485215 31.3605400389 30.3607298092 30.3869746921 29.8883600992 30.7801156021 31.3465612262 29.1299951707 27.8046346546 29.6472714425 32.5018331074 34.8626660896 36.3339510776 37.0336385109 37.9732308991 40.5696139386 44.0923680114 50.101513785 58.1385459456 63.6865874057 63.3846350308 59.3303830063 53.3526253443 31.0829193982 49.6945811382 3.67824625389e-33 1.23609963215e-35 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 24.8536510615 25.812317881 25.6892720406 25.0858011849 25.7758150063 25.4515854078 25.3421455925 26.5721468507 27.0506240615 27.492376554 29.9478520497 28.789280366 28.1994805839 28.6083392393 29.6001777588 29.3425873424 28.9325593585 30.5398280898 30.9050825508 31.6840524958 31.9799222128 32.5242140148 32.7367600579 32.7719074532 32.4164014018 31.8540162985 32.6074485393 30.6515363451 27.3196029758 28.1061201136 30.0414262101 32.9365638422 35.3477941839 37.3432173188 37.7582743816 39.066302473 42.3753157986 49.8287577084 60.7284532974 66.2413904353 63.6102062861 64.5454723131 64.1100551653 35.7740940854 5.27015765683e-32 1.44096348013e-34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 25.0585859145 25.9100745592 25.9329401929 25.2541578336 26.1127999557 25.9760814325 25.7137961135 26.8496136547 27.5669709014 26.8306635543 30.1288060631 29.4280284852 28.5977227388 28.0915147003 30.1636246418 30.0192548395 29.6194628079 31.1566740785 31.3376415549 31.9824741649 32.8381753967 32.4971023616 34.0318122906 34.5853286956 34.6317609243 34.5148369002 34.5497234253 33.5506085713 29.0106147576 27.1059247112 28.1654546305 29.9479567337 32.6623831345 34.9073514222 37.3506033559 37.9147446363 39.5802197471 46.1566970617 63.6361083152 68.6528936225 61.0197633135 57.8393170938 62.6291592996 58.8738078734 1.78806949334e-33 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 25.195237366 25.931224466 25.6872259235 25.2596717942 26.3114996164 26.4054053735 25.9493658447 26.6511167324 28.2692632737 27.5275847951 30.1952676578 30.1242697715 29.2049244038 28.581555928 30.731369966 30.6969365079 30.5674408948 31.9774753841 32.0407060458 31.8884550574 33.7712172113 33.6847106396 34.9888906519 35.6242611806 36.1878500947 36.7816113257 37.1864961103 37.1514699028 34.6573971602 28.6161009501 27.6326272799 28.3402950989 30.6109154795 32.178751693 34.3554645614 36.1992888276 37.0100670501 38.4321034589 59.3185194687 70.0283343458 68.2517338136 57.1034038869 18.5058513602 48.1559064776 1.47205677372e-34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 25.2308697078 25.8411337362 25.2742501525 25.3806873715 26.47935309 26.5389891904 26.0950275238 26.2793515166 28.4837922111 28.2445478438 29.8735825513 30.8133295756 29.8384859788 29.5631633519 31.2901816196 31.3121150862 31.6168556777 32.728053122 33.0251118925 32.8938941528 34.6618949126 35.0559233789 36.0823338637 36.4216558471 37.739094046 38.4501300694 39.6239544015 40.664233869 41.1496130394 36.7590953945 30.3600927447 29.5110157903 28.8214019802 30.6952699533 31.9555753577 33.0389838747 33.466646866 31.8127551379 35.6984003188 61.0760372614 75.1389346583 78.4754356441 45.5152777193 3.66095864308e-33 4.48413248145e-36 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 25.2335192974 25.3822483217 25.6037456067 26.2140037987 26.708535613 26.6453627325 26.2957640285 26.3486875819 28.1542221835 28.587690406 29.356815382 31.3218698369 30.3421935572 30.2696015591 31.5224085234 31.8222495924 31.9608904976 33.0117433887 33.8953062902 34.1579782579 35.4677039697 36.0101447342 36.9109978286 37.998428452 39.0788765402 39.3344273443 41.2235873565 42.8187528956 44.5508784058 45.7018020129 40.7588932811 33.9854390868 31.6416322637 30.1142538076 29.8544727364 29.8194216579 29.1017329521 26.4514188906 16.5384057387 12.4214537974 54.521672685 76.5187332019 71.0794968419 2.73597729974e-34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 25.2086806478 25.3081994663 26.8660342337 26.8470859533 26.7781620656 26.6726991418 26.5454065 26.5624054641 27.9782636471 28.9378731838 28.4486905578 31.3074446572 30.7793846207 30.311697172 30.9243996 32.2494272942 32.0666185201 32.2096272149 34.3689221243 34.6582638845 35.8209158874 36.9407652482 36.8925737283 39.2669752631 40.2638470252 41.579807575 42.8957915945 44.4371586795 46.5093113438 48.8084499275 50.2791482996 46.4004142066 41.2527736184 37.0144870348 34.9028159516 33.7642845245 33.4948598842 32.766589106 23.4607155009 24.2911949295 0.000771844589381 34.0086373849 63.5111141954 3.45889529458e-35 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.04927011793e-39 25.0259508972 25.2579200865 25.532189238 26.4623420249 26.5082926087 26.5529559524 26.7313987689 26.6116948938 27.8216993784 29.1129812199 28.5483851437 30.6721495129 31.3409267265 30.4154740782 30.0528280742 32.4992914228 32.4130600847 32.4650839216 34.5833153611 35.009696265 35.2985583627 37.8704513398 38.1441535448 39.9555094755 40.9814225884 43.0849150727 44.2824712722 45.9217260045 48.037797273 50.3938554538 52.8599363355 55.5188204384 54.5064441992 51.9975577137 50.1508413898 49.5361987193 49.9352793242 51.4971663888 54.0682226345 60.9142552028 52.8494343337 6.81418093174e-09 1.11441011169e-33 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2.62887941052e-39 24.7088339015 24.978723347 24.8824431371 25.9467310545 26.3856073949 26.4278732482 26.6503999557 26.4055897552 27.0573167356 28.8528459777 28.7218132614 29.5836930087 31.8208366792 30.7908385503 30.6367686514 32.4338458057 32.897467466 33.0754925522 34.5527601393 35.6465913977 36.0574438838 38.2506530588 39.0871375161 40.4223031081 42.1775287796 43.710081602 45.4470135841 47.3987168463 49.281880086 51.8282400337 53.9354408766 57.5318228021 60.1604002982 62.5005206229 62.3734198817 62.7166336885 63.3994780525 66.3715321443 72.2169061678 81.4442776449 90.4776518188 60.755336657 1.505905754e-34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2.62887941052e-39 2.62887941052e-39 24.3808360468 24.6757143243 25.2438867753 26.343201515 26.5528354896 26.2979989304 26.3303030203 26.054055219 26.3240100896 28.0820027408 28.8223728387 28.0559451198 31.0929939768 31.3090798118 30.7420512547 31.3993200145 33.2660084716 33.1858573213 33.5717829546 35.9361834727 36.5135613407 38.239532078 39.8257407026 40.1190581785 42.8127040331 43.6701338947 46.5502667077 48.0340356636 49.8910892241 52.6206366157 54.9850052382 57.5168601198 60.1182596757 62.8665714825 64.6602991738 65.4622122163 66.4594246479 68.5558107558 72.2046172875 78.9569398925 96.3285067253 90.6366330653 2.0959730651e-35 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.28305708466e-39 2.62887941052e-39 2.62887941052e-39 24.0061534654 24.2656335976 25.6051218077 26.8714421352 26.2636016917 25.9447752572 25.885818757 25.6892020342 25.8050445601 27.3041472637 28.5650861991 28.3452774212 29.5089367792 31.9228833424 30.8219002455 30.7023536103 33.1644330715 33.3958573454 33.6734399969 35.8459182652 36.8130349316 37.5346454437 40.2162384843 40.9801118049 43.0247414375 44.7365017046 46.6159033338 48.2439080374 50.4527173698 52.4827382061 54.7949603164 56.9444163773 59.1024893992 61.3598839791 63.1759124459 64.0889422273 63.8201009443 62.4359996667 59.0585245252 56.6213934026 59.0621921171 78.19557714 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.59732869245e-39 2.62887941052e-39 4.21480397586e-38 4.44740029512e-38 23.5674377934 23.7434176564 24.6927517805 25.5789435229 25.5627524841 25.3635508686 25.3166390393 25.321097602 25.1953084134 26.0199481577 27.6228860472 28.3262631538 27.5935042371 30.7195476078 31.2115173698 30.5858989931 31.662551648 33.5656966117 33.6886122374 34.6420528742 37.0521510976 37.6337884263 39.9376266546 41.5942008255 42.0014929537 44.8441194622 46.5368109449 48.7622470742 50.4401981229 52.2956034463 54.9473448037 56.8331153474 58.8676933491 60.8140564443 61.9592065266 63.0006859334 62.1659468209 59.4890253512 46.9955668031 55.0519119061 7.18169791114e-08 1.66149623912e-34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3.27162048108e-38 1.10431903596e-37 1.64590270123e-37 23.1134925479 23.1998749158 24.0118498103 22.8907199311 24.4303509215 24.654277342 24.6282723156 24.7571367144 24.3482664843 24.7700308253 26.4166552135 27.8364530897 27.8843015205 28.7077167297 31.3534582558 30.7456692427 30.7723091762 33.3274108712 33.9841095434 34.17044306 36.8190553426 37.902058776 38.642814482 41.0580729569 42.4234021242 44.4161445357 46.734806831 48.5445118624 50.7378871173 52.9252145063 55.058359018 57.0878937285 59.4267036476 61.5634163761 63.2610661614 64.292257094 65.1311850104 65.011413472 61.4884604149 65.4125790746 0.000235189512726 4.92789708982e-35 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.48950645562e-38 5.3361003667e-38 7.50204360385e-37 5.08715296957e-33 22.4521736908 22.5152421919 23.8970867498 22.8617581554 23.4839021576 23.8015341467 23.8219765735 23.8860123618 23.5399132761 23.7072969184 24.7403802138 26.4935412733 27.8805628447 27.8232200762 29.4309578223 31.2777928664 30.5617080845 30.6075944398 33.7607388646 33.7773030353 34.4130261542 37.356062673 38.1660534268 40.3736860827 42.2806077421 43.7251796763 46.2387357648 48.310715402 50.8699003929 52.7446705779 55.2340663254 58.265857299 61.1197345332 63.5888269417 66.0200791686 68.4463104629 70.4137667782 71.747352991 76.7324048615 79.659813924 46.9256879263 1.31376993624e-36 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9.3987307716e-39 3.12424866084e-38 2.99748024753e-36 8.68881291444e-34 4.19559957252e-24 21.3984249603 21.4342029315 22.743596408 23.1264517313 21.8377228257 22.7939514582 22.9668283933 23.0471943181 23.0387606442 22.7338593075 23.1601806536 24.8651354774 26.4680003276 27.5145975187 27.1327260222 30.143596969 30.8849815189 30.0658176875 32.5128765559 33.5869895807 33.7878156232 36.4306667911 38.002626806 39.6673930052 41.7492007302 43.9458355088 45.7867726108 48.6826581631 50.5200918022 52.6500010322 56.4260596097 59.6370454477 62.9607943162 66.0578484782 69.909449929 73.2477290794 76.359701905 78.0323191658 80.5893256353 78.6242868222 33.6602078079 9.02676436334e-38 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3.02052655834e-38 3.74042546049e-36 8.6016450046e-34 3.23019795352e-29 6.54944198962e-19 20.3313295861 20.2962848742 20.3282219659 22.4725744133 20.7571394819 21.7918418055 22.2198749925 22.3175342866 22.4947118532 21.904783807 22.1351530931 22.467530977 24.6440716481 26.391117284 26.5087917785 26.5639356742 29.5012726543 29.8016869447 30.0395405608 32.531814794 33.5865171463 34.8006992598 37.2167133427 39.0542951412 41.1291268921 43.2486133447 45.7038260406 48.037898359 50.4758952803 53.8253661052 57.3349445445 61.0386552977 65.1945074766 69.8523970584 75.1377074905 80.6980369274 85.4302257865 90.3199893659 96.1445533655 83.380970401 3.88690731089e-06 2.19576201862e-37 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9.3987307716e-39 2.2296729462e-36 5.02154442561e-34 7.43341463564e-30 1.86079743091e-20 0.000754975165575 19.7520939853 19.6270145488 19.5203575841 22.2372835856 22.6964791294 21.6648487573 21.7010071268 21.6812756949 21.697066334 21.403322621 21.0661931306 21.5594387777 22.542441098 24.3114972889 25.7656454312 25.1691332292 26.7231561465 28.6894250433 29.1506203379 29.6646400968 32.5387520334 34.0485132747 35.462983795 38.0903591304 40.2002522948 42.3054206333 44.9725363418 47.6846468291 51.5538894938 55.2397946433 59.6376662259 64.4692190168 69.1137349204 74.7064581143 81.1806389632 87.9620526813 97.0517170358 100 100 100 56.0193740853 2.19576201862e-37 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4.68414450389e-37 1.53433649214e-34 7.33695570873e-31 1.76957956952e-23 1.64346501852e-07 75.9147542949 19.4834443473 19.1846689082 19.7182481536 21.2333322469 22.3477075036 21.7729397802 21.8014953541 21.3320307329 21.0089021168 20.9907665599 20.1157547078 20.4603523562 20.2906741918 21.8725178768 23.1274790729 24.3119340466 24.1437056407 26.519267258 27.6732003442 28.5154822187 29.2560314999 32.5291633938 34.4141063269 36.5041653467 38.8976173394 41.9411401858 44.7683718784 48.9714451725 52.6328319256 57.4068676476 61.528378479 66.3213329587 71.6921239042 78.1166861802 84.9169504681 93.6041614584 99.9999998743 100 100 100 63.6666706807 5.89494012369e-40 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2.35458901594e-38 2.18340641327e-35 5.71326116804e-32 1.52290598396e-26 7.54751375584e-13 67.0366611985 68.6201695576 19.0342915157 18.3640568037 19.2031872397 19.1016724951 20.7226839044 22.3992273471 23.1566003584 21.5195970253 20.434025332 19.9847610185 19.5746907739 18.4693140387 19.0847214246 18.2496206545 19.3900186146 21.3906050786 22.4392026398 22.5074373511 25.0678861663 26.5089298117 27.9693556094 29.1312700518 32.7424159198 34.9231758229 37.7417145011 41.4085941199 45.3062765135 48.9874611837 53.1893160941 57.1207767077 61.4780143394 67.1292818623 73.6695135789 80.0616858088 87.0327722114 97.0189076122 99.9999996522 100 100 99.999999952 99.9999999972 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4.54634589167e-37 2.39990585545e-33 1.10557946387e-28 5.8391711913e-19 51.0180250286 57.0958585856 60.0224497707 18.5390738839 17.0958415128 17.0270589374 17.1659928787 17.7668933369 20.6375365435 23.120935817 21.1729313114 19.7802928674 18.8997853143 18.4823869041 17.221205326 17.4569619315 16.5860650265 16.4113893467 15.9155538107 19.3348263895 20.4154638937 20.6797657585 23.4782070742 25.3661503541 27.5678813742 29.3161156901 33.3463100677 36.9349892983 40.6252923119 44.2831581082 48.0127469296 52.4231271135 56.8802103143 63.2230918017 68.8212092952 74.5142245791 80.4941755549 88.2236334833 96.5988534444 99.9997148861 99.9999915418 99.9999998778 99.999999622 99.9999981616 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3.34379056774e-35 9.38419483139e-31 1.12314544959e-23 0.000188903876254 53.3351277134 52.6357842555 51.2806748865 18.4093308586 15.7167484725 15.2365099393 15.3108852821 15.7435465239 17.6156036096 20.1366031477 20.5776576728 18.94956216 17.8564187966 17.0300635175 16.5982501045 14.2459715852 14.5730889109 12.2002151895 14.7028733509 12.4929180657 16.654217733 18.1458041414 18.4144016151 21.8063724768 24.9493467843 28.1501958837 31.4016614566 35.9753363119 40.0476917502 43.2529760305 48.1844304314 52.8608317039 59.1776912329 63.7000558278 68.5509306427 74.2655014736 81.2209500303 89.5835951834 98.8954196179 99.9999977843 99.9999999999 99.9999999885 90.6928834723 4.33910757261e-08 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2.51626497264e-38 3.6673070918e-33 3.64704037228e-27 8.77573903006e-13 52.4477941771 52.9690973194 46.5441458574 44.8473480581 18.5859284769 14.5950777577 13.7253378476 13.4276055515 13.7339822004 14.8916330795 17.3797035433 19.734528523 18.2696538627 16.8533550455 15.7641705292 14.7340820914 13.6192346239 9.41839367028 10.399880401 6.86525148953 10.1728592975 5.93424802444 14.1528687953 14.9377080667 17.2260766051 19.8350945634 26.6230903704 30.8165971599 35.1956087965 39.3855549643 43.9189164735 48.8610077249 54.8941672018 58.7923777127 62.6596583891 69.005663856 75.7191695655 83.4994278252 92.4243736724 99.9970464066 99.9999999953 100 62.3754942349 4.07094029051e-21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3.04387066051e-37 8.16410880194e-31 2.3689819768e-18 53.3543217921 55.7905841672 49.2736660882 43.4396203707 41.0430742644 17.5160626355 13.8565026411 12.3876402063 12.0032567761 11.854853322 12.5588013456 12.6745653941 17.0564667984 17.8912359916 16.0476787487 14.6626177298 13.3374492816 11.5630116692 8.61906131322 8.95467910542 4.68857950572 0.129088165669 5.41945888183 5.08441470646 1.89698972203 14.4006925511 18.5146230544 24.5782225009 30.1822477507 34.8228634506 39.1871035926 44.4177306802 49.9401873889 53.8001083042 57.2027247408 63.787963322 70.054521973 76.895436012 84.672203969 93.2670909154 99.9977889081 99.9999998556 99.9999999996 1.46399939042e-22 8.12862704684e-22 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3.59205322807e-34 2.11806166588e-25 49.6498233534 62.308008144 53.7173451513 46.6427892456 42.5842226612 41.2225511323 15.8673779088 13.4652600663 11.3809996941 10.9016199465 10.6273935086 10.3033059911 11.7677469976 11.9813925199 15.9543106366 15.245362596 13.7407495774 12.3496719716 9.78030271687 7.877994145 0.0578552086513 0.0909485453713 0.0246669555726 6.52990759408 0.3054728878 3.1024392876 3.51200398544 18.3761939855 24.3585826026 29.9909631439 34.3135342948 39.8600816685 44.6320242498 49.136280519 52.6104182039 58.9012339392 64.7327080992 71.029226378 77.6906826531 84.9537595446 92.6210602971 99.683423339 99.9998864319 99.9999994942 2.054431551e-21 3.61538510595e-16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6.82199359443e-39 2.67774528098e-31 0.000301859298014 66.9300502642 60.1808732538 52.7353544398 46.9400873295 43.6854919729 42.8516244332 14.8926945095 12.560311493 10.5964873973 9.76970305002 9.69089151693 9.09428724231 8.20501586033 10.3838253201 10.1639745045 14.1833562218 13.1828079595 11.7866560969 7.52367787833 5.21110404935 0.0178605236335 0.00265327113348 0.0423263373397 0.0122118814039 0.172365923885 0.121365950152 12.8614929247 18.1555100049 25.0000792071 29.7726333182 34.6509441287 39.7959851884 45.2682263354 48.9602143028 54.7889952308 60.059520699 65.9111579923 71.3184603405 77.1018916844 83.1264130678 88.9760630372 95.9047799847 99.998782924 90.757409196 2.72170691664e-21 4.74257246328e-13 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2.12766744301e-37 3.23774171943e-19 67.7322887824 65.6457374635 58.7176962691 52.8362497597 48.636005963 46.3477421553 46.0073089654 14.942385526 11.0789764515 9.39660293212 8.51317096263 8.78028712154 8.37343816908 6.3369365208 5.1625782539 7.63051620763 8.3723170498 13.4962615443 12.5712058929 7.75551907229 0.010163165664 0.000821286955153 0.00113612576323 0.0012406752372 0.0157936468689 0.0134069630535 10.3254164298 12.9147812512 21.3263206129 26.0417190072 30.5882888415 35.6684666796 41.1563498492 45.688726188 51.2285193502 56.0248452445 61.2851039902 66.0771354865 71.26662946 76.0774925976 80.6493816323 85.1288689914 91.9869484115 95.4539180562 36.7039479696 9.94669224686e-21 1.40143270983e-09 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9.03489380738e-33 61.5150303764 71.0051630978 64.1479407799 58.4519595048 54.0111003361 51.0091683962 49.3606766984 48.2450097814 15.7069872588 9.3931631734 6.60384179845 7.09550609105 7.77742254264 8.04682815259 6.50615759589 0.00465308376224 5.6992385168 5.64558731257 8.30312102492 11.5617237825 0.000371924721798 0.000403515729519 0.00017319631893 0.000274337107755 0.0009562854488 0.00241145734617 8.75746354014 9.9817099769 18.2610304432 22.8247768171 27.6260767601 32.7329779919 37.3419448894 42.2854436354 47.8249221955 52.468247656 57.4818878112 61.9237480228 66.9568739592 70.8468741692 74.31664817 77.8268899522 81.7357346553 86.4794650209 80.9572320044 0.0350228501426 1.68724081218e-19 80.654934275 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.50298336575e-38 43.357521699 76.2938012536 70.4570894438 64.1301699254 59.6323324854 56.3874185384 54.1111241762 52.9485793852 52.1534732 15.3392265159 9.43731570758 4.05775447219 4.33587696264 6.61577466334 7.56132539328 6.71747767424 0.00192409570878 8.04675450568e-05 0.00321132669433 1.34419038587 10.0840158335 0.00380232467735 3.00677225026e-05 6.8276118107e-05 0.000123850943143 0.000727905855894 6.53036956482 9.36503199478 16.4274229606 20.216787139 25.543203409 30.2109529276 34.765983911 39.2509950544 44.3280970777 48.8287827147 54.1718456353 58.3963800133 63.0910990941 66.870792327 70.6527219758 73.4358529765 76.7969152972 78.9158109633 77.913797913 77.3753044414 48.5634122711 2.51434861307e-18 99.9999999997 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.07978163824e-14 76.1950052272 74.668552516 69.7862628986 65.2187471097 62.0576103246 60.5268961839 59.2902453205 58.1811002111 57.9261874736 13.8469883176 0.0532277761792 0.000234602032897 1.14209169645 5.72843688156 7.10697099821 6.75956106152 3.89337733765 4.23479669076e-06 4.55424163942 2.32104474842 0.000520993740782 1.30676068892e-06 0.00101177165311 3.45293050538e-05 0.000122072464988 4.92537820777 9.70854707994 14.544145863 18.0395443629 22.9953651883 26.9640617275 32.0759995294 36.6747336373 40.7638572297 45.5746836528 50.8104851547 55.2296298125 59.885652832 63.7651921194 68.1391787581 71.0551123779 74.1372192134 77.7649809328 77.5022298373 77.8759586893 82.7287232104 70.2906290488 5.4451285591e-18 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.02729190783e-37 69.9052817961 73.4208210112 73.1388938989 70.0319279766 67.3392595873 65.6972646413 65.3976755855 66.3382394303 64.5464542838 65.854493179 12.1169756359 6.59235672901e-06 2.67014120951e-06 1.93687332035 6.11721372894 7.30092707439 7.27031264884 5.73819909843 3.79892402306e-06 4.93401679357e-07 7.05060291965e-06 2.7755380909e-06 1.15421640322e-06 3.80810191706e-06 1.04403527649e-05 0.621318887744 10.4458874301 12.5976683251 17.3794395559 20.91121945 24.2536484773 29.2557622173 34.1719405109 38.3459770297 42.527105539 47.3620865798 51.7727317093 56.8827271032 60.7939508541 65.1167618428 68.9467704643 73.1919111033 77.095585003 78.4285769715 77.9958815207 77.7613754601 79.1063472526 82.1689385105 1.47472408551e-17 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50.871201688 78.9388177522 76.2870900957 74.1076772818 71.6848111052 69.9827687883 69.073197041 68.7871292602 70.4666702497 69.5579073335 69.0439554506 10.2258511475 2.10656250015e-06 3.52829918717e-07 4.3420408665 7.28679780507 8.02615880431 7.70521171183 6.3951430758 0.000648304866126 2.26718677775e-07 1.00536633548e-07 4.18512223493e-07 3.79963723257e-06 1.66943988638e-06 0.000154016356819 8.66031245462 12.8137687086 16.6926637562 20.82813748 22.5374392954 26.6018227666 30.9618886935 35.5941647636 39.7431023224 43.633494921 48.3241233839 53.4516992119 57.6385282864 62.1722792529 66.4713391584 72.5227664273 76.8534837575 80.1791825382 81.1360279094 80.2115849907 75.5503674594 75.211202725 83.3203837067 2.54855266054e-17 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6.48576317326e-32 83.4875865703 79.1998343631 77.3578105234 75.4426956033 73.6442768391 72.4019249677 71.6247918164 71.1255351021 71.8355792358 71.6102066859 70.3664947192 6.84428336059 1.68790720088e-07 6.3322908679e-08 7.15678907494 8.95579841836 9.03895522011 8.32971147088 6.81004238485 2.90249374364 9.40589292764e-08 4.18349001299e-08 4.50031878376e-08 2.27044918933e-07 0.445230048092 8.62486011831 11.7138558891 14.3294577646 17.9959474527 21.4653717999 25.0513993944 29.1202176917 32.1423529948 36.6369593165 40.780170294 44.9047419396 49.6822308757 54.2288211637 59.2965962154 63.6592671931 70.7095900512 77.3541343096 81.3033592274 84.3270370043 86.5006948086 84.2503450983 80.3057159738 76.1446680967 78.7569566607 1.80213572008e-17 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 71.1560403206 73.807202094 78.9553874475 78.003939594 76.9239441748 75.6349598032 74.6289312104 73.8704331374 73.2963958193 73.7091049259 73.1957726341 72.0938221583 4.89462972962e-09 1.63063723839e-08 1.36104888447e-05 10.1454050624 10.6671741526 10.1819978411 9.04612354234 7.50816219878 4.43533652877 4.32700420889e-08 1.81487960018e-08 1.74423643382e-08 5.66494438729e-08 0.000282336077111 10.4814266546 9.71347491265 16.4983709078 18.8353476273 22.3080125948 25.6719487285 29.7629104294 33.5333327383 37.3576708334 41.6035941721 45.8542075855 50.6343082352 55.9293106359 60.5339692379 68.0529654702 75.8852584779 80.6917240044 85.992559013 90.6518664429 93.4081076451 94.5103360856 96.1829578485 97.3938531434 99.9999984175 69.1888185158 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.36657883861e-16 94.8809576664 84.9382412043 82.233524038 80.102869444 78.7616926616 77.5647888993 76.6318541994 75.8991363181 75.3373934002 75.4448804029 74.7322170995 74.2869382137 1.87489132929e-09 3.24283264566e-09 7.04999053138 10.2808150275 10.4580540327 10.2180100429 9.74606356799 8.18251952231 5.63119297851 2.10455560974e-08 8.16882825463e-09 7.77445736877e-09 1.24233976144e-08 3.89644209581 0.749141885681 14.6702791871 17.6811597026 20.430600608 23.9422680621 26.9879115617 30.625347391 34.0329336192 38.0848665943 42.3199253967 46.8588577005 52.3689605725 57.3406213081 64.4116635251 72.1346909567 78.2739307483 84.5044794242 90.9773995703 98.0398762917 99.9999446979 99.9999999992 100 100 100 99.9999999827 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 90.7747122092 87.1378170797 86.2957707069 83.3821912653 81.4043429587 79.9106213998 78.7373898662 77.8155321782 77.1300054231 76.656864523 76.2431657914 75.5532716094 75.4718356097 1.7453496571e-09 1.389202582e-09 6.0979716033 9.83673602742 10.3439560231 10.1046014275 9.42431612818 8.39318643569 6.52862300994 9.93477034453e-09 3.88912330457e-09 3.65593571958e-09 6.86017581335e-09 3.43406668834e-08 11.3851496928 16.6192849907 17.6238272079 22.1559349459 25.5370648829 27.7153110423 30.7607659771 34.5019998227 38.9222558491 42.9787095092 48.4256905028 53.7473872971 59.8003200408 66.8663734065 74.1166644279 81.0359650998 88.1061410497 97.5658305753 99.999993677 100 100 100 100 100 98.7704546685 3.46816946312e-09 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5.43553444495e-24 90.5369189849 87.3681579382 85.5431474993 83.4260702696 81.644760875 79.8750978632 78.5736322686 77.4852791916 76.6527844752 76.3737427539 75.6981859204 74.8857314064 75.2048254016 2.3487481874e-09 7.06090120677e-10 7.06785675361e-09 10.083256298 10.6398275653 10.1677166815 9.27323749242 7.91385088704 6.07026699896 2.01215725551e-08 2.12841150711e-09 1.91308662353e-09 3.8561423752e-09 3.98868389899 9.23532961595 13.8281984181 20.0166168609 23.0116590976 24.5789898933 28.65057053 32.2503667226 35.112368117 38.7742533294 44.2617052739 49.9085002079 54.7018254089 61.3215169234 69.0122721835 76.2097067087 83.2846670069 93.2315892875 99.9994832555 99.9999999996 100 100 100 100 100 6.23903677122e-16 3.20698522771e-17 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 95.8519369809 86.2642393224 87.1038873589 84.7362233318 83.0839086851 80.9364641629 78.9029796597 77.2919865999 75.8988620528 74.7267731158 73.7869589128 73.2853253638 72.9667435582 73.8646030544 6.77232572709e-09 4.4332684758e-10 4.68118290834e-10 10.5927488918 11.0355972992 10.2797573012 9.12065167502 7.44853390779 4.72672860673 2.19928583739e-09 1.38586232978e-09 1.24926370548e-09 1.99596655796e-09 4.11208199466 9.33701545079 13.1946943133 18.5915240844 22.8816272352 25.657143117 29.4794289903 30.9135292611 35.188152398 40.7729297098 45.7499687803 49.6640883862 56.3110954566 63.5341786937 69.9629003583 77.6987744746 87.2216393086 98.0227578946 99.9999970203 100 100 100 100 100 100 5.19802085067e-21 8.80884965128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2.36316900462e-36 99.9998457961 93.3442723734 88.8791534271 85.3771518012 82.7435406099 80.429522665 77.6645206226 75.7008934318 74.0988170015 72.8232516694 71.8549367228 71.4700759975 70.8910946519 71.4675448286 3.10750118633e-07 3.97683811659e-10 2.01140033768e-10 10.8805068938 11.2846539438 10.3185036398 8.91531426726 7.03202301828 4.43964104097 1.29358681656e-09 7.40319545391e-10 8.11547939778e-10 2.35409275466e-09 5.5573934653 9.87665665694 13.6774512337 16.8686775922 21.4349050221 26.066069144 28.4538795282 31.7145358372 36.6719213736 41.5793747839 44.5919298063 50.9178255304 57.8251847317 63.7663564301 71.1755796604 80.1588905924 89.3625454801 99.8272614177 99.9999999466 100 100 100 100 100 100 1.22302632502e-25 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 95.6671159876 85.9305117988 92.8627152666 89.3308494992 85.92597869 82.7047988733 79.6851142616 76.5732248076 74.2853070899 72.5052797984 71.1369646261 70.2377644037 69.917813823 69.0656747683 68.3423189413 1.03852235406e-09 4.1212444291e-07 1.28264971431e-10 10.1651860213 11.3355342451 10.1806662768 8.39296332778 5.29354220621 7.25013330152e-10 3.26544452248e-10 2.68316598335e-10 3.18946955889e-10 6.38587530254e-10 5.92977709486 11.3681876616 14.6998748287 17.0335167385 19.4771349123 23.6357954901 28.1690045446 31.8295806688 36.1739827222 39.771225001 44.8195086727 52.1888465603 58.2663088699 63.6870666829 71.5046748928 80.8105550919 91.7648247927 99.9943554898 99.9999999895 100 100 100 100 100 100 3.24496175262e-25 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 100 99.9999998975 98.1104601998 92.0377108395 87.5081404366 83.0282454143 79.0761400403 75.8282239615 73.2720726498 71.3095360133 69.7995574836 68.8973296784 68.325269045 67.4063775726 66.6949663152 6.63723087561e-10 5.27204369354 7.81685356722e-11 9.20897124177 11.3981579802 10.0165824594 8.10235730719 6.69755446761 4.79761129038 1.07313708923e-08 1.72136841371e-09 1.33099529778e-09 3.80119118024e-09 6.73910025002 11.7192675853 14.8767592866 17.3986524296 19.8040534844 21.972513417 24.5558824939 29.415683001 34.3619577075 38.731390867 44.8251704871 51.7435702545 57.4836583723 63.7615062685 72.4638926549 82.4076194841 91.9005520335 99.9958430247 99.9999999989 100 100 100 100 100 100 4.20761827882e-19 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5.51149894076e-11 82.7502303299 99.9999410818 99.2894674034 94.2549102179 88.4840028884 83.9807440062 79.0502436704 75.5046896359 72.644336279 70.4896309402 68.9661073767 68.3179014416 66.9833007198 66.0112766186 65.4138334725 1.37607938024e-10 5.9031677246 4.53218766336e-11 9.66797451868 10.718110149 8.27629583121 5.22999218936 2.30619248548 5.73726414869e-11 3.300149329e-11 2.99626878538e-11 3.79935459026e-11 8.17603706063e-11 4.89749798514 12.3035187222 15.9590238657 17.4530883699 18.7854953265 20.6705824548 23.4874903683 26.8084698578 30.8390360285 36.4646788672 44.05005496 51.1451005931 57.5211451179 62.9894441549 71.2711986451 81.0941316237 92.6145998278 99.999685819 99.9999999998 100 100 100 100 100 100 5.34574897046e-18 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 100 100 100 99.9999206092 97.095040547 90.5160885993 84.4258319308 79.4685679524 75.3028690714 71.966191437 69.5165329108 67.8740326362 66.8710129146 65.3937021955 64.5917709679 64.7412116292 1.88502399003e-10 2.8474925533 2.64554773518e-11 9.26308992616 7.95621894948 5.60830894901 3.82479438371 2.5478005481 1.57162835235e-11 1.68852697498e-11 2.45316947376e-11 5.25245633626e-11 7.46669184288e-10 6.54253106092 11.8671547483 14.171981218 15.3215815675 16.2872697075 18.3919613176 22.1654421528 25.6352251746 29.8836104887 35.2023526965 41.7728139384 48.3122264243 53.9881183976 60.7177461458 70.4299374496 81.1586301609 93.5996543041 99.9998672146 99.9999999989 100 100 100 100 100 100 7.9206854753e-17 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4.78782737821e-37 99.9999999594 100 100 99.9999999591 99.2751464802 92.4238098737 85.2219195437 79.5389900487 74.7463544482 70.7865629677 67.8566210422 65.9738669935 64.3413928621 63.0298484643 62.1064658765 62.876072317 4.05757618935 1.76026758013e-11 1.61314280449e-11 10.7633945271 9.07314968393 5.84818017894 3.83228755748 2.53754669974 1.12668864953e-11 1.06358903481e-11 1.12004995141e-11 1.35062034186e-11 2.51093047908e-11 2.65678749704 12.3590300913 14.6488021204 15.3145648162 15.6585699166 16.5340844913 18.5449534186 22.3766677476 27.7581672978 33.6719091376 39.9938030861 45.5263313449 51.2383253336 58.7884153776 68.6475467204 80.3788466185 92.6070555173 99.9987367375 99.9999999972 100 100 100 100 100 100 3.16948738933e-16 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 84.786409128 99.9999999999 100 100 100 99.9996351382 93.6122580655 85.8155602449 79.1659429188 73.6862038849 69.1748575032 65.6276043857 63.0790377796 60.8751262144 59.4498629744 58.3962620969 59.4426671619 8.41113889549 5.1957061726e-10 1.49490826891e-11 11.4166478614 10.483535169 5.64307960357 4.29925131778 2.97073895109 7.35969122947e-12 8.68042996516e-12 1.73216310179e-11 4.16112100827e-11 4.77543995967e-11 0.000114059499734 10.9923750978 14.2101222395 14.4531489461 13.5836906676 12.7894130142 14.4191392305 18.8927002314 24.7836715376 30.9705063592 37.2612238674 43.6030486905 49.3389334592 57.4174259943 66.9093381922 77.4415706556 89.4017770361 99.9710822766 99.9999999952 100 100 100 100 100 100 1.35307173658e-14 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 100 100 100 100 100 99.9999999634 96.8527780875 86.8119866058 78.6770937103 72.3779720137 67.2966276839 62.4053906652 58.9223799702 56.4564804556 55.0781063224 54.064912042 54.9405154555 9.70319733091 1.30588275502 1.93681086956e-11 1.80279155095 6.14624884308 6.42102904079 5.68084707831 5.32944165797 6.27107536555 5.23355208745e-11 1.66158587029e-11 1.23115071173e-11 1.2378449757e-11 2.47679422149e-11 9.31276981253 14.419628913 14.2018510208 11.3010513814 5.81087669997 6.4633825561 13.422180941 22.1273378478 29.0446857797 34.7386909954 40.2572664986 46.6297783107 54.7586348384 64.3370079988 74.9243540022 86.0987872929 97.163941472 99.9999988229 100 100 100 100 100 100 5.35754167165e-14 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2.38433903025e-36 100 100 100 100 100 100 99.9815989033 88.9995304035 78.6952272826 70.7262288534 64.670898292 59.707116961 55.7500112114 52.2824049651 50.0397166207 49.5376861523 49.5140832176 7.45746907392 4.22082857761 5.55778192619e-11 1.13064453565e-08 7.05521608817 9.34444502353 10.3466375176 8.73745731125 6.08986522583 6.30720872589e-11 1.48122139891e-11 9.5158204862e-12 7.90699627987e-12 9.76162015293e-12 6.5937169926 14.5364300158 15.2179341682 11.7977509053 4.1087517777 1.37467250658e-05 9.22817708226 18.5847008494 25.2078504989 30.7894335346 36.4453815251 43.0671096183 51.4371244428 61.1173223295 70.9022767397 80.3514584761 91.597887914 99.9998364099 99.9999999997 100 100 100 100 100 6.46317881555e-11 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 97.0734334067 100 100 100 100 100 100 99.999996067 92.0650083987 79.4989359288 69.4776259363 61.9600542058 55.9028210503 51.4323768871 48.0239904395 44.4120849732 44.3300398046 43.5143063259 4.89057320609 5.5483633602 2.35871029396e-10 4.5053038258e-10 9.38543094297 11.1291658364 10.5515547758 9.78311809871 8.63360808028 4.58815356168 3.38599678032e-11 9.41278068844e-12 6.43530525827e-12 6.42133918148e-12 4.32634379182e-05 16.3635224782 18.0642784672 8.75323861473 2.95883204803e-10 1.54042326276e-11 1.67141152317e-11 7.34531196243 20.7144257257 26.5594577744 31.7524579022 38.2484385554 46.6909980691 56.7797606652 65.4756963596 72.9978266366 83.2156970772 97.075013978 99.99998735 99.9999999998 100 100 100 100 1.53562917726e-07 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 100 100 100 100 100 100 100 99.9999999989 95.8153175157 81.4838739728 69.3036820054 60.2348604515 52.7223138107 46.8284956859 42.8366624581 38.803254862 38.0641088536 38.6762727475 4.53832364556 7.5789547093 8.493749786e-09 1.38507581764e-10 11.3081099967 11.7156842248 11.6729044481 11.3002702285 10.6923347604 8.71890853528 2.36604541847e-05 1.39073922155e-11 5.2008082008e-12 4.29852968432e-12 8.91241619573 20.3708915292 15.8571858104 6.91892808606e-08 1.41687376809e-09 4.09970578873e-12 9.9414807772e-13 0.000294054672395 10.8817905074 17.7825609833 22.5481846567 30.9807351857 39.8682698394 51.9962858736 59.7027116347 63.3819787807 71.0133320604 84.2295485488 93.89427923 99.9999782363 100 100 100 100 99.9999984013 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5.53022701577e-37 100 100 100 100 100 100 100 100 99.7884700762 84.083424989 69.956075401 59.0263226018 50.9314614271 43.644513876 37.6262366004 32.9359907345 32.695829135 36.7550989104 0.253134772331 0.0314065218689 5.24726468547e-09 0.0031263724001 13.0238150626 13.5088849255 13.7713907012 13.5941100512 13.3864242103 12.8065863252 8.59697163507 1.85626751473e-08 9.18486733673e-12 2.74486117001e-12 1.77420314675e-12 21.2771615258 3.81077498647e-05 7.67967306242e-08 1.64083324276e-06 8.75285275343 3.3196752807e-13 7.94664674352e-14 5.65797643909e-05 15.9013135445 22.2504437847 22.7322714702 27.2049920349 43.5252272195 56.2947307266 51.204863895 53.7205332882 63.2754738362 72.9676725325 87.068545756 99.9999873804 100 100 100 100 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 100 100 100 100 100 100 100 100 100 99.9996639357 86.2669632647 71.0199519829 58.7148266956 49.2704500438 41.8463442552 35.7089916447 31.0685403152 30.7691667986 29.5036733198 1.49164532249 1.06878904204e-08 1.68657211915e-06 6.47796300721e-11 13.9376367314 15.895530018 16.7968081339 16.6747445391 16.8402697034 15.5976947264 13.8988615278 3.69993370243 5.46606577626e-11 2.09008333569e-12 1.44833610073e-12 1.99109823032e-11 1.54816199477e-08 0.688906967421 20.1733660649 12.7892995232 7.30271079205e-14 1.42823945725e-14 3.26706555224e-15 2.48544747256e-15 2.52094382046e-15 1.34576339197e-08 3.15302893054 1.12456527058e-12 31.7166566777 38.0691245641 35.0785795961 56.5842266908 57.8819949812 74.8538933493 85.2186018567 99.9987802055 99.999993488 100 100 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8.95352773505e-39 98.4074701452 100 100 100 100 100 100 100 100 99.9999812038 87.6877203357 72.5335833308 59.7016655086 49.3376534657 41.4300122901 34.878898932 29.2089018955 25.643923014 19.0411308788 1.12325091594 6.28251194137 2.19662987392 1.28379809983e-10 1.65306149959e-12 4.59411372458e-12 5.16827186123e-09 3.34275072803e-11 2.3582563595e-11 1.2508951304e-11 6.66797721924e-12 3.3477689561e-12 1.45110657012e-12 4.93904021959e-13 1.82233408289e-13 5.11999603581e-14 2.56219365151e-14 2.4016223623e-14 1.74896936976e-14 1.09919682606e-14 7.22619316988e-15 4.30325448457e-15 2.142063957e-15 1.15831169035e-15 9.36708741087e-16 5.95730501048e-16 2.879230523e-16 1.2017365859e-16 8.51208368489e-17 3.08787663585e-17 2.7888714502e-17 1.50121070877e-18 3.75567941946e-16 2.74009598731e-21 4.05098910892e-16 1.94745304639e-24 3.29710575216e-15 4.2366153167e-30 2.67829545106e-29 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.48950645562e-38 100 6.57805281491e-18 100 100 100 100 100 100 100 99.9999789945 87.094115806 72.1586985401 59.459000786 48.502380119 39.5714688508 32.3303947121 26.6013897831 22.7566093027 12.8836819317 ) ; boundaryField { frontAndBack { type empty; } upperWall { type calculated; value uniform 0; } lowerWall { type calculated; value uniform 0; } inlet { type calculated; value uniform 5.3234808063e-36; } outlet { type calculated; value nonuniform List<scalar> 20 ( 3.06565712073e-38 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2.62887941052e-39 5.95880805214e-38 ) ; } } // ************************************************************************* //
37cc877f54e6cfe663f4b4bc3163e7335c25e8c2
4b404aa7779cdcd31da4fe1a8de890d77f81948c
/3D팀/160524 Bless 58/Engine/System/Code/Frame.h
82d1ba13a8cfa133f91b126402c3320a10a78ee9
[]
no_license
Jisean/BlessProjectBackup
dd738a535d9180a364a88f1401ac8f027654cb04
fc2fc079731bb6212ba860c40981f46afe97d603
refs/heads/master
2021-05-13T17:59:27.410635
2018-01-09T14:04:52
2018-01-09T14:04:52
116,822,909
0
0
null
null
null
null
UTF-8
C++
false
false
485
h
Frame.h
#ifndef Frame_h__ #define Frame_h__ #include "Engine_Include.h" #include "Base.h" BEGIN(Engine) class ENGINE_DLL CFrame : public CBase { private: explicit CFrame(void); virtual ~CFrame(void); public: bool Pass_Limit(const _float& fTimeDelta); public: HRESULT Ready_Frame(const _float& fLimitCall); public: static CFrame* Create(const _float& fLimitCall); private: float m_fLimitCall; float m_fAccTimes; public: virtual void Free(void); }; END #endif // Frame_h__
120ffd4bf70a022e7526f0a7ec9e2eecfe7b2112
4708cd977ff1da4b9e28a89f3cdf568af9f4a183
/jam-engine/src/Game.hpp
225bf97af66ff8a8aafd78472a322e4bf023ee82
[]
no_license
rooooooooob/orcajam4-during-jam
c97db782d519eb3e35bd9f69967f11afdc99186f
a7102c10df7b2f4fcd0f6a642adaf625902148a6
refs/heads/master
2016-09-06T05:31:36.337199
2013-09-10T06:58:27
2013-09-10T06:58:27
null
0
0
null
null
null
null
UTF-8
C++
false
false
553
hpp
Game.hpp
#ifndef JE_GAME_HPP #define JE_GAME_HPP #include <string> #include <SFML/Graphics.hpp> #include "Input.hpp" #include "TexManager.hpp" namespace je { class Level; class Game { public: Game(int width, int height, int framerate); ~Game(); int execute(); void setLevel(Level *level); void setTitle(const std::string& title); Input& getInput(); TexManager& getTexManager(); sf::RenderWindow& getWindow(); private: sf::RenderWindow window; sf::View view; Level *level; std::string title; Input input; TexManager texMan; }; } #endif
b8658753642ea45b4d9b6413953c8b0c6a45bc1d
872770c5323aa17120f2f708a1f0be09e663c9a8
/Elastos/Framework/Droid/eco/src/core/provider/MediaStore.cpp
def37c2120fc4ae802ed1e5fda6327f1f5b6dc7a
[]
no_license
xianjimli/Elastos
76a12b58db23dbf32ecbcefdaf6179510362dd21
f9f019d266a7e685544596b365cfbc05bda9cb70
refs/heads/master
2021-01-11T08:26:17.180908
2013-08-21T02:31:17
2013-08-21T02:31:17
null
0
0
null
null
null
null
UTF-8
C++
false
false
51,306
cpp
MediaStore.cpp
#include "provider/MediaStore.h" #include "content/ContentUris.h" #include "media/media/MiniThumbFile.h" #include "net/Uri.h" #include "media/media/ThumbnailUtils.h" #include "database/DatabaseUtils.h" #include "os/Environment.h" #include "graphics/CBitmapFactory.h" #include "graphics/CMatrix.h" #include "content/CContentValues.h" const AutoPtr<IUri> MediaStore::Images::Media::INTERNAL_CONTENT_URI; const AutoPtr<IUri> MediaStore::Images::Media::EXTERNAL_CONTENT_URI; const CString MediaStore::Images::Media::CONTENT_TYPE = "vnd.android.cursor.dir/image"; const CString MediaStore::Images::Media::DEFAULT_SORT_ORDER = ImageColumns_BUCKET_DISPLAY_NAME; const AutoPtr<IUri> MediaStore::Images::Thumbnails::INTERNAL_CONTENT_URI; const AutoPtr<IUri> MediaStore::Images::Thumbnails::EXTERNAL_CONTENT_URI; const CString MediaStore::Images::Thumbnails::DEFAULT_SORT_ORDER = "image_id ASC"; const CString MediaStore::Images::Thumbnails::DATA = "_data"; const CString MediaStore::Images::Thumbnails::IMAGE_ID = "image_id"; const CString MediaStore::Images::Thumbnails::KIND = "kind"; const Int32 MediaStore::Images::Thumbnails::MINI_KIND;// = 1; const Int32 MediaStore::Images::Thumbnails::FULL_SCREEN_KIND;// = 2; const Int32 MediaStore::Images::Thumbnails::MICRO_KIND;// = 3; /** * The blob raw data of thumbnail * <P>Type: DATA STREAM</P> */ const CString MediaStore::Images::Thumbnails::THUMB_DATA = "thumb_data"; /** * The width of the thumbnal * <P>Type: INTEGER (Int64)</P> */ const CString MediaStore::Images::Thumbnails::WIDTH = "width"; /** * The height of the thumbnail * <P>Type: INTEGER (Int64)</P> */ const CString MediaStore::Images::Thumbnails::HEIGHT = "height"; /** * The content:// style URI for the internal storage. */ const AutoPtr<IUri> MediaStore::Audio::Media::INTERNAL_CONTENT_URI = GetContentUri(String("internal")); /** * The content:// style URI for the "primary" external storage * volume. */ const AutoPtr<IUri> MediaStore::Audio::Media::EXTERNAL_CONTENT_URI = GetContentUri(String("external")); /** * The MIME type for this table. */ const CString MediaStore::Audio::Media::CONTENT_TYPE = "vnd.android.cursor.dir/audio"; /** * The default sort order for this table */ const CString MediaStore::Audio::Media::DEFAULT_SORT_ORDER = AudioColumns_TITLE_KEY; /** * Activity Action: Start SoundRecorder application. * <p>Input: nothing. * <p>Output: An uri to the recorded sound stored in the Media Library * if the recording was successful. * May also contain the extra EXTRA_MAX_BYTES. * @see #EXTRA_MAX_BYTES */ const CString MediaStore::Audio::Media::RECORD_SOUND_ACTION = "android.provider.MediaStore.RECORD_SOUND"; /** * The name of the Intent-extra used to define a maximum file size for * a recording made by the SoundRecorder application. * * @see #RECORD_SOUND_ACTION */ const CString MediaStore::Audio::Media::EXTRA_MAX_BYTES = "android.provider.MediaStore.extra.MAX_BYTES"; /** * The content:// style URI for the internal storage. */ const AutoPtr<IUri> MediaStore::Audio::Genres::INTERNAL_CONTENT_URI = GetContentUri(String("internal")); /** * The content:// style URI for the "primary" external storage * volume. */ const AutoPtr<IUri> MediaStore::Audio::Genres::EXTERNAL_CONTENT_URI = GetContentUri(String("external")); /** * The MIME type for this table. */ const CString MediaStore::Audio::Genres::CONTENT_TYPE = "vnd.android.cursor.dir/genre"; /** * The MIME type for entries in this table. */ const CString MediaStore::Audio::Genres::ENTRY_CONTENT_TYPE = "vnd.android.cursor.item/genre"; /** * The default sort order for this table */ const CString MediaStore::Audio::Genres::DEFAULT_SORT_ORDER = GenresColumns_NAME; /** * A subdirectory of each genre containing all member audio files. */ const CString MediaStore::Audio::Genres::Members::CONTENT_DIRECTORY = "members"; /** * The default sort order for this table */ const CString MediaStore::Audio::Genres::Members::DEFAULT_SORT_ORDER = AudioColumns_TITLE_KEY; /** * The ID of the audio file * <P>Type: INTEGER (Int64)</P> */ const CString MediaStore::Audio::Genres::Members::AUDIO_ID = "audio_id"; /** * The ID of the genre * <P>Type: INTEGER (Int64)</P> */ const CString MediaStore::Audio::Genres::Members::GENRE_ID = "genre_id"; /** * The content:// style URI for the internal storage. */ const AutoPtr<IUri> MediaStore::Audio::Playlists::INTERNAL_CONTENT_URI = GetContentUri(String("internal")); /** * The content:// style URI for the "primary" external storage * volume. */ const AutoPtr<IUri> MediaStore::Audio::Playlists::EXTERNAL_CONTENT_URI = GetContentUri(String("external")); /** * The MIME type for this table. */ const CString MediaStore::Audio::Playlists::CONTENT_TYPE = "vnd.android.cursor.dir/playlist"; /** * The MIME type for entries in this table. */ const CString MediaStore::Audio::Playlists::ENTRY_CONTENT_TYPE = "vnd.android.cursor.item/playlist"; /** * The default sort order for this table */ const CString MediaStore::Audio::Playlists::DEFAULT_SORT_ORDER = PlaylistsColumns_NAME; /** * The ID within the playlist. */ const CString MediaStore::Audio::Playlists::Members::_ID = "_id"; /** * A subdirectory of each playlist containing all member audio * files. */ const CString MediaStore::Audio::Playlists::Members::CONTENT_DIRECTORY = "members"; /** * The ID of the audio file * <P>Type: INTEGER (Int64)</P> */ const CString MediaStore::Audio::Playlists::Members::AUDIO_ID = "audio_id"; /** * The ID of the playlist * <P>Type: INTEGER (Int64)</P> */ const CString MediaStore::Audio::Playlists::Members::PLAYLIST_ID = "playlist_id"; /** * The order of the songs in the playlist * <P>Type: INTEGER (Int64)></P> */ const CString MediaStore::Audio::Playlists::Members::PLAY_ORDER = "play_order"; /** * The default sort order for this table */ const CString MediaStore::Audio::Playlists::Members::DEFAULT_SORT_ORDER = PLAY_ORDER; /** * The content:// style URI for the internal storage. */ const AutoPtr<IUri> MediaStore::Audio::Artists::INTERNAL_CONTENT_URI = GetContentUri(String("internal")); /** * The content:// style URI for the "primary" external storage * volume. */ const AutoPtr<IUri> MediaStore::Audio::Artists::EXTERNAL_CONTENT_URI = GetContentUri(String("external")); /** * The MIME type for this table. */ const CString MediaStore::Audio::Artists::CONTENT_TYPE = "vnd.android.cursor.dir/artists"; /** * The MIME type for entries in this table. */ const CString MediaStore::Audio::Artists::ENTRY_CONTENT_TYPE = "vnd.android.cursor.item/artist"; /** * The default sort order for this table */ const CString MediaStore::Audio::Artists::DEFAULT_SORT_ORDER = ArtistColumns_ARTIST_KEY; /** * The content:// style URI for the internal storage. */ const AutoPtr<IUri> MediaStore::Audio::Albums::INTERNAL_CONTENT_URI = GetContentUri(String("internal")); /** * The content:// style URI for the "primary" external storage * volume. */ const AutoPtr<IUri> MediaStore::Audio::Albums::EXTERNAL_CONTENT_URI = GetContentUri(String("external")); /** * The MIME type for this table. */ const CString MediaStore::Audio::Albums::CONTENT_TYPE = "vnd.android.cursor.dir/albums"; /** * The MIME type for entries in this table. */ const CString MediaStore::Audio::Albums::ENTRY_CONTENT_TYPE = "vnd.android.cursor.item/album"; /** * The default sort order for this table */ const CString MediaStore::Audio::Albums::DEFAULT_SORT_ORDER = AlbumColumns_ALBUM_KEY; const CString MediaStore::Video::DEFAULT_SORT_ORDER = MediaColumns_DISPLAY_NAME; /** * The content:// style URI for the internal storage. */ const AutoPtr<IUri> MediaStore::Video::Media::INTERNAL_CONTENT_URI = GetContentUri(String("internal")); /** * The content:// style URI for the "primary" external storage * volume. */ const AutoPtr<IUri> MediaStore::Video::Media::EXTERNAL_CONTENT_URI = GetContentUri(String("external")); /** * The MIME type for this table. */ const CString MediaStore::Video::Media::CONTENT_TYPE = "vnd.android.cursor.dir/video"; /** * The default sort order for this table */ const CString MediaStore::Video::Media::DEFAULT_SORT_ORDER = MediaColumns_TITLE; /** * The content:// style URI for the internal storage. */ const AutoPtr<IUri> MediaStore::Video::Thumbnails::INTERNAL_CONTENT_URI = GetContentUri(String("internal")); /** * The content:// style URI for the "primary" external storage * volume. */ const AutoPtr<IUri> MediaStore::Video::Thumbnails::EXTERNAL_CONTENT_URI = GetContentUri(String("external")); /** * The default sort order for this table */ const CString MediaStore::Video::Thumbnails::DEFAULT_SORT_ORDER = "video_id ASC"; /** * The data stream for the thumbnail * <P>Type: DATA STREAM</P> */ const CString MediaStore::Video::Thumbnails::DATA = "_data"; /** * The original image for the thumbnal * <P>Type: INTEGER (ID from Video table)</P> */ const CString MediaStore::Video::Thumbnails::VIDEO_ID = "video_id"; /** * The kind of the thumbnail * <P>Type: INTEGER (One of the values below)</P> */ const CString MediaStore::Video::Thumbnails::KIND = "kind"; const Int32 MediaStore::Video::Thumbnails::MINI_KIND;// = 1; const Int32 MediaStore::Video::Thumbnails::FULL_SCREEN_KIND;// = 2; const Int32 MediaStore::Video::Thumbnails::MICRO_KIND;// = 3; /** * The width of the thumbnal * <P>Type: INTEGER (Int64)</P> */ const CString MediaStore::Video::Thumbnails::WIDTH = "width"; /** * The height of the thumbnail * <P>Type: INTEGER (Int64)</P> */ const CString MediaStore::Video::Thumbnails::HEIGHT = "height"; const Int32 MediaStore::InternalThumbnails::DEFAULT_GROUP_ID;// = 0; const Int32 MediaStore::InternalThumbnails::MINI_KIND;// = 1; const Int32 MediaStore::InternalThumbnails::FULL_SCREEN_KIND;// = 2; const Int32 MediaStore::InternalThumbnails::MICRO_KIND;// = 3; //const ArrayOf_<CString, 2> MediaStore::InternalThumbnails::PROJECTION[2];// = {"_id", "_data"}; const CString MediaStore::AUTHORITY = "media"; /** * Activity Action: Launch a music player. * The activity should be able to play, browse, or manipulate music files stored on the device. */ //@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) const CString MediaStore::INTENT_ACTION_MUSIC_PLAYER = "android.intent.action.MUSIC_PLAYER"; /** * Activity Action: Perform a search for media. * Contains at least the {@link android.app.SearchManager#QUERY} extra. * May also contain any combination of the following extras: * EXTRA_MEDIA_ARTIST, EXTRA_MEDIA_ALBUM, EXTRA_MEDIA_TITLE, EXTRA_MEDIA_FOCUS * * @see android.provider.MediaStore#EXTRA_MEDIA_ARTIST * @see android.provider.MediaStore#EXTRA_MEDIA_ALBUM * @see android.provider.MediaStore#EXTRA_MEDIA_TITLE * @see android.provider.MediaStore#EXTRA_MEDIA_FOCUS */ //@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) const CString MediaStore::INTENT_ACTION_MEDIA_SEARCH = "android.intent.action.MEDIA_SEARCH"; /** * An intent to perform a search for music media and automatically play content from the * result when possible. This can be fired, for example, by the result of a voice recognition * command to listen to music. * <p> * Contains the {@link android.app.SearchManager#QUERY} extra, which is a string * that can contain any type of unstructured music search, like the name of an artist, * an album, a song, a genre, or any combination of these. * <p> * Because this intent includes an open-ended unstructured search string, it makes the most * sense for apps that can support large-scale search of music, such as services connected * to an online database of music which can be streamed and played on the device. */ const CString MediaStore::INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH = "android.media.action.MEDIA_PLAY_FROM_SEARCH"; /** * The name of the Intent-extra used to define the artist */ const CString MediaStore::EXTRA_MEDIA_ARTIST = "android.intent.extra.artist"; /** * The name of the Intent-extra used to define the album */ const CString MediaStore::EXTRA_MEDIA_ALBUM = "android.intent.extra.album"; /** * The name of the Intent-extra used to define the song title */ const CString MediaStore::EXTRA_MEDIA_TITLE = "android.intent.extra.title"; /** * The name of the Intent-extra used to define the search focus. The search focus * indicates whether the search should be for things related to the artist, album * or song that is identified by the other extras. */ const CString MediaStore::EXTRA_MEDIA_FOCUS = "android.intent.extra.focus"; /** * The name of the Intent-extra used to control the orientation of a ViewImage or a MovieView. * This is an Int32 property that overrides the activity's requestedOrientation. * @see android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED */ const CString MediaStore::EXTRA_SCREEN_ORIENTATION = "android.intent.extra.screenOrientation"; /** * The name of an Intent-extra used to control the UI of a ViewImage. * This is a boolean property that overrides the activity's default fullscreen state. */ const CString MediaStore::EXTRA_FULL_SCREEN = "android.intent.extra.fullScreen"; /** * The name of an Intent-extra used to control the UI of a ViewImage. * This is a boolean property that specifies whether or not to show action icons. */ const CString MediaStore::EXTRA_SHOW_ACTION_ICONS = "android.intent.extra.showActionIcons"; /** * The name of the Intent-extra used to control the onCompletion behavior of a MovieView. * This is a boolean property that specifies whether or not to finish the MovieView activity * when the movie completes playing. The default value is true, which means to automatically * exit the movie player activity when the movie completes playing. */ const CString MediaStore::EXTRA_FINISH_ON_COMPLETION = "android.intent.extra.finishOnCompletion"; /** * The name of the Intent action used to launch a camera in still image mode. */ const CString MediaStore::INTENT_ACTION_STILL_IMAGE_CAMERA = "android.media.action.STILL_IMAGE_CAMERA"; /** * The name of the Intent action used to launch a camera in video mode. */ const CString MediaStore::INTENT_ACTION_VIDEO_CAMERA = "android.media.action.VIDEO_CAMERA"; /** * Standard Intent action that can be sent to have the camera application * capture an image and return it. * <p> * The caller may pass an extra EXTRA_OUTPUT to control where this image will be written. * If the EXTRA_OUTPUT is not present, then a small sized image is returned as a Bitmap * object in the extra field. This is useful for applications that only need a small image. * If the EXTRA_OUTPUT is present, then the full-sized image will be written to the Uri * value of EXTRA_OUTPUT. * @see #EXTRA_OUTPUT * @see #EXTRA_VIDEO_QUALITY */ const CString MediaStore::ACTION_IMAGE_CAPTURE = "android.media.action.IMAGE_CAPTURE"; /** * Standard Intent action that can be sent to have the camera application * capture an video and return it. * <p> * The caller may pass in an extra EXTRA_VIDEO_QUALITY to control the video quality. * <p> * The caller may pass in an extra EXTRA_OUTPUT to control * where the video is written. If EXTRA_OUTPUT is not present the video will be * written to the standard location for videos, and the Uri of that location will be * returned in the data field of the Uri. * @see #EXTRA_OUTPUT */ const CString MediaStore::ACTION_VIDEO_CAPTURE = "android.media.action.VIDEO_CAPTURE"; /** * The name of the Intent-extra used to control the quality of a recorded video. This is an * integer property. Currently value 0 means low quality, suitable for MMS messages, and * value 1 means high quality. In the future other quality levels may be added. */ const CString MediaStore::EXTRA_VIDEO_QUALITY = "android.intent.extra.videoQuality"; /** * Specify the maximum allowed size. */ const CString MediaStore::EXTRA_SIZE_LIMIT = "android.intent.extra.sizeLimit"; /** * Specify the maximum allowed recording duration in seconds. */ const CString MediaStore::EXTRA_DURATION_LIMIT = "android.intent.extra.durationLimit"; /** * The name of the Intent-extra used to indicate a content resolver Uri to be used to * store the requested image or video. */ const CString MediaStore::EXTRA_OUTPUT = "output"; /** * The string that is used when a media attribute is not known. For example, * if an audio file does not have any meta data, the artist and album columns * will be set to this value. */ const CString MediaStore::UNKNOWN_STRING = "<unknown>"; /** * Name of current volume being scanned by the media scanner. */ const CString MediaStore::MEDIA_SCANNER_VOLUME = "volume"; /** * Name of the file signaling the media scanner to ignore media in the containing directory * and its subdirectories. Developers should use this to avoid application graphics showing * up in the Gallery and likewise prevent application sounds and music from showing up in * the Music app. */ const CString MediaStore::MEDIA_IGNORE_FILENAME = ".nomedia"; const CString MediaStore::TAG = "MediaStore"; const String MediaStore::CONTENT_AUTHORITY_SLASH = String("content://") + AUTHORITY + String("/"); AutoPtr<IBitmap> MediaStore::InternalThumbnails::GetMiniThumbFromFile( /* [in] */ ICursor* c, /* [in] */ IUri* baseUri, /* [in] */ IContentResolver* cr, /* [in] */ IBitmapFactoryOptions* options) { AutoPtr<IBitmap> bitmap = NULL; AutoPtr<IUri> thumbUri = NULL; //try { Int64 thumbId; c->GetInt64(0, &thumbId); String filePath; c->GetString(1, &filePath); thumbUri = ContentUris::WithAppendedId(baseUri, thumbId); AutoPtr<IParcelFileDescriptor> pfdInput; cr->OpenFileDescriptor(thumbUri, String("r"), (IParcelFileDescriptor**)&pfdInput); AutoPtr<IBitmapFactory> factory; ASSERT_SUCCEEDED(CBitmapFactory::AcquireSingleton( (IBitmapFactory**)&factory)); AutoPtr<IFileDescriptor> fd; pfdInput->GetFileDescriptor((IFileDescriptor**)&fd); factory->DecodeFileDescriptor( fd, NULL, options, (IBitmap**)&bitmap); pfdInput->Close(); /*} catch (FileNotFoundException ex) { Log.e(TAG, "couldn't open thumbnail " + thumbUri + "; " + ex); } catch (IOException ex) { Log.e(TAG, "couldn't open thumbnail " + thumbUri + "; " + ex); } catch (OutOfMemoryError ex) { Log.e(TAG, "failed to allocate memory for thumbnail " + thumbUri + "; " + ex); }*/ return bitmap; } /** * This method cancels the thumbnail request so clients waiting for getThumbnail will be * interrupted and return immediately. Only the original process which made the getThumbnail * requests can cancel their own requests. * * @param cr ContentResolver * @param origId original image or video id. use -1 to cancel all requests. * @param groupId the same groupId used in getThumbnail * @param baseUri the base URI of requested thumbnails */ void MediaStore::InternalThumbnails::CancelThumbnailRequest( /* [in] */ IContentResolver* cr, /* [in] */ Int64 origId, /* [in] */ IUri* baseUri, /* [in] */ Int64 groupId) { AutoPtr<IUri> cancelUri; AutoPtr<IUriBuilder> ub; baseUri->BuildUpon((IUriBuilder**)&ub); ub->AppendQueryParameter(String("cancel"), String("1")); ub->AppendQueryParameter(String("orig_id"), String::FromInt64(origId)); ub->AppendQueryParameter(String("group_id"), String::FromInt64(groupId)); ub->Build((IUri**)&cancelUri); AutoPtr<ICursor> c = NULL; //try { cr->Query(cancelUri, *PROJECTION, String(""), *PROJECTION, String(""), (ICursor**)&c); //} //finally { if (c != NULL) c->Close(); //} } /** * This method ensure thumbnails associated with origId are generated and decode the byte * stream from database (MICRO_KIND) or file (MINI_KIND). * * Special optimization has been done to avoid further IPC communication for MICRO_KIND * thumbnails. * * @param cr ContentResolver * @param origId original image or video id * @param kind could be MINI_KIND or MICRO_KIND * @param options this is only used for MINI_KIND when decoding the Bitmap * @param baseUri the base URI of requested thumbnails * @param groupId the id of group to which this request belongs * @return Bitmap bitmap of specified thumbnail kind */ AutoPtr<IBitmap> MediaStore::InternalThumbnails::GetThumbnail( /* [in] */ IContentResolver* cr, /* [in] */ Int64 origId, /* [in] */ Int64 groupId, /* [in] */ Int32 kind, /* [in] */ IBitmapFactoryOptions* options, /* [in] */ IUri* baseUri, /* [in] */ Boolean isVideo) { AutoPtr<IBitmap> bitmap = NULL; String filePath; // Log.v(TAG, "getThumbnail: origId="+origId+", kind="+kind+", isVideo="+isVideo); // If the magic is non-zero, we simply return thumbnail if it does exist. // querying MediaProvider and simply return thumbnail. AutoPtr<IMiniThumbFile> thumbFile; //CMiniThumbFile::New(baseUri, (IMiniThumbFile**)&thumbFile); Int64 magic; thumbFile->GetMagic(origId, &magic); if (magic != 0) { if (kind == MICRO_KIND) { //synchronized (sThumbBufLock) { if (sThumbBuf == NULL) { sThumbBuf = ArrayOf<Byte>::Alloc(MiniThumbFile::BYTES_PER_MINTHUMB); } ArrayOf<Byte>* miniThumb; thumbFile->GetMiniThumbFromFile(origId, *sThumbBuf, &miniThumb); if (miniThumb != NULL) { AutoPtr<IBitmapFactory> factory; ASSERT_SUCCEEDED(CBitmapFactory::AcquireSingleton( (IBitmapFactory**)&factory)); factory->DecodeByteArrayEx(*sThumbBuf, 0, sThumbBuf->GetLength(), (IBitmap**)&bitmap); if (bitmap == NULL) { //Log.w(TAG, "couldn't decode byte array."); } } //} return bitmap; } else if (kind == MINI_KIND) { String column = isVideo ? String("video_id=") : String("image_id="); AutoPtr<ICursor> c = NULL; //try { //cr->Query(baseUri, PROJECTION, column + origId, NULL, NULL, (ICursor**)&c); Boolean bSucceeded; if (c != NULL && (c->MoveToFirst(&bSucceeded), bSucceeded)) { bitmap = GetMiniThumbFromFile(c, baseUri, cr, options); if (bitmap != NULL) { return bitmap; } } //} finally { if (c != NULL) c->Close(); //} } } AutoPtr<ICursor> c = NULL; //try { AutoPtr<IUri> blockingUri; AutoPtr<IUriBuilder> ub; baseUri->BuildUpon((IUriBuilder**)&ub); ub->AppendQueryParameter(String("blocking"), String("1")); ub->AppendQueryParameter(String("orig_id"), String::FromInt64(origId)); ub->AppendQueryParameter(String("group_id"), String::FromInt64(groupId)); ub->Build((IUri**)&blockingUri); //cr->Query(blockingUri, PROJECTION, NULL, NULL, NULL, (ICursor**)&c); // This happens when original image/video doesn't exist. if (c == NULL) return NULL; // Assuming thumbnail has been generated, at least original image exists. if (kind == MICRO_KIND) { //synchronized (sThumbBufLock) { if (sThumbBuf == NULL) { sThumbBuf = ArrayOf<Byte>::Alloc(MiniThumbFile::BYTES_PER_MINTHUMB); } ArrayOf<Byte>* miniThumb; thumbFile->GetMiniThumbFromFile(origId, *sThumbBuf, &miniThumb); if (miniThumb != NULL) { AutoPtr<IBitmapFactory> factory; ASSERT_SUCCEEDED(CBitmapFactory::AcquireSingleton( (IBitmapFactory**)&factory)); factory->DecodeByteArrayEx(*sThumbBuf, 0, sThumbBuf->GetLength(), (IBitmap**)&bitmap); if (bitmap == NULL) { //Log.w(TAG, "couldn't decode byte array."); } } //} } else if (kind == MINI_KIND) { Boolean bSucceeded; if ((c->MoveToFirst(&bSucceeded), bSucceeded)) { bitmap = GetMiniThumbFromFile(c, baseUri, cr, options); } } else { //throw new IllegalArgumentException("Unsupported kind: " + kind); } // We probably run out of space, so create the thumbnail in memory. if (bitmap == NULL) { /*Log.v(TAG, "Create the thumbnail in memory: origId=" + origId + ", kind=" + kind + ", isVideo="+isVideo);*/ AutoPtr<IUri> uri; AutoPtr<IUriBuilder> ub; baseUri->BuildUpon((IUriBuilder**)&ub); ub->AppendPath(String::FromInt64(origId)); String str; //ub->ToString(&str); //str.ReplaceFirst("thumbnails", "media"); Uri::Parse(str, (IUri**)&uri); if (filePath == NULL) { if (c != NULL) c->Close(); //cr->Query(uri, PROJECTION, NULL, NULL, NULL, (ICursor**)&c); Boolean bSucceeded; if (c == NULL || !(c->MoveToFirst(&bSucceeded), bSucceeded)) { return NULL; } c->GetString(1, &filePath); } if (isVideo) { bitmap = ThumbnailUtils::CreateVideoThumbnail(filePath, kind); } else { bitmap = ThumbnailUtils::CreateImageThumbnail(filePath, kind); } } //} catch (SQLiteException ex) { //Log.w(TAG, ex); //} finally { if (c != NULL) c->Close(); //} return bitmap; } AutoPtr<ICursor> MediaStore::Images::Media::Query( /* [in] */ IContentResolver* cr, /* [in] */ IUri* uri, /* [in] */ ArrayOf<String>* projection) { AutoPtr<ICursor> c; //cr->Query(uri, projection, NULL, NULL, DEFAULT_SORT_ORDER, (ICursor**)&c); return c; } AutoPtr<ICursor> MediaStore::Images::Media::Query( /* [in] */ IContentResolver* cr, /* [in] */ IUri* uri, /* [in] */ ArrayOf<String>* projection, /* [in] */ String where, /* [in] */ String orderBy) { AutoPtr<ICursor> c; /*cr->Query(uri, projection, where, NULL, orderBy == NULL ? DEFAULT_SORT_ORDER : orderBy, (ICursor**)&c);*/ return c; } AutoPtr<ICursor> MediaStore::Images::Media::Query( /* [in] */ IContentResolver* cr, /* [in] */ IUri* uri, /* [in] */ ArrayOf<String>* projection, /* [in] */ String selection, /* [in] */ ArrayOf<String>* selectionArgs, /* [in] */ String orderBy) { AutoPtr<ICursor> c; /*cr->Query(uri, projection, selection, selectionArgs, orderBy == NULL ? DEFAULT_SORT_ORDER : orderBy, (ICursor**)&c);*/ return c; } /** * Retrieves an image for the given url as a {@link Bitmap}. * * @param cr The content resolver to use * @param url The url of the image * @throws FileNotFoundException * @throws IOException */ AutoPtr<IBitmap> MediaStore::Images::Media::GetBitmap( /* [in] */ IContentResolver* cr, /* [in] */ IUri* url) { AutoPtr<IInputStream> input; cr->OpenInputStream(url, (IInputStream**)&input); AutoPtr<IBitmapFactory> factory; ASSERT_SUCCEEDED(CBitmapFactory::AcquireSingleton( (IBitmapFactory**)&factory)); AutoPtr<IBitmap> bitmap; factory->DecodeStreamEx(input, (IBitmap**)&bitmap); input->Close(); return bitmap; } /** * Insert an image and create a thumbnail for it. * * @param cr The content resolver to use * @param imagePath The path to the image to insert * @param name The name of the image * @param description The description of the image * @return The URL to the newly created image * @throws FileNotFoundException */ String MediaStore::Images::Media::InsertImage( /* [in] */ IContentResolver* cr, /* [in] */ String imagePath, /* [in] */ String name, /* [in] */ String description) { // Check if file exists with a FileInputStream AutoPtr<IFileInputStream> stream; CFileInputStream::New(imagePath, (IFileInputStream**)&stream); //try { AutoPtr<IBitmapFactory> factory; ASSERT_SUCCEEDED(CBitmapFactory::AcquireSingleton( (IBitmapFactory**)&factory)); AutoPtr<IBitmap> bm; factory->DecodeFileEx(imagePath, (IBitmap**)&bm); String ret = InsertImage(cr, bm, name, description); bm->Recycle(); //} finally { //try { stream->Close(); /*} catch (IOException e) { }*/ //} return ret; } AutoPtr<IBitmap> MediaStore::Images::Media::StoreThumbnail( /* [in] */ IContentResolver* cr, /* [in] */ IBitmap* source, /* [in] */ Int64 id, /* [in] */ Float width, /* [in] */ Float height, /* [in] */ Int32 kind) { // create the matrix to scale it AutoPtr<IMatrix> matrix; CMatrix::New((IMatrix**)&matrix); Int32 w, h; source->GetWidth(&w); source->GetHeight(&h); Float scaleX = width / w; Float scaleY = height / h; matrix->SetScaleEx(scaleX, scaleY); AutoPtr<IBitmapFactory> factory; ASSERT_SUCCEEDED(CBitmapFactory::AcquireSingleton( (IBitmapFactory**)&factory)); AutoPtr<IBitmap> thumb; factory->CreateBitmapEx2(source, 0, 0, w, h, matrix, TRUE, (IBitmap**)&thumb); AutoPtr<IContentValues> values; CContentValues::New(/*4, */(IContentValues**)&values); values->PutInt32(String(Images::Thumbnails::KIND), kind); values->PutInt32(String(Images::Thumbnails::IMAGE_ID), (Int32)id); values->PutInt32(String(Images::Thumbnails::HEIGHT), (thumb->GetHeight(&h), h)); values->PutInt32(String(Images::Thumbnails::WIDTH), (thumb->GetWidth(&w), w)); AutoPtr<IUri> url; cr->Insert(Images::Thumbnails::EXTERNAL_CONTENT_URI, values, (IUri**)&url); //try { AutoPtr<IOutputStream> thumbOut; cr->OpenOutputStream(url, (IOutputStream**)&thumbOut); Boolean res; thumb->Compress(BitmapCompressFormat_JPEG, 100, thumbOut, &res); thumbOut->Close(); return thumb; /*} catch (FileNotFoundException ex) { return NULL; } catch (IOException ex) { return NULL; }*/ } /** * Insert an image and create a thumbnail for it. * * @param cr The content resolver to use * @param source The stream to use for the image * @param title The name of the image * @param description The description of the image * @return The URL to the newly created image, or <code>NULL</code> if the image failed to be stored * for any reason. */ String MediaStore::Images::Media::InsertImage( /* [in] */ IContentResolver* cr, /* [in] */ IBitmap* source, /* [in] */ String title, /* [in] */ String description) { AutoPtr<IContentValues> values; CContentValues::New((IContentValues**)&values); values->PutString(String(MediaColumns_TITLE), title); values->PutString(String(ImageColumns_DESCRIPTION), description); values->PutString(String(MediaColumns_MIME_TYPE), String("image/jpeg")); AutoPtr<IUri> url = NULL; String stringUrl; /* value to be returned */ //try { cr->Insert(EXTERNAL_CONTENT_URI, values, (IUri**)&url); if (source != NULL) { AutoPtr<IOutputStream> imageOut; cr->OpenOutputStream(url, (IOutputStream**)&imageOut); //try { Boolean res; source->Compress(BitmapCompressFormat_JPEG, 50, imageOut, &res); //} finally { imageOut->Close(); //} Int64 id = ContentUris::ParseId(url); // Wait until MINI_KIND thumbnail is generated. AutoPtr<IBitmap> miniThumb = Images::Thumbnails::GetThumbnail(cr, id, Images::Thumbnails::MINI_KIND, NULL); // This is for backward compatibility. AutoPtr<IBitmap> microThumb = StoreThumbnail(cr, miniThumb, id, 50.0, 50.0, Images::Thumbnails::MICRO_KIND); } else { //Log.e(TAG, "Failed to create thumbnail, removing original"); //cr->Delete(url, NULL, NULL); url = NULL; } /*} catch (Exception e) { Log.e(TAG, "Failed to insert image", e); if (url != NULL) { cr.delete(url, NULL, NULL); url = NULL; } }*/ if (url != NULL) { url->ToString(&stringUrl); } return stringUrl; } /** * Get the content:// style URI for the image media table on the * given volume. * * @param volumeName the name of the volume to get the URI for * @return the URI to the image media table on the given volume */ AutoPtr<IUri> MediaStore::Images::Media::GetContentUri( /* [in] */ String volumeName) { AutoPtr<IUri> uri; Uri::Parse(CONTENT_AUTHORITY_SLASH + volumeName + "/images/media", (IUri**)&uri); return uri; } AutoPtr<ICursor> MediaStore::Images::Thumbnails::Query( /* [in] */ IContentResolver* cr, /* [in] */ IUri* uri, /* [in] */ ArrayOf<String>* projection) { AutoPtr<ICursor> c; //cr->Query(uri, projection, NULL, NULL, DEFAULT_SORT_ORDER, (ICursor**)&c); return c; } AutoPtr<ICursor> MediaStore::Images::Thumbnails::QueryMiniThumbnails( /* [in] */ IContentResolver* cr, /* [in] */ IUri* uri, /* [in] */ Int32 kind, /* [in] */ ArrayOf<String>* projection) { AutoPtr<ICursor> c; //cr->Query(uri, projection, "kind = " + kind, NULL, DEFAULT_SORT_ORDER, (ICursor**)&c); return c; } AutoPtr<ICursor> MediaStore::Images::Thumbnails::QueryMiniThumbnail( /* [in] */ IContentResolver* cr, /* [in] */ Int64 origId, /* [in] */ Int32 kind, /* [in] */ ArrayOf<String>* projection) { AutoPtr<ICursor> c; /*cr->Query(EXTERNAL_CONTENT_URI, projection, IMAGE_ID + " = " + origId + " AND " + KIND + " = " + kind, NULL, NULL, (ICursor**)&c);*/ return c; } /** * This method cancels the thumbnail request so clients waiting for getThumbnail will be * interrupted and return immediately. Only the original process which made the getThumbnail * requests can cancel their own requests. * * @param cr ContentResolver * @param origId original image id */ void MediaStore::Images::Thumbnails::CancelThumbnailRequest( /* [in] */ IContentResolver* cr, /* [in] */ Int64 origId) { InternalThumbnails::CancelThumbnailRequest(cr, origId, EXTERNAL_CONTENT_URI, InternalThumbnails::DEFAULT_GROUP_ID); } /** * This method checks if the thumbnails of the specified image (origId) has been created. * It will be blocked until the thumbnails are generated. * * @param cr ContentResolver used to dispatch queries to MediaProvider. * @param origId Original image id associated with thumbnail of interest. * @param kind The type of thumbnail to fetch. Should be either MINI_KIND or MICRO_KIND. * @param options this is only used for MINI_KIND when decoding the Bitmap * @return A Bitmap instance. It could be NULL if the original image * associated with origId doesn't exist or memory is not enough. */ AutoPtr<IBitmap> MediaStore::Images::Thumbnails::GetThumbnail( /* [in] */ IContentResolver* cr, /* [in] */ Int64 origId, /* [in] */ Int32 kind, /* [in] */ IBitmapFactoryOptions* options) { return InternalThumbnails::GetThumbnail(cr, origId, InternalThumbnails::DEFAULT_GROUP_ID, kind, options, EXTERNAL_CONTENT_URI, FALSE); } /** * This method cancels the thumbnail request so clients waiting for getThumbnail will be * interrupted and return immediately. Only the original process which made the getThumbnail * requests can cancel their own requests. * * @param cr ContentResolver * @param origId original image id * @param groupId the same groupId used in getThumbnail. */ void MediaStore::Images::Thumbnails::CancelThumbnailRequest( /* [in] */ IContentResolver* cr, /* [in] */ Int64 origId, /* [in] */ Int64 groupId) { InternalThumbnails::CancelThumbnailRequest(cr, origId, EXTERNAL_CONTENT_URI, groupId); } /** * This method checks if the thumbnails of the specified image (origId) has been created. * It will be blocked until the thumbnails are generated. * * @param cr ContentResolver used to dispatch queries to MediaProvider. * @param origId Original image id associated with thumbnail of interest. * @param groupId the id of group to which this request belongs * @param kind The type of thumbnail to fetch. Should be either MINI_KIND or MICRO_KIND. * @param options this is only used for MINI_KIND when decoding the Bitmap * @return A Bitmap instance. It could be NULL if the original image * associated with origId doesn't exist or memory is not enough. */ AutoPtr<IBitmap> MediaStore::Images::Thumbnails::GetThumbnail( /* [in] */ IContentResolver* cr, /* [in] */ Int64 origId, /* [in] */ Int64 groupId, /* [in] */ Int32 kind, /* [in] */ IBitmapFactoryOptions* options) { return InternalThumbnails::GetThumbnail(cr, origId, groupId, kind, options, EXTERNAL_CONTENT_URI, FALSE); } /** * Get the content:// style URI for the image media table on the * given volume. * * @param volumeName the name of the volume to get the URI for * @return the URI to the image media table on the given volume */ AutoPtr<IUri> MediaStore::Images::Thumbnails::GetContentUri( /* [in] */ String volumeName) { AutoPtr<IUri> uri; Uri::Parse(CONTENT_AUTHORITY_SLASH + volumeName + "/images/thumbnails", (IUri**)&uri); return uri; } /** * Converts a name to a "key" that can be used for grouping, sorting * and searching. * The rules that govern this conversion are: * - remove 'special' characters like ()[]'!?., * - remove leading/trailing spaces * - convert everything to lowercase * - remove leading "the ", "an " and "a " * - remove trailing ", the|an|a" * - remove accents. This step leaves us with CollationKey data, * which is not human readable * * @param name The artist or album name to convert * @return The "key" for the given name. */ String MediaStore::Audio::KeyFor( /* [in] */ String name) { if (name != NULL) { Boolean sortfirst = FALSE; if (!name.Equals(UNKNOWN_STRING)) { return String("\001"); } // Check if the first character is \001. We use this to // force sorting of certain special files, like the silent ringtone. if (name.StartWith("\001")) { sortfirst = TRUE; } name.Trim().ToLowerCase(); if (name.StartWith("the ")) { name = name.Substring(4); } if (name.StartWith("an ")) { name = name.Substring(3); } if (name.StartWith("a ")) { name = name.Substring(2); } if (name.EndWith(", the") || name.EndWith(",the") || name.EndWith(", an") || name.EndWith(",an") || name.EndWith(", a") || name.EndWith(",a")) { name = name.Substring(0, name.LastIndexOf(',')); } name = name.Replace("[\\[\\]\\(\\)\"'.,?!]", "").Trim(); if (name.GetLength() > 0) { // Insert a separator between the characters to avoid // matches on a partial character. If we ever change // to start-of-word-only matches, this can be removed. StringBuffer b;// = new StringBuilder(); b += '.'; Int32 nl = name.GetLength(); for (Int32 i = 0; i < nl; i++) { b += name[i]; b += '.'; } name = b; String key = DatabaseUtils::GetCollationKey(name); if (sortfirst) { key = "\001" + key; } return key; } else { return String(""); } } String str; return str; } /** * Get the content:// style URI for the audio media table on the * given volume. * * @param volumeName the name of the volume to get the URI for * @return the URI to the audio media table on the given volume */ AutoPtr<IUri> MediaStore::Audio::Media::GetContentUri( /* [in] */ String volumeName) { AutoPtr<IUri> uri; Uri::Parse(CONTENT_AUTHORITY_SLASH + volumeName + "/audio/media", (IUri**)&uri); return uri; } AutoPtr<IUri> MediaStore::Audio::Media::GetContentUriForPath( /* [in] */ String path) { String str; AutoPtr<IFile> file = Environment::GetExternalStorageDirectory(); file->GetPath(&str); return (str.StartWith(path) ? EXTERNAL_CONTENT_URI : INTERNAL_CONTENT_URI); } /** * Get the content:// style URI for the audio genres table on the * given volume. * * @param volumeName the name of the volume to get the URI for * @return the URI to the audio genres table on the given volume */ AutoPtr<IUri> MediaStore::Audio::Genres::GetContentUri( /* [in] */ String volumeName) { AutoPtr<IUri> uri; Uri::Parse(CONTENT_AUTHORITY_SLASH + volumeName + "/audio/genres", (IUri**)&uri); return uri; } AutoPtr<IUri> MediaStore::Audio::Genres::Members::GetContentUri( /* [in] */ String volumeName, /* [in] */ Int64 genreId) { AutoPtr<IUri> uri; Uri::Parse(CONTENT_AUTHORITY_SLASH + volumeName + "/audio/genres/" + String::FromInt64(genreId) + "/members", (IUri**)&uri); return uri; } /** * Get the content:// style URI for the audio playlists table on the * given volume. * * @param volumeName the name of the volume to get the URI for * @return the URI to the audio playlists table on the given volume */ AutoPtr<IUri> MediaStore::Audio::Playlists::GetContentUri( /* [in] */ String volumeName) { AutoPtr<IUri> uri; Uri::Parse(CONTENT_AUTHORITY_SLASH + volumeName + "/audio/playlists", (IUri**)&uri); return uri; } AutoPtr<IUri> MediaStore::Audio::Playlists::Members::GetContentUri( /* [in] */ String volumeName, /* [in] */ Int64 playlistId) { AutoPtr<IUri> uri; Uri::Parse(CONTENT_AUTHORITY_SLASH + volumeName + "/audio/playlists/" + String::FromInt64(playlistId) + "/members", (IUri**)&uri); return uri; } /** * Convenience method to move a playlist item to a new location * @param res The content resolver to use * @param playlistId The numeric id of the playlist * @param from The position of the item to move * @param to The position to move the item to * @return TRUE on success */ Boolean MediaStore::Audio::Playlists::Members::MoveItem( /* [in] */ IContentResolver* res, /* [in] */ Int64 playlistId, /* [in] */ Int32 from, /* [in] */ Int32 to) { AutoPtr<IUri> uri = MediaStore::Audio::Playlists::Members::GetContentUri(String("external"), playlistId); AutoPtr<IUriBuilder> ub; uri->BuildUpon((IUriBuilder**)&ub); ub->AppendEncodedPath(String::FromInt32(from)); ub->AppendQueryParameter(String("move"), String("TRUE")); ub->Build((IUri**)&uri); AutoPtr<IContentValues> values; CContentValues::New((IContentValues**)&values); values->PutInt32(String(MediaStore::Audio::Playlists::Members::PLAY_ORDER), to); Int32 result; //res->Update(uri, values, NULL, NULL, &result); return result != 0; } /** * Get the content:// style URI for the artists table on the * given volume. * * @param volumeName the name of the volume to get the URI for * @return the URI to the audio artists table on the given volume */ AutoPtr<IUri> MediaStore::Audio::Artists::GetContentUri( /* [in] */ String volumeName) { AutoPtr<IUri> uri; Uri::Parse(CONTENT_AUTHORITY_SLASH + volumeName + "/audio/artists", (IUri**)&uri); return uri; } AutoPtr<IUri> MediaStore::Audio::Artists::Albums::GetContentUri( /* [in] */ String volumeName, /* [in] */ Int64 artistId) { AutoPtr<IUri> uri; Uri::Parse(CONTENT_AUTHORITY_SLASH + volumeName + "/audio/artists/" + String::FromInt64(artistId) + "/albums", (IUri**)&uri); return uri; } /** * Get the content:// style URI for the albums table on the * given volume. * * @param volumeName the name of the volume to get the URI for * @return the URI to the audio albums table on the given volume */ AutoPtr<IUri> MediaStore::Audio::Albums::GetContentUri( /* [in] */ String volumeName) { AutoPtr<IUri> uri; Uri::Parse(CONTENT_AUTHORITY_SLASH + volumeName + "/audio/albums", (IUri**)&uri); return uri; } AutoPtr<ICursor> MediaStore::Video::Query( /* [in] */ IContentResolver* cr, /* [in] */ IUri* uri, /* [in] */ ArrayOf<String>* projection) { AutoPtr<ICursor> c; //cr->Query(uri, projection, NULL, NULL, DEFAULT_SORT_ORDER, (ICursor**)&c); return c; } /** * Get the content:// style URI for the video media table on the * given volume. * * @param volumeName the name of the volume to get the URI for * @return the URI to the video media table on the given volume */ AutoPtr<IUri> MediaStore::Video::Media::GetContentUri( /* [in] */ String volumeName) { AutoPtr<IUri> uri; Uri::Parse(CONTENT_AUTHORITY_SLASH + volumeName + "/video/media", (IUri**)&uri); return uri; } /** * This method cancels the thumbnail request so clients waiting for getThumbnail will be * interrupted and return immediately. Only the original process which made the getThumbnail * requests can cancel their own requests. * * @param cr ContentResolver * @param origId original video id */ void MediaStore::Video::Thumbnails::CancelThumbnailRequest( /* [in] */ IContentResolver* cr, /* [in] */ Int64 origId) { InternalThumbnails::CancelThumbnailRequest(cr, origId, EXTERNAL_CONTENT_URI, InternalThumbnails::DEFAULT_GROUP_ID); } /** * This method checks if the thumbnails of the specified image (origId) has been created. * It will be blocked until the thumbnails are generated. * * @param cr ContentResolver used to dispatch queries to MediaProvider. * @param origId Original image id associated with thumbnail of interest. * @param kind The type of thumbnail to fetch. Should be either MINI_KIND or MICRO_KIND. * @param options this is only used for MINI_KIND when decoding the Bitmap * @return A Bitmap instance. It could be NULL if the original image * associated with origId doesn't exist or memory is not enough. */ AutoPtr<IBitmap> MediaStore::Video::Thumbnails::GetThumbnail( /* [in] */ IContentResolver* cr, /* [in] */ Int64 origId, /* [in] */ Int32 kind, /* [in] */ IBitmapFactoryOptions* options) { return InternalThumbnails::GetThumbnail(cr, origId, InternalThumbnails::DEFAULT_GROUP_ID, kind, options, EXTERNAL_CONTENT_URI, TRUE); } /** * This method checks if the thumbnails of the specified image (origId) has been created. * It will be blocked until the thumbnails are generated. * * @param cr ContentResolver used to dispatch queries to MediaProvider. * @param origId Original image id associated with thumbnail of interest. * @param groupId the id of group to which this request belongs * @param kind The type of thumbnail to fetch. Should be either MINI_KIND or MICRO_KIND * @param options this is only used for MINI_KIND when decoding the Bitmap * @return A Bitmap instance. It could be NULL if the original image associated with * origId doesn't exist or memory is not enough. */ AutoPtr<IBitmap> MediaStore::Video::Thumbnails::GetThumbnail( /* [in] */ IContentResolver* cr, /* [in] */ Int64 origId, /* [in] */ Int64 groupId, /* [in] */ Int32 kind, /* [in] */ IBitmapFactoryOptions* options) { return InternalThumbnails::GetThumbnail(cr, origId, groupId, kind, options, EXTERNAL_CONTENT_URI, TRUE); } /** * This method cancels the thumbnail request so clients waiting for getThumbnail will be * interrupted and return immediately. Only the original process which made the getThumbnail * requests can cancel their own requests. * * @param cr ContentResolver * @param origId original video id * @param groupId the same groupId used in getThumbnail. */ void MediaStore::Video::Thumbnails::CancelThumbnailRequest( /* [in] */ IContentResolver* cr, /* [in] */ Int64 origId, /* [in] */ Int64 groupId) { InternalThumbnails::CancelThumbnailRequest(cr, origId, EXTERNAL_CONTENT_URI, groupId); } /** * Get the content:// style URI for the image media table on the * given volume. * * @param volumeName the name of the volume to get the URI for * @return the URI to the image media table on the given volume */ AutoPtr<IUri> MediaStore::Video::Thumbnails::GetContentUri( /* [in] */ String volumeName) { AutoPtr<IUri> uri; Uri::Parse(CONTENT_AUTHORITY_SLASH + volumeName + "/video/thumbnails", (IUri**)&uri); return uri; } /** * Uri for querying the state of the media scanner. */ AutoPtr<IUri> MediaStore::GetMediaScannerUri() { AutoPtr<IUri> uri; Uri::Parse(CONTENT_AUTHORITY_SLASH + "none/media_scanner", (IUri**)&uri); return uri; }
7c01129784abe14215569dd5c5a4721af5458f60
f8f6877731a71d9ff045ba856f0f20d529e9e666
/OpenGLGraphics/OpenGLGraphics/Hill.h
4c9d5498bc6c24e762dfbde8dd616532f0abc7ca
[]
no_license
JonECG/Cpp-Game-Engine
f925f10aaaa2f6d053e83ef56c4dee2503ba70de
c11b0ed268057eb17f06edb406f0d69448eb9008
refs/heads/master
2021-01-19T07:39:18.108901
2015-06-14T14:23:23
2015-06-14T14:23:23
null
0
0
null
null
null
null
UTF-8
C++
false
false
454
h
Hill.h
#pragma once #include "Model.h" #include "glm\glm.hpp" #include "Terrain.h" class Hill { float time; static Model ring; float wave; glm::vec3 position; public: Hill(); static void initialize(); void update( GLfloat dt, Terrain &terrain ); void draw( GLuint shader ); glm::vec3 getPosition(); inline float getScale(){ return time/4.0f; } inline void setPosition(glm::vec3 position){ this->position = position; } };
d2e685a612962535b8d763b1092459fdeb5b1d4d
4135d95e06a8dd39417a0798948b9819bfbd8298
/A1/polygon.hpp
279d1f030b12391b6b1e37403817377713bcd4af
[]
no_license
dm-stulov/SpbStu_cpp_second_year
b72cd40d9db1f688a23c2bc050a38bbd4b5bc5c0
2b6ceccb8679f26838e37f0c3bb744781960c664
refs/heads/master
2022-04-09T17:08:48.116959
2020-03-17T17:22:02
2020-03-17T17:22:02
null
0
0
null
null
null
null
UTF-8
C++
false
false
594
hpp
polygon.hpp
#ifndef POLYGON_HPP #define POLYGON_HPP #include "shape.hpp" class Polygon : public Shape { public: Polygon(const Polygon &); Polygon(Polygon &&); Polygon(const point_t *points, int size); ~Polygon(); Polygon & operator=(const Polygon &); Polygon & operator=(Polygon &&); double getArea() const override; rectangle_t getFrameRect() const override; void move(const point_t &pos) override; void move(double dx, double dy) override; void printInfo() const override; private: point_t *points_; int size_; point_t getCenter() const; bool isConvex() const; }; #endif
b06a87136aa977777c54b2da620c2456227870cd
b71e3a0f774f6b2be483d52f870519aaad73c407
/code/nes.cpp
a2e48bd35faad6fc2425171fc39dd7cf03ce313e
[]
no_license
domlawlor/tuNES
b3dc714ca677b317406aee3d6618110fc4bd22b7
c3a65e1072d369add2778231b56453d96b801d1c
refs/heads/main
2023-01-05T23:32:33.801159
2023-01-01T06:21:34
2023-01-01T06:21:34
69,621,229
0
0
null
2022-12-09T13:30:19
2016-09-30T01:10:54
Assembly
UTF-8
C++
false
false
4,495
cpp
nes.cpp
/* ======================================================================== $File: $ $Date: $ $Revision: $ $Creator: Dom Lawlor $ ======================================================================== */ #include "nes.h" #include "cpu.cpp" #include "ppu.cpp" #include "apu.cpp" #include "cartridge.cpp" // Static define Nes Nes::_instance; void Nes::Update() { if(m_triggerPowerOn && m_isPowerOn) { m_triggerPowerOn = false; m_isPowerOn = false; return; } if(m_triggerRomLoad || m_triggerPowerOn || m_triggerReset) { bool cyclePower = m_triggerRomLoad || m_triggerPowerOn; Reset(cyclePower); m_triggerRomLoad = false; m_triggerPowerOn = false; m_triggerReset = false; } if(m_isPowerOn) { u64 currentFrameNum = m_ppu->GetFrameNum(); bool newFrameHit = false; while(!newFrameHit) { InputUpdate(); u64 currentCycle = m_cpu->GetCycleNum(); u64 cyclesElapsed = (currentCycle - m_cyclesStartHz); if(cyclesElapsed >= (gNesCpuClockRate/120)) { r64 currentTime = GetTime(); r64 deltaTime = currentTime - m_startHzTime; if(deltaTime < (1.0/120)) { continue; } else { m_cyclesStartHz = currentCycle; m_startHzTime = currentTime; } } m_cpu->Run(); newFrameHit = m_ppu->GetFrameNum() != currentFrameNum; } } } void Nes::Init() { m_cpu = new Cpu(); m_ppu = new Ppu(); m_apu = new Apu(); m_startHzTime = GetTime(); } void Nes::Deinit() { delete m_cpu; delete m_ppu; delete m_apu; delete m_cartridge; } void Nes::Reset(bool cyclePower) { if(LoadCartridge(m_romFileName)) { m_ppu->Reset(); m_cpu->Reset(cyclePower); m_isPowerOn = true; } else { TraceLog(LOG_ERROR, "LoadCartridge failed on file - %s", m_romFileName); m_isPowerOn = false; return; } } void Nes::QueueRomLoadInternal(char *loadFileName) { TextCopy(m_romFileName, loadFileName); m_triggerRomLoad = true; } bool Nes::LoadCartridge(const char *fileName) { u32 romFileSize = 0; u8 *romFileData = LoadFileData((const char *)fileName, &romFileSize); if(!romFileData) { TraceLog(LOG_ERROR, "LoadFileData failed for filePath - %s", fileName); return false; } if(m_cartridge) { delete m_cartridge; m_cartridge = nullptr; } if(IsFileExtension(fileName, ".nes")) { m_cartridge = Cartridge::CreateCartridgeForRom(romFileData, romFileSize); if(!m_cartridge) { TraceLog(LOG_ERROR, "LoadCartridge failed to CreateCartridgeForRom for file - %s", fileName); return false; } m_nesMode = NesMode::ROM; } else if(IsFileExtension(fileName, ".nsf")) { struct NSFHeader { u8 nesId[5]; u8 versionNumber; u8 totalSongs; u8 startingSong; u16 loadAddress; u16 initAddress; u16 playAddress; u8 songName[32]; u8 artistName[32]; u8 copyright[32]; u16 playSpeedNtsc; u8 bankswitchInitValues[8]; u16 playSpeedPal; u8 regionByte; u8 soundChipsUsed; u8 reservedNSF2; u8 programDataLength[3]; }; Assert(sizeof(NSFHeader) == 0x80); NSFHeader *header = (NSFHeader *)romFileData; bool isNsfRom = (header->nesId[0] == 'N' && header->nesId[1] == 'E' && header->nesId[2] == 'S' && header->nesId[2] == 'M'); //TraceLog(LOG_ERROR, "LoadCartridge failed. NSF not implemented - %s", fileName); //return false; m_nesMode = NesMode::NSF; } return true; } void Nes::InputUpdate() { if(m_input.padStrobe) { bool altDown = IsKeyDown(KEY_LEFT_ALT) || IsKeyDown(KEY_RIGHT_ALT); bool shiftDown = IsKeyDown(KEY_LEFT_SHIFT) || IsKeyDown(KEY_RIGHT_SHIFT); m_input.pad1Buttons[Input::B_UP] = IsKeyDown(KEY_UP); m_input.pad1Buttons[Input::B_DOWN] = IsKeyDown(KEY_DOWN); m_input.pad1Buttons[Input::B_LEFT] = IsKeyDown(KEY_LEFT); m_input.pad1Buttons[Input::B_RIGHT] = IsKeyDown(KEY_RIGHT); m_input.pad1Buttons[Input::B_A] = IsKeyDown(KEY_Z); m_input.pad1Buttons[Input::B_B] = IsKeyDown(KEY_X); m_input.pad1Buttons[Input::B_START] = IsKeyDown(KEY_ENTER); m_input.pad1Buttons[Input::B_SELECT] = shiftDown; m_input.pad1CurrentButton = Input::B_A; m_input.pad2CurrentButton = Input::B_A; //TraceLog(LOG_INFO, "Input: A=%d, B=%d Start=%d Select=%d Up=%d Down=%d Left=%d Right=%d", // m_input.pad1Buttons[Input::B_A], m_input.pad1Buttons[Input::B_B], m_input.pad1Buttons[Input::B_START], m_input.pad1Buttons[Input::B_SELECT], // m_input.pad1Buttons[Input::B_UP], m_input.pad1Buttons[Input::B_DOWN], m_input.pad1Buttons[Input::B_LEFT], m_input.pad1Buttons[Input::B_RIGHT]); } }
9b85e59b0325e2443c350dcdb63276baeaf1307b
a6b24ce2a114b8577546f9b2b1ef8bf297cf23d4
/LNote/Core/Base/STLUtil.h
83eead0c43a75f372e174e972c4ee062f2939e6a
[ "MIT" ]
permissive
lriki/LNote
d63dfe9732f7257e6e33d1f82622af602c894267
a009cb44f7ac7ede3be7237fe7fca52d4c70f393
refs/heads/master
2022-12-18T03:49:06.288119
2020-09-25T17:12:16
2020-09-25T17:12:16
298,601,212
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
2,528
h
STLUtil.h
//============================================================================= //【 STLUtil 】 //----------------------------------------------------------------------------- ///** // @file STLUtil.h // @brief STLUtil // @author Riki //*/ //============================================================================= #pragma once //------------------------------------------------------------------------- // //------------------------------------------------------------------------- #include <vector> #include <algorithm> //------------------------------------------------------------------------- // //------------------------------------------------------------------------- namespace LNote { namespace Core { namespace Base { //============================================================================= // ■ STLUtil クラス //----------------------------------------------------------------------------- ///** // @brief //*/ //============================================================================= class STLUtil { public: //--------------------------------------------------------------------- ///** // @brief vector から等しい要素をすべて削除する //*/ //--------------------------------------------------------------------- template < class VTYPE_, class TYPE_ > static bool remove( VTYPE_& vector_, const TYPE_& v_ ) { size_t n = vector_.size(); vector_.erase( std::remove( vector_.begin(), vector_.end(), v_ ), vector_.end() ); return n != vector_.size(); } //--------------------------------------------------------------------- ///** // @brief vector から条件と等しい要素をすべて削除する //*/ //--------------------------------------------------------------------- template < class VTYPE_,class PR_ > static void remove_if( VTYPE_& vector_, const PR_& pred_ ) { vector_.erase( std::remove_if( vector_.begin(), vector_.end(), pred_ ), vector_.end() ); } }; //------------------------------------------------------------------------- // //------------------------------------------------------------------------- } // namespace Base } // namespace Core } // namespace LNote //============================================================================= // end of file //=============================================================================
849b323bfe9e25d700f665f7951d27a0056b27a2
14fec2cd7bbda751dc960c1fc332a409ff87f0f3
/week-3-conditionals/tax-bracket-est.cpp
ad5db4d954c46d46b8b555d871ae1377652c7d33
[]
no_license
zorianak/school-work
1a273226ffb0343913ac51eeed0121692c2cf476
8d5d8d7920c81793584cc1fa7ff213ce8cc3708b
refs/heads/master
2020-08-27T03:27:21.419544
2015-07-27T06:02:55
2015-07-27T06:02:55
39,538,118
0
0
null
null
null
null
UTF-8
C++
false
false
5,027
cpp
tax-bracket-est.cpp
#include <iostream> #include <iomanip> #include <cmath> #include <string> #include <cctype> using namespace std; //-------------------------------------------------------- // Name: Kim Holmes // Class: CS361 Control Structures // // Desc: Determins IRS 1040 logic // // Input: Num of exemptions // Adjusted Gross Income // Filing status // 1 Single // 2 Married, joint // 3 head of house // 4 Qualifying widow, married // 5 filing separately // // Output: Calcs magnetic field // One or two blank lines from reading all // inputs // data similar to format in sample // //-------------------------------------------------------- const double LINE_TWO_AMNT = 3950, LINE_SIX_AMNT_NOT_SEP = 2500, LINE_SIX_AMNT_SEP = 1250, LINE_SEVEN_AMNT = 0.02; //-------------------------------------------------------- // Description: Function determines if over AGI limit // for Line 6 // Input params: overLimit - amnt over limit // filingStatus - filing status // Returns: amount over AGI //-------------------------------------------------------- int calcAgi(double overLim, int filingStatus) { double agi = 0; // if it is less than 122500 and not sep, then calc if(overLim < 122500 && filingStatus != 5) { // not filing sep, AGI is low enough agi = overLim / LINE_SIX_AMNT_NOT_SEP; } else if( overLim < 61250 && filingStatus == 5) { // filing sep, AGI low enough agi = overLim / LINE_SIX_AMNT_SEP; } return ceil(agi); } int main() { int filingStatus, exemptions; double gross; cout << "Enter the number of exeptions claimed: "; cin >> exemptions; cout << endl << "Enter your Adjusted Gross Income (1040, line 38): "; cin >> gross; cout << endl << "1 - Single" << endl; cout << "2 - Married, Filing Jointly" << endl; cout << "3 - Head of Household" << endl; cout << "4 - Qualifying Widow(er)" << endl; cout << "5 - Married, Filing Separately" << endl; cout << "Enter your filing status from above (1-5): "; cin >> filingStatus; cout << setw(25) << "Eduction for Exemptions Worksheet" << '\n' << endl; // calculate line 2 double lineTwo = exemptions * LINE_TWO_AMNT; // check to see if Line 1 is satisfied and can exit string filingStatusDesc; double limit; switch(filingStatus) { case 1 : filingStatusDesc = "(single) "; limit = 254200; break; case 2 : filingStatusDesc = "(filing joint) "; limit = 305050; break; case 3 : filingStatusDesc = "(head of household)"; limit = 279650; break; case 5 : filingStatusDesc = "(filing separately) "; limit = 152252; break; default : filingStatusDesc = "(widow(er)) "; limit = 305050; } // If your gross is greater than limits, you're done. cout << fixed << showpoint << setprecision(2); if(gross < limit) { cout << "1." << '\t' << "AGI is not over filing status amount" << endl; cout << "2." << '\t' << "Exemptions claimed ( " << exemptions << " x " << LINE_TWO_AMNT << "):" << setw(15) << lineTwo << endl; cout << '\n' << "***Enter amount from worksheet line 2 on form 1040 line 42"<< endl; return 2; } cout << "1." << '\t' << "AGI is over filing status amount" << endl; cout << "2." << '\t' << "Exemptions claimed ( " << exemptions << " x " << LINE_TWO_AMNT << "):" << setw(21) << lineTwo << '\n' << endl; // Line 3 - show adjusted gross income cout << "3." << '\t' << "Adjusted gross income:" << setw(33) << gross << endl; cout << "4." << '\t' << "Filing status limit " << filingStatusDesc << setw(16) << limit << endl; cout << "" << setfill('-') << setw(63) << "" << setfill(' ') << endl; // Line 5 - subtract L4 from L3, this is amount over limit double amntOver = gross - limit; cout << "5." << '\t' << "AGI amount over limit:" << setw(33) << amntOver << endl; // L6 - test for AGI too high int agiResult = calcAgi(amntOver, filingStatus); // if we get a result more than 0, keep on keepin' on. // Otherwise, end. if(agiResult == 0 ) { cout << '\n' << "AGI is too high. No exeptions allowed." << endl; cout << '\n' << "***Enter 0.0 on form 1040 line 42"<< endl; return 6; } cout << "6." << '\t' << "Division result:" << setw(39) << agiResult << endl; cout << "" << setfill('-') << setw(63) << "" << setfill(' ') << endl; // Line 7 - Mult. L6 by .02, enter rounded up to 3 places double lineSev = agiResult * LINE_SEVEN_AMNT; cout << "7." << '\t' << "Multiply line 6 by 2%:" << setw(33) << setprecision(3) << lineSev << endl;; // Line 8 - mult. L2 by L7 double lineEig = lineTwo * lineSev; cout << "8." << '\t' << "Multiply line 2 by line 7:" << setw(29) << setprecision(2) << lineEig << endl; cout << "" << setfill('-') << setw(63) << "" << setfill(' ') << endl; // Line 9 - Subtract line 8 from line 2 double lineNine = lineTwo - lineEig; cout << "9." << '\t' << "Subtract line 8 from line 2:" << setw(27) << lineNine << '\n' << endl; cout << "***Enter amount from worksheet line 9 on form 1040 line 42" << endl; return 0; }
306cb2c8f7a388b38b43eb6c3f515fa8884d12cb
121ba97cf7ac30d3ae1f36875b389b0715aa79f5
/include/adagio/VBox.h
2cda6b269430027393ecb428358e4e0159fe3607
[]
no_license
trezker/adagio
ba9cddd3555242d33f3422262c85442296041a65
b5afdb9812b7e3b9f2832c9fe8a4a0195aa75937
refs/heads/master
2021-01-10T19:20:45.516940
2010-12-03T07:33:51
2010-12-03T07:33:51
282,799
0
0
null
null
null
null
UTF-8
C++
false
false
488
h
VBox.h
#ifndef adagio_vbox_h #define adagio_vbox_h #include "adagio/Widget.h" #include <list> namespace adagio { typedef std::list<Widget*> Widgetlist; class VBox: public Widget { public: virtual Widget* Clone() const; virtual void Handle_event(const ALLEGRO_EVENT &event); virtual void Render() const; void Add_widget(Widget* w); const Widgetlist& Get_widgets() const; void Set_spacing(int spacing); int Get_spacing() const; private: Widgetlist widgets; int spacing; }; } #endif
91821344b7e750e33ca8fc63c03b6d02789cadc1
0ba73af1c763722994215703b7abc005023d6d33
/src/system.cpp
cb33dcfe8032b577b102ed762e2cf35756ad7431
[ "MIT" ]
permissive
nu18de29/arduino-mqtt
d619c7c2cef2157acc645796711097b29184166c
cfc4a87c443032ec9f16076e2b24c68aaf4f06c3
refs/heads/master
2021-01-01T16:47:28.092809
2017-07-14T07:10:33
2017-07-14T07:10:35
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,461
cpp
system.cpp
#include <Arduino.h> #include "system.h" void lwmqtt_arduino_timer_set(lwmqtt_client_t *client, void *ref, unsigned int timeout) { // cast timer reference lwmqtt_arduino_timer_t *t = (lwmqtt_arduino_timer_t *)ref; // set future end time t->end = millis() + timeout; } unsigned int lwmqtt_arduino_timer_get(lwmqtt_client_t *client, void *ref) { // cast timer reference lwmqtt_arduino_timer_t *t = (lwmqtt_arduino_timer_t *)ref; // get difference to end time return (unsigned int)(t->end - millis()); } lwmqtt_err_t lwmqtt_arduino_network_read(lwmqtt_client_t *client, void *ref, unsigned char *buffer, int len, int *read, unsigned int timeout) { // cast network reference lwmqtt_arduino_network_t *n = (lwmqtt_arduino_network_t *)ref; // set timeout n->client->setTimeout(timeout); // read bytes *read = (int)n->client->readBytes(buffer, (size_t)len); if (*read <= 0) { return LWMQTT_NETWORK_READ_ERROR; } return LWMQTT_SUCCESS; } lwmqtt_err_t lwmqtt_arduino_network_write(lwmqtt_client_t *client, void *ref, unsigned char *buffer, int len, int *sent, unsigned int timeout) { // cast network reference lwmqtt_arduino_network_t *n = (lwmqtt_arduino_network_t *)ref; // write bytes *sent = (int)n->client->write(buffer, (size_t)len); if (*sent <= 0) { return LWMQTT_NETWORK_WRITE_ERR; }; return LWMQTT_SUCCESS; }
34169a8bc33f7511bf1fcc2fe6ffbf0c7e082ee0
e21dc3576db22ea75dc45b132b09e2eb5ec908c8
/graph.cpp
29505282fda11e14cde7f25e9ff1ab3fef183f48
[]
no_license
rtackx/ComSim
83b404e79bb56e2f08c960b56b4cf2e2eca455d1
262d97f7a00f3f2585b57fb7e86f4300d44dec35
refs/heads/master
2021-12-30T03:11:23.674687
2021-12-15T10:02:11
2021-12-15T10:02:11
105,791,705
2
0
null
null
null
null
UTF-8
C++
false
false
4,190
cpp
graph.cpp
#include "graph.h" Graph::Graph() { n = 0; m = 0; list_nodes = NULL; } Graph::~Graph() { unsigned int index, nb; index = 0; while(index < n) { nb = list_nodes[index]->nb_neighbors; delete list_nodes[index]; index++; } if(list_nodes) delete[] list_nodes; } void Graph::load_graph(string bip_filename) { char delim = ' '; int fd = open(bip_filename.c_str(), O_RDONLY); if(fd == -1) { perror("Can't open file."); exit(EXIT_FAILURE); } Node* node, *node_tmp; char* w = (char*) malloc(sizeof(char) * SIZE_BUFFER); string word; char c; float weight; int i, size_w, count; bool new_w, new_line; new_line = new_w; unsigned int index = 0; int index1, index2; unordered_map<string, unsigned int> map_word; unordered_map<unsigned int, Node*> map_node; unordered_map<unsigned int, set<pair<unsigned int, float>, comp_pair>> map_neighbor; index2 = -1; size_w = 0; count = 0; weight = 1.0; node_tmp = NULL; do { i = read(fd, &c, 1); if(size_w == SIZE_BUFFER) w = (char*) realloc(w, sizeof(char) * SIZE_BUFFER + size_w); if(c == '\r') continue; if(c == delim || c == '\n') { if(c == '\n') new_line = true; w[size_w] = '\0'; new_w = true; word = w; count++; } else { w[size_w] = c; size_w++; } if(new_w && size_w > 0) { new_w = false; if(count == 3) { weight = stof(word); } else { if(map_word.find(word) == map_word.end()) { node = new Node(); node->id = word; map_node[index] = node; map_word[word] = index; index1 = index; index++; } else index1 = map_word[word]; } if(new_line) { map_neighbor[index1].insert(make_pair(index2, weight)); map_neighbor[index2].insert(make_pair(index1, weight)); new_line = false; count = 0; weight = 1.0; index2 = -1; } else { if(index2 == -1) index2 = index1; } free(w); w = (char*) malloc(sizeof(char) * SIZE_BUFFER); size_w = 0; } } while(i != 0); free(w); create_graph(map_node, map_neighbor); } void Graph::create_graph(unordered_map<unsigned int, Node*>& map_node, unordered_map<unsigned int, set<pair<unsigned int, float>, comp_pair>>& map_neighbor) { Node* node; unsigned int index; n = map_node.size(); for(auto& e : map_neighbor) m += e.second.size(); list_nodes = new Node*[n]; index = 0; for(auto& e : map_node) { node = e.second; node->nb_neighbors = map_neighbor[e.first].size(); node->index = index; if(node->main_index == -1) node->main_index = index; list_nodes[index] = node; index++; for(auto& d : map_neighbor[e.first]) node->neighbor_weights[map_node[d.first]] = d.second; } } /*Graph* Graph::get_subgraph(vector<unsigned int>& list_ending_nodes) const { Graph* new_graph = NULL; if(list_ending_nodes.size() > 0) { new_graph = new Graph(); unordered_map<unsigned int, Node*> map_node; unordered_map<unsigned int, set<pair<unsigned int, float>, comp_pair>> map_neighbor; pair<unordered_map<unsigned int, set<pair<unsigned int, float>, comp_pair>>::iterator, bool> it_map; unsigned int index; Node* node; Node* new_node; set<unsigned int> list_accepted_index; for(auto& index : list_ending_nodes) list_accepted_index.insert(index); index = 0; while(index < size_list_nodes) { if(list_accepted_index.find(index) != list_accepted_index.end()) { node = list_nodes[index]; new_node = new Node(); new_node->id = node->id; new_node->main_index = node->main_index; map_node[index] = new_node; it_map = map_neighbor.emplace(index, set<pair<unsigned int, float>, comp_pair>()); for(unsigned int i=0; i<node->nb_neighbors; i++) { if(list_accepted_index.find(list_nodes[index+i+1]->index) != list_accepted_index.end()) it_map.first->second.insert(make_pair(list_nodes[index+i+1]->index, node->neighbor_weights[i])); //map_neighbor[index].insert(make_pair(list_nodes[index+i+1]->index, node->neighbor_weights[i])); } } index += list_nodes[index]->nb_neighbors + 1; } new_graph->create_graph(map_node, map_neighbor); } return new_graph; }*/
c6de9d6917204974599f8794b148bd3fc80af142
9030ce2789a58888904d0c50c21591632eddffd7
/SDK/ARKSurvivalEvolved_PrimalItemSkin_SummerSwimShirt_Eels_classes.hpp
53f496b76b35b9a7a15dbebf9d593d0dbf17c788
[ "MIT" ]
permissive
2bite/ARK-SDK
8ce93f504b2e3bd4f8e7ced184980b13f127b7bf
ce1f4906ccf82ed38518558c0163c4f92f5f7b14
refs/heads/master
2022-09-19T06:28:20.076298
2022-09-03T17:21:00
2022-09-03T17:21:00
232,411,353
14
5
null
null
null
null
UTF-8
C++
false
false
912
hpp
ARKSurvivalEvolved_PrimalItemSkin_SummerSwimShirt_Eels_classes.hpp
#pragma once // ARKSurvivalEvolved (332.8) SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "ARKSurvivalEvolved_PrimalItemSkin_SummerSwimShirt_Eels_structs.hpp" namespace sdk { //--------------------------------------------------------------------------- //Classes //--------------------------------------------------------------------------- // BlueprintGeneratedClass PrimalItemSkin_SummerSwimShirt_Eels.PrimalItemSkin_SummerSwimShirt_Eels_C // 0x0000 (0x0AE8 - 0x0AE8) class UPrimalItemSkin_SummerSwimShirt_Eels_C : public UPrimalItemSkin_SummerSwimShirt_Base_C { public: static UClass* StaticClass() { static auto ptr = UObject::FindClass("BlueprintGeneratedClass PrimalItemSkin_SummerSwimShirt_Eels.PrimalItemSkin_SummerSwimShirt_Eels_C"); return ptr; } void ExecuteUbergraph_PrimalItemSkin_SummerSwimShirt_Eels(int EntryPoint); }; } #ifdef _MSC_VER #pragma pack(pop) #endif
f77f3c0e918d111a45032271376cbb5c98c2e1f9
6a75b43ccb165a0b27343cf029c409335ab33000
/ReadYUV/FileScanner.cpp
3da03aa785c441082115248e32fd51cd3894ec90
[]
no_license
HuYuzhang/Analyzer
16e73516a98ebc7e3efad9b542046e0cfe94018e
5760a9b61f6b58dc7785bc57b467a6828b11f90b
refs/heads/master
2020-04-02T05:58:43.634116
2018-11-02T11:18:26
2018-11-02T11:18:26
154,119,670
2
0
null
null
null
null
GB18030
C++
false
false
888
cpp
FileScanner.cpp
#include "FileScanner.h" FileScanner::FileScanner() { } FileScanner::~FileScanner() { } vector<string>FileScanner::find_file(string dir) { std::vector<std::string> ret; WIN32_FIND_DATA p; HANDLE h = FindFirstFile(dir.c_str(), &p); //文件夹路径可以写成 C:\windows\tmp\ (字串内要双斜线) //也可写成C:\windows\tmp\*.dat (检索所有.dat文件) //或者C:\windows\tmp\abc* (检索abc开头的文件) do { ret.push_back(std::string(p.cFileName)); //printf("%s\n", p.cFileName);//输出文件名称 //输出的名称前两个 分别是“.”和“..” 代表当前目录和上一目录可以略过 //得到文件的名称之后 就可以和前面的路径拼合组成文件的绝对路径 //然后使用fopen对文件进行读写操作 } while (FindNextFile(h, &p)); return ret; }
7f12d7b0472d730f834593782bb697f613646bd9
5ce5a426f6f9a788f0ff4e631398463c2ee640a6
/tst/datetime/day_diff_test.cpp
d51dbab259d3d6241dc998796494a2298aea105f
[ "MIT" ]
permissive
LesnyRumcajs/ModernCppChallenge
5b64e7b59ff9117915b4c3c72327412311439351
175601d4c3d3ae88240c190c891261696f777ef1
refs/heads/master
2020-04-01T15:07:23.587268
2020-03-05T20:19:22
2020-03-05T20:19:22
153,322,188
6
0
MIT
2020-02-01T18:55:35
2018-10-16T16:58:16
C++
UTF-8
C++
false
false
702
cpp
day_diff_test.cpp
#include <gtest/gtest.h> #include <gmock/gmock.h> #include <thread> #include "../../src/datetime/date.h" namespace { using namespace testing; using cppchallenge::datetime::Date; TEST(DayDiffTest, GivenSameDateShouldReturnZero) { Date date{2019, 3, 31}; ASSERT_EQ(date.day_difference_with(date), 0); } TEST(DayDiffTest, GivenDiffBetweenOlderAndEarlierShouldReturnNegative) { Date date1{2019, 3, 1}; Date date2{2019, 3, 2}; ASSERT_EQ(date2.day_difference_with(date1), -1); } TEST(DayDiffTest, GivenDifferentDateShouldCorrectlyDiffDays) { ASSERT_EQ(Date(1990, 10, 04).day_difference_with(Date(2011, 10, 04)), 7670); } }
e598526ca891f2d11526753b0715d8fcbac71290
4760167ca7d0ba4ea5606eb5dcb6a6dcc63d63d9
/src/state_configurable_timer.hpp
6c85d9b40593facd5835899503d945e828725ecc
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
Fadis/lpc810
485248d84cab766b1a411fc795363111638ea77c
6d333a7c2d384934c3bcc8056422aa77733f19b5
refs/heads/master
2020-05-18T00:13:10.983102
2013-11-24T14:03:32
2013-11-24T14:03:32
14,647,554
0
1
null
null
null
null
UTF-8
C++
false
false
3,255
hpp
state_configurable_timer.hpp
/******************************************************************************** * Copyright (c) 2013 Naomasa Matsubayashi * * 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. * ******************************************************************************/ #include "LPC8xx.h" class state_configurable_timer { public: state_configurable_timer() { LPC_SCT->CONFIG = (LPC_SCT->CONFIG & ~0x00060001) | 0x00000000; /* SPLIT */ /* MATCH/CAPTURE registers */ LPC_SCT->REGMODE_L = 0x0000; /* L: 2x MATCH, 0x CAPTURE, 3 unused */ LPC_SCT->REGMODE_H = 0x0000; /* H: 0x MATCH, 0x CAPTURE, 5 unused */ LPC_SCT->MATCH_L[0] = 32768; /* MATCH0 */ LPC_SCT->MATCHREL_L[0] = 32768; LPC_SCT->MATCH_L[1] = 16384; /* MATCH1 */ LPC_SCT->MATCHREL_L[1] = 16384; /* OUTPUT registers */ LPC_SCT->OUT[0].SET = 0x00000001; /* Output_pin_0 */ LPC_SCT->OUT[0].CLR = 0x00000002; /* Unused outputs must not be affected by any event */ LPC_SCT->OUT[1].SET = 0; LPC_SCT->OUT[1].CLR = 0; LPC_SCT->OUT[2].SET = 0; LPC_SCT->OUT[2].CLR = 0; LPC_SCT->OUT[3].SET = 0; LPC_SCT->OUT[3].CLR = 0; /* Conflict resolution register */ /* EVENT registers */ LPC_SCT->EVENT[0].CTRL = 0x00005000; /* L: --> state L_ENTRY */ LPC_SCT->EVENT[0].STATE = 0x00000001; LPC_SCT->EVENT[1].CTRL = 0x00005001; /* L: --> state L_ENTRY */ LPC_SCT->EVENT[1].STATE = 0x00000001; /* Unused events must not have any effect */ LPC_SCT->EVENT[2].STATE = 0; LPC_SCT->EVENT[3].STATE = 0; LPC_SCT->EVENT[4].STATE = 0; LPC_SCT->EVENT[5].STATE = 0; /* STATE registers */ LPC_SCT->STATE_L = 0; LPC_SCT->STATE_H = 0; /* implicit value */ /* state names assignment: */ /* State L 0: L_ENTRY */ /* CORE registers */ LPC_SCT->START_L = 0x0000; LPC_SCT->STOP_L = 0x0000; LPC_SCT->HALT_L = 0x0000; LPC_SCT->LIMIT_L = 0x0001; LPC_SCT->START_H = 0x0000; LPC_SCT->STOP_H = 0x0000; LPC_SCT->HALT_H = 0x0000; LPC_SCT->LIMIT_H = 0x0000; LPC_SCT->EVEN = 0x00000000; } };
cdd878d8e7d791a3b850823538dc2cbc28653703
09b184e2ca3f1f86a72f954bce3a1a2c887d41f7
/testbed/gtk/main.cc
3a4ab89d01ebea74a1156e9022ddc1bf481d2eac
[ "Apache-2.0" ]
permissive
enderdev-playground/flutter-app
9388ad599680ed7c1be8707e0344e2ba8761da04
96e380a0707a9ad7d47c7e12462f3c6240669003
refs/heads/master
2022-10-12T00:14:54.396506
2020-06-12T21:04:40
2020-06-12T21:04:40
271,870,624
1
0
null
null
null
null
UTF-8
C++
false
false
180
cc
main.cc
#include "fl_application.h" int main(int argc, char** argv) { g_autoptr(FlApplication) app = fl_application_new(); return g_application_run(G_APPLICATION(app), argc, argv); }
d68712329c6b5ec3edb79e0a0c253f8b2371b039
489dc9eae27dea2841123e870fcb664b49803d5c
/Feuchtigkeitswarner.ino
c30ee1be3d64179d2e10fa600e90d5ea8c7bfcf0
[]
no_license
dcp4ever/Feuchtigkeitswarner
fee16d3c67b7ef9a06f712d12c8ec749581fd1d0
1aa26bc12789c496026933b3eeda1da7e7a5697b
refs/heads/master
2020-03-21T02:37:57.546115
2018-07-08T20:07:22
2018-07-08T20:07:22
138,008,749
0
0
null
null
null
null
UTF-8
C++
false
false
3,140
ino
Feuchtigkeitswarner.ino
#include <avr/sleep.h> #include <avr/power.h> // erstellen einiger Variablen int feuchteLevel = 0; int port = 0; int sensorval = 0; int state = 0; int alarm = 0; const int sensorCount = 8; const int sensors[sensorCount] = {A0,A1, A2, A3, A4, A5,A6,A7}; const int statusLED[] = {2,3,4,5,6,7,8,9}; const String zustand[] = {"nA", "trocken", "feucht", "nass"}; volatile int toggle = 0; #define alarmPin 10 //Pin an dem der Piezosummer angeschlossen ist #define thresh_trocken 800 #define thresh_nass 400 #define trocken 1 #define nass 3 #define feucht 2 ISR(TIMER1_OVF_vect) /* Timer1 Interrupt service Routine */ { if(toggle == 0) toggle = 1; } void enter_sleep(void) /* Arduino schlafen legen */ { Serial.println("Entering Sleepmode"); set_sleep_mode(SLEEP_MODE_IDLE); sleep_enable(); /* Weil diesmal nicht der tiefste Schlafmodus gewaehlt wurde, * koennen unbenutzte Komponenten noch zusaetzlich abgeschaltet * werden, um Energie zu sparen. Noch wichtiger: Die Komponenten * koennten ggf. den Arduino ungewollt aufwecken. */ power_adc_disable(); /* Analog-Eingaenge abschalten */ power_spi_disable(); /* SPI abschalten */ power_timer0_disable(); /* Timer0 abschalten */ power_timer2_disable(); /* Timer0 abschalten */ power_twi_disable(); /* TWI abschalten */ sleep_mode(); sleep_disable(); /* nach dem Schlafen, wird das Programm ab hier weiter ausgeführt*/ power_all_enable(); /* Komponenten wieder aktivieren */ } // Bestimmen der Feuchtestaerke der gemessenen Stelle int best_feuchteLevel(int port) { sensorval = analogRead(port); if (sensorval >= thresh_trocken) return trocken; if (sensorval < thresh_nass) return nass; if (sensorval < thresh_trocken) return feucht; else return 0; } void setup() { Serial.begin(9600); pinMode(alarmPin, OUTPUT); digitalWrite(alarmPin, HIGH); //GPIO as drain for (int i = 0; i < sensorCount; i++) { pinMode(sensors[i], INPUT_PULLUP); // set pull-up on analog pin pinMode(statusLED[i], OUTPUT); digitalWrite(statusLED[i],HIGH); // GPIO as drain delay(50); } /* Timer konfigurieren, dass der Arduino für ca 4sek schläft */ TCCR1A = 0x00; /* Normalbetrieb */ TCNT1 = 0x0000; /* Zaehler loeschen */ TCCR1B = 0x05; /* Prescaler: 1024 */ TIMSK1 = 0x01; /* Timer-Interrupt einschalten */ } void loop() { if(toggle==1) //für den Schlafmodus benötigter Toggle { toggle = 0; for (int i = 0; i < sensorCount; i++) { Serial.print("sensor: "); Serial.print(i); Serial.print("-"); int reading = best_feuchteLevel(sensors[i]); delay(50); Serial.println(zustand[reading]); if (reading == nass){ digitalWrite(statusLED[i],LOW); alarm =1; } else { digitalWrite(statusLED[i],HIGH); digitalWrite(alarmPin, HIGH); } } Serial.println("-----------"); if (alarm ==1) digitalWrite(alarmPin, LOW); //GPIO as drain ==> Alarm an else digitalWrite(alarmPin, HIGH); //GPIO as drain ==> Alarm aus alarm =0; //delay(1000); enter_sleep(); } } //Loop beenden
e517eb6cefb7e26e5dc8ac7afc8f0d7e3da2318e
7eed2307f93ac5b04ec6b47cfdbb60f9b66f3c26
/include/dataStructure.hpp
d98b36ccfc65e02c4b6675ca058967f75de8388a
[]
no_license
muouim/SimCompression
40a178f1e1c22ebe805d711d85a60714c8abd7e8
fd7c8d93944580ecd1b0f059d3ab304c359f5ee0
refs/heads/master
2023-04-21T11:34:53.242938
2021-05-04T11:18:29
2021-05-04T11:18:29
364,218,550
0
0
null
null
null
null
UTF-8
C++
false
false
2,664
hpp
dataStructure.hpp
#ifndef GENERALDEDUPSYSTEM_CHUNK_HPP #define GENERALDEDUPSYSTEM_CHUNK_HPP #include "configure.hpp" #include <bits/stdc++.h> #include <vector> using namespace std; typedef struct { int containerID; int startSegmentID, endSegmentID; u_char hash[CHUNK_HASH_SIZE]; }L6; typedef struct { int segmentID; int startChunkID, endChunkID; u_char hash[CHUNK_HASH_SIZE]; }LP; typedef struct { int chunkID; int size; int unique; u_char fingerprint[CHUNK_HASH_SIZE]; }L0; typedef struct { u_char fileNameHash[FILE_NAME_HASH_SIZE]; int segmentnumber; int containernumber; int chunknumber; vector<L0>chunk; vector<LP>segment; vector<L6>container; }Index; typedef struct { int newID; int oldID; }Pair; typedef struct { u_char hash[CHUNK_HASH_SIZE]; } Hash_t; // system basic data structures typedef struct { uint32_t ID; int type; int logicDataSize; u_char logicData[MAX_CHUNK_SIZE]; u_char chunkHash[CHUNK_HASH_SIZE]; u_char encryptKey[CHUNK_ENCRYPT_KEY_SIZE]; } Chunk_t; typedef struct { int logicDataSize; char logicData[MAX_CHUNK_SIZE]; char chunkHash[CHUNK_HASH_SIZE]; } StorageCoreData_t; typedef struct { uint32_t ID; int logicDataSize; char logicData[MAX_CHUNK_SIZE]; } RetrieverData_t; typedef struct { uint32_t chunkID; int chunkSize; u_char chunkHash[CHUNK_HASH_SIZE]; } RecipeEntry_t; typedef vector<Chunk_t> ChunkList_t; typedef vector<RecipeEntry_t> RecipeList_t; typedef struct { uint64_t fileSize; u_char fileNameHash[FILE_NAME_HASH_SIZE]; uint64_t totalChunkNumber; } FileRecipeHead_t; typedef struct { uint64_t fileSize; u_char fileNameHash[FILE_NAME_HASH_SIZE]; uint64_t totalChunkKeyNumber; } KeyRecipeHead_t; typedef struct { FileRecipeHead_t fileRecipeHead; KeyRecipeHead_t keyRecipeHead; } Recipe_t; typedef struct { union { Chunk_t chunk; Recipe_t recipe; }; int dataType; } Data_t; typedef struct { u_char originHash[CHUNK_HASH_SIZE]; } KeyGenEntry_t; typedef struct { int fd; int epfd; u_char hash[CHUNK_HASH_SIZE]; } Message_t; typedef struct { int messageType; int clientID; int dataSize; } NetworkHeadStruct_t; // database data structures typedef struct { u_char containerName[16]; uint32_t offset; uint32_t length; uint32_t count; uint32_t deltaCount; } keyForChunkHashDB_t; typedef struct { char RecipeFileName[FILE_NAME_HASH_SIZE]; uint32_t version; } keyForFilenameDB_t; typedef vector<uint32_t> RequiredChunk_t; #endif // GENERALDEDUPSYSTEM_CHUNK_HPP
11cae97c859e8abe014eb2cc044873fb90a8a0ef
b028aee920bb0e326bbc521f6a558aee92de7955
/src/Classes/ArvoreB/NoB.cpp
d1d5a89e75717e413d6c9cea29864d61300f0488
[]
no_license
hdnexus/Segunda-parte-Trabalho-ED2-2020-5
45848a4db0d1de15f1cefb0d3eebada6ba28f339
47096cd79cbfdc63deed3571dfef3121c9bdb084
refs/heads/main
2023-03-15T01:43:14.062810
2021-03-19T22:34:38
2021-03-19T22:34:38
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,516
cpp
NoB.cpp
#include "./NoB.h" #include <iostream> #include <vector> #include <fstream> #include <string> #include <ctime> using std::cin; using std::cout; using std::endl; NoB::NoB(int _min) { min = _min; max = min * 2; n = 0; folha = true; filhos = new NoB *[max]; //cria filhos com o numero minimo chave.reserve(max - 1); //Cria chave de ordem m - 1 for (int i = 0; i < max; i++) //inicializa os filhos com nullptr filhos[i] = nullptr; for (int i = 0; i < max - 1; i++) //cria chaves com o numero maximo m - 1 chave[i] = NULL; } NoB::~NoB() { chave.~vector(); delete[] filhos; } bool NoB::getFolha() { return folha; } void NoB::setFolha(bool _folha) { folha = _folha; } int NoB::getChave(int i) { return chave[i]; } void NoB::atualizarChave(int i, int info) { chave[i] = info; } int NoB::getN() { return n; } void NoB::setN(int _n) { n = _n; } NoB* NoB::getFilho(int i) { return filhos[i]; } void NoB:: setFilho(int i, NoB* val) { filhos[i] = val; } void NoB::inserirNo(int info, int *numComparacoesInsercao) { int i = n - 1; //Indice com o elemento mais a direita if (folha == true) { while (i >= 0 && chave[i] > info) //Encontra a posicao da nova chave a ser inserida { chave[i + 1] = chave[i]; i--; *numComparacoesInsercao += 1; } chave[i + 1] = info; n += 1; } else { while (i >= 0 && chave[i] > info) //Procura o filho que terá a nova chave { i--; *numComparacoesInsercao += 1; } if (filhos[i + 1]->getN() == max - 1) { overflow(i + 1, filhos[i + 1]); //Se o filho está cheio if (chave[i + 1] < info) i++; } filhos[i + 1]->inserirNo(info, numComparacoesInsercao); } } void NoB::overflow(int i, NoB *p) //Executa a cisao do no { //Cria um novo no que armazena min NoB *aux = new NoB(min); aux->setN(min - 1); for (int j = 0; j < min - 1; j++) //Copia as chaves { aux->chave[j] = p->chave[j + min]; } if (p->getFolha() == false) { for (int j = 0; j < min; j++) //Copia os filhos { aux->filhos[j] = p->filhos[j + min]; } } p->setN(min - 1); //Reduz o numero de chaves for (int j = n; j >= i + 1; j--) //Cria espaço para o novo filho { filhos[j + 1] = filhos[j]; } filhos[i + 1] = aux; //Junta o novo filho com o nó for (int j = n - 1; j >= i; j--) //Encontra a posição da nova chave e move as chaves maiores para a direita { chave[j + 1] = chave[j]; } chave[i] = p->chave[min - 1]; n += 1; //Incrementa o numero de chaves para esse nó } NoB* NoB::buscarNo(int info, NoB* p, int* numComparacoesBusca) { *numComparacoesBusca += 1; int i = 0; while (i < n && info > chave[i]) { i++; } if ( i < n && chave[i] == info ) { return p; } if (folha == true) { return nullptr; } return filhos[i]->buscarNo(info, filhos[i], numComparacoesBusca); } void NoB::imprimir() { int i; for (i = 0; i < n; i++) { if (folha == false) { filhos[i]->imprimir(); } cout << " " << chave[i]; } cout << endl; if (folha == false) { filhos[i]->imprimir(); } }
d27715fbca049e9ac280b4472810052d404f6261
516a26a1cc52340897933d66e70dd27bf97aa986
/klimasNovy/User.h
ed8fb75eab1430d9e9711fd5f46d789d23fae0a6
[]
no_license
bsuir-labs/klim
fd32ec1ba1b122682ea741aca82135be2e482047
c62dc7147ed2c6318d2ea294dae5d003b0677158
refs/heads/master
2020-04-12T17:02:15.017244
2019-01-09T06:52:47
2019-01-09T06:52:47
162,632,547
0
0
null
null
null
null
UTF-8
C++
false
false
1,253
h
User.h
#pragma once #include <string> class User { protected: std::string m_username; // логин std::string m_password; // пароль unsigned m_permissions; // уровни доступа bool m_anonymous; // флаг, что пользователь анонимен (не залогинен) public: User(); // конструктор User(std::string username, std::string password); // конструктор по логину и паролю virtual ~User(); // деструктор void setPermissions(unsigned); // задаём права доступа bool allowed(unsigned); // проверям права доступа bool anonymous(); // проверка на анонимность (что пользователь залогинен) std::string username(); // получаем имя пользователя std::string password(); // получаем пароль (хэш) // операторы сравнения friend bool operator< (const User& lhs, const User& rhs); friend bool operator> (const User& lhs, const User& rhs); friend bool operator<=(const User& lhs, const User& rhs); friend bool operator>=(const User& lhs, const User& rhs); };
da3e1b89df3d8444d288983abda87709c4927fe5
164e709dcf03ce4769c3ba8f874da0666c35bc03
/include/RtTpsDataAccess/tps_da_poimanager.h
0b4f0df0e54aa4cbf9dae72738057f0ffe6d4728
[]
no_license
liq07lzucn/tps
b343894bcfd59a71be48bd47d6eff6e010464457
a3be6dc50c5f9a2ff448ecff3f5df1956e26ad4f
refs/heads/master
2021-06-23T16:35:01.349523
2017-08-30T08:09:02
2017-08-30T08:09:02
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,937
h
tps_da_poimanager.h
////////////////////////////////////////////////////////////////////////// /// Copyright (c) Shanghai United Imaging Healthcare, 2013 /// All rights reserved. /// /// \author xiaoqing.shangguan xiaoqing.shangguan@united-imaging.com /// /// \file tps_poi_manager.cpp /// /// \brief /// \version 1.0 /// \date Jan. 17, 2014 ////////////////////////////////////////////////////////////////////////// #ifndef TPS_POI_MANAGER_H_ #define TPS_POI_MANAGER_H_ #include "tps_da_defs.h" #include "McsfMedViewer3DArithmetic/point2d.h" #include "RtTpsDataAccess/tps_da_datamanagerbase.h" namespace Mcsf { namespace MedViewer3D { class Point2D; } } TPS_BEGIN_NAMESPACE; class RtPoi; class TPS_DA_DECLSPEC TpsPOIManager : public TpsDataManagerBase { public: TpsPOIManager(void); ~TpsPOIManager(void); struct POIPosInfo{ std::string Uid; ::Mcsf::MedViewer3D::Point2D Pos; int Counter; unsigned char* TxtBuffer; int TxtWidth; int TxtHeight; }; /// \brief Add a POI to the manager /// \param[in] poi /// \return bool bool AddPOI(RtPoi *poi); bool AddMaxPoint(RtPoi *poi); /// \brief Remove a POI from the manager /// \param[in] poiUID /// \return bool bool DeletePOI(const std::string &poiUID); bool DeleteMaxPoint(const std::string &poiUID); void UpdatePois(std::vector<RtPoi*>& poiList); /// \brief Get a POI from the manager /// \param[in] poiUID /// \param[out] pPOI /// \return bool RtPoi* GetPOI(const std::string &poiUID); RtPoi* GetMaxPoint(const std::string &poiUID); RtPoi* GetPoiViaName(const std::string &strPoiName, const std::string &seriesUid); ///////////////////////////////////////////////////////////////// /// \brief get poi list by planUID /// query from memory NOT database /// \param[in] const std::string &sPlanUID /// \return std::vector<std::string> may be empty /// \exceptions: none ///////////////////////////////////////////////////////////////// std::vector<std::string> GetPoiUidListBySeriesUid(const std::string &sSeriesUID) const; std::vector<RtPoi*> GetAllPoiInSeries(const std::string& sSeriesUid) const; void ClearPatientData(); bool GetPoiPosText(const std::string& poiUid, POIPosInfo& poiPos) const; bool AddPoiPos(const std::string& uid, ::Mcsf::MedViewer3D::Point2D pos, const std::string& name, const float color[4]); void ClearPoiPosMap(); private: void Dispose(bool isPatientDataOnly = false); private: typedef std::map<std::string, RtPoi*> POIMap; POIMap mPoiMap; std::map<std::string, POIPosInfo> mAllPOIPosInfo; POIMap mMaxPointMap; }; TPS_END_NAMESPACE #endif
c82db0a82a614b1bb0e699f0f641c91176fd10ed
680440f5e59eb2157c1ecb41fd891880ac47c459
/CodeForces/1206/B.cpp
48923d9d8af032270ce1a91a2ca61f38cfd397f8
[]
no_license
Skywt2003/codes
a705dc3a4f5f79d47450179fc597bd92639f3d93
0e09198dc84e3f6907a11b117a068f5e0f55ca68
refs/heads/master
2020-03-29T09:29:54.014364
2019-11-15T12:39:47
2019-11-15T12:39:47
149,760,952
6
0
null
null
null
null
UTF-8
C++
false
false
731
cpp
B.cpp
#include<bits/stdc++.h> using namespace std; #define int long long inline int read(){ int ret=0,f=1;char ch=getchar(); while (ch<'0'||ch>'9') {if (ch=='-') f=-1;ch=getchar();} while (ch>='0'&&ch<='9') ret=ret*10+ch-'0',ch=getchar(); return ret*f; } const int maxn=100005; int n,a[maxn],ans=0; int num1=0,numn1=0,num0=0; signed main(){ n=read(); for (int i=1;i<=n;i++){ a[i]=read(); if (a[i]==0) num0++; else if (a[i]>0) num1++,ans+=a[i]-1; else if (a[i]<0) numn1++,ans+=-1-a[i]; } if (numn1&1){ if (num0){ ans+=num0; } else { ans+=2; } } else { ans+=num0; } printf("%lld\n",ans); return 0; }
7ba65ff8645ccfd6674ece9c99144fd18b1f945a
37eb9e4b2624f3a8d8954c07359593f27e72c8f0
/NESTest/MemoryTest.cpp
ea34cbc5fd1d8fd053668970e8205ee0fd3c0604
[ "MIT" ]
permissive
MatthewHinton56/NES
a5bdc586af3f2a0428620f4fb26221c9a99e767f
5ff0249de767ed7a8261566ac32f46e6ea0e98c7
refs/heads/master
2022-02-16T23:32:20.035782
2019-08-14T06:22:28
2019-08-14T06:22:28
197,897,515
0
0
MIT
2019-08-13T08:50:54
2019-07-20T07:45:59
C++
UTF-8
C++
false
false
2,983
cpp
MemoryTest.cpp
#pragma once #include "pch.h" #define COMMA , using namespace mos6502; namespace { class MemoryTest : public ::testing::Test { protected: MemoryTest(): mem(), page() {} void SetUp() override { page.fill(0); } Memory<256, 256> mem; std::array<uint8_t, 256> page; }; TEST_F(MemoryTest, MemoryConstruction) { ASSERT_EQ(mem.getPageSize(), 256); ASSERT_EQ(mem.getNumPages(), 256); ASSERT_EQ(mem.getAddressSize(), 16); ASSERT_EQ(mem.getOffsetAddressSize(), 8); ASSERT_EQ(mem.getPageAddressSize(), 8); ASSERT_EQ(mem.getTotalBytes(), 65535); } TEST_F(MemoryTest, MemoryConstructionBadParameters) { ASSERT_THROW(Memory<255 COMMA 32> mem, std::invalid_argument); } TEST_F(MemoryTest, MemoryMask) { unsigned int offsetMask = 0xFF; unsigned int pageMask = 0xFF00; unsigned int addressMask = 0xFFFF; ASSERT_EQ(mem.getOffsetMask(), offsetMask); ASSERT_EQ(mem.getPageMask(), pageMask); ASSERT_EQ(mem.getAddressMask(), addressMask); } TEST_F(MemoryTest, MemoryReadWrite) { mem.writeByte(0x1CBA, 0xCA); ASSERT_EQ(mem.readByte(0x1CBA), 0xCA); } TEST_F(MemoryTest, MemoryPageReadWrite) { for (int i = 0; i < 256; i++) { page[i] = rand() & 0xFF; } mem.writePage(31, page); std::array<uint8_t, 256> actualPage = mem.readPage(31); ASSERT_EQ(page.size(), actualPage.size()) << "Vectors x and y are of unequal length"; for (size_t i = 0; i < actualPage.size(); ++i) { EXPECT_EQ(actualPage[i], page[i]) << "Vectors x and y differ at index " << i; } } TEST_F(MemoryTest, MemoryPageAccessErrors) { ASSERT_THROW(mem.readPage(257), std::invalid_argument); ASSERT_THROW(mem.writePage(358, page), std::invalid_argument); } static Word num = 0; inline void changeNum(Word address, Byte data, bool write) { num = 5; } TEST_F(MemoryTest, MemoryListenerTest) { mem.addMemoryListener(0x44, &changeNum); ASSERT_EQ(num, 0); mem.writeByte(0x44, 6); ASSERT_EQ(num, 5); } TEST_F(MemoryTest, MemoryMirrorTest) { mem.writeByte(0x0, 0x55); ASSERT_EQ(mem[0x0000], 0x55); ASSERT_EQ(mem[0x0800], 0x55); ASSERT_EQ(mem[0x1000], 0x55); ASSERT_EQ(mem[0x1800], 0x55); mem.writeByte(0x07FF, 0xC5); ASSERT_EQ(mem[0x07FF], 0xC5); ASSERT_EQ(mem[0x0FFF], 0xC5); ASSERT_EQ(mem[0x17FF], 0xC5); ASSERT_EQ(mem[0x1FFF], 0xC5); mem.writeByte(0x2000, 0x12); mem.writeByte(0x2001, 0xC3); mem.writeByte(0x2002, 0x41); mem.writeByte(0x2003, 0x12); mem.writeByte(0x2004, 0x91); mem.writeByte(0x2005, 0x24); mem.writeByte(0x2006, 0x65); mem.writeByte(0x2007, 0xF4); for (Word address = 0x2000; address < 0x4000; address += ((Word)0x8)) { ASSERT_EQ(mem[address + 0], 0x12); ASSERT_EQ(mem[address + 1], 0xC3); ASSERT_EQ(mem[address + 2], 0x41); ASSERT_EQ(mem[address + 3], 0x12); ASSERT_EQ(mem[address + 4], 0x91); ASSERT_EQ(mem[address + 5], 0x24); ASSERT_EQ(mem[address + 6], 0x65); ASSERT_EQ(mem[address + 7], 0xF4); } } }
bc134e3a67d1a708bb7fbd62de0907ee2c713665
fcf1e9d46c8fbdcefd83b886e9312d30bda3aed1
/task 4/task 5/Source.cpp
fc2f3a94282fd501c8d48997b6ecbb0b2fb64c83
[]
no_license
MuhammadSaim7776/1st-semester-programes
0d7c623a837a91b95bdc12bef63662ae5bb59872
3ea39e5bd6b84260a09917c00f70deb6c9031414
refs/heads/main
2023-03-09T00:25:31.543785
2021-02-20T10:57:25
2021-02-20T10:57:25
340,631,925
0
0
null
null
null
null
UTF-8
C++
false
false
400
cpp
Source.cpp
#include<iostream> #include<conio.h> using namespace std; void main() { float x, a, b, c, d; cout << "Enter distance in km" << endl; cin >> x; a = x * 1000; cout << "Distance in meters is:" << a << endl; b = x*3280.84; cout << "Distance in feet is:" << b << endl; c = x * 100000; cout << "Distance in cm is:" << c << endl; d = x*39370.1; cout << "Distance in inches is:" << d; _getch(); }
ca25039842d8e26c50aa195b324e1dfcbb6b583f
934cadc86c6957f9705e7338b57f497ae0007503
/trace/readtrace/networkevents.cc
c030065e0eb2fbc4ab23f5b595720fd320160444
[]
permissive
luglio/dashmm
750e9cae003770a442bc41df7a903abafa864390
b51cdf5e9030a2eb8d844a243f376524a4af8b0f
refs/heads/dev-v2
2020-06-07T15:32:34.903145
2018-06-05T19:51:00
2018-06-05T19:51:00
193,050,086
0
0
BSD-3-Clause
2020-02-18T07:56:51
2019-06-21T07:14:36
C++
UTF-8
C++
false
false
2,896
cc
networkevents.cc
#include "networkevents.h" #include <exception> namespace traceutils { namespace network { namespace { // The class of events implemented here static std::string kEventClass{"network"}; // The various event types static std::string kProgressBeginType{"progress begin"}; static std::string kProgressEndType{"progress end"}; // Convert name to type - this may not be needed elsewhere, and so we // may drop this eventually. EventType type_from_name(const std::string &name) { if (name == std::string("PROGRESS_BEGIN")) { return EventType::kProgressBegin; } else if (name == std::string("PROGRESS_END")) { return EventType::kProgressEnd; } else { return EventType::kUnknown; } } } // anonymous std::unique_ptr<Event> prototype_from_name(const std::string &name) { auto type = type_from_name(name); switch (type) { case EventType::kProgressBegin: return std::unique_ptr<Event>{new ProgressBegin{}}; break; case EventType::kProgressEnd: return std::unique_ptr<Event>{new ProgressEnd{}}; break; case EventType::kUnknown: return std::unique_ptr<Event>{nullptr}; break; } return std::unique_ptr<Event>{nullptr}; } const std::string &ProgressBegin::event_class() const { return kEventClass; } const std::string &ProgressBegin::event_type() const { return kProgressBeginType; } std::unique_ptr<Event> ProgressBegin::read_from_file(FILE *fd) const { uint64_t rval{0}; auto before = ftell(fd); if (1 != fread(&rval, sizeof(rval), 1, fd)) { auto after = ftell(fd); if (feof(fd)) { if (before == after) { return std::unique_ptr<Event>{nullptr}; } else { throw std::runtime_error("incomplete read, suggesting format error"); } } else if (ferror(fd)) { // TODO make this a bit more meaningful throw std::runtime_error("error during read."); } } return std::unique_ptr<Event>{new ProgressBegin{rval}}; } const std::string &ProgressEnd::event_class() const { return kEventClass; } const std::string &ProgressEnd::event_type() const { return kProgressEndType; } std::unique_ptr<Event> ProgressEnd::read_from_file(FILE *fd) const { uint64_t rval{0}; auto before = ftell(fd); if (1 != fread(&rval, sizeof(rval), 1, fd)) { auto after = ftell(fd); if (feof(fd)) { if (before == after) { return std::unique_ptr<Event>{nullptr}; } else { throw std::runtime_error("incomplete read, suggesting format error"); } } else if (ferror(fd)) { // TODO make this a bit more meaningful throw std::runtime_error("error during read."); } } return std::unique_ptr<Event>{new ProgressEnd{rval}}; } } // traceutils::network } // traceutils
ab5cddd28dda4960e30e8e33a5144afad024a779
e1959af66f12e21c645586190f837569577fd7da
/Line_Test/tests/SoundexTest.cpp
15b5b5f00c7b060f424eba39710360168bf88bd8
[ "MIT" ]
permissive
wfs/MyCPPAndTDD
5eb6952fb65fd0990be7d38316bc4874031dc0f1
6ffc747a2a25bfa0ce9738d880449a423ba260d0
refs/heads/master
2021-01-20T03:00:21.821200
2016-11-18T02:27:52
2016-11-18T02:27:52
73,883,372
3
1
null
2016-11-18T02:24:32
2016-11-16T04:16:26
C++
UTF-8
C++
false
false
157
cpp
SoundexTest.cpp
/* #include "gmock/gmock.h" */ #include "gtest/gtest.h" #include "Soundex.cpp" TEST(SoundexEncoding, RetainsSoleLetterOfOneLetterWord) { Soundex soundex; }
069eb026a1cb5c84a03f68f40d8f2ceb75426c85
9da7b2ecbe87b501e1a0ce592aa4c2df08accf0e
/Cpp/0129_Sum_Root_to_Leaf_Numbers.cpp
de261df6675a35e22d1fe0a3e1de005ca05c0f70
[]
no_license
Bill-hbrhbr/LeetCode
149a30607917cd4b8bf981b539c61a7b94435ff0
277b197bc3626977dc174efcd89ef154b1415704
refs/heads/master
2020-04-02T12:36:31.871973
2020-01-26T01:19:59
2020-01-26T01:19:59
154,441,519
0
0
null
null
null
null
UTF-8
C++
false
false
901
cpp
0129_Sum_Root_to_Leaf_Numbers.cpp
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ class Solution { public: static int sum; static int curVal; int sumNumbers(TreeNode *root) { sum = 0; curVal = 0; if (root == nullptr) { return 0; } dfsHelper(root); return sum; } private: void dfsHelper(TreeNode *&root) { if (root->left == nullptr && root->right == nullptr) { sum += curVal * 10 + root->val; return; } curVal = curVal * 10 + root->val; if (root->left) { dfsHelper(root->left); } if (root->right) { dfsHelper(root->right); } curVal /= 10; } }; int Solution::sum = 0; int Solution::curVal = 0;
303cd26e624a033dc4ce420626e2fe321c648827
0c6dddf31f92b2ec15f353e95ae041391415bef1
/1100/1152.cpp
719b42de33d92d343f2c83b3bcaf557a48a8d445
[]
no_license
dmsrb1002/algorithm
de5cf3f45307d4fd08ce91807ecb487b20088f90
345ec97fc47786df525bcba1a94b516965b72c8f
refs/heads/master
2020-04-19T01:34:27.033064
2019-02-21T03:54:05
2019-02-21T03:54:05
167,875,596
0
1
null
null
null
null
UTF-8
C++
false
false
267
cpp
1152.cpp
#include <iostream> #pragma warning (disable: 4996) using namespace std; int main() { char c; int cnt = 0, flag = 0; while (EOF != scanf("%c", &c)) { if (c == ' ' || c == '\n') flag = 0; else if (flag == 0) { cnt++; flag = 1; } } cout << cnt; }
7c1a4d9c7831c81f4f3cc492382f9726dd15dff7
c15f487ef96abcf034bd2b1e55e018f525f95c8b
/Source/Project_ESTRA/Public/Common/TeamCharacter_Interface.h
b2cab2d6cd4c865ed558c2bd95f3ca2144b8844a
[]
no_license
Everixel/Project_ESTRA
9d0aff1d896cdea531bee0903586dbcd33724b50
12650436f7063e8bb15656369f107cffc129c19e
refs/heads/master
2020-04-09T06:45:00.315286
2019-01-02T10:09:59
2019-01-02T10:09:59
160,125,504
0
0
null
null
null
null
UTF-8
C++
false
false
844
h
TeamCharacter_Interface.h
// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "CoreMinimal.h" #include "UObject/Interface.h" #include "Misc.h" #include "TeamCharacter_Interface.generated.h" // This class does not need to be modified. UINTERFACE(BlueprintType) class UTeamCharacter_Interface : public UInterface { GENERATED_BODY() }; /** * */ class PROJECT_ESTRA_API ITeamCharacter_Interface { GENERATED_BODY() // Add interface functions to this class. This is the class that will be inherited to implement this interface. public: UFUNCTION(BlueprintImplementableEvent, BlueprintCallable, Category = "Team Character Interface") void TakeDamage(AActor* DamageDealer, float DamageAmount); UFUNCTION(BlueprintImplementableEvent, BlueprintCallable, Category = "Team Character Interface") ETeam GetTeam(); };
a96143f59a654999bcbbf754bef162345bf5eb3f
a8f1597a16638229ac7e038c0f1bd50a7af1a043
/crowdSimulation/myCell/myCell.cpp
7d732f8e3993890d11114bec3f2c5b23f24fa452
[]
no_license
andy-yuanchang/Crowd_Simulation
b84386f3887a61b7cb2706beaa80d04eccb9d1e9
8032d7c5c79df31318284ed5da10a5681418edf4
refs/heads/master
2021-09-10T16:37:56.713421
2018-03-29T13:11:47
2018-03-29T13:11:47
null
0
0
null
null
null
null
UTF-8
C++
false
false
731
cpp
myCell.cpp
#include "../myCellularAutomata/cellular_automata.h" void CELL::reset(){ probability = 0; dFF = 0; temp_dFF = 0; occupied = 0; inobstacle = false; //cell_type = 0; intersect_obstacle = false; obstacle = false; normalize_dFF = 0; _sFF = 0; obstacle_ = 1; click = false; obstacle_id = -1; occupant_id = -1; mark = false; mark_ = false; check = false; max_sFF = 0.0f; } void FFMODEL::reset(){ start = false; group_count = 0; pause_start_time = clock(); pause_end_time = clock(); total_pause_through_time = 0; pause_through_time = 0; select_agent_ID = 0; pre_select_agent_ID = 0; guider_ID.clear(); out = false; out_anxiety = false; remain_agent = agent_number; //size2_num = 0; //size3_num = 0; }
32ee6f3d099b5c9bba01d481cd44091dbdf98827
ac41d2ccb549dc09ed34e5c0f4da403509abb5c3
/test/traits/scalar_types.hpp
336b2d2ad9f56e800ef7a5ac0bddeaf202b02cc5
[ "MIT" ]
permissive
spraetor/amdis2
c65b530dabd087d922d616bfaf9d53f4c8d5e3c4
53c45c81a65752a8fafbb54f9ae6724a86639dcd
refs/heads/master
2020-12-24T15:51:03.069002
2016-03-06T14:42:53
2016-03-06T14:42:53
39,136,073
2
0
null
null
null
null
UTF-8
C++
false
false
587
hpp
scalar_types.hpp
/** \file scalar_types.hpp */ #pragma once // std c++ headers #include <type_traits> namespace AMDiS { namespace traits { template <class T> using IsIntegral = std::is_integral<typename std::decay<T>::type>; template <class T> using IsArithmetic = std::is_arithmetic<typename std::decay<T>::type>; } // end namespace traits namespace concepts { template <class T> using Integral = traits::IsIntegral<T>; template <class T> using Arithmetic = traits::IsArithmetic<T>; } // end namespace concepts } // end namespace AMDiS
172d838b753d37db956164a4204cf3e174b98a9d
871389a6caae3e652c288e5836cf2ba83b190cbd
/src/main/c++/Native/libs/libQBAInvEigen.hpp
76a262316273f125591bf421729e15ba7b9285e1
[ "Apache-2.0" ]
permissive
fsaab/ParallelLCA
b5251cadccb6a16bc063a62a8e12d5459222631d
62b5e96c921a2d2daef3b8322c60ca5d11445b86
refs/heads/master
2020-06-23T16:41:49.328148
2019-09-04T21:44:23
2019-09-04T21:44:23
198,683,247
0
0
null
null
null
null
UTF-8
C++
false
false
4,974
hpp
libQBAInvEigen.hpp
// // libQBAInv.hpp // LCA.Kernel // // Created by francois saab on 2/26/18. // Copyright © 2018 fsaab. All rights reserved. // #ifndef libQBAInvEigen_hpp #define libQBAInvEigen_hpp #include <stdio.h> #include "../Calculators/Models/AppSettings.hpp" #include <stdio.h> #include "../LCAModels/LCAIndexes.hpp" #include <iostream> #include "../Factories/TechnologyMatrixFactorySingle.hpp" #include "../Factories/InterventionMatrixFactorySingle.hpp" #include "../LCAModels/ExchangeItem.hpp" #include "../LCAModels/CalcImpactFactorItem.hpp" #include "../Factories/CharacterisationMatrixFactory.hpp" using namespace std; #include "../Calculators/MontecarloCalculator.hpp" //#include <chrono> // for high_resolution_clock #include "../Calculators/Models/IterationsResults.hpp" //#include "SensitivityCalculator.hpp" //#include "ScalarsFactoryMUMPS.hpp" #include "../Utilities/FileUtils.hpp" #include "../DAL/LCADB.hpp" #include "../Graph/GraphData.h" class libQBAInvEigen { public: static Eigen::MatrixXd calculateByTransposeSystemBICGSTAB( CalculatorData *calculatorData, AppSettings settings) { SMatrix m = TechnologyMatrixFactorySingle::build(settings, calculatorData); long Acols = m.cols(); int nnz = m.nonZeros(); SMatrix m_B = InterventionMatrixFactorySingle::build(settings, calculatorData); long Brows = m_B.rows(); SMatrix Q = CharacterisationMatrixFactory::build(settings, calculatorData); int Qrows = Q.rows(); SMatrix QB = Q * m_B; SMatrix m__rhs_T = QB.transpose(); BiCGSTAB<SparseMatrix<double> /*, Eigen::IncompleteLUT< double, int >*/> solver; SMatrix mt = m.transpose(); solver.compute(mt); SMatrix QBAinv_t(Acols, Qrows); std::vector<Triplet> triplets; triplets.reserve(Acols * Qrows); if (mt.rows() != m__rhs_T.rows()) { throw LCAException(200, "Sizes does not match while solving linear system in the LCIA contribution analysis report."); } #pragma omp parallel for for (int col = 0; col < m__rhs_T.cols(); col++) { VectorXd xVec(Acols), bVec(Acols); xVec = solver.solve(m__rhs_T.col(col)); #pragma omp critical { for (int i = 0; i < Acols; i++) { triplets.push_back(Triplet(i, col, xVec(i))); } } } QBAinv_t.setFromTriplets(triplets.begin(), triplets.end()); QBAinv_t.makeCompressed(); return (QBAinv_t.transpose()); } static Eigen::MatrixXd calculateByTransposeSystemBICGSTAB_Simple( long Alength, long *rowsA_ptr, long *colsA_ptr, double *dataA_ptr, long Blength, long *rowsB_ptr, long *colsB_ptr, double *dataB_ptr, long Qlength, long *rowsQ_ptr, long *colsQ_ptr, double *dataQ_ptr, AppSettings settings, CalculatorData *calculatorData ) { int Arows = (*calculatorData).lcaIndexes.IntermediateFlowsIndexLength(); SMatrix m(Arows, Arows); libEigen::fillSparseMatrix(&m, Alength, rowsA_ptr, colsA_ptr, dataA_ptr); long Acols = m.cols(); int nnz = m.nonZeros(); int Brows = (*calculatorData).lcaIndexes.ElementaryFlowsIndexLength(); int Bcols = (*calculatorData).lcaIndexes.ProcessesIndexLength(); SMatrix m_B(Brows, Bcols); libEigen::fillSparseMatrix(&m_B, Blength, rowsB_ptr, colsB_ptr, dataB_ptr); int Qcols = (*calculatorData).lcaIndexes.ElementaryFlowsIndexLength(); int Qrows = (*calculatorData).lcaIndexes.ImpactCategoryIndexLength(); SMatrix Q(Qrows, Qcols); libEigen::fillSparseMatrix(&Q, Qlength, rowsQ_ptr, colsQ_ptr, dataQ_ptr); SMatrix QB = Q * m_B; SMatrix m__rhs_T; m__rhs_T = QB.transpose(); BiCGSTAB<SparseMatrix<double> /*, Eigen::IncompleteLUT< double, int >*/> solver; SMatrix mt = m.transpose(); solver.compute(mt); SMatrix QBAinv_t(Acols, Qrows); std::vector<Triplet> triplets; triplets.reserve(Acols * Qrows); if (mt.rows() != m__rhs_T.rows()) { throw LCAException(200, "Sizes does not match while solving linear system in the LCIA contribution analysis report."); } #pragma omp parallel for for (int col = 0; col < m__rhs_T.cols(); col++) { VectorXd xVec(Acols), bVec(Acols); xVec = solver.solve(m__rhs_T.col(col)); #pragma omp critical { for (int i = 0; i < Acols; i++) { triplets.push_back(Triplet(i, col, xVec(i))); } } } QBAinv_t.setFromTriplets(triplets.begin(), triplets.end()); QBAinv_t.makeCompressed(); return (QBAinv_t.transpose()); } }; #endif /* libQBAInv_hpp */
ea2ad88670cbabb49775091c82bf2980fad497ba
d889b468197c10e1987b54fbcf69f6dacc821f9d
/src/IHM/focusgroup.cpp
85428d5f10a9843e6ec77c2bf1b90f99154bd766
[ "MIT" ]
permissive
piochelepiotr/Ludumdare
d2c60807ada67efa9f6eaca376341d30142edf50
5ed0bf4562d4c76cb5ed3e89340f1113867f6249
refs/heads/master
2021-08-22T05:51:12.505413
2017-11-29T12:04:01
2017-11-29T12:04:01
112,466,940
0
0
null
null
null
null
UTF-8
C++
false
false
1,844
cpp
focusgroup.cpp
#include <IHM/focusgroup.hpp> #include <IHM/widget.hpp> FocusGroup* FocusGroup::mCurrentFocusGroup = nullptr; FocusGroup::~FocusGroup() { if (mCurrentFocusGroup == this) mCurrentFocusGroup = nullptr; for(auto w : mWidgets) { w->setFocusGroup(nullptr); } } void FocusGroup::append (Widget& widget) { mWidgets.push_back(&widget); if (mCurrent == nullptr) setFocus(widget); } void FocusGroup::remove (Widget& widget) { auto it = std::find(mWidgets.begin(), mWidgets.end(), &widget); if (it != mWidgets.end()) { if (&widget == mCurrent) mCurrent = nullptr; mWidgets.erase(it); } } void FocusGroup::setFocus (Widget& widget) { if (mCurrent == &widget || std::find(mWidgets.begin(), mWidgets.end(), &widget) == mWidgets.end()) return; if (mCurrent) mCurrent->disableFocus(); mCurrent = &widget; if (mCurrentFocusGroup && mCurrentFocusGroup != this) mCurrentFocusGroup->unfocus(); mCurrentFocusGroup = this; widget.enableFocus(); } Widget* FocusGroup::next() { if(mWidgets.size() == 0) return nullptr; auto it = std::find(mWidgets.begin(), mWidgets.end(), mCurrent); ++it; if (it == mWidgets.end()) { setFocus(**mWidgets.begin()); return mCurrent; } setFocus(**it); return mCurrent; } Widget* FocusGroup::previous() { if(mWidgets.size() == 0) return nullptr; auto it = std::find(mWidgets.rbegin(), mWidgets.rend(), mCurrent); ++it; if (it == mWidgets.rend()) { setFocus(**mWidgets.rbegin()); return mCurrent; } setFocus(**it); return mCurrent; } Widget* FocusGroup::current() { return mCurrent; } void FocusGroup::unfocus() { if (mCurrent) mCurrent->disableFocus(); mCurrentFocusGroup = nullptr; } bool FocusGroup::mouseEvent(sf::Event event, sf::Vector2f local) { for (auto w : mWidgets) { if (w->mouseEvent(event, local)) return true; } return false; }
6f0bc4e7c527c332ca93713fab4c6ca30e4ae4a1
9cb6b8d7d4625450db5f3fed5040e87bcc950832
/verao2010/dia03/p.cpp
03589b1bd0ddcb051a6caf7b16b9bbbfbde0cb4f
[]
no_license
kangli-bionic/Treino-Maratona
7ca7731142514c28880c0e463c6a8ba5d97aebb6
c02fefbe740f8792b825faa722718cdd64c456a2
refs/heads/master
2021-05-30T03:28:37.094987
2014-09-15T18:17:01
2014-09-15T18:17:01
null
0
0
null
null
null
null
UTF-8
C++
false
false
474
cpp
p.cpp
#include <cstdio> #include <cstring> #include <algorithm> #include <vector> #include <set> #include <map> #include <queue> #include <cmath> using namespace std; char s[200]; int main() { int casos; scanf(" %d", &casos); while(casos--){ scanf(" %s", s); int i = strlen(s) - 1; while(i >= 0){ if(s[i] == '1') s[i] = '0'; else{ s[i] = '1'; break; } i--; } if(i < 0) printf("1"); printf("%s\n", s); } return 0; }
4059b3c5c1ac5e4d96923560b659fd154a598a3b
e07657e7eea82c48df802769df42e18ed1b5d2d5
/weak_ptr/Resource.h
697ee9382895da57ba661a57a6734b158fcf5102
[]
no_license
KyleMylonakis/Cpp-examples-and-problem-solutions
815ccce79f5bb1533822952422d9aa1ff623ce46
e6ee5f09e67a3aea53d3351c3a458f3ba9ad94e0
refs/heads/master
2021-01-01T17:56:02.514760
2018-08-02T21:40:48
2018-08-02T21:40:48
98,203,924
0
0
null
null
null
null
UTF-8
C++
false
false
128
h
Resource.h
#pragma once #include <memory> class Resource { public: std::weak_ptr<Resource> m_ptr; Resource(); ~Resource(); };
2d674ee78fcbba6153c071fc836ad42a32107b8d
2e7d109ce9c16ee052f6b016b2014038e7a62d37
/src/eddl_addons.hpp
676695333a0014afab5e72ee1cab1d1c5dacb552
[ "MIT" ]
permissive
deephealthproject/pyeddl
a101ae963d8ddc754899daf617c556528a05a27c
76c65977b5eec22883e208bcce3b7a32fcf8661e
refs/heads/master
2022-06-24T14:52:28.422146
2022-06-14T15:36:50
2022-06-14T15:36:50
192,718,714
10
4
MIT
2022-06-10T09:49:11
2019-06-19T11:25:49
C++
UTF-8
C++
false
false
87,125
hpp
eddl_addons.hpp
// Copyright (c) 2019-2022 CRS4 // // 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 <pybind11/pybind11.h> #include <pybind11/functional.h> #include <pybind11/stl_bind.h> #ifdef EDDL_WITH_PROTOBUF #include <eddl/serialization/onnx/eddl_onnx.h> #endif PYBIND11_MAKE_OPAQUE(std::vector<Layer*>); // Use return_value_policy::reference for objects that get deleted on the C++ // side. In particular, layers and optimizers are deleted by the Net destructor void eddl_addons(pybind11::module &m) { // Avoid "Could not allocate weak reference" error when returning [layer] pybind11::bind_vector<std::vector<Layer*>>(m, "VLayer"); pybind11::implicitly_convertible<pybind11::list, std::vector<Layer*>>(); // --- specific layer classes --- // Minimal bindings for specific layers. These are not meant to be used // directly, but their presence allows pybind11 to return the relevant // specific layer type from functions like getLayer. // tier 1 pybind11::class_<LinLayer, std::shared_ptr<LinLayer>, Layer>(m, "LinLayer", ""); pybind11::class_<MLayer, std::shared_ptr<MLayer>, Layer>(m, "MLayer", ""); pybind11::class_<OperatorLayer, std::shared_ptr<OperatorLayer>, Layer>(m, "OperatorLayer", ""); pybind11::class_<ReductionLayer, std::shared_ptr<ReductionLayer>, Layer>(m, "ReductionLayer", ""); pybind11::class_<ReductionLayer2, std::shared_ptr<ReductionLayer2>, Layer>(m, "ReductionLayer2", ""); // tier 2 pybind11::class_<GeneratorLayer, std::shared_ptr<GeneratorLayer>, LinLayer>(m, "GeneratorLayer", ""); pybind11::class_<LActivation, std::shared_ptr<LActivation>, LinLayer>(m, "LActivation", ""); pybind11::class_<LBatchNorm, std::shared_ptr<LBatchNorm>, LinLayer>(m, "LBatchNorm", ""); pybind11::class_<LBroadcast, std::shared_ptr<LBroadcast>, LinLayer>(m, "LBroadcast", ""); pybind11::class_<LBypass, std::shared_ptr<LBypass>, LinLayer>(m, "LBypass", ""); pybind11::class_<LConstOfTensor, std::shared_ptr<LConstOfTensor>, LinLayer>(m, "LConstOfTensor", ""); pybind11::class_<LConv, std::shared_ptr<LConv>, LinLayer>(m, "LConv", ""); pybind11::class_<LConv1D, std::shared_ptr<LConv1D>, LinLayer>(m, "LConv1D", ""); pybind11::class_<LConv3D, std::shared_ptr<LConv3D>, LinLayer>(m, "LConv3D", ""); pybind11::class_<LConvT2D, std::shared_ptr<LConvT2D>, LinLayer>(m, "LConvT2D", ""); pybind11::class_<LConvT3D, std::shared_ptr<LConvT3D>, LinLayer>(m, "LConvT3D", ""); pybind11::class_<LDataAugmentation, std::shared_ptr<LDataAugmentation>, LinLayer>(m, "LDataAugmentation", ""); pybind11::class_<LDense, std::shared_ptr<LDense>, LinLayer>(m, "LDense", ""); pybind11::class_<LDropout, std::shared_ptr<LDropout>, LinLayer>(m, "LDropout", ""); pybind11::class_<LEmbedding, std::shared_ptr<LEmbedding>, LinLayer>(m, "LEmbedding", ""); pybind11::class_<LEqual, std::shared_ptr<LEqual>, LinLayer>(m, "LEqual", ""); pybind11::class_<LExpand, std::shared_ptr<LExpand>, LinLayer>(m, "LExpand", ""); pybind11::class_<LGather, std::shared_ptr<LGather>, LinLayer>(m, "LGather", ""); pybind11::class_<LGaussianNoise, std::shared_ptr<LGaussianNoise>, LinLayer>(m, "LGaussianNoise", ""); pybind11::class_<LGroupNorm, std::shared_ptr<LGroupNorm>, LinLayer>(m, "LGroupNorm", ""); pybind11::class_<LInput, std::shared_ptr<LInput>, LinLayer>(m, "LInput", ""); pybind11::class_<LLayerNorm, std::shared_ptr<LLayerNorm>, LinLayer>(m, "LLayerNorm", ""); pybind11::class_<LMultiThreshold, std::shared_ptr<LMultiThreshold>, LinLayer>(m, "LMultiThreshold", ""); pybind11::class_<LNorm, std::shared_ptr<LNorm>, LinLayer>(m, "LNorm", ""); pybind11::class_<LNormMax, std::shared_ptr<LNormMax>, LinLayer>(m, "LNormMax", ""); pybind11::class_<LNormMinMax, std::shared_ptr<LNormMinMax>, LinLayer>(m, "LNormMinMax", ""); pybind11::class_<LPad, std::shared_ptr<LPad>, LinLayer>(m, "LPad", ""); pybind11::class_<LPermute, std::shared_ptr<LPermute>, LinLayer>(m, "LPermute", ""); pybind11::class_<LPool, std::shared_ptr<LPool>, LinLayer>(m, "LPool", ""); pybind11::class_<LPool1D, std::shared_ptr<LPool1D>, LinLayer>(m, "LPool1D", ""); pybind11::class_<LPool3D, std::shared_ptr<LPool3D>, LinLayer>(m, "LPool3D", ""); pybind11::class_<LRepeat, std::shared_ptr<LRepeat>, LinLayer>(m, "LRepeat", ""); pybind11::class_<LReshape, std::shared_ptr<LReshape>, LinLayer>(m, "LReshape", ""); pybind11::class_<LResize, std::shared_ptr<LResize>, LinLayer>(m, "LResize", ""); pybind11::class_<LSelect, std::shared_ptr<LSelect>, LinLayer>(m, "LSelect", ""); pybind11::class_<LShape, std::shared_ptr<LShape>, LinLayer>(m, "LShape", ""); pybind11::class_<LSplit, std::shared_ptr<LSplit>, LinLayer>(m, "LSplit", ""); pybind11::class_<LSqueeze, std::shared_ptr<LSqueeze>, LinLayer>(m, "LSqueeze", ""); pybind11::class_<LTensor, std::shared_ptr<LTensor>, LinLayer>(m, "LTensor", ""); pybind11::class_<LTile, std::shared_ptr<LTile>, LinLayer>(m, "LTile", ""); pybind11::class_<LTopK, std::shared_ptr<LTopK>, LinLayer>(m, "LTopK", ""); pybind11::class_<LTransform, std::shared_ptr<LTransform>, LinLayer>(m, "LTransform", ""); pybind11::class_<LUnsqueeze, std::shared_ptr<LUnsqueeze>, LinLayer>(m, "LUnsqueeze", ""); pybind11::class_<LUpSampling, std::shared_ptr<LUpSampling>, LinLayer>(m, "LUpSampling", ""); pybind11::class_<LUpSampling3D, std::shared_ptr<LUpSampling3D>, LinLayer>(m, "LUpSampling3D", ""); pybind11::class_<LAdd, std::shared_ptr<LAdd>, MLayer>(m, "LAdd", ""); pybind11::class_<LAverage, std::shared_ptr<LAverage>, MLayer>(m, "LAverage", ""); pybind11::class_<LConcat, std::shared_ptr<LConcat>, MLayer>(m, "LConcat", ""); pybind11::class_<LCopyStates, std::shared_ptr<LCopyStates>, MLayer>(m, "LCopyStates", ""); pybind11::class_<LGRU, std::shared_ptr<LGRU>, MLayer>(m, "LGRU", ""); pybind11::class_<LHLSinf, std::shared_ptr<LHLSinf>, MLayer>(m, "LHLSinf", ""); pybind11::class_<LLSTM, std::shared_ptr<LLSTM>, MLayer>(m, "LLSTM", ""); pybind11::class_<LMatMul, std::shared_ptr<LMatMul>, MLayer>(m, "LMatMul", ""); pybind11::class_<LMaximum, std::shared_ptr<LMaximum>, MLayer>(m, "LMaximum", ""); pybind11::class_<LMinimum, std::shared_ptr<LMinimum>, MLayer>(m, "LMinimum", ""); pybind11::class_<LRNN, std::shared_ptr<LRNN>, MLayer>(m, "LRNN", ""); pybind11::class_<LSubtract, std::shared_ptr<LSubtract>, MLayer>(m, "LSubtract", ""); pybind11::class_<LStates, std::shared_ptr<LStates>, MLayer>(m, "LStates", ""); pybind11::class_<LWhere, std::shared_ptr<LWhere>, MLayer>(m, "LWhere", ""); pybind11::class_<LAbs, std::shared_ptr<LAbs>, OperatorLayer>(m, "LAbs", ""); pybind11::class_<LClamp, std::shared_ptr<LClamp>, OperatorLayer>(m, "LClamp", ""); pybind11::class_<LDiff, std::shared_ptr<LDiff>, OperatorLayer>(m, "LDiff", ""); pybind11::class_<LDiv, std::shared_ptr<LDiv>, OperatorLayer>(m, "LDiv", ""); pybind11::class_<LExp, std::shared_ptr<LExp>, OperatorLayer>(m, "LExp", ""); pybind11::class_<LLog, std::shared_ptr<LLog>, OperatorLayer>(m, "LLog", ""); pybind11::class_<LLog10, std::shared_ptr<LLog10>, OperatorLayer>(m, "LLog10", ""); pybind11::class_<LLog2, std::shared_ptr<LLog2>, OperatorLayer>(m, "LLog2", ""); pybind11::class_<LMult, std::shared_ptr<LMult>, OperatorLayer>(m, "LMult", ""); pybind11::class_<LPow, std::shared_ptr<LPow>, OperatorLayer>(m, "LPow", ""); pybind11::class_<LSqrt, std::shared_ptr<LSqrt>, OperatorLayer>(m, "LSqrt", ""); pybind11::class_<LSum, std::shared_ptr<LSum>, OperatorLayer>(m, "LSum", ""); pybind11::class_<LRMax, std::shared_ptr<LRMax>, ReductionLayer>(m, "LRMax", ""); pybind11::class_<LRMean, std::shared_ptr<LRMean>, ReductionLayer>(m, "LRMean", ""); pybind11::class_<LRMin, std::shared_ptr<LRMin>, ReductionLayer>(m, "LRMin", ""); pybind11::class_<LRSum, std::shared_ptr<LRSum>, ReductionLayer>(m, "LRSum", ""); pybind11::class_<LRVar, std::shared_ptr<LRVar>, ReductionLayer>(m, "LRVar", ""); pybind11::class_<LRArgmax, std::shared_ptr<LRArgmax>, ReductionLayer2>(m, "LRArgmax", ""); // tier 3 pybind11::class_<LGauss, std::shared_ptr<LGauss>, GeneratorLayer>(m, "LGauss", ""); pybind11::class_<LUniform, std::shared_ptr<LUniform>, GeneratorLayer>(m, "LUniform", ""); pybind11::class_<LCrop, std::shared_ptr<LCrop>, LDataAugmentation>(m, "LCrop", ""); pybind11::class_<LCropRandom, std::shared_ptr<LCropRandom>, LDataAugmentation>(m, "LCropRandom", ""); pybind11::class_<LCropScaleRandom, std::shared_ptr<LCropScaleRandom>, LDataAugmentation>(m, "LCropScaleRandom", ""); pybind11::class_<LCutout, std::shared_ptr<LCutout>, LDataAugmentation>(m, "LCutout", ""); pybind11::class_<LCutoutRandom, std::shared_ptr<LCutoutRandom>, LDataAugmentation>(m, "LCutoutRandom", ""); pybind11::class_<LFlip, std::shared_ptr<LFlip>, LDataAugmentation>(m, "LFlip", ""); pybind11::class_<LFlipRandom, std::shared_ptr<LFlipRandom>, LDataAugmentation>(m, "LFlipRandom", ""); pybind11::class_<LRotate, std::shared_ptr<LRotate>, LDataAugmentation>(m, "LRotate", ""); pybind11::class_<LRotateRandom, std::shared_ptr<LRotateRandom>, LDataAugmentation>(m, "LRotateRandom", ""); pybind11::class_<LScale, std::shared_ptr<LScale>, LDataAugmentation>(m, "LScale", ""); pybind11::class_<LScaleRandom, std::shared_ptr<LScaleRandom>, LDataAugmentation>(m, "LScaleRandom", ""); pybind11::class_<LShift, std::shared_ptr<LShift>, LDataAugmentation>(m, "LShift", ""); pybind11::class_<LShiftRandom, std::shared_ptr<LShiftRandom>, LDataAugmentation>(m, "LShiftRandom", ""); pybind11::class_<LAveragePool, std::shared_ptr<LAveragePool>, LPool>(m, "LAveragePool", ""); pybind11::class_<LMaxPool, std::shared_ptr<LMaxPool>, LPool>(m, "LMaxPool", ""); pybind11::class_<LAveragePool1D, std::shared_ptr<LAveragePool1D>, LPool1D>(m, "LAveragePool1D", ""); pybind11::class_<LMaxPool1D, std::shared_ptr<LMaxPool1D>, LPool1D>(m, "LMaxPool1D", ""); pybind11::class_<LAveragePool3D, std::shared_ptr<LAveragePool3D>, LPool3D>(m, "LAveragePool3D", ""); pybind11::class_<LMaxPool3D, std::shared_ptr<LMaxPool3D>, LPool3D>(m, "LMaxPool3D", ""); // tier 4 pybind11::class_<LCropScale, std::shared_ptr<LCropScale>, LCrop>(m, "LCropScale", ""); // --- core layers --- m.def("Activation", (class Layer* (*)(class Layer*, string, vector<float>, string)) &eddl::Activation, "C++: eddl::Activation(class Layer*, string, vector<float>, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("activation"), pybind11::arg("params") = vector<float>{}, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Softmax", (class Layer* (*)(class Layer*, int, string)) &eddl::Softmax, "C++: eddl::Softmax(class Layer*, int, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("axis") = -1, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Sigmoid", (class Layer* (*)(class Layer*, string)) &eddl::Sigmoid, "C++: eddl::Sigmoid(class Layer*, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("HardSigmoid", (class Layer* (*)(class Layer*, string)) &eddl::HardSigmoid, "C++: eddl::HardSigmoid(class Layer*, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("ReLu", (class Layer* (*)(class Layer*, string)) &eddl::ReLu, "C++: eddl::ReLu(class Layer*, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("ThresholdedReLu", (class Layer* (*)(class Layer*, float, string)) &eddl::ThresholdedReLu, "C++: eddl::ThresholdedReLu(class Layer*, float, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("alpha") = 1.0, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("LeakyReLu", (class Layer* (*)(class Layer*, float, string)) &eddl::LeakyReLu, "C++: eddl::LeakyReLu(class Layer*, float, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("alpha") = 0.01, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Elu", (class Layer* (*)(class Layer*, float, string)) &eddl::Elu, "C++: eddl::Elu(class Layer*, float, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("alpha") = 1.0, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Selu", (class Layer* (*)(class Layer*, string)) &eddl::Selu, "C++: eddl::Selu(class Layer*, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Exponential", (class Layer* (*)(class Layer*, string)) &eddl::Exponential, "C++: eddl::Exponential(class Layer*, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Softplus", (class Layer* (*)(class Layer*, string)) &eddl::Softplus, "C++: eddl::Softplus(class Layer*, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Softsign", (class Layer* (*)(class Layer*, string)) &eddl::Softsign, "C++: eddl::Softsign(class Layer*, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Linear", (class Layer* (*)(class Layer*, float, string)) &eddl::Linear, "C++: eddl::Linear(class Layer*, float, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("alpha") = 1.0, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Tanh", (class Layer* (*)(class Layer*, string)) &eddl::Tanh, "C++: eddl::Tanh(class Layer*, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Conv", (class Layer* (*)(class Layer*, int, const vector<int>&, const vector<int>&, string, bool, int, const vector<int>&, string)) &eddl::Conv, "C++: eddl::Conv(class Layer*, int, const vector<int>&, const vector<int> &, string, bool, int, const vector<int>&, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("filters"), pybind11::arg("kernel_size"), pybind11::arg("strides") = vector<int>{1, 1}, pybind11::arg("padding") = "same", pybind11::arg("use_bias") = true, pybind11::arg("groups") = 1, pybind11::arg("dilation_rate") = vector<int>{1, 1}, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Conv1D", (class Layer* (*)(class Layer*, int, vector<int>, vector<int>, string, bool, int, const vector<int>, string)) &eddl::Conv1D, "C++: eddl::Conv1D(class Layer*, int, vector<int>, vector<int>, string, bool, int, const vector<int>, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("filters"), pybind11::arg("kernel_size"), pybind11::arg("strides") = vector<int>{1}, pybind11::arg("padding") = "same", pybind11::arg("use_bias") = true, pybind11::arg("groups") = 1, pybind11::arg("dilation_rate") = vector<int>{1}, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Conv2D", (Layer* (*)(Layer*, int, const vector<int>&, const vector<int>&, string, bool, int, const vector<int>&, string)) &eddl::Conv2D, "2D convolution layer", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("filters"), pybind11::arg("kernel_size"), pybind11::arg("strides") = vector<int>{1, 1}, pybind11::arg("padding") = "same", pybind11::arg("use_bias") = true, pybind11::arg("groups") = 1, pybind11::arg("dilation_rate") = vector<int>{1, 1}, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Conv3D", (Layer* (*)(Layer*, int, const vector<int>&, const vector<int>&, string, bool, int, const vector<int>&, string)) &eddl::Conv3D, "3D convolution layer", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("filters"), pybind11::arg("kernel_size"), pybind11::arg("strides") = vector<int>{1, 1, 1}, pybind11::arg("padding") = "same", pybind11::arg("use_bias") = true, pybind11::arg("groups") = 1, pybind11::arg("dilation_rate") = vector<int>{1, 1, 1}, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("PointwiseConv", (class Layer* (*)(class Layer*, int, const vector<int>&, bool, int, const vector<int>&, string)) &eddl::PointwiseConv, "Pointwise convolution", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("filters"), pybind11::arg("strides") = vector<int>{1, 1}, pybind11::arg("use_bias") = true, pybind11::arg("groups") = 1, pybind11::arg("dilation_rate") = vector<int>{1, 1}, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("PointwiseConv2D", (Layer* (*)(Layer*, int, const vector<int>&, bool, int, const vector<int>&, string)) &eddl::PointwiseConv2D, "Pointwise 2D convolution layer", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("filters"), pybind11::arg("strides") = vector<int>{1, 1}, pybind11::arg("use_bias") = true, pybind11::arg("groups") = 1, pybind11::arg("dilation_rate") = vector<int>{1, 1}, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("DepthwiseConv2D", (Layer* (*)(Layer*, const vector<int>&, const vector<int>&, string, bool, const vector<int>&, string)) &eddl::DepthwiseConv2D, "Depthwise 2D convolution layer", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("kernel_size"), pybind11::arg("strides") = vector<int>{1, 1}, pybind11::arg("padding") = "same", pybind11::arg("use_bias") = true, pybind11::arg("dilation_rate") = vector<int>{1, 1}, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("ConvT2D", (Layer* (*)(Layer*, int, const vector<int>&, const vector<int>&, string, bool, int, const vector<int>&, string)) &eddl::ConvT2D, "2D transposed convolution layer", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("filters"), pybind11::arg("kernel_size"), pybind11::arg("strides") = vector<int>{1, 1}, pybind11::arg("padding") = "same", pybind11::arg("use_bias") = true, pybind11::arg("groups") = 1, pybind11::arg("dilation_rate") = vector<int>{1, 1}, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("ConvT3D", (Layer* (*)(Layer*, int, const vector<int>&, const vector<int>&, string, bool, int, const vector<int>&, string)) &eddl::ConvT3D, "3D transposed convolution layer", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("filters"), pybind11::arg("kernel_size"), pybind11::arg("strides") = vector<int>{1, 1, 1}, pybind11::arg("padding") = "same", pybind11::arg("use_bias") = true, pybind11::arg("groups") = 1, pybind11::arg("dilation_rate") = vector<int>{1, 1, 1}, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Dense", (class Layer* (*)(class Layer*, int, bool, string)) &eddl::Dense, "C++: eddl::Dense(class Layer*, int, bool, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("ndim"), pybind11::arg("use_bias") = true, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Embedding", (class Layer* (*)(class Layer*, int, int, int, bool, string)) &eddl::Embedding, "C++: eddl::Embedding(class Layer*, int, int, int, bool, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("vocsize"), pybind11::arg("length"), pybind11::arg("output_dim"), pybind11::arg("mask_zeros") = false, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Input", (class Layer* (*)(const vector<int>&, string)) &eddl::Input, "C++: eddl::Input(const vector<int>&, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("shape"), pybind11::arg("name") = ""); m.def("UpSampling", (class Layer* (*)(class Layer*, const vector<int>&, string, string)) &eddl::UpSampling, "C++: eddl::UpSampling(class Layer*, const vector<int>&, string, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("size"), pybind11::arg("interpolation") = "nearest", pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("UpSampling2D", (Layer* (*)(Layer*, const vector<int>&, string, string)) &eddl::UpSampling2D, "C++: eddl::UpSampling2D(class Layer*, const vector<int>&, string, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("size"), pybind11::arg("interpolation") = "nearest", pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("UpSampling3D", (Layer* (*)(Layer*, vector<int>, bool, string, float, string, string)) &eddl::UpSampling3D, "3D Upsampling layer", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("new_shape"), pybind11::arg("reshape") = true, pybind11::arg("da_mode") = "constant", pybind11::arg("constant") = 0.0f, pybind11::arg("coordinate_transformation_mode") = "asymmetric", pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Resize", (Layer* (*)(Layer*, vector<int>, bool, string, float, string, string)) &eddl::Resize, "Resize the input image", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("new_shape"), pybind11::arg("reshape") = true, pybind11::arg("da_mode") = "constant", pybind11::arg("constant") = 0.0f, pybind11::arg("coordinate_transformation_mode") = "asymmetric", pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Reshape", (class Layer* (*)(class Layer*, const vector<int>&, string)) &eddl::Reshape, "C++: eddl::Reshape(class Layer*, const vector<int>&, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("shape"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Transform", (class Layer* (*)(class Layer*, int, int, int, int, string)) &eddl::Transform, "", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("copy_cpu_to_fpga"), pybind11::arg("copy_fpga_to_cpu"), pybind11::arg("transform"), pybind11::arg("mode"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Flatten", (class Layer* (*)(class Layer*, string)) &eddl::Flatten, "C++: eddl::Flatten(class Layer*, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Repeat", (class Layer* (*)(class Layer*, const vector<unsigned int>&, unsigned int, string)) &eddl::Repeat, "Repeat the elements of the output tensor along the specified dimension", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("repeats"), pybind11::arg("axis"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Repeat", (class Layer* (*)(class Layer*, unsigned int, unsigned int, string)) &eddl::Repeat, "Repeat the elements of the output tensor along the specified dimension", pybind11::arg("parent"), pybind11::arg("repeats"), pybind11::arg("axis"), pybind11::arg("name") = "", pybind11::return_value_policy::reference, pybind11::keep_alive<0, 1>()); m.def("Tile", (class Layer* (*)(class Layer*, const vector<int>&, string)) &eddl::Tile, "Construct a tensor by repeating the elements of input", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("repeats"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Broadcast", (class Layer* (*)(class Layer*, class Layer*, string)) &eddl::Broadcast, "Broadcast output of smaller layer into bigger one", pybind11::return_value_policy::reference, pybind11::arg("parent1"), pybind11::arg("parent2"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Bypass", (class Layer* (*)(class Layer*, string, string)) &eddl::Bypass, "Propagate the output of the parent", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("bypass_name") = "", pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Shape", (class Layer* (*)(class Layer*, bool, string)) &eddl::Shape, "Propagate the output of the parent", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("include_batch") = true, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Squeeze", (Layer* (*)(Layer*, int, string)) &eddl::Squeeze, "C++: eddl::Squeeze(class Layer*, int, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("axis") = -1, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Unsqueeze", (Layer* (*)(Layer*, int, string)) &eddl::Unsqueeze, "C++: eddl::Unsqueeze(class Layer*, int, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("axis") = 0, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Transpose", (class Layer* (*)(class Layer*, string)) &eddl::Transpose, "C++: eddl::Transpose(class Layer*, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("ConstOfTensor", (Layer* (*)(Tensor*, string)) &eddl::ConstOfTensor, "Repeat tensor for each batch", pybind11::return_value_policy::reference, pybind11::arg("t"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Where", (Layer* (*)(Layer*, Layer*, Layer*, string)) &eddl::Where, "Choose elements from layers depending on a condition", pybind11::return_value_policy::reference, pybind11::arg("parent1"), pybind11::arg("parent2"), pybind11::arg("condition"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); // --- transformations --- m.def("Shift", (class Layer* (*)(class Layer*, vector<int>, string, float, string)) &eddl::Shift, "C++: eddl::Shift(class Layer*, vector<int>, string, float, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("shift"), pybind11::arg("da_mode") = "nearest", pybind11::arg("constant") = 0.0f, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Rotate", (class Layer* (*)(class Layer*, float, vector<int>, string, float, string)) &eddl::Rotate, "C++: eddl::Rotate(class Layer*, float, vector<int>, string, float, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("angle"), pybind11::arg("offset_center") = vector<int>{0, 0}, pybind11::arg("da_mode") = "original", pybind11::arg("constant") = 0.0f, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Scale", (class Layer* (*)(class Layer*, vector<int>, bool, string, float, string, string)) &eddl::Scale, "Resize the input image", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("new_shape"), pybind11::arg("reshape") = true, pybind11::arg("da_mode") = "constant", pybind11::arg("constant") = 0.0f, pybind11::arg("coordinate_transformation_mode") = "asymmetric", pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Flip", (class Layer* (*)(class Layer*, int, string)) &eddl::Flip, "C++: eddl::Flip(class Layer*, int, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("axis") = 0, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("HorizontalFlip", (class Layer* (*)(class Layer*, string)) &eddl::HorizontalFlip, "C++: eddl::HorizontalFlip(class Layer*, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Pad", (Layer* (*)(Layer*, vector<int>, float, string)) &eddl::Pad, "Pad image on all sides", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("padding"), pybind11::arg("constant") = 0.0f, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("VerticalFlip", (class Layer* (*)(class Layer*, string)) &eddl::VerticalFlip, "C++: eddl::VerticalFlip(class Layer*, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Crop", (class Layer* (*)(class Layer*, vector<int>, vector<int>, bool, float, string)) &eddl::Crop, "C++: eddl::Crop(class Layer*, vector<int>, vector<int>, bool, float, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("from_coords"), pybind11::arg("to_coords"), pybind11::arg("reshape") = true, pybind11::arg("constant") = 0.0f, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("CenteredCrop", (class Layer* (*)(class Layer*, vector<int>, bool, float, string)) &eddl::CenteredCrop, "C++: eddl::CenteredCrop(class Layer*, vector<int>, bool, float, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("size"), pybind11::arg("reshape") = true, pybind11::arg("constant") = 0.0f, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("CropScale", (class Layer* (*)(class Layer*, vector<int>, vector<int>, string, float, string)) &eddl::CropScale, "C++: eddl::CropScale(class Layer*, vector<int>, vector<int>, string, float, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("from_coords"), pybind11::arg("to_coords"), pybind11::arg("da_mode") = "constant", pybind11::arg("constant") = 0.0f, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Cutout", (class Layer* (*)(class Layer*, vector<int>, vector<int>, float, string)) &eddl::Cutout, "C++: eddl::Cutout(class Layer*, vector<int>, vector<int>, float, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("from_coords"), pybind11::arg("to_coords"), pybind11::arg("constant") = 0.0f, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); // --- data augmentation --- m.def("RandomShift", (class Layer* (*)(class Layer*, vector<float>, vector<float>, string, float, string)) &eddl::RandomShift, "C++: eddl::RandomShift(class Layer*, vector<float>, vector<float>, string, float, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("factor_x"), pybind11::arg("factor_y"), pybind11::arg("da_mode") = "nearest", pybind11::arg("constant") = 0.0f, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("RandomRotation", (class Layer* (*)(class Layer*, vector<float>, vector<int>, string, float, string)) &eddl::RandomRotation, "C++: eddl::RandomRotation(class Layer*, vector<float>, vector<int>, string, float, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("factor"), pybind11::arg("offset_center") = vector<int>{0, 0}, pybind11::arg("da_mode") = "original", pybind11::arg("constant") = 0.0f, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("RandomScale", (class Layer* (*)(class Layer*, vector<float>, string, float, string, string)) &eddl::RandomScale, "Resize the input image randomly", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("factor"), pybind11::arg("da_mode") = "nearest", pybind11::arg("constant") = 0.0f, pybind11::arg("coordinate_transformation_mode") = "asymmetric", pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("RandomFlip", (class Layer* (*)(class Layer*, int, string)) &eddl::RandomFlip, "C++: eddl::RandomFlip(class Layer*, int, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("axis"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("RandomHorizontalFlip", (class Layer* (*)(class Layer*, string)) &eddl::RandomHorizontalFlip, "C++: eddl::RandomHorizontalFlip(class Layer*, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("RandomVerticalFlip", (class Layer* (*)(class Layer*, string)) &eddl::RandomVerticalFlip, "C++: eddl::RandomVerticalFlip(class Layer*, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("RandomCrop", (class Layer* (*)(class Layer*, vector<int>, string)) &eddl::RandomCrop, "C++: eddl::RandomCrop(class Layer*, vector<int>, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("new_shape"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("RandomCropScale", (class Layer* (*)(class Layer*, vector<float>, string, string)) &eddl::RandomCropScale, "C++: eddl::RandomCropScale(class Layer*, vector<float>, string, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("factor"), pybind11::arg("da_mode") = "nearest", pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("RandomCutout", (class Layer* (*)(class Layer*, vector<float>, vector<float>, float, string)) &eddl::RandomCutout, "C++: eddl::RandomCutout(class Layer*, vector<float>, vector<float>, float, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("factor_x"), pybind11::arg("factor_y"), pybind11::arg("constant") = 0.0f, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); // --- losses --- m.def("getLoss", (class Loss* (*)(string)) &eddl::getLoss, "C++: eddl::getLoss(string) --> class Loss*", pybind11::return_value_policy::reference, pybind11::arg("type")); m.def("newloss", (class NetLoss* (*)(const std::function<Layer*(vector<Layer*>)>&, vector<Layer*>, string)) &eddl::newloss, "C++: eddl::newloss(const std::function<Layer*(vector<Layer*>)>&, vector<Layer*>, string) --> class NetLoss*", pybind11::return_value_policy::reference); m.def("newloss", (class NetLoss* (*)(const std::function<Layer*(Layer*)>&, Layer*, string)) &eddl::newloss, "C++: eddl::newloss(const std::function<Layer*(Layer*)>&, Layer*, string) --> class NetLoss*", pybind11::return_value_policy::reference); // --- metrics --- m.def("getMetric", (class Metric* (*)(string)) &eddl::getMetric, "C++: eddl::getMetric(string) --> class Metric*", pybind11::return_value_policy::reference, pybind11::arg("type")); // --- merge layers --- m.def("Add", (class Layer* (*)(const vector<Layer*>&, string)) &eddl::Add, "C++: eddl::Add(const vector<Layer*>, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("layers"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Add", (class Layer * (*)(class Layer *, class Layer *)) &eddl::Add, "Layer that computes the sum of two layers.\n\n \n Layer\n \n\n Layer\n \n\n The result after computing the sum between layers l1 and l2\n\nC++: eddl::Add(class Layer *, class Layer *) --> class Layer *", pybind11::return_value_policy::reference, pybind11::arg("l1"), pybind11::arg("l2"), pybind11::keep_alive<0, 1>(), pybind11::keep_alive<0, 2>()); m.def("Add", (class Layer * (*)(class Layer *, float)) &eddl::Add, "Layer that computes the sum of a float number and a layer.\n\n \n Parent layer\n \n\n Number\n \n\n Parent layer l1 after computing his sum with k\n\nC++: eddl::Add(class Layer *, float) --> class Layer *", pybind11::return_value_policy::reference, pybind11::arg("l1"), pybind11::arg("k"), pybind11::keep_alive<0, 1>()); m.def("Add", (class Layer * (*)(float, class Layer *)) &eddl::Add, "C++: eddl::Add(float, class Layer *) --> class Layer *", pybind11::return_value_policy::reference, pybind11::arg("k"), pybind11::arg("l1"), pybind11::keep_alive<0, 2>()); m.def("Average", (class Layer* (*)(const vector<Layer*>, string)) &eddl::Average, "C++: eddl::Average(const vector<Layer*>, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("layers"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Concat", (class Layer* (*)(const vector<Layer*>, unsigned int, string)) &eddl::Concat, "C++: eddl::Concat(const vector<Layer*>, unsigned int, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("layers"), pybind11::arg("axis") = 0, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("MatMul", (class Layer* (*)(const vector<Layer*>, string)) &eddl::MatMul, "C++: eddl::MatMul(const vector<Layer*>, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("layers"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Maximum", (class Layer* (*)(const vector<Layer*>, string)) &eddl::Maximum, "C++: eddl::Maximum(const vector<Layer*>, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("layers"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Minimum", (class Layer* (*)(const vector<Layer*>, string)) &eddl::Minimum, "C++: eddl::Minimum(const vector<Layer*>, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("layers"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Subtract", (class Layer* (*)(const vector<Layer*>, string)) &eddl::Subtract, "C++: eddl::Subtract(const vector<Layer*>, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("layers"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); // --- noise layers --- m.def("GaussianNoise", (class Layer* (*)(class Layer*, float, string)) &eddl::GaussianNoise, "C++: eddl::GaussianNoise(class Layer*, float, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("stddev"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); // --- normalization layers --- m.def("BatchNormalization", (class Layer* (*)(class Layer*, bool, float, float, string)) &eddl::BatchNormalization, "C++: eddl::BatchNormalization(class Layer*, bool, float, float, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("affine"), pybind11::arg("momentum") = 0.99f, pybind11::arg("epsilon") = 0.001f, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("LayerNormalization", (class Layer* (*)(class Layer*, bool, float, string)) &eddl::LayerNormalization, "C++: eddl::LayerNormalization(class Layer*, bool, float, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("affine"), pybind11::arg("epsilon") = 0.00001f, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("GroupNormalization", (class Layer* (*)(class Layer*, int, float, bool, string)) &eddl::GroupNormalization, "C++: eddl::GroupNormalization(class Layer*, int, float, bool, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("groups"), pybind11::arg("epsilon") = 0.001f, pybind11::arg("affine") = true, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Norm", (class Layer* (*)(class Layer*, float, string)) &eddl::Norm, "C++: eddl::Norm(class Layer*, float, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("epsilon") = 0.001f, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("NormMax", (class Layer* (*)(class Layer*, float, string)) &eddl::NormMax, "C++: eddl::NormMax(class Layer*, float, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("epsilon") = 0.001f, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("NormMinMax", (class Layer* (*)(class Layer*, float, string)) &eddl::NormMinMax, "C++: eddl::NormMinMax(class Layer*, float, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("epsilon") = 0.001f, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Dropout", (class Layer* (*)(class Layer*, float, bool, string)) &eddl::Dropout, "C++: eddl::Dropout(class Layer*, float, bool, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("rate"), pybind11::arg("iw") = true, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); // --- operator layers --- m.def("Abs", (class Layer* (*)(class Layer*)) &eddl::Abs, "C++: eddl::Abs(class Layer*) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l"), pybind11::keep_alive<0, 1>()); m.def("Sub", (class Layer* (*)(class Layer*, class Layer*)) &eddl::Sub, "C++: eddl::Sub(class Layer*, class Layer*) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l1"), pybind11::arg("l2"), pybind11::keep_alive<0, 1>(), pybind11::keep_alive<0, 2>()); m.def("Sub", (class Layer* (*)(class Layer*, float)) &eddl::Sub, "C++: eddl::Sub(class Layer*, float) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l1"), pybind11::arg("k"), pybind11::keep_alive<0, 1>()); m.def("Sub", (class Layer* (*)(float, class Layer*)) &eddl::Sub, "C++: eddl::Sub(float, class Layer*) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("k"), pybind11::arg("l1"), pybind11::keep_alive<0, 2>()); m.def("Diff", (class Layer* (*)(class Layer*, class Layer*)) &eddl::Diff, "C++: eddl::Diff(class Layer*, class Layer*) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l1"), pybind11::arg("l2"), pybind11::keep_alive<0, 1>(), pybind11::keep_alive<0, 2>()); m.def("Diff", (class Layer* (*)(class Layer*, float)) &eddl::Diff, "C++: eddl::Diff(class Layer*, float) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l1"), pybind11::arg("k"), pybind11::keep_alive<0, 1>()); m.def("Diff", (class Layer* (*)(float, class Layer*)) &eddl::Diff, "C++: eddl::Diff(float, class Layer*) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("k"), pybind11::arg("l1"), pybind11::keep_alive<0, 2>()); m.def("Div", (class Layer* (*)(class Layer*, class Layer*)) &eddl::Div, "C++: eddl::Div(class Layer*, class Layer*) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l1"), pybind11::arg("l2"), pybind11::keep_alive<0, 1>(), pybind11::keep_alive<0, 2>()); m.def("Div", (class Layer* (*)(class Layer*, float)) &eddl::Div, "C++: eddl::Div(class Layer*, float) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l1"), pybind11::arg("k"), pybind11::keep_alive<0, 1>()); m.def("Div", (class Layer* (*)(float, class Layer*)) &eddl::Div, "C++: eddl::Div(float, class Layer*) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("k"), pybind11::arg("l1"), pybind11::keep_alive<0, 2>()); m.def("Exp", (class Layer* (*)(class Layer*)) &eddl::Exp, "C++: eddl::Exp(class Layer*) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l"), pybind11::keep_alive<0, 1>()); m.def("Log", (class Layer* (*)(class Layer*)) &eddl::Log, "C++: eddl::Log(class Layer*) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l"), pybind11::keep_alive<0, 1>()); m.def("Log2", (class Layer* (*)(class Layer*)) &eddl::Log2, "C++: eddl::Log2(class Layer*) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l"), pybind11::keep_alive<0, 1>()); m.def("Log10", (class Layer* (*)(class Layer*)) &eddl::Log10, "C++: eddl::Log10(class Layer*) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l"), pybind11::keep_alive<0, 1>()); m.def("Clamp", (class Layer* (*)(class Layer*, float, float, string)) &eddl::Clamp, "Clamps all elements in input into the range [min, max]", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("min"), pybind11::arg("max"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Clip", (class Layer* (*)(class Layer*, float, float, string)) &eddl::Clip, "Clamps all elements in input into the range [min, max]", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("min"), pybind11::arg("max"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Mult", (class Layer* (*)(class Layer*, class Layer*)) &eddl::Mult, "C++: eddl::Mult(class Layer*, class Layer*) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l1"), pybind11::arg("l2"), pybind11::keep_alive<0, 1>(), pybind11::keep_alive<0, 2>()); m.def("Mult", (class Layer* (*)(class Layer*, float)) &eddl::Mult, "C++: eddl::Mult(class Layer*, float) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l1"), pybind11::arg("k"), pybind11::keep_alive<0, 1>()); m.def("Mult", (class Layer* (*)(float, class Layer*)) &eddl::Mult, "C++: eddl::Mult(float, class Layer*) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("k"), pybind11::arg("l1"), pybind11::keep_alive<0, 2>()); m.def("Pow", (class Layer* (*)(class Layer*, float)) &eddl::Pow, "C++: eddl::Pow(class Layer*, float) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l1"), pybind11::arg("k"), pybind11::keep_alive<0, 1>()); m.def("Sqrt", (class Layer* (*)(class Layer*)) &eddl::Sqrt, "C++: eddl::Sqrt(class Layer*) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l"), pybind11::keep_alive<0, 1>()); m.def("Sum", (class Layer* (*)(class Layer*, class Layer*)) &eddl::Sum, "C++: eddl::Sum(class Layer*, class Layer*) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l1"), pybind11::arg("l2"), pybind11::keep_alive<0, 1>(), pybind11::keep_alive<0, 2>()); m.def("Sum", (class Layer* (*)(class Layer*, float)) &eddl::Sum, "C++: eddl::Sum(class Layer*, float) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l1"), pybind11::arg("k"), pybind11::keep_alive<0, 1>()); m.def("Sum", (class Layer* (*)(float, class Layer*)) &eddl::Sum, "C++: eddl::Sum(float, class Layer*) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("k"), pybind11::arg("l1"), pybind11::keep_alive<0, 2>()); m.def("Select", (class Layer* (*)(class Layer*, vector<string>, string)) &eddl::Select, "C++: eddl::Select(class Layer*, vector<string>, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l"), pybind11::arg("indices"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Slice", (class Layer* (*)(class Layer*, vector<string>, string)) &eddl::Slice, "Alias for Select", pybind11::return_value_policy::reference, pybind11::arg("l"), pybind11::arg("indices"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Expand", (Layer* (*)(Layer*, int, string)) &eddl::Expand, "Expand singleton dimensions", pybind11::return_value_policy::reference, pybind11::arg("l"), pybind11::arg("size"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Split", (vector<Layer*> (*)(Layer*, vector<int>, int, bool, string)) &eddl::Split, "Split layer into list of tensor layers", pybind11::return_value_policy::reference, pybind11::arg("l"), pybind11::arg("indexes"), pybind11::arg("axis") = -1, pybind11::arg("merge_sublayers") = false, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("Permute", (class Layer* (*)(class Layer*, vector<int>, string)) &eddl::Permute, "C++: eddl::Permute(class Layer*, vector<int>, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l"), pybind11::arg("dims"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); // --- reduction layers --- m.def("ReduceMean", (class Layer* (*)(class Layer*, vector<int>, bool)) &eddl::ReduceMean, "C++: eddl::ReduceMean(class Layer*, vector<int>, bool) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l"), pybind11::arg("axis"), pybind11::arg("keepdims") = false, pybind11::keep_alive<0, 1>()); m.def("ReduceVar", (class Layer* (*)(class Layer*, vector<int>, bool)) &eddl::ReduceVar, "C++: eddl::ReduceVar(class Layer*, vector<int>, bool) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l"), pybind11::arg("axis"), pybind11::arg("keepdims") = false, pybind11::keep_alive<0, 1>()); m.def("ReduceSum", (class Layer* (*)(class Layer*, vector<int>, bool)) &eddl::ReduceSum, "C++: eddl::ReduceSum(class Layer*, vector<int>, bool) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l"), pybind11::arg("axis"), pybind11::arg("keepdims") = false, pybind11::keep_alive<0, 1>()); m.def("ReduceMax", (class Layer* (*)(class Layer*, vector<int>, bool)) &eddl::ReduceMax, "C++: eddl::ReduceMax(class Layer*, vector<int>, bool) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l"), pybind11::arg("axis"), pybind11::arg("keepdims") = false, pybind11::keep_alive<0, 1>()); m.def("ReduceMin", (class Layer* (*)(class Layer*, vector<int>, bool)) &eddl::ReduceMin, "C++: eddl::ReduceMin(class Layer*, vector<int>, bool) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l"), pybind11::arg("axis"), pybind11::arg("keepdims") = false, pybind11::keep_alive<0, 1>()); m.def("ReduceArgMax", (class Layer* (*)(class Layer*, vector<int>, bool)) &eddl::ReduceArgMax, "C++: eddl::ReduceArgMax(class Layer*, vector<int>, bool) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l"), pybind11::arg("axis"), pybind11::arg("keepdims") = false, pybind11::keep_alive<0, 1>()); // --- generator layers --- m.def("GaussGenerator", (class Layer* (*)(float, float, vector<int>)) &eddl::GaussGenerator, "C++: eddl::GaussGenerator(float, float, vector<int>) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("mean"), pybind11::arg("stdev"), pybind11::arg("size")); m.def("UniformGenerator", (class Layer* (*)(float, float, vector<int>)) &eddl::UniformGenerator, "C++: eddl::UniformGenerator(float, float, vector<int>) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("low"), pybind11::arg("high"), pybind11::arg("size")); // --- optimizers --- m.def("setlr", (void (*)(class Net*, vector<float>)) &eddl::setlr, "C++: eddl::setlr(class Net*, vector<float>) --> void", pybind11::arg("net"), pybind11::arg("p")); m.def("adadelta", (class Optimizer* (*)(float, float, float, float)) &eddl::adadelta, "C++: eddl::adadelta(float, float, float, float) --> class Optimizer *", pybind11::return_value_policy::reference, pybind11::arg("lr"), pybind11::arg("rho"), pybind11::arg("epsilon"), pybind11::arg("weight_decay")); m.def("adam", (class Optimizer* (*)(float, float, float, float, float, bool)) &eddl::adam, "C++: eddl::adam(float, float, float, float, float, bool) --> class Optimizer *", pybind11::return_value_policy::reference, pybind11::arg("lr") = 0.01, pybind11::arg("beta_1") = 0.9, pybind11::arg("beta_2") = 0.999, pybind11::arg("epsilon")=0.000001, pybind11::arg("weight_decay") = 0, pybind11::arg("amsgrad") = false); m.def("adagrad", (class Optimizer* (*)(float, float, float)) &eddl::adagrad, "C++: eddl::adagrad(float, float, float) --> class Optimizer *", pybind11::return_value_policy::reference, pybind11::arg("lr"), pybind11::arg("epsilon"), pybind11::arg("weight_decay")); m.def("adamax", (class Optimizer* (*)(float, float, float, float, float)) &eddl::adamax, "C++: eddl::adamax(float, float, float, float, float) --> class Optimizer *", pybind11::return_value_policy::reference, pybind11::arg("lr"), pybind11::arg("beta_1"), pybind11::arg("beta_2"), pybind11::arg("epsilon"), pybind11::arg("weight_decay")); m.def("nadam", (class Optimizer* (*)(float, float, float, float, float)) &eddl::nadam, "C++: eddl::nadam(float, float, float, float, float) --> class Optimizer *", pybind11::return_value_policy::reference, pybind11::arg("lr"), pybind11::arg("beta_1"), pybind11::arg("beta_2"), pybind11::arg("epsilon"), pybind11::arg("schedule_decay")); m.def("rmsprop", (class Optimizer* (*)(float, float, float, float)) &eddl::rmsprop, "C++: eddl::rmsprop(float, float, float, float) --> class Optimizer *", pybind11::return_value_policy::reference, pybind11::arg("lr") = 0.01, pybind11::arg("rho") = 0.9, pybind11::arg("epsilon") = 0.00001, pybind11::arg("weight_decay") = 0.0); m.def("sgd", (class Optimizer* (*)(float, float, float, bool)) &eddl::sgd, "C++: eddl::sgd(float, float, float, bool) --> class Optimizer *", pybind11::return_value_policy::reference, pybind11::arg("lr") = 0.01f, pybind11::arg("momentum") = 0.0f, pybind11::arg("weight_decay") = 0.0f, pybind11::arg("nesterov") = false); // --- pooling layers --- m.def("AveragePool", (class Layer* (*)(class Layer*, const vector<int>&, const vector<int> &, string, string)) &eddl::AveragePool, "C++: eddl::AveragePool(class Layer*, const vector<int>&, const vector<int> &, string, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("pool_size") = vector<int>{2, 2}, pybind11::arg("strides") = vector<int>{2, 2}, pybind11::arg("padding") = "none", pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("AvgPool", (Layer* (*)(Layer*, const vector<int>&, const vector<int> &, string, string)) &eddl::AvgPool, "Alias for AveragePool", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("pool_size") = vector<int>{2, 2}, pybind11::arg("strides") = vector<int>{2, 2}, pybind11::arg("padding") = "none", pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("AveragePool1D", (Layer* (*)(Layer*, vector<int>, vector<int>, string, string)) &eddl::AveragePool1D, "1D average pooling", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("pool_size") = vector<int>{2}, pybind11::arg("strides") = vector<int>{2}, pybind11::arg("padding") = "none", pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("AvgPool1D", (Layer* (*)(Layer*, vector<int>, vector<int>, string, string)) &eddl::AvgPool1D, "Alias for AveragePool1D", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("pool_size") = vector<int>{2}, pybind11::arg("strides") = vector<int>{2}, pybind11::arg("padding") = "none", pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("AveragePool2D", (Layer* (*)(Layer*, vector<int>, vector<int>, string, string)) &eddl::AveragePool2D, "2D average pooling", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("pool_size") = vector<int>{2, 2}, pybind11::arg("strides") = vector<int>{2, 2}, pybind11::arg("padding") = "none", pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("AvgPool2D", (Layer* (*)(Layer*, vector<int>, vector<int>, string, string)) &eddl::AvgPool2D, "Alias for AveragePool2D", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("pool_size") = vector<int>{2, 2}, pybind11::arg("strides") = vector<int>{2, 2}, pybind11::arg("padding") = "none", pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("AveragePool3D", (Layer* (*)(Layer*, vector<int>, vector<int>, string, string)) &eddl::AveragePool3D, "3D average pooling", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("pool_size") = vector<int>{2, 2, 2}, pybind11::arg("strides") = vector<int>{2, 2, 2}, pybind11::arg("padding") = "none", pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("AvgPool3D", (Layer* (*)(Layer*, vector<int>, vector<int>, string, string)) &eddl::AvgPool3D, "Alias for AveragePool3D", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("pool_size") = vector<int>{2, 2, 2}, pybind11::arg("strides") = vector<int>{2, 2, 2}, pybind11::arg("padding") = "none", pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("GlobalMaxPool", (class Layer* (*)(Layer*, string)) &eddl::GlobalMaxPool, "C++: eddl::GlobalMaxPool(Layer*, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("GlobalMaxPool1D", (class Layer* (*)(Layer*, string)) &eddl::GlobalMaxPool1D, "GlobalMaxPooling1D operation.", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("GlobalMaxPool2D", (class Layer* (*)(Layer*, string)) &eddl::GlobalMaxPool2D, "GlobalMaxPooling2D operation.", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("GlobalMaxPool3D", (class Layer* (*)(Layer*, string)) &eddl::GlobalMaxPool3D, "GlobalMaxPooling3D operation.", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("GlobalAveragePool", (class Layer* (*)(Layer*, string)) &eddl::GlobalAveragePool, "C++: eddl::GlobalAveragePool(Layer*, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("GlobalAvgPool", (class Layer* (*)(Layer*, string)) &eddl::GlobalAvgPool, "Alias for GlobalAveragePool", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("GlobalAveragePool1D", (Layer* (*)(Layer*, string)) &eddl::GlobalAveragePool1D, "C++: eddl::GlobalAveragePool1D(Layer*, string) --> Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("GlobalAvgPool1D", (Layer* (*)(Layer*, string)) &eddl::GlobalAvgPool1D, "Alias for GlobalAveragePool1D", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("GlobalAveragePool2D", (Layer* (*)(Layer*, string)) &eddl::GlobalAveragePool2D, "C++: eddl::GlobalAveragePool2D(Layer*, string) --> Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("GlobalAvgPool2D", (Layer* (*)(Layer*, string)) &eddl::GlobalAvgPool2D, "Alias for GlobalAveragePool2D", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("GlobalAveragePool3D", (Layer* (*)(Layer*, string)) &eddl::GlobalAveragePool3D, "C++: eddl::GlobalAveragePool3D(Layer*, string) --> Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("GlobalAvgPool3D", (Layer* (*)(Layer*, string)) &eddl::GlobalAvgPool3D, "Alias for GlobalAveragePool3D", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("MaxPool", (class Layer* (*)(class Layer*, const vector<int>&, const vector<int> &, string, string)) &eddl::MaxPool, "C++: eddl::MaxPool(class Layer*, const vector<int>&, const vector<int> &, string, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("pool_size") = vector<int>{2, 2}, pybind11::arg("strides") = vector<int>{2, 2}, pybind11::arg("padding") = "none", pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("MaxPool1D", (class Layer* (*)(class Layer*, vector<int>, vector<int> &, string, string)) &eddl::MaxPool1D, "C++: eddl::MaxPool1D(class Layer*, vector<int>, vector<int>, string, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("pool_size") = vector<int>{2}, pybind11::arg("strides") = vector<int>{2}, pybind11::arg("padding") = "none", pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("MaxPool2D", (Layer* (*)(Layer*, vector<int>, vector<int>, string, string)) &eddl::MaxPool2D, "MaxPooling2D operation.", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("pool_size") = vector<int>{2, 2}, pybind11::arg("strides") = vector<int>{2, 2}, pybind11::arg("padding") = "none", pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("MaxPool3D", (Layer* (*)(Layer*, vector<int>, vector<int>, string, string)) &eddl::MaxPool3D, "MaxPooling3D operation.", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("pool_size") = vector<int>{2, 2, 2}, pybind11::arg("strides") = vector<int>{2, 2, 2}, pybind11::arg("padding") = "none", pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); // --- recurrent layers --- m.def("RNN", (class Layer* (*)(class Layer*, int, string, bool, bool, string)) &eddl::RNN, "C++: eddl::RNN(class Layer*, int, string, bool, bool, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("units"), pybind11::arg("activation") = "tanh", pybind11::arg("use_bias") = true, pybind11::arg("bidirectional") = false, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("LSTM", (class Layer* (*)(class Layer*, int, bool, bool, string)) &eddl::LSTM, "C++: eddl::LSTM(class Layer*, int, bool, bool, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("units"), pybind11::arg("mask_zeros") = false, pybind11::arg("bidirectional") = false, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("LSTM", (class Layer* (*)(vector<Layer*>, int, bool, bool, string)) &eddl::LSTM, "C++: eddl::LSTM(vector<Layer*>, int, bool, bool, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("units"), pybind11::arg("mask_zeros") = false, pybind11::arg("bidirectional") = false, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("States", (Layer* (*)(const vector<int>&, string)) &eddl::States, "C++: eddl::States(const vector<int>&, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("shape"), pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("GRU", (Layer* (*)(Layer*, int, bool, bool, string)) &eddl::GRU, "C++: eddl::GRU(Layer*, int, bool, bool, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("units"), pybind11::arg("mask_zeros") = false, pybind11::arg("bidirectional") = false, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("GRU", (Layer* (*)(vector<Layer*>, int, bool, bool, string)) &eddl::GRU, "C++: eddl::GRU(vector<Layer*>, int, bool, bool, string) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("units"), pybind11::arg("mask_zeros") = false, pybind11::arg("bidirectional") = false, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); m.def("GetStates", (Layer* (*)(Layer*)) &eddl::GetStates, "C++: eddl::GetStates(Layer*) --> Layer*", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::keep_alive<0, 1>()); m.def("setDecoder", (void (*)(Layer*)) &eddl::setDecoder, "C++: eddl::setDecoder(Layer*) --> void", pybind11::arg("l")); // --- initializers --- m.def("GlorotNormal", (class Layer* (*)(class Layer*, int)) &eddl::GlorotNormal, "C++: eddl::GlorotNormal(class Layer*, int) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l"), pybind11::arg("seed") = 1234, pybind11::keep_alive<0, 1>()); m.def("GlorotUniform", (class Layer* (*)(class Layer*, int)) &eddl::GlorotUniform, "C++: eddl::GlorotUniform(class Layer*, int) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l"), pybind11::arg("seed") = 1234, pybind11::keep_alive<0, 1>()); m.def("HeNormal", (class Layer* (*)(class Layer*, int)) &eddl::HeNormal, "C++: eddl::HeNormal(class Layer*, int) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l"), pybind11::arg("seed") = 1234, pybind11::keep_alive<0, 1>()); m.def("HeUniform", (class Layer* (*)(class Layer*, int)) &eddl::HeUniform, "C++: eddl::HeUniform(class Layer*, int) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l"), pybind11::arg("seed") = 1234, pybind11::keep_alive<0, 1>()); m.def("RandomNormal", (class Layer* (*)(class Layer*, float, float, float)) &eddl::RandomNormal, "C++: eddl::RandomNormal(class Layer*, float, float, float) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l"), pybind11::arg("m") = 0.0, pybind11::arg("s") = 0.1, pybind11::arg("seed") = 1234, pybind11::keep_alive<0, 1>()); m.def("RandomUniform", (class Layer* (*)(class Layer*, float, float, float)) &eddl::RandomUniform, "C++: eddl::RandomUniform(class Layer*, float, float, float) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l"), pybind11::arg("min") = 0.0, pybind11::arg("max") = 0.1, pybind11::arg("seed") = 1234, pybind11::keep_alive<0, 1>()); m.def("Constant", (class Layer* (*)(class Layer*, float)) &eddl::Constant, "C++: eddl::Constant(class Layer*, float) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l"), pybind11::arg("v") = 0.1, pybind11::keep_alive<0, 1>()); // --- regularizers --- m.def("L2", (class Layer* (*)(class Layer*, float)) &eddl::L2, "C++: eddl::L2(class Layer*, float) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l"), pybind11::arg("l2"), pybind11::keep_alive<0, 1>()); m.def("L1", (class Layer* (*)(class Layer*, float)) &eddl::L1, "C++: eddl::L1(class Layer*, float) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l"), pybind11::arg("l1"), pybind11::keep_alive<0, 1>()); m.def("L1L2", (class Layer* (*)(class Layer*, float, float)) &eddl::L1L2, "C++: eddl::L1L2(class Layer*, float, float) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l"), pybind11::arg("l1"), pybind11::arg("l2"), pybind11::keep_alive<0, 1>()); // --- computing services --- m.def("CS_CPU", (class CompServ* (*)(int, string)) &eddl::CS_CPU, "Executes the code in the CPU", pybind11::return_value_policy::reference, pybind11::arg("th") = -1, pybind11::arg("mem") = "full_mem"); m.def("CS_GPU", (class CompServ* (*)(const vector<int>&, const string&)) &eddl::CS_GPU, "Executes the code in the GPU", pybind11::return_value_policy::reference, pybind11::arg("g"), pybind11::arg("mem") = "full_mem"); m.def("CS_GPU", (class CompServ* (*)(const vector<int>&, int, const string&)) &eddl::CS_GPU, "Executes the code in the GPU", pybind11::return_value_policy::reference, pybind11::arg("g"), pybind11::arg("lsb"), pybind11::arg("mem") = "full_mem"); m.def("CS_FPGA", (class CompServ* (*)(const vector<int>&, int)) &eddl::CS_FPGA, "Executes the code in the FPGA", pybind11::return_value_policy::reference, pybind11::arg("f"), pybind11::arg("lsb") = 1); m.def("CS_COMPSS", (class CompServ* (*)(const string&)) &eddl::CS_COMPSS, "Executes the code through the COMPSs framework", pybind11::return_value_policy::reference, pybind11::arg("filename")); m.def("exist", (bool (*)(string)) &eddl::exist, "C++: eddl::exist(string) --> bool", pybind11::arg("name")); // --- fine-grained methods --- m.def("random_indices", (vector<int> (*)(int, int)) &eddl::random_indices, "C++: eddl::random_indices(int, int) --> vector<int>", pybind11::arg("batch_size"), pybind11::arg("num_samples")); m.def("train_batch", (void (*)(class Net*, vector<Tensor*>, vector<Tensor*>, vector<int>)) &eddl::train_batch, "C++: eddl::train_batch(class Net*, vector<Tensor*>, vector<Tensor*>, vector<int>) --> void", pybind11::call_guard<pybind11::gil_scoped_release>(), pybind11::arg("net"), pybind11::arg("in"), pybind11::arg("out"), pybind11::arg("indices")); m.def("train_batch", (void (*)(class Net*, vector<Tensor*>, vector<Tensor*>)) &eddl::train_batch, "C++: eddl::train_batch(class Net*, vector<Tensor*>, vector<Tensor*>) --> void", pybind11::call_guard<pybind11::gil_scoped_release>(), pybind11::arg("net"), pybind11::arg("in"), pybind11::arg("out")); m.def("eval_batch", (void (*)(class Net*, vector<Tensor*>, vector<Tensor*>, vector<int>)) &eddl::eval_batch, "C++: eddl::eval_batch(class Net*, vector<Tensor*>, vector<Tensor*>, vector<int>) --> void", pybind11::call_guard<pybind11::gil_scoped_release>(), pybind11::arg("net"), pybind11::arg("in"), pybind11::arg("out"), pybind11::arg("indices")); m.def("eval_batch", (void (*)(class Net*, vector<Tensor*>, vector<Tensor*>)) &eddl::eval_batch, "C++: eddl::eval_batch(class Net*, vector<Tensor*>, vector<Tensor*>) --> void", pybind11::call_guard<pybind11::gil_scoped_release>(), pybind11::arg("net"), pybind11::arg("in"), pybind11::arg("out")); m.def("next_batch", (void (*)(vector<Tensor*>, vector<Tensor*>)) &eddl::next_batch, "C++: eddl::next_batch(vector<Tensor*>, vector<Tensor*>) --> void", pybind11::arg("in"), pybind11::arg("out")); m.def("forward", (vector<Layer*> (*)(class Net*, vector<Layer*>)) &eddl::forward, "C++: eddl::forward(class Net*, vector<Layer*>) --> vector<Layer*>", pybind11::return_value_policy::reference, pybind11::arg("m"), pybind11::arg("in")); m.def("forward", (vector<Layer*> (*)(class Net*, vector<Tensor*>)) &eddl::forward, "C++: eddl::forward(class Net*, vector<Tensor*>) --> vector<Layer*>", pybind11::return_value_policy::reference, pybind11::arg("m"), pybind11::arg("in")); m.def("forward", (vector<Layer*> (*)(class Net*)) &eddl::forward, "C++: eddl::forward(class Net*) --> vector<Layer*>", pybind11::return_value_policy::reference, pybind11::arg("m")); m.def("forward", (vector<Layer*> (*)(class Net*, int)) &eddl::forward, "C++: eddl::forward(class Net*, int) --> vector<Layer*>", pybind11::return_value_policy::reference, pybind11::arg("m"), pybind11::arg("b")); m.def("detach", (class Layer* (*)(class Layer*)) &eddl::detach, "C++: eddl::detach(class Layer*) --> class Layer*", pybind11::return_value_policy::reference, pybind11::arg("l")); m.def("detach", (class vector<Layer*> (*)(class vector<Layer*>)) &eddl::detach, "C++: eddl::detach(class vector<Layer*>) --> class vector<Layer*>", pybind11::return_value_policy::reference, pybind11::arg("l")); m.def("backward", (void (*)(class Net*, vector<Tensor*>)) &eddl::backward, "C++: eddl::backward(class Net*, vector<Tensor*>) --> void", pybind11::arg("m"), pybind11::arg("target")); m.def("optimize", (void (*)(vector<NetLoss*>)) &eddl::optimize, "C++: eddl::optimize(vector<NetLoss*>) --> void", pybind11::arg("l")); m.def("getOut", (vector<Layer*> (*)(class Net*)) &eddl::getOut, "C++: eddl::getOut(class Net*) --> vector<Layer*>", pybind11::return_value_policy::reference, pybind11::arg("net")); m.def("get_losses", (vector<float> (*)(class Net*)) &eddl::get_losses, "Get model losses", pybind11::arg("m")); m.def("get_metrics", (vector<float> (*)(class Net*)) &eddl::get_metrics, "Get model metrics", pybind11::arg("m")); // --- manage tensors inside layers --- m.def("getParams", (vector<Tensor*> (*)(class Layer *)) &eddl::getParams, "C++: eddl::getParams(class Layer *) --> vector<Tensor*>", pybind11::arg("l1")); m.def("getGradients", (vector<Tensor*> (*)(class Layer *)) &eddl::getGradients, "C++: eddl::getGradients(class Layer *) --> vector<Tensor*>", pybind11::arg("l1")); m.def("getStates", (vector<Tensor*> (*)(class Layer *)) &eddl::getStates, "C++: eddl::getStates(class Layer *) --> vector<Tensor*>", pybind11::arg("l1")); // --- model methods --- m.def("Model", (class Net* (*)(vector<Layer*>, vector<Layer*>)) &eddl::Model, "C++: eddl::Model(vector<Layer*>, vector<Layer*>) --> class Net*", pybind11::arg("in"), pybind11::arg("out"), pybind11::keep_alive<0, 1>(), pybind11::keep_alive<0, 2>()); m.def("setName", (void (*)(class Net*, string)) &eddl::setName, "C++: eddl::setName(class Net*, string) --> void", pybind11::arg("m"), pybind11::arg("name")); m.def("getLayer", (Layer* (*)(class Net*, string)) &eddl::getLayer, "C++: eddl::getLayer(class Net*, string) --> Layer*", pybind11::return_value_policy::reference, pybind11::arg("net"), pybind11::arg("l")); m.def("removeLayer", (void (*)(class Net*, string)) &eddl::removeLayer, "C++: eddl::removeLayer(class Net*, string) --> void", pybind11::arg("net"), pybind11::arg("l")); m.def("initializeLayer", (void (*)(class Net*, string)) &eddl::initializeLayer, "C++: eddl::initializeLayer(class Net*, string) --> void", pybind11::arg("net"), pybind11::arg("l")); m.def("setTrainable", (void (*)(class Net*, string, bool)) &eddl::setTrainable, "C++: eddl::setTrainable(class Net*, string, bool) --> void", pybind11::arg("net"), pybind11::arg("lanme"), pybind11::arg("val")); m.def("get_parameters", (vector<vector<Tensor*>> (*)(class Net*, bool)) &eddl::get_parameters, "C++: eddl::get_parameters(class Net*, bool) --> vector<vector<Tensor*>>", pybind11::return_value_policy::reference, pybind11::arg("net"), pybind11::arg("deepcopy")=false); m.def("set_parameters", (void (*)(class Net*, const vector<vector<Tensor*>>&)) &eddl::set_parameters, "C++: eddl::set_parameters(class Net*, const vector<vector<Tensor*>>&) --> void", pybind11::arg("net"), pybind11::arg("params")); m.def("build", (void (*)(class Net*, class Optimizer*, const vector<string>&, const vector<string>&, class CompServ*, bool)) &eddl::build, "Configure the model for training", pybind11::arg("net"), pybind11::arg("o"), pybind11::arg("lo"), pybind11::arg("me"), pybind11::arg("cs") = nullptr, pybind11::arg("init_weights") = true, pybind11::keep_alive<1, 2>(), pybind11::keep_alive<1, 5>()); m.def("toGPU", (void (*)(class Net*, const string&)) &eddl::toGPU, "Assign model operations to the GPU", pybind11::arg("net"), pybind11::arg("mem") = "full_mem"); m.def("toGPU", (void (*)(class Net*, vector<int>, const string&)) &eddl::toGPU, "Assign model operations to the GPU", pybind11::arg("net"), pybind11::arg("g") = vector<int>{1}, pybind11::arg("mem") = "full_mem"); m.def("toGPU", (void (*)(class Net*, vector<int>, int, const string&)) &eddl::toGPU, "Assign model operations to the GPU", pybind11::arg("net"), pybind11::arg("g") = vector<int>{1}, pybind11::arg("lsb") = 1, pybind11::arg("mem") = "full_mem"); m.def("setlogfile", (void (*)(class Net*, const string&)) &eddl::setlogfile, "Save the training outputs of a model to a file", pybind11::arg("net"), pybind11::arg("fname")); m.def("load", (void (*)(class Net*, const string&, const string&)) &eddl::load, "C++: eddl::load(class Net*, const string&, const string&) --> void", pybind11::arg("m"), pybind11::arg("fname"), pybind11::arg("format") = "bin"); m.def("save", (void (*)(class Net*, const string&, const string&)) &eddl::save, "C++: eddl::save(class Net*, const string&, const string&) --> void", pybind11::arg("m"), pybind11::arg("fname"), pybind11::arg("format") = "bin"); m.def("plot", (void (*)(class Net*, const string&, const string&)) &eddl::plot, "C++: eddl::plot(class Net*, const string&, const string&) --> void", pybind11::arg("m"), pybind11::arg("fname")="model.pdf", pybind11::arg("rankdir") = "LR"); m.def("fit", (void (*)(class Net*, const vector<Tensor*>&, const vector<Tensor*>&, int, int)) &eddl::fit, "C++: eddl::fit(class Net*, const vector<Tensor*>&, const vector<Tensor*>&, int, int) --> void", pybind11::call_guard<pybind11::gil_scoped_release>(), pybind11::arg("m"), pybind11::arg("in"), pybind11::arg("out"), pybind11::arg("batch"), pybind11::arg("epochs")); m.def("evaluate", (void (*)(class Net*, const vector<Tensor*>&, const vector<Tensor*>&, int)) &eddl::evaluate, "C++: eddl::evaluate(class Net*, const vector<Tensor*>&, const vector<Tensor*>&, int) --> void", pybind11::call_guard<pybind11::gil_scoped_release>(), pybind11::arg("m"), pybind11::arg("in"), pybind11::arg("out"), pybind11::arg("bs")=-1); m.def("predict", (vector<Tensor*> (*)(class Net*, const vector<Tensor*>&)) &eddl::predict, "C++: eddl::predict(class Net*, const vector<Tensor*>&) --> vector<Tensor*>", pybind11::call_guard<pybind11::gil_scoped_release>(), pybind11::arg("m"), pybind11::arg("in")); // not implemented upstream: // Affine // ColorJitter // Grayscale // Normalize // RandomAffine // RandomGrayscale // m.def("ConvSTM", (class Layer* (*)(class Layer*, int, const vector<int>&, const vector<int>&, string, bool, int, const vector<int>&, string)) &eddl::ConvSTM, "", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("filters"), pybind11::arg("kernel_size"), pybind11::arg("strides") = vector<int>{1, 1}, pybind11::arg("padding") = "same", pybind11::arg("use_bias") = true, pybind11::arg("groups") = 1, pybind11::arg("dilation_rate") = vector<int>{1, 1}, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); // m.def("ConvSTMAdd", (class Layer* (*)(const vector<Layer*>&, int, const vector<int>&, const vector<int>&, string, bool, int, const vector<int>&, string)) &eddl::ConvSTMAdd, "", pybind11::return_value_policy::reference, pybind11::arg("layers"), pybind11::arg("filters"), pybind11::arg("kernel_size"), pybind11::arg("strides") = vector<int>{1, 1}, pybind11::arg("padding") = "same", pybind11::arg("use_bias") = true, pybind11::arg("groups") = 1, pybind11::arg("dilation_rate") = vector<int>{1, 1}, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); // m.def("ConvMaxPool", (class Layer* (*)(class Layer*, int, const vector<int>&, const vector<int>&, string, const vector<int>&, const vector<int>&, string, bool, int, const vector<int>&, string)) &eddl::ConvMaxPool, "", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("filters"), pybind11::arg("kernel_size"), pybind11::arg("strides") = vector<int>{1, 1}, pybind11::arg("conv_padding") = "same", pybind11::arg("pool_size") = vector<int>{2, 2}, pybind11::arg("pool_strides") = vector<int>{2, 2}, pybind11::arg("pool_padding") = "none", pybind11::arg("use_bias") = true, pybind11::arg("groups") = 1, pybind11::arg("dilation_rate") = vector<int>{1, 1}, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); // m.def("ConvReLUMaxPool", (class Layer* (*)(class Layer*, int, const vector<int>&, const vector<int>&, string, const vector<int>&, const vector<int>&, string, bool, int, const vector<int>&, string)) &eddl::ConvReLUMaxPool, "", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("filters"), pybind11::arg("kernel_size"), pybind11::arg("strides") = vector<int>{1, 1}, pybind11::arg("conv_padding") = "same", pybind11::arg("pool_size") = vector<int>{2, 2}, pybind11::arg("pool_strides") = vector<int>{2, 2}, pybind11::arg("pool_padding") = "none", pybind11::arg("use_bias") = true, pybind11::arg("groups") = 1, pybind11::arg("dilation_rate") = vector<int>{1, 1}, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); // m.def("ConvReLU", (class Layer* (*)(class Layer*, int, const vector<int>&, const vector<int>&, string, bool, int, const vector<int>&, string)) &eddl::ConvReLU, "", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("filters"), pybind11::arg("kernel_size"), pybind11::arg("strides") = vector<int>{1, 1}, pybind11::arg("padding") = "same", pybind11::arg("use_bias") = true, pybind11::arg("groups") = 1, pybind11::arg("dilation_rate") = vector<int>{1, 1}, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); // m.def("Conv2dActivation", (Layer* (*)(Layer*, string, int, const vector<int>&, const vector<int>&, string, bool, int, const vector<int>&, string)) &eddl::Conv2dActivation, "Convolution + Activation layer", pybind11::return_value_policy::reference, pybind11::arg("parent"), pybind11::arg("act"), pybind11::arg("filters"), pybind11::arg("kernel_size"), pybind11::arg("strides") = vector<int>{1, 1}, pybind11::arg("padding") = "same", pybind11::arg("use_bias") = true, pybind11::arg("groups") = 1, pybind11::arg("dilation_rate") = vector<int>{1, 1}, pybind11::arg("name") = "", pybind11::keep_alive<0, 1>()); // --- utils --- m.def("get_topk_predictions", (string (*)(Tensor*, const vector<string>&, int, int)) &eddl::get_topk_predictions, "Get top k class names along with their probabilities", pybind11::arg("class_probs"), pybind11::arg("class_names"), pybind11::arg("k") = 5, pybind11::arg("decimals") = 2); // --- get models --- m.def("download_model", (void (*)(string, string)) &eddl::download_model, "C++: eddl::download_model(string, string) --> void", pybind11::arg("name"), pybind11::arg("link")); m.def("download_vgg16", (Net* (*)(bool, vector<int>)) &eddl::download_vgg16, "C++: eddl::download_vgg16(string, string) --> Net*", pybind11::arg("top") = true, pybind11::arg("input_shape") = vector<int>{}); m.def("download_vgg16_bn", (Net* (*)(bool, vector<int>)) &eddl::download_vgg16_bn, "C++: eddl::download_vgg16_bn(string, string) --> Net*", pybind11::arg("top") = true, pybind11::arg("input_shape") = vector<int>{}); m.def("download_vgg19", (Net* (*)(bool, vector<int>)) &eddl::download_vgg19, "C++: eddl::download_vgg19(string, string) --> Net*", pybind11::arg("top") = true, pybind11::arg("input_shape") = vector<int>{}); m.def("download_vgg19_bn", (Net* (*)(bool, vector<int>)) &eddl::download_vgg19_bn, "C++: eddl::download_vgg19_bn(string, string) --> Net*", pybind11::arg("top") = true, pybind11::arg("input_shape") = vector<int>{}); m.def("download_resnet18", (Net* (*)(bool, vector<int>)) &eddl::download_resnet18, "C++: eddl::download_resnet18(string, string) --> Net*", pybind11::arg("top") = true, pybind11::arg("input_shape") = vector<int>{}); m.def("download_resnet34", (Net* (*)(bool, vector<int>)) &eddl::download_resnet34, "C++: eddl::download_resnet34(string, string) --> Net*", pybind11::arg("top") = true, pybind11::arg("input_shape") = vector<int>{}); m.def("download_resnet50", (Net* (*)(bool, vector<int>)) &eddl::download_resnet50, "C++: eddl::download_resnet50(string, string) --> Net*", pybind11::arg("top") = true, pybind11::arg("input_shape") = vector<int>{}); m.def("download_resnet101", (Net* (*)(bool, vector<int>)) &eddl::download_resnet101, "C++: eddl::download_resnet101(string, string) --> Net*", pybind11::arg("top") = true, pybind11::arg("input_shape") = vector<int>{}); m.def("download_resnet152", (Net* (*)(bool, vector<int>)) &eddl::download_resnet152, "C++: eddl::download_resnet152(string, string) --> Net*", pybind11::arg("top") = true, pybind11::arg("input_shape") = vector<int>{}); m.def("download_densenet121", (Net* (*)(bool, vector<int>)) &eddl::download_densenet121, "C++: eddl::download_densenet121(string, string) --> Net*", pybind11::arg("top") = true, pybind11::arg("input_shape") = vector<int>{}); #ifdef EDDL_WITH_PROTOBUF pybind11::enum_<LOG_LEVEL>(m, "LOG_LEVEL", "ONNX log level") .value("TRACE", LOG_LEVEL::TRACE) .value("DEBUG", LOG_LEVEL::DEBUG) .value("INFO", LOG_LEVEL::INFO) .value("WARN", LOG_LEVEL::WARN) .value("ERROR", LOG_LEVEL::ERROR) .value("NO_LOGS", LOG_LEVEL::NO_LOGS); // --- serialization --- m.def("save_net_to_onnx_file", (void (*)(class Net*, string, int)) &save_net_to_onnx_file, "C++: eddl::save_net_to_onnx_file(class Net *, string, int) --> void", pybind11::arg("net"), pybind11::arg("path"), pybind11::arg("seq_len") = 0); m.def("import_net_from_onnx_file", (class Net* (*)(string, int, LOG_LEVEL)) &import_net_from_onnx_file, "Imports ONNX Net from file", pybind11::arg("path"), pybind11::arg("mem") = 0, pybind11::arg("log_level") = LOG_LEVEL::INFO); m.def("import_net_from_onnx_file", (class Net* (*)(string, vector<int>, int, LOG_LEVEL)) &import_net_from_onnx_file, "Imports ONNX Net from file and changes its input shape", pybind11::arg("path"), pybind11::arg("input_shape"), pybind11::arg("mem") = 0, pybind11::arg("log_level") = LOG_LEVEL::INFO); m.def("serialize_net_to_onnx_string", [](Net* net, bool gradients) -> pybind11::bytes { string* s = serialize_net_to_onnx_string(net, gradients); return pybind11::bytes(*s); }, pybind11::arg("net"), pybind11::arg("gradients")); m.def("import_net_from_onnx_string", [](pybind11::bytes model_string, int mem = 0) -> Net* { string s = string(model_string); return import_net_from_onnx_string(&s, mem); }, pybind11::arg("model_string"), pybind11::arg("mem") = 0); #endif // --- constants --- m.attr("DEV_CPU") = pybind11::int_(DEV_CPU); m.attr("DEV_GPU") = pybind11::int_(DEV_GPU); m.attr("DEV_FPGA") = pybind11::int_(DEV_FPGA); m.attr("MAX_THREADS") = pybind11::int_(MAX_THREADS); }
2b7d37c52252608ef817b74c11404bbab5ed63ea
7a65e60bc000621200c9f25332e6e05fd9624856
/player.h
fce479288323e8202ddcf7e184ee3069e3b5ad2a
[]
no_license
jhb123/pandemic
984e722f81f66cd8025cd10af3e1c0000a7dcf9f
8b0f8a248018de411b5b137148ce84a47cd91ca6
refs/heads/master
2021-01-23T05:24:51.024619
2019-05-19T15:36:20
2019-05-19T15:36:20
102,466,243
0
0
null
null
null
null
UTF-8
C++
false
false
245
h
player.h
#include node.h class player: public node{ private: std::vector<int> hand; public: int move(node* start, node* end); int shareKnowledge(int); int buildResearchStation(int); int treatDisease(int); int discoverCure(); }; #endif
bb168c2a0a1aaab1d99a8a66488f2d8aa268539e
785f542387f302225a8a95af820eaccb50d39467
/codechef/ANUDTC/ANUDTC-3921274.cpp
f2ddc8a25e2db909edaaf61236c711a6c103b79a
[]
no_license
anveshi/Competitive-Programming
ce33b3f0356beda80b50fee48b0c7b0f42c44b0c
9a719ea3a631320dfa84c60300f45e370694b378
refs/heads/master
2016-08-12T04:27:13.078738
2015-01-19T17:30:00
2016-03-08T17:44:36
51,570,689
0
0
null
null
null
null
UTF-8
C++
false
false
572
cpp
ANUDTC-3921274.cpp
#include<iostream> #include<cstdio> using namespace std; bool f1(int x) { if(360%x ==0) return true; return false; } bool f2(int x) { if(x>=1 && x<=360) return true; return false; } bool f3(int x) { if(x>=1 && x<27) return true; return false; } int main() { int T; cin >> T; while(T--) { int n,ans1,ans2,ans3; cin >> n; ans1 = f1(n); ans2 = f2(n); ans3 = f3(n); if(ans1) cout <<"y "; else cout <<"n "; if(ans2) cout <<"y "; else cout << "n "; if(ans3) cout << "y"<<endl; else cout << "n"<<endl; } return 0; }
6fe99c811da0f39aacbd64a1f79d383a28456963
a6b7dae246897552f465ff986a4976b5e8f3811c
/escaper/dialog.cpp
0cadcaf03f0c2dd27cf35210d5c920bf72074c4e
[]
no_license
nfette/sandbox
859241d24c3ad7343c2b21f24cdcb0ba0caa75ca
fb6797566a7bb346760a31cfd1db5a2753325e06
refs/heads/master
2021-09-02T16:40:42.251819
2018-01-03T16:41:29
2018-01-03T16:41:29
107,694,326
0
0
null
null
null
null
UTF-8
C++
false
false
3,514
cpp
dialog.cpp
#include "dialog.h" #include "ui_dialog.h" #include <QXmlStreamWriter> #include <QXmlStreamReader> #include <QString> #include <QDebug> #include <QXmlStreamAttribute> #include <QXmlStreamAttributes> #include <QtXml> Dialog::Dialog(QWidget *parent) : QDialog(parent), ui(new Ui::Dialog) { ui->setupUi(this); connect(ui->lineEdit_1, SIGNAL(textChanged(QString)), SLOT(on_inputs_edited(void))); connect(ui->lineEdit_2, SIGNAL(textChanged(QString)), SLOT(on_inputs_edited(void))); QButtonGroup * qbg = new QButtonGroup(this); qbg->addButton(ui->radioButton_1); qbg->addButton(ui->radioButton_2); connect(ui->radioButton_1, SIGNAL(toggled(bool)), SLOT(on_inputs_edited(void))); on_inputs_edited(); } Dialog::~Dialog() { delete ui; } void Dialog::on_inputs_edited() { QString arg1 = ui->lineEdit_1->text(); QString arg2 = ui->lineEdit_2->text(); QString result = (ui->radioButton_1->isChecked())?post(arg1, arg2):post2(arg1, arg2); ui->plainTextEdit->setPlainText(result); } void Dialog::on_plainTextEdit_textChanged() { QString xml = ui->plainTextEdit->toPlainText(); QString arg1, arg2, errorString; get(xml, arg1, arg2, errorString); ui->lineEdit_3->setText(arg1); ui->lineEdit_4->setText(arg2); ui->label_error->setText(errorString); get2(xml, arg1, arg2, errorString); ui->lineEdit_5->setText(arg1); ui->lineEdit_6->setText(arg2); ui->label_9->setText(errorString); } QString Dialog::post(const QString &arg1, const QString &arg2) { QString result; QXmlStreamWriter myWriter(&result); myWriter.setAutoFormatting(true); myWriter.writeStartDocument(); //myWriter.writeTextElement("root", arg1); myWriter.writeStartElement("root"); myWriter.writeAttribute("myAttribute", arg2); myWriter.writeCharacters(arg1); myWriter.writeEndElement(); myWriter.writeEndDocument(); return result; } QString Dialog::post2(const QString &arg1, const QString &arg2) { QDomDocument doc; QDomElement el = doc.createElement("root"); //QDomElement el = doc.documentElement(); el.setTagName("root"); el.setAttribute("myAttribute", arg2); //el.setNodeValue(arg1); QDomText val = doc.createTextNode(arg1); el.appendChild(val); doc.appendChild(el); QString result = doc.toString(2); return result; } void Dialog::get(const QString &xml, QString &arg1, QString &arg2, QString &errorString) { QXmlStreamReader myReader(xml); QXmlStreamReader::TokenType myType; while (!myReader.atEnd()) { myType = myReader.readNext(); qDebug() << " Token type/string:" << myType << "/" << myReader.tokenString(); qDebug() << " Name:" << myReader.name(); if (myType == QXmlStreamReader::Characters) arg1 = myReader.text().toString(); if (myType == QXmlStreamReader::StartElement) arg2 = myReader.attributes().value("myAttribute").toString(); } qDebug() << "At end?" << myReader.atEnd(); qDebug() << "Error?" << myReader.errorString(); qDebug(); errorString = myReader.errorString(); } void Dialog::get2(const QString &xml, QString &arg1, QString &arg2, QString &errorString) { QDomDocument doc; int errorLine, errorColumn; doc.setContent(xml, &errorString, &errorLine, &errorColumn); QDomElement rootEl = doc.documentElement(); arg2 = rootEl.attribute("myAttribute"); arg1 = rootEl.text(); qDebug() << arg1; qDebug() << arg2; }
8da96770290f22d8d54dbaebd4ef2692ef82c90b
bb108c3ea7d235e6fee0575181b5988e6b6a64ef
/mame/src/mame/includes/snk6502.h
2a5bfd2e9d7257f2dd59a926510f0af1999bece9
[ "MIT" ]
permissive
clobber/MAME-OS-X
3c5e6058b2814754176f3c6dcf1b2963ca804fc3
ca11d0e946636bda042b6db55c82113e5722fc08
refs/heads/master
2021-01-20T05:31:15.086981
2013-04-17T18:42:40
2013-04-17T18:42:40
3,805,274
15
8
null
2013-04-17T18:42:41
2012-03-23T04:23:01
C
UTF-8
C++
false
false
2,468
h
snk6502.h
/************************************************************************* rokola hardware *************************************************************************/ #include "devlegcy.h" #include "sound/discrete.h" #include "sound/samples.h" #include "sound/sn76477.h" class snk6502_state : public driver_device { public: snk6502_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) { } UINT8 m_sasuke_counter; UINT8 *m_videoram; UINT8 *m_colorram; UINT8 *m_videoram2; UINT8 *m_charram; int m_charbank; int m_backcolor; tilemap_t *m_bg_tilemap; tilemap_t *m_fg_tilemap; rgb_t m_palette[64]; }; /*----------- defined in audio/snk6502.c -----------*/ extern const samples_interface sasuke_samples_interface; extern const samples_interface vanguard_samples_interface; extern const samples_interface fantasy_samples_interface; extern const sn76477_interface sasuke_sn76477_intf_1; extern const sn76477_interface sasuke_sn76477_intf_2; extern const sn76477_interface sasuke_sn76477_intf_3; extern const sn76477_interface satansat_sn76477_intf; extern const sn76477_interface vanguard_sn76477_intf_1; extern const sn76477_interface vanguard_sn76477_intf_2; extern const sn76477_interface fantasy_sn76477_intf; extern WRITE8_HANDLER( sasuke_sound_w ); extern WRITE8_HANDLER( satansat_sound_w ); extern WRITE8_HANDLER( vanguard_sound_w ); extern WRITE8_HANDLER( vanguard_speech_w ); extern WRITE8_HANDLER( fantasy_sound_w ); extern WRITE8_HANDLER( fantasy_speech_w ); DECLARE_LEGACY_SOUND_DEVICE(SNK6502, snk6502_sound); void snk6502_set_music_clock(running_machine &machine, double clock_time); void snk6502_set_music_freq(running_machine &machine, int freq); int snk6502_music0_playing(running_machine &machine); DISCRETE_SOUND_EXTERN( fantasy ); /*----------- defined in video/snk6502.c -----------*/ WRITE8_HANDLER( snk6502_videoram_w ); WRITE8_HANDLER( snk6502_videoram2_w ); WRITE8_HANDLER( snk6502_colorram_w ); WRITE8_HANDLER( snk6502_charram_w ); WRITE8_HANDLER( snk6502_flipscreen_w ); WRITE8_HANDLER( snk6502_scrollx_w ); WRITE8_HANDLER( snk6502_scrolly_w ); PALETTE_INIT( snk6502 ); VIDEO_START( snk6502 ); SCREEN_UPDATE( snk6502 ); VIDEO_START( pballoon ); WRITE8_HANDLER( satansat_b002_w ); WRITE8_HANDLER( satansat_backcolor_w ); PALETTE_INIT( satansat ); VIDEO_START( satansat );
2d8af4fee611141393fecfc974295e9485ce1c07
4a7701074acb637078c8a2c1d26ecea135713322
/Phân công công việc/1.12.cpp
8829d24e97b259c5af4b5fa2c397135d8744dc50
[]
no_license
thuylinh-uit/Artificial-Intelligent
e3dcd3efcb513bd50bdf75afe934b458ed3d7eca
088b61768d7e2a278d11fa9f5feae4cbf2cea724
refs/heads/master
2022-01-15T22:09:18.899625
2019-07-16T10:18:41
2019-07-16T10:18:41
197,167,098
0
0
null
null
null
null
UTF-8
C++
false
false
2,093
cpp
1.12.cpp
/** * Ý tưởng: * B1:phân tập chi tiết máy ra làm 2 mảng: * Mảng tmp01: gồm các chi tiết máy gia công trên máy 1 nhanh hơn gia công trên máy 2 * Mảng tmp02: gồm các chi tiết máy gia công trên máy 2 nhanh hơn gia công trên máy 1 * B2: sort tmp01 tăng dần theo thời gian gia công trên máy 1 * sort tmp02 giảm dần theo thời gian gia công trên máy 2 * B3: gộp danh sách 2 mảng theo thứ tự tmp01 đến tmp02 vào mảng s * => Mảng s chính là thứ tự cần gia công để được thời gian nhanh nhất * IDE: code::block 17.12 / G++ 14 * Instance: 11 3 6 4 3 4 2 7 5 5 6 12 4 5 5 2 3 3 6 6 4 7 2 */ #include <iostream> #include <vector> #include <algorithm> using namespace std; #define piii pair<int, pair<int, int>> // pair<id, pair<a, b>> int main() { int n; cin >> n; // instance: n = 11 vector<piii> s(n), tmp01, tmp02; for (int i = 0; i < n; ++i) { cin >> s[i].second.first; s[i].first = i; } // --------------------- B1 -------------------- for (int i = 0; i < n; ++i) { cin >> s[i].second.second; if (s[i].second.first <= s[i].second.second) { tmp01.push_back(s[i]); } else { tmp02.push_back(s[i]); } } // --------------------- B2 -------------------- sort(tmp01.begin(), tmp01.end(), [&](piii i, piii j) { return i.second.first < j.second.first; }); sort(tmp02.begin(), tmp02.end(), [&](piii i, piii j) { return i.second.second > j.second.second; }); // --------------------- B3 -------------------- s.clear(); for (auto i : tmp01) { s.push_back(i); } for (auto i : tmp02) { s.push_back(i); } // --------------------- final ----------------- int time_M1 = 0, time_M2 = 0; for (int i = 0; i < n; ++i) { time_M1 += s[i].second.first; time_M2 = max(time_M1, time_M2) + s[i].second.second; } cout << "THOI GIAN HOAN THANH: " << time_M2 << '\n'; cout << "THU TU GIA CONG CHI TIET: "; for (int i = 0; i < n; ++i) { cout << s[i].first << ' '; } return 0; }
8820c19341d0907aaa1a19ce400db2d2a3084b94
794b3436024b60a5e2a15923010e7406243a1321
/Lectures/lec11/orange3.cpp
6b6c9ec0f7342d44c5405e139e2d83e87a776464
[]
no_license
stel-nik/ADSM
710a7d88952c1dc1d4391d3adc1c4d37fdbebe60
b5280a7b74264b26a94fe22cb7b10052a19227ce
refs/heads/master
2021-09-14T12:05:25.239445
2018-05-09T06:47:59
2018-05-09T06:47:59
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,297
cpp
orange3.cpp
#include <TMB.hpp> // Links in the TMB libraries template<class Type> Type objective_function<Type>::operator() () { DATA_VECTOR(y); // Data vector transmitted from R DATA_VECTOR(t); // Data vector transmitted from R DATA_VECTOR(season); // Data vector transmitted from R DATA_FACTOR(tree); // Data vector transmitted from R PARAMETER_VECTOR(u); // Random effects // Parameters PARAMETER_VECTOR(beta); // Parameter value transmitted from R PARAMETER(sigma_u); // Parameter value transmitted from R PARAMETER(sigma); // Parameter value transmitted from R int nobs = y.size(); int ntrees = u.size(); Type mean_ran = Type(0); int j; Type f = 0; // Declare the "objective function" (neg. log. likelihood) for(int j=0; j < ntrees; j++){ f -= dnorm(u[j], beta[0] , sigma_u, true); } for(int i =0; i < nobs; i++){ j = tree[i]; f -= dnorm(y[i], u[j]/(1+exp(-((t[i]-beta[1])/beta[2] + season[i]*beta[3]))), sigma, true); } return f; }
73476742a399e1c95b1e6c46b67224758c11d5d6
8f78a3d132a1e4e05f2a8a48ac6dd92f527e1901
/src/depth_detect.cpp
4069a2d44444cedae399799bb5167eeb63b23326
[]
no_license
tasuka98/zed2_depth
06d8b0ea9643ab6b89ed49dbe1697c558eaff563
758068b09c735f46850386012146576c1e52ac34
refs/heads/master
2021-03-24T17:00:22.132466
2020-03-15T21:06:03
2020-03-15T21:06:03
247,551,075
1
0
null
null
null
null
UTF-8
C++
false
false
4,938
cpp
depth_detect.cpp
#include <stdio.h> #include <string.h> #include <sl/Camera.hpp> #include <opencv2/core/core.hpp>; #include <opencv2/highgui/highgui.hpp>; #include <opencv2/imgproc/imgproc.hpp>; #define FOCAL_LENGTH 100; #define PIXEL_SIZE 0.004; using namespace sl; using namespace std; void display_volumn(sl::Mat depth_map, cv::Mat mask, vector<pair<cv::Point, cv::Point>> description) { float min_distance = 99; float max_distance = 0; float volumn = 0; float surface_area = 0; int pixelcount = 0; int objectnum = 1; float depth_value = 0; while (!description.empty()) { auto iter = description.back(); std::cout << "\n" << "\n"; std::cout << "Analyzing object "<< objectnum << "\n"; volumn = 0; min_distance = 99; max_distance = 0; volumn = 0; surface_area = 0; pixelcount = 0; depth_value = 0; for (int i = iter.first.x; i < iter.second.x; i++) { for (int j = iter.first.y; j < iter.second.y; j++) { if (mask.at<cv::Vec3b>(i, j) != cv::Vec3b(0, 0, 0)) { pixelcount++; depth_map.getValue(i, j, &depth_value); if (min_distance > depth_value && depth_value >= 0.15) min_distance = depth_value; if (max_distance < depth_value && max_distance < 2 && depth_value >= 0.15) max_distance = depth_value; } } } min_distance = min_distance - 0.18; float vertical_realdistance = 2 * float(min_distance) * 0.7265; float horizontal_realdistance = 2 * float(min_distance) * 1.2799; float distance_perPixelv = vertical_realdistance / 720; float distance_perPixelh = horizontal_realdistance / 1280; printf("distance from len to object is %f\n", min_distance); printf("distance per pixel x = %f\n", distance_perPixelv); printf("distance per pixel y = %f\n", distance_perPixelh); printf("total area pixel count = %d\n", pixelcount); surface_area = distance_perPixelh * distance_perPixelv * pixelcount; printf("real surface area of the detected object is: %f square meters\n", surface_area); volumn = powl(surface_area, 1.5) / 10.635; printf("volumn of the detected object is %f cubic meters\n", volumn); objectnum++; description.pop_back(); } return; } // Need to get the mask matrix for the picture; int main() { Camera zed; sl::InitParameters init_parameters; sl::Mat image; sl::Mat depth_map; float objectvolumn = 0; std::string object = "charger"; init_parameters.camera_resolution = sl::RESOLUTION::HD720; init_parameters.depth_mode = DEPTH_MODE::QUALITY; init_parameters.coordinate_units = UNIT::METER; init_parameters.depth_minimum_distance = float(0.10) ; // Set the minimum depth perception distance to 10cm ERROR_CODE zed_error = zed.open(init_parameters); // Check camera; if (zed_error != ERROR_CODE::SUCCESS) { printf("Opening camera failed"); zed.close(); return 1; } //Get image and retrieve map; if (zed.grab() == ERROR_CODE::SUCCESS) { zed.retrieveImage(image, VIEW::LEFT); zed.retrieveMeasure(depth_map,MEASURE::DEPTH); printf("Image resolution: %d x %d\n", (int)image.getWidth(), (int)image.getHeight()); } else { printf("Unable to grab image!"); zed.close(); return -1; } image.write("./output.jpg"); cv::Mat srcImage = cv::imread("./output.jpg", CV_LOAD_IMAGE_COLOR); if (!srcImage.data) // Check for invalid input { cout << "Could not open or find the image" << std::endl; return -1; } std::vector<pair<cv::Point, cv::Point>> description; cv::Mat mask = cv::Mat::zeros(srcImage.size(), srcImage.type()); cv::Mat dstImage = cv::Mat::zeros(srcImage.size(), srcImage.type()); //Establish mask and bounding box; cv::circle(mask, cv::Point(srcImage.cols/2, srcImage.rows/2 + 50), 100, CV_RGB(0, 255, 0), -1, 8, 0); //cv::rectangle(mask, cv::Point(srcImage.cols/2-100, srcImage.rows/2-100), cv::Point(srcImage.cols/2+100, srcImage.rows/2+100), CV_RGB(255,0,0), -1, 8, 0); //description.push_back(std::make_pair(cv::Point(450 - 100, 940 - 100), cv::Point(450 + 100, 940 + 100))); description.push_back(std::make_pair(cv::Point(srcImage.rows/2-50, srcImage.cols/2-100), cv::Point(srcImage.rows/2+150, srcImage.cols/2+100))); auto iter = description.back(); srcImage.copyTo(dstImage, mask); cv::imshow("image", dstImage); cv::waitKey(1); display_volumn(depth_map,mask, description); system("pause"); zed.close(); }
7ad3a668bea09dc56f3a6ecd8365c9cf21a72470
60c9d77f074a756b706e04729e006d412afbca30
/LeetCodeStrProblems1/LeetCodeStrProblems1/test.cpp
4a1c07a1c18f1d81d6a0a106c808ff280a0b075f
[]
no_license
xym97/XYM__Code
e007a9f079044766133018024aef2ec7fc9d232f
18562dddfdf2a9826d7ec145955a11962ba7ccaa
refs/heads/master
2021-01-21T11:33:49.128356
2017-10-26T09:28:48
2017-10-26T09:28:48
102,011,110
0
0
null
null
null
null
UTF-8
C++
false
false
189
cpp
test.cpp
//#include"LeetCodesstrProblems1.cpp" // //void Test1() //{ // string time("19:34"); // cout << NextCloseTime(time); //} // //int main() //{ // Test1(); // system("pause"); // return 0; //}
f2389bf375abc2bcb6ed75f4c36db4956934897a
1d8e0baed7b67885e68b6ec92d5613b7a85d72e2
/sap1.cpp
2926fffc6490db476dd9948a75ed84804e8b293b
[]
no_license
rolffokkens/sap-cpp
4e2f6bb209ab513a26467cc69197567424f19098
d23ea984dacfd635557498cb3c0ff0c6ec5a3708
refs/heads/master
2022-12-16T10:02:17.792101
2020-08-30T20:38:26
2020-08-30T20:38:26
258,873,686
0
0
null
null
null
null
UTF-8
C++
false
false
951
cpp
sap1.cpp
/* * This demonstrates CPU1 (see cpu1.h) * * It counts down from 5 to 0 and * outputs each counter value */ #include <iostream> #include <boost/format.hpp> #include <cstddef> #include "cpu1.h" using namespace std; int main (void) { unsigned char ram[16] = { 0x51 // [00] LDI 0x01 , 0x4e // [01] STA 0x0e # Start 1 in [0E] , 0x55 // [02] LDI 0x05 # Set A to counter value 5 , 0xe0 // [03] OUT # Output A , 0x3e // [04] SUB 0x0e # Subtract 1 ([0E]) from A , 0xe0 // [05] OUT # Output A , 0x88 // [06] JZ 0x08 # Go to [08] when A is zero , 0x64 // [07] JMP 0x04 # Repeat the loop at [04] , 0xf0 // [08] HLT # HALT }; CPU1 cpu (ram); while (!cpu.clock (1)) {}; }
cf5fdefb2234bfc5028f430f4783acb4a0154372
5af84910d05332c66c295dec1eed30b3bee70dbe
/替换空格/code.cpp
d507fd17a9edaf42ce6a6727791c28579538a667
[]
no_license
renmengqisheng/Coding-Interviews
339a4432ee2b1ef3446e6fca2b8074f9d6bdd388
25e45572b335ffb388ea0ae31217387350425a6d
refs/heads/master
2020-04-24T18:18:45.924810
2019-03-15T13:08:24
2019-03-15T13:08:24
172,175,873
0
0
null
null
null
null
UTF-8
C++
false
false
1,238
cpp
code.cpp
class Solution { public: void replaceSpace(char *str,int length) { /*********************************** *解法一 ***********************************/ if(str == NULL || length <= 0) return; int space_count = 0; int len = 0; while(str[len] != '\0') { if(str[len] == ' ') space_count++; len++; } int new_len = len + space_count * 2; if(new_len > length) return; for(int i = len; i >= 0; i--) { if(str[i] == ' ') { str[new_len--] = '0'; str[new_len--] = '2'; str[new_len--] = '%'; } else { str[new_len--] = str[i]; } } /************************************** *解法二 string newstr = ""; for(int i = 0; i < strlen(str); i++) { if(str[i] == ' ') newstr += "%20"; else newstr += str[i]; } strcpy(str, newstr.c_str()); ************************************/ } };
d2aeb72a3cecc1f4a3f29b485aa1b351d8542345
e1621cb9fc42ee2921b0bcbffe1fe8337015fa91
/References/Source.cpp
b0d261928ecb3c38679d98aae2a55b48bc11f5f5
[]
no_license
steffanmouton/IntroCPPSteffanM
88c564569b74aaca4a9e0adc94c065963087f947
89af67ed01546a8d8540d29e97740c4c46d67b73
refs/heads/master
2020-03-26T12:52:14.838065
2018-10-08T23:04:00
2018-10-08T23:04:00
144,911,110
1
0
null
null
null
null
UTF-8
C++
false
false
1,300
cpp
Source.cpp
#include <iostream> //2 void ChangeValue(Structure type) { type.a += 2; type.b += 2; } //3 struct Structure { const int a = 0; const int b = 1; const int c = 2; const int d = 3; }; int main() { //Exercise #1 //a - f int integer = 10; std::cout << "integer: " << integer << std::endl; int& referenceToInteger = integer; std::cout << "reference to integer: " << referenceToInteger << std::endl; integer = 20; std::cout << "integer: " << integer << std::endl; referenceToInteger = 30; std::cout << "integer: " << integer << std::endl; //g int& anotherReferenceToInteger = integer; std::cout << "reference to integer: " << referenceToInteger << std::endl; std::cout << "another reference to integer: " << anotherReferenceToInteger << std::endl; //h /*int& referenceToNothing; float a = 10.5f; int& = a;*/ //2 { int a = 10; int b = 12; struct stuff; std::cout << stuff.a << std::endl; ChangeValue(&stuff); std::cout << stuff << std::endl; } //5 //a - It takes up far less memory to pass in the address of the struct than it does // to pass in the entire struct. //b - No, they take up the the same amount of memory. The advantage in passing in the const // reference would be that the value could not be changed, always keeping the same value. }
c67942b5936a61c9990cbd027d60a0a83e03c17a
98c84fcb752c35825faaa5811275a7b287ce228b
/Asgn37/try2.cpp
023f403a1ec0f1c4548f1d63ed1234d02dd81298
[]
no_license
JPL4494/DVC-COMSC110
7553b77fd245ea5b61c3641be95cbb17f7ed96fb
1ec4bd745df3efc451c7c036615580d46d89fcaf
refs/heads/master
2020-03-19T00:36:44.418685
2018-05-30T20:37:31
2018-05-30T20:37:31
135,493,389
0
0
null
null
null
null
UTF-8
C++
false
false
1,027
cpp
try2.cpp
#include <iostream> using namespace std; double sort(int i, int SIZE, int j, int temp, int s[]) { for (i = 0; i < SIZE; i++) { for (j = i + 1; j < SIZE; j++) { if (s[i] > s[j]) { temp = s[i]; s[i] = s[j]; s[j] = temp; } } } } int main() { int SIZE = 20; int a[SIZE], sorted[SIZE], temp; int i, j, min; cout << "??"; cin >> j; SIZE = j; for (i = 0; i < SIZE; i++) { cout << "?"; cin >> a[i]; sorted[i] = a [i]; } sort(i,SIZE,j,temp,sorted); cout << endl; for (i = 0; i < SIZE; i++) { cout << a[i] << " "; } cout << endl << endl; for (i = 0; i < SIZE; i++) { cout << sorted[i] << " "; } cout << endl << endl << "Bye" << endl; }
5d89d1bd6c5084a86545d65b47cf70320973cdff
59846a1f265fab954253fff7065c5ac1c2b928d2
/cpp/client/com.spoonacular.client.model/OAIGetMenuItemInformation_200_response.cpp
b3e0c30235c63174b46d14d1bb81b1397eb1169b
[ "MIT" ]
permissive
ddsky/spoonacular-api-clients
9179fa16b4fd942493616edc94d8a15de8b172a2
1c7b30bd164ad669d95f1f63661adb04c7c4ab32
refs/heads/master
2023-04-13T09:23:59.070747
2022-11-03T16:13:34
2022-11-03T16:13:34
189,444,765
36
83
MIT
2023-04-09T00:56:33
2019-05-30T16:12:36
Java
UTF-8
C++
false
false
14,360
cpp
OAIGetMenuItemInformation_200_response.cpp
/** * spoonacular API * The spoonacular Nutrition, Recipe, and Food API allows you to access over thousands of recipes, thousands of ingredients, 800,000 food products, over 100,000 menu items, and restaurants. Our food ontology and semantic recipe search engine makes it possible to search for recipes using natural language queries, such as \"gluten free brownies without sugar\" or \"low fat vegan cupcakes.\" You can automatically calculate the nutritional information for any recipe, analyze recipe costs, visualize ingredient lists, find recipes for what's in your fridge, find recipes based on special diets, nutritional requirements, or favorite ingredients, classify recipes into types and cuisines, convert ingredient amounts, or even compute an entire meal plan. With our powerful API, you can create many kinds of food and especially nutrition apps. Special diets/dietary requirements currently available include: vegan, vegetarian, pescetarian, gluten free, grain free, dairy free, high protein, whole 30, low sodium, low carb, Paleo, ketogenic, FODMAP, and Primal. * * The version of the OpenAPI document: 1.1 * Contact: mail@spoonacular.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "OAIGetMenuItemInformation_200_response.h" #include <QDebug> #include <QJsonArray> #include <QJsonDocument> #include <QObject> #include "OAIHelpers.h" namespace OpenAPI { OAIGetMenuItemInformation_200_response::OAIGetMenuItemInformation_200_response(QString json) { this->initializeModel(); this->fromJson(json); } OAIGetMenuItemInformation_200_response::OAIGetMenuItemInformation_200_response() { this->initializeModel(); } OAIGetMenuItemInformation_200_response::~OAIGetMenuItemInformation_200_response() {} void OAIGetMenuItemInformation_200_response::initializeModel() { m_id_isSet = false; m_id_isValid = false; m_title_isSet = false; m_title_isValid = false; m_restaurant_chain_isSet = false; m_restaurant_chain_isValid = false; m_nutrition_isSet = false; m_nutrition_isValid = false; m_badges_isSet = false; m_badges_isValid = false; m_breadcrumbs_isSet = false; m_breadcrumbs_isValid = false; m_generated_text_isSet = false; m_generated_text_isValid = false; m_image_type_isSet = false; m_image_type_isValid = false; m_likes_isSet = false; m_likes_isValid = false; m_servings_isSet = false; m_servings_isValid = false; m_price_isSet = false; m_price_isValid = false; m_spoonacular_score_isSet = false; m_spoonacular_score_isValid = false; } void OAIGetMenuItemInformation_200_response::fromJson(QString jsonString) { QByteArray array(jsonString.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); } void OAIGetMenuItemInformation_200_response::fromJsonObject(QJsonObject json) { m_id_isValid = ::OpenAPI::fromJsonValue(id, json[QString("id")]); m_id_isSet = !json[QString("id")].isNull() && m_id_isValid; m_title_isValid = ::OpenAPI::fromJsonValue(title, json[QString("title")]); m_title_isSet = !json[QString("title")].isNull() && m_title_isValid; m_restaurant_chain_isValid = ::OpenAPI::fromJsonValue(restaurant_chain, json[QString("restaurantChain")]); m_restaurant_chain_isSet = !json[QString("restaurantChain")].isNull() && m_restaurant_chain_isValid; m_nutrition_isValid = ::OpenAPI::fromJsonValue(nutrition, json[QString("nutrition")]); m_nutrition_isSet = !json[QString("nutrition")].isNull() && m_nutrition_isValid; m_badges_isValid = ::OpenAPI::fromJsonValue(badges, json[QString("badges")]); m_badges_isSet = !json[QString("badges")].isNull() && m_badges_isValid; m_breadcrumbs_isValid = ::OpenAPI::fromJsonValue(breadcrumbs, json[QString("breadcrumbs")]); m_breadcrumbs_isSet = !json[QString("breadcrumbs")].isNull() && m_breadcrumbs_isValid; m_generated_text_isValid = ::OpenAPI::fromJsonValue(generated_text, json[QString("generatedText")]); m_generated_text_isSet = !json[QString("generatedText")].isNull() && m_generated_text_isValid; m_image_type_isValid = ::OpenAPI::fromJsonValue(image_type, json[QString("imageType")]); m_image_type_isSet = !json[QString("imageType")].isNull() && m_image_type_isValid; m_likes_isValid = ::OpenAPI::fromJsonValue(likes, json[QString("likes")]); m_likes_isSet = !json[QString("likes")].isNull() && m_likes_isValid; m_servings_isValid = ::OpenAPI::fromJsonValue(servings, json[QString("servings")]); m_servings_isSet = !json[QString("servings")].isNull() && m_servings_isValid; m_price_isValid = ::OpenAPI::fromJsonValue(price, json[QString("price")]); m_price_isSet = !json[QString("price")].isNull() && m_price_isValid; m_spoonacular_score_isValid = ::OpenAPI::fromJsonValue(spoonacular_score, json[QString("spoonacularScore")]); m_spoonacular_score_isSet = !json[QString("spoonacularScore")].isNull() && m_spoonacular_score_isValid; } QString OAIGetMenuItemInformation_200_response::asJson() const { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIGetMenuItemInformation_200_response::asJsonObject() const { QJsonObject obj; if (m_id_isSet) { obj.insert(QString("id"), ::OpenAPI::toJsonValue(id)); } if (m_title_isSet) { obj.insert(QString("title"), ::OpenAPI::toJsonValue(title)); } if (m_restaurant_chain_isSet) { obj.insert(QString("restaurantChain"), ::OpenAPI::toJsonValue(restaurant_chain)); } if (nutrition.isSet()) { obj.insert(QString("nutrition"), ::OpenAPI::toJsonValue(nutrition)); } if (badges.size() > 0) { obj.insert(QString("badges"), ::OpenAPI::toJsonValue(badges)); } if (breadcrumbs.size() > 0) { obj.insert(QString("breadcrumbs"), ::OpenAPI::toJsonValue(breadcrumbs)); } if (m_generated_text_isSet) { obj.insert(QString("generatedText"), ::OpenAPI::toJsonValue(generated_text)); } if (m_image_type_isSet) { obj.insert(QString("imageType"), ::OpenAPI::toJsonValue(image_type)); } if (m_likes_isSet) { obj.insert(QString("likes"), ::OpenAPI::toJsonValue(likes)); } if (servings.isSet()) { obj.insert(QString("servings"), ::OpenAPI::toJsonValue(servings)); } if (m_price_isSet) { obj.insert(QString("price"), ::OpenAPI::toJsonValue(price)); } if (m_spoonacular_score_isSet) { obj.insert(QString("spoonacularScore"), ::OpenAPI::toJsonValue(spoonacular_score)); } return obj; } qint32 OAIGetMenuItemInformation_200_response::getId() const { return id; } void OAIGetMenuItemInformation_200_response::setId(const qint32 &id) { this->id = id; this->m_id_isSet = true; } bool OAIGetMenuItemInformation_200_response::is_id_Set() const{ return m_id_isSet; } bool OAIGetMenuItemInformation_200_response::is_id_Valid() const{ return m_id_isValid; } QString OAIGetMenuItemInformation_200_response::getTitle() const { return title; } void OAIGetMenuItemInformation_200_response::setTitle(const QString &title) { this->title = title; this->m_title_isSet = true; } bool OAIGetMenuItemInformation_200_response::is_title_Set() const{ return m_title_isSet; } bool OAIGetMenuItemInformation_200_response::is_title_Valid() const{ return m_title_isValid; } QString OAIGetMenuItemInformation_200_response::getRestaurantChain() const { return restaurant_chain; } void OAIGetMenuItemInformation_200_response::setRestaurantChain(const QString &restaurant_chain) { this->restaurant_chain = restaurant_chain; this->m_restaurant_chain_isSet = true; } bool OAIGetMenuItemInformation_200_response::is_restaurant_chain_Set() const{ return m_restaurant_chain_isSet; } bool OAIGetMenuItemInformation_200_response::is_restaurant_chain_Valid() const{ return m_restaurant_chain_isValid; } OAISearchGroceryProductsByUPC_200_response_nutrition OAIGetMenuItemInformation_200_response::getNutrition() const { return nutrition; } void OAIGetMenuItemInformation_200_response::setNutrition(const OAISearchGroceryProductsByUPC_200_response_nutrition &nutrition) { this->nutrition = nutrition; this->m_nutrition_isSet = true; } bool OAIGetMenuItemInformation_200_response::is_nutrition_Set() const{ return m_nutrition_isSet; } bool OAIGetMenuItemInformation_200_response::is_nutrition_Valid() const{ return m_nutrition_isValid; } QList<QString> OAIGetMenuItemInformation_200_response::getBadges() const { return badges; } void OAIGetMenuItemInformation_200_response::setBadges(const QList<QString> &badges) { this->badges = badges; this->m_badges_isSet = true; } bool OAIGetMenuItemInformation_200_response::is_badges_Set() const{ return m_badges_isSet; } bool OAIGetMenuItemInformation_200_response::is_badges_Valid() const{ return m_badges_isValid; } QList<QString> OAIGetMenuItemInformation_200_response::getBreadcrumbs() const { return breadcrumbs; } void OAIGetMenuItemInformation_200_response::setBreadcrumbs(const QList<QString> &breadcrumbs) { this->breadcrumbs = breadcrumbs; this->m_breadcrumbs_isSet = true; } bool OAIGetMenuItemInformation_200_response::is_breadcrumbs_Set() const{ return m_breadcrumbs_isSet; } bool OAIGetMenuItemInformation_200_response::is_breadcrumbs_Valid() const{ return m_breadcrumbs_isValid; } QString OAIGetMenuItemInformation_200_response::getGeneratedText() const { return generated_text; } void OAIGetMenuItemInformation_200_response::setGeneratedText(const QString &generated_text) { this->generated_text = generated_text; this->m_generated_text_isSet = true; } bool OAIGetMenuItemInformation_200_response::is_generated_text_Set() const{ return m_generated_text_isSet; } bool OAIGetMenuItemInformation_200_response::is_generated_text_Valid() const{ return m_generated_text_isValid; } QString OAIGetMenuItemInformation_200_response::getImageType() const { return image_type; } void OAIGetMenuItemInformation_200_response::setImageType(const QString &image_type) { this->image_type = image_type; this->m_image_type_isSet = true; } bool OAIGetMenuItemInformation_200_response::is_image_type_Set() const{ return m_image_type_isSet; } bool OAIGetMenuItemInformation_200_response::is_image_type_Valid() const{ return m_image_type_isValid; } double OAIGetMenuItemInformation_200_response::getLikes() const { return likes; } void OAIGetMenuItemInformation_200_response::setLikes(const double &likes) { this->likes = likes; this->m_likes_isSet = true; } bool OAIGetMenuItemInformation_200_response::is_likes_Set() const{ return m_likes_isSet; } bool OAIGetMenuItemInformation_200_response::is_likes_Valid() const{ return m_likes_isValid; } OAISearchGroceryProductsByUPC_200_response_servings OAIGetMenuItemInformation_200_response::getServings() const { return servings; } void OAIGetMenuItemInformation_200_response::setServings(const OAISearchGroceryProductsByUPC_200_response_servings &servings) { this->servings = servings; this->m_servings_isSet = true; } bool OAIGetMenuItemInformation_200_response::is_servings_Set() const{ return m_servings_isSet; } bool OAIGetMenuItemInformation_200_response::is_servings_Valid() const{ return m_servings_isValid; } double OAIGetMenuItemInformation_200_response::getPrice() const { return price; } void OAIGetMenuItemInformation_200_response::setPrice(const double &price) { this->price = price; this->m_price_isSet = true; } bool OAIGetMenuItemInformation_200_response::is_price_Set() const{ return m_price_isSet; } bool OAIGetMenuItemInformation_200_response::is_price_Valid() const{ return m_price_isValid; } double OAIGetMenuItemInformation_200_response::getSpoonacularScore() const { return spoonacular_score; } void OAIGetMenuItemInformation_200_response::setSpoonacularScore(const double &spoonacular_score) { this->spoonacular_score = spoonacular_score; this->m_spoonacular_score_isSet = true; } bool OAIGetMenuItemInformation_200_response::is_spoonacular_score_Set() const{ return m_spoonacular_score_isSet; } bool OAIGetMenuItemInformation_200_response::is_spoonacular_score_Valid() const{ return m_spoonacular_score_isValid; } bool OAIGetMenuItemInformation_200_response::isSet() const { bool isObjectUpdated = false; do { if (m_id_isSet) { isObjectUpdated = true; break; } if (m_title_isSet) { isObjectUpdated = true; break; } if (m_restaurant_chain_isSet) { isObjectUpdated = true; break; } if (nutrition.isSet()) { isObjectUpdated = true; break; } if (badges.size() > 0) { isObjectUpdated = true; break; } if (breadcrumbs.size() > 0) { isObjectUpdated = true; break; } if (m_generated_text_isSet) { isObjectUpdated = true; break; } if (m_image_type_isSet) { isObjectUpdated = true; break; } if (m_likes_isSet) { isObjectUpdated = true; break; } if (servings.isSet()) { isObjectUpdated = true; break; } if (m_price_isSet) { isObjectUpdated = true; break; } if (m_spoonacular_score_isSet) { isObjectUpdated = true; break; } } while (false); return isObjectUpdated; } bool OAIGetMenuItemInformation_200_response::isValid() const { // only required properties are required for the object to be considered valid return m_id_isValid && m_title_isValid && m_restaurant_chain_isValid && m_nutrition_isValid && m_badges_isValid && m_breadcrumbs_isValid && m_image_type_isValid && m_likes_isValid && m_servings_isValid && true; } } // namespace OpenAPI
e959a28fcc8f5ff8c456bebcb6c450a37219ffb4
c5ac74a469f01db9f5dfc152a15c39195f8a9e78
/General/SIMD.h
f66976531764e19d58fe137683a84c9349fb67b7
[ "MIT" ]
permissive
anylee2021/NextGen
57307c76fb27ab19f57efd270d0a76f9ed1eeca8
0288513ce85632738abc52a1dae5a4f70cead94d
refs/heads/master
2023-01-19T09:30:12.519723
2020-11-24T23:33:04
2020-11-24T23:33:04
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,775
h
SIMD.h
#pragma once #include <array> #include <xmmintrin.h> #include <intrin.h> namespace Math::SIMD { class XMM { __m128 xmm; public: inline XMM() noexcept : xmm(_mm_setzero_ps()) {} inline XMM(__m128 xmm) noexcept : xmm(xmm) {} inline XMM(float src) noexcept : xmm(_mm_set1_ps(src)) {} inline XMM(float x, float y, float z, float w) noexcept : xmm(_mm_set_ps(x, y, z, w)) {} inline XMM(const float src[4]) noexcept : xmm(_mm_loadu_ps(src)) {} public: inline operator __m128() const noexcept { return xmm; } public: inline void Extract(float dst[4]) const noexcept; inline std::array<float, 4> Extract() const noexcept; friend inline XMM __vectorcall operator +(XMM src) noexcept, __vectorcall operator -(XMM src) noexcept; friend inline XMM __vectorcall operator +(XMM left, XMM right) noexcept, __vectorcall operator -(XMM left, XMM right) noexcept, __vectorcall operator *(XMM left, XMM right) noexcept, __vectorcall operator /(XMM left, XMM right) noexcept; friend inline XMM &__vectorcall operator +=(XMM &left, XMM right) noexcept, &__vectorcall operator -=(XMM &left, XMM right) noexcept, &__vectorcall operator *=(XMM &left, XMM right) noexcept, &__vectorcall operator /=(XMM &left, XMM right) noexcept; }; #if defined _MSC_VER && _MSC_VER > 1924 && _MSC_VER <= 1928 inline XMM __vectorcall operator +(XMM src) noexcept, __vectorcall operator -(XMM src) noexcept; inline XMM __vectorcall operator +(XMM left, XMM right) noexcept, __vectorcall operator -(XMM left, XMM right) noexcept, __vectorcall operator *(XMM left, XMM right) noexcept, __vectorcall operator /(XMM left, XMM right) noexcept; inline XMM &__vectorcall operator +=(XMM &left, XMM right) noexcept, &__vectorcall operator -=(XMM &left, XMM right) noexcept, &__vectorcall operator *=(XMM &left, XMM right) noexcept, &__vectorcall operator /=(XMM &left, XMM right) noexcept; #endif class YMM { __m256 ymm; public: inline YMM() noexcept : ymm(_mm256_setzero_ps()) {} inline YMM(__m256 ymm) noexcept : ymm(ymm) {} inline YMM(float src) noexcept : ymm(_mm256_set1_ps(src)) {} inline YMM(float _0, float _1, float _2, float _3, float _4, float _5, float _6, float _7) noexcept : ymm(_mm256_set_ps(_0, _1, _2, _3, _4, _5, _6, _7)) {} inline YMM(const float src[8]) noexcept : ymm(_mm256_loadu_ps(src)) {} public: inline operator __m256() const noexcept { return ymm; } public: inline void Extract(float dst[8]) const noexcept; inline std::array<float, 8> Extract() const noexcept; friend inline YMM __vectorcall operator +(YMM src) noexcept, __vectorcall operator -(YMM src) noexcept; friend inline YMM __vectorcall operator +(YMM left, YMM right) noexcept, __vectorcall operator -(YMM left, YMM right) noexcept, __vectorcall operator *(YMM left, YMM right) noexcept, __vectorcall operator /(YMM left, YMM right) noexcept; friend inline YMM &__vectorcall operator +=(YMM &left, YMM right) noexcept, &__vectorcall operator -=(YMM &left, YMM right) noexcept, &__vectorcall operator *=(YMM &left, YMM right) noexcept, &__vectorcall operator /=(YMM &left, YMM right) noexcept; }; #if defined _MSC_VER && _MSC_VER > 1924 && _MSC_VER <= 1927 inline YMM __vectorcall operator +(YMM src) noexcept, __vectorcall operator -(YMM src) noexcept; inline YMM __vectorcall operator +(YMM left, YMM right) noexcept, __vectorcall operator -(YMM left, YMM right) noexcept, __vectorcall operator *(YMM left, YMM right) noexcept, __vectorcall operator /(YMM left, YMM right) noexcept; inline YMM &__vectorcall operator +=(YMM &left, YMM right) noexcept, &__vectorcall operator -=(YMM &left, YMM right) noexcept, &__vectorcall operator *=(YMM &left, YMM right) noexcept, &__vectorcall operator /=(YMM &left, YMM right) noexcept; #endif } #include "SIMD.inl"
6aedef900d58efe39f46f10e21b783470f7273b2
f6724b46574298a3b89ac558954eadc49c9f96f1
/MinimumWindowSubstring.cpp
4b09abe01d284ac787b06fac142324956cf9917f
[]
no_license
zrss/LeetCode
5b0a6ce72d44859cc12a45edef8c5a371c149bc9
54ff11599b5c141072f94e77ce55731b76467f0d
refs/heads/master
2020-04-06T00:57:25.675167
2016-10-22T03:26:26
2016-10-22T03:26:26
24,978,800
0
0
null
null
null
null
UTF-8
C++
false
false
1,354
cpp
MinimumWindowSubstring.cpp
#include <iostream> #include <string> using namespace std; class Solution { public: string minWindow(string s, string t) { int slen = s.length(); int tlen = t.length(); int dict[128] = {0}; fill(dict, dict + 128, -slen); for (int i = 0; i < tlen; ++i) { if (dict[t[i]] > 0) { ++dict[t[i]]; } else { dict[t[i]] = 1; } } int count = t.length(); int start = 0; // window start int minWin = INT_MAX; // int minStart = 0; // for (int end = 0; end < slen; ++end) { // s[i] in t and window fit if (--dict[s[end]] >= 0 && --count == 0) { // if s[start] not in t or still have s[start] in window then move start while (dict[s[start]] <= -slen || ++dict[s[start]] <= 0) { ++start; } // update minimum window length if (end - start + 1 < minWin) { minWin = end - start + 1; minStart = start; } // continue to traverse ++start; count = 1; // as moving forward start one step so only left 1 character unmatch } } return minWin != INT_MAX ? s.substr(minStart, minWin) : ""; } }; int main(int argc, char const *argv[]) { Solution solution; string s = "ADOBECODEBANC"; string t = "ABC"; cout << solution.minWindow(s, t) << endl; return 0; }
b371f5a4fd1efb65742b4b7e7808e61540da3c0b
182525c611e62286df4321ad0dd4b9c9fda63114
/Plugins/BossPlugin/Source/BossPlugin/Private/BossCharacter.cpp
73c50ad76fbb1ae1c8f31db268f4b253f123de13
[ "MIT" ]
permissive
frostblooded/UE4BossProject
64dc2ce34098fb0f4e209ad34ee42aeeec45ad75
3f80ce23822a870a00553c256ee39377ac1b07ba
refs/heads/master
2022-04-02T03:40:47.873410
2020-02-25T14:59:15
2020-02-25T14:59:15
236,283,513
1
0
null
null
null
null
UTF-8
C++
false
false
1,953
cpp
BossCharacter.cpp
// Fill out your copyright notice in the Description page of Project Settings. #include "BossCharacter.h" #include "BossPlugin.h" ABossCharacter::ABossCharacter() { PrimaryActorTick.bCanEverTick = true; DamageableComponent = CreateDefaultSubobject<UDamageableComponent>(TEXT("Damageable")); } void ABossCharacter::BeginPlay() { Super::BeginPlay(); InstantiateAbilities(); } void ABossCharacter::InstantiateAbilities() { for (auto Template : PhaseOneAbilitiesTemplates) { PhaseOneAbilitiesInstances.Add(NewObject<UBossAbility>(this, Template)); } for (auto Template : PhaseTwoAbilitiesTemplates) { PhaseTwoAbilitiesInstances.Add(NewObject<UBossAbility>(this, Template)); } for (auto Template : PhaseThreeAbilitiesTemplates) { PhaseThreeAbilitiesInstances.Add(NewObject<UBossAbility>(this, Template)); } } int ABossCharacter::GetPhase() { if (DamageableComponent->Health > PhaseTwoThreshold) { return 1; } else if (DamageableComponent->Health > PhaseThreeThreshold && DamageableComponent->Health <= PhaseTwoThreshold) { return 2; } return 3; } TArray<UBossAbility*> ABossCharacter::GetPhaseAbilities() { int Phase = GetPhase(); if (Phase == 1) { return PhaseOneAbilitiesInstances; } else if (Phase == 2) { return PhaseTwoAbilitiesInstances; } return PhaseThreeAbilitiesInstances; } UBossAbility* ABossCharacter::GetRandomAbility() { TArray<UBossAbility*> Abilities = GetPhaseAbilities(); if (Abilities.Num() == 0) { UE_LOG(LogBossPlugin, Error, TEXT("ABossAIController::UseRandomAbility Abilities.Num == 0")); return nullptr; } int RandomAbilityIndex = FMath::RandRange(0, Abilities.Num() - 1); return Abilities[RandomAbilityIndex]; } bool ABossCharacter::HasAbilityOffCooldown() { TArray<UBossAbility*> Abilities = GetPhaseAbilities(); bool bResult = false; for (UBossAbility* Ability : Abilities) { if (Ability->IsOffCooldown()) { return true; } } return false; }
a67fc74d2d0d8a235f21d5b2b30dac9d63d472ae
68e3cbcd32ef49a64267a92486ae7e0dc8f3916f
/cf 1369A.cpp
26bf12af5958d7828210376e4358db7b80238d35
[]
no_license
star-platinum127/uva
d2db4e0078a502628257ac6b4b6ac7d6f4899e5e
fc660aad483909055f5397be267c4ce9c033c4ef
refs/heads/master
2023-05-26T15:57:48.922938
2023-05-21T15:45:46
2023-05-21T15:45:46
240,208,573
0
0
null
null
null
null
UTF-8
C++
false
false
442
cpp
cf 1369A.cpp
#include <bits/stdc++.h> using namespace std; /* run this program using the console pauser or add your own getch, system("pause") or input loop */ typedef long long ll; int main(int argc, char** argv) { ios_base::sync_with_stdio(0); cin.tie(0); int t; cin>>t; while(t--){ ll n; cin>>n; if(n<4){ cout<<"NO"<<endl; continue; } if((n-4)%4==0) cout<<"YES"<<endl; else cout<<"NO"<<endl; } return 0; }
f0942411e50bbaa0b92878b900d435493f6831df
47070d61c2dd251c65eaab22ffc310044257483a
/SFML_Working.cpp
d4cdbf8845b32ef29ab3106b616fd33a2c6008eb
[]
no_license
DanielCaoSilva/Snakegame
0f149523fffe603c4f54deb1d5283916b5d68b0f
54a959d4e531664614fb887daa293a3ffd5c66b7
refs/heads/master
2021-10-07T16:04:33.500397
2021-10-06T07:10:13
2021-10-06T07:10:13
181,766,058
2
0
null
null
null
null
UTF-8
C++
false
false
7,571
cpp
SFML_Working.cpp
// SFML_Test.cpp : snake game #include <SFML/Graphics.hpp> //using namespace sf #include <time.h> //New: Making the timer global float timer = 0.0f, delay = 0.1f; //dimensions for window size and background int num_vertBox = 30, num_horzBox = 20; int size = 16; //number of pixels int w = size * num_horzBox; //background number of pixels in width int h = size * num_vertBox; //background number of pixels in height //Snake variables to dertermine length and direction int direction; int direction1;//direction the snake is moving int snake_length = 4; //initial size is 4 int snake_length1 = 4; //Actual Snake in game is an array of x,y coordinates of sprite2 struct Snake { int x, y; //each sprite of snake needs an x,y coordinate }s[100]; struct Snake2 { int x, y; }s1[100]; //***NEW*** this is the fruit or food that the snake will eat struct Fruit { int x, y; // only need one sprite needed for one food item }food; //move snake head based on user input and body by incrementing //forward by iterating through arrays previous position void move() { //1st update body so everything updates in proper order //move the body only! s[0] = head will not be changed here for (int i = snake_length; i > 0; i--) { s[i].x = s[i - 1].x; s[i].y = s[i - 1].y; } for (int i = snake_length1; i > 0; i--) { s1[i].x = s1[i - 1].x; s1[i].y = s1[i - 1].y; } //2nd update the head //Head of snake, s[0] depends on direction user inputs //if user presses up if (direction == 0) s[0].y -= 1; //if user presses down if (direction == 1) s[0].y += 1; //if user presses left if (direction == 2) s[0].x -= 1; //if user presses right if (direction == 3) s[0].x += 1; //if user2 presses w if (direction1 == 4) s1[0].y -= 1; //if user2 presses s if (direction1 == 5) s1[0].y += 1; //if user2 presses a if (direction1 == 6) s1[0].x -= 1; //if user2 presses d if (direction1 == 7) s1[0].x += 1; //***NEW*** If Snake eats food it should grow //check if snake head = food location if (((s[0].x) == food.x) && ((s[0].y) == food.y)) { //increment snake snake_length++; //New: Increases the speed of the game after snake eats food delay=delay-.01; //Randomly place food somewhere else food.x = rand() % num_horzBox; food.y = rand() % num_vertBox; } if (((s1[0].x) == food.x) && ((s1[0].y) == food.y)) { //increment snake snake_length1++; //New: Increases the speed of the game after snake eats food delay = delay - .01; //Randomly place food somewhere else food.x = rand() % num_horzBox; food.y = rand() % num_vertBox; } //***NEW*** Boundary Checking snake as is hits screen end //loop snake back on other side //LEFT and RIGHT if (s[0].x > num_horzBox) s[0].x = 0; if (s[0].x < 0) s[0].x = num_horzBox; //TOP and BOTTOM if (s[0].y > num_vertBox) s[0].y = 0; if (s[0].y < 0) s[0].y = num_vertBox; //Left and Right if (s1[0].x > num_horzBox) s1[0].x = 0; if (s1[0].x < 0) s1[0].x = num_horzBox; //TOP and BOTTOM if (s1[0].y > num_vertBox) s1[0].y = 0; if (s1[0].y < 0) s1[0].y = num_vertBox; //***NEW*** Check if you eat body of snake for (int i = 1; i < snake_length; i++) { //Cut Snake body from place eaten if (s[0].x == s[i].x && s[0].y == s[i].y) { snake_length = i; //New: Resets the delay after snake eats part of itself delay = 0.1f; } } for (int i = 1; i < snake_length1; i++) { //Cut Snake body from place eaten if (s1[0].x == s1[i].x && s1[0].y == s1[i].y) { snake_length1 = i; //New: Resets the delay after snake eats part of itself delay = 0.1f; } } } int main() { //Setting pseudorandom time, srand(time(0)); //Window that we can play the game in sf::RenderWindow window(sf::VideoMode(w, h), "Snake Game"); //Textures load an image into the GPU Memory sf::Texture t1, t2, t3, t4; t1.loadFromFile("white.png"); t2.loadFromFile("red.png"); t3.loadFromFile("pineapple.png"); t4.loadFromFile("green.png"); //Sprite has physical dimmensions that can be set in //coordinate system, setPosition(x,y), and drawn on screen sf::Sprite sprite1(t1); sf::Sprite sprite2(t2); sf::Sprite sprite3(t3); sf::Sprite sprite4(t4); //***NEW*** initially place food somewhere on screen food.x = 10; food.y = 10; sf::Clock clock; //float timer = 0.0f, delay = 0.1f; while (window.isOpen()) { float time = clock.getElapsedTime().asSeconds(); clock.restart(); timer += time; //Allow us to check when a user does something sf::Event e; //Check when the window is closed while (window.pollEvent(e)) { //If user presses x in the top right, Windows, top left, Mac, close the window if (e.type == sf::Event::Closed) { window.close(); } } //Control for Snake by User if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up)) direction = 0; if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down)) direction = 1; if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left)) direction = 2; if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right)) direction = 3; if (sf::Keyboard::isKeyPressed(sf::Keyboard::W)) direction1 = 4; if (sf::Keyboard::isKeyPressed(sf::Keyboard::S)) direction1 = 5; if (sf::Keyboard::isKeyPressed(sf::Keyboard::A)) direction1 = 6; if (sf::Keyboard::isKeyPressed(sf::Keyboard::D)) direction1 = 7; if (timer > delay) { timer = 0; //reset timer move(); //move Snake one sprite forward } /***************** //Draw in window *****************/ window.clear(); //clear the window so new frame can be drawn in //NOTE: Order matters as we will draw over items listed first. //Hence the background should be the first thing you will always do //1st: Draw Background first for (int i = 0; i < num_horzBox; i++) { for (int j = 0; j < num_vertBox; j++) { //Set position of sprite1 one at a time sprite1.setPosition(i * size, j * size); //Draw sprite1 but, do not show it on screen. window.draw(sprite1); } } //2nd: Then Draw snake otherwise background will be drawn over snake if order was reversed with background for (int i = 0; i < snake_length; i++) { //position sprite2 one at a time sprite2.setPosition(s[i].x * size, s[i].y * size); //sprite4.setPosition(s1[i].x* size, s1[i].y* size); //Draw sprite2 one at a time by drawing over background window.draw(sprite2); //window.draw(sprite4); } for (int i = 0; i < snake_length1; i++) { //position sprite4 one at a time sprite4.setPosition(s1[i].x * size, s1[i].y * size); //Draw sprite4 one at a time by drawing over background window.draw(sprite4); } //***NEW*** 3rd: Draw Fruit sprite3.setPosition(food.x * size, food.y * size); window.draw(sprite3); //Show everything we have drawn on the screen window.display(); } return 0; }
36c37360255a0297cf8a919772d502bcf528afad
ad71ef02dcbea4f684dbc87119e860b7a4ae1ebb
/LeetCode/Problems/12.Integer_to_roman.cpp
e65f8f37452995914f78b12f2cba2a4b6fa6677f
[]
no_license
Bab95/Programs
851e46a8f7be0b6bde412caf405102c562dde2e0
79ed28bb487bdab3b72fa12d56c2d62f2bc6a683
refs/heads/master
2022-09-30T00:41:32.631053
2022-08-27T09:42:57
2022-08-27T09:42:57
228,459,568
0
0
null
null
null
null
UTF-8
C++
false
false
492
cpp
12.Integer_to_roman.cpp
class Solution { public: string intToRoman(int num) { int arbics[] = {1000,900,500,400,100,90,50,40,10,9,5,4,1}; string romans[] = {"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"}; string result = ""; int size = sizeof(arbics)/sizeof(int); for(int i=0;i<size;i++){ while(num-arbics[i]>=0){ result.append(romans[i]); num = num-arbics[i]; } } return result; } };
c4d669b11fb490105140e6ebf768e0400b499817
16b31f7e7df68c0da7d9f54c339ec0d9ab02bc21
/traycer.cpp
37371390afcb224306615f512d3e05f7939cc377
[ "MIT" ]
permissive
prateek96/Ray-Tracer
90f704016293f99ab5d7486d5b02e0302282aafb
476d6168c6a7f6c22c38e601cea0cb860c69e91f
refs/heads/master
2021-01-12T06:05:56.841970
2016-12-24T20:05:49
2016-12-24T20:05:49
77,298,545
1
0
null
null
null
null
UTF-8
C++
false
false
4,721
cpp
traycer.cpp
#include <vector> #include <memory> #include "geometry.hpp" #include "traycer.hpp" #include "object.hpp" #define STB_IMAGE_WRITE_IMPLEMENTATION #include "stb_image_write.h" const float kInfinity = std::numeric_limits<float>::max(); std::random_device rd; std::mt19937 gen(rd()); std::uniform_real_distribution<> dis(0, 1); bool solveQuadratic(const float &a, const float &b, const float &c, float &x0, float &x1) { float discr = b * b - 4 * a * c; if (discr < 0) return false; else if (discr == 0) { x0 = x1 = - 0.5 * b / a; } else { float q = (b > 0) ? -0.5 * (b + sqrt(discr)) : -0.5 * (b - sqrt(discr)); x0 = q / a; x1 = c / q; } return true; } bool trace(const Rayf &ray, const std::vector<std::unique_ptr<Object>> &objects, float &tNear, const Object *&hitObject) { tNear = kInfinity; std::vector<std::unique_ptr<Object>>::const_iterator iter = objects.begin(); for (; iter != objects.end(); ++iter) { float t = kInfinity; if ((*iter)->intersect(ray, t) && t < tNear) { hitObject = iter->get(); tNear = t; } } return (hitObject != nullptr); } Vec3f castRay(const Rayf &ray, const std::vector<std::unique_ptr<Object>> &objects) { Vec3f hitColor = 0; const Object *hitObject = nullptr; // this is a pointer to the hit object float t; // this is the intersection distance from the ray origin to the hit point if (trace(ray, objects, t, hitObject)) { Vec3f Phit = ray.point(t); Vec3f Nhit; Vec2f tex; hitObject->getSurfaceData(Phit, Nhit, tex); // Use the normal and texture coordinates to shade the hit point. // The normal is used to compute a simple facing ratio and the texture coordinate // to compute a basic checker board pattern float scale = 4; float pattern = (fmodf(tex.x * scale, 1) > 0.5) ^ (fmodf(tex.y * scale, 1) > 0.5); hitColor = std::max(0.f, Nhit.dotProduct(-ray.dir)) * mix(hitObject->color, hitObject->color * 0.8, pattern); } return hitColor; } void render(const Options &options, const std::vector<std::unique_ptr<Object>> &objects) { Vec3f *framebuffer = new Vec3f[options.width * options.height]; Vec3f *pix = framebuffer; float scale = tan(deg2rad(options.fov * 0.5)); float imageAspectRatio = options.width / (float)options.height; // Don't forget to transform the ray origin (which is also the camera origin // by transforming the point with coordinates (0,0,0) to world-space using the // camera-to-world matrix. Vec3f orig; options.cameraToWorld.multVecMatrix(Vec3f(0), orig); for (uint32_t j = 0; j < options.height; ++j) { for (uint32_t i = 0; i < options.width; ++i) { // Generate primary ray direction. Compute the x and y position // of the ray in screen space. This gives a point on the image plane // at z=1. From there, we simply compute the direction by normalized // the resulting vec3f variable. This is similar to taking the vector // between the point on the image plane and the camera origin, which // in camera space is (0,0,0): // // ray.dir = normalize(Vec3f(x,y,-1) - Vec3f(0)); #ifdef MAYA_STYLE float x = (2 * (i + 0.5) / (float)options.width - 1) * scale; float y = (1 - 2 * (j + 0.5) / (float)options.height) * scale * 1 / imageAspectRatio; #else float x = (2 * (i + 0.5) / (float)options.width - 1) * imageAspectRatio * scale; float y = (1 - 2 * (j + 0.5) / (float)options.height) * scale; #endif // Don't forget to transform the ray direction using the camera-to-world matrix. Vec3f dir; options.cameraToWorld.multDirMatrix(Vec3f(x, y, -1), dir); dir.normalize(); *(pix++) = castRay(Rayf(orig, dir), objects); } } unsigned char *image = new unsigned char[3 * options.width * options.height]; for (size_t i = 0; i < options.width; ++i) { for(size_t j = 0; j < options.height; ++j) { image[3 * (i + options.width * j) + 0] = (unsigned char)(255 * clamp(0, 1, framebuffer[i + options.width * j].x)); image[3 * (i + options.width * j) + 1] = (unsigned char)(255 * clamp(0, 1, framebuffer[i + options.width * j].y)); image[3 * (i + options.width * j) + 2] = (unsigned char)(255 * clamp(0, 1, framebuffer[i + options.width * j].z)); } } stbi_write_png("ray_trace.png", options.width, options.height, 3, image, 0); delete [] framebuffer; delete [] image; }
63ff3c357258b7c767cc80185080f2a31156a9dc
0c3d18b4d3deaca6ad804db78b5863d8ad2e8101
/MainController.cpp
ed077e536c68f5b5c3d5231c6e07f61bef749717
[]
no_license
jinzhu6/astra_kintinuous_yolo
f7e82c1b93edaa16f3375b9ad9c85d6594f6188f
1eccadd245d589ed6fb610b1e66b48e36a1db349
refs/heads/master
2020-12-26T17:14:30.278092
2018-02-11T10:54:57
2018-02-11T10:54:57
null
0
0
null
null
null
null
UTF-8
C++
false
false
9,790
cpp
MainController.cpp
/* * This file is part of Kintinuous. * * Copyright (C) 2015 The National University of Ireland Maynooth and * Massachusetts Institute of Technology * * The use of the code within this file and all code within files that * make up the software that is Kintinuous is permitted for * non-commercial purposes only. The full terms and conditions that * apply to the code within this file are detailed within the LICENSE.txt * file and at <http://www.cs.nuim.ie/research/vision/data/kintinuous/code.php> * unless explicitly stated. By downloading this file you agree to * comply with these terms. * * If you wish to use any of this code for commercial purposes then * please email commercialisation@nuim.ie. */ #include "MainController.h" #include <boost/filesystem.hpp> #include <boost/algorithm/algorithm.hpp> #include <boost/algorithm/string.hpp> MainController * MainController::controller = 0; MainController::MainController(int argc, char * argv[]) : depthIntrinsics(0), pangoVis(0), trackerInterface(0), meshGenerator(0), placeRecognition(0), cloudSliceProcessor(0), deformation(0), rawRead(0), liveRead(0), logRead(0) { ConfigArgs::get(argc, argv); assert(!MainController::controller); MainController::controller = this; } MainController::~MainController() { if(depthIntrinsics) { delete depthIntrinsics; } } int MainController::start() { if(setup()) { return mainLoop(); } else { return -1; } } bool MainController::setup() { pcl::console::setVerbosityLevel(pcl::console::L_ALWAYS); Volume::get(ConfigArgs::get().volumeSize); Stopwatch::get().setCustomSignature(43543534); cudaSafeCall(cudaSetDevice(ConfigArgs::get().gpu)); loadCalibration(); std::cout << "Point resolution: " << ((int)((Volume::get().getVoxelSizeMeters().x * 1000.0f) * 10.0f)) / 10.0f << " millimetres" << std::endl; if(ConfigArgs::get().logFile.size()) { rawRead = new RawLogReader; logRead = static_cast<LogReader *>(rawRead); } else { liveRead = new LiveLogReader; logRead = static_cast<LogReader *>(liveRead); } ThreadDataPack::get(); trackerInterface = new TrackerInterface(logRead, depthIntrinsics); if(ConfigArgs::get().trajectoryFile.size()) { std::cout << "Load trajectory: " << ConfigArgs::get().trajectoryFile << std::endl; trackerInterface->loadTrajectory(ConfigArgs::get().trajectoryFile); } systemComponents.push_back(trackerInterface); ThreadDataPack::get().assignFrontend(trackerInterface->getFrontend()); cloudSliceProcessor = new CloudSliceProcessor(); systemComponents.push_back(cloudSliceProcessor); if(ConfigArgs::get().extractOverlap) { trackerInterface->enableOverlap(); } if(!ConfigArgs::get().incrementalMesh && ConfigArgs::get().enableMeshGenerator) { meshGenerator = new MeshGenerator(); systemComponents.push_back(meshGenerator); } else { ThreadDataPack::get().meshGeneratorFinished.assignValue(true); } if(ConfigArgs::get().vocabFile.size() && ConfigArgs::get().onlineDeformation) { deformation = new Deformation; placeRecognition = new PlaceRecognition(depthIntrinsics); systemComponents.push_back(deformation); systemComponents.push_back(placeRecognition); } else { ThreadDataPack::get().deformationFinished.assignValue(true); ThreadDataPack::get().placeRecognitionFinished.assignValue(true); } pangoVis = new PangoVis(depthIntrinsics); return true; } int MainController::mainLoop() { timeval start; gettimeofday(&start, 0); //uint64_t beginning = start.tv_sec * 1000000 + start.tv_usec; for(unsigned int i = 0; i < systemComponents.size(); i++) { threads.add_thread(new boost::thread(boost::bind(&ThreadObject::start, systemComponents.at(i)))); } if(pangoVis) { pangoVis->start(); } threads.join_all(); for(unsigned int i = 0; i < systemComponents.size(); i++) { delete systemComponents.at(i); } if(pangoVis) { pangoVis->stop(); delete pangoVis; } if(rawRead) { delete rawRead; } if(liveRead) { delete liveRead; } return 0; } void MainController::loadCalibration() { const std::string& calFile = ConfigArgs::get().calibrationFile; if(calFile.length() > 0) { std::string extension = boost::filesystem::extension(calFile); boost::algorithm::to_lower(extension); if(extension == ".xml" || extension == ".yml"){ // Traditional kintinuous format (opencv) cv::FileStorage calibrationFile(calFile.c_str(), cv::FileStorage::READ); depthIntrinsics = new cv::Mat((CvMat *) calibrationFile["depth_intrinsics"].readObj(), true); } else { // ElasticFusion format std::ifstream file(calFile); std::string line; if(file.eof()) throw std::invalid_argument("Could not read calibration file."); double fx, fy, cx, cy, w, h; std::getline(file, line); int n = sscanf(line.c_str(), "%lg %lg %lg %lg %lg %lg", &fx, &fy, &cx, &cy, &w, &h); if (n != 4 && n != 6) throw std::invalid_argument("Ooops, your calibration file should contain a single line with [fx fy cx cy] or [fx fy cx cy w h]"); depthIntrinsics = new cv::Mat(cv::Mat::zeros(3, 3, CV_64F)); depthIntrinsics->at<double>(0, 2) = cx; depthIntrinsics->at<double>(1, 2) = cy; depthIntrinsics->at<double>(0, 0) = fx; depthIntrinsics->at<double>(1, 1) = fy; depthIntrinsics->at<double>(2, 2) = 1; if (n == 6) Resolution::get(w, h); } } else { depthIntrinsics = new cv::Mat(cv::Mat::zeros(3, 3, CV_64F)); depthIntrinsics->at<double>(0, 2) = 322.3317718505859; depthIntrinsics->at<double>(1, 2) = 248.8806838989258; depthIntrinsics->at<double>(0, 0) = 507.8066533497105; depthIntrinsics->at<double>(1, 1) = 507.8066533497105; depthIntrinsics->at<double>(2, 2) = 1; } Resolution::get(640, 480); } void MainController::complete() { trackerInterface->endRequested.assignValue(true); } void MainController::save() { if(ThreadDataPack::get().finalised.getValue()) { if(!ConfigArgs::get().onlineDeformation) { boost::thread * cloudSaveThread = new boost::thread(boost::bind(&CloudSliceProcessor::save, cloudSliceProcessor)); assert(cloudSaveThread); if(controller->meshGenerator) { boost::thread * meshSaveThread = new boost::thread(boost::bind(&MeshGenerator::save, meshGenerator)); assert(meshSaveThread); } } else { boost::thread * cloudSaveThread = new boost::thread(boost::bind(&Deformation::saveCloud, deformation)); assert(cloudSaveThread); if(ConfigArgs::get().enableMeshGenerator) { boost::thread * meshSaveThread = new boost::thread(boost::bind(&Deformation::saveMesh, deformation)); assert(meshSaveThread); } } } } void MainController::reset() { if(!ThreadDataPack::get().finalised.getValue()) { for(unsigned int i = 0; i < systemComponents.size(); i++) { systemComponents.at(i)->stop(); } while(true) { bool stillRunning = false; for(unsigned int i = 0; i < systemComponents.size(); i++) { if(systemComponents.at(i)->running()) { stillRunning = true; break; } } if(!stillRunning) { break; } else { ThreadDataPack::get().notifyVariables(); ThreadDataPack::get().tracker->cloudSignal.notify_all(); } } threads.join_all(); if(pangoVis) { pangoVis->reset(); } for(unsigned int i = 0; i < systemComponents.size(); i++) { systemComponents.at(i)->reset(); } ThreadDataPack::get().reset(); for(unsigned int i = 0; i < systemComponents.size(); i++) { threads.add_thread(new boost::thread(boost::bind(&ThreadObject::start, systemComponents.at(i)))); } } } void MainController::setPark(const bool park) { trackerInterface->setPark(park); } void MainController::shutdown() { for(size_t i = 0; i < systemComponents.size(); i++) { systemComponents.at(i)->stop(); } while(true) { bool stillRunning = false; for(size_t i = 0; i < systemComponents.size(); i++) { if(systemComponents.at(i)->running()) { stillRunning = true; break; } } if(!stillRunning) { break; } else { ThreadDataPack::get().notifyVariables(); ThreadDataPack::get().tracker->cloudSignal.notify_all(); } } if(pangoVis) { pangoVis->stop(); } } uint64_t MainController::getMaxLag() { uint64_t maxLag = 0; for(size_t i = 0; i < systemComponents.size(); i++) { maxLag = std::max(systemComponents.at(i)->lagTime.getValue(), maxLag); } return maxLag; }
49604e2e947f7cd31aa08f62b027a89f21a847a9
fc9a7b45a17e664af144b03508e04deb75463ce7
/kernel.cpp
f2a48f5dd2fcb21bbde55837f9a2f4e80b307c3e
[]
no_license
luansimoes/Semaforo
fe1a304e13dc68e775f621fb4da64b3a3c7bd5e4
e24e77f4f0425899fecab6e64406d697d814eaa1
refs/heads/master
2020-04-20T02:35:35.552154
2019-01-31T18:36:43
2019-01-31T18:36:43
168,575,315
0
0
null
null
null
null
UTF-8
C++
false
false
3,031
cpp
kernel.cpp
#include "kernel.h" #include <QDebug> #include "luascriptengine.h" #include "consolemodule.h" #include "trafficlightwidgetwrapper.h" #include <QtLua/Value> class KernelPrivate { public: KernelPrivate() : m_engine(nullptr) { } ~KernelPrivate() { } QtLua::Value registerGlobalObject(QObject *qobject, const QString &name); LuaScriptEngine *m_engine; ConsoleModule m_consoleModule; }; QtLua::Value KernelPrivate::registerGlobalObject(QObject *qobject, const QString &name) { if (!m_engine) { qDebug() << "No engine set, aborting global object creation."; return nullptr; } //newQObject() e globalObject()- criar m_engine->newQObject(qobject, name); return m_engine->getObject(name); } //BEGIN: Kernel Kernel::Kernel() : d(new KernelPrivate) { connect(&d->m_consoleModule, &ConsoleModule::message, this, &Kernel::processMessage); } Kernel::~Kernel(){} QtLua::ValueBase::List Kernel::execute(TrafficLight *tl, const QString &script){ if (!d->m_engine) { d->m_engine = new LuaScriptEngine(this); } // register meta types //qScriptRegisterSequenceMetaType<QList<GraphTheory::NodeWrapper*> >(d->m_engine); //qScriptRegisterSequenceMetaType<QList<GraphTheory::EdgeWrapper*> >(d->m_engine); //qRegisterMetaType<GraphTheory::NodeWrapper*>(); //qRegisterMetaType<GraphTheory::EdgeWrapper*>(); if (d->m_engine->isEvaluating()) { d->m_engine->abortEvaluation(); } d->m_engine->collectGarbage(); d->m_engine->pushContext(); // add document TrafficLightWidgetWrapper tlWrapper(tl, d->m_engine); d->registerGlobalObject(&tlWrapper, "trafficLight"); connect(&tlWrapper, &TrafficLightWidgetWrapper::message, this, &Kernel::processMessage); // set modules d->registerGlobalObject(&d->m_consoleModule,"Console"); // set evaluation //d->m_engine->setProcessEventsInterval(100); //! TODO: Make that changeable. //QScriptValue result = d->m_engine->evaluate(script).toString(); QtLua::ValueBase::List result = d->m_engine->evaluate(script); /*if (d->m_engine && d->m_engine->hasUncaughtException()) { emit message(result.toString(), WarningMessage); emit message(d->m_engine->uncaughtExceptionBacktrace().join("\n"), InfoMessage); }*/ if (d->m_engine) { emit message(tr("@info status message after successful script execution", "<i>Execution Finished</i>"), InfoMessage); emit message(script, InfoMessage); d->m_engine->abortEvaluation(); } // end processing messages disconnect(&tlWrapper, &TrafficLightWidgetWrapper::message, this, &Kernel::processMessage); emit executionFinished(); //d->m_engine->globalObject().setProperty("Document", QScriptValue()); return result; } void Kernel::stop(){ d->m_engine->abortEvaluation(); } void Kernel::processMessage(const QString &messageString, Kernel::MessageType type) { emit message(messageString, type); };
7f4f766972bc0483d33d060d3fd80fe2070d3af7
907f33a9223356c626f851da91e6b873e88bd7f8
/066_Plus One.cpp
bba058796443295f652d1ab72559ca66d9b0d71e
[]
no_license
wei-han/LeetCode
fb371722886b248f96fb42941f8f731f7b6e1175
39c3433061dc49a52fce7ca189dbf214e96f3a75
refs/heads/master
2023-08-30T10:03:52.313495
2023-08-30T00:42:38
2023-08-30T00:42:38
91,193,931
0
0
null
null
null
null
UTF-8
C++
false
false
1,205
cpp
066_Plus One.cpp
class Solution { public: vector<int> plusOne(vector<int>& digits) { for( int i = digits.size()-1; i >= 0; i--) { if(digits[i] == 9) { digits[i] = 0; } else { digits[i]++; return digits; } } digits[0] = 1; digits.push_back(0); return digits; } }; //a redundant recursive solution! class Solution { public: vector<int> plusOne(vector<int>& digits) { int len = digits.size(); plus(digits, len-1); if(digits[0]==10) { vector<int> ans(len+1,0); ans[0]=1; return ans; } return digits; } void plus(vector<int>& digits, int k) { if(digits[k] != 9) { digits[k]++; return; } else { if(k==0) { digits[k]=10; return; } digits[k] = 0; plus(digits, k-1); } } };
75746765cabb5b7c775fb0bdc8a1aaf0e660326d
7c9c7af877cfca219efd15e91cdc5e953cf2ea33
/source/platform/linux/high_frequency_timer.cpp
7043ea37bdf48fda5b5dac5b443050f8c1152f5a
[ "BSD-2-Clause" ]
permissive
ancapdev/crunch.base
b1152251ed1d968ebe486252494b4074176af141
19561a92ecfe973bae36eea1719d634e9cdd51e6
refs/heads/master
2021-01-02T22:45:46.234434
2013-11-09T21:45:53
2013-11-09T21:45:53
null
0
0
null
null
null
null
UTF-8
C++
false
false
761
cpp
high_frequency_timer.cpp
// Copyright (c) 2011, Christian Rorvik // Distributed under the Simplified BSD License (See accompanying file LICENSE.txt) #include "crunch/base/high_frequency_timer.hpp" namespace Crunch { HighFrequencyTimer::SampleType HighFrequencyTimer::Sample() const { timespec sample; clock_gettime(CLOCK_MONOTONIC, &sample); return sample; } Duration HighFrequencyTimer::GetElapsedTime(SampleType begin, SampleType end) const { return Duration::Seconds(difftime(end.tv_sec, begin.tv_sec)) + Duration::Nanoseconds(end.tv_nsec - begin.tv_nsec); } double HighFrequencyTimer::GetElapsedSeconds(SampleType begin, SampleType end) const { return difftime(end.tv_sec, begin.tv_sec) + (end.tv_nsec - begin.tv_nsec) / 1000000000.0; } }
2e896c9d23240bdf69abc629a0e3a9939b5a4e38
f6933897e64db13ce481c8e70e9e841d08c84ccd
/engine.h
3e7c57402abb8fb351a243f5b780659818984419
[]
no_license
iamsubhranil/Next
44a4605faa4dfac167e61e2218b4b28dffb616a2
51f46e73a982fb835d923a9f9f2126f2818df2cc
refs/heads/develop
2023-03-15T16:35:48.121821
2022-08-11T10:58:38
2022-08-11T10:58:38
219,454,282
8
1
null
2019-11-04T08:45:50
2019-11-04T08:39:33
null
UTF-8
C++
false
false
3,206
h
engine.h
#pragma once #include <cstdarg> #include <cstdint> #include "hashmap.h" #include "value.h" class ExecutionEngine { using ModuleMap = HashMap<Value, GcObject *>; static ModuleMap *loadedModules; // stack of unhandled exceptions static Array *pendingExceptions; // state of fibers when that exception occurred static Array *pendingFibers; static void formatExceptionMessage(const char *message, ...); // current fiber on execution static Fiber *currentFiber; // max recursion limit for execute() static std::size_t maxRecursionLimit; static std::size_t currentRecursionDepth; static void printRemainingExceptions(); // denotes whether or not repl is running static bool isRunningRepl; // exits if we're running a module directly, // otherwise throws a runtime_error to // denote an unhandled exception. // returns NULL always static Fiber *exitOrThrow(); public: static void mark(); static void init(); static bool isModuleRegistered(Value filename); static GcObject *getRegisteredModule(Value filename); static void setPendingException(Value v); // throwException will either return // the matching Fiber if found, // or call exit(1) from itself. static Fiber *throwException(Value v, Fiber *f); // print v, and print stack trace, and exit static void printException(Value v, Fiber *f); static void printStackTrace(Fiber *f); // all these methods return bool to denote whether // or not an exception occurred while executing the // given frame, and hence whether or not to continue // with the rest of the execution. // the engine assumes a new exception has occurred when // the number of exceptions generated before // executing the function is greater than // number of exceptions generated after. // registers and executes a module static bool registerModule(Value name, Function *defConstructor, Value *ret); // executes a bound method on v in current fiber static bool execute(Value v, Function *f, Value *args, int numargs, Value *ret, bool returnToCaller = false); static bool execute(Value v, Function *f, Value *ret, bool returnToCaller = false); // executes the boundmethod in current fiber static bool execute(BoundMethod *b, Value *ret, bool returnToCaller = false); // executes the boundmethod in the given fiber static bool execute(Fiber *f, BoundMethod *b, Value *ret, bool returnToCaller = false); // executes the fiber static bool execute(Fiber *f, Value *ret); // singleton instance of core static Object *CoreObject; static Fiber *getCurrentFiber() { return currentFiber; } static void setCurrentFiber(Fiber *f) { currentFiber = f; } static std::size_t getMaxRecursionLimit() { return maxRecursionLimit; } static void setMaxRecursionLimit(std::size_t n) { maxRecursionLimit = n; } static std::size_t getCurrentRecursionDepth() { return currentRecursionDepth; } // returns false if the hash extraction fails // if succeeds, assigns the pointer to the generated hash static bool getHash(const Value &v, Value *generatedHash); static void setRunningRepl(bool status); };
cfef7c17e8c538b397b7d47c2ad082fa82786287
3d7e2bc9489ca4e956f3be45e6001f6156f176f0
/CS-Classification/VS/Classifier-Tester/Classifier-Tester/Classifier-Tester.cpp
992d55ec11bd4014b07fd93c5693d36d151c5012
[]
no_license
waynegerard/cell-scope
bf23cef8b7de841af04dd9ad8f4d5f5b522aaff7
29b547a77014c58f407143d5ce0c4896bc0ce4b3
refs/heads/master
2021-01-21T20:50:08.232942
2013-08-09T04:46:31
2013-08-09T04:46:31
null
0
0
null
null
null
null
UTF-8
C++
false
false
453
cpp
Classifier-Tester.cpp
// Classifier-Tester-Win32.cpp : Defines the entry point for the console application. // #include "Classifier.h" #include "Globals.h" #include "MatrixOperations.h" int main(int argc, char *argv[]) { char* file = "C:\\Users\\Wayne\\Documents\\GitHub\\cell-scope\\CS-Classification\\Debug\\1350_Clay_Fluor_Yes.png"; cv::Mat image; image = cv::imread(file, CV_LOAD_IMAGE_GRAYSCALE); cv::Mat result = Classifier::runWithImage(image); return 0; }
ccd360eb888e405292e2e9b20aab12b79e706877
4401dbd29409413db141b5b0c71715064a3f5a1e
/SDL first/Main.cpp
8dea9d3fea004fea1b4b80033ebe1cffe9d1b8a8
[]
no_license
Miighn/SDL-first
ee88b4216c4a6712bcb90424eebea656906783fc
7078bce56263b8d40c91bb02db6be18d4536914b
refs/heads/master
2023-06-09T23:27:03.791383
2019-11-19T22:23:49
2019-11-19T22:23:49
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,189
cpp
Main.cpp
#include "Particle.h" #include "Screen.h" #include "Swarm.h" #include <SDL.h> #include <cmath> #include <cstdlib> #include <ctime> int main(int argc, char* argv[]) { std::srand(static_cast<unsigned int>(time(NULL))); particle::Screen screen; screen.init(); particle::Swarm swarm; while (true) { // draw particles int elapsed = SDL_GetTicks(); swarm.update(elapsed); unsigned char green = (unsigned char)((1 + sin(elapsed * 0.0001)) * 128); unsigned char red = (unsigned char)((1 + sin(elapsed * 0.0004)) * 128); unsigned char blue = (unsigned char)((1 + sin(elapsed * 0.0008)) * 128); const particle::Particle* const pParticles = swarm.getParticles(); for (int i = 0; i < particle::Swarm::NPARTICLES; i++) { particle::Particle particle = pParticles[i]; int x = (particle.m_x + 1) * particle::Screen::SCREEN_WIDTH / 2; int y = particle.m_y * particle::Screen::SCREEN_WIDTH / 2 + particle::Screen::SCREEN_HEIGHT / 2; screen.setPixel(x, y, red, green, blue); } screen.boxBlur(); // Draw the screen screen.update(); // Check for messages/events if (screen.processEvents() == false) { break; } } screen.close(); return 0; }
57956ea3f5a5c94ca49a3a5e1b543c5e8c56c49a
ad0f14241707604a3144f79422f008aa223df581
/src/EuropeanSwaptionContract.h
c5ff475786cc484e2b199f848a3e1f3e903ddea0
[]
no_license
jmptrader/FinancialLibrary
7f17e58c562b97fa74813d5782dd67d0d1308aab
b2c95879c4732bf5df08f4c1aca4ed3b302fa68d
refs/heads/master
2020-12-28T20:41:51.931044
2016-09-06T13:05:03
2016-09-06T13:05:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,131
h
EuropeanSwaptionContract.h
#ifndef ESWAPTIONCONTRACT_H_INCLUDED_ #define ESWAPTIONCONTRACT_H_INCLUDED_ #include "BaseContract.h" #include "SwaptionVolatility.h" #include <string> #include <vector> class EuropeanSwaptionContract : public BaseContract{ private: std::string m_effective_date; std::string m_currency; int m_receiver_or_payer; //0 == receiver, 1 == payer std::string m_option_maturity_date; std::string m_underlying_swap_start_date; double m_underlying_swap_notional_amount; double m_underlying_swap_contract_term; //1year = 1 double m_underlying_swap_payment_period; //6month = 0.5 double m_strike_swap_rate; int m_contract_info_set_flag; double Interpolate(double target_term, double pre_term, double post_term, double pre_value, double post_value); double Interpolate(int target_term, int pre_term, int post_term, double pre_value, double post_value); double interpolateRange(int targetGrid, int *gridArray, double *valueArray, int numOfArray); double InterpolateRange(int target_term, const std::vector<int> &term, const std::vector<double> &value); double CalcForwardRate(double startTermZR, int startTerm, double endTermZR, int endTerm); double CalcNormDistProbability(double x, double average, double variance); public: EuropeanSwaptionContract(); virtual ~EuropeanSwaptionContract(); void SetContractInfo( const std::string &effective_date, const std::string &currency, int receiver_or_payer, const std::string &option_maturity_date, const std::string &underlying_swap_start_date, double underlying_swap_notional_amount, double underlying_swap_contract_term, double underlying_swap_payment_period, double strike_swap_rate ); double CalcPV( const std::string &valuation_date, const std::vector<int> &floating_rate_term, const std::vector<double> &floating_rate_value, const std::vector<int> &discount_curve_term, const std::vector<double> &discount_curve_value, const std::vector<SwaptionVolatility> &volatility_set, int num_of_vol_strike_rate, int num_of_vol_underlying_term_grid, int num_of_vol_option_term_grid ); }; #endif
437ade2b569f248fe99d2051b17b3fa365b0cbe3
94b8bb1e41b1f6ed132ad1e85894113aa06f21c1
/src/hardware/display.cpp
7968d6b8bd74dcf7e3970417d4737f94d96e8d41
[]
no_license
EverlastEngineering/My-TTGO-Watch
7e488d22e86c9e7d59b1c6036fbc1c8cd18a94d1
f0ec9056753ed4cb970bf7a9b89fb9571fb26967
refs/heads/master
2022-11-19T18:16:45.529638
2020-07-21T14:17:16
2020-07-21T14:17:16
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,922
cpp
display.cpp
#include "config.h" #include <TTGO.h> #include "display.h" display_config_t display_config; /* * */ void display_setup( TTGOClass *ttgo ) { display_read_config(); ttgo->openBL(); ttgo->bl->adjust( 0 ); ttgo->tft->setRotation( display_config.rotation / 90 ); } /* * loop routine for handling IRQ in main loop */ void display_loop( TTGOClass *ttgo ) { } /* * */ void display_save_config( void ) { fs::File file = SPIFFS.open( DISPLAY_CONFIG_FILE, FILE_WRITE ); if ( !file ) { Serial.printf("Can't save file: %s\r\n", DISPLAY_CONFIG_FILE ); } else { file.write( (uint8_t *)&display_config, sizeof( display_config ) ); file.close(); } } /* * */ void display_read_config( void ) { fs::File file = SPIFFS.open( DISPLAY_CONFIG_FILE, FILE_READ ); if (!file) { Serial.printf("Can't open file: %s!\r\n", DISPLAY_CONFIG_FILE ); } else { int filesize = file.size(); if ( filesize > sizeof( display_config ) ) { Serial.printf("Failed to read configfile. Wrong filesize!\r\n" ); } else { file.read( (uint8_t *)&display_config, filesize ); } file.close(); } } uint32_t display_get_timeout( void ) { return( display_config.timeout ); } void display_set_timeout( uint32_t timeout ) { display_config.timeout = timeout; } uint32_t display_get_brightness( void ) { return( display_config.brightness ); } void display_set_brightness( uint32_t brightness ) { TTGOClass *ttgo = TTGOClass::getWatch(); display_config.brightness = brightness; ttgo->bl->adjust( brightness ); } uint32_t display_get_rotation( void ) { TTGOClass *ttgo = TTGOClass::getWatch(); return( display_config.rotation ); } void display_set_rotation( uint32_t rotation ) { TTGOClass *ttgo = TTGOClass::getWatch(); display_config.rotation = rotation; ttgo->tft->setRotation( rotation / 90 ); lv_obj_invalidate( lv_scr_act() ); }
19cb53643ba799c1dbd48bfb2d52865ce1d0d820
5012f1a7f9d746c117f04ff56f7ebe6d5fc9128f
/1.Server/2.Midware/KFPlugin/KFAttribute/KFAttributeModule.cpp
b6afd3a8cc3e52ac85d094e19ea74349538d9786
[ "Apache-2.0" ]
permissive
hw233/KFrame
c9badd576ab7c75f4e5aea2cfb3b20f6f102177f
a7e300c301225d0ba3241abcf81e871d8932f326
refs/heads/master
2023-05-11T07:50:30.349114
2019-01-25T08:20:11
2019-01-25T08:20:11
null
0
0
null
null
null
null
UTF-8
C++
false
false
10,945
cpp
KFAttributeModule.cpp
#include "KFAttributeModule.h" namespace KFrame { void KFAttributeModule::BeforeRun() { // 注册Debug函数 __REGISTER_DEBUG_FUNCTION__( __KF_STRING__( adddata ), &KFAttributeModule::DebugAddData ); __REGISTER_DEBUG_FUNCTION__( __KF_STRING__( setdata ), &KFAttributeModule::DebugSetData ); __REGISTER_DEBUG_FUNCTION__( __KF_STRING__( decdata ), &KFAttributeModule::DebugDecData ); _kf_player->BindAfterQueryFunction( this, &KFAttributeModule::OnAfterQueryPlayerData ); _kf_player->BindAfterSetNameFunction( this, &KFAttributeModule::OnAfterSetPlayerName ); //////////////////////////////////////////////////////////////////////////////////////////////////////// __REGISTER_MESSAGE__( KFMsg::MSG_QUERY_PLAYER_REQ, &KFAttributeModule::HandleQueryPlayerReq ); __REGISTER_MESSAGE__( KFMsg::MSG_SET_NAME_REQ, &KFAttributeModule::HandleSetNameReq ); __REGISTER_MESSAGE__( KFMsg::MSG_SET_SEX_REQ, &KFAttributeModule::HandleSetSexReq ); __REGISTER_MESSAGE__( KFMsg::MSG_CHANGE_ICON_REQ, &KFAttributeModule::HandleChangeIconReq ); __REGISTER_MESSAGE__( KFMsg::MSG_REMOVE_DATA_REQ, &KFAttributeModule::HandleRemoveDataReq ); __REGISTER_MESSAGE__( KFMsg::MSG_CHANGE_ICON_BOX_REQ, &KFAttributeModule::HandleChangeIconBoxReq ); __REGISTER_MESSAGE__( KFMsg::MSG_CHANGE_MOTTO_REQ, &KFAttributeModule::HandleChangeMottoReq ); __REGISTER_MESSAGE__( KFMsg::MSG_QUERY_SETTING_REQ, &KFAttributeModule::HandleQuerySettingReq ); __REGISTER_MESSAGE__( KFMsg::MSG_UPDATE_SETTING_REQ, &KFAttributeModule::HandleUpdateSettingReq ); __REGISTER_MESSAGE__( KFMsg::MSG_TITLE_CHANGE_REQ, &KFAttributeModule::HandleTitleChangeReq ); } void KFAttributeModule::BeforeShut() { // 取消注册debug函数 __UNREGISTER_DEBUG_FUNCTION__( __KF_STRING__( adddata ) ); __UNREGISTER_DEBUG_FUNCTION__( __KF_STRING__( setdata ) ); __UNREGISTER_DEBUG_FUNCTION__( __KF_STRING__( decdata ) ); _kf_player->UnBindAfterQueryFunction( this ); _kf_player->UnBindAfterSetNameFunction( this ); //////////////////////////////////////////////////////////////////////////////////////////////////////// __UNREGISTER_MESSAGE__( KFMsg::MSG_QUERY_PLAYER_REQ ); __UNREGISTER_MESSAGE__( KFMsg::MSG_SET_NAME_REQ ); __UNREGISTER_MESSAGE__( KFMsg::MSG_SET_SEX_REQ ); __UNREGISTER_MESSAGE__( KFMsg::MSG_CHANGE_ICON_REQ ); __UNREGISTER_MESSAGE__( KFMsg::MSG_REMOVE_DATA_REQ ); __UNREGISTER_MESSAGE__( KFMsg::MSG_CHANGE_ICON_BOX_REQ ); __UNREGISTER_MESSAGE__( KFMsg::MSG_CHANGE_MOTTO_REQ ); __UNREGISTER_MESSAGE__( KFMsg::MSG_QUERY_SETTING_REQ ); __UNREGISTER_MESSAGE__( KFMsg::MSG_UPDATE_SETTING_REQ ); __UNREGISTER_MESSAGE__( KFMsg::MSG_TITLE_CHANGE_REQ ); } //////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////// __KF_MESSAGE_FUNCTION__( KFAttributeModule::HandleQueryPlayerReq ) { __CLIENT_PROTO_PARSE__( KFMsg::MsgQueryPlayerReq ); // 不能查询自己的数据,客户端本地可以获取到 if ( playerid == kfmsg.playerid() ) { return; } //查询玩家数据 KFMsg::S2SQueryPlayerReq req; req.set_playerid( playerid ); auto ok = _kf_player->QueryPlayer( playerid, kfmsg.playerid() ); if ( !ok ) { _kf_display->SendToClient( player, KFMsg::RouteServerBusy ); } } void KFAttributeModule::OnAfterQueryPlayerData( uint32 result, uint64 playerid, KFMsg::PBObject* pbplayerdata ) { auto player = _kf_player->FindPlayer( playerid ); if ( player == nullptr ) { return; } if ( result != KFMsg::Ok ) { return _kf_display->SendToClient( playerid, result ); } KFMsg::MsgQueryPlayerAck ack; ack.mutable_player()->CopyFrom( *pbplayerdata ); _kf_game->SendToClient( player, KFMsg::MSG_QUERY_PLAYER_ACK, &ack ); } //////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////// uint32 KFAttributeModule::CheckNameValid( const std::string& name ) { static auto* _option = _kf_option->FindOption( __KF_STRING__( playernamelength ) ); if ( name.size() > _option->_uint32_value ) { return KFMsg::NameLengthError; } auto ok = _kf_filter->CheckFilter( name ); if ( ok ) { return KFMsg::NameFilterError; } return KFMsg::Ok; } __KF_MESSAGE_FUNCTION__( KFAttributeModule::HandleSetNameReq ) { __CLIENT_PROTO_PARSE__( KFMsg::MsgSetNameReq ); if ( kfmsg.name().empty() ) { return _kf_display->SendToClient( player, KFMsg::NameEmpty ); } auto kfobject = player->GetData(); auto name = kfobject->GetValue<std::string>( __KF_STRING__( basic ), __KF_STRING__( name ) ); if ( !name.empty() ) { return _kf_display->SendToClient( player, KFMsg::NameAlreadySet ); } // 检查名字的有效性 auto result = CheckNameValid( kfmsg.name() ); if ( result != KFMsg::Ok ) { return _kf_display->SendToClient( player, result ); } // 修改名字 auto ok = _kf_player->SetName( playerid, name, kfmsg.name(), _invalid_int ); if ( !ok ) { _kf_display->SendToClient( player, KFMsg::RouteServerBusy ); } } void KFAttributeModule::OnAfterSetPlayerName( uint32 result, KFEntity* player, const std::string& name, uint64 itemguid ) { _kf_display->SendToClient( player, result, name ); if ( result != KFMsg::NameSetOK ) { return; } if ( itemguid != _invalid_int ) { // 删除改名卡 player->RemoveData( __KF_STRING__( item ), itemguid ); } } //////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////// __KF_MESSAGE_FUNCTION__( KFAttributeModule::HandleSetSexReq ) { __CLIENT_PROTO_PARSE__( KFMsg::MsgChangeSexReq ); _kf_display->SendToClient( player, KFMsg::SexSetOK ); player->UpdateData( __KF_STRING__( basic ), __KF_STRING__( sex ), KFOperateEnum::Set, kfmsg.sex() ); } __KF_MESSAGE_FUNCTION__( KFAttributeModule::HandleChangeIconReq ) { __CLIENT_PROTO_PARSE__( KFMsg::MsgChangeIconReq ); _kf_display->SendToClient( player, KFMsg::ChangeIconOK ); player->UpdateData( __KF_STRING__( basic ), __KF_STRING__( icon ), kfmsg.icon() ); } __KF_MESSAGE_FUNCTION__( KFAttributeModule::HandleChangeMottoReq ) { __CLIENT_PROTO_PARSE__( KFMsg::MsgChangeMottoReq ); auto filter = _kf_filter->CheckFilter( kfmsg.motto() ); if ( filter ) { //return _kf_display->SendToClient( player, KFMsg::InvalidFilter ); } _kf_display->SendToClient( player, KFMsg::ChangeMottoOK ); player->UpdateData( __KF_STRING__( motto ), kfmsg.motto() ); } __KF_MESSAGE_FUNCTION__( KFAttributeModule::HandleRemoveDataReq ) { __CLIENT_PROTO_PARSE__( KFMsg::MsgRemoveDataReq ); player->UpdateData( kfmsg.dataname(), kfmsg.key(), __KF_STRING__( count ), KFOperateEnum::Dec, kfmsg.count() ); __LOG_INFO__( "remove data[{}:{}:{}] ok!", kfmsg.dataname(), kfmsg.key(), kfmsg.count() ); } __KF_MESSAGE_FUNCTION__( KFAttributeModule::HandleChangeIconBoxReq ) { __CLIENT_PROTO_PARSE__( KFMsg::MsgChangeIconBoxReq ); _kf_display->SendToClient( player, KFMsg::ChangeIconBoxOK ); player->UpdateData( __KF_STRING__( basic ), __KF_STRING__( iconbox ), kfmsg.iconbox() ); } __KF_MESSAGE_FUNCTION__( KFAttributeModule::HandleQuerySettingReq ) { __CLIENT_PROTO_PARSE__( KFMsg::MsgQuerySettingReq ); auto kfobject = player->GetData(); auto kfsetting = kfobject->FindData( __KF_STRING__( setting ) ); KFMsg::MsgQuerySettingAck ack; _kf_kernel->SerializeToData( kfsetting, ack.mutable_pbsetting() ); _kf_game->SendToClient( player, KFMsg::MSG_QUERY_SETTING_ACK, &ack ); } __KF_MESSAGE_FUNCTION__( KFAttributeModule::HandleUpdateSettingReq ) { __CLIENT_PROTO_PARSE__( KFMsg::MsgUpdateSettingReq ); if ( kfmsg.settingvalue().size() >= KFBufferEnum::Buff_1M ) { return; } auto kfobject = player->GetData(); auto kfsetting = kfobject->FindData( __KF_STRING__( setting ) ); player->UpdateData( kfsetting, kfmsg.settingkey(), kfmsg.settingvalue() ); } __KF_DEBUG_FUNCTION__( KFAttributeModule::DebugAddData ) { if ( params.size() < 1 ) { return; } auto& strdata = params[ 0 ]; KFElements kfelements; auto ok = kfelements.Parse( strdata, __FUNC_LINE__ ); if ( ok ) { player->AddElement( __FUNC_LINE__, &kfelements, true ); } } __KF_DEBUG_FUNCTION__( KFAttributeModule::DebugSetData ) { if ( params.size() < 1 ) { return; } auto& strdata = params[ 0 ]; KFElements kfelements; auto ok = kfelements.Parse( strdata, __FUNC_LINE__ ); if ( ok ) { kfelements.SetOperate( KFOperateEnum::Set ); player->AddElement( __FUNC_LINE__, &kfelements, true ); } } __KF_DEBUG_FUNCTION__( KFAttributeModule::DebugDecData ) { if ( params.size() < 1 ) { return; } auto& stragent = params[ 0 ]; KFElements kfelements; auto ok = kfelements.Parse( stragent, __FUNC_LINE__ ); if ( ok ) { player->RemoveElement( __FUNC_LINE__, &kfelements ); } } __KF_MESSAGE_FUNCTION__( KFAttributeModule::HandleTitleChangeReq ) { __CLIENT_PROTO_PARSE__( KFMsg::MsgTitleChangeReq ); auto kfobject = player->GetData(); auto kftitle = kfobject->FindData( __KF_STRING__( title ), kfmsg.titleid() ); if ( kftitle == nullptr ) { return _kf_display->SendToClient( player, KFMsg::TitleNotExist ); } player->UpdateData( __KF_STRING__( titleid ), KFOperateEnum::Set, kfmsg.titleid() ); } }
a7309ae32b484e247340ca0e0c82f480c50d988d
3d96817e2811228e3768d248b6f8c3ac0dc30d54
/glw/dev/zdev03/main.cpp
f9b88f543561d9ddeda26b2906833bc4228da3c4
[]
no_license
glw3d/_GLW3D
6300aadab094433bde9e3c50ac1b6e78a1b8b66b
2f94cc285c692f3e35d9782a534a78fed1527751
refs/heads/master
2020-04-17T18:24:11.170269
2019-01-21T13:57:16
2019-01-21T13:57:16
166,824,833
0
0
null
null
null
null
UTF-8
C++
false
false
3,336
cpp
main.cpp
/** Author: Mario J. Martin <dominonurbs$gmail.com> In some applications, we have to launch the render in another thread, so, we can watch the visualization while the main application is still running. */ #include <stdio.h> #include "context_glfw/context_glfw.h" #include "glw/gwmath.h" #include "glw/glw.h" int gl_hint = 32; /* This is the render loop */ void render_loop() { int status = 1; while (status > 0){ glfw_render(); } } int main() { /* Creates a window, but this is not created here, * but request a new instance that is opened in a different thread.*/ int wid = glfwWindow_open(); gwWindowContext* context = gw_getWindowContext( wid ); context->screen_width = 640; context->screen_height = 640; context->background_color = gwColorNavy; context->gl_version_hint = 11; /* The frame is used to especify the render area */ gwFrame* frame = gwFrame_create( wid ); frame->size_in_pixels1_relative0 = 0; frame->x0 = 0.1f; frame->y0 = 0.1f; frame->x1 = 0.9f; frame->y1 = 0.9f; frame->background_color = gwColorGray; /* The definition of the scene remains the same */ gwMesh* surface = gwShape_cube(); gwMesh* wireframe = gwWireframe_cube(); gwMesh* points = gwMesh_create(); surface->primary_color.a = 0; wireframe->primary_color.a = 255; points->vertex = surface->vertex; points->primary_color.a = 128; points->point_size = 16; /* Camera */ gwCamera* camera = gwCamera_create(); gwWindowContext_attachCamera( wid, camera ); gwCamera_behaviour_cad( camera ); /* To attach cameras to frames is only necesary if we call glfw_render() * to do all the render. * If we call gwCamera_render() use gwFrame_use() before the call */ gwFrame_addCamera( frame, camera ); /* Then, add the mesh objects to the camera */ gwCamera_addMesh( camera, points ); gwCamera_addMesh( camera, wireframe ); gwCamera_addMesh( camera, surface ); /* Because the context is not yet created, the shader is not loaded here, * but at the next render loop, instead */ int sh = gwShader_load ( wid, "../dev/zdev03", "shader_gl3.vsh", "shader_gl3.fsh" , nullptr, GW_POLYGON_FILL ); gwShader* shader = gw_getShader( wid, sh ); if (shader != nullptr){ shader->polygon = GW_POLYGON_FILL; shader->target = GW_TARGET_SCREEN; shader->ambient_light = gwColorWhite; shader->ambient_light.a = 60; /* Intensity of the ambient light */ shader->light_direction = { 1, 1, -1 }; } /* Assign the shader to the mesh * Several shaders can be added simultaneously: shader1 + shader2 + ... */ surface->shaders = sh; wireframe->shaders = sh; points->shaders = sh; /* The render_loop looks like: int status = 1; while (status > 0){ glfw_render(); } * Then call: gw_launch_thread( [](){ while (glfw_render() > 0); } ); */ /* In asyncronous mode, the render runs in a different thread * and we do not have direct control of the render loop. */ glfw_render_thread(); /* Then we halt the main thread execution or the program will exit */ printf( "Running... PRESS ENTER\n" ); getchar(); return 0; }
da826ff5d6d10c87e713f80189e3399f6e6a3ecd
cd030dd9810d5cca146729507ecd7e7453f4b7a4
/simpleTetris/main.cpp
e820c522536fdda028095208523023afb085f02d
[]
no_license
furaga/simpleTetris
c198a3c2757e18dcc731afa2711751d9de1187fb
03173adf51b4cbd3f3fd048d5e169fa038fd91f3
refs/heads/master
2021-01-10T20:57:36.560443
2012-04-30T18:37:44
2012-04-30T18:37:44
4,185,629
1
0
null
null
null
null
SHIFT_JIS
C++
false
false
16,336
cpp
main.cpp
#include "main.h" #include "Pad.h" Pad* pad; // Padクラスのインスタンスはこれに入れて使う int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR, int ) { ChangeWindowMode( WindowFlag ); if ( DxLib_Init() == -1 ){ return -1; } // FPS計測用の変数たち。 int NowTime, PrevTime; float* Time = new float[ ( int )FPS ]; int flame = 0; int IdealTime = 1000 / FPS; float fps = 60.f; PrevTime = GetNowCount(); // 現在時刻を入れる。 Initialize(); while ( ProcessMessage() != -1 ){ ClearDrawScreen(); // Padの生成または更新など if ( !Pad::instance() ){ Pad::create(); pad = Pad::instance(); } else { pad->update(); if ( pad->isTriggered( ESCAPE ) ){ SaveHighScore(); break; } } // ゲームの進行 static bool goPause = false; if ( pad->isTriggered( KEY_INPUT_SPACE ) ){ goPause = !goPause; PlaySoundMem( PauseSound, DX_PLAYTYPE_BACK ); } if ( goPause ){ DrawGame( fps ); DrawPause(); } else { UpdateGame(); DrawGame( fps ); } // FPSの計測・調整 NowTime = GetNowCount(); Time[ flame ] = ( NowTime - PrevTime ) * 0.001f; if ( flame == FPS - 1 ){ fps = 0; for ( int i = 0; i < FPS; i++ ){ fps += Time[ i ]; } fps = FPS / fps; } if ( NowTime - PrevTime < IdealTime ){ Sleep( ( int )( IdealTime - NowTime + PrevTime) ); } flame = ( flame + 1 ) % ( int )FPS; PrevTime = NowTime; // 裏画面を表画面に表示 ScreenFlip(); } // メモリの解放 SAFE_DELETE_ARRAY( Time ); Pad::destroy(); destroy(); // DXライブラリの終了処理。 DxLib_End(); return 0; } // いろいろ初期化 void Initialize(){ resetWithChangingWindow(); reset(); } void resetWithChangingWindow(){ SetMainWindowText( "tetris by furaga" ); SetDrawScreen( DX_SCREEN_BACK ); // フォント Pop = CreateFontToHandle( "HGP創英角ポップ体", 32, -1, DX_FONTTYPE_NORMAL ); Gothic = CreateFontToHandle( "HGP創英角ゴシックUB", 32, -1, DX_FONTTYPE_NORMAL ); Gothicb = CreateFontToHandle( "HGP創英角ゴシックUB", 112, -1, DX_FONTTYPE_NORMAL ); Gyosyo = CreateFontToHandle( "HGP行書体", 32, -1, DX_FONTTYPE_NORMAL ); Gyosyob = CreateFontToHandle( "HGP行書体", 96, -1, DX_FONTTYPE_NORMAL ); // サウンド LandSound = LoadSoundMem( LAND_SOUND ); MoveSound = LoadSoundMem( MOVE_SOUND ); // MoveSound = LoadSoundMem( ROT_SOUND ); RotSound = LoadSoundMem( ROT_SOUND ); DeleteSound = LoadSoundMem( DELETE_SOUND ); PauseSound = LoadSoundMem( PAUSE_SOUND ); GameOverSound1 = LoadSoundMem( GAMEOVER_SOUND1 ); GameOverSound2 = LoadSoundMem( GAMEOVER_SOUND2 ); bgm = LoadSoundMem( BGM ); ChangeVolumeSoundMem( 16, MoveSound ); // 画像 LoadDivGraph( BLOCK_IMAGE, 8, 1, 8, 20, 20, BlockImages ); BlockImages[ 8 ] = 0; BGImage = LoadGraph( BG_IMAGE ); } void reset(){ GameOverFlag = false; gocnt = 0; h = 1; for ( int i = 0; i < MaxDelete; i++ ){ DeleteLine[ i ] = -1; } DeleteFlag = -1; score = 0; GetHighScore(); NormalSpeed = 20; HighSpeed = 5; FallSpeed = NormalSpeed; level = 1; movecnt = 0; for ( int i = 0; i < height; i++ ){ for ( int j = 0; j < 10; j++ ){ map[ i ][ j ].exist = false; map[ i ][ j ].type = 8; } } for ( int i = 0; i < 4; i++ ){ for ( int j = 0; j < 4; j++ ){ CurBlocks[ i ][ j ].exist = false; CurBlocks[ i ][ j ].type = 8; } } NextBlocks[0][0].type = GetRand( 6 ); NextBlock(); } void destroy(){ } void GetHighScore(){ // DXライブラリはヘッダでstdio.hの方をインクルードしてるので、せっかくだしそっちを使う。 FILE *fp; if( ( fp = fopen( filename, "rb" ) ) == NULL ) { save_data.highscore = 0; return; } else { fread( &save_data, sizeof(save_data_t), 1, fp ) ; fclose( fp );//解放 save_data.highscore; } } void SaveHighScore(){ FILE *fp; if ( score > save_data.highscore ){ if( ( fp = fopen( filename, "wb" ) ) == NULL ) { return; } else { save_data.highscore = score; fwrite( &save_data, sizeof(save_data_t), 1, fp ) ; fclose( fp ); } } } void ResetHighScore(){ FILE *fp; if( ( fp = fopen( filename, "wb" ) ) == NULL ) { return; } else { save_data.highscore = 0; fwrite( &save_data, sizeof(save_data_t), 1, fp ) ; fclose( fp ); } } void NextBlock(){ CurBlocks[0][0].type = NextBlocks[0][0].type; CurBlocks[0][0].x = 3; CurBlocks[0][0].y = -4; for ( int i = 0; i < 4; i++ ){ for ( int j = 0; j < 4; j++ ){ CurBlocks[ i ][ j ].exist = BLOCKS[ CurBlocks[0][0].type ][ i ][ j ]; } } NextBlocks[0][0].type = GetRand( 6 ); for ( int i = 0; i < 4; i++ ){ for ( int j = 0; j < 4; j++ ){ NextBlocks[ i ][ j ].exist = BLOCKS[ NextBlocks[0][0].type ][ i ][ j ]; } } } void UpdateGame(){ // ゲームオーバー時 if ( GameOverFlag ){ UpdateGameOver(); static int WaitTime = 30; if ( pad->isTriggered() && WaitTime < 0 ){ if ( h < height ){ h = height; } else { WaitTime = 30; SaveHighScore(); reset(); } } else { WaitTime--; } return; } // F5でゲームをリセット if ( pad->isTriggered( KEY_INPUT_F5 ) ){ SaveHighScore(); reset(); } // F10でハイスコアをリセット if ( pad->isTriggered( KEY_INPUT_F12 ) ){ ResetHighScore(); GetHighScore(); } // F2で全画面 if ( pad->isTriggered( KEY_INPUT_F2 ) ){ WindowFlag = !WindowFlag; ChangeWindowMode( WindowFlag ); resetWithChangingWindow(); } //"Q"で音を消す。 if ( pad->isTriggered( KEY_INPUT_Q ) ){ isPlay = !isPlay; if ( isPlay ){ ChangeVolumeSoundMem( 16, LandSound ); ChangeVolumeSoundMem( 16, MoveSound ); ChangeVolumeSoundMem( 16, RotSound ); ChangeVolumeSoundMem( 16, DeleteSound ); ChangeVolumeSoundMem( 16, PauseSound ); ChangeVolumeSoundMem( 16, GameOverSound1 ); ChangeVolumeSoundMem( 16, GameOverSound2 ); ChangeVolumeSoundMem( 16, bgm ); } else { ChangeVolumeSoundMem( 0, LandSound ); ChangeVolumeSoundMem( 0, MoveSound ); ChangeVolumeSoundMem( 0, RotSound ); ChangeVolumeSoundMem( 0, DeleteSound ); ChangeVolumeSoundMem( 0, PauseSound ); ChangeVolumeSoundMem( 0, GameOverSound1 ); ChangeVolumeSoundMem( 0, GameOverSound2 ); ChangeVolumeSoundMem( 0, bgm ); } } bool next = false; if ( DeleteFlag < 0 ){ MoveBlocks(); if ( FallBlocks() ){ next = true; } if ( next ){ CheckGameOver(); UpdateMap(); DeleteMap(); NextBlock(); if ( DeleteFlag < 0 ){ PlaySoundMem( LandSound, DX_PLAYTYPE_BACK ); } } } else { DeleteMap(); } UpdateSpeed(); } void UpdateSpeed(){ if ( score < 300 ){ NormalSpeed = 20; HighSpeed = 5; level = 1; } else if ( score < 1000 ){ NormalSpeed = 15; HighSpeed = 5; level = 2; } else if ( score < 1500 ){ NormalSpeed = 12; HighSpeed = 4; level = 3; } else if ( score < 2000 ){ NormalSpeed = 8; HighSpeed = 3; level = 4; } else { NormalSpeed = 6; HighSpeed = 3; level = 5; } } bool MoveBlocks(){ if ( pad->isOn( LEFT ) && !movecnt ){ movecnt = MoveSpeed; CurBlocks[ 0 ][ 0 ].x--; for ( int j = 0; j < 4; j++ ){ for ( int i = 0; i < 4; i++ ){ int x = CurBlocks[ 0 ][ 0 ].x + i; int y = CurBlocks[ 0 ][ 0 ].y + j; if ( CurBlocks[ j ][ i ].exist && ( map[ y ][ x ].exist || x < 0 ) ){ movecnt = 0; CurBlocks[ 0 ][ 0 ].x++; return true; } } } PlaySoundMem( MoveSound, DX_PLAYTYPE_BACK ); } else if ( pad->isOn( RIGHT ) && !movecnt ){ movecnt = MoveSpeed; CurBlocks[ 0 ][ 0 ].x++; for ( int j = 0; j < 4; j++ ){ for ( int i = 0; i < 4; i++ ){ int x = CurBlocks[ 0 ][ 0 ].x + i; int y = CurBlocks[ 0 ][ 0 ].y + j; if ( CurBlocks[ j ][ i ].exist && ( map[ y ][ x ].exist || x >= width ) ){ movecnt = 0; CurBlocks[ 0 ][ 0 ].x--; return true; } } } PlaySoundMem( MoveSound, DX_PLAYTYPE_BACK ); } else if ( pad->isOn( UP ) && !movecnt ){ movecnt = MoveSpeed * 2; rotRight(); for ( int j = 0; j < 4; j++ ){ for ( int i = 0; i < 4; i++ ){ int x = CurBlocks[ 0 ][ 0 ].x + i; int y = CurBlocks[ 0 ][ 0 ].y + j; if ( CurBlocks[ j ][ i ].exist && ( map[ y ][ x ].exist || x < 0 || width <= x || y >= height ) ){ movecnt = 0; rotLeft(); return true; } } } PlaySoundMem( RotSound, DX_PLAYTYPE_BACK ); } if ( !pad->isOn( LEFT ) && !pad->isOn( RIGHT ) && !pad->isOn( UP ) ){ movecnt = 0; } else { if ( movecnt ) movecnt--; } return false; } void rotRight(){ bool tmp[ 4 ][ 4 ]; for ( int j = 0; j < 4; j++ ){ for ( int i = 0; i < 4; i++ ){ tmp[ j ][ i ] = CurBlocks[ 3 - i ][ j ].exist; } } for ( int j = 0; j < 4; j++ ){ for ( int i = 0; i < 4; i++ ){ CurBlocks[ j ][ i ].exist = tmp[ j ][ i ]; } } } void rotLeft(){ bool tmp[ 4 ][ 4 ]; for ( int j = 0; j < 4; j++ ){ for ( int i = 0; i < 4; i++ ){ tmp[ j ][ i ] = CurBlocks[ i ][ 3 - j ].exist; } } for ( int j = 0; j < 4; j++ ){ for ( int i = 0; i < 4; i++ ){ CurBlocks[ j ][ i ].exist = tmp[ j ][ i ]; } } } bool FallBlocks(){ static int cnt = 0; if ( cnt == 0 ){ if ( pad->isOn( DOWN ) ){ FallSpeed = HighSpeed; } else { FallSpeed = NormalSpeed; } } if ( cnt >= FallSpeed ){ cnt = 0; CurBlocks[ 0 ][ 0 ].y++; for ( int j = 0; j < 4; j++ ){ for ( int i = 0; i < 4; i++ ){ int x = CurBlocks[ 0 ][ 0 ].x + i; int y = CurBlocks[ 0 ][ 0 ].y + j; if ( y < 0 ) continue; if ( CurBlocks[ j ][ i ].exist && ( map[ y ][ x ].exist || y >= height ) ){ CurBlocks[ 0 ][ 0 ].y--; return true; } } } } else { cnt++; } return false; } void UpdateMap(){ for ( int j = 0; j < 4; j++ ){ for ( int i = 0; i < 4; i++ ){ int x = CurBlocks[ 0 ][ 0 ].x + i; int y = CurBlocks[ 0 ][ 0 ].y + j; if ( CurBlocks[ j ][ i ].exist && 0 <= i && i < width && 0 <= j && j < height ){ map[ y ][ x ].exist = true; map[ y ][ x ].type = CurBlocks[ 0 ][ 0 ].type; } } } } void DeleteMap(){ int cnt = 0 ; const int WaitTime = 20; if ( DeleteFlag < 0 ){ // 消せるかどうか調べる。 CheckDeleteMap( &cnt, WaitTime ); } else { if ( DeleteFlag > 0 ){ if ( DeleteFlag == WaitTime ){ PlaySoundMem( DeleteSound, DX_PLAYTYPE_BACK ); } ef_delete(); // エフェクト } else if ( DeleteFlag == 0 ){ DeleteLines(); // 行を消す } else { // 念のため DeleteFlag = -1; for ( int i = 0; i < MaxDelete; i++ ){ DeleteLine[ i ] = -1; } } DeleteFlag--; } // 点数の更新 switch( cnt ){ case 1: score += 10 * level; break; case 2: score += 30 * level; break; case 3: score += 60 * level; break; case 4: score += 100 * level; break; default: break; } } void CheckDeleteMap( int* cnt, const int WaitTime ){ for ( int j = height - 1; j >= 0; j-- ){ DeleteLine[ *cnt ] = j; for ( int i = 0; i < width; i++ ){ if ( !map[ j ][ i ].exist ){ DeleteLine[ *cnt ] = -1; break; } } if ( DeleteLine[ *cnt ] >= 0 ){ DeleteFlag = WaitTime; ( *cnt )++; } } } void ef_delete(){ for ( int n = MaxDelete - 1; n >= 0; n-- ){ int j = DeleteLine[ n ]; if ( j >= 0 ){ for ( int x = 0; x < width; x++ ){ map[ j ][ x ].type = 7; } } } } void DeleteLines(){ for ( int n = MaxDelete - 1; n >= 0; n-- ){ int j = DeleteLine[ n ]; if ( j >= 0 ){ for ( int y = j; y >= 1; y-- ){ for ( int x = 0; x < width; x++ ){ map[ y ][ x ].exist = map[ y - 1 ][ x ].exist; map[ y ][ x ].type = map[ y - 1 ][ x ].type; } } for ( int x = 0; x < width; x++ ){ map[ 0 ][ x ].exist = false; map[ 0 ][ x ].type = 8; } } } for ( int i = 0; i < MaxDelete; i++ ){ DeleteLine[ i ] = -1; } } void CheckGameOver(){ for ( int j = 0; j < 4; j++ ){ for ( int i = 0; i < 4; i++ ){ if ( CurBlocks[ j ][ i ].exist && CurBlocks[ 0 ][ 0 ].y + j < 0 ){ GameOverFlag = true; } } } } void DrawGame( float fps ){ DrawBG(); DrawMap(); DrawCurrentBlock(); DrawNextBlock(); DrawParam( fps ); if ( GameOverFlag ){ DrawGameOver(); } } void DrawBG(){ DrawExtendGraph( 0,0,640,480,BGImage,FALSE ); DrawBox( X0 + 5, Y0 + 5, X0 + StageWidth + 5, Y0 + StageHeight + 5, GetColor( 0,0,0 ), TRUE ); DrawBox( X0, Y0, X0 + StageWidth, Y0 + StageHeight,GetColor( 0,0,64 ), TRUE ); DrawString( 400, 60, "← / →  :移動", GetColor( 0, 0, 0 ) ); DrawString( 400, 90, "↑    :回転", GetColor( 0, 0, 0 ) ); DrawString( 400, 120, "↓    :高速落下", GetColor( 0, 0, 0 ) ); DrawString( 400, 150, "スペースキー:一時停止", GetColor( 0, 0, 0 ) ); DrawString( 400, 180, "F5キー  :やり直し", GetColor( 0, 0, 0 ) ); DrawStringToHandle( 400, 20, "制作者:フラガ", GetColor( 64, 64, 0 ), Gyosyo ); DrawStringToHandle( 280, 350, "テトリス", GetColor( 64, 64, 0 ), Gyosyob ); } void DrawMap(){ for ( int j = 0; j < height; j++ ){ for ( int i = 0; i < width; i++ ){ if ( map[ j ][ i ].exist ){ int x = X0 + i * BlockSize; int y = Y0 + j * BlockSize; DrawGraph( x, y, BlockImages[ map[ j ][ i ].type ], FALSE ); } } } } void DrawCurrentBlock(){ for ( int i = 0; i < 4; i++ ){ for ( int j = 0; j < 4; j++ ){ if ( CurBlocks[ i ][ j ].exist && 0 <= CurBlocks[ 0 ][ 0 ].x + j && CurBlocks[ 0 ][ 0 ].x + j < width && 0 <= CurBlocks[ 0 ][ 0 ].y + i && CurBlocks[ 0 ][ 0 ].y + i <= height ) { int x = X0 + ( CurBlocks[ 0 ][ 0 ].x + j ) * BlockSize; int y = Y0 + ( CurBlocks[ 0 ][ 0 ].y + i ) * BlockSize; DrawGraph( x, y, BlockImages[ CurBlocks[ 0 ][ 0 ].type ], FALSE ); } } } } void DrawNextBlock(){ int d = 10; DrawStringToHandle( 2 * X0 + 12 * BlockSize, Y0, "NEXT", GetColor( 0,0,0 ), Pop ); DrawBox( 2 * X0 + 12 * BlockSize + 5 - d, 2 * Y0 + 5 - d, 2 * X0 + 16 * BlockSize + 5 + d, 2 * Y0 + 4 * BlockSize + 5 + d, GetColor( 0,0,0 ), TRUE ); DrawBox( 2 * X0 + 12 * BlockSize - d, 2 * Y0 - d, 2 * X0 + 16 * BlockSize + d, 2 * Y0 + 4 * BlockSize + d, GetColor( 0,0,64 ), TRUE ); for ( int i = 0; i < 4; i++ ){ for ( int j = 0; j < 4; j++ ){ if ( NextBlocks[ i ][ j ].exist ){ int x = 2 * X0 + ( 12 + j ) * BlockSize; int y = 2 * Y0 + i * BlockSize; DrawGraph( x, y, BlockImages[ NextBlocks[ 0 ][ 0 ].type ], FALSE ); } } } } void DrawParam( float fps ){ // 得点の表示 DrawFormatStringToHandle( 280, 210, GetColor( 0,0,0 ), Pop, "HIGHSCORE" ); DrawFormatStringToHandle( 472, 210, GetColor( 0,0,0 ), Gothic, "%d", save_data.highscore ); DrawFormatStringToHandle( 280, 260, GetColor( 0,0,0 ), Pop, "SCORE" ); DrawFormatStringToHandle( 472, 260, score > save_data.highscore ? GetColor( 255,0,0 ) : GetColor( 0,0,0 ), Gothic, "%d", score ); DrawFormatStringToHandle( 280, 310, GetColor( 0,0,0 ), Pop, "LEVEL" ); DrawFormatStringToHandle( 472, 310, GetColor( 0,0,0 ), Gothic, "%d", level ); // FPSの表示 DrawFormatString( 550, 440, GetColor( 0,0,0 ), "FPS %3.1f", fps ); } bool PlayFlag = false; void UpdateGameOver(){ if ( h <= 1 && gocnt <= 0 ){ PlaySoundMem( GameOverSound1, DX_PLAYTYPE_BACK ); } if ( h >= height ){ PlayFlag = true; } if ( h < height && gocnt % 10 == 0 ){ h++; } for ( int i = 0; i < h; i++ ){ for ( int j = 0; j < width; j++ ){ map[ height - 1 - i ][ j ].type = 0; } } } void DrawGameOver(){ if ( h < height ){ int y = Y0 + StageHeight - BlockSize * ( h - 1 + ( gocnt % 10 ) / 10.0 ); DrawLine( X0, y, X0 + StageWidth, y, GetColor( 255,255,255 ) ); } else { if ( PlayFlag ){ PlayFlag = false; PlaySoundMem( GameOverSound2, DX_PLAYTYPE_BACK ); } SetDrawBlendMode( DX_BLENDMODE_ALPHA, 0x80 ); DrawBox( 0,140,640, 340, GetColor( 255,255,255 ), TRUE ); SetDrawBlendMode( DX_BLENDMODE_NOBLEND, 0 ); DrawStringToHandle( 64, 170, "GameOver", GetColor( 128,0,0 ), Gothicb ); DrawStringToHandle( 216, 295 + 3 * cosf( PHI_F * gocnt / FPS ),"Press Any Key", GetColor( 0,128,0 ), Pop ); if ( score > save_data.highscore ){ DrawStringToHandle( 400, 170, "HIGHSCORE!!", GetColor( 0,0,128 ), Pop ); } } gocnt = ( gocnt >= 2 * FPS ? 0 : gocnt + 1 ); } void DrawPause(){ SetDrawBlendMode( DX_BLENDMODE_ALPHA, 0x80 ); DrawBox( 0,0,640,480,GetColor(0,0,0),TRUE ); SetDrawBlendMode( DX_BLENDMODE_NOBLEND, 0 ); DrawStringToHandle( 176, 216, "Press Space Key", GetColor( 255,255,255 ), Pop ); }
92e096ef4d4ed4209770bf60c4d7345e60e54c14
ce3c566d591f34ca21ee7e60eb6a43da471c3b63
/A3/SceneNode.cpp
8c58e96af62771ea9816e4dfa64d016b8d12d692
[]
no_license
GanDing/CS-488
5f7090bc3924a1321f916b319fa29dfd6e09ba30
35c45ffca93a2779df2530ceb1024dd3710be561
refs/heads/master
2020-04-08T21:56:21.503310
2018-06-20T17:54:04
2018-06-20T17:54:04
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,102
cpp
SceneNode.cpp
#include "SceneNode.hpp" #include "GeometryNode.hpp" #include "cs488-framework/MathUtils.hpp" #include "cs488-framework/GlErrorCheck.hpp" #include <iostream> #include <sstream> using namespace std; #include <glm/glm.hpp> #include <glm/gtx/transform.hpp> #include <glm/gtx/io.hpp> #include <glm/gtc/type_ptr.hpp> using namespace glm; // Static class variable unsigned int SceneNode::nodeInstanceCount = 0; //--------------------------------------------------------------------------------------- SceneNode::SceneNode(const std::string& name) : m_name(name), m_nodeType(NodeType::SceneNode), trans(mat4()), parent_trans(mat4()), trackball_mat(mat4()), isSelected(false), parent(NULL), m_nodeId(nodeInstanceCount++) { } //--------------------------------------------------------------------------------------- // Deep copy SceneNode::SceneNode(const SceneNode & other) : m_nodeType(other.m_nodeType), m_name(other.m_name), trans(other.trans), invtrans(other.invtrans), parent_trans(other.parent_trans), trackball_mat(other.trackball_mat) { for(SceneNode * child : other.children) { this->children.push_front(new SceneNode(*child)); } } //--------------------------------------------------------------------------------------- SceneNode::~SceneNode() { for(SceneNode * child : children) { delete child; } } //--------------------------------------------------------------------------------------- void SceneNode::set_transform(const glm::mat4& m) { trans = m; invtrans = m; } //--------------------------------------------------------------------------------------- const glm::mat4& SceneNode::get_transform() const { return trans; } //--------------------------------------------------------------------------------------- const glm::mat4& SceneNode::get_inverse() const { return invtrans; } //--------------------------------------------------------------------------------------- void SceneNode::add_child(SceneNode* child) { child->parent = this; child->parent_trans = get_M(); children.push_back(child); } //--------------------------------------------------------------------------------------- void SceneNode::remove_child(SceneNode* child) { children.remove(child); } //--------------------------------------------------------------------------------------- void SceneNode::apply_effect_to_child() { for(SceneNode * child : children) { child->parent_trans = get_M(); child->apply_effect_to_child(); } } void SceneNode::reset_select() { isSelected = false; for (SceneNode * child : children) { child->reset_select(); } } SceneNode * SceneNode::find_node_by_id(unsigned int id) { if (id == m_nodeId) { if (parent->m_nodeType == NodeType::JointNode) { isSelected = !isSelected; return this; } return NULL; } for (SceneNode * child : children) { SceneNode * result = child->find_node_by_id(id); if( result ) { return result; } } return NULL; } glm::mat4 SceneNode::get_M(){ return parent_trans * trans * trackball_mat; } //--------------------------------------------------------------------------------------- void SceneNode::rotate(char axis, float angle) { vec3 rot_axis; switch (axis) { case 'x': rot_axis = vec3(1,0,0); break; case 'y': rot_axis = vec3(0,1,0); break; case 'z': rot_axis = vec3(0,0,1); break; default: break; } mat4 rot_matrix = glm::rotate(degreesToRadians(angle), rot_axis); trans = rot_matrix * trans; apply_effect_to_child(); } //--------------------------------------------------------------------------------------- void SceneNode::scale(const glm::vec3 & amount) { trans = glm::scale(amount) * trans; apply_effect_to_child(); } //--------------------------------------------------------------------------------------- void SceneNode::translate(const glm::vec3& amount) { trans = glm::translate(amount) * trans; apply_effect_to_child(); } //--------------------------------------------------------------------------------------- int SceneNode::totalSceneNodes() const { return nodeInstanceCount; } //--------------------------------------------------------------------------------------- std::ostream & operator << (std::ostream & os, const SceneNode & node) { //os << "SceneNode:[NodeType: ___, name: ____, id: ____, isSelected: ____, transform: ____" switch (node.m_nodeType) { case NodeType::SceneNode: os << "SceneNode"; break; case NodeType::GeometryNode: os << "GeometryNode"; break; case NodeType::JointNode: os << "JointNode"; break; } os << ":["; os << "name:" << node.m_name << ", "; os << "id:" << node.m_nodeId; os << "]"; return os; } void SceneNode::render( ShaderProgram & shader, glm::mat4 & view, BatchInfoMap & batchInfoMap, const bool isPicking ) { if (m_nodeType == NodeType::GeometryNode) { GeometryNode * geometryNode = static_cast<GeometryNode *>(this); geometryNode->geometryNodeRender(shader, view, batchInfoMap, isPicking); } for (SceneNode * child : children) { child->render(shader, view, batchInfoMap, isPicking); } }
7e0acd81fd8e013bec542dca2e38fb8ebc5542b3
341d64e5dda1bfc5fb334c24de8543013ba7a117
/src/IRT/register_allocation/InterferentGraphBuilder.cpp
a6b1315ae4df596ebef89c4167aeec46331788d5
[]
no_license
Izeren/mini-java-compilator
a89a163e9fa98222bc71cc3744ad3b3da7f48005
c79cb166ecb3847cb61d43a4c292a07f4c119e84
refs/heads/develop
2020-12-02T00:25:18.831365
2017-05-14T18:53:28
2017-05-14T18:53:28
67,932,132
2
1
null
2016-12-14T21:43:12
2016-09-11T13:44:47
C++
UTF-8
C++
false
false
3,807
cpp
InterferentGraphBuilder.cpp
#include <cassert> #include "InterferentGraphBuilder.h" #include "../utils/Frame.h" #include "IgnoreList.h" #include <algorithm> bool isInDynamicIgnoreList(std::string temp, std::vector<std::string>& ignoreList) { return std::find(ignoreList.begin(), ignoreList.end(), temp) != ignoreList.end(); } void AssemblyCode::addOrientedEdge(std::string from, std::string to, std::map<std::string, std::set<std::string>>& graph) { if (graph.find(from) == graph.end()) { graph[from] = std::set<std::string>(); } graph[from].insert(to); } void AssemblyCode::addNotOrientedEdge(std::string a, std::string b, std::map<std::string, std::set<std::string>>& graph) { assert(a != b); addOrientedEdge(a, b, graph); addOrientedEdge(b, a, graph); } void addEdgesFromMoveLine(AssemblyCode::CodeLine& line, std::map<std::string, std::set<std::string>>& graph, std::vector<std::string>& ignoreList) { AssemblyCode::MoveRegRegCommand* moveRegRegCommand = dynamic_cast<AssemblyCode::MoveRegRegCommand*>(line.command.get()); std::string target = moveRegRegCommand->getTarget(); std::string source = moveRegRegCommand->getSource(); for (auto outTemp : line.liveOutTemps) { if (outTemp == source) { continue; } if (!isInIgnoreList(outTemp) && !isInIgnoreList(target) && !isInDynamicIgnoreList(outTemp, ignoreList) && !isInDynamicIgnoreList(target, ignoreList) && target != outTemp) { AssemblyCode::addNotOrientedEdge( target, outTemp, graph ); } } } void addEdgesFromNotMoveLine(AssemblyCode::CodeLine& line, std::map<std::string, std::set<std::string>>& graph, std::vector<std::string>& ignoreList) { for (auto defTemp : line.command->GetOut()) { for (auto outTemp : line.liveOutTemps) { if (defTemp.ToString() != outTemp) { std::string def = defTemp.ToString( ); std::string out = outTemp; if ( !isInIgnoreList( def ) && !isInIgnoreList( out ) && !isInDynamicIgnoreList(def, ignoreList) && !isInDynamicIgnoreList(out, ignoreList)) { AssemblyCode::addNotOrientedEdge( def, out, graph ); } } } } } void processLine(AssemblyCode::CodeLine& line, std::map<std::string, std::set<std::string>>& graph, std::vector<std::string>& ignoreList) { if (line.isMoveRegReg) { addEdgesFromMoveLine(line, graph, ignoreList); } else { addEdgesFromNotMoveLine(line, graph, ignoreList); } } void addVertices(std::vector<AssemblyCode::CodeLine>& lines, std::map<std::string, std::set<std::string>>& g, std::vector<std::string>& ignoreList) { for (auto line : lines) { for (auto temp : line.command->GetIn()) { std::string t = temp.ToString(); if (!isInIgnoreList(t) && !isInDynamicIgnoreList(t, ignoreList)) { g[t] = std::set<std::string>( ); } } for (auto temp : line.command->GetOut()) { std::string t = temp.ToString(); if (!isInIgnoreList(t) && !isInDynamicIgnoreList(t, ignoreList)) { g[t] = std::set<std::string>( ); } } } } std::map<std::string, std::set<std::string>> AssemblyCode::buildInterferentGraph(std::vector<AssemblyCode::CodeLine>& lines, std::vector<std::string>& ignoreList) { std::map<std::string, std::set<std::string>> graph; addVertices(lines, graph, ignoreList); for (auto line : lines) { processLine(line, graph, ignoreList); } return graph; };
fcce071fbfb85a73185e238a47fc2be6f67bc9a9
cdeccfe63cedee76f87e8bd9d45d866ca1a90563
/include/minecraft/actor/BaseAttributeMap.h
59fdc4b10def7c3a52a1008f46892f4c4af7c605
[ "MIT" ]
permissive
mclauncherlinux/bdlauncher
d6cfc7b1e7f7c90b7319087f2832b98360536536
9d7482786ba8be1e06fc7c81b448c5862e970870
refs/heads/master
2020-09-20T23:46:13.569316
2019-11-27T05:18:31
2019-11-27T05:18:31
224,619,858
1
0
MIT
2019-11-28T09:43:01
2019-11-28T09:43:00
null
UTF-8
C++
false
false
1,399
h
BaseAttributeMap.h
#pragma once #include "AttributeInstance.h" #include <memory> #include <unordered_map> #include <vector> class AttributeInstanceHandle; class AttributeModifier; class BaseAttributeMap { public: std::unordered_map<std::string, AttributeInstance> att_map; // 0 std::vector<AttributeInstanceHandle> dirtyAttributes; // 56 static AttributeInstance mInvalidInstance; AttributeInstance &registerAttribute(Attribute const &); void addAttributeModifier(std::string const &, std::shared_ptr<AttributeModifier>); void removeAttributeModifier(std::string const &, std::shared_ptr<AttributeModifier>); void clearDirtyAttributes(); std::vector<AttributeInstanceHandle> &getDirtyAttributes(); AttributeInstance const &getInstance(Attribute const &) const; AttributeInstance const &getInstance(std::string const &) const; AttributeInstance &getMutableInstance(Attribute const &); AttributeInstance &getMutableInstance(std::string const &); std::vector<AttributeInstanceHandle> getSyncableAttributes() const; void onAttributeModified(AttributeInstance const &); std::unordered_map<std::string, AttributeInstance>::iterator begin(); std::unordered_map<std::string, AttributeInstance>::const_iterator begin() const; std::unordered_map<std::string, AttributeInstance>::iterator end(); std::unordered_map<std::string, AttributeInstance>::const_iterator end() const; };
8221ca5a198ec8f79806cc84133f91f218c3f04c
7b4a0a266f8488f2b2596d95e6f5c985c8f232b9
/18/05.18/10.05.18/429B.cpp
0d406f24d9f7223f5c386f14649cde4eeeaf453a
[]
no_license
shishirkumar1996/cp
811d8607d5f460fcec445db9af4853c550aee685
e89cb840e5b3fd91be4b9402a6fdcb20bb3466c6
refs/heads/master
2020-03-10T11:06:17.696405
2019-01-04T07:12:45
2019-01-04T07:12:45
129,348,767
0
0
null
null
null
null
UTF-8
C++
false
false
1,222
cpp
429B.cpp
#include<bits/stdc++.h> #define faster ios::sync_with_stdio(false);cin.tie(0); #define lld long long int #define vi vector< lld > #define vii vector< vi > using namespace std; int main(){ faster int n,m; cin>>n>>m; lld input[n+2][m+2],dp1[n+2][m+2],dp2[n+2][m+2],dp3[n+2][m+2],dp4[n+2][m+2]; memset(input,0,sizeof(input)); memset(dp1,0,sizeof(dp1)); memset(dp2,0,sizeof(dp2)); memset(dp3,0,sizeof(dp3)); memset(dp4,0,sizeof(dp4)); for(int i =1;i<=n;i++) for(int j = 1;j<=m;j++) cin>>input[i][j]; for(int i = 1;i<=n;i++) for(int j = 1;j<= m;j++) dp1[i][j] = input[i][j]+max(dp1[i-1][j],dp1[i][j-1]); for(int i=n;i>=1;i--) for(int j=m;j>=1;j--) dp2[i][j] = input[i][j] + max(dp2[i+1][j],dp2[i][j+1]); for(int i= n;i>=1;i--) for(int j = 1;j<=m;j++) dp3[i][j] = input[i][j]+max(dp3[i+1][j],dp3[i][j-1]); for(int i= 1;i<=n;i++) for(int j = m;j>=0;j--) dp4[i][j] = input[i][j]+max(dp4[i-1][j],dp4[i][j+1]); lld ans = 0; for(int i = 2;i<n;i++) for(int j = 2;j<m;j++) ans = max(ans,max(dp1[i-1][j]+dp2[i+1][j]+dp3[i][j-1]+dp4[i][j+1],dp1[i][j-1]+dp2[i][j+1]+dp3[i+1][j]+dp4[i-1][j])); cout<<ans<<endl; }
2ca72d1f936ee41402392bec5593129941091aad
dbcaaad293a6c0958f6d4c9f045c80f00258f003
/Operator Overloading (Ch 11)/Operator Overloading (Ch 11)/Main.cpp
303838664351b82263185779800a27a9d128aa34
[]
no_license
dwatherton/Programming-II
41c12be3c9a8416153656a9a40ff4744c7bbbfd9
fb19ddabd24872a572cc341341d69a8fe4102da8
refs/heads/master
2021-09-22T01:26:41.354944
2018-09-03T23:48:29
2018-09-03T23:48:29
147,263,907
1
0
null
null
null
null
UTF-8
C++
false
false
704
cpp
Main.cpp
#include"Car.h" //Global Variables const int SIZE = 100; //Function Declarations int main() { //Local Variables Car cars[SIZE]; Car *cars[SIZE]; Car car1("Honda", "Accord", 2015, 30000.00); Car car2("Toyota", "Camry", 2013, 20000.00 ); //Code cars[0] = new Car(" ", " ", 2000, 3000); cout << "Car 1: " << endl; car1.print(); cout << endl; cout << "Car 2: " << endl; car2.print(); car1 = car2; cout << endl; cout << "Car1: " << endl; cout << car1 + car2 << endl << endl; car1.print(); if (car1 == car2) { cout << "Both cars have same year!" << endl; } else { cout << "Both cars do NOT have the same year!" << endl; } system("pause"); return 0; } //Function Definitions
ffb5b5a9f9fe050f0b9c504d4e7e79a8066314f8
5cb229062fce0aacee7c0bf988f4e0ff96a6aafe
/rp2040_examples/src/blink.cpp
ba796102ab61ebdae1561fb142b3c4d4926c7048
[ "BSD-3-Clause" ]
permissive
el-bart/soft_playground
7d80b2175827b5cb0ddb33a5b50d66678ad4f4c9
d0c151640400f082d0abe4072f3f3738d3671977
refs/heads/master
2023-09-01T20:10:02.082880
2023-08-17T20:14:57
2023-08-17T20:14:57
17,799,100
0
0
null
null
null
null
UTF-8
C++
false
false
299
cpp
blink.cpp
#include "pico/stdlib.h" int main() { const uint LED_PIN = PICO_DEFAULT_LED_PIN; gpio_init(LED_PIN); gpio_set_dir(LED_PIN, GPIO_OUT); do { constexpr auto delay = 100; gpio_put(LED_PIN, 1); sleep_ms(delay); gpio_put(LED_PIN, 0); sleep_ms(delay); } while (true); }
d802130c6b2939f5b0e8bb402cd3a4c1b27d85e4
ea5df613c2d16cb46a2de71fee95d47f2c72cfaa
/LeetCode/Largest Multiple Of 3.cpp
10d892f18debebada02ee4d890d082d920fbb428
[]
no_license
gagandeepahuja09/Greedy-Algorithm
f7075edb051d534a01e374b8c640f9e6027d87fd
2956ce9235bae16d7d192899d15610d5ceba17ba
refs/heads/master
2021-06-24T13:54:39.184186
2020-12-06T07:11:09
2020-12-06T07:11:09
177,094,139
1
0
null
null
null
null
UTF-8
C++
false
false
922
cpp
Largest Multiple Of 3.cpp
class Solution { public: string largestMultipleOfThree(vector<int>& dig) { vector<vector<int>> d(3); int sum = 0; sort(dig.begin(), dig.end(), greater<int>()); for(int i = 0; i < dig.size(); i++) { d[dig[i] % 3].push_back(dig[i]); sum = (sum + dig[i]) % 3; } if(sum) { if(!d[sum].size()) { if(d[3 - sum].size() < 2) return ""; d[3 - sum].pop_back(); d[3 - sum].pop_back(); } else { d[sum].pop_back(); } } string ret; for(int i = 0; i < 3; i++) { for(auto a : d[i]) { ret += (a + '0'); } } sort(ret.begin(), ret.end(), greater<int>()); if(ret.size() && ret[0] == '0') return "0"; return ret; } };
9016dbda4fd54d9834d0ac8ebbae9759116556c1
e9f99b2fa0c8ad4900cd5126cefdc8ffb78c5e03
/BtcEur/mainwindow.cpp
33b405d379d9204a3bc0e7d9c8a5ee6f220f9ead
[]
no_license
dbarbat/TiCare
6bb434812a1ce9bc19fc2dc2c92cf8a5fc957efa
59658aca69c5bfa77bf60b29df1327479e69c2ed
refs/heads/master
2021-05-06T07:22:08.596585
2017-12-11T22:52:44
2017-12-11T22:52:44
113,861,836
0
1
null
null
null
null
UTF-8
C++
false
false
2,637
cpp
mainwindow.cpp
#include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); auto edit_list = {ui->high, ui->last,ui->timestamp,ui->bid, ui->vwap,ui->volume,ui->low,ui->ask,ui->open}; for(auto line_edit : edit_list) { line_edit->setReadOnly(true); line_edit->setText("Loading in 10 seconds..."); } network_Manager = new QNetworkAccessManager(this); connect(network_Manager, &QNetworkAccessManager::finished, this, &MainWindow::onNetworkManagerFinished); timer=new QTimer(this); connect(timer, &QTimer::timeout, this, &MainWindow::onTimeOut ); timer->start(10000); } MainWindow::~MainWindow() { delete ui; } void MainWindow::onNetworkManagerFinished(QNetworkReply *reply) { if(reply->error() != QNetworkReply::NoError){ ui->high->setText("Error"); ui->last->setText("Error"); ui->timestamp->setText("Error"); ui->bid->setText("Error"); ui->vwap->setText("Error"); ui->volume->setText("Error"); ui->low->setText("Error"); ui->ask->setText("Error"); ui->open->setText("Error"); network_Manager->clearAccessCache(); } else { //Parsing reply JSON QJsonObject jsonObject= QJsonDocument::fromJson(reply->readAll()).object(); ui->high->setText(jsonObject["high"].toString()); ui->last->setText(jsonObject["last"].toString()); ui->timestamp->setText(jsonObject["timestamp"].toString()); ui->bid->setText(jsonObject["bid"].toString()); ui->vwap->setText(jsonObject["vwap"].toString()); ui->volume->setText(jsonObject["volume"].toString()); ui->low->setText(jsonObject["low"].toString()); ui->ask->setText(jsonObject["ask"].toString()); ui->open->setText(jsonObject["open"].toString()); } reply->deleteLater(); } void MainWindow::onTimeOut() { QUrlQuery query; query.addQueryItem("amount", "1"); query.addQueryItem("region", "United States"); QUrl url("https://www.bitstamp.net/api/v2/ticker/btceur/"); url.setQuery(query); QNetworkRequest networkRequest(url); network_Manager->get(networkRequest); ui->high->setText("Loading. . ."); ui->last->setText("Loading. . ."); ui->timestamp->setText("Loading. . ."); ui->bid->setText("Loading. . ."); ui->vwap->setText("Loading. . ."); ui->volume->setText("Loading. . ."); ui->low->setText("Loading. . ."); ui->ask->setText("Loading. . ."); ui->open->setText("Loading. . ."); }