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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
58dcb09a7297effb89c9b48cae9edb6233ca61ad | b93cda7e5d90fb5a84c24603619671c1767ba3dc | /pku/1026/2278549_AC_281MS_188K.cpp | bc67102170c043fe2116f4f23250c8045a9893c0 | [] | no_license | denofiend/acm | e7008ff49bf6bea0042dabf94bbae05ebc28fe8a | 409910ca43c888c0e2734699f982ff67b6613699 | refs/heads/master | 2022-11-23T14:51:02.445949 | 2020-07-31T11:42:24 | 2020-07-31T11:42:24 | 284,022,401 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 961 | cpp | 2278549_AC_281MS_188K.cpp | #include <stdio.h>
int main(){
int n , k , pos[201] ;
while( scanf( "%d" , & n ) && n != 0 )
{
for( int i = 1 ; i <= n ; i ++ )
scanf( "%d" , & pos[i] ) ;
char * cp = new char[ n + 1 ] ;
char * res = new char[ n + 1 ] ;
while( scanf( "%d" , & k ) && k != 0 )
{
for( int j = 0 ; j < n ; j ++ )
cp[j] = res[j] = ' ' ;
char c ;
int j1 = 1 ;
scanf("%c" , & c ) ;
while( scanf("%c" , & c ) && c != '\n' )
{
cp[j1] = c ;
j1 ++ ;
}
while( j1 <= n )
{
cp[j1] = ' ' ;
j1 ++ ;
}
int k1 = k ;
for( int i1 = 1 ; i1 <= n ; i1 ++ )
{
int num = 1 , pos1 = i1 ;
while( pos[ pos1 ] != i1 )
{
num ++ ;
pos1 = pos[ pos1 ] ;
}
k1 = k ;
k1 %= num ;
pos1 = i1 ;
while( k1 --)
pos1 = pos[ pos1 ] ;
res[pos1] = cp[i1] ;
}
for( int i3 = 1 ; i3 <= n ; i3 ++ )
printf( "%c" , res[i3] ) ;
printf( "\n" ) ;
}
printf( "\n" ) ;
}
return 0 ;
} |
c979cbbceb93fdd46956b83088049dd6cdb2da05 | 7a8fe8f993a36b6fe5512558e67c6fc717a85f24 | /psnr.cpp | c0860dfe7b1821be59c0b3ae629b9e3eba923aa9 | [] | no_license | highwy/GaoGuangPu | fafaf79612e732d9e313a3408592be533785eed0 | 82b91670c1ee87d2350d7b2dd7a4246c3cdf59b0 | refs/heads/main | 2023-03-17T05:05:10.578509 | 2020-10-05T05:23:18 | 2020-10-05T05:23:18 | null | 0 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 659 | cpp | psnr.cpp | #include "psnr.h"
#include "Windows.h"
#include "stdio.h"
#include "math.h"
double caculate(rBYTE* image1, rBYTE* image2) {
double mse = 0.0;
double temp = 0.0;
for (int i = 0; i < 512 * 680 * 224; i++)
{
//temp = temp + (image1[i] - image2[i])*(image1[i] - image2[i]);
temp = temp + pow(image1[i] - image2[i], 2);
}
printf("temp=%lf\n", temp);
mse = (double)(temp / (512 * 680 * 224)); //ยพรนยทยฝยฒรฎ
double t;
t = (double)(65535.0 * 65535.0 / mse); //(2^(n)-1)^2/mse //65535.0*65535.0
double psnr;
psnr = 10 * log10(t);
printf("psnr=%lf\n", psnr);
return psnr;
}
|
ff2c67c3fac1dfb0d4cae878e62190035725043e | e7ba008314a1b02a89915ab339a62467d355ba50 | /04-Collision/Skeleton.h | 684c34bc81041fce416a983ba5285f7e75b3d53d | [] | no_license | caoluyennguyen/Castlevania-Game | a957d85e6a2fbe871b27a47e23edf870fa6c09cc | 43be3630b9cbf396f76f5515fc1793eb8ae79eee | refs/heads/master | 2021-03-24T02:30:48.303294 | 2020-10-04T08:12:12 | 2020-10-04T08:12:12 | 247,507,273 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 774 | h | Skeleton.h | #pragma once
#include "GameObject.h"
#include "Weapon.h"
#define SKELETON_BBOX_WIDTH 32
#define SKELETON_BBOX_HEIGHT 64
#define SKELETON_STATE_IDLE 0
#define SKELETON_STATE_WALK 1
#define SKELETON_STATE_DIE 2
#define SKELETON_THROW_BONE_DELAY 2000
class Skeleton : public CGameObject
{
int move = 1;
bool isWaiting;
DWORD waiting;
public:
Weapon* weapon;
bool isAbleToThrowBone;
Skeleton(int nx);
virtual void Update(DWORD dt, vector<LPGAMEOBJECT>* colliable_objects = NULL);
virtual void Render();
virtual void GetBoundingBox(float& left, float& top, float& right, float& bottom);
virtual void GetActiveBoundingBox(float& left, float& top, float& right, float& bottom);
void SetState(int state);
void StartWaiting() { this->waiting = GetTickCount(); }
};
|
bdbe82ae0c456a927ffd46df4759c8f85e47faf0 | 7fa7330c8279b22db538c27a027cf40efad1092f | /ExeParser.h | a27efc32ac2975a1e01fcb1482df54f0cb60bc69 | [] | no_license | andrewrk/Secure-WordVault | 1483626ffe622c7f98865daac4fa9fd6e3dd4c88 | 408de2c1ec7e119d253336c5ebd07f4a60793d7f | refs/heads/master | 2023-03-13T07:13:14.609768 | 2010-04-29T00:12:55 | 2010-04-29T00:18:06 | 605,539 | 2 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 559 | h | ExeParser.h | #ifndef EXEPARSER_H
#define EXEPARSER_H
#include <QFile>
class ExeParser
{
public:
// get the document out of an EXE. size of 0 means no document
static QByteArray read(QString exeFile);
// (over)write a document into an EXE.
static void write(QString exeFile, QByteArray document);
// copy an exe file, leaving the document behind
static void copyOnlyExe(QString exeFileSource, QString exeFileDest);
private:
static void parse(QFile & openFile, qint64 & contentStart, qint64 & contentEnd);
};
#endif
|
d20b00841a49435865452eedc2d7324793ce2041 | 3281ea28e8646b1776c0b4f0b73d0af4d7aa5d70 | /as2/part1/pic_viewer.h | 1485289a58ccc7ab6eb42ada708e54cbc3b6a014 | [] | no_license | lernerc/3770 | 64745540e028761b463b594a833e736a2b8c7941 | a4e1e2fc59fa373ef436f47b647d787008304a82 | refs/heads/master | 2021-01-01T06:05:36.102797 | 2014-04-04T04:25:27 | 2014-04-04T04:25:27 | 16,365,821 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 836 | h | pic_viewer.h | //*****************************************************************************
// Name: Camara Lerner
// SN: 001150339
// Class: CPSC 3770
// The header for PicViewer for assignment # 2 part 1
//*****************************************************************************
#ifndef PIC_VIEWER_H
#define PIC_VIEWER_H
#include <QWidget>
class QImage;
class QMouseEvent;
class QPaintEvent;
class QSizeF;
class QPointF;
class PicViewer : public QWidget {
Q_OBJECT
public:
PicViewer(QWidget *parent = 0);
void loadPic(const QString &name);
protected:
virtual void mouseReleaseEvent(QMouseEvent *event);
virtual void mouseMoveEvent(QMouseEvent *event);
virtual void paintEvent(QPaintEvent *event);
private:
QImage image;
QRectF target, source;
int mode;
QPoint move, cursor, drawHere;
};
#endif
|
fe821840045fb89605bee2e391a867f872132fa5 | 0af6a4592d013e4b563e25a58f62f4cf77a74a2c | /adrenosdk-linux/Development/Tools/FbxModelConverter/FilmboxManager.h | 2afffe75dc06b30577172b3ac1a0e54ce7b2f106 | [] | no_license | sunzhiyuan/opencl | b03f8deb4034f254245d6d40b6cd06acbb89d1bd | 9e0e9a46b4ec1e336eecd4f4d167f69e04b26dbc | refs/heads/master | 2016-09-10T02:08:07.636786 | 2014-12-12T05:12:39 | 2014-12-12T10:41:43 | 27,906,253 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,566 | h | FilmboxManager.h | //-----------------------------------------------------------------------------
//
// FilmboxManager
//
// Copyright (c) 2013 QUALCOMM Technologies, Inc.
// All Rights Reserved. QUALCOMM Proprietary/GTDR
//
//-----------------------------------------------------------------------------
#ifndef MCE_FILMBOX_MANAGER_H
#define MCE_FILMBOX_MANAGER_H
#include "FilmboxSceneInfo.h"
#include "Scene.h"
#include <fbxsdk.h>
//-----------------------------------------------------------------------------
namespace MCE
{
namespace FBX
{
class FilmboxNode;
class FilmboxManager
{
public:
FilmboxManager();
~FilmboxManager();
void SetOptimizeMeshes ( bool optimize_meshes );
void SetWeldThreshold ( float weld_threshold );
KFbxScene* ImportScene ( const char* filename ) const;
MCE::FBX::Scene* ConvertScene ( KFbxScene* fbx_scene );
private:
KFbxScene* CreateScene () const;
void PreprocessScene ( KFbxScene& fbx_scene ) const;
void ConvertCoordinateSystem ( KFbxScene& fbx_scene ) const;
void TriangulateGeometry ( KFbxScene& fbx_scene ) const;
void TriangulateGeometry ( KFbxNode* root_fbx_node ) const;
void BakePivotOffsetsIntoGeometry ( KFbxScene& fbx_scene ) const;
void BakePivotOffsetsIntoGeometry ( KFbxNode* root_fbx_node ) const;
void ExtractSceneInfo ( KFbxScene& fbx_scene );
void ExtractMaterialsInfo ( KFbxScene& fbx_scene );
void ExtractChildNodesInfo ( KFbxNode& fbx_root_node );
const MCE::FBX::FilmboxBone* GetBoneInfo ( const KFbxNode* fbx_bone_node ) const;
const MCE::FBX::FilmboxSkinInfo* GetSkinInfo ( const KFbxMesh* fbx_mesh ) const;
int GetBoneIndex ( const KFbxNode* bone_node ) const;
int GetMaterialIndex ( const KFbxSurfaceMaterial* fbx_material ) const;
void ExtractMaterials ( KFbxScene& fbx_scene, MCE::FBX::Scene& mce_scene ) const;
void ExtractNodes ( KFbxScene& fbx_scene, MCE::FBX::Scene& mce_scene ) const;
void ExtractChildNodes ( KFbxNode* fbx_root_node, MCE::FBX::Scene& mce_scene, MCE::FBX::SceneNode& scene_root_node ) const;
MCE::FBX::SceneNode* ConvertNode ( KFbxNode* fbx_node, MCE::FBX::Scene& mce_scene ) const;
void ConvertBoneNode ( MCE::FBX::SceneNode& scene_node, MCE::FBX::FilmboxNode& mce_fbx_node ) const;
void ConvertCameraNode ( MCE::FBX::SceneNode& scene_node, MCE::FBX::FilmboxNode& mce_fbx_node ) const;
void ConvertMeshNode ( MCE::FBX::SceneNode& scene_node, MCE::FBX::FilmboxNode& mce_fbx_node ) const;
MCE::FBX::Mesh* ConvertMesh ( const MCE::FBX::FilmboxNode& mesh_node ) const;
MCE::FBX::Mesh* CreateCollisionMesh ( const MCE::FBX::Mesh& visual_mesh ) const;
void InitializeVertexArray ( const MCE::FBX::FilmboxNode& mesh_node, MCE::FBX::VertexArray& vertex_buffer ) const;
void InitializeVertexFormat ( const MCE::FBX::FilmboxNode& mesh_node, MCE::FBX::VertexFormat& vertex_format ) const;
void InitializeTriangleArray ( const MCE::FBX::FilmboxNode& mesh_node, MCE::FBX::TriangleArray& triangles ) const;
void InitializeSkinVertexProperties ( MCE::FBX::VertexArray& vertex_buffer, int num_verts, const KFbxMesh* mesh ) const;
private:
KFbxSdkManager* m_fbx_manager;
KFbxGeometryConverter* m_geometry_converter;
MCE::FBX::FilmboxSceneInfo m_fbx_scene_info;
bool m_optimize_meshes;
float m_weld_threshold;
};
//-----------------------------------------------------------------------------
void InitializeFilmboxManager();
FilmboxManager* GetFilmboxManager();
void ReleaseFilmboxManager();
}
}
//-----------------------------------------------------------------------------
#endif |
e3f6aef0c425e8d2af58c6ae43608feb1f224771 | bd930733e6790046ee3da935ed6a1c35f8795f16 | /wallet/test/db_tests.cpp | ece065c7e3323bb1b202decaa6c365d4e1af4831 | [
"MIT"
] | permissive | RabbiSpace/neblio | 9f2dd5229970a7b90498a1f705241ee780d10f0a | 70c6b31160ae9b336647d845248ec0cc074c8862 | refs/heads/master | 2023-03-12T09:46:01.131277 | 2021-02-17T13:55:47 | 2021-02-17T13:55:47 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,809 | cpp | db_tests.cpp | #include "googletest/googletest/include/gtest/gtest.h"
#include "curltools.h"
#include "hash.h"
#include "ntp1/ntp1tools.h"
#include <boost/algorithm/string.hpp>
#include <fstream>
#include <unordered_map>
#include <unordered_set>
const std::string TempNTP1File("ntp1txout.bin");
std::string RandomString(const int len)
{
static const char alphanum[] = "0123456789"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz";
std::string s;
s.resize(len);
for (int i = 0; i < len; ++i) {
s[i] = alphanum[rand() % (sizeof(alphanum) - 1)];
}
return s;
}
#define CUSTOM_LMDB_DB_SIZE (1 << 14)
#include "../txdb-lmdb.h"
TEST(lmdb_tests, basic)
{
std::cout << "LMDB DB size: " << DB_DEFAULT_MAPSIZE << std::endl;
CTxDB::DB_DIR = "test-txdb"; // avoid writing to the main database
CTxDB::__deleteDb(); // clean up
CTxDB::QuickSyncHigherControl_Enabled = false;
CTxDB db;
std::string k1 = "key1";
std::string v1 = "val1";
EXPECT_TRUE(db.test1_WriteStrKeyVal(k1, v1));
std::string out;
EXPECT_TRUE(db.test1_ReadStrKeyVal(k1, out));
EXPECT_EQ(out, v1);
EXPECT_TRUE(db.test1_ExistsStrKeyVal(k1));
EXPECT_TRUE(db.test1_EraseStrKeyVal(k1));
EXPECT_FALSE(db.test1_ExistsStrKeyVal(k1));
db.Close();
}
TEST(lmdb_tests, basic_in_1_tx)
{
CTxDB::DB_DIR = "test-txdb"; // avoid writing to the main database
CTxDB::__deleteDb(); // clean up
CTxDB::QuickSyncHigherControl_Enabled = false;
CTxDB db;
db.TxnBegin();
std::string k1 = "key1";
std::string v1 = "val1";
EXPECT_TRUE(db.test1_WriteStrKeyVal(k1, v1));
std::string out;
EXPECT_TRUE(db.test1_ReadStrKeyVal(k1, out));
EXPECT_EQ(out, v1);
EXPECT_TRUE(db.test1_ExistsStrKeyVal(k1));
db.TxnAbort();
// uncommitted data shouldn't exist
EXPECT_FALSE(db.test1_ExistsStrKeyVal(k1));
db.Close();
}
TEST(lmdb_tests, many_inputs)
{
CTxDB::DB_DIR = "test-txdb"; // avoid writing to the main database
CTxDB::__deleteDb(); // clean up
CTxDB::QuickSyncHigherControl_Enabled = false;
CTxDB db;
std::unordered_map<std::string, std::string> entries;
const uint64_t entriesCount = 100;
for (uint64_t i = 0; i < entriesCount; i++) {
std::string k = RandomString(100);
std::string v = RandomString(1000000);
if (entries.find(k) != entries.end()) {
continue;
}
entries[k] = v;
EXPECT_TRUE(db.test1_WriteStrKeyVal(k, v));
std::string out;
EXPECT_TRUE(db.test1_ReadStrKeyVal(k, out));
EXPECT_EQ(out, v);
EXPECT_TRUE(db.test1_ExistsStrKeyVal(k));
}
for (const auto& pair : entries) {
std::string out;
EXPECT_TRUE(db.test1_ReadStrKeyVal(pair.first, out));
EXPECT_EQ(out, pair.second);
EXPECT_TRUE(db.test1_ExistsStrKeyVal(pair.first));
}
db.Close();
}
TEST(lmdb_tests, many_inputs_one_tx)
{
CTxDB::DB_DIR = "test-txdb"; // avoid writing to the main database
CTxDB::__deleteDb(); // clean up
CTxDB::QuickSyncHigherControl_Enabled = false;
CTxDB db;
std::unordered_map<std::string, std::string> entries;
const uint64_t entriesCount = 100;
std::size_t keySize = 100;
std::size_t valSize = 1000000;
db.TxnBegin(keySize * valSize * 11 / 10);
for (uint64_t i = 0; i < entriesCount; i++) {
std::string k = RandomString(keySize);
std::string v = RandomString(valSize);
if (entries.find(k) != entries.end()) {
continue;
}
entries[k] = v;
EXPECT_TRUE(db.test1_WriteStrKeyVal(k, v));
std::string out;
EXPECT_TRUE(db.test1_ReadStrKeyVal(k, out));
EXPECT_EQ(out, v);
EXPECT_TRUE(db.test1_ExistsStrKeyVal(k));
}
db.TxnCommit();
for (const auto& pair : entries) {
std::string out;
EXPECT_TRUE(db.test1_ReadStrKeyVal(pair.first, out));
EXPECT_EQ(out, pair.second);
EXPECT_TRUE(db.test1_ExistsStrKeyVal(pair.first));
}
db.Close();
}
TEST(lmdb_tests, basic_multiple_read)
{
CTxDB::DB_DIR = "test-txdb"; // avoid writing to the main database
CTxDB::__deleteDb(); // clean up
CTxDB::QuickSyncHigherControl_Enabled = false;
CTxDB db;
const std::string k1 = "key1";
const std::string k2 = "key2";
const std::string v1 = "val1";
const std::string v2 = "val2";
const std::string v3 = "val3";
const std::string v4 = "val4";
const std::string v5 = "val5";
const std::string v6 = "val6";
EXPECT_TRUE(db.test2_WriteStrKeyVal(k1, v1));
EXPECT_TRUE(db.test2_WriteStrKeyVal(k1, v2));
EXPECT_TRUE(db.test2_WriteStrKeyVal(k1, v3));
EXPECT_TRUE(db.test2_WriteStrKeyVal(k2, v4));
EXPECT_TRUE(db.test2_WriteStrKeyVal(k2, v5));
EXPECT_TRUE(db.test2_WriteStrKeyVal(k2, v6));
std::vector<std::string> outs1;
std::vector<std::string> outs2;
EXPECT_TRUE(db.test2_ReadMultipleStr1KeyVal(k1, outs1));
EXPECT_EQ(outs1, std::vector<std::string>({v1, v2, v3}));
EXPECT_TRUE(db.test2_ReadMultipleStr1KeyVal(k2, outs2));
EXPECT_EQ(outs2, std::vector<std::string>({v4, v5, v6}));
std::map<std::string, std::vector<std::string>> allValsMap;
EXPECT_TRUE(db.test2_ReadMultipleAllStr1KeyVal(allValsMap));
EXPECT_EQ(allValsMap, (std::map<std::string, std::vector<std::string>>(
{{k1, std::vector<std::string>({v1, v2, v3})},
{k2, std::vector<std::string>({v4, v5, v6})}})));
EXPECT_TRUE(db.test2_ExistsStrKeyVal(k1));
EXPECT_TRUE(db.test2_EraseStrKeyVal(k1));
EXPECT_FALSE(db.test2_ExistsStrKeyVal(k1));
// uncommitted data shouldn't exist
EXPECT_FALSE(db.test1_ExistsStrKeyVal(k1));
db.Close();
}
TEST(lmdb_tests, basic_multiple_read_in_tx)
{
CTxDB::DB_DIR = "test-txdb"; // avoid writing to the main database
CTxDB::__deleteDb(); // clean up
CTxDB::QuickSyncHigherControl_Enabled = false;
CTxDB db;
db.TxnBegin(100);
std::string k1 = "key1";
std::string v1 = "val1";
std::string v2 = "val2";
std::string v3 = "val3";
EXPECT_TRUE(db.test2_WriteStrKeyVal(k1, v1));
EXPECT_TRUE(db.test2_WriteStrKeyVal(k1, v2));
EXPECT_TRUE(db.test2_WriteStrKeyVal(k1, v3));
std::vector<std::string> outs;
EXPECT_TRUE(db.test2_ReadMultipleStr1KeyVal(k1, outs));
EXPECT_EQ(outs, std::vector<std::string>({v1, v2, v3}));
EXPECT_TRUE(db.test2_ExistsStrKeyVal(k1));
EXPECT_TRUE(db.test2_EraseStrKeyVal(k1));
EXPECT_FALSE(db.test2_ExistsStrKeyVal(k1));
// uncommitted data shouldn't exist
EXPECT_FALSE(db.test1_ExistsStrKeyVal(k1));
db.TxnCommit();
db.Close();
}
TEST(lmdb_tests, basic_multiple_many_inputs)
{
CTxDB::DB_DIR = "test-txdb"; // avoid writing to the main database
CTxDB::__deleteDb(); // clean up
CTxDB::QuickSyncHigherControl_Enabled = false;
CTxDB db;
std::vector<std::string> entries;
std::string k = "TheKey";
EXPECT_FALSE(db.test2_ExistsStrKeyVal(k));
const uint64_t entriesCount = 1;
for (uint64_t i = 0; i < entriesCount; i++) {
std::string v = RandomString(508); // bigger size seems to create error: MDB_BAD_VALSIZE
entries.push_back(v);
EXPECT_TRUE(db.test2_WriteStrKeyVal(k, v));
std::string out;
EXPECT_TRUE(db.test2_ExistsStrKeyVal(k));
}
std::vector<std::string> outs;
EXPECT_TRUE(db.test2_ReadMultipleStr1KeyVal(k, outs));
EXPECT_EQ(outs, entries);
EXPECT_TRUE(db.test2_ExistsStrKeyVal(k));
EXPECT_TRUE(db.test2_EraseStrKeyVal(k));
EXPECT_FALSE(db.test2_ExistsStrKeyVal(k));
db.Close();
}
TEST(quicksync_tests, download_index_file)
{
std::string s = cURLTools::GetFileFromHTTPS(QuickSyncDataLink, 30, false);
json_spirit::Value parsedData;
json_spirit::read_or_throw(s, parsedData);
json_spirit::Array rootArray = parsedData.get_array();
ASSERT_GE(rootArray.size(), 1u);
for (const json_spirit::Value& val : rootArray) {
json_spirit::Array files = NTP1Tools::GetArrayField(val.get_obj(), "files");
bool lockFileFound = false;
for (const json_spirit::Value& fileVal : files) {
json_spirit::Array urlsObj = NTP1Tools::GetArrayField(fileVal.get_obj(), "url");
std::string sum = NTP1Tools::GetStrField(fileVal.get_obj(), "sha256sum");
int64_t fileSize = NTP1Tools::GetInt64Field(fileVal.get_obj(), "size");
std::string sumBin = boost::algorithm::unhex(sum);
EXPECT_GT(fileSize, 0);
ASSERT_GE(urlsObj.size(), 0u);
for (const auto& urlObj : urlsObj) {
std::string url = urlObj.get_str();
// test the lock file, if this iteration is for the lock file
if (boost::algorithm::ends_with(url, "lock.mdb")) {
lockFileFound = true;
{
// test by loading to memory and calculating the hash
std::string lockFile = cURLTools::GetFileFromHTTPS(url, 30, false);
std::string sha256_result;
sha256_result.resize(32);
SHA256(reinterpret_cast<unsigned char*>(&lockFile.front()), lockFile.size(),
reinterpret_cast<unsigned char*>(&sha256_result.front()));
EXPECT_EQ(sumBin, sha256_result);
}
{
// test by downloading to a file and calculating the hash
std::atomic<float> progress;
boost::filesystem::path testFilePath = "test_lock.mdb";
cURLTools::GetLargeFileFromHTTPS(url, 30, testFilePath, progress);
std::string sha256_result = CalculateHashOfFile<Sha256Calculator>(testFilePath);
EXPECT_EQ(sumBin, sha256_result);
boost::filesystem::remove(testFilePath);
}
}
// test the data file, if this iteration is for the data file
// if (boost::algorithm::ends_with(url, "data.mdb")) {
// std::string url = NTP1Tools::GetStrField(fileVal.get_obj(), "url");
// std::string sum = NTP1Tools::GetStrField(fileVal.get_obj(),
// "sha256sum"); std::string sumBin = boost::algorithm::unhex(sum);
// {
// // test by downloading to a file and calculating the hash
// std::atomic<float> progress;
// boost::filesystem::path testFilePath = "test_data.mdb";
// std::atomic_bool finishedDownload;
// finishedDownload.store(false);
// boost::thread downloadThread([&]() {
// cURLTools::GetLargeFileFromHTTPS(url, 30, testFilePath,
// progress); finishedDownload.store(true);
// });
// std::cout << "Downloading file: " << url << std::endl;
// while (!finishedDownload) {
// std::cout << "File download progress: " << progress.load() <<
// "%"
// << std::endl;
// std::this_thread::sleep_for(std::chrono::seconds(2));
// }
// std::cout << "File download progress: "
// << "100"
// << "%" << std::endl;
// downloadThread.join();
// std::string sha256_result =
// CalculateHashOfFile<Sha256Calculator>(testFilePath);
// EXPECT_EQ(sumBin, sha256_result);
// boost::filesystem::remove(testFilePath);
// }
// }
}
}
EXPECT_TRUE(lockFileFound) << "For one entry, lock file not found: " << QuickSyncDataLink;
std::string os = NTP1Tools::GetStrField(val.get_obj(), "os");
}
}
|
bda3fae422c6946cce9e10aa826213a7a06bafe2 | c1aa912bdd55d03c7313eaa0084656095778019d | /man.h | 6814b7cc7c87fb1c85aa2b3b90617219c9618c5e | [] | no_license | ZaurAtakishiev/Dz1_Class | f3873b0571918c8a9cdda054eb5c51712bccd1ad | e039704a8537516e82cae442f44dcdbbfa7eabba | refs/heads/master | 2021-03-12T20:31:09.468214 | 2014-04-12T19:09:13 | 2014-04-12T19:09:13 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 320 | h | man.h | #pragma once
#include <iostream>
#include <stdio.h>
#include <conio.h>
#include <windows.h>
#include <string>
#include <string.h>
#include <list>
using namespace std;
class Man
{
public:
string FIO;
int Quant_of_money;
bool Oplata;
Man(string Name, int Quant_of_money);
~Man();
void menu();
void oplatit();
};
|
75e3d761ec72694d8060a3ad35b35ae41a34fb01 | d4148d4c37f920feeca7a421926f7caace838f73 | /๊ทธ๋ฆฌ๋/์ฃผ์ ์.cpp | 8f98c610d06d7c5a9323d22a828380987eb99d04 | [] | no_license | kim-hwi/Algorithm | faf6725bcc3b08c08513c5b54c130a4768ca3276 | 14a38d6174938cb8eb4633212b59d693cfe9a702 | refs/heads/master | 2023-07-19T01:32:17.499032 | 2021-08-30T14:59:52 | 2021-08-30T14:59:52 | 341,794,890 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 926 | cpp | ์ฃผ์ ์.cpp | #include<iostream>
using namespace std;
int main(void){
long long pay=0;//1์ต*1์ต์ ๋ด๊ธฐ์ํ ๋ณ์
int citynum;
cin>>citynum;
int cityoil[citynum];
long long path[citynum-1];
for(int i=0;i<citynum-1;i++) cin>>path[i];
for(int i=0;i<citynum;i++) cin>>cityoil[i];
long long temppath=0;//๋งค์ฐ์ค์! intํ 1์ต ๋์ ๊ณฑํ๋ ์๊ฐ pay์ ๋ค์ด๊ฐ๊ธฐ ์ ์ ์ค๋ฒํ๋ก์ฐ๊ฐ ๋ฐ์๋๊ธฐ ๋๋ฌธ. int=์ฝ 21์ต ๊น์ง.
for(int i=0;i<citynum;i++){
temppath=0;
for(int j=i+1;j<citynum;j++){
temppath+=path[j-1];
if(j==citynum-1){
pay+=temppath*cityoil[i];
cout<<pay;
return 0;
}
if(cityoil[i]>cityoil[j]){
pay+=temppath*cityoil[i];
temppath=0;
i=j-1;
break;
}
}
}
} |
75f6fcf35fd1e1b6e87a97a5550a6df82f6c0564 | 44e0a0c85d7b797df53c90296dd657b0a42186be | /Engine/General/Clock.cpp | c7924ff2c1c98697d3c3243e48a33ec276f27d68 | [
"MIT"
] | permissive | BielBdeLuna/DarkXL | e759f1d39ca594b330a645a3adda0295dc84c94d | 647f88835b78f0afc595c17ccb7410c0661c93a9 | refs/heads/master | 2020-12-24T14:26:20.132150 | 2019-12-12T03:01:30 | 2019-12-12T03:01:30 | 227,507,115 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,162 | cpp | Clock.cpp | #include "Clock.h"
#include <windows.h>
#include <stdio.h>
#define SEC_TO_uS 1000000.0
float Clock::m_fDeltaTime;
float Clock::m_fRealDeltaTime;
int Clock::m_nDeltaTicks;
static LARGE_INTEGER _Timer_Freq;
static u64 _Start_Tick[16];
LONGLONG _GetCurTickCnt();
bool Clock::Init()
{
BOOL bRet = QueryPerformanceFrequency(&_Timer_Freq);
return (bRet) ? true : false;
}
void Clock::StartTimer(int timerID/*=0*/)
{
assert( timerID < 16 );
_Start_Tick[timerID] = _GetCurTickCnt();
}
float Clock::GetDeltaTime(float fMax, int timerID/*=0*/)
{
assert( timerID < 16 );
u64 End = _GetCurTickCnt();
float fTimeDelta = (float)( (double)(End - _Start_Tick[timerID]) / (double)(_Timer_Freq.QuadPart) );
if ( fTimeDelta > fMax ) { fTimeDelta = fMax; }
return fTimeDelta;
}
u64 Clock::GetDeltaTime_uS(int timerID/*=0*/)
{
u64 End = _GetCurTickCnt();
double quadPart_uS = (double)(_Timer_Freq.QuadPart) / SEC_TO_uS;
return (u64)( (double)(End - _Start_Tick[timerID]) / quadPart_uS );
}
LONGLONG _GetCurTickCnt()
{
LARGE_INTEGER lcurtick;
QueryPerformanceCounter(&lcurtick);
return lcurtick.QuadPart;
}
|
436c7f6cebe72703114a4ed69e218a832d79f6d7 | 696221bce2a5f2424cc7ee76c5b2fa42204741b4 | /source/code/scratch/old_repos/webapps/hickey-rates/deploy-tool/category_checker.cpp | 71d799b191585f2aab2d41b62b66fb8b15ee0fa9 | [] | no_license | advaitsangle/unilang | b325cc8cc42c719ad7182f47fc28d38aedf1bbfa | 365965159c1c997b4f02a5d3704daf2dae986eb4 | refs/heads/master | 2022-11-09T19:57:34.624803 | 2020-06-28T23:57:34 | 2020-06-28T23:57:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 31 | cpp | category_checker.cpp | #include "category_checker.hpp" |
001a987b345681e59114186a01be90817eee1532 | 28d668bf537e3bc1ed28b4ae058f86ec6195eb80 | /Template/Skills_And_Methods/High_Precision.cc | 62eb90242090f4540e899908d98188ee5af126ee | [] | no_license | seoi2017/OICode | 4aa710d5f6e40e2d611c9b543facd1ec2318e810 | 6e793181a9a2663db7cc160d5d43fc4eb38de43f | refs/heads/master | 2021-06-30T03:32:25.030999 | 2018-03-31T11:30:27 | 2018-03-31T11:30:27 | 96,162,533 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,869 | cc | High_Precision.cc | #include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#define MAX_SUM 16384
using namespace std;
const int base = 100000000;
const int power = 8;
class bigint_t
{
public:
long long s[MAX_SUM];
bigint_t()
{
memset(this->s, 0, sizeof(this->s));
}
bigint_t(int x)
{
*this = x;
}
void operator=(const char *str)
{
memset(this->s, 0, sizeof(this->s));
int len = strlen(str);
this->s[0] = (len + power - 1) / power;
for (int i = 0, t = 0, w; i < len; w *= 10, ++i)
{
if (i % power == 0)
w = 1, ++t;
this->s[t] += (w * (str[i] - '0'));
}
}
void operator=(const int x)
{
memset(this->s, 0, sizeof(this->s));
this->s[0] = 1;
this->s[1] = x;
while (this->s[this->s[0]] >= base)
{
this->s[this->s[0] + 1] = this->s[this->s[0]] / base;
this->s[this->s[0]] %= base;
++this->s[0];
}
}
inline void add(int x)
{
if (x || this->s[0])
this->s[++this->s[0]] = x;
}
inline void print()
{
printf("%lld", this->s[this->s[0]]);
for (int i = this->s[0] - 1; i > 0; --i)
printf("%0*lld", power, this->s[i]);
printf("\n");
}
};
bool operator<(const bigint_t &x, const bigint_t &y)
{
if (x.s[0] < y.s[0])
return true;
if (x.s[0] > y.s[0])
return false;
for (int i = x.s[0]; i > 0; --i)
if (x.s[i] != y.s[i])
return x.s[i] < y.s[i];
return false;
}
bool operator==(const bigint_t &x, const bigint_t &y)
{
if (x.s[0] != y.s[0])
return false;
for (int i = x.s[0]; i >= 1; --i)
if (x.s[i] != y.s[i])
return false;
return true;
}
bool operator<=(const bigint_t &x, const bigint_t &y)
{
if (x < y)
return true;
if (x == y)
return true;
return false;
}
bigint_t operator+(const bigint_t &x, const bigint_t &y)
{
bigint_t z;
z.s[0] = max(x.s[0], y.s[0]);
for (int i = 1; i <= z.s[0]; ++i)
{
z.s[i] += (x.s[i] + y.s[i]);
z.s[i + 1] += (z.s[i] / base);
z.s[i] %= base;
}
while (z.s[z.s[0] + 1])
++z.s[0];
return z;
}
bigint_t operator-(const bigint_t &x, const bigint_t &y)
{
bigint_t z = x;
for (int i = 1; i <= z.s[0]; ++i)
{
z.s[i] -= y.s[i];
if (z.s[i] < 0)
z.s[i] += base,
--z.s[i + 1];
}
while (z.s[0] > 0 && !z.s[z.s[0]])
--z.s[0];
return z;
}
bigint_t operator*(const bigint_t &x, const bigint_t &y)
{
bigint_t z;
z.s[0] = x.s[0] + y.s[0] - 1;
for (int i = 1; i <= x.s[0]; ++i)
for (int j = 1; j <= y.s[0]; ++j)
{
z.s[i + j - 1] += (x.s[i] * y.s[j]);
z.s[i + j] += z.s[i + j - 1] / base;
z.s[i + j - 1] %= base;
}
while (z.s[z.s[0] + 1])
++z.s[0];
while (!z.s[z.s[0]]) //ไธบไบๅบๅฏนไน0
--z.s[0];
return z;
}
inline bigint_t cp(const bigint_t &a, int x)
{
bigint_t t;
t.s[0] = a.s[0] + x;
for (int i = 1; i <= a.s[0]; ++i)
t.s[i + x] = a.s[i];
return t;
}
inline bigint_t divide(const bigint_t &x, const bigint_t &y, bigint_t &b)
{
//็ฑไบๆข้คๅไฝ็ดๆฅๅๅๅธธๆฐ=TLE๏ผๆไปฅ่ฟ้ๅทไธชๆ๏ผไธไธชๅฝๆฐ่งฃๅณไธคไธช้ฎ้ข
bigint_t a;
a.s[0] = x.s[0] - y.s[0] + 1;
b = x;
int st[(int)log2(base) + 5];
st[0] = 1;
for (int i = 1; i <= log2(base); ++i)
st[i] = (st[i - 1] << 1);
for (int i = a.s[0]; i >= 1; --i)
{
bigint_t t = cp(y, i - 1);
for (int j = log2(base); j >= 0; --j)
if (t * st[j] <= b)
{
a.s[i] = a.s[i] + st[j];
b = b - (t * st[j]);
}
}
while (a.s[0] > 0 && !a.s[a.s[0]])
--a.s[0];
return a;
}
char a[MAX_SUM], b[MAX_SUM];
bigint_t A, B, ans, mod;
int main()
{
#ifdef LOCAL
freopen("io/in", "r", stdin);
freopen("io/out", "w", stdout);
#endif
scanf("%s", a);
reverse(a, a + strlen(a));
scanf("%s", b);
reverse(b, b + strlen(b));
A = a, B = b;
ans = A + B;
ans.print();
if (B < A)
ans = A - B;
else
ans = B - A,
printf("-");
ans.print();
ans = A * B;
ans.print();
ans = divide(A, B, mod);
ans.print();
mod.print();
#ifdef LOCAL
fclose(stdin);
fclose(stdout);
#endif
return 0;
} |
0e6d24c6e52bb3b0f464346b989ce4dc162c1fba | 6a174bf3b779ae22960130170c6fcc2930ec82bb | /James Moran Tutorial 04 Exercise 1/Input.h | 19a54371078240ecda387e0ce552971a142f7dec | [] | no_license | FioKron/CGP---Tutorials | 83c7c048f7d383e1daf1981124e764d28bb85908 | 180689fba85373931afccb131a16078b972a2b68 | refs/heads/master | 2020-12-24T06:37:29.923561 | 2017-01-09T15:54:56 | 2017-01-09T15:54:56 | 73,468,569 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 412 | h | Input.h | #pragma once
#include "SDL.h"
// Enum.(s):
enum PressedKeys
{
KEY_ESCAPE,
KEY_R,
KEY_G,
KEY_B,
KEY_T,
KEY_H,
KEY_N,
KEY_W,
KEY_A,
KEY_S,
KEY_D,
PRESSED_KEYS_SIZE // Interesting...
};
class Input
{
public:
void Update();
bool KeyIsPressed(PressedKeys PressedKey);
Input();
~Input();
private:
SDL_Event M_Event;
bool bKeysPressed[PRESSED_KEYS_SIZE];
};
|
343d974fd9dcc3314dd0eb843a03b880d0ee3210 | 7cf8b5fd6ed148f294fb40a72d99acab4c58c220 | /example/game_prototype/weakPlatform.cpp | 8ba551848f1776be81f7506d1c7044d92d8f4620 | [] | no_license | ssyp-ru/ssyp17-ws03 | 3a100c5793fc3b3be09ea63eaf5a425d4c22a584 | 3eae7f0df34f553773af4f656db1589e8723eb37 | refs/heads/master | 2021-01-15T17:59:21.650989 | 2018-07-09T21:05:40 | 2018-07-09T21:05:40 | 99,767,136 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,305 | cpp | weakPlatform.cpp | #include "weakPlatform.h"
re::ImagePtr WeakPlatform::tex = nullptr;
WeakPlatform::WeakPlatform(re::Point2f pos, re::Point2f siz, double destroyTime) : Platform::Platform(pos, siz)
{
size = siz;
touched = false;
hp = destroyTime;
setFriction(1.0);
setBounciness(0.0);
}
void WeakPlatform::onCollisionStay(re::PhysicObjectPtr to, re::Point2f vec)
{
if (re::Point2f(0, 1).angleBetween(vec) < 30.0 / 180.0 * 3.14159)
touched = true;
}
void WeakPlatform::update()
{
if (touched) hp -= re::Time::delta_time;
if (hp <= 0)
{
destroy();
re::explode_image( re::Point2f( position.x * 16, position.y * 16 ),
re::Point2f( 64, 64 ),
re::Point2f( 6, 6 ),
tex,
re::Point2f( 0.5, -6 ),
re::Point2f( 5, -4 ),
1,
1 );
}
}
void WeakPlatform::display(int scale)
{
if( tex == nullptr )
{
tex = std::make_shared<re::Image>( "map/corr.png" );
}
re::draw_image_part( position.x * scale, position.y * scale, (position.x * scale) + 64, (position.y * scale) + 64,
0,0, 1,1,
tex );
} |
221f32b2c0e614654f71cf5080d17bb166fe18d4 | ee1820f94178fdfa93eceb6dd2cb9b9d9c95b72a | /ITSA/C_AR01.cpp | 891493af2e3c21a3dffb4331cd94e9b244adca8a | [] | no_license | asd0012/ITSA | 3a2f6c8a829c08d49ac0be951514f1bd2ee47989 | 05879bf4c13db4c75588b8135942bda8bbcc0456 | refs/heads/master | 2020-06-07T08:05:21.205082 | 2019-06-21T02:56:59 | 2019-06-21T02:56:59 | 192,969,053 | 0 | 0 | null | null | null | null | BIG5 | C++ | false | false | 752 | cpp | C_AR01.cpp | #include<stdio.h>
#include<iostream>
#include<stdlib.h>
#include<string.h>
#include<vector>
using namespace std;
int main()
{
char str[100];
vector<int> num;
int i;
// freopen("input.txt","r",stdin);
while(fgets(str,100,stdin) !=NULL)
{
char *token;
token=strtok(str," "); /** ไปฅtokenๅ็ฉบ็ฝ **/
while(token != NULL)
{
num.push_back(atoi(token)); /** ๅฐๅญๅ
็ASCIIๅผ่ฝๆINT **/
token=strtok(NULL," "); /** ๅไธไธๆฎต็ฉบ็ฝ **/
}
for(i=num.size()-1;i>0;i--) /** ่ผธๅบๅ่ฝ็ตๆ **/
cout<<num[i]<<" ";
cout<<num[0];
cout<<endl;
num.clear();
}
return 0;
}
|
b8bab50c92ec95b79b89b0fe79b36414a6243f3b | 2a6b3e8306e201e6665366f3e055942cdadccdfa | /64/Debug&Release/include/hermes2d/projections/localprojection.h | c90ffa661a7e8f55805b00680b1fd7ff4e29dbbc | [] | no_license | bausoft-kft/hermes-windows | 7f86ad2d79f77a894cab29f9133a895efda4439e | d3db7cb546069ad6c8f06c2e7fcd6a0df697d651 | refs/heads/master | 2021-12-10T22:51:25.996544 | 2016-09-29T21:21:16 | 2016-09-29T21:21:16 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,273 | h | localprojection.h | // This file is part of Hermes2D.
//
// Hermes2D is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 2 of the License, or
// (at your option) any later version.
//
// Hermes2D is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Hermes2D. If not, see <http://www.gnu.org/licenses/>.
#ifndef __H2D_LOCALPROJECTION_H
#define __H2D_LOCALPROJECTION_H
#include "../function/solution.h"
#include "../forms.h"
#include "../weakform/weakform.h"
#include "../views/scalar_view.h"
namespace Hermes
{
namespace Hermes2D
{
/// @ingroup projections
template<typename Scalar>
class HERMES_API LocalProjection
{
public:
LocalProjection();
// Main functionality.
static void project_local(SpaceSharedPtr<Scalar> space, MeshFunctionSharedPtr<Scalar> meshfn,
Scalar* target_vec, ProjNormType proj_norm = HERMES_UNSET_NORM);
// Wrapper that delivers a Solution instead of coefficient vector.
static void project_local(SpaceSharedPtr<Scalar> space,
MeshFunctionSharedPtr<Scalar> source_sln, MeshFunctionSharedPtr<Scalar> target_sln, ProjNormType proj_norm = HERMES_UNSET_NORM);
// Wrapper that takes multiple MeshFunctions.
static void project_local(Hermes::vector<SpaceSharedPtr<Scalar> > spaces, Hermes::vector<MeshFunctionSharedPtr<Scalar> > meshfns,
Scalar* target_vec, Hermes::vector<ProjNormType> proj_norms = Hermes::vector<ProjNormType>());
// Wrapper that delivers Solutions instead of a coefficient vector.
static void project_local(Hermes::vector<SpaceSharedPtr<Scalar> > spaces,
Hermes::vector<MeshFunctionSharedPtr<Scalar> > source_slns, Hermes::vector<MeshFunctionSharedPtr<Scalar> > target_slns,
Hermes::vector<ProjNormType> proj_norms = Hermes::vector<ProjNormType>(), bool delete_old_mesh = false);
protected:
static int ndof;
};
}
}
#endif |
ca3c80b9898faa9483d9addb5b0903521929a6a8 | dd3ff7e66b5d6f6d9661ee7d0f48a02ee22cd1ee | /Game/difficulty.cpp | 4395f0b39405413701f4bba7d8f4051e5e040700 | [] | no_license | JfChi18/Space-shooting-2D-game- | 6b34f2ea6e1a01cea858f2ae809a9527c3b5f4ca | 215a141953105b6e5e4815b605026f06b492ccbe | refs/heads/master | 2021-07-05T16:58:14.996367 | 2017-09-26T03:37:59 | 2017-09-26T03:37:59 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,437 | cpp | difficulty.cpp | #include "difficulty.hpp"
#include<SDL2/SDL.h>
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <ctime>
#include "items.hpp"
#include <SDL2/SDL_mixer.h>
#include <SDL2/SDL_ttf.h>
#define SCREENW 640
#define SCREENH 480
#define BUTTONW 180
#define BUTTONH 60
#define SCREENW 640
#define SCREENH 480
#define BUTTONW 180
#define BUTTONH 60
int getDifficuty(SDL_Renderer* gRenderer) {
SDL_Texture* mainTexture;
SDL_Surface *tmp = SDL_LoadBMP("img/background.bmp");
mainTexture = SDL_CreateTextureFromSurface(gRenderer, tmp);
SDL_FreeSurface(tmp);
Button easyBtnMain(SCREENW / 2 - BUTTONW / 2, 90, BUTTONW, BUTTONH, "img/button/easy.bmp", gRenderer);
Button normalBtnMain(SCREENW / 2 - BUTTONW / 2, 180, BUTTONW, BUTTONH, "img/button/normal.bmp", gRenderer);
Button hardBtnMain(SCREENW / 2 - BUTTONW / 2,270, BUTTONW, BUTTONH, "img/button/difficult.bmp", gRenderer);
Button backBtnMain(SCREENW / 2 - BUTTONW / 2, 360, BUTTONW, BUTTONH, "img/button/back.bmp", gRenderer);
Button selected_easyBtnMain(SCREENW / 2 - BUTTONW / 2, 90, BUTTONW, BUTTONH, "img/button/easy-selected.bmp", gRenderer);
Button selected_normalBtnMain(SCREENW / 2 - BUTTONW / 2, 180, BUTTONW, BUTTONH, "img/button/normal-selected.bmp", gRenderer);
Button selected_hardBtnMain(SCREENW / 2 - BUTTONW / 2, 270, BUTTONW, BUTTONH, "img/button/difficult-selected.bmp", gRenderer);
Button selected_backBtnMain(SCREENW / 2 - BUTTONW / 2, 360, BUTTONW, BUTTONH, "img/button/back-selected.bmp", gRenderer);
//0 easy 1 normal 2hard 3back
int difficultyopt = 0;
int isRunning = 1;
SDL_Event e;
SDL_RenderCopy(gRenderer, mainTexture, NULL, NULL);
selected_easyBtnMain.redraw();
normalBtnMain.redraw();
hardBtnMain.redraw();
backBtnMain.redraw();
SDL_RenderPresent(gRenderer);
while (isRunning)
{
while (SDL_PollEvent(&e) != 0)
{
if (e.type == SDL_QUIT)
return -1;
if (e.type == SDL_KEYDOWN)
{
if (e.key.keysym.sym == SDLK_UP)
{
// if user press up so we need decrease curOp
if (difficultyopt > 0)
{
difficultyopt--;
// then redraw
SDL_RenderCopy(gRenderer, mainTexture, NULL, NULL);
if (difficultyopt == 0)
{
selected_easyBtnMain.redraw();
normalBtnMain.redraw();
hardBtnMain.redraw();
backBtnMain.redraw();
}
if (difficultyopt == 1)
{
selected_normalBtnMain.redraw();
easyBtnMain.redraw();
hardBtnMain.redraw();
backBtnMain.redraw();
}
if (difficultyopt == 2)
{
selected_hardBtnMain.redraw();
easyBtnMain.redraw();
normalBtnMain.redraw();
backBtnMain.redraw();
}
if (difficultyopt == 3)
{
selected_backBtnMain.redraw();
hardBtnMain.redraw();
easyBtnMain.redraw();
normalBtnMain.redraw();
}
SDL_RenderPresent(gRenderer);
}
continue;
}
if (e.key.keysym.sym == SDLK_DOWN)
{
if (difficultyopt <3)
{
difficultyopt++;//
SDL_RenderCopy(gRenderer, mainTexture, NULL, NULL);
if (difficultyopt == 0)
{
selected_easyBtnMain.redraw();
normalBtnMain.redraw();
hardBtnMain.redraw();
backBtnMain.redraw();
}
if (difficultyopt == 1)
{
selected_normalBtnMain.redraw();
easyBtnMain.redraw();
hardBtnMain.redraw();
backBtnMain.redraw();
}
if (difficultyopt == 2)
{
selected_hardBtnMain.redraw();
easyBtnMain.redraw();
normalBtnMain.redraw();
backBtnMain.redraw();
}
if (difficultyopt == 3)
{
selected_backBtnMain.redraw();
hardBtnMain.redraw();
easyBtnMain.redraw();
normalBtnMain.redraw();
}
SDL_RenderPresent(gRenderer);
}
continue;
}
if (e.key.keysym.sym == SDLK_ESCAPE) {
return -2;
}
if (e.key.keysym.sym == SDLK_SPACE)
{
// check here if current option is 0,1,2
if (difficultyopt == 2)
{
return 2;
}
if (difficultyopt == 0)
{
return 0;
}
if (difficultyopt == 1)
{
return 1;
}
if (difficultyopt == 3)
{
return -2;
}
}
}
}
}
}
|
e61dc76c820415963462d7ab89a26d7640bac31a | 9e3a2a980c4c0f50dab735a2f17488b9e3e5d245 | /MSCL/source/mscl/MicroStrain/Wireless/WirelessDataPoint.h | 26237cc63d67ab0401d36bfdbfe6fc3e8181868b | [
"OpenSSL",
"MIT",
"BSL-1.0"
] | permissive | LORD-MicroStrain/MSCL | 6c11a0c50889fae852bf04cdce9b4fe7230cecf1 | aef74d5a85c2573cee224f53dad1e22c32d4a128 | refs/heads/master | 2023-08-31T06:51:24.246179 | 2023-08-23T00:03:50 | 2023-08-23T00:03:50 | 41,445,502 | 73 | 61 | MIT | 2023-07-04T00:07:55 | 2015-08-26T19:27:43 | C++ | UTF-8 | C++ | false | false | 4,626 | h | WirelessDataPoint.h | /*****************************************************************************************
** Copyright(c) 2015-2022 Parker Hannifin Corp. All rights reserved. **
** **
** MIT Licensed. See the included LICENSE.txt for a copy of the full MIT License. **
*****************************************************************************************/
#pragma once
#include "WirelessChannel.h"
#include "mscl/MicroStrain/DataPoint.h"
#include "mscl/Utils.h"
namespace mscl
{
//API Class: WirelessDataPoint
// Represents a single channel's data point within a sweep
//
//See Also:
// <DataPoint>, <Value>
class WirelessDataPoint : public DataPoint
{
public:
//Default Constructor: WirelessDataPoint
// Builds a WirelessDataPoint object
WirelessDataPoint();
#ifndef SWIG
//Constructor: WirelessDataPoint
// Builds a WirelessDataPoint object.
// The channel name will be automatically generated from the given channel id.
//
//Parameters:
// channelId - The <WirelessChannel::ChannelId> of the the data point
// channelNumber - The channel number associated with the data point (ch1 = 1, ch8 = 8).
// type - The <ValueType> of the value to be stored
// value - The value to store
// channelProperties - Any <ChannelProperties> to store for later retrieval.
WirelessDataPoint(
WirelessChannel::ChannelId channelId,
uint8 channelNumber,
ValueType type,
const anyType& value,
const ChannelProperties& channelProperties = ChannelProperties());
//Constructor: WirelessDataPoint
// Builds a WirelessDataPoint object.
//
//Parameters:
// channelId - The <WirelessChannel::ChannelId> of the the data point
// channelNumber - The channel number associated with the data point (ch1 = 1, ch8 = 8).
// channelName - The channel name associated with the data point.
// type - The <ValueType> of the value to be stored
// value - The value to store
// channelProperties - Any <ChannelProperties> to store for later retrieval.
WirelessDataPoint(
WirelessChannel::ChannelId channelId,
uint8 channelNumber,
const Utils::Lazy<std::string>& channelName,
ValueType type,
const anyType& value,
const ChannelProperties& channelProperties = ChannelProperties());
#endif
private:
//Variable: m_channelId
// The <WirelessChannel::ChannelId> representing information about the channel this data point is associated with
WirelessChannel::ChannelId m_channelId;
//Variable: m_channelNumber
// The channel number associated with the data point (ch1 = 1, ch8 = 8).
uint8 m_channelNumber;
//Variable: m_channelName
// The channel name associated with the data point (as a lazy load function).
mutable Utils::Lazy<std::string> m_channelName;
public:
//API Function: channelId
// Gets the <WirelessChannel::ChannelId> associated with the data point.
//
//Returns:
// A <WirelessChannel::ChannelId> representing which channel this data corresponds with.
WirelessChannel::ChannelId channelId() const;
//API Function: channelNumber
// Gets the channel number associated with the data point (ch1 = 1, ch8 = 8), when applicable.
// Otherwise, this will return a 0 (for example, a Structural Health data point doesn't relate
// an actual channel on the Wireless Node, so this will be a 0).
// This number can be used to relate to the Node's <WirelessChannel> in the
// map returned from calling <WirelessNode::channels>().
//
//Returns:
// The channel number associated with the data point.
uint8 channelNumber() const;
//API Function: channelName
// Gets the name of the channel.
// This is the universal channel name that should be used for uploading to SensorCloud.
//
//Returns:
// The name of the channel.
const std::string& channelName() const;
};
//API Typedef: ChannelData
// A typedef for a collection (vector) of <WirelessDataPoint>s
typedef std::vector<WirelessDataPoint> ChannelData;
}
|
19ce5e15d7ddc379acf04f9ef6b553fd5c4a37cd | 651f4c18391f3e7a48cf74d1364d42086a3fb6ca | /6sem/ParProg/MPI/IntroductionTasks/HelloWorld/hello_world.cpp | 58cfb7f9afd3c289e3eea3ff1b1e30039dbfe7d9 | [] | no_license | exesaLigno/Mipt | eaade84ccbf8a8138602125854199083ead263b6 | 48bca95819a2e88a778e8ff737aecee0cb80b1ff | refs/heads/master | 2023-02-26T09:54:10.517980 | 2023-02-17T14:46:35 | 2023-02-17T14:46:35 | 185,024,591 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 317 | cpp | hello_world.cpp | #include <cstdio>
#include <mpi.h>
int main(int argc, char** argv)
{
MPI_Init(&argc, &argv);
int comm_size = 0, rank = 0;
MPI_Comm_size(MPI_COMM_WORLD, &comm_size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
printf("Hello world! My rank is %d of %d runners\n", rank, comm_size);
MPI_Finalize();
return 0;
}
|
42c684cecbcbf1d7ce7795632fb5af71650ce36a | b6850515d32ea0768efdc726cee5766551cc36fe | /bag.cf.cpp | d01e10f9d0b0b0e803a7be9a526e43a726a75baf | [] | no_license | kamol7/OJ-SOLVE | 4bfa97edd6c078c4126a702a6a7b701d1472fba4 | d82fcabe7acdc3929210d8101ab1591998cef438 | refs/heads/master | 2022-01-15T12:06:19.683083 | 2019-07-23T05:12:15 | 2019-07-23T05:12:15 | 198,356,034 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 258 | cpp | bag.cf.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int y,k,n;
cin>>y>>k>>n;
int i;
int lol=y%k;
if(n-y<k-lol){
printf("-1\n");
return 0;
}
for(i=1;y+i*k-lol<=n;i++) printf("%d ",i*k-lol);
return 0;
} |
09a74ea80073d9cf362d2d2c1650a90c46ae5e37 | 9be246df43e02fba30ee2595c8cec14ac2b355d1 | /worldcraft/visgroup.h | fe76ac667a9d4678236236ebfa499431205d3ddb | [] | no_license | Clepoy3/LeakNet | 6bf4c5d5535b3824a350f32352f457d8be87d609 | 8866efcb9b0bf9290b80f7263e2ce2074302640a | refs/heads/master | 2020-05-30T04:53:22.193725 | 2019-04-12T16:06:26 | 2019-04-12T16:06:26 | 189,544,338 | 18 | 5 | null | 2019-05-31T06:59:39 | 2019-05-31T06:59:39 | null | WINDOWS-1252 | C++ | false | false | 2,630 | h | visgroup.h | //========= Copyright ยฉ 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#ifndef VISGROUP_H
#define VISGROUP_H
#pragma once
#include "basetypes.h"
class CChunkFile;
class CSaveInfo;
enum ChunkFileResult_t;
class CVisGroup
{
public:
CVisGroup(void)
{
m_dwID = 0;
m_rgbColor.r = 0;
m_rgbColor.g = 0;
m_rgbColor.b = 0;
m_rgbColor.a = 0;
m_bVisible = false;
m_szName[0] = '\0';
}
DWORD GetID(void) { return(m_dwID); }
void SetID(DWORD dwID) { m_dwID = dwID; }
const char *GetName(void)
{
return(m_szName);
}
void SetName(const char *pszName)
{
if (pszName != NULL)
{
lstrcpyn(m_szName, pszName, sizeof(m_szName));
}
}
inline color32 GetColor(void);
inline void SetColor(color32 rgbColor);
inline void SetColor(unsigned char red, unsigned char green, unsigned char blue);
bool IsVisible(void);
void SetVisible(bool bVisible) { m_bVisible = bVisible; }
static bool IsShowAllActive(void);
static void ShowAllVisGroups(bool bShow);
//
// Serialization.
//
ChunkFileResult_t LoadVMF(CChunkFile *pFile);
ChunkFileResult_t SaveVMF(CChunkFile *pFile, CSaveInfo *pSaveInfo);
protected:
static ChunkFileResult_t LoadKeyCallback(const char *szKey, const char *szValue, CVisGroup *pGroup);
static bool g_bShowAll;
char m_szName[128];
color32 m_rgbColor;
DWORD m_dwID;
bool m_bVisible;
};
//-----------------------------------------------------------------------------
// Purpose: Returns the render color of this visgroup.
//-----------------------------------------------------------------------------
inline color32 CVisGroup::GetColor(void)
{
return m_rgbColor;
}
//-----------------------------------------------------------------------------
// Purpose: Sets the color of this visgroup.
//-----------------------------------------------------------------------------
inline void CVisGroup::SetColor(color32 rgbColor)
{
m_rgbColor = rgbColor;
}
//-----------------------------------------------------------------------------
// Purpose: Sets the color of this visgroup using RGB values.
//-----------------------------------------------------------------------------
inline void CVisGroup::SetColor(unsigned char red, unsigned char green, unsigned char blue)
{
m_rgbColor.r = red;
m_rgbColor.g = green;
m_rgbColor.b = blue;
m_rgbColor.a = 0;
}
#endif // VISGROUP_H
|
8413b9e8a5e2b0d3e7521cf99efd70f6c303d71e | 0c7565763a25388a35d1748e75c8bf2906da8857 | /CSED331/ASSN5/3.cpp | 704a8630d7e8e615379b463b0b91589c777db993 | [] | no_license | sjlee1218/Algorithms | 63de4a3d9bbb86960f0b7f7dc1916dd3fe53a354 | 5f264b8dba37a8086ed6cff0355ee0955dd36e31 | refs/heads/master | 2020-04-13T14:04:27.485801 | 2019-06-05T20:00:14 | 2019-06-05T20:00:14 | 163,250,687 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,781 | cpp | 3.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
ll Sum_arr[3001][3001];
int origin_arr[3001][3001];
ll Conv_arr[3001][3001];
ll Find_Sum(int n,int m){
if (n<0 || m<0)
return 0;
if(n==0 && m ==0) {
Sum_arr[0][0] = origin_arr[0][0];
return origin_arr[0][0];
}
if (Sum_arr[n][m] != 0)
return Sum_arr[n][m];
ll sum1 = Find_Sum(n-1,m);
ll sum2 = Find_Sum(n,m-1);
ll sub = Find_Sum(n-1,m-1);
Sum_arr[n][m] = sum1 + sum2 - sub + origin_arr[n][m];
return Sum_arr[n][m];
}
ll Conv(int y1, int x1, int y2, int x2){
if (!x1 && !y1){
return Sum_arr[y2][x2];
}
else if (x1 && !y1){
return Sum_arr[y2][x2] - Sum_arr[y2][x1-1];
}
else if (!x1 && y1){
return Sum_arr[y2][x2] - Sum_arr[y1-1][x2];
}
else
return Sum_arr[y2][x2] - Sum_arr[y2][x1-1] - Sum_arr[y1-1][x2] + Sum_arr[y1-1][x1-1];
//Conv_arr[i][j] = Sum_arr[i+D-1][j+D-1] - Sum_arr[i-1][j+D-1] - Sum_arr[i+D-1][j-1] + Sum_arr[i-1][j-1]
}
int main() {
cin.tie(NULL);
ios::sync_with_stdio(false);
int t;
cin>>t;
for(int _=0;_<t;_++) {
int N, M, D;
cin >> N >> M >> D;
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++){
cin>>origin_arr[i][j];
Sum_arr[i][j]=0;
Conv_arr[i][j]=0;
}
}
ll temp = Find_Sum(N - 1, M - 1);
for (int i = 0; i < N - D + 1; i++) { // y
for (int j = 0; j < M - D + 1; j++) { // j == x
Conv_arr[i][j] = Conv(i, j, i+D-1, j+D-1);
cout<<Conv_arr[i][j]<<" ";
}
cout<<'\n';
}
}
return 0;
}
|
9c206440eca19ea8e7940ff742c30081a9fb2299 | fb2d3702450ae18d2d5e2796e8f22f5dff60b4f2 | /engine/Fury/RenderUtil.cpp | db6ecde9a666e5902769643b3c3917dbe7a1320f | [
"MIT"
] | permissive | fireword/fury3d | d15b56be504bc441372b207deb2457279f99e27f | a280c276e59fa758b269ca605a95aee5f3ed78c9 | refs/heads/master | 2021-01-13T07:39:40.584122 | 2016-10-11T13:39:15 | 2016-10-11T13:39:15 | 71,447,923 | 1 | 0 | null | 2016-10-20T09:40:19 | 2016-10-20T09:40:18 | null | UTF-8 | C++ | false | false | 7,169 | cpp | RenderUtil.cpp | #include <SFML/System/Time.hpp>
#include "Fury/RenderUtil.h"
#include "Fury/GLLoader.h"
#include "Fury/Log.h"
#include "Fury/Vector4.h"
#include "Fury/Shader.h"
#include "Fury/SceneNode.h"
#include "Fury/Frustum.h"
#include "Fury/Mesh.h"
#include "Fury/MeshUtil.h"
#include "Fury/Texture.h"
namespace fury
{
RenderUtil::RenderUtil()
{
const char *debug_vs =
"#version 330\n"
"in vec3 vertex_position;\n"
"uniform mat4 projection_matrix;\n"
"uniform mat4 invert_view_matrix;\n"
"uniform mat4 world_matrix;\n"
"void main() {\n"
" gl_Position = projection_matrix * invert_view_matrix * world_matrix * vec4(vertex_position, 1.0);\n"
"}\n";
const char *debug_fs =
"#version 330\n"
"uniform vec3 color;\n"
"out vec4 fragment_output;\n"
"void main() {\n"
" fragment_output = vec4(color, 1.0);\n"
"}\n";
m_DebugShader = Shader::Create("DebugShader", ShaderType::OTHER);
if (!m_DebugShader->Compile(debug_vs, debug_fs, ""))
FURYE << "Failed to compile line shader!";
m_DebugShader->Bind();
auto shaderId = m_DebugShader->GetProgram();
glBindAttribLocation(shaderId, 0, "vertex_position");
glGenVertexArrays(1, &m_LineVAO);
glGenBuffers(1, &m_LineVBO);
glBindVertexArray(m_LineVAO);
glBindBuffer(GL_ARRAY_BUFFER, m_LineVBO);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
glEnableVertexAttribArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
m_DebugShader->UnBind();
m_BlitPass = Pass::Create("BlitPass");
m_BlitPass->SetBlendMode(BlendMode::REPLACE);
m_BlitPass->SetClearMode(ClearMode::COLOR_DEPTH_STENCIL);
m_BlitPass->SetCompareMode(CompareMode::LESS);
m_BlitPass->SetCullMode(CullMode::NONE);
}
RenderUtil::~RenderUtil()
{
if (m_LineVAO != 0)
glDeleteVertexArrays(1, &m_LineVAO);
if (m_LineVBO != 0)
glDeleteBuffers(1, &m_LineVBO);
}
void RenderUtil::Blit(const std::shared_ptr<Texture> &src, const std::shared_ptr<Texture> &dest,
const std::shared_ptr<Shader> &shader, ClearMode clearMode, BlendMode blendMode)
{
m_BlitPass->AddTexture(dest, false);
m_BlitPass->SetClearMode(clearMode);
m_BlitPass->SetBlendMode(blendMode);
m_BlitPass->Bind(true);
shader->Bind();
shader->BindTexture(src);
shader->BindMesh(MeshUtil::GetUnitQuad());
glDrawElements(GL_TRIANGLES, MeshUtil::GetUnitQuad()->Indices.Data.size(), GL_UNSIGNED_INT, 0);
shader->UnBind();
m_BlitPass->UnBind();
m_BlitPass->RemoveAllTextures();
m_TriangleCount += 2;
m_DrawCall++;
}
void RenderUtil::BeginDrawLines(const std::shared_ptr<SceneNode> &camera)
{
if (m_DrawingLine || m_LineVAO == 0 || m_LineVBO == 0 || m_DebugShader->GetDirty())
return;
m_DrawingLine = true;
m_DebugShader->Bind();
m_DebugShader->BindCamera(camera);
m_DebugShader->BindMatrix(Matrix4::WORLD_MATRIX, Matrix4());
glBindVertexArray(m_LineVAO);
glBindBuffer(GL_ARRAY_BUFFER, m_LineVBO);
}
void RenderUtil::DrawLines(const float* positions, unsigned int size, Color color, LineMode lineMode)
{
if (!m_DrawingLine)
{
FURYE << "Call BeginDrawLines(camera) before DrawLines(xxx)!";
return;
}
auto dataSize = sizeof(float) * size;
glBufferData(GL_ARRAY_BUFFER, dataSize, 0, GL_STREAM_DRAW);
glBufferSubData(GL_ARRAY_BUFFER, 0, dataSize, positions);
m_DebugShader->BindFloat("color", color.r, color.g, color.b);
glDrawArrays(EnumUtil::LineModeToUnit(lineMode), 0, size / 3);
m_DrawCall++;
}
void RenderUtil::DrawBoxBounds(const BoxBounds &aabb, Color color)
{
Vector4 min = aabb.GetMin();
Vector4 max = aabb.GetMax();
Vector4 cornors[] = {
min,
Vector4(max.x, min.y, min.z, 1.0f),
Vector4(min.x, max.y, min.z, 1.0f),
Vector4(max.x, max.y, min.z, 1.0f),
Vector4(min.x, min.y, max.z, 1.0f),
Vector4(max.x, min.y, max.z, 1.0f),
Vector4(min.x, max.y, max.z, 1.0f),
max
};
unsigned int indices[] = { 0, 1, 2, 3, 6, 7, 4, 5, 6, 2, 7, 3, 5, 1, 4, 0, 6, 4, 7, 5, 3, 1, 2, 0 };
std::vector<float> lines;
for (unsigned int i : indices)
{
Vector4 cornor = cornors[i];
lines.push_back(cornor.x);
lines.push_back(cornor.y);
lines.push_back(cornor.z);
}
DrawLines(&lines[0], lines.size(), color);
}
void RenderUtil::DrawFrustum(const Frustum &frustum, Color color)
{
auto corners = frustum.GetCurrentCorners();
unsigned int indices[] = { 0, 4, 1, 5, 3, 7, 2, 6, 0, 2, 2, 3, 3, 1, 1, 0, 4, 6, 6, 7, 7, 5, 5, 4 };
std::vector<float> lines;
for (unsigned int i : indices)
{
Vector4 cornor = corners[i];
lines.push_back(cornor.x);
lines.push_back(cornor.y);
lines.push_back(cornor.z);
}
DrawLines(&lines[0], lines.size(), color);
}
void RenderUtil::EndDrawLines()
{
m_DrawingLine = false;
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
m_DebugShader->UnBind();
}
void RenderUtil::BeginDrawMeshs(const std::shared_ptr<SceneNode> &camera)
{
if (m_DebugShader->GetDirty() || m_DrawingMesh)
return;
m_DrawingMesh = true;
m_DebugShader->Bind();
m_DebugShader->BindCamera(camera);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
}
void RenderUtil::DrawMesh(const std::shared_ptr<Mesh> &mesh, const Matrix4 &worldMatrix, Color color)
{
if (!m_DrawingMesh || mesh->IsSkinnedMesh() || mesh->GetSubMeshCount() > 0)
return;
m_DebugShader->BindFloat("color", color.r, color.g, color.b);
m_DebugShader->BindMatrix(Matrix4::WORLD_MATRIX, worldMatrix);
m_DebugShader->BindMesh(mesh);
glDrawElements(GL_TRIANGLES, mesh->Indices.Data.size(), GL_UNSIGNED_INT, 0);
m_DrawCall++;
}
void RenderUtil::EndDrawMeshes()
{
m_DrawingMesh = false;
m_DebugShader->UnBind();
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
}
void RenderUtil::BeginFrame()
{
m_DrawCall = 0;
m_MeshCount = 0;
m_TriangleCount = 0;
m_SkinnedMeshCount = 0;
m_LightCount = 0;
m_FrameClock.restart();
OnBeginFrame.Emit();
}
void RenderUtil::EndFrame()
{
auto frameTime = m_FrameClock.restart().asMilliseconds();
OnEndFrame.Emit(std::move(frameTime));
}
void RenderUtil::IncreaseDrawCall(unsigned int count)
{
m_DrawCall += count;
}
unsigned int RenderUtil::GetDrawCall()
{
return m_DrawCall;
}
void RenderUtil::IncreaseMeshCount(unsigned int count)
{
m_MeshCount += count;
}
unsigned int RenderUtil::GetMeshCount()
{
return m_MeshCount;
}
void RenderUtil::IncreaseTriangleCount(unsigned int count)
{
m_TriangleCount += count;
}
unsigned int RenderUtil::GetTriangleCount()
{
return m_TriangleCount;
}
void RenderUtil::IncreaseSkinnedMeshCount(unsigned int count)
{
m_SkinnedMeshCount += count;
}
unsigned int RenderUtil::GetSkinnedMeshCount()
{
return m_SkinnedMeshCount;
}
void RenderUtil::IncreaseLightCount(unsigned int count)
{
m_LightCount += count;
}
unsigned int RenderUtil::GetLightCount()
{
return m_LightCount;
}
} |
4889d5f427f5535c4dee22abba6eb2d11854d45d | 29dd30a62c2ec7089897b485f81ab3b3a3d4ec3f | /AddressBook/ContactView.cpp | 69f19152421a97a7ab517b90cb7f2f3b555b56d3 | [] | no_license | WZYFX/keyhotee | e988568f6ba8dca3bedd1e2d23734785813590e6 | 4bc506b61a67564afb76dd9535393a4ad8de4ca0 | refs/heads/master | 2021-01-17T11:33:13.542506 | 2013-12-09T07:09:29 | 2013-12-09T07:09:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 16,375 | cpp | ContactView.cpp | #include "ContactView.hpp"
#include "ui_ContactView.h"
#include "AddressBookModel.hpp"
#include "public_key_address.hpp"
#include <KeyhoteeMainWindow.hpp>
#include <bts/application.hpp>
#include <bts/address.hpp>
#include <fc/thread/thread.hpp>
#include <fc/log/logger.hpp>
#include <QtWebKitWidgets/QWebFrame>
extern bool gMiningIsPossible;
bool ContactView::eventFilter(QObject* object, QEvent* event)
{
if (event->type() == QEvent::KeyPress)
{
QKeyEvent* key_event = static_cast<QKeyEvent*>(event);
switch(key_event->key())
{
case Qt::Key_Enter:
case Qt::Key_Return:
sendChatMessage();
return true;
default:
break;
}
}
return QObject::eventFilter(object, event);
}
bool ContactView::isChatSelected()
{
return (ui->contact_pages->currentWidget() == ui->chat_page);
}
void ContactView::sendChatMessage()
{
auto msg = ui->chat_input->toPlainText();
if( msg.size() != 0 )
{
auto app = bts::application::instance();
auto profile = app->get_profile();
auto idents = profile->identities();
bts::bitchat::private_text_message text_msg( msg.toStdString() );
if( idents.size() )
{
fc::ecc::private_key my_priv_key = profile->get_keychain().get_identity_key( idents[0].dac_id );
app->send_text_message( text_msg, _current_contact.public_key, my_priv_key );
appendChatMessage( "me", msg );
}
ui->chat_input->setPlainText(QString());
}
}
void ContactView::appendChatMessage( const QString& from, const QString& msg, const QDateTime& date_time )
{ //DLNFIX2 improve formatting later
wlog( "append... ${msg}", ("msg",msg.toStdString() ) );
QString formatted_msg = date_time.toString("hh:mm ap") + " "+ from + ": " + msg;
#if 1
QColor color;
if (from == "me")
color = "grey";
else
color = "black";
ui->chat_conversation->setTextColor(color);
ui->chat_conversation->append(formatted_msg);
#else //this doesn't start new paragraphs, probably not worth spending
//time on as we'll like junk in favor of somethng else later
QTextCursor text_cursor = ui->chat_conversation->textCursor();
QString colorName = (from == "me") ? "grey" : "black";
formatted_msg = QString("<font color=\"%1\">%2</font>").arg(colorName).arg(formatted_msg);
ui->chat_conversation->insertHtml(formatted_msg);
cursor.movePosition(QTextCursor::NextBlock);
ui->chat_conversation->setTextCursor(text_cursor);
#endif
}
ContactView::ContactView( QWidget* parent )
: QWidget(parent),
ui( new Ui::ContactView() )
{
_address_book = nullptr;
ui->setupUi(this);
//ui->chat_conversation->setHtml( "<html><head></head><body>Hello World<br/></body></html>" );
connect( ui->save_button, &QPushButton::clicked, this, &ContactView::onSave );
connect( ui->cancel_button, &QPushButton::clicked, this, &ContactView::onCancel );
connect( ui->edit_button, &QPushButton::clicked, this, &ContactView::onEdit );
connect( ui->mail_button, &QAbstractButton::clicked, this, &ContactView::onMail );
connect( ui->chat_button, &QAbstractButton::clicked, this, &ContactView::onChat );
connect( ui->info_button, &QAbstractButton::clicked, this, &ContactView::onInfo );
connect( ui->firstname, &QLineEdit::textChanged, this, &ContactView::firstNameChanged );
connect( ui->lastname, &QLineEdit::textChanged, this, &ContactView::lastNameChanged );
connect( ui->id_edit, &QLineEdit::textChanged, this, &ContactView::keyhoteeIdChanged );
connect( ui->id_edit, &QLineEdit::textEdited, this, &ContactView::keyhoteeIdEdited );
connect( ui->public_key, &QLineEdit::textEdited, this, &ContactView::publicKeyEdited );
ui->chat_input->installEventFilter(this);
setContact( Contact() );
}
void ContactView::onEdit()
{
ui->contact_pages->setCurrentWidget( ui->info_page );
ui->info_stack->setCurrentWidget(ui->info_edit);
}
void ContactView::onSave()
{ try {
_current_contact.first_name = ui->firstname->text().toStdString();
_current_contact.last_name = ui->lastname->text().toStdString();
_current_contact.dac_id_string = ui->id_edit->text().toStdString();
if( _current_record )
{
//_current_contact.bit_id_hash = _current_record->name_hash;
if( !_current_contact.public_key.valid() )
{
_current_contact.public_key = _current_record->active_key;
FC_ASSERT( _current_contact.public_key.valid() );
}
// TODO: lookup block id / timestamp that registered this ID
// _current_contact.known_since.setMSecsSinceEpoch( );
}
else if( !_current_record ) /// note: user is entering manual public key
{
elog( "!current record??\n" );
/*
if( _current_contact.known_since == QDateTime() )
{
_current_contact.known_since = QDateTime::currentDateTime();
}
*/
public_key_address key_address(ui->public_key->text().toStdString());
_current_contact.public_key = key_address.key;
}
_current_contact.privacy_setting = bts::addressbook::secret_contact;
_address_book->storeContact( _current_contact );
//DLNFIX
#if 1
ui->info_stack->setCurrentWidget(ui->info_status);
ui->chat_button->setEnabled(true);
ui->mail_button->setEnabled(true);
ui->info_button->setEnabled(true);
ui->info_button->setChecked(true);
#else
setContact(_current_contact,ContactView::info);
#endif
} FC_RETHROW_EXCEPTIONS( warn, "onSave" ) }
void ContactView::onCancel()
{
ui->info_stack->setCurrentWidget(ui->info_status);
ui->firstname->setText( _current_contact.first_name.c_str() );
ui->lastname->setText( _current_contact.last_name.c_str() );
ui->id_edit->setText( _current_contact.dac_id_string.c_str() );
updateNameLabel();
}
void ContactView::onChat()
{
ui->contact_pages->setCurrentWidget( ui->chat_page );
//clear unread message count on display of chat window
//DLNFIX maybe getMainWindow can be removed via some connect magic or similar observer notification?
ContactGui* contact_gui = GetKeyhoteeWindow()->getContactGui(_current_contact.wallet_index);
if (contact_gui)
contact_gui->setUnreadMsgCount(0);
ui->chat_input->setFocus();
}
void ContactView::onInfo()
{
ui->info_stack->setCurrentWidget(ui->info_status);
ui->contact_pages->setCurrentWidget( ui->info_page );
}
void ContactView::onMail()
{
GetKeyhoteeWindow()->newMailMessageTo(_current_contact.wallet_index);
}
void ContactView::onDelete()
{
}
ContactView::~ContactView()
{
}
void ContactView::setContact( const Contact& current_contact,
ContactDisplay contact_display )
{ try {
_current_contact = current_contact;
bool has_null_public_key = _current_contact.public_key == fc::ecc::public_key_data();
if ( has_null_public_key )
{
elog( "********* null public key!" );
ui->save_button->setEnabled(false);
ui->chat_button->setEnabled(false);
ui->mail_button->setEnabled(false);
ui->save_button->setEnabled(false);
ui->info_button->setEnabled(false);
ui->info_button->setChecked(true);
onEdit();
if (gMiningIsPossible)
ui->id_status->setText( tr( "Please provide a valid ID or public key" ) );
else
{
ui->id_status->setText( tr( "Public Key Only Mode" ) );
}
if( _current_contact.first_name == std::string() && _current_contact.last_name == std::string() )
{
ui->name_label->setText( tr( "New Contact" ) );
ui->id_edit->setText( QString() );
ui->public_key->setText( QString() );
//keyhoteeIds don't function when mining is not possible
if (!gMiningIsPossible)
ui->id_edit->setEnabled(false);
}
}
else
{
/// note: you cannot change the id of a contact once it has been
/// set... you must create a new contact anytime their public key
/// changes.
ui->id_edit->setEnabled(false);
ui->save_button->setEnabled(true);
ui->chat_button->setEnabled(true);
ui->mail_button->setEnabled(true);
ui->info_button->setEnabled(true);
if (contact_display == chat)
{
ui->chat_button->setChecked(true);
onChat();
}
else
{
ui->info_button->setChecked(true);
onInfo();
}
/** TODO... restore this kind of check
if( _current_contact.bit_id_public_key != _current_contact.public_key )
{
ui->id_status->setText(
tr( "Warning! Keyhotee ID %1 no longer matches known public key!" ).arg(_current_contact.bit_id) );
}
*/
}
ui->firstname->setText( _current_contact.first_name.c_str() );
ui->lastname->setText( _current_contact.last_name.c_str() );
// ui->email->setText( _current_contact.email_address );
// ui->phone->setText( _current_contact.phone_number );
std::string public_key_string = public_key_address( _current_contact.public_key );
ui->public_key_view->setText( public_key_string.c_str() );
ui->id_edit->setText( _current_contact.dac_id_string.c_str() );
ui->icon_view->setIcon( _current_contact.getIcon() );
} FC_RETHROW_EXCEPTIONS( warn, "" ) }
Contact ContactView::getContact()const
{
return _current_contact;
}
void ContactView::firstNameChanged( const QString& /*name*/ )
{
updateNameLabel();
}
void ContactView::keyhoteeIdChanged( const QString& /*name*/ )
{
updateNameLabel();
}
void ContactView::updateNameLabel()
{
auto full_name = ui->firstname->text() + " " + ui->lastname->text();
QString dac_id = ui->id_edit->text();
if (dac_id != QString())
full_name += "(" + dac_id + ")";
if( full_name != " " )
{
ui->name_label->setText(full_name);
}
else
{
ui->name_label->setText(tr( "New Contact" ));
}
}
void ContactView::lastNameChanged( const QString& /*name*/ )
{
updateNameLabel();
}
/***************** Algorithm for handling keyhoteeId, keyhoteeeId status, and public key fields
Notes:
If gMiningIsPossible,
We can lookup a public key from a kehoteeId
We can validate a public key is registered,
but we can't lookup the associated keyhoteeId, only a hash of the keyhoteeId
Some choices in Display Status for id not found on block chain: Available, Unable to find, Not registered
*** When creating new identity (this is for later implementation and some details may change):
Note: Public key field is not editable (only keyhotee-generated public keys are allowed as they must be tied to wallet)
If gMiningPossible,
Display Mining Effort combo box:
options: Let Expire, Renew Quarterly, Renew Monthly, Renew Weekly, Renew Daily, Max Effort
If keyhoteeId changed, lookup id and report status
Display status: Not Available (red), Available (black), Registered To Me (green), Registering (yellow)
(If keyhoteeId is not registered and mining effort is not 'Let Expire', then status is "Registering')
OR:
Display status: Registered (red), Not Registered (black), Registered To Me (green), Registering (yellow)
(If keyhoteeId is not registered and mining effort is not 'Let Expire', then status is "Registering')
Generate new public key based on keyhoteeId change and display it
If not gMiningPossible,
Hide Mining Effort combo box:
If keyhoteeId changed, just keep it
Generate new public key based on keyhoteeId change and display it
*** When adding a contact:
If gMiningPossible,
If keyhoteeId changed, lookup id and report status
Display status: Registered (green), Unable to find (red)
if keyhoteeId registered in block chain, set public key field to display it
if keyhoteeId field not registered in block chain, clear public key field
enable save if valid public key or disable save
If public key changed, validate it
if public key is registered, change keyhotee field to ********
if public key is not registered, clear keyhotee id field
enable save if valid public key or disable save
If not gMiningPossible,
Disable keyhoteeId field
If public key changed, validate it
enable save if valid public key or disable save
*** When editing a contact:
If gMiningPossible,
Public key is not editable
if keyhotee set, set as not editable
If keyhoteeId blank, lookup id and report status
Display status: Matches (green)
Mismatch (red)
Doesn't save keyhoteeId on mismatch (i.e. field data isn't transferred to the contact record)
If not gMiningPossible,
Public key is not editable
KeyhoteeId is not editable
*/
void ContactView::keyhoteeIdEdited( const QString& id )
{
/** TODO
if( is_address( id ) )
{
_complete = true;
}
else
*/
{
_last_validate = fc::time_point::now();
ui->id_status->setText( tr( "Looking up id..." ) );
fc::async( [=](){
fc::usleep( fc::microseconds(500*1000) );
if( fc::time_point::now() > (_last_validate + fc::microseconds(500*1000)) )
{
lookupId();
}
} );
}
updateNameLabel();
}
//implement real version and put in bitshares or fc (probably should be in fc)
bool is_valid_public_key(const std::string& public_key_string)
{
return public_key_address(public_key_string).is_valid();
}
//implement real version and put in bitshares or fc (probably should be in fc)
bool is_registered_public_key(std::string public_key_string)
{
return false; //(public_key_string == "invictus");
}
void ContactView::publicKeyEdited( const QString& public_key_string )
{
ui->id_edit->clear(); //clear keyhotee id field
if (gMiningIsPossible)
{
lookupPublicKey();
}
//check for validly hashed public key and enable/disable save button accordingly
bool public_key_is_valid = is_valid_public_key(public_key_string.toStdString());
if (public_key_is_valid)
{
ui->id_status->setText( tr("Public Key Only Mode: valid key") );
ui->id_status->setStyleSheet("QLabel { color : green; }");
}
else
{
ui->id_status->setText( tr("Public Key Only Mode: not a valid key") );
ui->id_status->setStyleSheet("QLabel { color : red; }");
}
ui->save_button->setEnabled(public_key_is_valid);
}
void ContactView::lookupId()
{
try {
auto current_id = ui->id_edit->text().toStdString();
if( current_id.empty() )
{
ui->id_status->setText( QString() );
ui->save_button->setEnabled(false);
return;
}
_current_record = bts::application::instance()->lookup_name( current_id );
if( _current_record )
{
ui->id_status->setStyleSheet("QLabel { color : green; }");
ui->id_status->setText( tr( "Registered" ) );
std::string public_key_string = public_key_address(_current_record->active_key);
ui->public_key->setText( public_key_string.c_str() );
if( _address_book != nullptr )
ui->save_button->setEnabled(true);
}
else
{
ui->id_status->setStyleSheet("QLabel { color : red; }");
ui->id_status->setText( tr( "Unable to find ID" ) );
ui->public_key->setText(QString());
ui->save_button->setEnabled(false);
}
}
catch ( const fc::exception& e )
{
ui->id_status->setText( e.to_string().c_str() );
}
}
void ContactView::lookupPublicKey()
{
std::string public_key_string = ui->public_key->text().toStdString();
//fc::ecc::public_key public_key;
//bts::bitname::client::reverse_name_lookup( public_key );
bool public_key_is_registered = is_registered_public_key(public_key_string);
if (public_key_is_registered)
ui->id_edit->setText("********"); //any better idea to indicate unknown but keyhoteeId?
else
ui->id_edit->setText(QString()); //clear keyhotee field if unregistered public key
}
void ContactView::setAddressBook( AddressBookModel* addressbook )
{
_address_book = addressbook;
}
AddressBookModel* ContactView::getAddressBook()const
{
return _address_book;
}
|
b7f3ff7a32f5221c6ca600bb85cd888dd92c22ee | 25245cdad68304c439d7bb15f6efc80dc431df54 | /Learn_Game/Frame.h | d10e5829786e4756d24fe99ecdde520789f457e1 | [] | no_license | ArturKnopik/Game | f25dc52f7d5b4e3c99bab9a5c02f53f9c00c4c24 | a6e49532097523acbd39bba967a81c9eaed3aafc | refs/heads/master | 2023-02-24T17:26:13.255822 | 2021-02-02T17:49:37 | 2021-02-02T17:49:37 | 166,843,827 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 342 | h | Frame.h | #pragma once
#include "SFML/Graphics/Rect.hpp"
#include <vector>
namespace TCG
{
class Frame
{
double timeToNextFrame = 0.5;
sf::IntRect imagePosition;
public:
Frame() = delete;
Frame(sf::IntRect imagePosition, double timeToNextFrame = 0.1);
const double getMaxFrameTime() const;
const sf::IntRect getFrameRect() const;
};
}
|
89f5ee5f931188c561cc28c8d800f128ec10d79e | 24b48bbf173884f943cdbba78d2f544ae69bb89a | /src/math/segment2d.h | 5d6f7603e1e9312719cdd111ccc21a0707d4478d | [] | no_license | drodri/MRCore | 854a869595fa685c09cfe3be7f1ace290ce3b739 | 91710f2ba6a9967e4c637f566fdca38f28374220 | refs/heads/master | 2016-08-05T10:20:27.820811 | 2013-07-22T15:13:41 | 2013-07-24T10:18:43 | 3,554,360 | 5 | 4 | null | 2013-07-23T10:19:00 | 2012-02-26T19:56:52 | C++ | UTF-8 | C++ | false | false | 750 | h | segment2d.h | #pragma once
#include <iostream>
#include "transformation2d.h"
#include "../base/globject.h"
#include "gl/gltools.h"
using namespace std;
namespace mr{
class Segment2D
{
friend class Interactions;
public:
//constructors
Segment2D(){;}
Segment2D(const Vector2D& v1,const Vector2D& v2):p1(v1),p2(v2){;}
virtual ~Segment2D(void){;}
double distance(const Vector2D& p) const
{
Vector2D v1=p-p1;//(s.source,p);
Vector2D v2=p2-p1;//(s.source,s.target);
double lambda=(v1*v2)/(v2*v2);
if(lambda>=1)
return p.distance(p2);//squaredDistance(p,target);
if(lambda<=0)
return p.distance(p1);
Vector2D proj=p1+v2*lambda;//projection point
return p.distance(proj);
}
Vector2D p1;
Vector2D p2;///<orientation p1->p2
};
}
|
06670917cedcac741a8a047adb89c3bf2fc2eb07 | 3ff1fe3888e34cd3576d91319bf0f08ca955940f | /ssm/src/v20190923/model/CreateSecretRequest.cpp | 5414c487415b3991cee6276ba4eb925fb36981b3 | [
"Apache-2.0"
] | permissive | TencentCloud/tencentcloud-sdk-cpp | 9f5df8220eaaf72f7eaee07b2ede94f89313651f | 42a76b812b81d1b52ec6a217fafc8faa135e06ca | refs/heads/master | 2023-08-30T03:22:45.269556 | 2023-08-30T00:45:39 | 2023-08-30T00:45:39 | 188,991,963 | 55 | 37 | Apache-2.0 | 2023-08-17T03:13:20 | 2019-05-28T08:56:08 | C++ | UTF-8 | C++ | false | false | 7,252 | cpp | CreateSecretRequest.cpp | /*
* Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <tencentcloud/ssm/v20190923/model/CreateSecretRequest.h>
#include <tencentcloud/core/utils/rapidjson/document.h>
#include <tencentcloud/core/utils/rapidjson/writer.h>
#include <tencentcloud/core/utils/rapidjson/stringbuffer.h>
using namespace TencentCloud::Ssm::V20190923::Model;
using namespace std;
CreateSecretRequest::CreateSecretRequest() :
m_secretNameHasBeenSet(false),
m_versionIdHasBeenSet(false),
m_descriptionHasBeenSet(false),
m_kmsKeyIdHasBeenSet(false),
m_secretTypeHasBeenSet(false),
m_secretBinaryHasBeenSet(false),
m_secretStringHasBeenSet(false),
m_additionalConfigHasBeenSet(false),
m_tagsHasBeenSet(false)
{
}
string CreateSecretRequest::ToJsonString() const
{
rapidjson::Document d;
d.SetObject();
rapidjson::Document::AllocatorType& allocator = d.GetAllocator();
if (m_secretNameHasBeenSet)
{
rapidjson::Value iKey(rapidjson::kStringType);
string key = "SecretName";
iKey.SetString(key.c_str(), allocator);
d.AddMember(iKey, rapidjson::Value(m_secretName.c_str(), allocator).Move(), allocator);
}
if (m_versionIdHasBeenSet)
{
rapidjson::Value iKey(rapidjson::kStringType);
string key = "VersionId";
iKey.SetString(key.c_str(), allocator);
d.AddMember(iKey, rapidjson::Value(m_versionId.c_str(), allocator).Move(), allocator);
}
if (m_descriptionHasBeenSet)
{
rapidjson::Value iKey(rapidjson::kStringType);
string key = "Description";
iKey.SetString(key.c_str(), allocator);
d.AddMember(iKey, rapidjson::Value(m_description.c_str(), allocator).Move(), allocator);
}
if (m_kmsKeyIdHasBeenSet)
{
rapidjson::Value iKey(rapidjson::kStringType);
string key = "KmsKeyId";
iKey.SetString(key.c_str(), allocator);
d.AddMember(iKey, rapidjson::Value(m_kmsKeyId.c_str(), allocator).Move(), allocator);
}
if (m_secretTypeHasBeenSet)
{
rapidjson::Value iKey(rapidjson::kStringType);
string key = "SecretType";
iKey.SetString(key.c_str(), allocator);
d.AddMember(iKey, m_secretType, allocator);
}
if (m_secretBinaryHasBeenSet)
{
rapidjson::Value iKey(rapidjson::kStringType);
string key = "SecretBinary";
iKey.SetString(key.c_str(), allocator);
d.AddMember(iKey, rapidjson::Value(m_secretBinary.c_str(), allocator).Move(), allocator);
}
if (m_secretStringHasBeenSet)
{
rapidjson::Value iKey(rapidjson::kStringType);
string key = "SecretString";
iKey.SetString(key.c_str(), allocator);
d.AddMember(iKey, rapidjson::Value(m_secretString.c_str(), allocator).Move(), allocator);
}
if (m_additionalConfigHasBeenSet)
{
rapidjson::Value iKey(rapidjson::kStringType);
string key = "AdditionalConfig";
iKey.SetString(key.c_str(), allocator);
d.AddMember(iKey, rapidjson::Value(m_additionalConfig.c_str(), allocator).Move(), allocator);
}
if (m_tagsHasBeenSet)
{
rapidjson::Value iKey(rapidjson::kStringType);
string key = "Tags";
iKey.SetString(key.c_str(), allocator);
d.AddMember(iKey, rapidjson::Value(rapidjson::kArrayType).Move(), allocator);
int i=0;
for (auto itr = m_tags.begin(); itr != m_tags.end(); ++itr, ++i)
{
d[key.c_str()].PushBack(rapidjson::Value(rapidjson::kObjectType).Move(), allocator);
(*itr).ToJsonObject(d[key.c_str()][i], allocator);
}
}
rapidjson::StringBuffer buffer;
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
d.Accept(writer);
return buffer.GetString();
}
string CreateSecretRequest::GetSecretName() const
{
return m_secretName;
}
void CreateSecretRequest::SetSecretName(const string& _secretName)
{
m_secretName = _secretName;
m_secretNameHasBeenSet = true;
}
bool CreateSecretRequest::SecretNameHasBeenSet() const
{
return m_secretNameHasBeenSet;
}
string CreateSecretRequest::GetVersionId() const
{
return m_versionId;
}
void CreateSecretRequest::SetVersionId(const string& _versionId)
{
m_versionId = _versionId;
m_versionIdHasBeenSet = true;
}
bool CreateSecretRequest::VersionIdHasBeenSet() const
{
return m_versionIdHasBeenSet;
}
string CreateSecretRequest::GetDescription() const
{
return m_description;
}
void CreateSecretRequest::SetDescription(const string& _description)
{
m_description = _description;
m_descriptionHasBeenSet = true;
}
bool CreateSecretRequest::DescriptionHasBeenSet() const
{
return m_descriptionHasBeenSet;
}
string CreateSecretRequest::GetKmsKeyId() const
{
return m_kmsKeyId;
}
void CreateSecretRequest::SetKmsKeyId(const string& _kmsKeyId)
{
m_kmsKeyId = _kmsKeyId;
m_kmsKeyIdHasBeenSet = true;
}
bool CreateSecretRequest::KmsKeyIdHasBeenSet() const
{
return m_kmsKeyIdHasBeenSet;
}
uint64_t CreateSecretRequest::GetSecretType() const
{
return m_secretType;
}
void CreateSecretRequest::SetSecretType(const uint64_t& _secretType)
{
m_secretType = _secretType;
m_secretTypeHasBeenSet = true;
}
bool CreateSecretRequest::SecretTypeHasBeenSet() const
{
return m_secretTypeHasBeenSet;
}
string CreateSecretRequest::GetSecretBinary() const
{
return m_secretBinary;
}
void CreateSecretRequest::SetSecretBinary(const string& _secretBinary)
{
m_secretBinary = _secretBinary;
m_secretBinaryHasBeenSet = true;
}
bool CreateSecretRequest::SecretBinaryHasBeenSet() const
{
return m_secretBinaryHasBeenSet;
}
string CreateSecretRequest::GetSecretString() const
{
return m_secretString;
}
void CreateSecretRequest::SetSecretString(const string& _secretString)
{
m_secretString = _secretString;
m_secretStringHasBeenSet = true;
}
bool CreateSecretRequest::SecretStringHasBeenSet() const
{
return m_secretStringHasBeenSet;
}
string CreateSecretRequest::GetAdditionalConfig() const
{
return m_additionalConfig;
}
void CreateSecretRequest::SetAdditionalConfig(const string& _additionalConfig)
{
m_additionalConfig = _additionalConfig;
m_additionalConfigHasBeenSet = true;
}
bool CreateSecretRequest::AdditionalConfigHasBeenSet() const
{
return m_additionalConfigHasBeenSet;
}
vector<Tag> CreateSecretRequest::GetTags() const
{
return m_tags;
}
void CreateSecretRequest::SetTags(const vector<Tag>& _tags)
{
m_tags = _tags;
m_tagsHasBeenSet = true;
}
bool CreateSecretRequest::TagsHasBeenSet() const
{
return m_tagsHasBeenSet;
}
|
820566efea31bc99a2b55cfb7bde8f1dfc76d480 | 519b7621d5e0bb4d8a134c6f5d7d1d780916094b | /src/main.cpp | 70a13adda9eb4c9b2785b618499a5e96cc9088bf | [] | no_license | Heych88/udacity-sdcnd-PID-Control | 98bdbe77481812920ca1f64a63ce7c0719252336 | 62c4b20d986c4e3a77453248b5499ce6a4beceb3 | refs/heads/master | 2021-01-01T06:24:58.150518 | 2017-07-19T01:14:41 | 2017-07-19T01:14:41 | 97,424,245 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,187 | cpp | main.cpp | #include <uWS/uWS.h>
#include <iostream>
#include "json.hpp"
#include "PID.h"
#include <math.h>
// for convenience
using json = nlohmann::json;
// For converting back and forth between radians and degrees.
constexpr double pi() { return M_PI; }
double deg2rad(double x) { return x * pi() / 180; }
double rad2deg(double x) { return x * 180 / pi(); }
// Checks if the SocketIO event has JSON data.
// If there is data the JSON object in string format will be returned,
// else the empty string "" will be returned.
std::string hasData(std::string s) {
auto found_null = s.find("null");
auto b1 = s.find_first_of("[");
auto b2 = s.find_last_of("]");
if (found_null != std::string::npos) {
return "";
}
else if (b1 != std::string::npos && b2 != std::string::npos) {
return s.substr(b1, b2 - b1 + 1);
}
return "";
}
// Belows code is copied from Andrey Glushko slack thread
// https://carnd.slack.com/archives/C4Z4GFX0X/p1495663199162875?thread_ts=1495550577.287993&cid=C4Z4GFX0X
// reset the simulator when the car goes off the track or when a lap has
// completed. Only used when using twiddle.
void resetSimulator(uWS::WebSocket<uWS::SERVER>& ws)
{
// reset
std::string msg("42[\"reset\", {}]");
ws.send(msg.data(), msg.length(), uWS::OpCode::TEXT);
}
// uses a hill climbing method to find good parameters.
// twiddle works as follows
// 1. init the parameters with their starting values, often all zero
// 2. run the system and observer the error
// 3A. if the first run, save the error as the best error
// 3B. not first, compare the error with the best error and update as:
// A. best error so far, increase the current adjustable parameter by 1.1 times
// its current value.
// B. worse error, decrease the current parameter by the 2 * delta size variable
// and also decrease the value of the delta variable.
// 4. check if the error or the delta value is below the accepted threshold level
// or runtime has not been exceeded.
// 5. repeat steps 2 to 4 until step 4 is no longer valid
// 6. change to the next parameter to be tuned, with the previous tuned parameters
// and repeat steps 2 to 5 until all parameters have been tuned.
//
// as it stands, this code is buggy and only finds workable system parameters.
// TODO: Add a sum of cte error to check for more accurate runs.
// TODO: Check for crashes when the speed goes below 1Mph
void twiddle(PID &steer_pid, double cte, uWS::WebSocket<uWS::SERVER>& ws) {
if((cte >= 5.0) || (cte <= -5.0) || (steer_pid.current_twiddle > 3000)) {
if(steer_pid.first_run){
// if it is the first run, set the best error
steer_pid.first_run = false;
steer_pid.best_twiddle = steer_pid.current_twiddle;
}
if(steer_pid.current_twiddle > steer_pid.best_twiddle) {
// the parameters improved the error so keep improving the parameters
steer_pid.best_twiddle = steer_pid.current_twiddle;
steer_pid.delta_params[steer_pid.current_param] *= 1.1;
} else {
// parameters decreased accuracy so decrease them.
steer_pid.delta_params[steer_pid.current_param] -= 2 * steer_pid.delta_params[steer_pid.current_param];
steer_pid.params[steer_pid.current_param] += steer_pid.delta_params[steer_pid.current_param];
steer_pid.delta_params[steer_pid.current_param] *= 0.9;
}
// check if the error or timeout has passed the threshold to tune the next
// parameter.
if((fabs(steer_pid.delta_params[steer_pid.current_param]) < steer_pid.params_thresh[steer_pid.current_param])
|| (steer_pid.current_twiddle > 3000)){
steer_pid.current_param++;
steer_pid.best_twiddle = 0;
steer_pid.first_run = true;
if(steer_pid.current_param >= 3){
// all the parameters are tuned so stop twiddeling
steer_pid.use_twiddle = false;
}
}
// update the controller parameters to the latest values for the next run
steer_pid.current_twiddle = 0;
steer_pid.Kp = steer_pid.params[0];
steer_pid.Ki = steer_pid.params[1];
steer_pid.Kd = steer_pid.params[2];
resetSimulator(ws); // reset the simulator
} else {
steer_pid.current_twiddle++;
}
}
int main()
{
uWS::Hub h;
// Initialize the steering PID controller
PID steer_pid;
bool use_twiddel = false;
double steer_kp, steer_kd, steer_ki;
if(use_twiddel) {
// set the twiddle inital parameters.
steer_kp = steer_pid.params[0];
steer_ki = steer_pid.params[1];
steer_kd = steer_pid.params[2];
} else {
// twiddle optimal parameters Kp: -0.091 Ki: -0.01 Kd: -1.52121
// manual good parameters Kp: -0.13 Ki: -0.002 Kd: -2.5
steer_kp = -0.091; // -0.13
steer_kd = -1.52121; // -2.5
steer_ki = -0.001; // -0.002
}
steer_pid.Init(steer_kp, steer_ki, steer_kd, 1, -1, use_twiddel);
// Initialize the speed PID controller
// these have been manually tuned by using the following steps
// 1. Set all parameters to 0
// 2. Increase only Kp and observe the speed
// 3. Increase the value until the cars speed oscillates around the target
// speed decrease if excessive oscillation
// 4. Repeat step 3 until the speed is slightly oscillating about the target speed
// 5. Repeat steps 2 to 4 now with the derivative Kd parameter until the
// osscilations subside/stop. The result may not be exactly the target speed,
// but the goal is to stop the oscillations.
// 6. Repeat steps 2 to 4 now with the integral Ki parameter until the speed
// is the same as the target speed.
PID speed_pid;
double speed_kp = 0.5;
double speed_ki = 0.00024;
double speed_kd = 1.1;
speed_pid.Init(speed_kp, speed_ki, speed_kd);
h.onMessage([&steer_pid, &speed_pid](uWS::WebSocket<uWS::SERVER> ws, char *data, size_t length, uWS::OpCode opCode) {
// "42" at the start of the message means there's a websocket message event.
// The 4 signifies a websocket message
// The 2 signifies a websocket event
if (length && length > 2 && data[0] == '4' && data[1] == '2')
{
auto s = hasData(std::string(data).substr(0, length));
if (s != "") {
auto j = json::parse(s);
std::string event = j[0].get<std::string>();
if (event == "telemetry") {
// j[1] is the data JSON object
double cte = std::stod(j[1]["cte"].get<std::string>());
double speed = std::stod(j[1]["speed"].get<std::string>());
double angle = std::stod(j[1]["steering_angle"].get<std::string>());
/*
* TODO: Calcuate steering value here, remember the steering value is
* [-1, 1].
* NOTE: Feel free to play around with the throttle and speed. Maybe use
* another PID controller to control the speed!
*/
if(steer_pid.use_twiddle){
// run twiddle to find the best steering parameters
twiddle(steer_pid, cte, ws);
// twidle parameter check for DEBUG
std::cout << "Kp: " << steer_pid.Kp << " Ki: " << steer_pid.Ki << " "
"Kd: " << steer_pid.Kd << " ct: " << steer_pid.current_twiddle <<
" bt: " << steer_pid.best_twiddle << " cp " << steer_pid.current_param
<< std::endl;
}
steer_pid.UpdateError(cte);
double steer_value = steer_pid.output;
// run the speed PID controller
double desired_speed = 50; // mph
double error = desired_speed - speed;
speed_pid.UpdateError(error);
double throttle_value = speed_pid.output;
// DEBUG
std::cout << "CTE: " << cte << " Steering Value: " << steer_value << std::endl;
json msgJson;
msgJson["steering_angle"] = steer_value;
msgJson["throttle"] = throttle_value;
auto msg = "42[\"steer\"," + msgJson.dump() + "]";
std::cout << msg << std::endl;
ws.send(msg.data(), msg.length(), uWS::OpCode::TEXT);
}
} else {
// Manual driving
std::string msg = "42[\"manual\",{}]";
ws.send(msg.data(), msg.length(), uWS::OpCode::TEXT);
}
}
});
// We don't need this since we're not using HTTP but if it's removed the program
// doesn't compile :-(
h.onHttpRequest([](uWS::HttpResponse *res, uWS::HttpRequest req, char *data, size_t, size_t) {
const std::string s = "<h1>Hello world!</h1>";
if (req.getUrl().valueLength == 1)
{
res->end(s.data(), s.length());
}
else
{
// i guess this should be done more gracefully?
res->end(nullptr, 0);
}
});
h.onConnection([&h](uWS::WebSocket<uWS::SERVER> ws, uWS::HttpRequest req) {
std::cout << "Connected!!!" << std::endl;
});
h.onDisconnection([&h](uWS::WebSocket<uWS::SERVER> ws, int code, char *message, size_t length) {
ws.close();
std::cout << "Disconnected" << std::endl;
});
int port = 4567;
if (h.listen(port))
{
std::cout << "Listening to port " << port << std::endl;
}
else
{
std::cerr << "Failed to listen to port" << std::endl;
return -1;
}
h.run();
}
|
e25b23ec86b3d6d80a6376e1763c0a7339a9f4a4 | 23f52d5e77c8b88318494ad95fc0bba8f391d4b0 | /main.cpp | 2b9a36eb1970478658d4993143caa1850f1b05d9 | [] | no_license | justanotherminh/LinkedList | f549001c39d5eb45f153d5ac141af65816b80cff | b7ce5d82e683b518aafd3d82f416a053bf50aa19 | refs/heads/master | 2021-09-16T19:57:36.342973 | 2018-06-24T06:42:08 | 2018-06-24T06:42:08 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 191 | cpp | main.cpp | //
// Created by Nguyen Luong Minh on 6/19/18.
//
#include "LinkedList.h"
int main() {
LinkedList<string> list;
list << "Hello" << "World";
cout << list << endl;
return 0;
} |
ca09df8e40547a6b9a3b0a11d3f222e5fffabce9 | 5ad3cd78a661fc5ecc283b6fff2575858d88b546 | /ray-tracer-v2/src/myUtil.cpp | bf3660ee741ec2742ed833e57f65b1a4eb8b19c2 | [] | no_license | PhilO42/ray-tracer-v1 | 6ce4853ae02cb06fe35eb720fa09d1e72295f9cb | 6bab5582ad835bdbc508eb4ecc8e886c469d9cf7 | refs/heads/master | 2021-01-10T16:01:21.146289 | 2012-01-31T18:06:45 | 2012-01-31T18:06:45 | 44,117,434 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,011 | cpp | myUtil.cpp | /*
* myUtil.cpp
*
* Created on: 28.10.2011
* Author: philipp
*/
#include "myUtil.h"
myUtil::myUtil() {
// TODO Auto-generated constructor stub
}
myUtil::~myUtil() {
// TODO Auto-generated destructor stub
}
CVector<float> myUtil::color(float x, float y, float z){
CVector<float> vec(3,0);
vec(0) = x;
vec(1) = y;
vec(2) = z;
return vec;
}
CVector<float> myUtil::color9D(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3){
CVector<float> vec(9,0);
vec(0) = x1;
vec(1) = y1;
vec(2) = z1;
vec(3) = x2;
vec(4) = y2;
vec(5) = z2;
vec(6) = x3;
vec(7) = y3;
vec(8) = z3;
return vec;
}
CVector<float> myUtil::PosHom(float x, float y, float z){
CVector<float> vec(4,1);
vec(0) = x;
vec(1) = y;
vec(2) = z;
return vec;
}
CVector<float> myUtil::PosHom(float x, float y, float z, float w){
CVector<float> vec(4,0);
vec(0) = x;
vec(1) = y;
vec(2) = z;
vec(3) = w;
return vec;
}
CVector<float> myUtil::Pos5D(float v, float w, float x, float y, float z){
CVector<float> vec(5,0);
vec(0) = v;
vec(1) = w;
vec(2) = x;
vec(3) = y;
vec(4) = z;
return vec;
}
CMatrix<float> myUtil::eye(int dim){
CMatrix<float> mat(dim,dim,0);
for(int i = 0; i < dim; i++){
mat(i,i) = 1.0;
}
return mat;
}
CVector<float> myUtil::elementWiseMulti(CVector<float> A, CVector<float> B){
int s = A.size();
if(B.size() < s)
s = B.size();
CVector<float> back(s);
for(int i = 0; i < s; i++){
back(i) = A(i)*B(i);
}
return back;
}
float myUtil::homogenNorm(CVector<float> vec){
if(vec(3) == 0){
return color(vec(0),vec(1),vec(2)).norm();
}//else
CVector<float> back = vec;
back *= (1.0/back(3));
back(3) = 0;
return back.norm();
}
CVector<float> myUtil::normalize(CVector<float> vec){
if(vec(3) == 0){
if(homogenNorm(vec) != 0)
return vec*(1.0f/homogenNorm(vec));
}
CVector<float> back = vec;
back *= (1.0/back(3));
back(3) = 1.0;
if(homogenNorm(back) != 0)
back *= (1.0/homogenNorm(back));
back(3) = 1.0;
return back;
}
|
cd89be15cad3836bc6ea311f057f534bef72d585 | cc495f7c7ee0133aa4614ac9a5f4a494c9d8d6da | /p14.cpp | e26e12c1c343b4db2fd4802153f746f13c9df25a | [] | no_license | chrollo966/projecteuler | 5fa16c5b99a31bfd68c0fccb4861340774b88b85 | a184246cc3f2f009aa741a62eb84300bbfe15bf7 | refs/heads/main | 2023-05-07T08:47:23.310291 | 2021-05-25T08:09:01 | 2021-05-25T08:09:01 | 370,614,145 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 942 | cpp | p14.cpp | // Longest Collatz sequence
#include <iostream>
#include <vector>
int main()
{
const int range = 1000000;
int start_num = 0;
int seq_length = 0;
long seq;
int * cache = new int[range + 1];
for (int i = 0; i < range; i++)
{
cache[i] = -1;
}
cache[1] = 1;
for (int i = 2; i < range; i++)
{
seq = i;
int count = 0;
while(seq != 1 && seq >= i)
{
if (seq % 2 == 0)
{
seq /= 2;
count++;
}
else
{
seq = 3 * seq + 1;
count++;
}
}
cache[i] = count + cache[seq];
if (cache[i] > seq_length)
{
seq_length = cache[i];
start_num = i;
}
}
std::cout << "starting number: " << start_num << std::endl;
std::cout << "length: " << seq_length << std::endl;
} |
5d6d4ef566f3b6447ae96bd7512a4e0d289106f4 | dc933e6c4af6db8e5938612935bb51ead04da9b3 | /android-x86/external/opencore/oscl/oscl/osclregcli/src/oscl_registry_client_impl.h | fd59632d5d3ded9f1cf12639c36b0013a3e499ee | [] | no_license | leotfrancisco/patch-hosting-for-android-x86-support | 213f0b28a7171570a77a3cec48a747087f700928 | e932645af3ff9515bd152b124bb55479758c2344 | refs/heads/master | 2021-01-10T08:40:36.731838 | 2009-05-28T04:29:43 | 2009-05-28T04:29:43 | 51,474,005 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,808 | h | oscl_registry_client_impl.h | /* ------------------------------------------------------------------
* Copyright (C) 2008 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
// -*- c++ -*-
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
// Oscl Registry Client Impl
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
/*! \addtogroup osclutil OSCL Util
*
* @{
*/
/*!
* \file oscl_registry_client_impl.h
* \brief Client-side implementation of OsclRegistryInterface
*
*/
#ifndef OSCL_REGISTRY_CLIENT_IMPL_H_INCLUDED
#define OSCL_REGISTRY_CLIENT_IMPL_H_INCLUDED
#include "osclconfig_proc.h"
#include "oscl_registry_serv_impl_global.h"
//client is the same as server
class OsclRegistryClientImpl: public OsclRegistryServImpl
{
};
//access client is also the same as server
class OsclRegistryAccessClientImpl: public OsclRegistryServImpl
{
};
//TLS-based registry
#include "oscl_registry_serv_impl_tls.h"
//client is the same as server
class OsclRegistryClientTlsImpl: public OsclRegistryServTlsImpl
{
};
//access client is also the same as server
class OsclRegistryAccessClientTlsImpl: public OsclRegistryServTlsImpl
{
};
#endif //OSCL_REGISTRY_IMPL_H_INCLUDED
/*! @} */
|
40178164999f8830034ba6f6d4a902acccdad79c | 476b62392b6b96353af265e4b4e4010147b9ff68 | /Easy100_2020-9-19/AC_ABC100_C.cpp | a9facd2b557c56ab49ae38d44b3e1260ac501bba | [] | no_license | Nattchi/Atcoder | 16d803dd8d83593f31b1a2e399ceefb350990ff0 | 820c4f648a25542da61543bef277f533d6edc614 | refs/heads/master | 2022-04-04T03:30:15.678042 | 2022-03-20T19:08:01 | 2022-03-20T19:08:01 | 247,407,286 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 522 | cpp | AC_ABC100_C.cpp | #include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <cmath>
#include <queue>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=1;i<=ll(n);i++)
int main(){
ll n; cin >> n;
vector<ll> a(n+1);
ll ans = 0;
rep(i, n) {
cin >> a[i];
if(a[i] % 2 == 0){
while(a[i] % 2 == 0){
a[i] /= 2;
ans++;
}
}
}
cout << ans << endl;
} |
9f5edc3920ffaa417dc60788f3506e0fc344e5b5 | 20771ec0bf6cb66ea0ff13495c3f7edeba883a5f | /guide-to-competitive-programming/05 Data Structures/5.2 Set Structures/maps.cpp | 20b6077f6d61413f86cc638e6e262c35fbcf7223 | [] | no_license | ferconde87/Programming-contests | 9a78f38e9bf37ba89df9ae4f61987f05da51b403 | 54b09ded13e3b797a1612d90b14167b0508af94e | refs/heads/master | 2021-11-11T01:21:40.043164 | 2021-09-25T04:59:16 | 2021-09-25T04:59:16 | 133,291,753 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,496 | cpp | maps.cpp | #include <bits/stdc++.h>
using namespace std;
//Map
void maps(){
cout << "Maps\n";
map<string,int> m;
m["monkey"] = 4;
m["banana"] = 3;
m["harpsichord"] = 9;
cout << m["banana"] << "\n"; // 3
// If the value of a key is requested but the map does not contain it, the key is
// automatically added to the map with a default value
cout << m["aybabtu"] << "\n"; // 0
//The function count checks if a key exists in a map:
if (m.count("aybabtu")) {
// key exists
cout << "Now aybabtu exists for the m[aybabtu] operation\n" << endl;
}
}
//Priority Queue
void max_heap(){
cout << "Max-Heap\n";
//default max-heap
priority_queue<int> q;
q.push(3);
q.push(5);
q.push(7);
q.push(2);
cout << q.top() << "\n"; // 7
q.pop();
cout << q.top() << "\n"; // 5
q.pop();
q.push(6);
cout << q.top() << "\n\n"; // 6
q.pop();
}
// If we want to create a priority queue that supports finding and removing the
// smallest element, we can do it as follows:
void min_heap(){
cout << "Min-Heap\n";
priority_queue<int,vector<int>,greater<int>> q;
q.push(3);
q.push(5);
q.push(7);
q.push(2);
cout << q.top() << "\n"; // 2
q.pop();
cout << q.top() << "\n"; // 3
q.pop();
q.push(6);
cout << q.top() << "\n"; // 5
q.pop();
}
void priority_queues(){
max_heap();
min_heap();
}
int main(){
maps();
priority_queues();
return 0;
}
|
58f597e2ba1585cf139309e740cbeadfc58eddd4 | ffe2a7f855c1fecbb1969626a045e25a160e062b | /game_widget/game_widget.h | 765b9246c7ae76724d296110be10f45a70948684 | [] | no_license | BaranVlad/portal2d | 9f18e571034ca88a9eb38ae1350ddca23d51637c | d3bec6dcdcc34d0b7b65f6192a048e0175bf5af6 | refs/heads/master | 2023-06-24T05:21:30.291539 | 2023-06-20T12:13:28 | 2023-06-20T12:13:28 | 366,668,226 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 685 | h | game_widget.h | #ifndef PORTAL2D_GAME_WIDGET_H_
#define PORTAL2D_GAME_WIDGET_H_
#include <QWidget>
#include <QTimer>
#include <QElapsedTimer>
#include <QKeyEvent>
#define FPS 60
class Scene;
class GameWidget : public QWidget {
Q_OBJECT
protected:
Scene* scene_;
QElapsedTimer clock_;
virtual void Update();
void keyPressEvent(QKeyEvent*);
void keyReleaseEvent(QKeyEvent*);
void paintEvent(QPaintEvent*);
void wheelEvent(QWheelEvent*);
void mouseMoveEvent(QMouseEvent*);
void mousePressEvent(QMouseEvent*);
void mouseReleaseEvent(QMouseEvent*);
void resizeEvent(QResizeEvent*);
public:
GameWidget(QWidget* parent = nullptr);
~GameWidget();
void StartLevel(int level);
};
#endif
|
80b13cf7f5c794de7e75b0eeef94de15072f92df | 3f5e7d38fde9076b6c58f392dae71b123fb079b2 | /src/paradis_ompf_my_read.cc | 50a7652b14927793340be1ddee6d48aedc98d54d | [
"MIT"
] | permissive | albicilla/paradis_experiment | 8229c58dd24001285be4625ac8d03af24f61348c | 546067daa7c6c8fd3419cac750e04919c5aa4a1a | refs/heads/master | 2023-01-08T11:21:51.151466 | 2020-10-27T04:29:47 | 2020-10-27T04:29:47 | 260,705,568 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,894 | cc | paradis_ompf_my_read.cc | #include <cassert>
#include <iostream>
#include <vector>
#include <algorithm>
#include <chrono>
#include <random>
#include <sstream>
#include <thread>
#include <fstream>
#include <iomanip>
#include <iterator>
#include <stdexcept>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <fcntl.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF 1e9
#define dump(x) cerr<<#x<<"="<<x<<endl
#define ALL(a) (a).begin(),(a).end()
#define EACH(e,v) for(auto& e:v)
#define SORT(v) sort(ALL(v))
#define PERM(v) SORT(v);for(bool c##p=1;c##p;c##p=next_permutation(ALL(v)))
#define printArr(x) for(auto itr:x)cerr<<"="<<itr<<endl
long long DATASIZE=1000LL*1000LL*1000LL*10LL;
long long SIZE=DATASIZE/400LL;
string inputfile="";
#include <omp.h>
class CppClock{
public:
std::chrono::system_clock::time_point start;
CppClock(){
start = std::chrono::system_clock::now();
}
double get(){
auto end = std::chrono::system_clock::now();
double elapsed = static_cast<double>(std::chrono::duration_cast<std::chrono::milliseconds>(end-start).count());
return elapsed;
}
};
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
template <class T> void chmax(T & a, T const & b) { if (b > a) a = b; }
template <typename T>
string to_string(const T &n){ostringstream stm;stm << n;return stm.str();}
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll =long long;
const ll mod = 1000'000'007;
// nๆฌกๅ
้
ๅใฎๅๆๅใ็ฌฌ๏ผๅผๆฐใฎๅใฎใตใคใบใใจใซๅๆๅใใฆใใใ
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
std::fill( (T*)array, (T*)(array+N), val );
}
template< class _Type>
//gcc can't inline this funciton for some reson
inline void _swap(_Type &a, _Type&b) {
_Type temp = b;
b = a;
a = temp;
}
const int kisuu=256;
const int MaxThreadNum=224;
const long long MaxDataSize=10000000000;
const long long MaxDataNum=4294967295;
const int MaxKisuu=256;
int threadNum;
int NumRange=0;
ll unsortCnt=0;
//std::vector<ll> Dataset;
//concurrent_vector<int> v;
ll Datasize;
//Sort ๅฏพ่ฑกใใผใฟใปใใ
void makeDataset(int* Dataset){
int fd =open(inputfile.c_str(),O_RDONLY);
if(fd==-1){printf("cannot open file.\n");exit(1);}
else{printf("successfully open file.\n");}
for(long long i=0;i<400LL;i++){
int ret=read(fd,&Dataset[i*SIZE],sizeof(int)*SIZE);
if(ret==-1){
cout<<"read failure."<<endl;
exit(1);
}else{
// cout<<"ret:"<<ret<<endl;
}
}
cout<<"read done"<<endl;
for (long long i = 0; i < DATASIZE; i++) {
if (Dataset[i] == 0) {
printf("Error: %lld\n", i);
exit(1);
}
}
close(fd);
cout << "close done" << endl;
}
static const ll kRadixBits = 8;
static const size_t kInsertSortThreshold = 0;
static const ll kRadixMask = (1LL << kRadixBits) - 1LL;
static const ll kRadixBin = 1LL << kRadixBits;
template<class D>
inline int determineDigitBucket(int stage,D num){
return ((num>>(8*stage))&kRadixMask);
}
void report_num_threads(int level)
{
#pragma omp single
{
printf("Level %d: number of threads in the team - %d\n",
level, omp_get_num_threads());
}
}
template<class T>
bool compare(const T &x,const T &y){
return x < y;
}
template <class RandomIt>
inline void insert_sort_core_(RandomIt s, RandomIt e)
{
for (RandomIt i = s + 1; i < e; ++i) {
if (compare(*i, *(i - 1))) {
RandomIt j;
auto tmp = *i;
*i = *(i - 1);
for (j = i - 1; j > s && compare(tmp, *(j - 1)); --j) {
*j = *(j - 1);
}
*j = tmp;
}
}
}
double createHistTime=0.0;
double paradisParmutateTime=0.0;
double paradisRepairTime=0.0;
double createGhGt=0.0;
double quickSortTime = 0.0;
double MiTime = 0.0;
int localhistCall=0;
int recum=0;
int CallProcesses=0;
int swapNum=0;
int needRepairNum=0;
int prefer_insert=0;
template<class D,int kth_byte>
inline void RadixSort(int* arr,ll elenum,ll start,int processes=1){
ll cnt[MaxKisuu];
rep(i,kisuu){cnt[i]=0LL;}
//step1
ll part=elenum/(ll)processes;
ll res=elenum%(ll)(processes);
//threadNumๅใฎใในใใฐใฉใ ใไฝใ
ll localHists[MaxThreadNum][MaxKisuu];
ll gh[MaxKisuu],gt[MaxKisuu],starts[MaxKisuu],ends[MaxKisuu];
ll ph[MaxThreadNum][MaxKisuu];
ll pt[MaxThreadNum][MaxKisuu];
//indicesใpartitionใใฆใซใฆใณใ
ll nvalue = elenum;
// sum i(Ci) > 0 ๅใใฏๅ
จ่ฆ็ด
int SumCi=elenum,nth=2;
int roop=0;
//for paradis repair
// ll pfp[processes+1];
int var_p=processes;
double start_ck,end_ck;
#pragma omp parallel num_threads(processes)
{
int th = omp_get_thread_num();
#pragma omp for
rep(i,kisuu){
rep(th,processes)localHists[th][i]=0LL;
}
#pragma omp barrier
#pragma omp for
for(ll i=start;i<start+elenum;i++){
// assert(arr[i]>=(D)0);
int digit=determineDigitBucket(kth_byte,arr[i]);
localHists[th][digit]++;
}
#pragma omp barrier
#pragma omp for
for(int i=0;i<kisuu;i++){
for(int j=0;j<processes;j++){
cnt[i]+=localHists[j][i];
}
}
#pragma omp barrier
#pragma omp single
{
gh[0]=start;
gt[0]=start+cnt[0];
starts[0]=gh[0];
}
//step2
#pragma omp single
for(int i=1;i<kRadixBin;i++){
//calc ghi
gh[i]=gh[i-1]+cnt[i-1];
//calc gti;
gt[i]=gh[i]+cnt[i];
starts[i]=gh[i];
}
#pragma omp barrier
//step3
while(SumCi!=0){
#pragma omp for
for(int ii=0;ii<var_p;ii++)
{
int pID=omp_get_thread_num();
for(int i=0;i<kisuu;i++){
ll part=(ll)(gt[i]-gh[i])/(ll)var_p;
ll res=(ll)(gt[i]-gh[i])%(ll)(var_p);
if(pID<var_p-1){
ph[pID][i]=part*pID+gh[i];
pt[pID][i]=part*(pID+1LL)+gh[i];
}else{
ph[pID][i]=part*pID+gh[i];
pt[pID][i]=part*(pID+1LL)+gh[i]+res;
}
}
for(int i=0;i<kisuu;i++){
ll head=ph[pID][i];
while(head<pt[pID][i]){
int v=arr[head];
int k=determineDigitBucket(kth_byte,v);
while(k!=i&&ph[pID][k]<pt[pID][k]){
// int arph=(int)arr[ph[pID][k]++];
_swap(v,arr[ph[pID][k]++]);
k=determineDigitBucket(kth_byte,v);
//swapNum++;
}
if(k==i){
arr[head++]=arr[ph[pID][i]];
arr[ph[pID][i]++]=v;
}else{
arr[head++]=v;
}
}
}
}//end of omp pfp
#pragma omp single
{
nth=1;
SumCi=0;
}
#pragma omp barrier
#pragma omp single
start_ck=omp_get_wtime();
#pragma omp for
for(int k=0;k<kRadixBin;k++){
ll nthAftKey=0LL;
for(int pID=0;pID<var_p;pID++){
if(pt[pID][k]-ph[pID][k]>=1e7 && ph[pID][k]-nthAftKey>=pt[pID][k]-ph[pID][k]){
// cout<<"more than 1e7!"<<endl;
#pragma omp parallel for num_threads(4)
for(ll ii=ph[pID][k];ii<pt[pID][k];ii++){
// if(gh[k]==-1)gh[k]=ph[pID][k];
_swap(arr[gh[k]+(ii-ph[pID][k])+nthAftKey],arr[ii]);
}
}else{
for(ll ii=ph[pID][k];ii<pt[pID][k];ii++){
// if(gh[k]==-1)gh[k]=ph[pID][k];
_swap(arr[gh[k]+(ii-ph[pID][k])+nthAftKey],arr[ii]);
}
}
nthAftKey+=(pt[pID][k]-ph[pID][k]);
}
gt[k]=gh[k]+nthAftKey;
if(gt[k]-gh[k]>0LL)SumCi=1;
}
#pragma omp barrier
#pragma omp single
{
end_ck=omp_get_wtime();
cout<<"clock \t"<<(end_ck-start_ck)*1000<<"[ms]"<<endl;
}
}//end of while
}//end of omp2
if(kth_byte>0){
{
#pragma omp parallel num_threads(processes)
#pragma omp single
{
for(int i=0;i<kisuu;i++){
int nextStageThreads=1;
nextStageThreads=processes*(cnt[i]*(log(cnt[i])/log(kRadixBin))/(elenum*(log(elenum)/log(kRadixBin))));
if(cnt[i]>64LL){
#pragma omp task
RadixSort<D,(kth_byte > 0 ? (kth_byte - 1) : 0)>(arr,cnt[i],starts[i],max((int)nextStageThreads,(int)1));
}
else if(cnt[i]>1LL){
//if elements less than 64 call insertion sort
insert_sort_core_(arr+starts[i],arr+starts[i]+cnt[i]);
}
}
#pragma omp taskwait
}
}
}
}
signed main(int argc, char** argv){
if (argc < 2) {
printf("ERROR! set thread num\n");
return 1;
}
threadNum = atoi(argv[1]);
if(threadNum>MaxThreadNum){
printf("ERROR! too many thread num\n");
return 1;
}
if (argc < 4) {
printf("ERROR! too few argments. (note) ./paradis [threadNum] [file] [datasize] \n (etc)./paradis_ompf_my_read 64 ./1_100_10^9 1000000000\n");
return 1;
}
inputfile = to_string(argv[2]);
DATASIZE = atoll(argv[3]);
cout<<"radix="<<kisuu<<endl;
cout<<"maximum threads="<<thread::hardware_concurrency()<<endl;
cout<<"creating dataset..."<<flush;
int *Dataset = (int*)calloc(sizeof(int),DATASIZE);
makeDataset(Dataset);
bool flag_one=false;
for (long long i = 0; i < DATASIZE; i++) {
// cout<<"Dataset["<<i<<"]="<<Dataset[i]<<endl;
if (Dataset[i] == 0) {
printf("Error: %lld\n", i);
exit(1);
}
if(Dataset[i]==1)flag_one=true;
}
//in general case this is not need
/*
if(!flag_one){
cout<<"Error no one"<<endl;
exit(1);
}
*/
cout<<" finish!"<<endl;cout<<endl;
string filename = "log.txt";
ofstream writing_file;
writing_file.open(filename,ios::app);
ll Ds = -1;
NumRange=0;while(Ds){NumRange++;Ds/=kisuu;}
cout<<"NumRange="<<NumRange<<" "<<endl;
writing_file<<"threadNum="<<threadNum<<" Datasize="<<DATASIZE<<" NumRange="<<NumRange<<endl;
cout<<"PARADIS is running..."<<flush;
auto start = std::chrono::system_clock::now();
//sortใใใ็ฎ็ใฎ้
ๅ,levelใฎๆฐ,ๆฌกใฎlevelใซๆธกใindexใฎ้
ๅ,levelใฎๆทฑใ
omp_set_max_active_levels(4);
RadixSort<ll,0>(Dataset,DATASIZE,0,threadNum);
auto end = std::chrono::system_clock::now();
for(ll i=1;i<DATASIZE;i++){
if(Dataset[i-1]>Dataset[i]){
cout<<"not sorted at "<<i<<endl;
cout<<"Dataset["<<i-1<<"]="<<Dataset[i-1]<<" Dataset["<<i<<"]="<<Dataset[i]<<endl;
exit(1);
}
}
if(!std::is_sorted(Dataset,Dataset+DATASIZE)){
std::cerr<<"Not sorted"<<std::endl;
}else{
//std::cout<<"sorted!! good job!"<<std::endl;
cout<<" finish!"<<endl;
}
auto elapsed = static_cast<double>(std::chrono::duration_cast<std::chrono::microseconds>(end-start).count()/1000.0);
printf("paradis time %lf[ms]\n",elapsed);
writing_file<<"paradis time "<<elapsed<<"\n"<<endl;
}
|
41125c348dabd5a44f4a7a8ae7b399438faa6433 | 00d5cd399405500ffef11d4d17b43b836cb5c964 | /src/stirling/source_connectors/perf_profiler/symbolizers/java_symbolizer.h | a2086ba091936d3b7a84e36074b4f2de5845bbf2 | [
"Apache-2.0"
] | permissive | doytsujin/pixie | 0b1105105d0f05cf320cdd7bea55c360d1d01925 | cfe6c966fac18ac0c6e4a28b4f51f3be7553e30b | refs/heads/main | 2023-06-10T00:09:33.784394 | 2023-06-06T00:05:07 | 2023-06-06T00:05:07 | 364,398,868 | 0 | 0 | Apache-2.0 | 2021-05-04T22:12:14 | 2021-05-04T22:12:13 | null | UTF-8 | C++ | false | false | 3,257 | h | java_symbolizer.h | /*
* Copyright 2018- The Pixie Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <memory>
#include <string>
#include <vector>
#include "src/stirling/source_connectors/perf_profiler/java/attach.h"
#include "src/stirling/source_connectors/perf_profiler/symbolizers/symbolizer.h"
#include "src/stirling/utils/monitor.h"
DECLARE_string(stirling_profiler_java_agent_libs);
DECLARE_string(stirling_profiler_px_jattach_path);
DECLARE_bool(stirling_profiler_java_symbols);
DECLARE_uint32(number_attach_attempts_per_iteration);
namespace px {
namespace stirling {
class JavaSymbolizationContext {
public:
struct SymbolAndCodeSize {
std::string symbol;
uint32_t size;
SymbolAndCodeSize() {}
SymbolAndCodeSize(const std::string sym, const uint32_t sz) : symbol(sym), size(sz) {}
};
using SymbolMapType = absl::btree_map<uint64_t, SymbolAndCodeSize>;
JavaSymbolizationContext(const struct upid_t& target_upid,
profiler::SymbolizerFn native_symbolizer_fn,
std::unique_ptr<std::ifstream> symbol_file);
~JavaSymbolizationContext();
std::string_view Symbolize(const uintptr_t addr);
void RemoveArtifacts() const;
void set_requires_refresh() { requires_refresh_ = true; }
private:
void UpdateSymbolMap();
bool requires_refresh_ = false;
SymbolMapType symbol_map_;
profiler::SymbolizerFn native_symbolizer_fn_;
std::unique_ptr<std::ifstream> symbol_file_;
std::filesystem::path host_artifacts_path_;
};
class JavaSymbolizer : public Symbolizer {
public:
static StatusOr<std::unique_ptr<Symbolizer>> Create(
std::unique_ptr<Symbolizer> native_symbolizer);
profiler::SymbolizerFn GetSymbolizerFn(const struct upid_t& upid) override;
void IterationPreTick() override;
void DeleteUPID(const struct upid_t& upid) override;
bool Uncacheable(const struct upid_t& upid) override;
private:
JavaSymbolizer() = delete;
explicit JavaSymbolizer(std::string&& agent_libs);
Status CreateNewJavaSymbolizationContext(const struct upid_t& upid);
std::string_view Symbolize(JavaSymbolizationContext* ctx, const uintptr_t addr);
std::unique_ptr<Symbolizer> native_symbolizer_;
absl::flat_hash_map<struct upid_t, profiler::SymbolizerFn> symbolizer_functions_;
absl::flat_hash_map<struct upid_t, std::unique_ptr<java::AgentAttacher>> active_attachers_;
absl::flat_hash_map<struct upid_t, std::unique_ptr<JavaSymbolizationContext>>
symbolization_contexts_;
const std::string agent_libs_;
StirlingMonitor& monitor_ = *StirlingMonitor::GetInstance();
uint32_t num_attaches_remaining_this_iteration_ = 0;
};
} // namespace stirling
} // namespace px
|
b5c6a872af1316ca895c834c03eec6c69934138a | fca84ffc0c8647f3140c9efd5904fba924c70e2b | /csv2Data/tools/python_protoc/cpp_out/commdef.pb.cc | 81aa699c64133a71bed8fab6570f58d263504a63 | [
"Apache-2.0",
"BSD-3-Clause"
] | permissive | pengdongwei/XFramework_XLua | ff193cb417fd661e78f76bdee709b640ee887587 | 7a87d1bfc10656d5895c737ca84cf7ab3ab82349 | refs/heads/master | 2021-04-12T09:53:18.853898 | 2018-03-23T12:25:45 | 2018-03-23T12:25:45 | 126,482,583 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | true | 6,107 | cc | commdef.pb.cc | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: commdef.proto
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include "commdef.pb.h"
#include <algorithm>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// @@protoc_insertion_point(includes)
namespace commdef {
namespace {
const ::google::protobuf::EnumDescriptor* SexType_descriptor_ = NULL;
const ::google::protobuf::EnumDescriptor* LeaderboardType_descriptor_ = NULL;
const ::google::protobuf::EnumDescriptor* SkillTrigType_descriptor_ = NULL;
const ::google::protobuf::EnumDescriptor* SkillType_descriptor_ = NULL;
const ::google::protobuf::EnumDescriptor* SkillTargetType_descriptor_ = NULL;
const ::google::protobuf::EnumDescriptor* SkillSlot_descriptor_ = NULL;
const ::google::protobuf::EnumDescriptor* Rules_descriptor_ = NULL;
} // namespace
void protobuf_AssignDesc_commdef_2eproto() {
protobuf_AddDesc_commdef_2eproto();
const ::google::protobuf::FileDescriptor* file =
::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
"commdef.proto");
GOOGLE_CHECK(file != NULL);
SexType_descriptor_ = file->enum_type(0);
LeaderboardType_descriptor_ = file->enum_type(1);
SkillTrigType_descriptor_ = file->enum_type(2);
SkillType_descriptor_ = file->enum_type(3);
SkillTargetType_descriptor_ = file->enum_type(4);
SkillSlot_descriptor_ = file->enum_type(5);
Rules_descriptor_ = file->enum_type(6);
}
namespace {
GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
inline void protobuf_AssignDescriptorsOnce() {
::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
&protobuf_AssignDesc_commdef_2eproto);
}
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
}
} // namespace
void protobuf_ShutdownFile_commdef_2eproto() {
}
void protobuf_AddDesc_commdef_2eproto() {
static bool already_here = false;
if (already_here) return;
already_here = true;
GOOGLE_PROTOBUF_VERIFY_VERSION;
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
"\n\rcommdef.proto\022\007commdef*\037\n\007SexType\022\n\n\006f"
"emale\020\000\022\010\n\004male\020\001*E\n\017LeaderboardType\022\016\n\n"
"none_board\020\000\022\020\n\014battle_power\020\001\022\020\n\014region"
"_level\020\002*%\n\rSkillTrigType\022\010\n\004buff\020\000\022\n\n\006d"
"ebuff\020\001*l\n\tSkillType\022\010\n\004none\020\000\022\t\n\005sword\020"
"\001\022\010\n\004fist\020\002\022\t\n\005knife\020\003\022\n\n\006talent\020\n\022\007\n\003pe"
"t\020\013\022\007\n\003QTE\020\014\022\013\n\007zhengwu\020\r\022\n\n\006moster\020\016*;\n"
"\017SkillTargetType\022\t\n\005enemy\020\000\022\010\n\004self\020\001\022\023\n"
"\017selfAndTeammate\020\002*[\n\tSkillSlot\022\r\n\tnoram"
"lAtk\020\000\022\n\n\006skill1\020\001\022\n\n\006skill2\020\002\022\n\n\006skill3"
"\020\003\022\n\n\006weapon\020\004\022\017\n\013zhengwuslot\020\005*<\n\005Rules"
"\022\032\n\026Limitation_PlayerLevel\020\000\022\027\n\023Limitati"
"on_ColdDown\020\001", 493);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"commdef.proto", &protobuf_RegisterTypes);
::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_commdef_2eproto);
}
// Force AddDescriptors() to be called at static initialization time.
struct StaticDescriptorInitializer_commdef_2eproto {
StaticDescriptorInitializer_commdef_2eproto() {
protobuf_AddDesc_commdef_2eproto();
}
} static_descriptor_initializer_commdef_2eproto_;
const ::google::protobuf::EnumDescriptor* SexType_descriptor() {
protobuf_AssignDescriptorsOnce();
return SexType_descriptor_;
}
bool SexType_IsValid(int value) {
switch(value) {
case 0:
case 1:
return true;
default:
return false;
}
}
const ::google::protobuf::EnumDescriptor* LeaderboardType_descriptor() {
protobuf_AssignDescriptorsOnce();
return LeaderboardType_descriptor_;
}
bool LeaderboardType_IsValid(int value) {
switch(value) {
case 0:
case 1:
case 2:
return true;
default:
return false;
}
}
const ::google::protobuf::EnumDescriptor* SkillTrigType_descriptor() {
protobuf_AssignDescriptorsOnce();
return SkillTrigType_descriptor_;
}
bool SkillTrigType_IsValid(int value) {
switch(value) {
case 0:
case 1:
return true;
default:
return false;
}
}
const ::google::protobuf::EnumDescriptor* SkillType_descriptor() {
protobuf_AssignDescriptorsOnce();
return SkillType_descriptor_;
}
bool SkillType_IsValid(int value) {
switch(value) {
case 0:
case 1:
case 2:
case 3:
case 10:
case 11:
case 12:
case 13:
case 14:
return true;
default:
return false;
}
}
const ::google::protobuf::EnumDescriptor* SkillTargetType_descriptor() {
protobuf_AssignDescriptorsOnce();
return SkillTargetType_descriptor_;
}
bool SkillTargetType_IsValid(int value) {
switch(value) {
case 0:
case 1:
case 2:
return true;
default:
return false;
}
}
const ::google::protobuf::EnumDescriptor* SkillSlot_descriptor() {
protobuf_AssignDescriptorsOnce();
return SkillSlot_descriptor_;
}
bool SkillSlot_IsValid(int value) {
switch(value) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
return true;
default:
return false;
}
}
const ::google::protobuf::EnumDescriptor* Rules_descriptor() {
protobuf_AssignDescriptorsOnce();
return Rules_descriptor_;
}
bool Rules_IsValid(int value) {
switch(value) {
case 0:
case 1:
return true;
default:
return false;
}
}
// @@protoc_insertion_point(namespace_scope)
} // namespace commdef
// @@protoc_insertion_point(global_scope)
|
4b035d2bbbaa74844f26eca60ea32dfbfa472217 | f053cb7fd5ab64d157c1e28394e5d27d9495b3b0 | /chapter09/05/Header1.h | 168b31fa2b8a2d1ce187742e74bae1d694d20d85 | [] | no_license | EvilingDark/Stroustrup-PPPUC | 81b91ef0252866d12a96a8a36cd4ed7401564c88 | 5fe09fc1277632447e647ab9b657be3af60bffb7 | refs/heads/master | 2020-09-25T14:03:45.271940 | 2020-01-15T13:25:59 | 2020-01-15T13:25:59 | 226,019,170 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 510 | h | Header1.h | #pragma once
#include <Header.h>
class Book
{
public:
void enter();
string name() const { return p_name; }
string author() const { return p_author; }
string ISBN() const { return p_ISBN; }
string Date() const { return p_Date; }
bool in_stock() const { return p_in_stock; }
private:
string p_name{ "123" };
string p_author{ "123" };
string p_ISBN{ "123" };
string p_Date{ "123" };
bool p_in_stock{ true };
void en_name();
void en_author();
void en_ISBN();
void en_Date();
void en_in_stock();
}; |
1e7cad0c30158f3648b990ba5739ad214dc62c17 | 3fffa43b32f76b2791247c6d9ffffddfe12632c0 | /Hook.h | b573a201fd5b1c44af73411ca792f64a1d2ab6d8 | [] | no_license | discapes/ACHook | ed5f4edda3befafd2d13df7553adf20e15d704fd | be0e84a61d3b5157cdfb7a184c8a251892911183 | refs/heads/master | 2022-12-24T14:16:06.517995 | 2020-10-02T17:52:19 | 2020-10-02T17:52:19 | 287,704,388 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,759 | h | Hook.h | #pragma once
#include <cstdint>
#include <Windows.h>
#include "def.h"
#include "Patch.h"
#include "LDE/ld32.h"
#define isRet(oc) oc == 0xC3 || oc == 0xCB || oc == 0xC2 || oc == 0xCA
template <typename T>
class Hook : public Patch
{
byte* oFun;
T gateway;
int _counter = 0;
public:
int& counter()
{
return _counter;
}
Hook(byte* oFun, const byte* hkFun)
:
Patch(oFun, std::move(createJump(oFun, hkFun))),
gateway ( (T)createGateway(oFun, patchSize) )
{}
Hook(T oFun, const T hkFun)
:
Hook((byte*)oFun, (const byte*)hkFun)
{}
Hook(const wchar_t* modName, const char* procName, const T hkFun)
: Hook((byte*)GetProcAddress(GetModuleHandle(modName), procName), (byte*)hkFun)
{}
~Hook() {
unPatch();
VirtualFree(gateway, 0, MEM_RELEASE);
}
template <typename... P>
std::invoke_result_t<T, P...> operator()(P&&... args)
{
_counter++;
return gateway(std::forward<P>(args)...);
}
private:
void placeJump(byte* jump, const byte* to) {
jump[0] = 0xE9;
*(uintptr_t*)(jump + 1) = to - (jump + 5);
}
SmartArray<byte> createJump(const byte* from, const byte* to)
{
SmartArray<byte> jump(5);
jump[0] = 0xE9;
*(uintptr_t*)(jump + 1) = to - (from + 5);
return jump;
}
size_t calcLength(const byte* oFun) {
size_t len = 0;
while ((len += length_disasm(oFun)) < 5);
loopi(len - 1)
if (isRet(*(oFun + i)))
throw "Can't hook, would overwrite after return";
return len;
}
byte* createGateway(const byte* oFun, size_t len) {
byte* gateway = (byte*)VirtualAlloc(NULL, len + 5, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
if (gateway == 0) throw "Could not allocate memory for gateway";
memcpy(gateway, oFun, len);
placeJump(gateway + len, oFun + len);
return gateway;
}
}; |
e6f80475a7fe62c8d37559620f5b9e3ce973fc99 | 337855cba159a26cf0d243e26d011de541824e9f | /libFileArb/UtilityComponents/FunctionCallers/Member/VoidFourArgMemberFunctionCaller.h | 46abffd13b13435d1875791405301c8dafb3b1ba | [
"MIT"
] | permissive | NeilJustice/FileArb | be2e91f49259f190f4d0b864dd2685b5d41340c8 | 7755956248e5bbfd7d2e0908c0c89656236dc000 | refs/heads/main | 2023-08-16T18:54:53.893169 | 2023-08-12T18:30:03 | 2023-08-12T18:30:03 | 286,283,428 | 4 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,001 | h | VoidFourArgMemberFunctionCaller.h | #pragma once
namespace Utils
{
template<typename ClassType, typename Arg1Type, typename Arg2Type, typename Arg3Type, typename Arg4Type>
class VoidFourArgMemberFunctionCaller
{
public:
virtual void CallConstMemberFunction(
const ClassType* constClassPointer,
void (ClassType::* constMemberFunction)(Arg1Type, Arg2Type, Arg3Type, Arg4Type) const,
Arg1Type arg1, Arg2Type arg2, Arg3Type arg3, Arg4Type arg4) const
{
(constClassPointer->*constMemberFunction)(arg1, arg2, arg3, arg4);
}
virtual void CallNonConstMemberFunction(
ClassType* nonConstClassPointer,
void (ClassType::* nonConstMemberFunction)(Arg1Type, Arg2Type, Arg3Type, Arg4Type),
Arg1Type arg1, Arg2Type arg2, Arg3Type arg3, Arg4Type arg4) const
{
(nonConstClassPointer->*nonConstMemberFunction)(arg1, arg2, arg3, arg4);
}
virtual ~VoidFourArgMemberFunctionCaller() = default;
};
}
|
2a454eefb31c6a64b8e280f059ab4634a4ba8eeb | 894d6ce449cfdb2810d498035edd061ddbe10585 | /llvm/include/llvm/Support/Dwarf.def | dc812074dde68eddba2e59f4e5bd2b14ea262fe2 | [
"NCSA",
"MIT"
] | permissive | afchung/Ratchet | db474ba723a52e40d30cc9a60a43082130a9f2d9 | 287af004477992394f10149b30695acd47efc05d | refs/heads/master | 2020-05-01T19:42:12.427129 | 2019-03-29T16:57:04 | 2019-03-29T16:57:04 | 177,655,403 | 0 | 0 | null | 2019-03-25T19:59:23 | 2019-03-25T19:59:23 | null | UTF-8 | C++ | false | false | 3,545 | def | Dwarf.def | //===- llvm/Support/Dwarf.def - Dwarf definitions ---------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Macros for running through Dwarf enumerators.
//
//===----------------------------------------------------------------------===//
// TODO: Add other DW-based macros.
#if !defined HANDLE_DW_TAG
#error "Missing macro definition of HANDLE_DW*"
#endif
HANDLE_DW_TAG(0x0001, array_type)
HANDLE_DW_TAG(0x0002, class_type)
HANDLE_DW_TAG(0x0003, entry_point)
HANDLE_DW_TAG(0x0004, enumeration_type)
HANDLE_DW_TAG(0x0005, formal_parameter)
HANDLE_DW_TAG(0x0008, imported_declaration)
HANDLE_DW_TAG(0x000a, label)
HANDLE_DW_TAG(0x000b, lexical_block)
HANDLE_DW_TAG(0x000d, member)
HANDLE_DW_TAG(0x000f, pointer_type)
HANDLE_DW_TAG(0x0010, reference_type)
HANDLE_DW_TAG(0x0011, compile_unit)
HANDLE_DW_TAG(0x0012, string_type)
HANDLE_DW_TAG(0x0013, structure_type)
HANDLE_DW_TAG(0x0015, subroutine_type)
HANDLE_DW_TAG(0x0016, typedef)
HANDLE_DW_TAG(0x0017, union_type)
HANDLE_DW_TAG(0x0018, unspecified_parameters)
HANDLE_DW_TAG(0x0019, variant)
HANDLE_DW_TAG(0x001a, common_block)
HANDLE_DW_TAG(0x001b, common_inclusion)
HANDLE_DW_TAG(0x001c, inheritance)
HANDLE_DW_TAG(0x001d, inlined_subroutine)
HANDLE_DW_TAG(0x001e, module)
HANDLE_DW_TAG(0x001f, ptr_to_member_type)
HANDLE_DW_TAG(0x0020, set_type)
HANDLE_DW_TAG(0x0021, subrange_type)
HANDLE_DW_TAG(0x0022, with_stmt)
HANDLE_DW_TAG(0x0023, access_declaration)
HANDLE_DW_TAG(0x0024, base_type)
HANDLE_DW_TAG(0x0025, catch_block)
HANDLE_DW_TAG(0x0026, const_type)
HANDLE_DW_TAG(0x0027, constant)
HANDLE_DW_TAG(0x0028, enumerator)
HANDLE_DW_TAG(0x0029, file_type)
HANDLE_DW_TAG(0x002a, friend)
HANDLE_DW_TAG(0x002b, namelist)
HANDLE_DW_TAG(0x002c, namelist_item)
HANDLE_DW_TAG(0x002d, packed_type)
HANDLE_DW_TAG(0x002e, subprogram)
HANDLE_DW_TAG(0x002f, template_type_parameter)
HANDLE_DW_TAG(0x0030, template_value_parameter)
HANDLE_DW_TAG(0x0031, thrown_type)
HANDLE_DW_TAG(0x0032, try_block)
HANDLE_DW_TAG(0x0033, variant_part)
HANDLE_DW_TAG(0x0034, variable)
HANDLE_DW_TAG(0x0035, volatile_type)
HANDLE_DW_TAG(0x0036, dwarf_procedure)
HANDLE_DW_TAG(0x0037, restrict_type)
HANDLE_DW_TAG(0x0038, interface_type)
HANDLE_DW_TAG(0x0039, namespace)
HANDLE_DW_TAG(0x003a, imported_module)
HANDLE_DW_TAG(0x003b, unspecified_type)
HANDLE_DW_TAG(0x003c, partial_unit)
HANDLE_DW_TAG(0x003d, imported_unit)
HANDLE_DW_TAG(0x003f, condition)
HANDLE_DW_TAG(0x0040, shared_type)
HANDLE_DW_TAG(0x0041, type_unit)
HANDLE_DW_TAG(0x0042, rvalue_reference_type)
HANDLE_DW_TAG(0x0043, template_alias)
// Mock tags we use as discriminators.
HANDLE_DW_TAG(0x0100, auto_variable) // Tag for local (auto) variables.
HANDLE_DW_TAG(0x0101, arg_variable) // Tag for argument variables.
HANDLE_DW_TAG(0x0102, expression) // Tag for complex address expressions.
// New in DWARF v5.
HANDLE_DW_TAG(0x0044, coarray_type)
HANDLE_DW_TAG(0x0045, generic_subrange)
HANDLE_DW_TAG(0x0046, dynamic_type)
// User-defined tags.
HANDLE_DW_TAG(0x4081, MIPS_loop)
HANDLE_DW_TAG(0x4101, format_label)
HANDLE_DW_TAG(0x4102, function_template)
HANDLE_DW_TAG(0x4103, class_template)
HANDLE_DW_TAG(0x4106, GNU_template_template_param)
HANDLE_DW_TAG(0x4107, GNU_template_parameter_pack)
HANDLE_DW_TAG(0x4108, GNU_formal_parameter_pack)
HANDLE_DW_TAG(0x4200, APPLE_property)
#undef HANDLE_DW_TAG
|
a3bb3b1386fd1162c3573bad25852e19dbcf0dff | c8b39acfd4a857dc15ed3375e0d93e75fa3f1f64 | /Engine/Source/ThirdParty/PhysX/APEX_1.4/shared/general/meshimport/src/MeshImport/VtxWeld.cpp | ba99db7aacf8bb778e721deab2d79c2060b9c219 | [
"MIT",
"LicenseRef-scancode-proprietary-license"
] | permissive | windystrife/UnrealEngine_NVIDIAGameWorks | c3c7863083653caf1bc67d3ef104fb4b9f302e2a | b50e6338a7c5b26374d66306ebc7807541ff815e | refs/heads/4.18-GameWorks | 2023-03-11T02:50:08.471040 | 2022-01-13T20:50:29 | 2022-01-13T20:50:29 | 124,100,479 | 262 | 179 | MIT | 2022-12-16T05:36:38 | 2018-03-06T15:44:09 | C++ | UTF-8 | C++ | false | false | 3,981 | cpp | VtxWeld.cpp | /*
* Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "VtxWeld.h"
namespace mimp
{
template<> MeshVertex VertexLess<MeshVertex>::mFind = MeshVertex();
template<> STDNAME::vector<MeshVertex > *VertexLess<MeshVertex>::mList=0;
template<>
bool VertexLess<MeshVertex>::operator()(MiI32 v1,MiI32 v2) const
{
const MeshVertex& a = Get(v1);
const MeshVertex& b = Get(v2);
if ( a.mPos[0] < b.mPos[0] ) return true;
if ( a.mPos[0] > b.mPos[0] ) return false;
if ( a.mPos[1] < b.mPos[1] ) return true;
if ( a.mPos[1] > b.mPos[1] ) return false;
if ( a.mPos[2] < b.mPos[2] ) return true;
if ( a.mPos[2] > b.mPos[2] ) return false;
if ( a.mNormal[0] < b.mNormal[0] ) return true;
if ( a.mNormal[0] > b.mNormal[0] ) return false;
if ( a.mNormal[1] < b.mNormal[1] ) return true;
if ( a.mNormal[1] > b.mNormal[1] ) return false;
if ( a.mNormal[2] < b.mNormal[2] ) return true;
if ( a.mNormal[2] > b.mNormal[2] ) return false;
if ( a.mColor < b.mColor ) return true;
if ( a.mColor > b.mColor ) return false;
if ( a.mTexel1[0] < b.mTexel1[0] ) return true;
if ( a.mTexel1[0] > b.mTexel1[0] ) return false;
if ( a.mTexel1[1] < b.mTexel1[1] ) return true;
if ( a.mTexel1[1] > b.mTexel1[1] ) return false;
if ( a.mTexel2[0] < b.mTexel2[0] ) return true;
if ( a.mTexel2[0] > b.mTexel2[0] ) return false;
if ( a.mTexel2[1] < b.mTexel2[1] ) return true;
if ( a.mTexel2[1] > b.mTexel2[1] ) return false;
if ( a.mTexel3[0] < b.mTexel3[0] ) return true;
if ( a.mTexel3[0] > b.mTexel3[0] ) return false;
if ( a.mTexel3[1] < b.mTexel3[1] ) return true;
if ( a.mTexel3[1] > b.mTexel3[1] ) return false;
if ( a.mTexel4[0] < b.mTexel4[0] ) return true;
if ( a.mTexel4[0] > b.mTexel4[0] ) return false;
if ( a.mTexel4[1] < b.mTexel4[1] ) return true;
if ( a.mTexel4[1] > b.mTexel4[1] ) return false;
if ( a.mTangent[0] < b.mTangent[0] ) return true;
if ( a.mTangent[0] > b.mTangent[0] ) return false;
if ( a.mTangent[1] < b.mTangent[1] ) return true;
if ( a.mTangent[1] > b.mTangent[1] ) return false;
if ( a.mTangent[2] < b.mTangent[2] ) return true;
if ( a.mTangent[2] > b.mTangent[2] ) return false;
if ( a.mBiNormal[0] < b.mBiNormal[0] ) return true;
if ( a.mBiNormal[0] > b.mBiNormal[0] ) return false;
if ( a.mBiNormal[1] < b.mBiNormal[1] ) return true;
if ( a.mBiNormal[1] > b.mBiNormal[1] ) return false;
if ( a.mBiNormal[2] < b.mBiNormal[2] ) return true;
if ( a.mBiNormal[2] > b.mBiNormal[2] ) return false;
if ( a.mWeight[0] < b.mWeight[0] ) return true;
if ( a.mWeight[0] > b.mWeight[0] ) return false;
if ( a.mWeight[1] < b.mWeight[1] ) return true;
if ( a.mWeight[1] > b.mWeight[1] ) return false;
if ( a.mWeight[2] < b.mWeight[2] ) return true;
if ( a.mWeight[2] > b.mWeight[2] ) return false;
if ( a.mWeight[3] < b.mWeight[3] ) return true;
if ( a.mWeight[3] > b.mWeight[3] ) return false;
if ( a.mBone[0] < b.mBone[0] ) return true;
if ( a.mBone[0] > b.mBone[0] ) return false;
if ( a.mBone[1] < b.mBone[1] ) return true;
if ( a.mBone[1] > b.mBone[1] ) return false;
if ( a.mBone[2] < b.mBone[2] ) return true;
if ( a.mBone[2] > b.mBone[2] ) return false;
if ( a.mBone[3] < b.mBone[3] ) return true;
if ( a.mBone[3] > b.mBone[3] ) return false;
if ( a.mRadius < b.mRadius ) return true;
if ( a.mRadius > b.mRadius ) return false;
return false;
};
}; // end of name space
|
f09c910a6255e7f2f89cda565719fa79d928a133 | 6b1098673571cb239314999778e46e185aef3a0a | /lab06-UARTComm-test/Arduino/ReadSHT1xValues/ReadSHT1xValues.ino | 3523c0c04e5e9c0da5359728d363bd008b774802 | [] | no_license | silla-mclab/jiot3 | b96716d5e401f231f1e0b32930d5ed7d74ffcca2 | 6062b16dc72b86f3978a9a79529ec5d1b3e22933 | refs/heads/master | 2022-06-09T06:14:42.193427 | 2019-12-10T08:43:22 | 2019-12-10T08:43:22 | 208,684,017 | 0 | 0 | null | 2022-05-20T21:18:16 | 2019-09-16T01:26:14 | Java | UTF-8 | C++ | false | false | 2,522 | ino | ReadSHT1xValues.ino | #include <SHT1x.h>
//#define TESTING
// Specify data and clock connections and instantiate SHT1x object
#define dataPin 2
#define clockPin 3
SHT1x sht1x(dataPin, clockPin);
#ifdef TESTING
#define COMM_DEV Serial
#else
#define COMM_DEV Serial1
#endif
char* reqCmds[3] = {
"TMP", "HMD", "ACK"
};
char cmdBuf[32];
#define BUF_LENGTH 10
float tmpValues[BUF_LENGTH], tmpSum = 0, tmpAvg;
float hmdValues[BUF_LENGTH], hmdSum = 0, hmdAvg;
void setup()
{
COMM_DEV.begin(115200);
#ifdef TESTING
COMM_DEV.println("Starting SHT11 monitoring...");
COMM_DEV.println("Initialize tmp/hmd value buffer...");
#endif
initSavedValues();
#ifdef TESTING
COMM_DEV.print("Avg. temperature = "); COMM_DEV.println(tmpAvg);
COMM_DEV.print("Avg. humidity = "); COMM_DEV.println(hmdAvg);
#endif
}
void initSavedValues() {
float val = 0;
for (int i=0; i<BUF_LENGTH; i++) {
val = sht1x.readTemperatureC();
tmpValues[i] = val;
tmpSum += val;
val = sht1x.readHumidity();
hmdValues[i] = val;
hmdSum += val;
}
tmpAvg = tmpSum / BUF_LENGTH;
hmdAvg = hmdSum / BUF_LENGTH;
}
void updateTemperature() {
static int idx = 0;
float val = sht1x.readTemperatureC();
tmpSum -= tmpValues[idx];
tmpValues[idx] = val;
tmpSum += val;
tmpAvg = tmpSum / BUF_LENGTH;
idx = (idx + 1) % BUF_LENGTH;
}
void updateHumidity() {
static int idx = 0;
float val = sht1x.readHumidity();
hmdSum -= hmdValues[idx];
hmdValues[idx] = val;
hmdSum += val;
hmdAvg = hmdSum / BUF_LENGTH;
idx = (idx + 1) % BUF_LENGTH;
}
boolean getReqCmd(char* cmd) {
boolean result = false;
int ch, count = 0;
if (COMM_DEV.available() >= 4) {
do {
ch = COMM_DEV.read();
} while (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n');
while (ch != -1 && ch != '\n') {
*cmd++ = ch;
count++;
ch = COMM_DEV.read();
}
if (count >= 3) result = true;
}
*cmd = '\0';
return result;
}
void processReqCmd(char *cmd) {
int idx = 0;
for (idx=0; idx<3; idx++) {
if (strncmp(reqCmds[idx], cmd, 3) == 0)
break;
}
switch (idx) {
case 0:
COMM_DEV.print("T="); COMM_DEV.print(tmpAvg); COMM_DEV.write('\n');
break;
case 1:
COMM_DEV.print("H="); COMM_DEV.print(hmdAvg); COMM_DEV.write('\n');
break;
case 2:
COMM_DEV.print("OK"); COMM_DEV.write('\n');
break;
}
}
void loop()
{
if (getReqCmd(cmdBuf)) {
processReqCmd(cmdBuf);
}
updateTemperature();
updateHumidity();
delay(100);
}
|
777c9a05f353a4f4cab1d7c0d259020efbef00f3 | bdc326f809a9854f35667dc66da8c296d6639f85 | /็ฉๅฝข่ฆ็.cpp | 82518b038b81a112cd36f3cad99324785f1d3712 | [
"MIT"
] | permissive | 1203126009/findjob | 05513af6f47acc83a310d57064b830e53cb55763 | be4e3e5c50b008efe139b94dd8561cd9c599e06c | refs/heads/master | 2020-03-27T20:22:44.958839 | 2018-09-02T08:22:01 | 2018-09-02T08:22:01 | 147,065,014 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 549 | cpp | ็ฉๅฝข่ฆ็.cpp | //https://www.nowcoder.com/practice/72a5a919508a4251859fb2cfb987a0e6?tpId=13&tqId=11163&rp=1&ru=%2Fta%2Fcoding-interviews&qru=%2Fta%2Fcoding-interviews%2Fquestion-ranking&tPage=1
class Solution {
public:
int rectCover(int number) {
if (number==0)return 0;
if (number==1)return 1;
if (number==2)return 2;
int f1 = 1;
int f2 = 2;
int fn;
for (int i = 3; i<=number; i++){
fn = f1+f2;
f1 = f2;
f2 = fn;
}
return fn;
}
}; |
4ff46d6fc51b7ee653f219cecc102125b70a7dbb | d396aa3495407069935ebab3faf870ad87025014 | /2 ๆฐๆฎ็ปๆ/2 ไบๅๆ /8 ไบๅๆ็ดขๆ ๏ผๅปบๆ ๅไธ๏ผ้่ฟๅไธญ้ๅๆฏ่พไธคๆ ๆฏๅฆ็ธๅ๏ผ.cpp | 6dc9a12164ac0e08f84194c06503d612459d1eb1 | [] | no_license | qwjaskzxl/For-OJ | 4d3b2f873cf11c5f9ddb74c4b91b4b78cccc3afa | 1fe6e5099d95fff2dcfc503951ff6e311202919b | refs/heads/master | 2021-12-25T21:17:44.232567 | 2021-08-05T14:01:59 | 2021-08-05T14:01:59 | 175,966,016 | 1 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,378 | cpp | 8 ไบๅๆ็ดขๆ ๏ผๅปบๆ ๅไธ๏ผ้่ฟๅไธญ้ๅๆฏ่พไธคๆ ๆฏๅฆ็ธๅ๏ผ.cpp | #include<iostream>
using namespace std;
struct node {
node *lchild;
node *rchild;
char data;//char็ฑปๅไนๅฏไปฅ็ดๆฅๆฏ่พๆฐๅญ็ๅคงๅฐ
};
string s0,s;//่ฎฐๅฝๆๅบๆ ๅบๅใๆฏไธชๆ ทไพๅฏนๅบๆฏไธชs๏ผ้ฝๅs0ๆฏ
string s1,s2;//่ฎฐๅฝไธคไธชๆ ็ ๅไธญ้ๅๅบๅ
node *creat() {
node *T=new node;
T->lchild=T->rchild=NULL;
return T;
}
node *insert(node *T, char x) {
if(T==NULL) {
T=creat();
T->data=x;
} else if(x<T->data) {
T->lchild=insert(T->lchild,x);
} else if(x>T->data) {
T->rchild=insert(T->rchild,x);
}
return T;
}
node *preorder(node *T,int k) {
if(T!=NULL) {
if(k==1) s1+=T->data;
else if(k==2) s2+=T->data;
}
if(T->lchild!=NULL) preorder(T->lchild,k);
if(T->rchild!=NULL) preorder(T->rchild,k);
}
node *inorder(node *T,int k) {
if(T->lchild!=NULL) inorder(T->lchild,k);
if(T!=NULL) {
if(k==1) s1+=T->data;
else if(k==2) s2+=T->data;
}
if(T->rchild!=NULL) inorder(T->rchild,k);
}
int main() {
int n;
while(cin>>n>>s0, n!=0) {
s1="";
node *T1=NULL;
for(int i=0; i<s0.length(); i++) {
T1=insert(T1,s0[i]);
}
preorder(T1,1);
inorder(T1,1);
while(n--) {
s2="";
cin>>s;
node *T2=NULL;
for(int i=0; i<s.length(); i++) {
T2=insert(T2,s[i]);
}
preorder(T2,2);
inorder(T2,2);
// cout<<s1<<" "<<s2<<endl;
if(s1==s2) printf("YES\n");
else printf("NO\n");
}
}
return 0;
}
|
9bb989aa6addd482439b25f6a924fdf24a2d5f8a | e91d8007699fdc17359f69f216edc37d5ac4f5df | /src/expand/file_line.cpp | 7a827ccf9bbc0a545bf8f8494bad4d63a00c3b8c | [
"MIT"
] | permissive | xTibor/mrustc | 54328a5dbe31c748a1be2c8a7e0a17102ed866bf | 7b6fa5c6e7d6838c2479280dd3f8d14a43c13899 | refs/heads/master | 2020-04-21T18:04:19.742718 | 2019-02-06T00:15:30 | 2019-02-06T00:15:30 | 169,756,176 | 3 | 0 | MIT | 2019-02-08T15:31:34 | 2019-02-08T15:31:33 | null | UTF-8 | C++ | false | false | 2,137 | cpp | file_line.cpp | /*
* MRustC - Rust Compiler
* - By John Hodge (Mutabah/thePowersGang)
*
* expand/file_line.cpp
* - file! line! and macro_path! macros
*/
#include <synext.hpp>
#include "../parse/common.hpp"
#include "../parse/ttstream.hpp"
namespace {
const Span& get_top_span(const Span& sp) {
if( sp.outer_span ) {
return get_top_span(*sp.outer_span);
}
else {
return sp;
}
}
}
class CExpanderFile:
public ExpandProcMacro
{
::std::unique_ptr<TokenStream> expand(const Span& sp, const AST::Crate& crate, const ::std::string& ident, const TokenTree& tt, AST::Module& mod) override
{
return box$( TTStreamO(sp, TokenTree(Token(TOK_STRING, get_top_span(sp).filename.c_str()))) );
}
};
class CExpanderLine:
public ExpandProcMacro
{
::std::unique_ptr<TokenStream> expand(const Span& sp, const AST::Crate& crate, const ::std::string& ident, const TokenTree& tt, AST::Module& mod) override
{
return box$( TTStreamO(sp, TokenTree(Token((uint64_t)get_top_span(sp).start_line, CORETYPE_U32))) );
}
};
class CExpanderColumn:
public ExpandProcMacro
{
::std::unique_ptr<TokenStream> expand(const Span& sp, const AST::Crate& crate, const ::std::string& ident, const TokenTree& tt, AST::Module& mod) override
{
return box$( TTStreamO(sp, TokenTree(Token((uint64_t)get_top_span(sp).start_ofs, CORETYPE_U32))) );
}
};
class CExpanderModulePath:
public ExpandProcMacro
{
::std::unique_ptr<TokenStream> expand(const Span& sp, const AST::Crate& crate, const ::std::string& ident, const TokenTree& tt, AST::Module& mod) override
{
::std::string path_str;
for(const auto& comp : mod.path().nodes()) {
if( &comp != &mod.path().nodes().front() )
path_str += "::";
path_str += comp.name();
}
return box$( TTStreamO(sp, TokenTree( Token(TOK_STRING, mv$(path_str)) )) );
}
};
STATIC_MACRO("file", CExpanderFile);
STATIC_MACRO("line", CExpanderLine);
STATIC_MACRO("column", CExpanderColumn);
STATIC_MACRO("module_path", CExpanderModulePath);
|
b84de1f1cb75a60d9037c35f23bd4675612d26a0 | f1a787ad211adc05075cade4e30c3e3173b6b673 | /4_week/files/teor1.cpp | 635b72382a4cf58797dd4eb6195e05ae67710e8c | [] | no_license | julproh/coursera_tasks_cpp | c395ffd630e3078fa2feb7b2924c6ec190d7040b | 5ddf158acfdc794e1571c031c2e9c8eaec0e79d7 | refs/heads/main | 2023-03-23T23:58:19.356543 | 2021-03-24T08:51:37 | 2021-03-24T08:51:37 | 351,007,366 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,511 | cpp | teor1.cpp | #include <iostream> //
// #include <istream> // ัin
// #include <ostream> // cout
#include <fstream> // ะดะปั ัะฐะนะปะพะฒ
using namespace std;
// getline - ัะธัะฐัั ะธะท ะฟะพัะพะบะฐ ะฟะพัััะพัะฝะพ
void ReadAll (const string& path) {
ifstream input(path);
if (input) {
string line;
while (getline(input, line)) {
cout << line << endl;
}
}
}
int main () {
ifstream input ("hello2.txt");
string line;
if (input.is_open()){
while(getline(input, line)){
cout << line << endl;
}
cout << "done!" << endl;
} else {
cout << "error!" << endl;
}
string year;
string month, day;
ifstream input2("date.txt");
if (input2) {
getline(input2, year, '-');
getline(input2, month, '-');
getline(input2, day, '-');
}
cout << year << ' ' << month << ' ' << day << endl;
int year1 = 0;
int month1 = 0;
int day1 = 0;
if (input2) {
input >> year;
input.ignore(1);
input >> month;
input.ignore(1);
input >> day;
}
cout << year << ' ' << month << ' ' << day << endl;
// __________________
const string path = "output.txt";
ofstream output(path);
output << "hello" << endl;
ifstream input3(path);
if (input3) {
while (getline(input3, line)) {
cout << line << endl;
}
}
ofstream output2(path, ios::app);
output2 << " world!" << endl;
ReadAll(path);
return 0;
} |
f14bf43ab3ea861effca8182ee3b8c23cd432168 | 0436a82eca12ef9625c26820aab4908572be9a83 | /platform-demo/src/main/java/phis/roles/61.re | c6c070a07769580482eea75c88e1b2b29651eeea | [] | no_license | zzq113114/-Demo | 8f3cd0d4d84aa543a9914132eec28d3c91821a5a | ca1549a9410d584372933ba2ffde419e5cb41731 | refs/heads/master | 2023-05-03T21:23:55.237216 | 2020-03-14T06:39:11 | 2020-03-14T06:39:11 | 247,218,124 | 0 | 0 | null | 2023-04-14T17:09:27 | 2020-03-14T05:32:06 | JavaScript | UTF-8 | C++ | false | false | 6,233 | re | 61.re | ๏ปฟ<?xml version="1.0" encoding="UTF-8"?>
<role id="phis.61" name="่ฏๅบ่ง่ฒ" parent="base" version="1388655243304">
<accredit>
<apps>
<app id="phis.application.menu.COMM">
<catagory id="PUB">
<others />
</catagory>
</app>
<app id="phis.application.top.TOP">
<catagory id="TOPFUNC">
<module id="StoreHouseSwitch">
<others />
</module>
</catagory>
</app>
<app id="phis.application.menu.YYGL">
<catagory id="STO">
<module id="STO2001">
<others />
</module>
<module id="STO03010101">
<others />
</module>
<!--่ฎกๅๅๆ้ฎๆ้ -->
<!--add -->
<module id="STO10010301">
<others />
</module>
<module id="STO1001030101">
<others />
</module>
<!--end -->
<module id="STO03010103">
<others />
</module>
<module id="STO03010201">
<others />
</module>
<module id="STO03010202">
<others />
</module>
<module id="STO04">
<others />
</module>
<module id="STO04010101">
<others />
</module>
<module id="STO04010102">
<others />
</module>
<module id="STO04010201">
<others />
</module>
<module id="STO04010202">
<others />
</module>
<module id="STO0501">
<others />
</module>
<module id="STO050101">
<others />
</module>
<module id="STO0502">
<others />
</module>
<module id="STO050201">
<others />
</module>
<module id="STO050301">
<others />
</module>
<module id="STO06">
<others />
</module>
<module id="STO06010101">
<others />
</module>
<module id="STO07">
<others />
</module>
<module id="STO07010101">
<others />
</module>
<module id="STO07010201">
<others />
</module>
<module id="STO07010202">
<others />
</module>
<module id="STO09">
<others />
</module>
<module id="STO09010101">
<others />
</module>
<module id="STO09010201">
<others />
</module>
<module id="STO09010202">
<others />
</module>
<module id="STO100101">
<others />
</module>
<module id="STO100102">
<others />
</module>
<module id="STO100103">
<others />
</module>
<module id="STO1103">
<others />
</module>
<module id="STO110101">
<others />
</module>
<module id="STO110201">
<others />
</module>
<module id="STO03">
<others />
</module>
<module id="STO0302">
<others />
</module>
<module id="STO030101">
<others />
</module>
<module id="STO03010102">
<others />
</module>
<module id="STO0301010201">
<others />
</module>
<module id="STO030102">
<others />
</module>
<module id="STO0401">
<others />
</module>
<module id="STO0402">
<others />
</module>
<module id="STO040101">
<others />
</module>
<module id="STO040102">
<others />
</module>
<module id="STO05">
<others />
</module>
<module id="STO0503">
<others />
</module>
<module id="STO0602">
<others />
</module>
<module id="STO060101">
<others />
</module>
<module id="STO06010102">
<others />
</module>
<module id="STO0702">
<others />
</module>
<module id="STO0301">
<others />
</module>
<module id="STO0601">
<others />
</module>
<module id="STO0701">
<others />
</module>
<module id="STO070101">
<others />
</module>
<module id="STO07010102">
<others />
</module>
<module id="STO070102">
<others />
</module>
<module id="STO0901">
<others />
</module>
<module id="STO0902">
<others />
</module>
<module id="STO090101">
<others />
</module>
<module id="STO09010102">
<others />
</module>
<module id="STO090102">
<others />
</module>
<module id="STO10">
<others />
</module>
<module id="STO1001">
<others />
</module>
<module id="STO10010201">
<others />
</module>
<module id="STO11">
<others />
</module>
<module id="STO1101">
<others />
</module>
<module id="STO1102">
<others />
</module>
<module id="STO12">
<others />
</module>
<module id="STO1201">
<others />
</module>
<module id="STO22">
<others />
</module>
<module id="STO2201">
<others />
</module>
<module id="STO220101">
<others />
</module>
<module id="STO220102">
<others />
</module>
<module id="STO31">
<others />
</module>
<module id="STO3101">
<others />
</module>
<module id="STO310101">
<others />
</module>
<module id="STO310102">
<others />
</module>
<module id="STO35">
<others />
</module>
<module id="STO36">
<others />
</module>
</catagory>
</app>
<app id="phis.application.sys.SYS">
<catagory id="STO">
<others />
</catagory>
</app>
<app id="phis.application.menu.TJFX">
<catagory id="STO" acType="blacklist">
<module id="STO22">
<others />
</module>
<module id="STO29">
<others />
</module>
</catagory>
<catagory id="KJY">
<module id="WAR53">
<others />
</module>
<module id="WAR72">
<others />
</module>
<module id="WAR71">
<others />
</module>
<module id="WAR54">
<others />
</module>
<module id="WAR55">
<others />
</module>
<module id="WAR56">
<others />
</module>
<module id="WAR57">
<others />
</module>
<module id="WAR58">
<others />
</module>
</catagory>
<catagory id="YKTJ" name="็ป่ฎกๅๆ" type="">
<others></others>
</catagory>
</app>
</apps>
</accredit>
</role>
|
43d59fc98a277ae84bf98dd7058ee7d8dcb61578 | 8e8b748965e211710f926deef69cab8077509fef | /Dusk/Physics/BulletPhysics/RigidBody.cpp | 4b27b802279bec86adc145d173f1f19aeb440020 | [] | no_license | i0r/project_freeride | 09240c7725298b4946d911dfff9de22a17c9288b | 896e6c3f08b830f93083f719a0816678c9128efb | refs/heads/master | 2023-02-06T10:07:30.369487 | 2020-12-28T11:10:07 | 2020-12-28T11:10:07 | 263,069,858 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,182 | cpp | RigidBody.cpp | /*
Dusk Source Code
Copyright (C) 2020 Prevost Baptiste
*/
#include <Shared.h>
#ifdef DUSK_USE_BULLET
#include "RigidBody.h"
#include "Physics/RigidBody.h"
#include "ThirdParty/bullet3/src/btBulletDynamicsCommon.h"
void CreateInternalObjects( BaseAllocator* memoryAllocator, NativeRigidBody* nativeObject, const dkVec3f& positionWorldSpace, const f32 bodyMassInKg, const dkQuatf& orientation )
{
const btQuaternion btMotionStateRotation = btQuaternion( orientation.x, orientation.y, orientation.z, orientation.w );
const btVector3 btMotionStateTranslation = btVector3( positionWorldSpace.x, positionWorldSpace.y, positionWorldSpace.z );
const btTransform btMotionStateTransform = btTransform( btMotionStateRotation, btMotionStateTranslation );
nativeObject->BodyMotionState = dk::core::allocate<btDefaultMotionState>( memoryAllocator, btMotionStateTransform );
btVector3 localInertia( 0, 0, 0 );
if ( bodyMassInKg > 0.0f ) {
nativeObject->CollisionShape->calculateLocalInertia( bodyMassInKg, localInertia );
}
btRigidBody::btRigidBodyConstructionInfo rigidBodyConstructionInfos(
bodyMassInKg,
nativeObject->BodyMotionState,
nativeObject->CollisionShape,
localInertia
);
nativeObject->RigidBodyInstance = dk::core::allocate<btRigidBody>( memoryAllocator, rigidBodyConstructionInfos );
btRigidBody* rigidBody = nativeObject->RigidBodyInstance;
rigidBody->setActivationState( ACTIVE_TAG );
rigidBody->setRestitution( 0.0f );
rigidBody->setFriction( 0.0f );
rigidBody->setRollingFriction( 0.0f );
}
RigidBody::RigidBody( BaseAllocator* allocator, const f32 massInKg )
: memoryAllocator( allocator )
, nativeObject( dk::core::allocate<NativeRigidBody>( allocator ) )
, bodyMassInKg( massInKg )
{
}
RigidBody::~RigidBody()
{
dk::core::free( memoryAllocator, nativeObject );
}
void RigidBody::createWithBoxCollider( const dkVec3f& positionWorldSpace, const dkQuatf& orientation, const dkVec3f& boxHalfExtents )
{
nativeObject->CollisionShape = dk::core::allocate<btBoxShape>( memoryAllocator, btVector3( boxHalfExtents.x, boxHalfExtents.y, boxHalfExtents.z ) );
CreateInternalObjects( memoryAllocator, nativeObject, positionWorldSpace, bodyMassInKg, orientation );
}
void RigidBody::createWithSphereCollider( const dkVec3f& positionWorldSpace, const dkQuatf& orientation, const f32 sphereRadius )
{
nativeObject->CollisionShape = dk::core::allocate<btSphereShape>( memoryAllocator, static_cast<btScalar>( sphereRadius ) );
CreateInternalObjects( memoryAllocator, nativeObject, positionWorldSpace, bodyMassInKg, orientation );
}
void RigidBody::createWithPlaneCollider( const dkVec3f& positionWorldSpace, const dkQuatf& orientation, const dkVec3f& planeNormal, const f32 planeHeight )
{
nativeObject->CollisionShape = dk::core::allocate<btStaticPlaneShape>( memoryAllocator, btVector3( planeNormal.x, planeNormal.y, planeNormal.z ), static_cast<btScalar>( planeHeight ) );
CreateInternalObjects( memoryAllocator, nativeObject, positionWorldSpace, bodyMassInKg, orientation );
}
void RigidBody::createWithCylinderCollider( const dkVec3f& positionWorldSpace, const dkQuatf& orientation, const f32 cylinderRadius, const f32 cylinderDepth )
{
nativeObject->CollisionShape = dk::core::allocate<btCylinderShapeX>( memoryAllocator, btVector3( cylinderDepth, cylinderRadius, cylinderRadius ) );
CreateInternalObjects( memoryAllocator, nativeObject, positionWorldSpace, bodyMassInKg, orientation );
}
void RigidBody::createWithConvexHullCollider( const dkVec3f& positionWorldSpace, const dkQuatf& orientation, const f32* hullVertices, const i32 vertexCount )
{
btConvexHullShape* shape = dk::core::allocate<btConvexHullShape>( memoryAllocator );
for ( i32 i = 0; i < vertexCount; i++ ) {
shape->addPoint( btVector3( hullVertices[i * 3 + 0], hullVertices[i * 3 + 1], hullVertices[i * 3 + 2] ), false );
}
shape->recalcLocalAabb();
nativeObject->CollisionShape = shape;
CreateInternalObjects( memoryAllocator, nativeObject, positionWorldSpace, bodyMassInKg, orientation );
}
void RigidBody::keepAlive()
{
nativeObject->RigidBodyInstance->setActivationState( DISABLE_DEACTIVATION );
}
void RigidBody::setSimulationState( const bool enableSimulation )
{
nativeObject->RigidBodyInstance->setActivationState( ( enableSimulation ) ? ACTIVE_TAG : ISLAND_SLEEPING );
}
dkVec3f RigidBody::getAngularVelocity() const
{
const btVector3& angularVelocity = nativeObject->RigidBodyInstance->getAngularVelocity();
return dkVec3f( angularVelocity.getX(), angularVelocity.getY(), angularVelocity.getZ() );
}
dkVec3f RigidBody::getLinearVelocity() const
{
const btVector3& linearVelocity = nativeObject->RigidBodyInstance->getLinearVelocity();
return dkVec3f( linearVelocity.getX(), linearVelocity.getY(), linearVelocity.getZ() );
}
dkVec3f RigidBody::getWorldPosition() const
{
const btTransform& transform = nativeObject->RigidBodyInstance->getWorldTransform();
const btVector3& worldPosition = transform.getOrigin();
return dkVec3f( worldPosition.getX(), worldPosition.getY(), worldPosition.getZ() );
}
dkQuatf RigidBody::getRotation() const
{
const btTransform& transform = nativeObject->RigidBodyInstance->getWorldTransform();
const btQuaternion& orientation = transform.getRotation();
return dkQuatf( orientation.getX(), orientation.getY(), orientation.getZ(), orientation.getW() );
}
dkVec3f RigidBody::getVelocityInLocalPoint( const dkVec3f& localPoint ) const
{
btVector3 velocity = nativeObject->RigidBodyInstance->getVelocityInLocalPoint( btVector3( localPoint.x, localPoint.y, localPoint.z ) );
return dkVec3f( velocity.getX(), velocity.getY(), velocity.getZ() );
}
void RigidBody::applyTorque( const dkVec3f& torque )
{
btVector3 btTorque( torque.x, torque.y, torque.z );
nativeObject->RigidBodyInstance->applyTorque( btTorque );
}
void RigidBody::applyForceCentral( const dkVec3f& force )
{
btVector3 btForce( force.x, force.y, force.z );
nativeObject->RigidBodyInstance->applyCentralForce( btForce );
}
#endif
|
a437008bd4c1d4f8b104593a450ccbf2f522ece4 | 137c734a6183803719931bef34d93b7567965ccd | /include/pointCloud.h | 1f902d92bfa6c3f007fd95906728c4237b12728f | [] | no_license | segmentcloudpoint/SparseSeg | d3e5c6214dab11b02770d82f69a4d4a92af414e3 | 8ec4f687e91867538908876b260e772064dcc8a3 | refs/heads/master | 2020-09-14T08:37:28.402653 | 2018-07-25T21:32:35 | 2018-07-25T21:32:35 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,229 | h | pointCloud.h | #ifndef POINTCLOUD_H
#define POINTCLOUD_H
#include "includes.h"
/*
* Stores point cloud from text file into a point cloud vector.
*
* @params
* path to file (string)
* reference to pointcloud (vector<point_XYZIRL>)
* @return 0 if successful, 1 if not
*/
int getPointCloud(std::string pathToFile, std::vector<point_XYZIRL>& pointCloud);
/*
* Prints point cloud coordinates
*
* @params
* reference to pointcloud (vector<point_XYZIRL>)
* number of values to print (int)
* @return void
*/
void printPointCloud(const std::vector<point_XYZIRL>& pointCloud, int num);
/*
* Sorts point cloud based on chosen axis
*
* @params
* reference to pointcloud (vector<point_XYZIRL>)
* reference to filter values - outliers (vector<point_XYZIRL>)
* apply filtering (bool)
* sorting axis (string)
* @return void
*/
void sortPointCloud(std::vector<point_XYZIRL>& pointCloud, std::vector<point_XYZIRL>& filtered, bool filter, std::string axis);
/*
* Convers LIDAR points from vector to MatrixXf
*
* @params
* point from point cloud (point_XYZIRL)
* @return point from point cloud (MatrixXf)
*/
Eigen::MatrixXf convertPointToMatXf(point_XYZIRL point);
#endif
|
feb52494694a78e605d6ecae115c10cefaf3ffed | 1d4deb56e502368ce79d19435a872e1991c37438 | /libs/remove_placeholders.hpp | 61e6e35bc0cefe1a6324b4011a01261ba8edee06 | [
"Apache-2.0"
] | permissive | wellington/go-libsass | 0bf6668d219403135569b4092df63db6ffc7ad4e | e1cda027356ef54af876fd1aa0bd29cd28f6c43f | refs/heads/main | 2023-03-12T03:27:11.338561 | 2023-02-26T16:40:13 | 2023-02-26T16:40:13 | 34,211,333 | 206 | 42 | Apache-2.0 | 2023-02-26T16:16:59 | 2015-04-19T15:09:47 | C++ | UTF-8 | C++ | false | false | 79 | hpp | remove_placeholders.hpp | #ifndef USE_LIBSASS
#include "../libsass-build/remove_placeholders.hpp"
#endif
|
2346e1be5c2543023e69beb42b692424144902a5 | 9d3dc48dad6c6a45db62962a707d4f79313dce68 | /src/main.cpp | 72f9a07b3e549e93e5eec8132ab46b1436c1e083 | [
"CC0-1.0"
] | permissive | rhyswhitley/climvelope | e22aefd20a1e8d1d8838798fc92c1bdd94843794 | 7dcde9d999811f8275abf873d0bc820f45112ad8 | refs/heads/master | 2021-01-10T21:15:18.461996 | 2015-03-04T06:53:44 | 2015-03-04T06:53:44 | 31,635,664 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,333 | cpp | main.cpp | #include "main.hh"
/* This code represents a C++ encoded version of the STASH model first
* published by Martin Sykes et al. (1992). The model operates as per the
* formulations specified in that paper, but has been rewritten in C++ so that
* it can be manipulated through the R Statistical language via the RCPP
* library. This retains the speed of the original code and allows model
* outputs to be directly analysed.
*
* Grided climate data is passed from R as SEXP objects and then accessed
* 'like' a vector<type> through the RCPP syntactic sugar, such that model runs
* as if from a direct binary. This requires that all passed SEXP objects from
* R must be correctly formatted data frame or matrix types.
*
* For each temperature, rainfall and sunlight hour matrices passed and
* translated into NumericMatrix types, the following structure holds:
* => cols 01:02 are latitude and longitude
* => cols 03:15 are monthly averages values of the meteorology
*
* GridCell objects contain private members storing the various time-dependent
* measure of the three drivers plus the derived climatologies that have been
* evaluated through an energy bucket model accessed from the Energy class.
*/
RcppExport SEXP gridStash( const SEXP R_gtc, const SEXP R_gpr, const SEXP R_gfs, const SEXP R_gcChar ) {
NumericMatrix temp(R_gtc), prec(R_gpr), fsol(R_gfs), gcChar(R_gcChar);
NumericVector lon = fsol(_,0), lat = fsol(_,1), elev = gcChar(_,2), fcap = gcChar(_,3);
unsigned int mn = 12,
ncol = mn + 2;
unsigned long ll, ncell = fsol.nrow();
NumericMatrix gTOT (ncell,nvar+2),
gAET (ncell,14), gEET (ncell,14), gPET (ncell,14),
gDET (ncell,14), gPAR (ncell,14), gMI (ncell,14),
gALPHA (ncell,14), gGDD0 (ncell,14), gGDD5 (ncell,14),
gGDD10 (ncell,14), gCHILL (ncell,14), gRO (ncell,14);
vector< vector<float> > tair, rain, fsun;
GridCell gridCell;
// 2D storage vectors for holding values stored in R objects
tair.resize( ncol, vector<float>( ncell, 0 ) );
rain.resize( ncol, vector<float>( ncell, 0 ) );
fsun.resize( ncol, vector<float>( ncell, 0 ) );
// run through each grid cell and perform daily time-series calculations
for( ll=0; ll<ncell; ll++ ) {
gridCell.initialise_State( ll, lat(ll), lon(ll), elev(ll), fcap(ll) );
gridCell.initialise_Force( tair[ll], rain[ll], fsun[ll] );
stash_Model( gridCell )
// convert back to SEXP objects for export to R
assign_R_total( gridCell, ll, gTOT );
assign_R_month( gridCell, ll, gAET, &GridCell::get_month_AET );
assign_R_month( gridCell, ll, gEET, &GridCell::get_month_EET );
assign_R_month( gridCell, ll, gPET, &GridCell::get_month_PET );
assign_R_month( gridCell, ll, gDET, &GridCell::get_month_DET );
assign_R_month( gridCell, ll, gPAR, &GridCell::get_month_PAR );
assign_R_month( gridCell, ll, gRO, &GridCell::get_month_RUN );
assign_R_month( gridCell, ll, gMI, &GridCell::get_month_MI );
assign_R_month( gridCell, ll, gALPHA, &GridCell::get_month_ALPHA );
assign_R_month( gridCell, ll, gGDD0, &GridCell::get_month_GDD0 );
assign_R_month( gridCell, ll, gGDD5, &GridCell::get_month_GDD5 );
assign_R_month( gridCell, ll, gGDD10, &GridCell::get_month_GDD10 );
assign_R_month( gridCell, ll, gCHILL, &GridCell::get_month_CHILL );
}
// all matrices are passed back to R as a list type
return List::create(
_("Total") = gTOT, _("AET") = gAET, _("EET") = gEET, _("PET") = gPET, _("DET") = gDET,
_("PAR") = gPAR, _("MI") = gMI, _("RO") = gRO, _("Alpha") = gALPHA,
_("GDD0") = gGDD0,_("GDD5") = gGDD5,_("GDD10") = gGDD10, _("Chill") = gCHILL
);
}
void stash_Model( GridCell &gc, float tair, float rain, float fsun ) {
// create program objects
Energy energy;
bool check_pass;
// check to see that the grid cell has no missing values (must have a complete year's worth of data)
check_pass = missing_Value_Check( tair, rain, fsun );
// if TRUE then run normally
if( check_pass ) {
// store monthly climate drivers in the gridCell object
insert_Meteorologies( gridCell, tair, rain, fsun )
// derive daily measurements from monthly values using linear interpolation
interpolate_Daily( gridCell );
// store pass value
gridCell.set_isNull_Flag( check_pass );
// do water balance calculations
energy.waterBucket( gridCell );
// perform monthly and annual sums
gridCell.calculate_Climatologies();
// echo to user
cout << "STASHING >> Grid Cell :" << gridCell.get_Cell() << endl;
// if FALSE then set all calculations for this cell to -999 (ALMA format standard)
} else {
gridCell.set_isNull_Flag( check_pass );
// assign missing values to all climatologies
gridCell.set_Missing_Value();
// echo to user
cout << "NOT STASHING >> Null Cell :" << gridCell.get_Cell() << endl;
}
}
void interpolate_Daily( GridCell &gc ) {
// linearly interpolate monthly values to daily values for all climate drivers
gc.linear_interp( gc, gc.get_month_FSUN(), &GridCell::set_day_FSUN );
gc.linear_interp( gc, gc.get_month_TEMP(), &GridCell::set_day_TEMP );
gc.linear_interp( gc, gc.get_month_PPT (), &GridCell::set_day_PPT );
}
/*
* Overload functions to make semi-polymorphic assignment to SEXP objects that can be sent back to R
*/
void assign_R_total( GridCell &gc, const unsigned long ll, NumericMatrix yGrid ) {
// store all yearly climatologies into a numeric vector that can be passed back to R
NumericVector year_vars(nvar+2);
year_vars = NumericVector::create(
gc.get_Lon(), gc.get_Lat(),
gc.get_year_AET(), gc.get_year_EET(), gc.get_year_PET(),
gc.get_year_DET(), gc.get_year_PAR(), gc.get_year_MI(),
gc.get_year_ALPHA(),gc.get_year_TEMP(), gc.get_year_PPT(),
gc.get_year_FSUN(), gc.get_year_RUN(),
gc.get_year_GDD0(),
gc.get_year_GDD5(),
gc.get_year_GDD10(),
gc.get_year_CHILL()
);
for( unsigned int i=0; i<nvar+2; i++ ) {
yGrid(ll,i) = year_vars(i);
}
}
void assign_R_month( GridCell &gc, const unsigned long ll, NumericMatrix mGrid, float (GridCell::*fget)(const int) const ) {
// create a new matrix for the climatology by passing grid cell coordinate and real value
mGrid(ll,0) = gc.get_Lon();
mGrid(ll,1) = gc.get_Lat();
for( int i=0; i<gc.get_MLEN(); i++ ) {
mGrid(ll,i+2) = (gc.*fget)(i);
}
}
void assign_R_month( GridCell &gc, const unsigned long ll, NumericMatrix mGrid, int (GridCell::*fget)(const int) const ) {
// create a new matrix for the climatology by passing grid cell coordinate and integer value
mGrid(ll,0) = gc.get_Lon();
mGrid(ll,1) = gc.get_Lat();
for( int i=0; i<gc.get_MLEN(); i++ ) {
mGrid(ll,i+2) = (gc.*fget)(i);
}
}
|
2d4c1fda93a33601e1b8b2fbe4b967f05636a3fd | acc1ed5eba0756cdb6eedfda1790a75a322a0564 | /FeatureServer/FileHelper.h | 29d53b68a95aa51d4c7876bfed871aca9dc9d7d1 | [
"BSD-3-Clause"
] | permissive | GaryZouchg/muduo | 4a571665571b6627258f57e5c00ec9b3e95a9ce0 | e213b979c91544f9cbf21c8ff8c38ec51b6b3433 | refs/heads/master | 2020-04-29T17:23:38.308790 | 2019-06-25T12:47:22 | 2019-06-25T12:47:22 | 166,192,098 | 0 | 0 | NOASSERTION | 2019-01-17T08:47:51 | 2019-01-17T08:47:50 | null | UTF-8 | C++ | false | false | 3,362 | h | FileHelper.h | //
// Created by test2 on 19-5-15.
//
#ifndef MUDUO_FILEHELPER_H
#define MUDUO_FILEHELPER_H
#include "hpsocketdef.h"
#include <unistd.h>
#include <sys/uio.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string>
#define CHECK_IS_OK(expr) {if(IS_NOT_OK(expr)) return FALSE;}
#define CHECK_ERROR_FD(fd) {if(IS_INVALID_FD(fd)) return FALSE;}
#define CHECK_ERROR_INVOKE(expr) {if(!IS_NO_ERROR(expr)) return FALSE;}
#define CHECK_ERROR_CODE(rs) {if(!IS_NO_ERROR(rs)) { return FALSE;}}
#define CHECK_ERROR(expr, code) {if(!(expr)) { return FALSE;}}
#define CHECK_EINVAL(expr) CHECK_ERROR(expr, ERROR_INVALID_PARAMETER)
#define ASSERT_CHECK_ERROR(expr, code) {ASSERT(expr); CHECK_ERROR(expr, code);}
#define ASSERT_CHECK_EINVAL(expr) {ASSERT(expr); CHECK_EINVAL(expr);}
#define INVALID_MAP_ADDR ((PBYTE)(MAP_FAILED))
std::string GetCurrentDirectory();
std::string GetModuleFileName(pid_t pid = 0);
bool SetCurrentPathToModulePath(pid_t pid = 0);
class FileHelper
{
public:
bool Open(LPCTSTR lpszFilePath, int iFlag, mode_t iMode = 0);
bool Close();
bool Stat(struct stat& st);
bool GetSize(SIZE_T& dwSize);
SSIZE_T Read(PVOID pBuffer, SIZE_T dwCount)
{return read(m_fd, pBuffer, dwCount);}
SSIZE_T Write(PVOID pBuffer, SIZE_T dwCount)
{return write(m_fd, pBuffer, dwCount);}
SSIZE_T PRead(PVOID pBuffer, SIZE_T dwCount, SIZE_T dwOffset)
{return pread(m_fd, pBuffer, dwCount, dwOffset);}
SSIZE_T PWrite(PVOID pBuffer, SIZE_T dwCount, SIZE_T dwOffset)
{return pwrite(m_fd, pBuffer, dwCount, dwOffset);}
SSIZE_T ReadV(const iovec* pVec, int iVecCount)
{return readv(m_fd, pVec, iVecCount);}
SSIZE_T WriteV(const iovec* pVec, int iVecCount)
{return writev(m_fd, pVec, iVecCount);}
SSIZE_T Seek(SSIZE_T lOffset, int iWhence)
{return lseek(m_fd, lOffset, iWhence);}
bool IsValid() {return m_fd != -1;}
operator FD () {return m_fd;}
bool IsExist() {return IsValid();}
bool IsDirectory();
bool IsFile();
static bool IsExist(LPCTSTR lpszFilePath);
static bool IsDirectory(LPCTSTR lpszFilePath);
static bool IsFile(LPCTSTR lpszFilePath);
static bool IsLink(LPCTSTR lpszFilePath);
public:
FileHelper(LPCTSTR lpszFilePath = nullptr, int iFlag = O_RDONLY, mode_t iMode = 0)
: m_fd(INVALID_FD)
{
if(lpszFilePath != nullptr)
Open(lpszFilePath, iFlag, iMode);
}
~FileHelper()
{
if(IsValid())
Close();
}
private:
FD m_fd;
};
class FileHelperMapping
{
public:
bool Map(LPCTSTR lpszFilePath, SIZE_T dwSize = 0, SIZE_T dwOffset = 0, int iProtected = PROT_READ, int iFlag = MAP_PRIVATE);
bool Map(FD fd, SIZE_T dwSize = 0, SIZE_T dwOffset = 0, int iProtected = PROT_READ, int iFlag = MAP_PRIVATE);
bool Unmap();
bool MSync(int iFlag = MS_SYNC, SIZE_T dwSize = 0);
bool IsValid () {return m_pv != INVALID_MAP_ADDR;}
SIZE_T Size () {return m_dwSize;}
LPBYTE Ptr () {return m_pv;}
operator LPBYTE () {return Ptr();}
public:
FileHelperMapping()
: m_pv(INVALID_MAP_ADDR)
, m_dwSize(0)
{
}
~FileHelperMapping()
{
if(IsValid())
Unmap();
}
private:
PBYTE m_pv;
SIZE_T m_dwSize;
};
#endif //MUDUO_FILEHELPER_H
|
f76575ae2914a490212014740e9818ed262c5913 | 397ac94439bd8a0fd511f52b85fed95af29e21c1 | /TemplatePractice/Queue.h | 88e25fc21178307aacfee8f61469649e2d2aed5c | [] | no_license | esl000/GameAlgorizmLecture | c086682d6bb6ecf5bd21df866b1531ebd304d087 | 06be67cfccfb6682c5c411ba2b37c10d9e8e4c86 | refs/heads/master | 2020-05-04T14:44:20.910669 | 2019-06-05T07:16:59 | 2019-06-05T07:16:59 | 179,208,627 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 273 | h | Queue.h | #pragma once
template<class T>
class Queue
{
class Node
{
public:
T _data;
Node* _next;
};
Node* _head;
Node* _tail;
int _size;
public:
Queue();
bool IsEmpty();
int Size();
void Enqueue(T item);
T Dequeue();
void Print();
};
#include "Queue.inl"
|
a1eecb680fea7be22a1d9dd004df5cd4dc884242 | 0f30d43960d46961688497af9004c2f154d71877 | /format/target/cpp/ts/include/utest/_Dispatcher/EventException.h | 9e6a477e79a72a258b28c0c82014b55d97e7aa36 | [
"MIT"
] | permissive | mboussaa/haxe-testing | 77d2c44596f92d3b509ad2e450f61d2e640eb9a3 | 930bd6e63c8cb91a4df323d01ae518d048c089ba | refs/heads/master | 2021-01-17T10:20:07.126520 | 2016-06-02T10:00:49 | 2016-06-02T10:00:49 | 59,005,172 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | true | 1,110 | h | EventException.h | // Generated by Haxe 3.3.0
#ifndef INCLUDED_utest__Dispatcher_EventException
#define INCLUDED_utest__Dispatcher_EventException
#ifndef HXCPP_H
#include <hxcpp.h>
#endif
HX_DECLARE_CLASS2(utest,_Dispatcher,EventException)
namespace utest{
namespace _Dispatcher{
class EventException_obj : public hx::EnumBase_obj
{
typedef hx::EnumBase_obj super;
typedef EventException_obj OBJ_;
public:
EventException_obj() {};
HX_DO_ENUM_RTTI;
static void __boot();
static void __register();
static bool __GetStatic(const ::String &inName, Dynamic &outValue, hx::PropertyAccess inCallProp);
::String GetEnumName( ) const { return HX_HCSTRING("utest._Dispatcher.EventException","\x44","\xd9","\x0a","\x12"); }
::String __ToString() const { return HX_HCSTRING("EventException.","\x99","\xed","\x96","\x21") + _hx_tag; }
static ::utest::_Dispatcher::EventException StopPropagation;
static inline ::utest::_Dispatcher::EventException StopPropagation_dyn() { return StopPropagation; }
};
} // end namespace utest
} // end namespace _Dispatcher
#endif /* INCLUDED_utest__Dispatcher_EventException */
|
0d5ecf12d64060a2196a09e4f5ec60b2819ad2ab | c4165e745412ade20a59bbaad5755ed8f1f54c6a | /Code/Algorithms/ITK/include/mapITKMultiResImageRegistrationAlgorithm.tpp | 87c0cace435352ab4dd3bd56c27113eea55dcb66 | [] | no_license | MIC-DKFZ/MatchPoint | e0e3fb45a274a6de4b6c49397ea1e9b5bbed4620 | a45efdf977418305039df6a4f98efe6e7ed1f578 | refs/heads/master | 2023-06-22T07:52:46.870768 | 2023-06-17T07:43:48 | 2023-06-17T07:43:48 | 186,114,444 | 0 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 14,705 | tpp | mapITKMultiResImageRegistrationAlgorithm.tpp | // -----------------------------------------------------------------------
// MatchPoint - DKFZ translational registration framework
//
// Copyright (c) German Cancer Research Center (DKFZ),
// Software development for Integrated Diagnostics and Therapy (SIDT).
// ALL RIGHTS RESERVED.
// See mapCopyright.txt or
// http://www.dkfz.de/en/sidt/projects/MatchPoint/copyright.html
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notices for more information.
//
//------------------------------------------------------------------------
/*!
// @file
// @version $Revision$ (last changed revision)
// @date $Date$ (last change date)
// @author $Author$ (last changed by)
// Subversion HeadURL: $HeadURL$
*/
#ifndef __ITK_MULTI_RES_IMAGE_REGISTRATION_ALGORITHM_TPP
#define __ITK_MULTI_RES_IMAGE_REGISTRATION_ALGORITHM_TPP
#include "mapAlgorithmException.h"
#include "mapPreCachedRegistrationKernel.h"
#include "mapInverseRegistrationKernelGenerator.h"
#include "mapRegistrationManipulator.h"
#include "mapAlgorithmWrapperEvent.h"
#include "mapITKMVNLOptimizerControlInterface.h"
#include "mapITKSVNLOptimizerControlInterface.h"
#include <mutex>
namespace map
{
namespace algorithm
{
namespace itk
{
template<class TMovingImage, class TTargetImage, class TIdentificationPolicy, class TInterpolatorPolicy, class TMetricPolicy, class TOptimizerPolicy, class TTransformPolicy, class TPyramidesPolicy, class TInternalRegistrationMethod>
typename ITKMultiResImageRegistrationAlgorithm<TMovingImage, TTargetImage, TIdentificationPolicy, TInterpolatorPolicy, TMetricPolicy, TOptimizerPolicy, TTransformPolicy, TPyramidesPolicy, TInternalRegistrationMethod>::ResolutionLevelCountType
ITKMultiResImageRegistrationAlgorithm<TMovingImage, TTargetImage, TIdentificationPolicy, TInterpolatorPolicy, TMetricPolicy, TOptimizerPolicy, TTransformPolicy, TPyramidesPolicy, TInternalRegistrationMethod>::
doGetCurrentLevel() const
{
return this->_currentLevelCount;
};
template<class TMovingImage, class TTargetImage, class TIdentificationPolicy, class TInterpolatorPolicy, class TMetricPolicy, class TOptimizerPolicy, class TTransformPolicy, class TPyramidesPolicy, class TInternalRegistrationMethod>
bool
ITKMultiResImageRegistrationAlgorithm<TMovingImage, TTargetImage, TIdentificationPolicy, TInterpolatorPolicy, TMetricPolicy, TOptimizerPolicy, TTransformPolicy, TPyramidesPolicy, TInternalRegistrationMethod>::
hasLevelCount() const
{
return true;
};
template<class TMovingImage, class TTargetImage, class TIdentificationPolicy, class TInterpolatorPolicy, class TMetricPolicy, class TOptimizerPolicy, class TTransformPolicy, class TPyramidesPolicy, class TInternalRegistrationMethod>
ITKMultiResImageRegistrationAlgorithm<TMovingImage, TTargetImage, TIdentificationPolicy, TInterpolatorPolicy, TMetricPolicy, TOptimizerPolicy, TTransformPolicy, TPyramidesPolicy, TInternalRegistrationMethod>::
ITKMultiResImageRegistrationAlgorithm()
{
_currentLevelCount = 0;
_firstLevelEvent = true;
};
template<class TMovingImage, class TTargetImage, class TIdentificationPolicy, class TInterpolatorPolicy, class TMetricPolicy, class TOptimizerPolicy, class TTransformPolicy, class TPyramidesPolicy, class TInternalRegistrationMethod>
ITKMultiResImageRegistrationAlgorithm<TMovingImage, TTargetImage, TIdentificationPolicy, TInterpolatorPolicy, TMetricPolicy, TOptimizerPolicy, TTransformPolicy, TPyramidesPolicy, TInternalRegistrationMethod>::
~ITKMultiResImageRegistrationAlgorithm()
{
};
template<class TMovingImage, class TTargetImage, class TIdentificationPolicy, class TInterpolatorPolicy, class TMetricPolicy, class TOptimizerPolicy, class TTransformPolicy, class TPyramidesPolicy, class TInternalRegistrationMethod>
void
ITKMultiResImageRegistrationAlgorithm<TMovingImage, TTargetImage, TIdentificationPolicy, TInterpolatorPolicy, TMetricPolicy, TOptimizerPolicy, TTransformPolicy, TPyramidesPolicy, TInternalRegistrationMethod>::
prepCheckValidity()
{
Superclass::prepCheckValidity();
if (!this->getMovingPyramideInternal())
{
mapExceptionMacro(AlgorithmException,
<< "Cannot start algorithm; no moving image pyramide available.");
}
if (!this->getTargetPyramideInternal())
{
mapExceptionMacro(AlgorithmException,
<< "Cannot start algorithm; no target image pyramide available.");
}
}
template<class TMovingImage, class TTargetImage, class TIdentificationPolicy, class TInterpolatorPolicy, class TMetricPolicy, class TOptimizerPolicy, class TTransformPolicy, class TPyramidesPolicy, class TInternalRegistrationMethod>
void
ITKMultiResImageRegistrationAlgorithm<TMovingImage, TTargetImage, TIdentificationPolicy, TInterpolatorPolicy, TMetricPolicy, TOptimizerPolicy, TTransformPolicy, TPyramidesPolicy, TInternalRegistrationMethod>::
prepPrepareSubComponents()
{
Superclass::prepPrepareSubComponents();
this->preparePyramides();
}
template<class TMovingImage, class TTargetImage, class TIdentificationPolicy, class TInterpolatorPolicy, class TMetricPolicy, class TOptimizerPolicy, class TTransformPolicy, class TPyramidesPolicy, class TInternalRegistrationMethod>
void
ITKMultiResImageRegistrationAlgorithm<TMovingImage, TTargetImage, TIdentificationPolicy, TInterpolatorPolicy, TMetricPolicy, TOptimizerPolicy, TTransformPolicy, TPyramidesPolicy, TInternalRegistrationMethod>::
prepAssembleSubComponents()
{
Superclass::prepAssembleSubComponents();
this->getInternalRegistrationMethod().SetMovingImagePyramid(this->getMovingPyramideInternal());
this->getInternalRegistrationMethod().SetFixedImagePyramid(this->getTargetPyramideInternal());
}
template<class TMovingImage, class TTargetImage, class TIdentificationPolicy, class TInterpolatorPolicy, class TMetricPolicy, class TOptimizerPolicy, class TTransformPolicy, class TPyramidesPolicy, class TInternalRegistrationMethod>
void
ITKMultiResImageRegistrationAlgorithm<TMovingImage, TTargetImage, TIdentificationPolicy, TInterpolatorPolicy, TMetricPolicy, TOptimizerPolicy, TTransformPolicy, TPyramidesPolicy, TInternalRegistrationMethod>::
prepSetInternalInputData()
{
Superclass::prepSetInternalInputData();
this->InvokeEvent(::map::events::AlgorithmEvent(this,
"Pass resolution schedules to itk registration method."));
this->getInternalRegistrationMethod().SetSchedules(this->getTargetSchedule(),
this->getMovingSchedule());
}
template<class TMovingImage, class TTargetImage, class TIdentificationPolicy, class TInterpolatorPolicy, class TMetricPolicy, class TOptimizerPolicy, class TTransformPolicy, class TPyramidesPolicy, class TInternalRegistrationMethod>
void
ITKMultiResImageRegistrationAlgorithm<TMovingImage, TTargetImage, TIdentificationPolicy, TInterpolatorPolicy, TMetricPolicy, TOptimizerPolicy, TTransformPolicy, TPyramidesPolicy, TInternalRegistrationMethod>::
prepFinalizePreparation()
{
Superclass::prepFinalizePreparation();
this->preparePyramidesAfterAssembly();
};
template<class TMovingImage, class TTargetImage, class TIdentificationPolicy, class TInterpolatorPolicy, class TMetricPolicy, class TOptimizerPolicy, class TTransformPolicy, class TPyramidesPolicy, class TInternalRegistrationMethod>
void
ITKMultiResImageRegistrationAlgorithm<TMovingImage, TTargetImage, TIdentificationPolicy, TInterpolatorPolicy, TMetricPolicy, TOptimizerPolicy, TTransformPolicy, TPyramidesPolicy, TInternalRegistrationMethod>::
prepareAlgorithm()
{
/*check once before start to change internal state*/
this->prepCheckValidity();
this->_firstLevelEvent = true;
this->_currentLevelCount = 0;
Superclass::prepareAlgorithm();
//Register level observers
typename ::itk::MemberCommand<Self>::Pointer spCommand = ::itk::MemberCommand<Self>::New();
spCommand->SetCallbackFunction(this, &Self::onLevelEvent);
this->getInternalRegistrationMethod().AddObserver(::itk::IterationEvent(), spCommand);
};
template<class TMovingImage, class TTargetImage, class TIdentificationPolicy, class TInterpolatorPolicy, class TMetricPolicy, class TOptimizerPolicy, class TTransformPolicy, class TPyramidesPolicy, class TInternalRegistrationMethod>
void
ITKMultiResImageRegistrationAlgorithm<TMovingImage, TTargetImage, TIdentificationPolicy, TInterpolatorPolicy, TMetricPolicy, TOptimizerPolicy, TTransformPolicy, TPyramidesPolicy, TInternalRegistrationMethod>::
onLevelEvent(::itk::Object* caller, const ::itk::EventObject& eventObject)
{
if (!(::itk::IterationEvent().CheckEvent(&eventObject)))
{
return;
}
typedef std::lock_guard<std::mutex> LockHolderType;
this->_currentIterationLock.lock();
this->_currentLevelLock.lock();
::map::core::OStringStream os;
if (!this->_firstLevelEvent)
{
TransformParametersType currentParams =
this->getTransformInternal()->GetParameters();
bool hasCurrentPosition = this->getOptimizerInternal()->hasCurrentPosition();
typename OptimizerBaseType::OptimizerPositionType currentPosition =
this->getOptimizerInternal()->getCurrentPosition();
bool hasCurrentValue = this->getOptimizerInternal()->hasCurrentValue();
typename OptimizerBaseType::SVNLMeasureType currentValue =
this->getOptimizerInternal()->getCurrentMeasure();
++_currentLevelCount;
this->_currentIterationCount = 0;
this->_currentTransformParameters = currentParams;
os << "Resolution level finished: final level params: ";
if (hasCurrentPosition)
{
os << currentParams;
}
else
{
os << "unkown";
}
os << "; final level metric value: ";
if (hasCurrentValue)
{
os << currentValue;
}
else
{
os << "unkown";
}
os << std::endl;
}
else
{
this->_firstLevelEvent = false;
}
os << "New Level #" << _currentLevelCount;
this->_currentIterationLock.unlock();
this->_currentLevelLock.unlock();
this->InvokeEvent(::map::events::AlgorithmResolutionLevelEvent(this, os.str()));
this->doInterLevelSetup();
};
template<class TMovingImage, class TTargetImage, class TIdentificationPolicy, class TInterpolatorPolicy, class TMetricPolicy, class TOptimizerPolicy, class TTransformPolicy, class TPyramidesPolicy, class TInternalRegistrationMethod>
void
ITKMultiResImageRegistrationAlgorithm<TMovingImage, TTargetImage, TIdentificationPolicy, TInterpolatorPolicy, TMetricPolicy, TOptimizerPolicy, TTransformPolicy, TPyramidesPolicy, TInternalRegistrationMethod>::
doInterLevelSetup()
{
//default implementation does nothing
}
template<class TMovingImage, class TTargetImage, class TIdentificationPolicy, class TInterpolatorPolicy, class TMetricPolicy, class TOptimizerPolicy, class TTransformPolicy, class TPyramidesPolicy, class TInternalRegistrationMethod>
void
ITKMultiResImageRegistrationAlgorithm<TMovingImage, TTargetImage, TIdentificationPolicy, TInterpolatorPolicy, TMetricPolicy, TOptimizerPolicy, TTransformPolicy, TPyramidesPolicy, TInternalRegistrationMethod>::
onTargetImagePyramideChange(const ::itk::EventObject& eventObject)
{
map::events::UnregisterAlgorithmComponentEvent unregEvent;
if (unregEvent.CheckEvent(&eventObject))
{
//we can directly reset the observer sentinel befor the target pyramide will be unregistered
this->_onGeneralTargePyramideObserver = NULL;
}
};
template<class TMovingImage, class TTargetImage, class TIdentificationPolicy, class TInterpolatorPolicy, class TMetricPolicy, class TOptimizerPolicy, class TTransformPolicy, class TPyramidesPolicy, class TInternalRegistrationMethod>
void
ITKMultiResImageRegistrationAlgorithm<TMovingImage, TTargetImage, TIdentificationPolicy, TInterpolatorPolicy, TMetricPolicy, TOptimizerPolicy, TTransformPolicy, TPyramidesPolicy, TInternalRegistrationMethod>::
onMovingImagePyramideChange(const ::itk::EventObject& eventObject)
{
map::events::UnregisterAlgorithmComponentEvent unregEvent;
if (unregEvent.CheckEvent(&eventObject))
{
//we can directly reset the observer sentinel befor the moving pyramide will be unregistered
this->_onGeneralMovingPyramideObserver = NULL;
}
};
template<class TMovingImage, class TTargetImage, class TIdentificationPolicy, class TInterpolatorPolicy, class TMetricPolicy, class TOptimizerPolicy, class TTransformPolicy, class TPyramidesPolicy, class TInternalRegistrationMethod>
bool
ITKMultiResImageRegistrationAlgorithm<TMovingImage, TTargetImage, TIdentificationPolicy, TInterpolatorPolicy, TMetricPolicy, TOptimizerPolicy, TTransformPolicy, TPyramidesPolicy, TInternalRegistrationMethod>::
registrationIsOutdated() const
{
bool outdated = Superclass::registrationIsOutdated();
if (!outdated)
{
outdated = this->_spFinalizedRegistration->GetMTime() < this->getTargetPyramideMTime();
}
if (!outdated)
{
outdated = this->_spFinalizedRegistration->GetMTime() < this->getMovingPyramideMTime();
}
return outdated;
};
template<class TMovingImage, class TTargetImage, class TIdentificationPolicy, class TInterpolatorPolicy, class TMetricPolicy, class TOptimizerPolicy, class TTransformPolicy, class TPyramidesPolicy, class TInternalRegistrationMethod>
void
ITKMultiResImageRegistrationAlgorithm<TMovingImage, TTargetImage, TIdentificationPolicy, TInterpolatorPolicy, TMetricPolicy, TOptimizerPolicy, TTransformPolicy, TPyramidesPolicy, TInternalRegistrationMethod>::
PrintSelf(std::ostream& os, ::itk::Indent indent) const
{
Superclass::PrintSelf(os, indent);
os << indent << "Current level count: " << _currentLevelCount << std::endl;
};
template<class TMovingImage, class TTargetImage, class TIdentificationPolicy, class TInterpolatorPolicy, class TMetricPolicy, class TOptimizerPolicy, class TTransformPolicy, class TPyramidesPolicy, class TInternalRegistrationMethod>
bool
ITKMultiResImageRegistrationAlgorithm<TMovingImage, TTargetImage, TIdentificationPolicy, TInterpolatorPolicy, TMetricPolicy, TOptimizerPolicy, TTransformPolicy, TPyramidesPolicy, TInternalRegistrationMethod>::
doStopAlgorithm()
{
this->getInternalRegistrationMethod().StopRegistration();
Superclass::doStopAlgorithm();
return true;
};
} // end namespace itk
} // end namespace algorithm
} // end namespace map
#endif
|
cd844de7de1598630eebfd05ca439674e67b2df0 | 6c6bb201c0dce86a053dfb9f4e8b2f26d0892fca | /fuelflashmove.h | 650ee67b472c1bd3fdf2acf028fff2454a1937b2 | [] | no_license | End1-1/FlashCards | 076481f5bb263e42beba879be4612c7c279de2be | e8609f440894dd4eab389397c0db91af0abfc896 | refs/heads/master | 2022-11-07T18:39:02.336469 | 2022-10-17T21:22:47 | 2022-10-17T21:22:47 | 251,817,501 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 889 | h | fuelflashmove.h | #ifndef FUELFLASHMOVE_H
#define FUELFLASHMOVE_H
#include "dialog.h"
namespace Ui {
class FuelFlashMove;
}
class FuelFlashMove : public Dialog
{
Q_OBJECT
public:
explicit FuelFlashMove();
~FuelFlashMove();
void setMove(int m);
FuelFlashMove &setDoc(int id);
private slots:
void on_btnCancel_clicked();
void on_btnSave_clicked();
void on_leQty_textEdited(const QString &arg1);
void on_lePrice_textEdited(const QString &arg1);
void on_leTotal_textEdited(const QString &arg1);
void on_btnPrint_clicked();
void on_leInitialPrice_textChanged(const QString &arg1);
void on_leDiscount_textChanged(const QString &arg1);
void on_btnAddRow_clicked();
void on_btnRemoveRow_clicked();
private:
Ui::FuelFlashMove *ui;
int fMove;
QString fTransaction;
int fDocNumber;
void countTotal();
};
#endif // FUELFLASHMOVE_H
|
3e06ff5362f294d4d94373fa5398dfc4f829b6aa | 389d0f93ef7bc3b11d5bbf739e5e12a2c33cbd6c | /src/test/agrad/matrix_test.cpp | d170688db00388d3753d344e8be7ae79d53d87f3 | [
"BSD-3-Clause"
] | permissive | jrising/jarising-stan | bfae03953ce67af6dc02cb5bf9830a6fd62536d2 | 97fcb1d8a3c9e5403405243598c101ee7b2f3052 | refs/heads/master | 2016-09-05T13:28:27.867469 | 2013-02-10T13:33:49 | 2013-02-10T13:33:49 | 32,218,630 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 120,880 | cpp | matrix_test.cpp | #include <gtest/gtest.h>
#include <stan/agrad/matrix.hpp>
// FIXME: add tests for Eigen NumTraits
typedef stan::agrad::var AVAR;
typedef std::vector<AVAR> AVEC;
typedef std::vector<double> VEC;
AVEC createAVEC(AVAR x) {
AVEC v;
v.push_back(x);
return v;
}
AVEC createAVEC(AVAR x1, AVAR x2) {
AVEC v = createAVEC(x1);
v.push_back(x2);
return v;
}
AVEC createAVEC(AVAR x1, AVAR x2, AVAR x3) {
AVEC v = createAVEC(x1,x2);
v.push_back(x3);
return v;
}
AVEC createAVEC(AVAR x1, AVAR x2, AVAR x3, AVAR x4) {
AVEC v = createAVEC(x1,x2,x3);
v.push_back(x4);
return v;
}
AVEC createAVEC(AVAR x1, AVAR x2, AVAR x3, AVAR x4, AVAR x5) {
AVEC v = createAVEC(x1,x2,x3,x4);
v.push_back(x5);
return v;
}
AVEC createAVEC(AVAR x1, AVAR x2, AVAR x3, AVAR x4, AVAR x5, AVAR x6) {
AVEC v = createAVEC(x1,x2,x3,x4,x5);
v.push_back(x6);
return v;
}
AVEC createAVEC(AVAR x1, AVAR x2, AVAR x3, AVAR x4, AVAR x5, AVAR x6, AVAR x7) {
AVEC v = createAVEC(x1,x2,x3,x4,x5,x6);
v.push_back(x7);
return v;
}
AVEC createAVEC(AVAR x1, AVAR x2, AVAR x3, AVAR x4, AVAR x5, AVAR x6, AVAR x7, AVAR x8) {
AVEC v = createAVEC(x1,x2,x3,x4,x5,x6,x7);
v.push_back(x8);
return v;
}
VEC cgrad(AVAR f, AVAR x1) {
AVEC x = createAVEC(x1);
VEC g;
f.grad(x,g);
return g;
}
VEC cgrad(AVAR f, AVAR x1, AVAR x2) {
AVEC x = createAVEC(x1,x2);
VEC g;
f.grad(x,g);
return g;
}
VEC cgrad(AVAR f, AVAR x1, AVAR x2, AVAR x3) {
AVEC x = createAVEC(x1,x2,x3);
VEC g;
f.grad(x,g);
return g;
}
VEC cgrad(AVAR f, AVAR x1, AVAR x2, AVAR x3, AVAR x4) {
AVEC x = createAVEC(x1,x2,x3,x4);
VEC g;
f.grad(x,g);
return g;
}
VEC cgradvec(AVAR f, AVEC x) {
VEC g;
f.grad(x,g);
return g;
}
TEST(AgradMatrix, fill) {
using stan::agrad::fill;
using std::vector;
using Eigen::Matrix;
using Eigen::Dynamic;
AVAR x;
AVAR y = 10;
fill(x,y);
EXPECT_FLOAT_EQ(10.0, x.val());
AVEC z(2);
AVAR a = 15;
fill(z,a);
EXPECT_FLOAT_EQ(15.0, z[0].val());
EXPECT_FLOAT_EQ(15.0, z[1].val());
EXPECT_EQ(2,z.size());
Matrix<AVAR,Dynamic,Dynamic> m(2,3);
fill(m,AVAR(12));
for (int i = 0; i < 2; ++i)
for (int j = 0; j < 3; ++j)
EXPECT_FLOAT_EQ(12.0, m(i,j).val());
Matrix<AVAR,Dynamic,1> rv(3);
fill(rv,AVAR(13));
for (int i = 0; i < 3; ++i)
EXPECT_FLOAT_EQ(13.0, rv(i).val());
Matrix<AVAR,1,Dynamic> v(4);
fill(v,AVAR(22));
for (int i = 0; i < 4; ++i)
EXPECT_FLOAT_EQ(22.0, v(i).val());
vector<vector<AVAR> > d(3,vector<AVAR>(2));
fill(d,AVAR(54));
for (size_t i = 0; i < 3; ++i)
for (size_t j = 0; j < 2; ++j)
EXPECT_FLOAT_EQ(54, d[i][j].val());
}
// to_var tests
TEST(AgradMatrix,to_var_scalar) {
double d = 5.0;
AVAR v = 5.0;
stan::agrad::var var_x = stan::agrad::to_var(d);
EXPECT_FLOAT_EQ(5.0, var_x.val());
var_x = stan::agrad::to_var(v);
EXPECT_FLOAT_EQ(5.0, var_x.val());
}
TEST(AgradMatrix,to_var_matrix) {
using stan::math::matrix_d;
using stan::agrad::matrix_v;
matrix_d m_d(2,3);
m_d << 0, 1, 2, 3, 4, 5;
matrix_v m_v = stan::agrad::to_var(m_d);
EXPECT_EQ(2, m_v.rows());
EXPECT_EQ(3, m_v.cols());
for (int ii = 0; ii < 2; ii++)
for (int jj = 0; jj < 3; jj++)
EXPECT_FLOAT_EQ(ii*3 + jj, m_v(ii, jj).val());
}
TEST(AgradMatrix,to_var_vector) {
using stan::math::vector_d;
using stan::agrad::vector_v;
vector_d d(5);
vector_v v(5);
d << 1, 2, 3, 4, 5;
v << 1, 2, 3, 4, 5;
vector_v out = stan::agrad::to_var(d);
EXPECT_FLOAT_EQ(1, out(0).val());
EXPECT_FLOAT_EQ(2, out(1).val());
EXPECT_FLOAT_EQ(3, out(2).val());
EXPECT_FLOAT_EQ(4, out(3).val());
EXPECT_FLOAT_EQ(5, out(4).val());
out = stan::agrad::to_var(v);
EXPECT_FLOAT_EQ(1, out(0).val());
EXPECT_FLOAT_EQ(2, out(1).val());
EXPECT_FLOAT_EQ(3, out(2).val());
EXPECT_FLOAT_EQ(4, out(3).val());
EXPECT_FLOAT_EQ(5, out(4).val());
}
TEST(AgradMatrix,to_var_rowvector) {
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
row_vector_d d(5);
row_vector_v v(5);
d << 1, 2, 3, 4, 5;
v << 1, 2, 3, 4, 5;
row_vector_v output = stan::agrad::to_var(d);
EXPECT_FLOAT_EQ(1, output(0).val());
EXPECT_FLOAT_EQ(2, output(1).val());
EXPECT_FLOAT_EQ(3, output(2).val());
EXPECT_FLOAT_EQ(4, output(3).val());
EXPECT_FLOAT_EQ(5, output(4).val());
output.resize(0);
output = stan::agrad::to_var(v);
EXPECT_FLOAT_EQ(1, output(0).val());
EXPECT_FLOAT_EQ(2, output(1).val());
EXPECT_FLOAT_EQ(3, output(2).val());
EXPECT_FLOAT_EQ(4, output(3).val());
EXPECT_FLOAT_EQ(5, output(4).val());
}
// end to_var tests
// rows tests
TEST(AgradMatrix,rows_vector) {
using stan::agrad::vector_v;
using stan::agrad::row_vector_v;
using stan::math::rows;
vector_v v(5);
v << 0, 1, 2, 3, 4;
EXPECT_EQ(5U, rows(v));
v.resize(0);
EXPECT_EQ(0U, rows(v));
}
TEST(AgradMatrix,rows_rowvector) {
using stan::agrad::row_vector_v;
using stan::math::rows;
row_vector_v rv(5);
rv << 0, 1, 2, 3, 4;
EXPECT_EQ(1U, rows(rv));
rv.resize(0);
EXPECT_EQ(1U, rows(rv));
}
TEST(AgradMatrix,rows_matrix) {
using stan::agrad::matrix_v;
using stan::math::rows;
matrix_v m(2,3);
m << 0, 1, 2, 3, 4, 5;
EXPECT_EQ(2U, rows(m));
m.resize(0,2);
EXPECT_EQ(0U, rows(m));
}
// end rows tests
// cols tests
TEST(AgradMatrix,cols_vector) {
using stan::agrad::vector_v;
using stan::agrad::row_vector_v;
using stan::math::cols;
vector_v v(5);
v << 0, 1, 2, 3, 4;
EXPECT_EQ(1U, cols(v));
v.resize(0);
EXPECT_EQ(1U, cols(v));
}
TEST(AgradMatrix,cols_rowvector) {
using stan::agrad::row_vector_v;
using stan::math::cols;
row_vector_v rv(5);
rv << 0, 1, 2, 3, 4;
EXPECT_EQ(5U, cols(rv));
rv.resize(0);
EXPECT_EQ(0U, cols(rv));
}
TEST(AgradMatrix,cols_matrix) {
using stan::agrad::matrix_v;
using stan::math::cols;
matrix_v m(2,3);
m << 0, 1, 2, 3, 4, 5;
EXPECT_EQ(3U, cols(m));
m.resize(5, 0);
EXPECT_EQ(0U, cols(m));
}
// end cols_tests
// determinant tests
TEST(AgradMatrix,determinant) {
using stan::agrad::matrix_v;
using stan::math::determinant;
matrix_v v(2,2);
v << 0, 1, 2, 3;
AVAR det;
det = determinant(v);
EXPECT_FLOAT_EQ(-2, det.val());
}
TEST(AgradMatrix,log_determinant) {
using stan::agrad::matrix_v;
using stan::math::log_determinant;
matrix_v v(2,2);
v << 0, 1, 2, 3;
AVAR det;
det = log_determinant(v);
EXPECT_FLOAT_EQ(std::log(2.0), det.val());
}
TEST(AgradMatrix,deteriminant_exception) {
using stan::agrad::matrix_v;
using stan::math::determinant;
EXPECT_THROW(determinant(matrix_v(2,3)), std::domain_error);
}
TEST(AgradMatrix,log_deteriminant_exception) {
using stan::agrad::matrix_v;
using stan::math::log_determinant;
EXPECT_THROW(log_determinant(matrix_v(2,3)), std::domain_error);
}
TEST(AgradMatrix,determinant_grad) {
using stan::agrad::matrix_v;
using stan::math::determinant;
matrix_v X(2,2);
AVAR a = 2.0;
AVAR b = 3.0;
AVAR c = 5.0;
AVAR d = 7.0;
X << a, b, c, d;
AVEC x = createAVEC(a,b,c,d);
AVAR f = determinant(X);
// det = ad - bc
EXPECT_FLOAT_EQ(-1.0,f.val());
VEC g;
f.grad(x,g);
EXPECT_FLOAT_EQ(7.0,g[0]);
EXPECT_FLOAT_EQ(-5.0,g[1]);
EXPECT_FLOAT_EQ(-3.0,g[2]);
EXPECT_FLOAT_EQ(2.0,g[3]);
}
TEST(AgradMatrix,log_determinant_grad) {
using stan::agrad::matrix_v;
using stan::math::log_determinant;
matrix_v X(2,2);
AVAR a = 2.0;
AVAR b = 3.0;
AVAR c = 5.0;
AVAR d = 7.0;
X << a, b, c, d;
AVEC x = createAVEC(a,b,c,d);
AVAR f = log_determinant(X);
// det = ad - bc
EXPECT_NEAR(0.0,f.val(),1E-12);
VEC g;
f.grad(x,g);
EXPECT_FLOAT_EQ(-7.0,g[0]);
EXPECT_FLOAT_EQ(5.0,g[1]);
EXPECT_FLOAT_EQ(3.0,g[2]);
EXPECT_FLOAT_EQ(-2.0,g[3]);
}
TEST(AgradMatrix,determinant3by3) {
// just test it can handle it
using stan::agrad::matrix_v;
using stan::math::determinant;
matrix_v Z(9,9);
for (int i = 0; i < 9; ++i)
for (int j = 0; j < 9; ++j)
Z(i,j) = i * j + 1;
AVAR h = determinant(Z);
h = h; // supresses set but not used warning
}
// end determinant tests
// dot_product tests
TEST(AgradMatrix, dot_product_vector_vector) {
using stan::math::vector_d;
using stan::agrad::vector_v;
vector_d vd_1(3), vd_2(3);
vector_v vv_1(3), vv_2(3);
vd_1 << 1, 3, -5;
vv_1 << 1, 3, -5;
vd_2 << 4, -2, -1;
vv_2 << 4, -2, -1;
EXPECT_FLOAT_EQ(3, stan::agrad::dot_product(vv_1, vd_2).val());
EXPECT_FLOAT_EQ(3, stan::agrad::dot_product(vd_1, vv_2).val());
EXPECT_FLOAT_EQ(3, stan::agrad::dot_product(vv_1, vv_2).val());
}
TEST(AgradMatrix, dot_product_vector_vector_exception) {
using stan::math::vector_d;
using stan::agrad::vector_v;
vector_d d1(3);
vector_v v1(3);
vector_d d2(2);
vector_v v2(4);
EXPECT_THROW(stan::agrad::dot_product(v1, d2), std::domain_error);
EXPECT_THROW(stan::agrad::dot_product(d1, v2), std::domain_error);
EXPECT_THROW(stan::agrad::dot_product(v1, v2), std::domain_error);
}
TEST(AgradMatrix, dot_product_rowvector_vector) {
using stan::math::vector_d;
using stan::agrad::vector_v;
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
row_vector_d d1(3);
row_vector_v v1(3);
vector_d d2(3);
vector_v v2(3);
d1 << 1, 3, -5;
v1 << 1, 3, -5;
d2 << 4, -2, -1;
v2 << 4, -2, -1;
EXPECT_FLOAT_EQ(3, stan::agrad::dot_product(v1, d2).val());
EXPECT_FLOAT_EQ(3, stan::agrad::dot_product(d1, v2).val());
EXPECT_FLOAT_EQ(3, stan::agrad::dot_product(v1, v2).val());
}
TEST(AgradMatrix, dot_product_rowvector_vector_exception) {
using stan::math::vector_d;
using stan::agrad::vector_v;
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
row_vector_d d1(3);
row_vector_v v1(3);
vector_d d2(2);
vector_v v2(4);
EXPECT_THROW(stan::agrad::dot_product(v1, d2), std::domain_error);
EXPECT_THROW(stan::agrad::dot_product(d1, v2), std::domain_error);
EXPECT_THROW(stan::agrad::dot_product(v1, v2), std::domain_error);
}
TEST(AgradMatrix, dot_product_vector_rowvector) {
using stan::math::vector_d;
using stan::agrad::vector_v;
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
vector_d d1(3);
vector_v v1(3);
row_vector_d d2(3);
row_vector_v v2(3);
d1 << 1, 3, -5;
v1 << 1, 3, -5;
d2 << 4, -2, -1;
v2 << 4, -2, -1;
EXPECT_FLOAT_EQ(3, stan::agrad::dot_product(v1, d2).val());
EXPECT_FLOAT_EQ(3, stan::agrad::dot_product(d1, v2).val());
EXPECT_FLOAT_EQ(3, stan::agrad::dot_product(v1, v2).val());
}
TEST(AgradMatrix, dot_product_vector_rowvector_exception) {
using stan::math::vector_d;
using stan::agrad::vector_v;
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
vector_d d1(3);
vector_v v1(3);
row_vector_d d2(2);
row_vector_v v2(4);
EXPECT_THROW(stan::agrad::dot_product(v1, d2), std::domain_error);
EXPECT_THROW(stan::agrad::dot_product(d1, v2), std::domain_error);
EXPECT_THROW(stan::agrad::dot_product(v1, v2), std::domain_error);
}
TEST(AgradMatrix, dot_product_rowvector_rowvector) {
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
row_vector_d d1(3), d2(3);
row_vector_v v1(3), v2(3);
d1 << 1, 3, -5;
v1 << 1, 3, -5;
d2 << 4, -2, -1;
v2 << 4, -2, -1;
EXPECT_FLOAT_EQ(3, stan::agrad::dot_product(v1, d2).val());
EXPECT_FLOAT_EQ(3, stan::agrad::dot_product(d1, v2).val());
EXPECT_FLOAT_EQ(3, stan::agrad::dot_product(v1, v2).val());
}
TEST(AgradMatrix, dot_product_rowvector_rowvector_exception) {
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
row_vector_d d1(3), d2(2);
row_vector_v v1(3), v2(4);
EXPECT_THROW(stan::agrad::dot_product(v1, d2), std::domain_error);
EXPECT_THROW(stan::agrad::dot_product(d1, v2), std::domain_error);
EXPECT_THROW(stan::agrad::dot_product(v1, v2), std::domain_error);
}
// end dot_product tests
// exp tests
TEST(AgradMatrix, exp_matrix) {
using stan::math::exp;
using stan::math::matrix_d;
using stan::agrad::matrix_v;
matrix_d expected_output(2,2);
matrix_v mv(2,2), output;
int i,j;
mv << 1, 2, 3, 4;
expected_output << std::exp(1), std::exp(2), std::exp(3), std::exp(4);
output = exp(mv);
for (i = 0; i < 2; i++)
for (j = 0; j < 2; j++)
EXPECT_FLOAT_EQ(expected_output(i,j), output(i,j).val());
}
// log tests
TEST(AgradMatrix, log_matrix) {
using stan::math::log;
using stan::math::matrix_d;
using stan::agrad::matrix_v;
matrix_d expected_output(2,2);
matrix_v mv(2,2), output;
int i,j;
mv << 1, 2, 3, 4;
expected_output << std::log(1), std::log(2), std::log(3), std::log(4);
output = log(mv);
for (i = 0; i < 2; i++)
for (j = 0; j < 2; j++)
EXPECT_FLOAT_EQ(expected_output(i,j), output(i,j).val());
}
// scalar add/subtract tests
TEST(AgradMatrix,add_scalar) {
using stan::agrad::matrix_v;
using stan::math::add;
matrix_v v(2,2);
v << 1, 2, 3, 4;
matrix_v result;
result = add(2.0,v);
EXPECT_FLOAT_EQ(3.0,result(0,0).val());
EXPECT_FLOAT_EQ(4.0,result(0,1).val());
EXPECT_FLOAT_EQ(5.0,result(1,0).val());
EXPECT_FLOAT_EQ(6.0,result(1,1).val());
result = add(v,2.0);
EXPECT_FLOAT_EQ(3.0,result(0,0).val());
EXPECT_FLOAT_EQ(4.0,result(0,1).val());
EXPECT_FLOAT_EQ(5.0,result(1,0).val());
EXPECT_FLOAT_EQ(6.0,result(1,1).val());
}
TEST(AgradMatrix,subtract_scalar) {
using stan::math::subtract;
using stan::agrad::matrix_v;
matrix_v v(2,2);
v << 1, 2, 3, 4;
matrix_v result;
result = subtract(2.0,v);
EXPECT_FLOAT_EQ(1.0,result(0,0).val());
EXPECT_FLOAT_EQ(0.0,result(0,1).val());
EXPECT_FLOAT_EQ(-1.0,result(1,0).val());
EXPECT_FLOAT_EQ(-2.0,result(1,1).val());
result = subtract(v,2.0);
EXPECT_FLOAT_EQ(-1.0,result(0,0).val());
EXPECT_FLOAT_EQ(0.0,result(0,1).val());
EXPECT_FLOAT_EQ(1.0,result(1,0).val());
EXPECT_FLOAT_EQ(2.0,result(1,1).val());
}
// add tests
TEST(AgradMatrix, add_vector_vector) {
using stan::math::add;
using stan::math::vector_d;
using stan::agrad::vector_v;
vector_d vd_1(5);
vector_d vd_2(5);
vector_v vv_1(5);
vector_v vv_2(5);
vd_1 << 1, 2, 3, 4, 5;
vv_1 << 1, 2, 3, 4, 5;
vd_2 << 2, 3, 4, 5, 6;
vv_2 << 2, 3, 4, 5, 6;
vector_d expected_output(5);
expected_output << 3, 5, 7, 9, 11;
vector_d output_d;
output_d = add(vd_1, vd_2);
EXPECT_FLOAT_EQ(expected_output(0), output_d(0));
EXPECT_FLOAT_EQ(expected_output(1), output_d(1));
EXPECT_FLOAT_EQ(expected_output(2), output_d(2));
EXPECT_FLOAT_EQ(expected_output(3), output_d(3));
EXPECT_FLOAT_EQ(expected_output(4), output_d(4));
vector_v output_v = add(vv_1, vd_2);
EXPECT_FLOAT_EQ(expected_output(0), output_v(0).val());
EXPECT_FLOAT_EQ(expected_output(1), output_v(1).val());
EXPECT_FLOAT_EQ(expected_output(2), output_v(2).val());
EXPECT_FLOAT_EQ(expected_output(3), output_v(3).val());
EXPECT_FLOAT_EQ(expected_output(4), output_v(4).val());
output_v = add(vd_1, vv_2);
EXPECT_FLOAT_EQ(expected_output(0), output_v(0).val());
EXPECT_FLOAT_EQ(expected_output(1), output_v(1).val());
EXPECT_FLOAT_EQ(expected_output(2), output_v(2).val());
EXPECT_FLOAT_EQ(expected_output(3), output_v(3).val());
EXPECT_FLOAT_EQ(expected_output(4), output_v(4).val());
output_v = add(vv_1, vv_2);
EXPECT_FLOAT_EQ(expected_output(0), output_v(0).val());
EXPECT_FLOAT_EQ(expected_output(1), output_v(1).val());
EXPECT_FLOAT_EQ(expected_output(2), output_v(2).val());
EXPECT_FLOAT_EQ(expected_output(3), output_v(3).val());
EXPECT_FLOAT_EQ(expected_output(4), output_v(4).val());
}
TEST(AgradMatrix, add_vector_vector_exception) {
using stan::math::add;
using stan::math::vector_d;
using stan::agrad::vector_v;
vector_d d1(5), d2(1);
vector_v v1(5), v2(1);
EXPECT_THROW(add(d1, d2), std::domain_error);
EXPECT_THROW(add(v1, d2), std::domain_error);
EXPECT_THROW(add(d1, v2), std::domain_error);
EXPECT_THROW(add(v1, v2), std::domain_error);
}
TEST(AgradMatrix, add_rowvector_rowvector) {
using stan::math::add;
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
row_vector_d rvd_1(5), rvd_2(5);
row_vector_v rvv_1(5), rvv_2(5);
rvd_1 << 1, 2, 3, 4, 5;
rvv_1 << 1, 2, 3, 4, 5;
rvd_2 << 2, 3, 4, 5, 6;
rvv_2 << 2, 3, 4, 5, 6;
row_vector_d expected_output(5);
expected_output << 3, 5, 7, 9, 11;
row_vector_d output_d = add(rvd_1, rvd_2);
EXPECT_FLOAT_EQ(expected_output(0), output_d(0));
EXPECT_FLOAT_EQ(expected_output(1), output_d(1));
EXPECT_FLOAT_EQ(expected_output(2), output_d(2));
EXPECT_FLOAT_EQ(expected_output(3), output_d(3));
EXPECT_FLOAT_EQ(expected_output(4), output_d(4));
row_vector_v output_v = add(rvv_1, rvd_2);
EXPECT_FLOAT_EQ(expected_output(0), output_v(0).val());
EXPECT_FLOAT_EQ(expected_output(1), output_v(1).val());
EXPECT_FLOAT_EQ(expected_output(2), output_v(2).val());
EXPECT_FLOAT_EQ(expected_output(3), output_v(3).val());
EXPECT_FLOAT_EQ(expected_output(4), output_v(4).val());
output_v = add(rvd_1, rvv_2);
EXPECT_FLOAT_EQ(expected_output(0), output_v(0).val());
EXPECT_FLOAT_EQ(expected_output(1), output_v(1).val());
EXPECT_FLOAT_EQ(expected_output(2), output_v(2).val());
EXPECT_FLOAT_EQ(expected_output(3), output_v(3).val());
EXPECT_FLOAT_EQ(expected_output(4), output_v(4).val());
output_v = add(rvv_1, rvv_2);
EXPECT_FLOAT_EQ(expected_output(0), output_v(0).val());
EXPECT_FLOAT_EQ(expected_output(1), output_v(1).val());
EXPECT_FLOAT_EQ(expected_output(2), output_v(2).val());
EXPECT_FLOAT_EQ(expected_output(3), output_v(3).val());
EXPECT_FLOAT_EQ(expected_output(4), output_v(4).val());
}
TEST(AgradMatrix, add_rowvector_rowvector_exception) {
using stan::math::add;
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
row_vector_d d1(5), d2(2);
row_vector_v v1(5), v2(2);
row_vector_v output;
EXPECT_THROW( add(d1, d2), std::domain_error);
EXPECT_THROW( add(d1, v2), std::domain_error);
EXPECT_THROW( add(v1, d2), std::domain_error);
EXPECT_THROW( add(v1, v2), std::domain_error);
}
TEST(AgradMatrix, add_matrix_matrix) {
using stan::math::add;
using stan::math::matrix_d;
using stan::agrad::matrix_v;
matrix_d md_1(2,2), md_2(2,2);
matrix_v mv_1(2,2), mv_2(2,2);
md_1 << -10, 1, 10, 0;
mv_1 << -10, 1, 10, 0;
md_2 << 10, -10, 1, 2;
mv_2 << 10, -10, 1, 2;
matrix_d expected_output(2,2);
expected_output << 0, -9, 11, 2;
matrix_d output_d = add(md_1, md_2);
EXPECT_FLOAT_EQ(expected_output(0,0), output_d(0,0));
EXPECT_FLOAT_EQ(expected_output(0,1), output_d(0,1));
EXPECT_FLOAT_EQ(expected_output(1,0), output_d(1,0));
EXPECT_FLOAT_EQ(expected_output(1,1), output_d(1,1));
matrix_v output_v = add(mv_1, md_2);
EXPECT_FLOAT_EQ(expected_output(0,0), output_v(0,0).val());
EXPECT_FLOAT_EQ(expected_output(0,1), output_v(0,1).val());
EXPECT_FLOAT_EQ(expected_output(1,0), output_v(1,0).val());
EXPECT_FLOAT_EQ(expected_output(1,1), output_v(1,1).val());
output_v = add(md_1, mv_2);
EXPECT_FLOAT_EQ(expected_output(0,0), output_v(0,0).val());
EXPECT_FLOAT_EQ(expected_output(0,1), output_v(0,1).val());
EXPECT_FLOAT_EQ(expected_output(1,0), output_v(1,0).val());
EXPECT_FLOAT_EQ(expected_output(1,1), output_v(1,1).val());
output_v = add(mv_1, mv_2);
EXPECT_FLOAT_EQ(expected_output(0,0), output_v(0,0).val());
EXPECT_FLOAT_EQ(expected_output(0,1), output_v(0,1).val());
EXPECT_FLOAT_EQ(expected_output(1,0), output_v(1,0).val());
EXPECT_FLOAT_EQ(expected_output(1,1), output_v(1,1).val());
}
TEST(AgradMatrix, add_matrix_matrix_exception) {
using stan::math::add;
using stan::math::matrix_d;
using stan::agrad::matrix_v;
matrix_d d1(2,2), d2(1,2);
matrix_v v1(2,2), v2(1,2);
EXPECT_THROW(add(d1, d2), std::domain_error);
EXPECT_THROW(add(d1, v2), std::domain_error);
EXPECT_THROW(add(v1, d2), std::domain_error);
EXPECT_THROW(add(v1, v2), std::domain_error);
}
// end add tests
// subtract tests
TEST(AgradMatrix, subtract_vector_vector) {
using stan::math::subtract;
using stan::math::vector_d;
using stan::agrad::vector_v;
vector_d expected_output(5);
vector_v output;
vector_d output_d;
vector_d vd_1(5), vd_2(5);
vector_v vv_1(5), vv_2(5);
vd_1 << 0, 2, -6, 10, 6;
vv_1 << 0, 2, -6, 10, 6;
vd_2 << 2, 3, 4, 5, 6;
vv_2 << 2, 3, 4, 5, 6;
expected_output << -2, -1, -10, 5, 0;
output_d = subtract(vd_1, vd_2);
EXPECT_FLOAT_EQ(expected_output(0), output_d(0));
EXPECT_FLOAT_EQ(expected_output(1), output_d(1));
EXPECT_FLOAT_EQ(expected_output(2), output_d(2));
EXPECT_FLOAT_EQ(expected_output(3), output_d(3));
EXPECT_FLOAT_EQ(expected_output(4), output_d(4));
output = subtract(vv_1, vd_2);
EXPECT_FLOAT_EQ(expected_output(0), output(0).val());
EXPECT_FLOAT_EQ(expected_output(1), output(1).val());
EXPECT_FLOAT_EQ(expected_output(2), output(2).val());
EXPECT_FLOAT_EQ(expected_output(3), output(3).val());
EXPECT_FLOAT_EQ(expected_output(4), output(4).val());
output = subtract(vd_1, vv_2);
EXPECT_FLOAT_EQ(expected_output(0), output(0).val());
EXPECT_FLOAT_EQ(expected_output(1), output(1).val());
EXPECT_FLOAT_EQ(expected_output(2), output(2).val());
EXPECT_FLOAT_EQ(expected_output(3), output(3).val());
EXPECT_FLOAT_EQ(expected_output(4), output(4).val());
output = subtract(vv_1, vv_2);
EXPECT_FLOAT_EQ(expected_output(0), output(0).val());
EXPECT_FLOAT_EQ(expected_output(1), output(1).val());
EXPECT_FLOAT_EQ(expected_output(2), output(2).val());
EXPECT_FLOAT_EQ(expected_output(3), output(3).val());
EXPECT_FLOAT_EQ(expected_output(4), output(4).val());
}
TEST(AgradMatrix, subtract_vector_vector_exception) {
using stan::math::subtract;
using stan::math::vector_d;
using stan::agrad::vector_v;
vector_d d1(5), d2(1);
vector_v v1(5), v2(1);
vector_v output;
EXPECT_THROW( subtract(d1, d2), std::domain_error);
EXPECT_THROW( subtract(v1, d2), std::domain_error);
EXPECT_THROW( subtract(d1, v2), std::domain_error);
EXPECT_THROW( subtract(v1, v2), std::domain_error);
}
TEST(AgradMatrix, subtract_rowvector_rowvector) {
using stan::math::subtract;
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
row_vector_d expected_output(5);
row_vector_d output_d;
row_vector_v output;
row_vector_d rvd_1(5), rvd_2(5);
row_vector_v rvv_1(5), rvv_2(5);
rvd_1 << 0, 2, -6, 10, 6;
rvv_1 << 0, 2, -6, 10, 6;
rvd_2 << 2, 3, 4, 5, 6;
rvv_2 << 2, 3, 4, 5, 6;
expected_output << -2, -1, -10, 5, 0;
output_d = subtract(rvd_1, rvd_2);
EXPECT_FLOAT_EQ(expected_output(0), output_d(0));
EXPECT_FLOAT_EQ(expected_output(1), output_d(1));
EXPECT_FLOAT_EQ(expected_output(2), output_d(2));
EXPECT_FLOAT_EQ(expected_output(3), output_d(3));
EXPECT_FLOAT_EQ(expected_output(4), output_d(4));
output = subtract(rvv_1, rvd_2);
EXPECT_FLOAT_EQ(expected_output(0), output(0).val());
EXPECT_FLOAT_EQ(expected_output(1), output(1).val());
EXPECT_FLOAT_EQ(expected_output(2), output(2).val());
EXPECT_FLOAT_EQ(expected_output(3), output(3).val());
EXPECT_FLOAT_EQ(expected_output(4), output(4).val());
output = subtract(rvd_1, rvv_2);
EXPECT_FLOAT_EQ(expected_output(0), output(0).val());
EXPECT_FLOAT_EQ(expected_output(1), output(1).val());
EXPECT_FLOAT_EQ(expected_output(2), output(2).val());
EXPECT_FLOAT_EQ(expected_output(3), output(3).val());
EXPECT_FLOAT_EQ(expected_output(4), output(4).val());
output = subtract(rvv_1, rvv_2);
EXPECT_FLOAT_EQ(expected_output(0), output(0).val());
EXPECT_FLOAT_EQ(expected_output(1), output(1).val());
EXPECT_FLOAT_EQ(expected_output(2), output(2).val());
EXPECT_FLOAT_EQ(expected_output(3), output(3).val());
EXPECT_FLOAT_EQ(expected_output(4), output(4).val());
}
TEST(AgradMatrix, subtract_rowvector_rowvector_exception) {
using stan::math::subtract;
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
row_vector_d d1(5), d2(2);
row_vector_v v1(5), v2(2);
row_vector_v output;
EXPECT_THROW( subtract(d1, d2), std::domain_error);
EXPECT_THROW( subtract(d1, v2), std::domain_error);
EXPECT_THROW( subtract(v1, d2), std::domain_error);
EXPECT_THROW( subtract(v1, v2), std::domain_error);
}
TEST(AgradMatrix, subtract_matrix_matrix) {
using stan::math::subtract;
using stan::math::matrix_d;
using stan::agrad::matrix_v;
matrix_d expected_output(2,2);
matrix_v output;
matrix_d md_1(2,2), md_2(2,2);
matrix_v mv_1(2,2), mv_2(2,2);
matrix_d md_mis (2, 3);
matrix_v mv_mis (1, 1);
md_1 << -10, 1, 10, 0;
mv_1 << -10, 1, 10, 0;
md_2 << 10, -10, 1, 2;
mv_2 << 10, -10, 1, 2;
expected_output << -20, 11, 9, -2;
matrix_d output_d = subtract(md_1, md_2);
EXPECT_FLOAT_EQ(expected_output(0,0), output_d(0,0));
EXPECT_FLOAT_EQ(expected_output(0,1), output_d(0,1));
EXPECT_FLOAT_EQ(expected_output(1,0), output_d(1,0));
EXPECT_FLOAT_EQ(expected_output(1,1), output_d(1,1));
output = subtract(mv_1, md_2);
EXPECT_FLOAT_EQ(expected_output(0,0), output(0,0).val());
EXPECT_FLOAT_EQ(expected_output(0,1), output(0,1).val());
EXPECT_FLOAT_EQ(expected_output(1,0), output(1,0).val());
EXPECT_FLOAT_EQ(expected_output(1,1), output(1,1).val());
output = subtract(md_1, mv_2);
EXPECT_FLOAT_EQ(expected_output(0,0), output(0,0).val());
EXPECT_FLOAT_EQ(expected_output(0,1), output(0,1).val());
EXPECT_FLOAT_EQ(expected_output(1,0), output(1,0).val());
EXPECT_FLOAT_EQ(expected_output(1,1), output(1,1).val());
output = subtract(mv_1, mv_2);
EXPECT_FLOAT_EQ(expected_output(0,0), output(0,0).val());
EXPECT_FLOAT_EQ(expected_output(0,1), output(0,1).val());
EXPECT_FLOAT_EQ(expected_output(1,0), output(1,0).val());
EXPECT_FLOAT_EQ(expected_output(1,1), output(1,1).val());
}
TEST(AgradMatrix, subtract_matrix_matrix_exception) {
using stan::math::subtract;
using stan::math::matrix_d;
using stan::agrad::matrix_v;
matrix_d d1(2,2), d2(1,2);
matrix_v v1(2,2), v2(1,2);
EXPECT_THROW( subtract(d1, d2), std::domain_error);
EXPECT_THROW( subtract(d1, v2), std::domain_error);
EXPECT_THROW( subtract(v1, d2), std::domain_error);
EXPECT_THROW( subtract(v1, v2), std::domain_error);
}
// end subtract tests
// minus tests
TEST(AgradMatrix, minus_scalar) {
using stan::math::minus;
double x = 10;
AVAR v = 11;
EXPECT_FLOAT_EQ(-10, minus(x));
EXPECT_FLOAT_EQ(-11, minus(v).val());
}
TEST(AgradMatrix, minus_vector) {
using stan::math::vector_d;
using stan::agrad::vector_v;
using stan::math::minus;
vector_d d(3);
vector_v v(3);
d << -100, 0, 1;
v << -100, 0, 1;
vector_d output_d;
output_d = minus(d);
EXPECT_FLOAT_EQ(100, output_d[0]);
EXPECT_FLOAT_EQ(0, output_d[1]);
EXPECT_FLOAT_EQ(-1, output_d[2]);
vector_v output;
output = minus(v);
EXPECT_FLOAT_EQ(100, output[0].val());
EXPECT_FLOAT_EQ(0, output[1].val());
EXPECT_FLOAT_EQ(-1, output[2].val());
}
TEST(AgradMatrix, minus_rowvector) {
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
using stan::math::minus;
row_vector_d d(3);
row_vector_v v(3);
d << -100, 0, 1;
v << -100, 0, 1;
row_vector_d output_d;
output_d = minus(d);
EXPECT_FLOAT_EQ(100, output_d[0]);
EXPECT_FLOAT_EQ(0, output_d[1]);
EXPECT_FLOAT_EQ(-1, output_d[2]);
row_vector_v output;
output = minus(v);
EXPECT_FLOAT_EQ(100, output[0].val());
EXPECT_FLOAT_EQ(0, output[1].val());
EXPECT_FLOAT_EQ(-1, output[2].val());
}
TEST(AgradMatrix, minus_matrix) {
using stan::math::matrix_d;
using stan::agrad::matrix_v;
using stan::math::minus;
matrix_d d(2, 3);
matrix_v v(2, 3);
d << -100, 0, 1, 20, -40, 2;
v << -100, 0, 1, 20, -40, 2;
matrix_d output_d = minus(d);
EXPECT_FLOAT_EQ(100, output_d(0,0));
EXPECT_FLOAT_EQ( 0, output_d(0,1));
EXPECT_FLOAT_EQ( -1, output_d(0,2));
EXPECT_FLOAT_EQ(-20, output_d(1,0));
EXPECT_FLOAT_EQ( 40, output_d(1,1));
EXPECT_FLOAT_EQ( -2, output_d(1,2));
matrix_v output = minus(v);
EXPECT_FLOAT_EQ(100, output(0,0).val());
EXPECT_FLOAT_EQ( 0, output(0,1).val());
EXPECT_FLOAT_EQ( -1, output(0,2).val());
EXPECT_FLOAT_EQ(-20, output(1,0).val());
EXPECT_FLOAT_EQ( 40, output(1,1).val());
EXPECT_FLOAT_EQ( -2, output(1,2).val());
}
// end minus tests
// divide tests
TEST(AgradMatrix, divide_scalar) {
using stan::agrad::divide;
double d1, d2;
AVAR v1, v2;
d1 = 10;
v1 = 10;
d2 = -2;
v2 = -2;
EXPECT_FLOAT_EQ(-5, divide(d1, d2));
EXPECT_FLOAT_EQ(-5, divide(d1, v2).val());
EXPECT_FLOAT_EQ(-5, divide(v1, d2).val());
EXPECT_FLOAT_EQ(-5, divide(v1, v2).val());
d2 = 0;
v2 = 0;
EXPECT_FLOAT_EQ(std::numeric_limits<double>::infinity(), divide(d1, d2));
EXPECT_FLOAT_EQ(std::numeric_limits<double>::infinity(), divide(d1, v2).val());
EXPECT_FLOAT_EQ(std::numeric_limits<double>::infinity(), divide(v1, d2).val());
EXPECT_FLOAT_EQ(std::numeric_limits<double>::infinity(), divide(v1, v2).val());
d1 = 0;
v1 = 0;
EXPECT_TRUE(std::isnan(divide(d1, d2)));
EXPECT_TRUE(std::isnan(divide(d1, v2).val()));
EXPECT_TRUE(std::isnan(divide(v1, d2).val()));
EXPECT_TRUE(std::isnan(divide(v1, v2).val()));
}
TEST(AgradMatrix, divide_vector) {
using stan::math::divide;
using stan::math::vector_d;
using stan::agrad::vector_v;
vector_d d1(3);
vector_v v1(3);
double d2;
AVAR v2;
d1 << 100, 0, -3;
v1 << 100, 0, -3;
d2 = -2;
v2 = -2;
vector_d output_d;
output_d = divide(d1, d2);
EXPECT_FLOAT_EQ(-50, output_d(0));
EXPECT_FLOAT_EQ( 0, output_d(1));
EXPECT_FLOAT_EQ(1.5, output_d(2));
vector_v output;
output = divide(d1, v2);
EXPECT_FLOAT_EQ(-50, output(0).val());
EXPECT_FLOAT_EQ( 0, output(1).val());
EXPECT_FLOAT_EQ(1.5, output(2).val());
output = divide(v1, d2);
EXPECT_FLOAT_EQ(-50, output(0).val());
EXPECT_FLOAT_EQ( 0, output(1).val());
EXPECT_FLOAT_EQ(1.5, output(2).val());
output = divide(v1, v2);
EXPECT_FLOAT_EQ(-50, output(0).val());
EXPECT_FLOAT_EQ( 0, output(1).val());
EXPECT_FLOAT_EQ(1.5, output(2).val());
d2 = 0;
v2 = 0;
output_d = divide(d1, d2);
EXPECT_FLOAT_EQ(std::numeric_limits<double>::infinity(), output_d(0));
EXPECT_TRUE (std::isnan(output_d(1)));
EXPECT_FLOAT_EQ(-std::numeric_limits<double>::infinity(), output_d(2));
output = divide(d1, v2);
EXPECT_FLOAT_EQ(std::numeric_limits<double>::infinity(), output(0).val());
EXPECT_TRUE (std::isnan(output(1).val()));
EXPECT_FLOAT_EQ(-std::numeric_limits<double>::infinity(), output(2).val());
output = divide(v1, d2);
EXPECT_FLOAT_EQ(std::numeric_limits<double>::infinity(), output(0).val());
EXPECT_TRUE (std::isnan(output(1).val()));
EXPECT_FLOAT_EQ(-std::numeric_limits<double>::infinity(), output(2).val());
output = divide(v1, v2);
EXPECT_FLOAT_EQ(std::numeric_limits<double>::infinity(), output(0).val());
EXPECT_TRUE (std::isnan(output(1).val()));
EXPECT_FLOAT_EQ(-std::numeric_limits<double>::infinity(), output(2).val());
}
TEST(AgradMatrix, divide_rowvector) {
using stan::math::divide;
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
row_vector_d d1(3);
row_vector_v v1(3);
double d2;
AVAR v2;
d1 << 100, 0, -3;
v1 << 100, 0, -3;
d2 = -2;
v2 = -2;
row_vector_d output_d = divide(d1, d2);
EXPECT_FLOAT_EQ(-50, output_d(0));
EXPECT_FLOAT_EQ( 0, output_d(1));
EXPECT_FLOAT_EQ(1.5, output_d(2));
row_vector_v output;
output = divide(d1, v2);
EXPECT_FLOAT_EQ(-50, output(0).val());
EXPECT_FLOAT_EQ( 0, output(1).val());
EXPECT_FLOAT_EQ(1.5, output(2).val());
output = divide(v1, d2);
EXPECT_FLOAT_EQ(-50, output(0).val());
EXPECT_FLOAT_EQ( 0, output(1).val());
EXPECT_FLOAT_EQ(1.5, output(2).val());
output = divide(v1, v2);
EXPECT_FLOAT_EQ(-50, output(0).val());
EXPECT_FLOAT_EQ( 0, output(1).val());
EXPECT_FLOAT_EQ(1.5, output(2).val());
d2 = 0;
v2 = 0;
output_d = divide(d1, d2);
EXPECT_FLOAT_EQ(std::numeric_limits<double>::infinity(), output_d(0));
EXPECT_TRUE(std::isnan(output_d(1)));
EXPECT_FLOAT_EQ(-std::numeric_limits<double>::infinity(), output_d(2));
output = divide(d1, v2);
EXPECT_FLOAT_EQ(std::numeric_limits<double>::infinity(), output(0).val());
EXPECT_TRUE(std::isnan(output(1).val()));
EXPECT_FLOAT_EQ(-std::numeric_limits<double>::infinity(), output(2).val());
output = divide(v1, d2);
EXPECT_FLOAT_EQ(std::numeric_limits<double>::infinity(), output(0).val());
EXPECT_TRUE (std::isnan(output(1).val()));
EXPECT_FLOAT_EQ(-std::numeric_limits<double>::infinity(), output(2).val());
output = divide(v1, v2);
EXPECT_FLOAT_EQ(std::numeric_limits<double>::infinity(), output(0).val());
EXPECT_TRUE (std::isnan(output(1).val()));
EXPECT_FLOAT_EQ(-std::numeric_limits<double>::infinity(), output(2).val());
}
TEST(AgradMatrix, divide_matrix) {
using stan::math::divide;
using stan::math::matrix_d;
using stan::agrad::matrix_v;
matrix_d d1(2,2);
matrix_v v1(2,2);
double d2;
AVAR v2;
d1 << 100, 0, -3, 4;
v1 << 100, 0, -3, 4;
d2 = -2;
v2 = -2;
matrix_d output_d = divide(d1, d2);
EXPECT_FLOAT_EQ(-50, output_d(0,0));
EXPECT_FLOAT_EQ( 0, output_d(0,1));
EXPECT_FLOAT_EQ(1.5, output_d(1,0));
EXPECT_FLOAT_EQ( -2, output_d(1,1));
matrix_v output;
output = divide(d1, v2);
EXPECT_FLOAT_EQ(-50, output(0,0).val());
EXPECT_FLOAT_EQ( 0, output(0,1).val());
EXPECT_FLOAT_EQ(1.5, output(1,0).val());
EXPECT_FLOAT_EQ( -2, output(1,1).val());
output = divide(v1, d2);
EXPECT_FLOAT_EQ(-50, output(0,0).val());
EXPECT_FLOAT_EQ( 0, output(0,1).val());
EXPECT_FLOAT_EQ(1.5, output(1,0).val());
EXPECT_FLOAT_EQ( -2, output(1,1).val());
output = divide(v1, v2);
EXPECT_FLOAT_EQ(-50, output(0,0).val());
EXPECT_FLOAT_EQ( 0, output(0,1).val());
EXPECT_FLOAT_EQ(1.5, output(1,0).val());
EXPECT_FLOAT_EQ( -2, output(1,1).val());
d2 = 0;
v2 = 0;
output_d = divide(d1, d2);
EXPECT_FLOAT_EQ(std::numeric_limits<double>::infinity(), output_d(0,0));
EXPECT_TRUE(std::isnan(output_d(0,1)));
EXPECT_FLOAT_EQ(-std::numeric_limits<double>::infinity(), output_d(1,0));
EXPECT_FLOAT_EQ(std::numeric_limits<double>::infinity(), output_d(1,1));
output = divide(d1, v2);
EXPECT_FLOAT_EQ(std::numeric_limits<double>::infinity(), output(0,0).val());
EXPECT_TRUE (std::isnan(output(0,1).val()));
EXPECT_FLOAT_EQ(-std::numeric_limits<double>::infinity(), output(1,0).val());
EXPECT_FLOAT_EQ(std::numeric_limits<double>::infinity(), output(1,1).val());
output = divide(v1, d2);
EXPECT_FLOAT_EQ(std::numeric_limits<double>::infinity(), output(0,0).val());
EXPECT_TRUE (std::isnan(output(0,1).val()));
EXPECT_FLOAT_EQ(-std::numeric_limits<double>::infinity(), output(1,0).val());
EXPECT_FLOAT_EQ(std::numeric_limits<double>::infinity(), output(1,1).val());
output = divide(v1, v2);
EXPECT_FLOAT_EQ(std::numeric_limits<double>::infinity(), output(0,0).val());
EXPECT_TRUE (std::isnan(output(0,1).val()));
EXPECT_FLOAT_EQ(-std::numeric_limits<double>::infinity(), output(1,0).val());
EXPECT_FLOAT_EQ(std::numeric_limits<double>::infinity(), output(1,1).val());
}
// end divide tests
// min tests
TEST(AgradMatrix, min_vector) {
using stan::math::min;
using stan::math::vector_d;
using stan::agrad::vector_v;
vector_d d1(3);
vector_v v1(3);
d1 << 100, 0, -3;
v1 << 100, 0, -3;
AVAR output;
output = min(d1);
EXPECT_FLOAT_EQ(-3, output.val());
output = min(v1);
EXPECT_FLOAT_EQ(-3, output.val());
}
TEST(AgradMatrix, min_vector_exception) {
using stan::math::min;
using stan::math::max;
using stan::math::vector_d;
using stan::agrad::vector_v;
vector_d d;
vector_v v;
d.resize(0);
v.resize(0);
EXPECT_EQ(std::numeric_limits<double>::infinity(), min(v).val());
EXPECT_EQ(-std::numeric_limits<double>::infinity(), max(v).val());
}
TEST(AgradMatrix, min_rowvector) {
using stan::math::min;
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
row_vector_d d1(3);
row_vector_v v1(3);
d1 << 100, 0, -3;
v1 << 100, 0, -3;
AVAR output;
output = min(d1);
EXPECT_FLOAT_EQ(-3, output.val());
output = min(v1);
EXPECT_FLOAT_EQ(-3, output.val());
}
TEST(AgradMatrix, min_rowvector_exception) {
using stan::math::min;
using stan::agrad::row_vector_v;
row_vector_v v;
EXPECT_FLOAT_EQ(std::numeric_limits<double>::infinity(), min(v).val());
}
TEST(AgradMatrix, min_matrix) {
using stan::math::min;
using stan::math::matrix_d;
using stan::agrad::matrix_v;
matrix_d d1(3,1);
matrix_v v1(1,3);
d1 << 100, 0, -3;
v1 << 100, 0, -3;
AVAR output;
output = min(d1);
EXPECT_FLOAT_EQ(-3, output.val());
output = min(v1);
EXPECT_FLOAT_EQ(-3, output.val());
}
TEST(AgradMatrix, min_matrix_exception) {
using stan::math::min;
using stan::agrad::matrix_v;
matrix_v v;
EXPECT_FLOAT_EQ(std::numeric_limits<double>::infinity(), min(v).val());
}
// end min tests
// max tests
TEST(AgradMatrix, max_vector) {
using stan::math::max;
using stan::math::vector_d;
using stan::agrad::vector_v;
vector_d d1(3);
vector_v v1(3);
d1 << 100, 0, -3;
v1 << 100, 0, -3;
AVAR output;
output = max(d1);
EXPECT_FLOAT_EQ(100, output.val());
output = max(v1);
EXPECT_FLOAT_EQ(100, output.val());
}
TEST(AgradMatrix, max_vector_exception) {
using stan::math::max;
using stan::agrad::vector_v;
vector_v v;
EXPECT_EQ(-std::numeric_limits<double>::infinity(), max(v).val());
}
TEST(AgradMatrix, max_rowvector) {
using stan::math::max;
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
row_vector_d d1(3);
row_vector_v v1(3);
d1 << 100, 0, -3;
v1 << 100, 0, -3;
AVAR output;
output = max(d1);
EXPECT_FLOAT_EQ(100, output.val());
output = max(v1);
EXPECT_FLOAT_EQ(100, output.val());
}
TEST(AgradMatrix, max_rowvector_exception) {
using stan::math::max;
using stan::agrad::row_vector_v;
row_vector_v v;
EXPECT_EQ(-std::numeric_limits<double>::infinity(), max(v).val());
}
TEST(AgradMatrix, max_matrix) {
using stan::math::max;
using stan::math::matrix_d;
using stan::agrad::matrix_v;
matrix_d d1(3,1);
matrix_v v1(1,3);
d1 << 100, 0, -3;
v1 << 100, 0, -3;
AVAR output;
output = max(d1);
EXPECT_FLOAT_EQ(100, output.val());
output = max(v1);
EXPECT_FLOAT_EQ(100, output.val());
}
TEST(AgradMatrix, max_matrix_exception) {
using stan::math::max;
using stan::agrad::matrix_v;
matrix_v v;
EXPECT_EQ(-std::numeric_limits<double>::infinity(), max(v).val());
}
// end max tests
// mean tests
TEST(AgradMatrix, mean_vector) {
using stan::math::mean;
using stan::math::vector_d;
using stan::agrad::vector_v;
vector_d d1(3);
vector_v v1(3);
d1 << 100, 0, -3;
v1 << 100, 0, -3;
AVAR output;
output = mean(d1);
EXPECT_FLOAT_EQ(97.0/3.0, output.val());
output = mean(v1);
EXPECT_FLOAT_EQ(97.0/3.0, output.val());
}
TEST(AgradMatrix, mean_vector_exception) {
using stan::math::mean;
using stan::math::vector_d;
using stan::agrad::vector_v;
vector_d d;
vector_v v;
EXPECT_THROW(mean(d), std::domain_error);
EXPECT_THROW(mean(v), std::domain_error);
}
TEST(AgradMatrix, mean_rowvector) {
using stan::math::mean;
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
row_vector_d d1(3);
row_vector_v v1(3);
d1 << 100, 0, -3;
v1 << 100, 0, -3;
AVAR output;
output = mean(d1);
EXPECT_FLOAT_EQ(97.0/3.0, output.val());
output = mean(v1);
EXPECT_FLOAT_EQ(97.0/3.0, output.val());
}
TEST(AgradMatrix, mean_rowvector_exception) {
using stan::math::mean;
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
row_vector_d d;
row_vector_v v;
EXPECT_THROW(mean(d), std::domain_error);
EXPECT_THROW(mean(v), std::domain_error);
}
TEST(AgradMatrix, mean_matrix) {
using stan::math::mean;
using stan::math::matrix_d;
using stan::agrad::matrix_v;
matrix_d d1(3,1);
matrix_v v1(1,3);
d1 << 100, 0, -3;
v1 << 100, 0, -3;
AVAR output;
output = mean(d1);
EXPECT_FLOAT_EQ(97.0/3.0, output.val());
output = mean(v1);
EXPECT_FLOAT_EQ(97.0/3.0, output.val());
}
TEST(AgradMatrix, mean_matrix_exception) {
using stan::math::mean;
using stan::math::matrix_d;
using stan::agrad::matrix_v;
matrix_d d;
matrix_v v;
EXPECT_THROW(mean(d), std::domain_error);
EXPECT_THROW(mean(v), std::domain_error);
}
// end mean tests
// variance tests
TEST(AgradMatrix, variance_vector) {
using stan::math::variance;
using stan::math::vector_d;
using stan::agrad::vector_v;
vector_d d(1);
d << 12.9;
EXPECT_FLOAT_EQ(0.0,variance(d));
vector_d d1(6);
vector_v v1(6);
d1 << 1, 2, 3, 4, 5, 6;
v1 << 1, 2, 3, 4, 5, 6;
EXPECT_FLOAT_EQ(17.5/5.0, variance(d1));
EXPECT_FLOAT_EQ(17.5/5.0, variance(v1).val());
d1.resize(1);
v1.resize(1);
EXPECT_FLOAT_EQ(0.0, variance(d1));
EXPECT_FLOAT_EQ(0.0, variance(v1).val());
}
TEST(AgradMatrix, variance_vector_exception) {
using stan::math::variance;
using stan::math::vector_d;
using stan::agrad::vector_v;
vector_d d1;
vector_v v1;
EXPECT_THROW(variance(d1), std::domain_error);
EXPECT_THROW(variance(v1), std::domain_error);
}
TEST(AgradMatrix, variance_rowvector) {
using stan::math::variance;
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
row_vector_d d(1);
d << 12.9;
EXPECT_FLOAT_EQ(0.0,variance(d));
row_vector_d d1(6);
row_vector_v v1(6);
d1 << 1, 2, 3, 4, 5, 6;
v1 << 1, 2, 3, 4, 5, 6;
EXPECT_FLOAT_EQ(17.5/5.0, variance(d1));
EXPECT_FLOAT_EQ(17.5/5.0, variance(v1).val());
d1.resize(1);
v1.resize(1);
EXPECT_FLOAT_EQ(0.0, variance(d1));
EXPECT_FLOAT_EQ(0.0, variance(v1).val());
}
TEST(AgradMatrix, variance_rowvector_exception) {
using stan::math::variance;
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
row_vector_d d1;
row_vector_v v1;
EXPECT_THROW(variance(d1), std::domain_error);
EXPECT_THROW(variance(v1), std::domain_error);
}
TEST(AgradMatrix, variance_matrix) {
using stan::math::variance;
using stan::math::matrix_d;
using stan::agrad::matrix_v;
matrix_d m(1,1);
m << 12.9;
EXPECT_FLOAT_EQ(0.0,variance(m));
matrix_d d1(2, 3);
matrix_v v1(2, 3);
d1 << 1, 2, 3, 4, 5, 6;
v1 << 1, 2, 3, 4, 5, 6;
EXPECT_FLOAT_EQ(17.5/5.0, variance(d1));
EXPECT_FLOAT_EQ(17.5/5.0, variance(v1).val());
d1.resize(1,1);
v1.resize(1,1);
EXPECT_FLOAT_EQ(0.0, variance(d1));
EXPECT_FLOAT_EQ(0.0, variance(v1).val());
}
TEST(AgradMatrix, variance_matrix_exception) {
using stan::math::variance;
using stan::math::matrix_d;
using stan::agrad::matrix_v;
matrix_d d1;
matrix_v v1;
EXPECT_THROW(variance(d1), std::domain_error);
EXPECT_THROW(variance(v1), std::domain_error);
d1.resize(0,1);
v1.resize(0,1);
EXPECT_THROW(variance(d1), std::domain_error);
EXPECT_THROW(variance(v1), std::domain_error);
d1.resize(1,0);
v1.resize(1,0);
EXPECT_THROW(variance(d1), std::domain_error);
EXPECT_THROW(variance(v1), std::domain_error);
}
// end variance tests
// sd tests
TEST(AgradMatrix, sd_vector) {
using stan::math::sd;
using stan::math::vector_d;
using stan::agrad::vector_v;
vector_d v(1);
v << 1.0;
EXPECT_FLOAT_EQ(0.0, sd(v));
vector_d d1(6);
vector_v v1(6);
d1 << 1, 2, 3, 4, 5, 6;
v1 << 1, 2, 3, 4, 5, 6;
EXPECT_FLOAT_EQ(std::sqrt(17.5/5.0), sd(d1));
EXPECT_FLOAT_EQ(std::sqrt(17.5/5.0), sd(v1).val());
d1.resize(1);
v1.resize(1);
EXPECT_FLOAT_EQ(0.0, sd(d1));
EXPECT_FLOAT_EQ(0.0, sd(v1).val());
}
TEST(AgradMatrix, sd_vector_exception) {
using stan::math::sd;
using stan::math::vector_d;
using stan::agrad::vector_v;
vector_d d1;
vector_v v1;
EXPECT_THROW(sd(d1), std::domain_error);
EXPECT_THROW(sd(v1), std::domain_error);
}
TEST(AgradMatrix, sd_rowvector) {
using stan::math::sd;
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
row_vector_d v(1);
v << 1.0;
EXPECT_FLOAT_EQ(0.0, sd(v));
row_vector_d d1(6);
row_vector_v v1(6);
d1 << 1, 2, 3, 4, 5, 6;
v1 << 1, 2, 3, 4, 5, 6;
EXPECT_FLOAT_EQ(std::sqrt(17.5/5.0), sd(d1));
EXPECT_FLOAT_EQ(std::sqrt(17.5/5.0), sd(v1).val());
d1.resize(1);
v1.resize(1);
EXPECT_FLOAT_EQ(0.0, sd(d1));
EXPECT_FLOAT_EQ(0.0, sd(v1).val());
}
TEST(AgradMatrix, sd_rowvector_exception) {
using stan::math::sd;
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
row_vector_d d;
row_vector_v v;
EXPECT_THROW(sd(d), std::domain_error);
EXPECT_THROW(sd(v), std::domain_error);
}
TEST(AgradMatrix, sd_matrix) {
using stan::math::sd;
using stan::math::matrix_d;
using stan::agrad::matrix_v;
matrix_d v(1,1);
v << 1.0;
EXPECT_FLOAT_EQ(0.0, sd(v));
matrix_d d1(2, 3);
matrix_v v1(2, 3);
d1 << 1, 2, 3, 4, 5, 6;
v1 << 1, 2, 3, 4, 5, 6;
EXPECT_FLOAT_EQ(std::sqrt(17.5/5.0), sd(d1));
EXPECT_FLOAT_EQ(std::sqrt(17.5/5.0), sd(v1).val());
d1.resize(1, 1);
v1.resize(1, 1);
EXPECT_FLOAT_EQ(0.0, sd(d1));
EXPECT_FLOAT_EQ(0.0, sd(v1).val());
}
TEST(AgradMatrix, sd_matrix_exception) {
using stan::math::sd;
using stan::math::matrix_d;
using stan::agrad::matrix_v;
matrix_d d;
matrix_v v;
EXPECT_THROW(sd(d), std::domain_error);
EXPECT_THROW(sd(v), std::domain_error);
d.resize(1, 0);
v.resize(1, 0);
EXPECT_THROW(sd(d), std::domain_error);
EXPECT_THROW(sd(v), std::domain_error);
d.resize(0, 1);
v.resize(0, 1);
EXPECT_THROW(sd(d), std::domain_error);
EXPECT_THROW(sd(v), std::domain_error);
}
// end sd tests
// sum tests
TEST(AgradMatrix, sum_vector) {
using stan::math::sum;
using stan::math::vector_d;
using stan::agrad::vector_v;
vector_d d(6);
vector_v v(6);
d << 1, 2, 3, 4, 5, 6;
v << 1, 2, 3, 4, 5, 6;
AVAR output;
output = sum(d);
EXPECT_FLOAT_EQ(21.0, output.val());
output = sum(v);
EXPECT_FLOAT_EQ(21.0, output.val());
d.resize(0);
v.resize(0);
EXPECT_FLOAT_EQ(0.0, sum(d));
EXPECT_FLOAT_EQ(0.0, sum(v).val());
}
TEST(AgradMatrix, sum_rowvector) {
using stan::math::sum;
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
row_vector_d d(6);
row_vector_v v(6);
d << 1, 2, 3, 4, 5, 6;
v << 1, 2, 3, 4, 5, 6;
AVAR output;
output = sum(d);
EXPECT_FLOAT_EQ(21.0, output.val());
output = sum(v);
EXPECT_FLOAT_EQ(21.0, output.val());
d.resize(0);
v.resize(0);
EXPECT_FLOAT_EQ(0.0, sum(d));
EXPECT_FLOAT_EQ(0.0, sum(v).val());
}
TEST(AgradMatrix, sum_matrix) {
using stan::math::sum;
using stan::math::matrix_d;
using stan::agrad::matrix_v;
matrix_d d(2, 3);
matrix_v v(2, 3);
d << 1, 2, 3, 4, 5, 6;
v << 1, 2, 3, 4, 5, 6;
AVAR output;
output = sum(d);
EXPECT_FLOAT_EQ(21.0, output.val());
output = sum(v);
EXPECT_FLOAT_EQ(21.0, output.val());
d.resize(0, 0);
v.resize(0, 0);
EXPECT_FLOAT_EQ(0.0, sum(d));
EXPECT_FLOAT_EQ(0.0, sum(v).val());
}
// end sum tests
// multiply tests
TEST(AgradMatrix, multiply_scalar_scalar) {
using stan::agrad::multiply;
double d1, d2;
AVAR v1, v2;
d1 = 10;
v1 = 10;
d2 = -2;
v2 = -2;
EXPECT_FLOAT_EQ(-20.0, multiply(d1,d2));
EXPECT_FLOAT_EQ(-20.0, multiply(d1, v2).val());
EXPECT_FLOAT_EQ(-20.0, multiply(v1, d2).val());
EXPECT_FLOAT_EQ(-20.0, multiply(v1, v2).val());
EXPECT_FLOAT_EQ(6.0, multiply(AVAR(3),AVAR(2)).val());
EXPECT_FLOAT_EQ(6.0, multiply(3.0,AVAR(2)).val());
EXPECT_FLOAT_EQ(6.0, multiply(AVAR(3),2.0).val());
}
TEST(AgradMatrix, multiply_vector_scalar) {
using stan::math::vector_d;
using stan::agrad::vector_v;
vector_d d1(3);
vector_v v1(3);
double d2;
AVAR v2;
d1 << 100, 0, -3;
v1 << 100, 0, -3;
d2 = -2;
v2 = -2;
vector_v output;
output = multiply(d1, v2);
EXPECT_FLOAT_EQ(-200, output(0).val());
EXPECT_FLOAT_EQ( 0, output(1).val());
EXPECT_FLOAT_EQ( 6, output(2).val());
output = multiply(v1, d2);
EXPECT_FLOAT_EQ(-200, output(0).val());
EXPECT_FLOAT_EQ( 0, output(1).val());
EXPECT_FLOAT_EQ( 6, output(2).val());
output = multiply(v1, v2);
EXPECT_FLOAT_EQ(-200, output(0).val());
EXPECT_FLOAT_EQ( 0, output(1).val());
EXPECT_FLOAT_EQ( 6, output(2).val());
}
TEST(AgradMatrix, multiply_rowvector_scalar) {
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
row_vector_d d1(3);
row_vector_v v1(3);
double d2;
AVAR v2;
d1 << 100, 0, -3;
v1 << 100, 0, -3;
d2 = -2;
v2 = -2;
row_vector_v output;
output = multiply(d1, v2);
EXPECT_FLOAT_EQ(-200, output(0).val());
EXPECT_FLOAT_EQ( 0, output(1).val());
EXPECT_FLOAT_EQ( 6, output(2).val());
output = multiply(v1, d2);
EXPECT_FLOAT_EQ(-200, output(0).val());
EXPECT_FLOAT_EQ( 0, output(1).val());
EXPECT_FLOAT_EQ( 6, output(2).val());
output = multiply(v1, v2);
EXPECT_FLOAT_EQ(-200, output(0).val());
EXPECT_FLOAT_EQ( 0, output(1).val());
EXPECT_FLOAT_EQ( 6, output(2).val());
}
TEST(AgradMatrix, multiply_matrix_scalar) {
using stan::math::matrix_d;
using stan::agrad::matrix_v;
matrix_d d1(2,2);
matrix_v v1(2,2);
double d2;
AVAR v2;
d1 << 100, 0, -3, 4;
v1 << 100, 0, -3, 4;
d2 = -2;
v2 = -2;
matrix_v output;
output = multiply(d1, v2);
EXPECT_FLOAT_EQ(-200, output(0,0).val());
EXPECT_FLOAT_EQ( 0, output(0,1).val());
EXPECT_FLOAT_EQ( 6, output(1,0).val());
EXPECT_FLOAT_EQ( -8, output(1,1).val());
output = multiply(v1, d2);
EXPECT_FLOAT_EQ(-200, output(0,0).val());
EXPECT_FLOAT_EQ( 0, output(0,1).val());
EXPECT_FLOAT_EQ( 6, output(1,0).val());
EXPECT_FLOAT_EQ( -8, output(1,1).val());
output = multiply(v1, v2);
EXPECT_FLOAT_EQ(-200, output(0,0).val());
EXPECT_FLOAT_EQ( 0, output(0,1).val());
EXPECT_FLOAT_EQ( 6, output(1,0).val());
EXPECT_FLOAT_EQ( -8, output(1,1).val());
}
TEST(AgradMatrix, multiply_rowvector_vector) {
using stan::math::vector_d;
using stan::agrad::vector_v;
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
row_vector_d d1(3);
row_vector_v v1(3);
vector_d d2(3);
vector_v v2(3);
d1 << 1, 3, -5;
v1 << 1, 3, -5;
d2 << 4, -2, -1;
v2 << 4, -2, -1;
EXPECT_FLOAT_EQ(3, multiply(v1, v2).val());
EXPECT_FLOAT_EQ(3, multiply(v1, d2).val());
EXPECT_FLOAT_EQ(3, multiply(d1, v2).val());
d1.resize(1);
v1.resize(1);
EXPECT_THROW(multiply(v1, v2), std::domain_error);
EXPECT_THROW(multiply(v1, d2), std::domain_error);
EXPECT_THROW(multiply(d1, v2), std::domain_error);
}
TEST(AgradMatrix, multiply_vector_rowvector) {
using stan::agrad::matrix_v;
using stan::math::vector_d;
using stan::agrad::vector_v;
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
vector_d d1(3);
vector_v v1(3);
row_vector_d d2(3);
row_vector_v v2(3);
d1 << 1, 3, -5;
v1 << 1, 3, -5;
d2 << 4, -2, -1;
v2 << 4, -2, -1;
matrix_v output = multiply(v1, v2);
EXPECT_EQ(3, output.rows());
EXPECT_EQ(3, output.cols());
EXPECT_FLOAT_EQ( 4, output(0,0).val());
EXPECT_FLOAT_EQ( -2, output(0,1).val());
EXPECT_FLOAT_EQ( -1, output(0,2).val());
EXPECT_FLOAT_EQ( 12, output(1,0).val());
EXPECT_FLOAT_EQ( -6, output(1,1).val());
EXPECT_FLOAT_EQ( -3, output(1,2).val());
EXPECT_FLOAT_EQ(-20, output(2,0).val());
EXPECT_FLOAT_EQ( 10, output(2,1).val());
EXPECT_FLOAT_EQ( 5, output(2,2).val());
output = multiply(v1, d2);
EXPECT_EQ(3, output.rows());
EXPECT_EQ(3, output.cols());
EXPECT_FLOAT_EQ( 4, output(0,0).val());
EXPECT_FLOAT_EQ( -2, output(0,1).val());
EXPECT_FLOAT_EQ( -1, output(0,2).val());
EXPECT_FLOAT_EQ( 12, output(1,0).val());
EXPECT_FLOAT_EQ( -6, output(1,1).val());
EXPECT_FLOAT_EQ( -3, output(1,2).val());
EXPECT_FLOAT_EQ(-20, output(2,0).val());
EXPECT_FLOAT_EQ( 10, output(2,1).val());
EXPECT_FLOAT_EQ( 5, output(2,2).val());
output = multiply(d1, v2);
EXPECT_EQ(3, output.rows());
EXPECT_EQ(3, output.cols());
EXPECT_FLOAT_EQ( 4, output(0,0).val());
EXPECT_FLOAT_EQ( -2, output(0,1).val());
EXPECT_FLOAT_EQ( -1, output(0,2).val());
EXPECT_FLOAT_EQ( 12, output(1,0).val());
EXPECT_FLOAT_EQ( -6, output(1,1).val());
EXPECT_FLOAT_EQ( -3, output(1,2).val());
EXPECT_FLOAT_EQ(-20, output(2,0).val());
EXPECT_FLOAT_EQ( 10, output(2,1).val());
EXPECT_FLOAT_EQ( 5, output(2,2).val());
}
TEST(AgradMatrix, multiply_matrix_vector) {
using stan::math::matrix_d;
using stan::agrad::matrix_v;
using stan::math::vector_d;
using stan::agrad::vector_v;
matrix_d d1(3,2);
matrix_v v1(3,2);
vector_d d2(2);
vector_v v2(2);
d1 << 1, 3, -5, 4, -2, -1;
v1 << 1, 3, -5, 4, -2, -1;
d2 << -2, 4;
v2 << -2, 4;
vector_v output = multiply(v1, v2);
EXPECT_EQ(3, output.size());
EXPECT_FLOAT_EQ(10, output(0).val());
EXPECT_FLOAT_EQ(26, output(1).val());
EXPECT_FLOAT_EQ( 0, output(2).val());
output = multiply(v1, d2);
EXPECT_EQ(3, output.size());
EXPECT_FLOAT_EQ(10, output(0).val());
EXPECT_FLOAT_EQ(26, output(1).val());
EXPECT_FLOAT_EQ( 0, output(2).val());
output = multiply(d1, v2);
EXPECT_EQ(3, output.size());
EXPECT_FLOAT_EQ(10, output(0).val());
EXPECT_FLOAT_EQ(26, output(1).val());
EXPECT_FLOAT_EQ( 0, output(2).val());
}
TEST(AgradMatrix, multiply_matrix_vector_exception) {
using stan::math::matrix_d;
using stan::agrad::matrix_v;
using stan::math::vector_d;
using stan::agrad::vector_v;
matrix_d d1(3,2);
matrix_v v1(3,2);
vector_d d2(4);
vector_v v2(4);
EXPECT_THROW(multiply(v1, v2), std::domain_error);
EXPECT_THROW(multiply(v1, d2), std::domain_error);
EXPECT_THROW(multiply(d1, v2), std::domain_error);
}
TEST(AgradMatrix, multiply_rowvector_matrix) {
using stan::math::matrix_d;
using stan::agrad::matrix_v;
using stan::agrad::vector_v;
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
row_vector_d d1(3);
row_vector_v v1(3);
matrix_d d2(3,2);
matrix_v v2(3,2);
d1 << -2, 4, 1;
v1 << -2, 4, 1;
d2 << 1, 3, -5, 4, -2, -1;
v2 << 1, 3, -5, 4, -2, -1;
vector_v output = multiply(v1, v2);
EXPECT_EQ(2, output.size());
EXPECT_FLOAT_EQ(-24, output(0).val());
EXPECT_FLOAT_EQ( 9, output(1).val());
output = multiply(v1, d2);
EXPECT_EQ(2, output.size());
EXPECT_FLOAT_EQ(-24, output(0).val());
EXPECT_FLOAT_EQ( 9, output(1).val());
output = multiply(d1, v2);
EXPECT_EQ(2, output.size());
EXPECT_FLOAT_EQ(-24, output(0).val());
EXPECT_FLOAT_EQ( 9, output(1).val());
}
TEST(AgradMatrix, multiply_rowvector_matrix_exception) {
using stan::math::matrix_d;
using stan::agrad::matrix_v;
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
row_vector_d d1(4);
row_vector_v v1(4);
matrix_d d2(3,2);
matrix_v v2(3,2);
EXPECT_THROW(multiply(v1, v2), std::domain_error);
EXPECT_THROW(multiply(v1, d2), std::domain_error);
EXPECT_THROW(multiply(d1, v2), std::domain_error);
}
TEST(AgradMatrix, multiply_matrix_matrix) {
using stan::math::matrix_d;
using stan::agrad::matrix_v;
matrix_d d1(2,3);
matrix_v v1(2,3);
matrix_d d2(3,2);
matrix_v v2(3,2);
d1 << 9, 24, 3, 46, -9, -33;
v1 << 9, 24, 3, 46, -9, -33;
d2 << 1, 3, -5, 4, -2, -1;
v2 << 1, 3, -5, 4, -2, -1;
matrix_v output = multiply(v1, v2);
EXPECT_EQ(2, output.rows());
EXPECT_EQ(2, output.cols());
EXPECT_FLOAT_EQ(-117, output(0,0).val());
EXPECT_FLOAT_EQ( 120, output(0,1).val());
EXPECT_FLOAT_EQ( 157, output(1,0).val());
EXPECT_FLOAT_EQ( 135, output(1,1).val());
output = multiply(v1, d2);
EXPECT_EQ(2, output.rows());
EXPECT_EQ(2, output.cols());
EXPECT_FLOAT_EQ(-117, output(0,0).val());
EXPECT_FLOAT_EQ( 120, output(0,1).val());
EXPECT_FLOAT_EQ( 157, output(1,0).val());
EXPECT_FLOAT_EQ( 135, output(1,1).val());
output = multiply(d1, v2);
EXPECT_EQ(2, output.rows());
EXPECT_EQ(2, output.cols());
EXPECT_FLOAT_EQ(-117, output(0,0).val());
EXPECT_FLOAT_EQ( 120, output(0,1).val());
EXPECT_FLOAT_EQ( 157, output(1,0).val());
EXPECT_FLOAT_EQ( 135, output(1,1).val());
}
TEST(AgradMatrix, multiply_matrix_matrix_exception) {
using stan::math::matrix_d;
using stan::agrad::matrix_v;
matrix_d d1(2,2);
matrix_v v1(2,2);
matrix_d d2(3,2);
matrix_v v2(3,2);
EXPECT_THROW(multiply(v1, v2), std::domain_error);
EXPECT_THROW(multiply(v1, d2), std::domain_error);
EXPECT_THROW(multiply(d1, v2), std::domain_error);
}
// end multiply tests
TEST(AgradMatrix,transpose_matrix) {
using stan::math::matrix_d;
using stan::agrad::matrix_v;
using stan::math::transpose;
EXPECT_EQ(0,transpose(matrix_v()).size());
EXPECT_EQ(0,transpose(matrix_d()).size());
matrix_v a(2,3);
a << -1.0, 2.0, -3.0,
5.0, 10.0, 100.0;
AVEC x = createAVEC(a(0,0), a(0,2), a(1,1));
matrix_v c = transpose(a);
EXPECT_FLOAT_EQ(-1.0,c(0,0).val());
EXPECT_FLOAT_EQ(10.0,c(1,1).val());
EXPECT_FLOAT_EQ(-3.0,c(2,0).val());
EXPECT_EQ(3,c.rows());
EXPECT_EQ(2,c.cols());
VEC g = cgradvec(c(2,0),x);
EXPECT_FLOAT_EQ(0.0,g[0]);
EXPECT_FLOAT_EQ(1.0,g[1]);
EXPECT_FLOAT_EQ(0.0,g[2]);
}
TEST(AgradMatrix,transpose_vector) {
using stan::agrad::vector_v;
using stan::agrad::row_vector_v;
using stan::math::transpose;
vector_v a(3);
a << 1.0, 2.0, 3.0;
AVEC x = createAVEC(a(0),a(1),a(2));
row_vector_v a_tr = transpose(a);
EXPECT_EQ(a.size(),a_tr.size());
for (size_t i = 0; i < 3; ++i)
EXPECT_FLOAT_EQ(a(i).val(),a_tr(i).val());
VEC g = cgradvec(a_tr(1),x);
EXPECT_FLOAT_EQ(0.0,g[0]);
EXPECT_FLOAT_EQ(1.0,g[1]);
EXPECT_FLOAT_EQ(0.0,g[2]);
}
TEST(AgradMatrix,transpose_row_vector) {
using stan::agrad::vector_v;
using stan::agrad::row_vector_v;
using stan::math::transpose;
row_vector_v a(3);
a << 1.0, 2.0, 3.0;
AVEC x = createAVEC(a(0),a(1),a(2));
vector_v a_tr = transpose(a);
EXPECT_EQ(a.size(),a_tr.size());
for (size_t i = 0; i < 3; ++i)
EXPECT_FLOAT_EQ(a(i).val(),a_tr(i).val());
VEC g = cgradvec(a_tr(1),x);
EXPECT_FLOAT_EQ(0.0,g[0]);
EXPECT_FLOAT_EQ(1.0,g[1]);
EXPECT_FLOAT_EQ(0.0,g[2]);
}
TEST(AgradMatrix,mv_trace) {
using stan::math::trace;
using stan::agrad::matrix_v;
matrix_v a(2,2);
a << -1.0, 2.0,
5.0, 10.0;
AVEC x = createAVEC(a(0,0), a(0,1), a(1,0), a(1,1));
AVAR s = trace(a);
EXPECT_FLOAT_EQ(9.0,s.val());
VEC g = cgradvec(s,x);
EXPECT_FLOAT_EQ(1.0, g[0]);
EXPECT_FLOAT_EQ(0.0, g[1]);
EXPECT_FLOAT_EQ(0.0, g[2]);
EXPECT_FLOAT_EQ(1.0, g[3]);
}
TEST(AgradMatrix,mdivide_left_val) {
using stan::math::matrix_d;
using stan::agrad::matrix_v;
using stan::math::mdivide_left;
matrix_v Av(2,2);
matrix_d Ad(2,2);
matrix_v I;
Av << 2.0, 3.0,
5.0, 7.0;
Ad << 2.0, 3.0,
5.0, 7.0;
I = mdivide_left(Av,Av);
EXPECT_NEAR(1.0,I(0,0).val(),1.0E-12);
EXPECT_NEAR(0.0,I(0,1).val(),1.0E-12);
EXPECT_NEAR(0.0,I(1,0).val(),1.0E-12);
EXPECT_NEAR(1.0,I(1,1).val(),1.0e-12);
I = mdivide_left(Av,Ad);
EXPECT_NEAR(1.0,I(0,0).val(),1.0E-12);
EXPECT_NEAR(0.0,I(0,1).val(),1.0E-12);
EXPECT_NEAR(0.0,I(1,0).val(),1.0E-12);
EXPECT_NEAR(1.0,I(1,1).val(),1.0e-12);
I = mdivide_left(Ad,Av);
EXPECT_NEAR(1.0,I(0,0).val(),1.0E-12);
EXPECT_NEAR(0.0,I(0,1).val(),1.0E-12);
EXPECT_NEAR(0.0,I(1,0).val(),1.0E-12);
EXPECT_NEAR(1.0,I(1,1).val(),1.0e-12);
}
TEST(AgradMatrix,mdivide_left_grad_vv) {
using stan::math::matrix_d;
using stan::agrad::matrix_v;
using stan::math::mdivide_left;
using stan::math::multiply;
matrix_d Ad(2,2), Ad_tmp(2,2);
matrix_d Bd(2,2), Bd_tmp(2,2);
matrix_d Cd(2,2);
Ad << 2.0, 3.0,
5.0, 7.0;
Bd << 12.0, 13.0,
15.0, 17.0;
size_t i,j,k;
for (i = 0; i < Bd.rows(); i++) {
for (j = 0; j < Bd.cols(); j++) {
matrix_v A(2,2);
matrix_v B(2,2);
matrix_v C;
for (k = 0; k < 4; k++) {
A(k) = Ad(k);
B(k) = Bd(k);
}
C = mdivide_left(A,B);
AVEC x = createAVEC(A(0,0),A(1,0),A(0,1),A(1,1),
B(0,0),B(1,0),B(0,1),B(1,1));
VEC g;
C(i,j).grad(x,g);
for (k = 0; k < 4; k++) {
Ad_tmp.setZero();
Ad_tmp(k) = 1.0;
Cd = -mdivide_left(Ad,multiply(Ad_tmp,mdivide_left(Ad,Bd)));
EXPECT_NEAR(Cd(i,j),g[k],1.0E-12);
}
for (k = 0; k < 4; k++) {
Bd_tmp.setZero();
Bd_tmp(k) = 1.0;
Cd = mdivide_left(Ad,Bd_tmp);
EXPECT_NEAR(Cd(i,j),g[4+k],1.0E-12);
}
}
}
}
TEST(AgradMatrix,mdivide_left_grad_dv) {
using stan::math::matrix_d;
using stan::agrad::matrix_v;
using stan::math::mdivide_left;
using stan::math::multiply;
matrix_d Ad(2,2), Ad_tmp(2,2);
matrix_d Bd(2,2), Bd_tmp(2,2);
matrix_d Cd(2,2);
Ad << 2.0, 3.0,
5.0, 7.0;
Bd << 12.0, 13.0,
15.0, 17.0;
size_t i,j,k;
for (i = 0; i < Bd.rows(); i++) {
for (j = 0; j < Bd.cols(); j++) {
matrix_v B(2,2);
matrix_v C;
for (k = 0; k < 4; k++) {
B(k) = Bd(k);
}
C = mdivide_left(Ad,B);
AVEC x = createAVEC(B(0,0),B(1,0),B(0,1),B(1,1));
VEC g;
C(i,j).grad(x,g);
for (k = 0; k < 4; k++) {
Bd_tmp.setZero();
Bd_tmp(k) = 1.0;
Cd = mdivide_left(Ad,Bd_tmp);
EXPECT_NEAR(Cd(i,j),g[k],1.0E-12);
}
}
}
}
TEST(AgradMatrix,mdivide_left_grad_vd) {
using stan::math::matrix_d;
using stan::agrad::matrix_v;
using stan::math::mdivide_left;
using stan::math::multiply;
matrix_d Ad(2,2), Ad_tmp(2,2);
matrix_d Bd(2,2), Bd_tmp(2,2);
matrix_d Cd(2,2);
Ad << 2.0, 3.0,
5.0, 7.0;
Bd << 12.0, 13.0,
15.0, 17.0;
size_t i,j,k;
for (i = 0; i < Bd.rows(); i++) {
for (j = 0; j < Bd.cols(); j++) {
matrix_v A(2,2);
matrix_v C;
for (k = 0; k < 4; k++) {
A(k) = Ad(k);
}
C = mdivide_left(A,Bd);
AVEC x = createAVEC(A(0,0),A(1,0),A(0,1),A(1,1));
VEC g;
C(i,j).grad(x,g);
for (k = 0; k < 4; k++) {
Ad_tmp.setZero();
Ad_tmp(k) = 1.0;
Cd = -mdivide_left(Ad,multiply(Ad_tmp,mdivide_left(Ad,Bd)));
EXPECT_NEAR(Cd(i,j),g[k],1.0E-12);
}
}
}
}
TEST(AgradMatrix,mdivide_right_val) {
using stan::math::matrix_d;
using stan::agrad::matrix_v;
using stan::math::mdivide_right;
matrix_v Av(2,2);
matrix_d Ad(2,2);
matrix_v I;
Av << 2.0, 3.0,
5.0, 7.0;
Ad << 2.0, 3.0,
5.0, 7.0;
I = mdivide_right(Av,Av);
EXPECT_NEAR(1.0,I(0,0).val(),1.0E-12);
EXPECT_NEAR(0.0,I(0,1).val(),1.0E-12);
EXPECT_NEAR(0.0,I(1,0).val(),1.0E-12);
EXPECT_NEAR(1.0,I(1,1).val(),1.0e-12);
I = mdivide_right(Av,Ad);
EXPECT_NEAR(1.0,I(0,0).val(),1.0E-12);
EXPECT_NEAR(0.0,I(0,1).val(),1.0E-12);
EXPECT_NEAR(0.0,I(1,0).val(),1.0E-12);
EXPECT_NEAR(1.0,I(1,1).val(),1.0e-12);
I = mdivide_right(Ad,Av);
EXPECT_NEAR(1.0,I(0,0).val(),1.0E-12);
EXPECT_NEAR(0.0,I(0,1).val(),1.0E-12);
EXPECT_NEAR(0.0,I(1,0).val(),1.0E-12);
EXPECT_NEAR(1.0,I(1,1).val(),1.0e-12);
}
TEST(AgradMatrix,mdivide_left_tri_val) {
using stan::math::matrix_d;
using stan::agrad::matrix_v;
using stan::math::mdivide_left_tri;
matrix_v Av(2,2);
matrix_v Av_inv(2,2);
matrix_d Ad(2,2);
matrix_v I;
Av << 2.0, 0.0,
5.0, 7.0;
Ad << 2.0, 0.0,
5.0, 7.0;
I = mdivide_left_tri<Eigen::Lower>(Av,Av);
EXPECT_NEAR(1.0,I(0,0).val(),1.0E-12);
EXPECT_NEAR(0.0,I(0,1).val(),1.0E-12);
EXPECT_NEAR(0.0,I(1,0).val(),1.0E-12);
EXPECT_NEAR(1.0,I(1,1).val(),1.0e-12);
I = mdivide_left_tri<Eigen::Lower>(Av,Ad);
EXPECT_NEAR(1.0,I(0,0).val(),1.0E-12);
EXPECT_NEAR(0.0,I(0,1).val(),1.0E-12);
EXPECT_NEAR(0.0,I(1,0).val(),1.0E-12);
EXPECT_NEAR(1.0,I(1,1).val(),1.0e-12);
I = mdivide_left_tri<Eigen::Lower>(Ad,Av);
EXPECT_NEAR(1.0,I(0,0).val(),1.0E-12);
EXPECT_NEAR(0.0,I(0,1).val(),1.0E-12);
EXPECT_NEAR(0.0,I(1,0).val(),1.0E-12);
EXPECT_NEAR(1.0,I(1,1).val(),1.0e-12);
Av_inv = mdivide_left_tri<Eigen::Lower>(Av);
I = Av * Av_inv;
EXPECT_NEAR(1.0,I(0,0).val(),1.0E-12);
EXPECT_NEAR(0.0,I(0,1).val(),1.0E-12);
EXPECT_NEAR(0.0,I(1,0).val(),1.0E-12);
EXPECT_NEAR(1.0,I(1,1).val(),1.0e-12);
Av << 2.0, 3.0,
0.0, 7.0;
Ad << 2.0, 3.0,
0.0, 7.0;
I = mdivide_left_tri<Eigen::Upper>(Av,Av);
EXPECT_NEAR(1.0,I(0,0).val(),1.0E-12);
EXPECT_NEAR(0.0,I(0,1).val(),1.0E-12);
EXPECT_NEAR(0.0,I(1,0).val(),1.0E-12);
EXPECT_NEAR(1.0,I(1,1).val(),1.0e-12);
I = mdivide_left_tri<Eigen::Upper>(Av,Ad);
EXPECT_NEAR(1.0,I(0,0).val(),1.0E-12);
EXPECT_NEAR(0.0,I(0,1).val(),1.0E-12);
EXPECT_NEAR(0.0,I(1,0).val(),1.0E-12);
EXPECT_NEAR(1.0,I(1,1).val(),1.0e-12);
I = mdivide_left_tri<Eigen::Upper>(Ad,Av);
EXPECT_NEAR(1.0,I(0,0).val(),1.0E-12);
EXPECT_NEAR(0.0,I(0,1).val(),1.0E-12);
EXPECT_NEAR(0.0,I(1,0).val(),1.0E-12);
EXPECT_NEAR(1.0,I(1,1).val(),1.0e-12);
}
TEST(AgradMatrix,mdivide_left_tri_lower_grad_vv) {
using stan::math::matrix_d;
using stan::agrad::matrix_v;
using stan::math::mdivide_left_tri;
using stan::math::multiply;
matrix_d Ad(2,2), Ad_tmp(2,2);
matrix_d Bd(2,2), Bd_tmp(2,2);
matrix_d Cd(2,2);
Ad << 2.0, 0.0,
5.0, 7.0;
Bd << 12.0, 13.0,
15.0, 17.0;
size_t i,j,k,l;
for (i = 0; i < Bd.rows(); i++) {
for (j = 0; j < Bd.cols(); j++) {
matrix_v A(2,2);
matrix_v B(2,2);
matrix_v C;
VEC g;
for (k = 0; k < 4; k++) {
A(k) = Ad(k);
B(k) = Bd(k);
}
C = mdivide_left_tri<Eigen::Lower>(A,B);
AVEC x = createAVEC(A(0,0),A(1,0),A(0,1),A(1,1),
B(0,0),B(1,0),B(0,1),B(1,1));
C(i,j).grad(x,g);
for (l = 0; l < Ad_tmp.cols(); l++) {
for (k = 0; k < Ad_tmp.rows(); k++) {
if (k >= l) {
Ad_tmp.setZero();
Ad_tmp(k,l) = 1.0;
Cd = -mdivide_left_tri<Eigen::Lower>(Ad,multiply(Ad_tmp,mdivide_left_tri<Eigen::Lower>(Ad,Bd)));
EXPECT_NEAR(Cd(i,j),g[k + l*Ad_tmp.rows()],1.0E-12);
}
else {
EXPECT_NEAR(0.0,g[k + l*Ad_tmp.rows()],1.0E-12);
}
}
}
for (k = 0; k < 4; k++) {
Bd_tmp.setZero();
Bd_tmp(k) = 1.0;
Cd = mdivide_left_tri<Eigen::Lower>(Ad,Bd_tmp);
EXPECT_NEAR(Cd(i,j),g[4+k],1.0E-12);
}
}
}
}
TEST(AgradMatrix,mdivide_left_tri_lower_grad_dv) {
using stan::math::matrix_d;
using stan::agrad::matrix_v;
using stan::math::mdivide_left_tri;
using stan::math::multiply;
matrix_d Ad(2,2), Ad_tmp(2,2);
matrix_d Bd(2,2), Bd_tmp(2,2);
matrix_d Cd(2,2);
Ad << 2.0, 0.0,
5.0, 7.0;
Bd << 12.0, 13.0,
15.0, 17.0;
size_t i,j,k;
for (i = 0; i < Bd.rows(); i++) {
for (j = 0; j < Bd.cols(); j++) {
matrix_v B(2,2);
matrix_v C;
VEC g;
for (k = 0; k < 4; k++) {
B(k) = Bd(k);
}
C = mdivide_left_tri<Eigen::Lower>(Ad,B);
AVEC x = createAVEC(B(0,0),B(1,0),B(0,1),B(1,1));
C(i,j).grad(x,g);
for (k = 0; k < 4; k++) {
Bd_tmp.setZero();
Bd_tmp(k) = 1.0;
Cd = mdivide_left_tri<Eigen::Lower>(Ad,Bd_tmp);
EXPECT_NEAR(Cd(i,j),g[k],1.0E-12);
}
}
}
}
TEST(AgradMatrix,mdivide_left_tri_lower_grad_vd) {
using stan::math::matrix_d;
using stan::agrad::matrix_v;
using stan::math::mdivide_left_tri;
using stan::math::multiply;
matrix_d Ad(2,2), Ad_tmp(2,2);
matrix_d Bd(2,2), Bd_tmp(2,2);
matrix_d Cd(2,2);
Ad << 2.0, 0.0,
5.0, 7.0;
Bd << 12.0, 13.0,
15.0, 17.0;
size_t i,j,k,l;
for (i = 0; i < Bd.rows(); i++) {
for (j = 0; j < Bd.cols(); j++) {
matrix_v A(2,2);
matrix_v C;
VEC g;
for (k = 0; k < 4; k++) {
A(k) = Ad(k);
}
C = mdivide_left_tri<Eigen::Lower>(A,Bd);
AVEC x = createAVEC(A(0,0),A(1,0),A(0,1),A(1,1));
C(i,j).grad(x,g);
for (l = 0; l < Ad_tmp.cols(); l++) {
for (k = 0; k < Ad_tmp.rows(); k++) {
if (k >= l) {
Ad_tmp.setZero();
Ad_tmp(k,l) = 1.0;
Cd = -mdivide_left_tri<Eigen::Lower>(Ad,multiply(Ad_tmp,mdivide_left_tri<Eigen::Lower>(Ad,Bd)));
EXPECT_NEAR(Cd(i,j),g[k + l*Ad_tmp.rows()],1.0E-12);
}
else {
EXPECT_NEAR(0.0,g[k + l*Ad_tmp.rows()],1.0E-12);
}
}
}
}
}
}
TEST(AgradMatrix,mdivide_left_tri_upper_grad_vv) {
using stan::math::matrix_d;
using stan::agrad::matrix_v;
using stan::math::mdivide_left_tri;
using stan::math::multiply;
matrix_d Ad(2,2), Ad_tmp(2,2);
matrix_d Bd(2,2), Bd_tmp(2,2);
matrix_d Cd(2,2);
Ad << 2.0, 3.0,
0.0, 7.0;
Bd << 12.0, 13.0,
15.0, 17.0;
size_t i,j,k,l;
for (i = 0; i < Bd.rows(); i++) {
for (j = 0; j < Bd.cols(); j++) {
matrix_v A(2,2);
matrix_v B(2,2);
matrix_v C;
VEC g;
for (k = 0; k < 4; k++) {
A(k) = Ad(k);
B(k) = Bd(k);
}
C = mdivide_left_tri<Eigen::Upper>(A,B);
AVEC x = createAVEC(A(0,0),A(1,0),A(0,1),A(1,1),
B(0,0),B(1,0),B(0,1),B(1,1));
C(i,j).grad(x,g);
for (l = 0; l < Ad_tmp.cols(); l++) {
for (k = 0; k < Ad_tmp.rows(); k++) {
if (k <= l) {
Ad_tmp.setZero();
Ad_tmp(k,l) = 1.0;
Cd = -mdivide_left_tri<Eigen::Upper>(Ad,multiply(Ad_tmp,mdivide_left_tri<Eigen::Upper>(Ad,Bd)));
EXPECT_NEAR(Cd(i,j),g[k + l*Ad_tmp.rows()],1.0E-12);
}
else {
EXPECT_NEAR(0.0,g[k + l*Ad_tmp.rows()],1.0E-12);
}
}
}
for (k = 0; k < 4; k++) {
Bd_tmp.setZero();
Bd_tmp(k) = 1.0;
Cd = mdivide_left_tri<Eigen::Upper>(Ad,Bd_tmp);
EXPECT_NEAR(Cd(i,j),g[4+k],1.0E-12);
}
}
}
}
TEST(AgradMatrix,mdivide_left_tri_upper_grad_dv) {
using stan::math::matrix_d;
using stan::agrad::matrix_v;
using stan::math::mdivide_left_tri;
using stan::math::multiply;
matrix_d Ad(2,2), Ad_tmp(2,2);
matrix_d Bd(2,2), Bd_tmp(2,2);
matrix_d Cd(2,2);
Ad << 2.0, 3.0,
0.0, 7.0;
Bd << 12.0, 13.0,
15.0, 17.0;
size_t i,j,k;
for (i = 0; i < Bd.rows(); i++) {
for (j = 0; j < Bd.cols(); j++) {
matrix_v B(2,2);
matrix_v C;
VEC g;
for (k = 0; k < 4; k++) {
B(k) = Bd(k);
}
C = mdivide_left_tri<Eigen::Upper>(Ad,B);
AVEC x = createAVEC(B(0,0),B(1,0),B(0,1),B(1,1));
C(i,j).grad(x,g);
for (k = 0; k < 4; k++) {
Bd_tmp.setZero();
Bd_tmp(k) = 1.0;
Cd = mdivide_left_tri<Eigen::Upper>(Ad,Bd_tmp);
EXPECT_NEAR(Cd(i,j),g[k],1.0E-12);
}
}
}
}
TEST(AgradMatrix,mdivide_left_tri_upper_grad_vd) {
using stan::math::matrix_d;
using stan::agrad::matrix_v;
using stan::math::mdivide_left_tri;
using stan::math::multiply;
matrix_d Ad(2,2), Ad_tmp(2,2);
matrix_d Bd(2,2), Bd_tmp(2,2);
matrix_d Cd(2,2);
Ad << 2.0, 3.0,
0.0, 7.0;
Bd << 12.0, 13.0,
15.0, 17.0;
size_t i,j,k,l;
for (i = 0; i < Bd.rows(); i++) {
for (j = 0; j < Bd.cols(); j++) {
matrix_v A(2,2);
matrix_v C;
VEC g;
for (k = 0; k < 4; k++) {
A(k) = Ad(k);
}
C = mdivide_left_tri<Eigen::Upper>(A,Bd);
AVEC x = createAVEC(A(0,0),A(1,0),A(0,1),A(1,1));
C(i,j).grad(x,g);
for (l = 0; l < Ad_tmp.cols(); l++) {
for (k = 0; k < Ad_tmp.rows(); k++) {
if (k <= l) {
Ad_tmp.setZero();
Ad_tmp(k,l) = 1.0;
Cd = -mdivide_left_tri<Eigen::Upper>(Ad,multiply(Ad_tmp,mdivide_left_tri<Eigen::Upper>(Ad,Bd)));
EXPECT_NEAR(Cd(i,j),g[k + l*Ad_tmp.rows()],1.0E-12);
}
else {
EXPECT_NEAR(0.0,g[k + l*Ad_tmp.rows()],1.0E-12);
}
}
}
}
}
}
// // FIXME: Fails in g++ 4.2 -- can't find agrad version of mdivide_left_tri
// // Works in clang++ and later g++
// // TEST(AgradMatrix,mdivide_left_tri2) {
// // using stan::math::mdivide_left_tri;
// // using stan::agrad::mdivide_left_tri;
// // int k = 3;
// // Eigen::Matrix<stan::agrad::var,Eigen::Dynamic,Eigen::Dynamic> L(k,k);
// // L << 1, 2, 3, 4, 5, 6, 7, 8, 9;
// // Eigen::Matrix<stan::agrad::var,Eigen::Dynamic,Eigen::Dynamic> I(k,k);
// // I.setIdentity();
// // L = mdivide_left_tri<Eigen::Lower>(L, I);
// // }
TEST(AgradMatrix,inverse_val) {
using stan::math::inverse;
using stan::agrad::matrix_v;
matrix_v a(2,2);
a << 2.0, 3.0,
5.0, 7.0;
matrix_v a_inv = inverse(a);
matrix_v I = multiply(a,a_inv);
EXPECT_NEAR(1.0,I(0,0).val(),1.0E-12);
EXPECT_NEAR(0.0,I(0,1).val(),1.0E-12);
EXPECT_NEAR(0.0,I(1,0).val(),1.0E-12);
EXPECT_NEAR(1.0,I(1,1).val(),1.0e-12);
EXPECT_THROW(inverse(matrix_v(2,3)), std::domain_error);
}
TEST(AgradMatrix,inverse_grad) {
using stan::math::inverse;
using stan::agrad::matrix_v;
for (size_t k = 0; k < 2; ++k) {
for (size_t l = 0; l < 2; ++l) {
matrix_v ad(2,2);
ad << 2.0, 3.0,
5.0, 7.0;
AVEC x = createAVEC(ad(0,0),ad(0,1),ad(1,0),ad(1,1));
matrix_v ad_inv = inverse(ad);
// int k = 0;
// int l = 1;
VEC g;
ad_inv(k,l).grad(x,g);
int idx = 0;
for (int i = 0; i < 2; ++i) {
for (int j = 0; j < 2; ++j) {
EXPECT_FLOAT_EQ(-ad_inv(k,i).val() * ad_inv(j,l).val(), g[idx]);
++idx;
}
}
}
}
}
TEST(AgradMatrix,inverse_inverse_sum) {
using stan::math::sum;
using stan::math::inverse;
using stan::agrad::matrix_v;
matrix_v a(4,4);
a << 2.0, 3.0, 4.0, 5.0,
9.0, -1.0, 2.0, 2.0,
4.0, 3.0, 7.0, -1.0,
0.0, 1.0, 19.0, 112.0;
AVEC x;
for (int i = 0; i < 4; ++i)
for (int j = 0; j < 4; ++j)
x.push_back(a(i,j));
AVAR a_inv_inv_sum = sum(inverse(inverse(a)));
VEC g = cgradvec(a_inv_inv_sum,x);
for (size_t k = 0; k < x.size(); ++k)
EXPECT_FLOAT_EQ(1.0,g[k]);
}
TEST(AgradMatrix,eigenval_sum) {
using stan::math::sum;
using stan::agrad::matrix_v;
using stan::agrad::vector_v;
using stan::math::eigenvalues_sym;
matrix_v a(3,3);
a <<
1.0, 2.0, 3.0,
2.0, 5.0, 7.9,
3.0, 7.9, 1.08;
AVEC x = createAVEC(a(0,0), a(1,1), a(2,2), a(1,2));
x.push_back(a(0,1));
x.push_back(a(2,0));
// grad sum eig = I
vector_v a_eigenvalues = eigenvalues_sym(a);
AVAR sum_a_eigenvalues = sum(a_eigenvalues);
VEC g = cgradvec(sum_a_eigenvalues,x);
EXPECT_NEAR(1.0,g[0],1.0E-11);
EXPECT_NEAR(1.0,g[1],1.0E-11);
EXPECT_NEAR(1.0,g[2],1.0E-11);
EXPECT_NEAR(0.0,g[3],1.0E-10);
EXPECT_NEAR(0.0,g[4],1.0E-10);
EXPECT_NEAR(0.0,g[5],1.0E-10);
}
TEST(AgradMatrix,mat_cholesky) {
using stan::agrad::matrix_v;
using stan::math::transpose;
using stan::math::cholesky_decompose;
using stan::math::singular_values;
// symmetric
matrix_v X(2,2);
AVAR a = 3.0;
AVAR b = -1.0;
AVAR c = -1.0;
AVAR d = 1.0;
X << a, b,
c, d;
matrix_v L = cholesky_decompose(X);
matrix_v LL_trans = multiply(L,transpose(L));
EXPECT_FLOAT_EQ(a.val(),LL_trans(0,0).val());
EXPECT_FLOAT_EQ(b.val(),LL_trans(0,1).val());
EXPECT_FLOAT_EQ(c.val(),LL_trans(1,0).val());
EXPECT_FLOAT_EQ(d.val(),LL_trans(1,1).val());
EXPECT_NO_THROW(singular_values(X));
}
// norm tests for raw calls; move into promotion lib
TEST(AgradMatrix,mv_squaredNorm) {
using stan::agrad::matrix_v;
matrix_v a(2,2);
a << -1.0, 2.0,
5.0, 10.0;
AVEC x = createAVEC(a(0,0), a(0,1), a(1,0), a(1,1));
AVAR s = a.squaredNorm();
EXPECT_FLOAT_EQ(130.0,s.val());
VEC g = cgradvec(s,x);
EXPECT_FLOAT_EQ(-2.0, g[0]);
EXPECT_FLOAT_EQ(4.0, g[1]);
EXPECT_FLOAT_EQ(10.0, g[2]);
EXPECT_FLOAT_EQ(20.0, g[3]);
}
TEST(AgradMatrix,mv_norm) {
using stan::agrad::matrix_v;
matrix_v a(2,1);
a << -3.0, 4.0;
AVEC x = createAVEC(a(0,0), a(1,0));
AVAR s = a.norm();
EXPECT_FLOAT_EQ(5.0,s.val());
// (see hypot in special_functions_test)
VEC g = cgradvec(s,x);
EXPECT_FLOAT_EQ(-3.0/5.0, g[0]);
EXPECT_FLOAT_EQ(4.0/5.0, g[1]);
}
TEST(AgradMatrix,mv_lp_norm) {
using stan::agrad::matrix_v;
matrix_v a(2,2);
a << -1.0, 2.0,
5.0, 0.0;
AVEC x = createAVEC(a(0,0), a(0,1), a(1,0), a(1,1));
AVAR s = a.lpNorm<1>();
EXPECT_FLOAT_EQ(8.0,s.val());
VEC g = cgradvec(s,x);
EXPECT_FLOAT_EQ(-1.0,g[0]);
EXPECT_FLOAT_EQ(1.0,g[1]);
EXPECT_FLOAT_EQ(1.0,g[2]);
EXPECT_FLOAT_EQ(0.0,g[3]); // ? depends on impl here, could be -1 or 1
}
TEST(AgradMatrix,mv_lp_norm_inf) {
using stan::agrad::matrix_v;
matrix_v a(2,2);
a << -1.0, 2.0,
-5.0, 0.0;
AVEC x = createAVEC(a(0,0), a(0,1), a(1,0), a(1,1));
AVAR s = a.lpNorm<Eigen::Infinity>();
EXPECT_FLOAT_EQ(5.0,s.val());
VEC g = cgradvec(s,x);
EXPECT_FLOAT_EQ(0.0,g[0]);
EXPECT_FLOAT_EQ(0.0,g[1]);
EXPECT_FLOAT_EQ(-1.0,g[2]);
EXPECT_FLOAT_EQ(0.0,g[3]);
}
TEST(AgradMatrix,multiply_scalar_vector_cv) {
using stan::agrad::multiply;
using stan::agrad::vector_v;
vector_v x(3);
x << 1, 2, 3;
AVEC x_ind = createAVEC(x(0),x(1),x(2));
vector_v y = multiply(2.0,x);
EXPECT_FLOAT_EQ(2.0,y(0).val());
EXPECT_FLOAT_EQ(4.0,y(1).val());
EXPECT_FLOAT_EQ(6.0,y(2).val());
VEC g = cgradvec(y(0),x_ind);
EXPECT_FLOAT_EQ(2.0,g[0]);
EXPECT_FLOAT_EQ(0.0,g[1]);
EXPECT_FLOAT_EQ(0.0,g[2]);
}
TEST(AgradMatrix,multiply_scalar_vector_vv) {
using stan::agrad::multiply;
using stan::agrad::vector_v;
vector_v x(3);
x << 1, 4, 9;
AVAR two = 2.0;
AVEC x_ind = createAVEC(x(0),x(1),x(2),two);
vector_v y = multiply(two,x);
EXPECT_FLOAT_EQ(2.0,y(0).val());
EXPECT_FLOAT_EQ(8.0,y(1).val());
EXPECT_FLOAT_EQ(18.0,y(2).val());
VEC g = cgradvec(y(1),x_ind);
EXPECT_FLOAT_EQ(0.0,g[0]);
EXPECT_FLOAT_EQ(2.0,g[1]);
EXPECT_FLOAT_EQ(0.0,g[2]);
EXPECT_FLOAT_EQ(4.0,g[3]);
}
TEST(AgradMatrix,multiply_scalar_vector_vc) {
using stan::agrad::multiply;
using stan::agrad::vector_v;
vector_v x(3);
x << 1, 2, 3;
AVAR two = 2.0;
AVEC x_ind = createAVEC(two);
vector_v y = multiply(two,x);
EXPECT_FLOAT_EQ(2.0,y(0).val());
EXPECT_FLOAT_EQ(4.0,y(1).val());
EXPECT_FLOAT_EQ(6.0,y(2).val());
VEC g = cgradvec(y(2),x_ind);
EXPECT_FLOAT_EQ(3.0,g[0]);
}
TEST(AgradMatrix,multiply_scalar_row_vector_cv) {
using stan::agrad::multiply;
using stan::agrad::row_vector_v;
row_vector_v x(3);
x << 1, 2, 3;
AVEC x_ind = createAVEC(x(0),x(1),x(2));
row_vector_v y = multiply(2.0,x);
EXPECT_FLOAT_EQ(2.0,y(0).val());
EXPECT_FLOAT_EQ(4.0,y(1).val());
EXPECT_FLOAT_EQ(6.0,y(2).val());
VEC g = cgradvec(y(0),x_ind);
EXPECT_FLOAT_EQ(2.0,g[0]);
EXPECT_FLOAT_EQ(0.0,g[1]);
EXPECT_FLOAT_EQ(0.0,g[2]);
}
TEST(AgradMatrix,multiply_scalar_row_vector_vv) {
using stan::agrad::multiply;
using stan::agrad::row_vector_v;
row_vector_v x(3);
x << 1, 4, 9;
AVAR two = 2.0;
AVEC x_ind = createAVEC(x(0),x(1),x(2),two);
row_vector_v y = multiply(two,x);
EXPECT_FLOAT_EQ(2.0,y(0).val());
EXPECT_FLOAT_EQ(8.0,y(1).val());
EXPECT_FLOAT_EQ(18.0,y(2).val());
VEC g = cgradvec(y(1),x_ind);
EXPECT_FLOAT_EQ(0.0,g[0]);
EXPECT_FLOAT_EQ(2.0,g[1]);
EXPECT_FLOAT_EQ(0.0,g[2]);
EXPECT_FLOAT_EQ(4.0,g[3]);
}
TEST(AgradMatrix,multiply_scalar_row_vector_vc) {
using stan::agrad::multiply;
using stan::agrad::row_vector_v;
row_vector_v x(3);
x << 1, 2, 3;
AVAR two = 2.0;
AVEC x_ind = createAVEC(two);
row_vector_v y = multiply(two,x);
EXPECT_FLOAT_EQ(2.0,y(0).val());
EXPECT_FLOAT_EQ(4.0,y(1).val());
EXPECT_FLOAT_EQ(6.0,y(2).val());
VEC g = cgradvec(y(2),x_ind);
EXPECT_FLOAT_EQ(3.0,g[0]);
}
TEST(AgradMatrix,multiply_scalar_matrix_cv) {
using stan::agrad::multiply;
using stan::agrad::matrix_v;
matrix_v x(2,3);
x << 1, 2, 3, 4, 5, 6;
AVEC x_ind = createAVEC(x(0,0),x(0,1),x(0,2),x(1,0));
matrix_v y = multiply(2.0,x);
EXPECT_FLOAT_EQ(2.0,y(0,0).val());
EXPECT_FLOAT_EQ(4.0,y(0,1).val());
EXPECT_FLOAT_EQ(6.0,y(0,2).val());
VEC g = cgradvec(y(0,0),x_ind);
EXPECT_FLOAT_EQ(2.0,g[0]);
EXPECT_FLOAT_EQ(0.0,g[1]);
EXPECT_FLOAT_EQ(0.0,g[2]);
EXPECT_FLOAT_EQ(0.0,g[3]);
}
TEST(AgradMatrix,multiply_scalar_matrix_vc) {
using stan::agrad::multiply;
using stan::math::matrix_d;
using stan::agrad::matrix_v;
matrix_d x(2,3);
x << 1, 2, 3, 4, 5, 6;
AVAR two = 2.0;
AVEC x_ind = createAVEC(two);
matrix_v y = multiply(two,x);
EXPECT_FLOAT_EQ(2.0,y(0,0).val());
EXPECT_FLOAT_EQ(4.0,y(0,1).val());
EXPECT_FLOAT_EQ(6.0,y(0,2).val());
VEC g = cgradvec(y(1,0),x_ind);
EXPECT_FLOAT_EQ(4.0,g[0]);
}
TEST(AgradMatrix,elt_multiply_vec_vv) {
using stan::math::elt_multiply;
using stan::agrad::vector_v;
vector_v x(2);
x << 2, 5;
vector_v y(2);
y << 10, 100;
AVEC x_ind = createAVEC(x(0),x(1),y(0),y(1));
vector_v z = elt_multiply(x,y);
EXPECT_FLOAT_EQ(20.0,z(0).val());
EXPECT_FLOAT_EQ(500.0,z(1).val());
VEC g = cgradvec(z(0),x_ind);
EXPECT_FLOAT_EQ(10.0,g[0]);
EXPECT_FLOAT_EQ(0.0,g[1]);
EXPECT_FLOAT_EQ(2.0,g[2]);
EXPECT_FLOAT_EQ(0.0,g[3]);
}
TEST(AgradMatrix,elt_multiply_vec_vd) {
using stan::math::elt_multiply;
using stan::math::vector_d;
using stan::agrad::vector_v;
vector_v x(2);
x << 2, 5;
vector_d y(2);
y << 10, 100;
AVEC x_ind = createAVEC(x(0),x(1));
vector_v z = elt_multiply(x,y);
EXPECT_FLOAT_EQ(20.0,z(0).val());
EXPECT_FLOAT_EQ(500.0,z(1).val());
VEC g = cgradvec(z(0),x_ind);
EXPECT_FLOAT_EQ(10.0,g[0]);
EXPECT_FLOAT_EQ(0.0,g[1]);
}
TEST(AgradMatrix,elt_multiply_vec_dv) {
using stan::math::elt_multiply;
using stan::math::vector_d;
using stan::agrad::vector_v;
vector_d x(2);
x << 2, 5;
vector_v y(2);
y << 10, 100;
AVEC x_ind = createAVEC(y(0),y(1));
vector_v z = elt_multiply(x,y);
EXPECT_FLOAT_EQ(20.0,z(0).val());
EXPECT_FLOAT_EQ(500.0,z(1).val());
VEC g = cgradvec(z(0),x_ind);
EXPECT_FLOAT_EQ(2.0,g[0]);
EXPECT_FLOAT_EQ(0.0,g[1]);
}
TEST(AgradMatrix,elt_multiply_row_vec_vv) {
using stan::math::elt_multiply;
using stan::agrad::row_vector_v;
row_vector_v x(2);
x << 2, 5;
row_vector_v y(2);
y << 10, 100;
AVEC x_ind = createAVEC(x(0),x(1),y(0),y(1));
row_vector_v z = elt_multiply(x,y);
EXPECT_FLOAT_EQ(20.0,z(0).val());
EXPECT_FLOAT_EQ(500.0,z(1).val());
VEC g = cgradvec(z(0),x_ind);
EXPECT_FLOAT_EQ(10.0,g[0]);
EXPECT_FLOAT_EQ(0.0,g[1]);
EXPECT_FLOAT_EQ(2.0,g[2]);
EXPECT_FLOAT_EQ(0.0,g[3]);
}
TEST(AgradMatrix,elt_multiply_row_vec_vd) {
using stan::math::elt_multiply;
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
row_vector_v x(2);
x << 2, 5;
row_vector_d y(2);
y << 10, 100;
AVEC x_ind = createAVEC(x(0),x(1));
row_vector_v z = elt_multiply(x,y);
EXPECT_FLOAT_EQ(20.0,z(0).val());
EXPECT_FLOAT_EQ(500.0,z(1).val());
VEC g = cgradvec(z(0),x_ind);
EXPECT_FLOAT_EQ(10.0,g[0]);
EXPECT_FLOAT_EQ(0.0,g[1]);
}
TEST(AgradMatrix,elt_multiply_row_vec_dv) {
using stan::math::elt_multiply;
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
row_vector_d x(2);
x << 2, 5;
row_vector_v y(2);
y << 10, 100;
AVEC x_ind = createAVEC(y(0),y(1));
row_vector_v z = elt_multiply(x,y);
EXPECT_FLOAT_EQ(20.0,z(0).val());
EXPECT_FLOAT_EQ(500.0,z(1).val());
VEC g = cgradvec(z(0),x_ind);
EXPECT_FLOAT_EQ(2.0,g[0]);
EXPECT_FLOAT_EQ(0.0,g[1]);
}
TEST(AgradMatrix,elt_multiply_matrix_vv) {
using stan::math::elt_multiply;
using stan::agrad::matrix_v;
matrix_v x(2,3);
x << 2, 5, 6, 9, 13, 29;
matrix_v y(2,3);
y << 10, 100, 1000, 10000, 100000, 1000000;
AVEC x_ind = createAVEC(x(0,0),x(0,1),x(0,2),y(0,0));
matrix_v z = elt_multiply(x,y);
EXPECT_FLOAT_EQ(20.0,z(0,0).val());
EXPECT_FLOAT_EQ(500.0,z(0,1).val());
EXPECT_FLOAT_EQ(29000000.0,z(1,2).val());
VEC g = cgradvec(z(0,0),x_ind);
EXPECT_FLOAT_EQ(10.0,g[0]);
EXPECT_FLOAT_EQ(0.0,g[1]);
EXPECT_FLOAT_EQ(0.0,g[2]);
EXPECT_FLOAT_EQ(2.0,g[3]);
}
TEST(AgradMatrix,elt_multiply_matrix_vd) {
using stan::math::elt_multiply;
using stan::math::matrix_d;
using stan::agrad::matrix_v;
matrix_v x(2,3);
x << 2, 5, 6, 9, 13, 29;
matrix_d y(2,3);
y << 10, 100, 1000, 10000, 100000, 1000000;
AVEC x_ind = createAVEC(x(0,0),x(0,1),x(0,2),x(1,0));
matrix_v z = elt_multiply(x,y);
EXPECT_FLOAT_EQ(20.0,z(0,0).val());
EXPECT_FLOAT_EQ(500.0,z(0,1).val());
EXPECT_FLOAT_EQ(29000000.0,z(1,2).val());
VEC g = cgradvec(z(0,0),x_ind);
EXPECT_FLOAT_EQ(10.0,g[0]);
EXPECT_FLOAT_EQ(0.0,g[1]);
EXPECT_FLOAT_EQ(0.0,g[2]);
EXPECT_FLOAT_EQ(0.0,g[3]);
}
TEST(AgradMatrix,elt_multiply_matrix_dv) {
using stan::math::elt_multiply;
using stan::math::matrix_d;
using stan::agrad::matrix_v;
matrix_d x(2,3);
x << 2, 5, 6, 9, 13, 29;
matrix_v y(2,3);
y << 10, 100, 1000, 10000, 100000, 1000000;
AVEC x_ind = createAVEC(y(0,0),y(0,1));
matrix_v z = elt_multiply(x,y);
EXPECT_FLOAT_EQ(20.0,z(0,0).val());
EXPECT_FLOAT_EQ(500.0,z(0,1).val());
EXPECT_FLOAT_EQ(29000000.0,z(1,2).val());
VEC g = cgradvec(z(0,0),x_ind);
EXPECT_FLOAT_EQ(2.0,g[0]);
EXPECT_FLOAT_EQ(0.0,g[1]);
}
TEST(AgradMatrix,elt_divide_vec_vv) {
using stan::math::elt_divide;
using stan::agrad::vector_v;
vector_v x(2);
x << 2, 5;
vector_v y(2);
y << 10, 100;
AVEC x_ind = createAVEC(x(0),x(1),y(0),y(1));
vector_v z = elt_divide(x,y);
EXPECT_FLOAT_EQ(0.2,z(0).val());
EXPECT_FLOAT_EQ(0.05,z(1).val());
VEC g = cgradvec(z(0),x_ind);
EXPECT_FLOAT_EQ(1.0/10.0,g[0]);
EXPECT_FLOAT_EQ(0.0,g[1]);
EXPECT_FLOAT_EQ(2.0 / (- 10.0 * 10.0), g[2]);
EXPECT_FLOAT_EQ(0.0,g[3]);
}
TEST(AgradMatrix,elt_divide_vec_vd) {
using stan::math::elt_divide;
using stan::math::vector_d;
using stan::agrad::vector_v;
vector_v x(2);
x << 2, 5;
vector_d y(2);
y << 10, 100;
AVEC x_ind = createAVEC(x(0),x(1));
vector_v z = elt_divide(x,y);
EXPECT_FLOAT_EQ(0.2,z(0).val());
EXPECT_FLOAT_EQ(0.05,z(1).val());
VEC g = cgradvec(z(0),x_ind);
EXPECT_FLOAT_EQ(1.0/10.0,g[0]);
EXPECT_FLOAT_EQ(0.0,g[1]);
}
TEST(AgradMatrix,elt_divide_vec_dv) {
using stan::math::elt_divide;
using stan::math::vector_d;
using stan::agrad::vector_v;
vector_d x(2);
x << 2, 5;
vector_v y(2);
y << 10, 100;
AVEC x_ind = createAVEC(y(0),y(1));
vector_v z = elt_divide(x,y);
EXPECT_FLOAT_EQ(0.2,z(0).val());
EXPECT_FLOAT_EQ(0.05,z(1).val());
VEC g = cgradvec(z(0),x_ind);
EXPECT_FLOAT_EQ(2.0 / (- 10.0 * 10.0), g[0]);
EXPECT_FLOAT_EQ(0.0,g[1]);
}
TEST(AgradMatrix,elt_divide_rowvec_vv) {
using stan::math::elt_divide;
using stan::agrad::row_vector_v;
row_vector_v x(2);
x << 2, 5;
row_vector_v y(2);
y << 10, 100;
AVEC x_ind = createAVEC(x(0),x(1),y(0),y(1));
row_vector_v z = elt_divide(x,y);
EXPECT_FLOAT_EQ(0.2,z(0).val());
EXPECT_FLOAT_EQ(0.05,z(1).val());
VEC g = cgradvec(z(0),x_ind);
EXPECT_FLOAT_EQ(1.0/10.0,g[0]);
EXPECT_FLOAT_EQ(0.0,g[1]);
EXPECT_FLOAT_EQ(2.0 / (- 10.0 * 10.0), g[2]);
EXPECT_FLOAT_EQ(0.0,g[3]);
}
TEST(AgradMatrix,elt_divide_rowvec_vd) {
using stan::math::elt_divide;
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
row_vector_v x(2);
x << 2, 5;
row_vector_d y(2);
y << 10, 100;
AVEC x_ind = createAVEC(x(0),x(1));
row_vector_v z = elt_divide(x,y);
EXPECT_FLOAT_EQ(0.2,z(0).val());
EXPECT_FLOAT_EQ(0.05,z(1).val());
VEC g = cgradvec(z(0),x_ind);
EXPECT_FLOAT_EQ(1.0/10.0,g[0]);
EXPECT_FLOAT_EQ(0.0,g[1]);
}
TEST(AgradMatrix,elt_divide_rowvec_dv) {
using stan::math::elt_divide;
using stan::math::row_vector_d;
using stan::agrad::row_vector_v;
row_vector_d x(2);
x << 2, 5;
row_vector_v y(2);
y << 10, 100;
AVEC x_ind = createAVEC(y(0),y(1));
row_vector_v z = elt_divide(x,y);
EXPECT_FLOAT_EQ(0.2,z(0).val());
EXPECT_FLOAT_EQ(0.05,z(1).val());
VEC g = cgradvec(z(0),x_ind);
EXPECT_FLOAT_EQ(2.0 / (- 10.0 * 10.0), g[0]);
EXPECT_FLOAT_EQ(0.0,g[1]);
}
TEST(AgradMatrix,elt_divide_mat_vv) {
using stan::math::elt_divide;
using stan::agrad::matrix_v;
matrix_v x(2,3);
x << 2, 5, 7, 13, 29, 112;
matrix_v y(2,3);
y << 10, 100, 1000, 10000, 100000, 1000000;
AVEC x_ind = createAVEC(x(0,0),x(0,1),y(0,0),y(0,1));
matrix_v z = elt_divide(x,y);
EXPECT_FLOAT_EQ(0.2,z(0,0).val());
EXPECT_FLOAT_EQ(0.05,z(0,1).val());
EXPECT_FLOAT_EQ(112.0/1000000.0,z(1,2).val());
VEC g = cgradvec(z(0),x_ind);
EXPECT_FLOAT_EQ(1.0/10.0,g[0]);
EXPECT_FLOAT_EQ(0.0,g[1]);
EXPECT_FLOAT_EQ(2.0 / (- 10.0 * 10.0), g[2]);
EXPECT_FLOAT_EQ(0.0,g[3]);
}
TEST(AgradMatrix,elt_divide_mat_vd) {
using stan::math::elt_divide;
using stan::math::matrix_d;
using stan::agrad::matrix_v;
matrix_v x(2,3);
x << 2, 5, 7, 13, 29, 112;
matrix_d y(2,3);
y << 10, 100, 1000, 10000, 100000, 1000000;
AVEC x_ind = createAVEC(x(0,0),x(0,1));
matrix_v z = elt_divide(x,y);
EXPECT_FLOAT_EQ(0.2,z(0,0).val());
EXPECT_FLOAT_EQ(0.05,z(0,1).val());
EXPECT_FLOAT_EQ(112.0/1000000.0,z(1,2).val());
VEC g = cgradvec(z(0),x_ind);
EXPECT_FLOAT_EQ(1.0/10.0,g[0]);
EXPECT_FLOAT_EQ(0.0,g[1]);
}
TEST(AgradMatrix,elt_divide_mat_dv) {
using stan::math::elt_divide;
using stan::math::matrix_d;
using stan::agrad::matrix_v;
matrix_d x(2,3);
x << 2, 5, 7, 13, 29, 112;
matrix_v y(2,3);
y << 10, 100, 1000, 10000, 100000, 1000000;
AVEC x_ind = createAVEC(y(0,0),y(0,1));
matrix_v z = elt_divide(x,y);
EXPECT_FLOAT_EQ(0.2,z(0,0).val());
EXPECT_FLOAT_EQ(0.05,z(0,1).val());
EXPECT_FLOAT_EQ(112.0/1000000.0,z(1,2).val());
VEC g = cgradvec(z(0),x_ind);
EXPECT_FLOAT_EQ(2.0 / (- 10.0 * 10.0), g[0]);
EXPECT_FLOAT_EQ(0.0,g[1]);
}
TEST(AgradMatrix,col_v) {
using stan::math::col;
using stan::agrad::matrix_v;
using stan::agrad::vector_v;
matrix_v y(2,3);
y << 1, 2, 3, 4, 5, 6;
vector_v z = col(y,1);
EXPECT_EQ(2,z.size());
EXPECT_FLOAT_EQ(1.0,z[0].val());
EXPECT_FLOAT_EQ(4.0,z[1].val());
vector_v w = col(y,2);
EXPECT_EQ(2,w.size());
EXPECT_EQ(2.0,w[0].val());
EXPECT_EQ(5.0,w[1].val());
}
TEST(AgradMatrix,col_v_exc0) {
using stan::math::col;
using stan::agrad::matrix_v;
matrix_v y(2,3);
y << 1, 2, 3, 4, 5, 6;
EXPECT_THROW(col(y,0),std::domain_error);
EXPECT_THROW(col(y,7),std::domain_error);
}
TEST(AgradMatrix,col_v_excHigh) {
using stan::math::col;
using stan::agrad::matrix_v;
matrix_v y(2,3);
y << 1, 2, 3, 4, 5, 6;
EXPECT_THROW(col(y,0),std::domain_error);
EXPECT_THROW(col(y,5),std::domain_error);
}
TEST(AgradMatrix,row_v) {
using stan::math::row;
using stan::agrad::matrix_v;
using stan::agrad::vector_v;
matrix_v y(2,3);
y << 1, 2, 3, 4, 5, 6;
vector_v z = row(y,1);
EXPECT_EQ(3,z.size());
EXPECT_FLOAT_EQ(1.0,z[0].val());
EXPECT_FLOAT_EQ(2.0,z[1].val());
EXPECT_FLOAT_EQ(3.0,z[2].val());
vector_v w = row(y,2);
EXPECT_EQ(3,w.size());
EXPECT_EQ(4.0,w[0].val());
EXPECT_EQ(5.0,w[1].val());
EXPECT_EQ(6.0,w[2].val());
}
TEST(AgradMatrix,row_v_exc0) {
using stan::math::row;
using stan::agrad::matrix_v;
matrix_v y(2,3);
y << 1, 2, 3, 4, 5, 6;
EXPECT_THROW(row(y,0),std::domain_error);
EXPECT_THROW(row(y,7),std::domain_error);
}
TEST(AgradMatrix,row_v_excHigh) {
using stan::math::row;
using stan::agrad::matrix_v;
matrix_v y(2,3);
y << 1, 2, 3, 4, 5, 6;
EXPECT_THROW(row(y,0),std::domain_error);
EXPECT_THROW(row(y,5),std::domain_error);
}
TEST(AgradMatrix, dot_product_vv) {
AVEC a, b;
AVAR c;
for (int i = -1; i < 2; i++) { // a = (-1, 0, 1), b = (1, 2, 3)
a.push_back(i);
b.push_back(i + 2);
}
c = dot_product(&a[0], &b[0], 3);
EXPECT_EQ(2, c);
AVEC ab;
VEC grad;
for (size_t i = 0; i < 3; i++) {
ab.push_back(a[i]);
ab.push_back(b[i]);
}
c.grad(ab, grad);
EXPECT_EQ(grad[0], 1);
EXPECT_EQ(grad[1], -1);
EXPECT_EQ(grad[2], 2);
EXPECT_EQ(grad[3], 0);
EXPECT_EQ(grad[4], 3);
EXPECT_EQ(grad[5], 1);
}
TEST(AgradMatrix, dot_product_dv) {
VEC a;
AVEC b;
AVAR c;
for (int i = -1; i < 2; i++) { // a = (-1, 0, 1), b = (1, 2, 3)
a.push_back(i);
b.push_back(i + 2);
}
c = dot_product(&a[0], &b[0], 3);
EXPECT_EQ(2, c);
VEC grad;
c.grad(b, grad);
EXPECT_EQ(grad[0], -1);
EXPECT_EQ(grad[1], 0);
EXPECT_EQ(grad[2], 1);
}
TEST(AgradMatrix, dot_product_vd) {
AVEC a;
VEC b;
AVAR c;
for (int i = -1; i < 2; i++) { // a = (-1, 0, 1), b = (1, 2, 3)
a.push_back(i);
b.push_back(i + 2);
}
c = dot_product(&a[0], &b[0], 3);
EXPECT_EQ(2, c);
VEC grad;
c.grad(a, grad);
EXPECT_EQ(grad[0], 1);
EXPECT_EQ(grad[1], 2);
EXPECT_EQ(grad[2], 3);
}
TEST(AgradMatrix, dot_product_vv_vec) {
AVEC a, b;
AVAR c;
for (int i = -1; i < 2; i++) { // a = (-1, 0, 1), b = (1, 2, 3)
a.push_back(i);
b.push_back(i + 2);
}
c = dot_product(a, b);
EXPECT_EQ(2, c);
AVEC ab;
VEC grad;
for (size_t i = 0; i < 3; i++) {
ab.push_back(a[i]);
ab.push_back(b[i]);
}
c.grad(ab, grad);
EXPECT_EQ(grad[0], 1);
EXPECT_EQ(grad[1], -1);
EXPECT_EQ(grad[2], 2);
EXPECT_EQ(grad[3], 0);
EXPECT_EQ(grad[4], 3);
EXPECT_EQ(grad[5], 1);
}
TEST(AgradMatrix, dot_product_dv_vec) {
VEC a;
AVEC b;
AVAR c;
for (int i = -1; i < 2; i++) { // a = (-1, 0, 1), b = (1, 2, 3)
a.push_back(i);
b.push_back(i + 2);
}
c = dot_product(a, b);
EXPECT_EQ(2, c);
VEC grad;
c.grad(b, grad);
EXPECT_EQ(grad[0], -1);
EXPECT_EQ(grad[1], 0);
EXPECT_EQ(grad[2], 1);
}
TEST(AgradMatrix, dot_product_vd_vec) {
AVEC a;
VEC b;
AVAR c;
for (int i = -1; i < 2; i++) { // a = (-1, 0, 1), b = (1, 2, 3)
a.push_back(i);
b.push_back(i + 2);
}
c = dot_product(a, b);
EXPECT_EQ(2, c);
VEC grad;
c.grad(a, grad);
EXPECT_EQ(grad[0], 1);
EXPECT_EQ(grad[1], 2);
EXPECT_EQ(grad[2], 3);
}
template <int R, int C>
void assert_val_grad(Eigen::Matrix<stan::agrad::var,R,C>& v) {
v << -1.0, 0.0, 3.0;
AVEC x = createAVEC(v(0),v(1),v(2));
AVAR f = dot_self(v);
VEC g;
f.grad(x,g);
EXPECT_FLOAT_EQ(-2.0,g[0]);
EXPECT_FLOAT_EQ(0.0,g[1]);
EXPECT_FLOAT_EQ(6.0,g[2]);
}
TEST(AgradMatrix, dot_self_vec) {
using stan::math::dot_self;
Eigen::Matrix<AVAR,Eigen::Dynamic,1> v1(1);
v1 << 2.0;
EXPECT_NEAR(4.0,dot_self(v1).val(),1E-12);
Eigen::Matrix<AVAR,Eigen::Dynamic,1> v2(2);
v2 << 2.0, 3.0;
EXPECT_NEAR(13.0,dot_self(v2).val(),1E-12);
Eigen::Matrix<AVAR,Eigen::Dynamic,1> v3(3);
v3 << 2.0, 3.0, 4.0;
EXPECT_NEAR(29.0,dot_self(v3).val(),1E-12);
Eigen::Matrix<AVAR,Eigen::Dynamic,1> v(3);
assert_val_grad(v);
Eigen::Matrix<AVAR,1,Eigen::Dynamic> vv(3);
assert_val_grad(vv);
Eigen::Matrix<AVAR,Eigen::Dynamic,Eigen::Dynamic> vvv(3,1);
assert_val_grad(vvv);
Eigen::Matrix<AVAR,Eigen::Dynamic,Eigen::Dynamic> vvvv(1,3);
assert_val_grad(vvvv);
}
TEST(AgradMatrix,columns_dot_self) {
using stan::math::columns_dot_self;
Eigen::Matrix<AVAR,Eigen::Dynamic,Eigen::Dynamic> m1(1,1);
m1 << 2.0;
EXPECT_NEAR(4.0,columns_dot_self(m1)(0,0).val(),1E-12);
Eigen::Matrix<AVAR,Eigen::Dynamic,Eigen::Dynamic> m2(1,2);
m2 << 2.0, 3.0;
Eigen::Matrix<AVAR,Eigen::Dynamic,Eigen::Dynamic> x;
x = columns_dot_self(m2);
EXPECT_NEAR(4.0,x(0,0).val(),1E-12);
EXPECT_NEAR(9.0,x(0,1).val(),1E-12);
Eigen::Matrix<AVAR,Eigen::Dynamic,Eigen::Dynamic> m3(2,2);
m3 << 2.0, 3.0, 4.0, 5.0;
x = columns_dot_self(m3);
EXPECT_NEAR(20.0,x(0,0).val(),1E-12);
EXPECT_NEAR(34.0,x(0,1).val(),1E-12);
Eigen::Matrix<AVAR,Eigen::Dynamic,Eigen::Dynamic> vvv(3,1);
assert_val_grad(vvv);
Eigen::Matrix<AVAR,Eigen::Dynamic,Eigen::Dynamic> vvvv(1,3);
assert_val_grad(vvvv);
}
TEST(AgradMatrix,softmax) {
using stan::math::softmax;
using Eigen::Matrix;
using Eigen::Dynamic;
using stan::agrad::vector_v;
EXPECT_THROW(softmax(vector_v()),std::domain_error);
Matrix<AVAR,Dynamic,1> x(1);
x << 0.0;
Matrix<AVAR,Dynamic,1> theta = softmax(x);
EXPECT_EQ(1,theta.size());
EXPECT_FLOAT_EQ(1.0,theta[0].val());
Matrix<AVAR,Dynamic,1> x2(2);
x2 << -1.0, 1.0;
Matrix<AVAR,Dynamic,1> theta2 = softmax(x2);
EXPECT_EQ(2,theta2.size());
EXPECT_FLOAT_EQ(exp(-1)/(exp(-1) + exp(1)), theta2[0].val());
EXPECT_FLOAT_EQ(exp(1)/(exp(-1) + exp(1)), theta2[1].val());
Matrix<AVAR,Dynamic,1> x3(3);
x3 << -1.0, 1.0, 10.0;
Matrix<AVAR,Dynamic,1> theta3 = softmax(x3);
EXPECT_EQ(3,theta3.size());
EXPECT_FLOAT_EQ(exp(-1)/(exp(-1) + exp(1) + exp(10.0)), theta3[0].val());
EXPECT_FLOAT_EQ(exp(1)/(exp(-1) + exp(1) + exp(10.0)), theta3[1].val());
EXPECT_FLOAT_EQ(exp(10)/(exp(-1) + exp(1) + exp(10.0)), theta3[2].val());
}
TEST(AgradMatrix, meanStdVector) {
using stan::math::mean; // should use arg-dep lookup
AVEC x(0);
EXPECT_THROW(mean(x), std::domain_error);
x.push_back(1.0);
EXPECT_FLOAT_EQ(1.0, mean(x).val());
x.push_back(2.0);
EXPECT_FLOAT_EQ(1.5, mean(x).val());
AVEC y = createAVEC(1.0,2.0);
AVAR f = mean(y);
VEC grad = cgrad(f, y[0], y[1]);
EXPECT_FLOAT_EQ(0.5, grad[0]);
EXPECT_FLOAT_EQ(0.5, grad[1]);
EXPECT_EQ(2U, grad.size());
}
TEST(AgradMatrix, varianceStdVector) {
using stan::math::variance; // should use arg-dep lookup
AVEC y1 = createAVEC(0.5,2.0,3.5);
AVAR f1 = variance(y1);
VEC grad1 = cgrad(f1, y1[0], y1[1], y1[2]);
double f1_val = f1.val(); // save before cleaned out
AVEC y2 = createAVEC(0.5,2.0,3.5);
AVAR mean2 = (y2[0] + y2[1] + y2[2]) / 3.0;
AVAR sum_sq_diff_2
= (y2[0] - mean2) * (y2[0] - mean2)
+ (y2[1] - mean2) * (y2[1] - mean2)
+ (y2[2] - mean2) * (y2[2] - mean2);
AVAR f2 = sum_sq_diff_2 / (3 - 1);
EXPECT_EQ(f2.val(), f1_val);
VEC grad2 = cgrad(f2, y2[0], y2[1], y2[2]);
EXPECT_EQ(3U, grad1.size());
EXPECT_EQ(3U, grad2.size());
for (size_t i = 0; i < 3; ++i)
EXPECT_FLOAT_EQ(grad2[i], grad1[i]);
}
TEST(AgradMatrix, sdStdVector) {
using stan::math::sd; // should use arg-dep lookup (and for sqrt)
AVEC y1 = createAVEC(0.5,2.0,3.5);
AVAR f1 = sd(y1);
VEC grad1 = cgrad(f1, y1[0], y1[1], y1[2]);
double f1_val = f1.val(); // save before cleaned out
AVEC y2 = createAVEC(0.5,2.0,3.5);
AVAR mean2 = (y2[0] + y2[1] + y2[2]) / 3.0;
AVAR sum_sq_diff_2
= (y2[0] - mean2) * (y2[0] - mean2)
+ (y2[1] - mean2) * (y2[1] - mean2)
+ (y2[2] - mean2) * (y2[2] - mean2);
AVAR f2 = sqrt(sum_sq_diff_2 / (3 - 1));
EXPECT_EQ(f2.val(), f1_val);
VEC grad2 = cgrad(f2, y2[0], y2[1], y2[2]);
EXPECT_EQ(3U, grad1.size());
EXPECT_EQ(3U, grad2.size());
for (size_t i = 0; i < 3; ++i)
EXPECT_FLOAT_EQ(grad2[i], grad1[i]);
}
TEST(AgradMatrix, initializeVariable) {
using stan::agrad::initialize_variable;
using std::vector;
using Eigen::Matrix;
using Eigen::Dynamic;
AVAR a;
initialize_variable(a, AVAR(1.0));
EXPECT_FLOAT_EQ(1.0, a.val());
AVEC b(3);
initialize_variable(b, AVAR(2.0));
EXPECT_EQ(3U,b.size());
EXPECT_FLOAT_EQ(2.0, b[0].val());
EXPECT_FLOAT_EQ(2.0, b[1].val());
EXPECT_FLOAT_EQ(2.0, b[2].val());
vector<AVEC > c(4,AVEC(3));
initialize_variable(c, AVAR(3.0));
for (size_t m = 0; m < c.size(); ++m)
for (size_t n = 0; n < c[0].size(); ++n)
EXPECT_FLOAT_EQ(3.0,c[m][n].val());
Matrix<AVAR, Dynamic, Dynamic> aa(5,7);
initialize_variable(aa, AVAR(4.0));
for (int m = 0; m < aa.rows(); ++m)
for (int n = 0; n < aa.cols(); ++n)
EXPECT_FLOAT_EQ(4.0, aa(m,n).val());
Matrix<AVAR, Dynamic, 1> bb(5);
initialize_variable(bb, AVAR(5.0));
for (int m = 0; m < bb.size(); ++m)
EXPECT_FLOAT_EQ(5.0, bb(m).val());
Matrix<AVAR,1,Dynamic> cc(12);
initialize_variable(cc, AVAR(7.0));
for (int m = 0; m < cc.size(); ++m)
EXPECT_FLOAT_EQ(7.0, cc(m).val());
Matrix<AVAR,Dynamic,Dynamic> init_val(3,4);
vector<Matrix<AVAR,Dynamic,Dynamic> > dd(5, init_val);
initialize_variable(dd, AVAR(11.0));
for (size_t i = 0; i < dd.size(); ++i)
for (int m = 0; m < dd[0].rows(); ++m)
for (int n = 0; n < dd[0].cols(); ++n)
EXPECT_FLOAT_EQ(11.0, dd[i](m,n).val());
}
TEST(AgradMatrix, assign) {
using stan::agrad::assign;
using std::vector;
using Eigen::Matrix;
using Eigen::Dynamic;
AVAR x;
assign(x,2.0);
EXPECT_FLOAT_EQ(2.0,x.val());
assign(x,2);
EXPECT_FLOAT_EQ(2.0,x.val());
AVAR y(3.0);
assign(x,y);
EXPECT_FLOAT_EQ(3.0,x.val());
double xd;
assign(xd,2.0);
EXPECT_FLOAT_EQ(2.0,xd);
assign(xd,2);
EXPECT_FLOAT_EQ(2.0,xd);
int iii;
assign(iii,2);
EXPECT_EQ(2,iii);
unsigned int j = 12;
assign(iii,j);
EXPECT_EQ(12U,j);
VEC y_dbl(2);
y_dbl[0] = 2.0;
y_dbl[1] = 3.0;
AVEC y_var(2);
assign(y_var,y_dbl);
EXPECT_FLOAT_EQ(2.0,y_var[0].val());
EXPECT_FLOAT_EQ(3.0,y_var[1].val());
Matrix<double,Dynamic,1> v_dbl(6);
v_dbl << 1,2,3,4,5,6;
Matrix<AVAR,Dynamic,1> v_var(6);
assign(v_var,v_dbl);
EXPECT_FLOAT_EQ(1,v_var(0).val());
EXPECT_FLOAT_EQ(6,v_var(5).val());
Matrix<double,1,Dynamic> rv_dbl(3);
rv_dbl << 2, 4, 6;
Matrix<AVAR,1,Dynamic> rv_var(3);
assign(rv_var,rv_dbl);
EXPECT_FLOAT_EQ(2,rv_var(0).val());
EXPECT_FLOAT_EQ(4,rv_var(1).val());
EXPECT_FLOAT_EQ(6,rv_var(2).val());
Matrix<double,Dynamic,Dynamic> m_dbl(2,3);
m_dbl << 2, 4, 6, 100, 200, 300;
Matrix<AVAR,Dynamic,Dynamic> m_var(2,3);
assign(m_var,m_dbl);
EXPECT_EQ(2,m_var.rows());
EXPECT_EQ(3,m_var.cols());
EXPECT_FLOAT_EQ(2,m_var(0,0).val());
EXPECT_FLOAT_EQ(100,m_var(1,0).val());
EXPECT_FLOAT_EQ(300,m_var(1,2).val());
}
TEST(AgradMatrix, assign_failure) {
using stan::agrad::assign;
using std::vector;
using Eigen::Matrix;
using Eigen::Dynamic;
VEC y_dbl(2);
y_dbl[0] = 2.0;
y_dbl[1] = 3.0;
AVEC y_var(3);
EXPECT_THROW(assign(y_var,y_dbl), std::domain_error);
Matrix<double,Dynamic,1> v_dbl(6);
v_dbl << 1,2,3,4,5,6;
Matrix<AVAR,Dynamic,1> v_var(5);
EXPECT_THROW(assign(v_var,v_dbl), std::domain_error);
Matrix<double,1,Dynamic> rv_dbl(3);
rv_dbl << 2, 4, 6;
Matrix<AVAR,1,Dynamic> rv_var(6);
EXPECT_THROW(assign(rv_var,rv_dbl), std::domain_error);
Matrix<double,Dynamic,Dynamic> m_dbl(2,3);
m_dbl << 2, 4, 6, 100, 200, 300;
Matrix<AVAR,Dynamic,Dynamic> m_var(1,1);
EXPECT_THROW(assign(m_var,m_dbl), std::domain_error);
}
TEST(AgradMatrix, UserCase1) {
using std::vector;
using stan::math::multiply;
using stan::math::transpose;
using stan::math::subtract;
using stan::math::get_base1;
using stan::agrad::assign;
using stan::math::dot_product;
using stan::agrad::matrix_v;
using stan::math::vector_d;
using stan::agrad::vector_v;
// also tried DpKm1 > H
size_t H = 3;
size_t DpKm1 = 3;
vector_v vk(DpKm1);
for (size_t k = 0; k < DpKm1; ++k)
vk[k] = (k + 1) * (k + 2);
matrix_v L_etaprec(DpKm1,DpKm1);
for (size_t m = 0; m < DpKm1; ++m)
for (size_t n = 0; n < DpKm1; ++n)
L_etaprec(m,n) = (m + 1) * (n + 1);
vector_d etamu(DpKm1);
for (size_t k = 0; k < DpKm1; ++k)
etamu[k] = 10 + (k * k);
vector<vector_d> eta(H,vector_d(DpKm1));
for (size_t h = 0; h < H; ++h)
for (size_t k = 0; k < DpKm1; ++k)
eta[h][k] = (h + 1) * (k + 10);
AVAR lp__ = 0.0;
for (size_t h = 1; h <= H; ++h) {
assign(vk, multiply(transpose(L_etaprec),
subtract(get_base1(eta,h,"eta",1),
etamu)));
assign(lp__, (lp__ - (0.5 * dot_product(vk,vk))));
}
EXPECT_TRUE(lp__.val() != 0);
}
TEST(AgradMatrix,prod) {
using stan::math::prod;
using stan::math::vector_d;
using stan::agrad::vector_v;
vector_d vd;
vector_v vv;
EXPECT_FLOAT_EQ(1.0,prod(vd));
EXPECT_FLOAT_EQ(1.0,prod(vv).val());
vd = vector_d(1);
vv = vector_v(1);
vd << 2.0;
vv << 2.0;
EXPECT_FLOAT_EQ(2.0,prod(vd));
EXPECT_FLOAT_EQ(2.0,prod(vv).val());
vd = vector_d(2);
vd << 2.0, 3.0;
vv = vector_v(2);
vv << 2.0, 3.0;
AVEC x(2);
x[0] = vv[0];
x[1] = vv[1];
AVAR f = prod(vv);
EXPECT_FLOAT_EQ(6.0,prod(vd));
EXPECT_FLOAT_EQ(6.0,f.val());
VEC g;
f.grad(x,g);
EXPECT_FLOAT_EQ(3.0,g[0]);
EXPECT_FLOAT_EQ(2.0,g[1]);
}
TEST(AgradMatrix,diagMatrix) {
using stan::math::diag_matrix;
using stan::agrad::matrix_v;
using stan::math::vector_d;
using stan::agrad::vector_v;
EXPECT_EQ(0,diag_matrix(vector_v()).size());
EXPECT_EQ(4,diag_matrix(vector_v(2)).size());
EXPECT_EQ(0,diag_matrix(vector_d()).size());
EXPECT_EQ(4,diag_matrix(vector_d(2)).size());
vector_v v(3);
v << 1, 4, 9;
matrix_v m = diag_matrix(v);
EXPECT_EQ(1,m(0,0).val());
EXPECT_EQ(4,m(1,1).val());
EXPECT_EQ(9,m(2,2).val());
}
void test_mult_LLT(const stan::agrad::matrix_v& L) {
using stan::agrad::matrix_v;
matrix_v Lp = L;
for (int m = 0; m < L.rows(); ++m)
for (int n = (m+1); n < L.cols(); ++n)
Lp(m,n) = 0;
matrix_v LLT_eigen = Lp * Lp.transpose();
matrix_v LLT_stan = multiply_lower_tri_self_transpose(L);
EXPECT_EQ(L.rows(),LLT_stan.rows());
EXPECT_EQ(L.rows(),LLT_stan.cols());
for (int m = 0; m < L.rows(); ++m)
for (int n = 0; n < L.rows(); ++n)
EXPECT_FLOAT_EQ(LLT_eigen(m,n).val(), LLT_stan(m,n).val());
}
TEST(AgradMatrix, multiplyLowerTriSelfTransposeGrad1) {
using stan::agrad::multiply_lower_tri_self_transpose;
using stan::agrad::matrix_v;
matrix_v L(1,1);
L << 3.0;
AVEC x(1);
x[0] = L(0,0);
matrix_v LLt = multiply_lower_tri_self_transpose(L);
AVEC y(1);
y[0] = LLt(0,0);
EXPECT_FLOAT_EQ(9.0, LLt(0,0).val());
std::vector<VEC > J;
stan::agrad::jacobian(y,x,J);
EXPECT_FLOAT_EQ(6.0, J[0][0]);
}
TEST(AgradMatrix, multiplyLowerTriSelfTransposeGrad2) {
using stan::agrad::multiply_lower_tri_self_transpose;
using stan::agrad::matrix_v;
matrix_v L(2,2);
L <<
1, 0,
2, 3;
AVEC x(3);
x[0] = L(0,0);
x[1] = L(1,0);
x[2] = L(1,1);
matrix_v LLt = multiply_lower_tri_self_transpose(L);
AVEC y(4);
y[0] = LLt(0,0);
y[1] = LLt(0,1);
y[2] = LLt(1,0);
y[3] = LLt(1,1);
EXPECT_FLOAT_EQ(1.0, LLt(0,0).val());
EXPECT_FLOAT_EQ(2.0, LLt(0,1).val());
EXPECT_FLOAT_EQ(2.0, LLt(1,0).val());
EXPECT_FLOAT_EQ(13.0, LLt(1,1).val());
std::vector<VEC > J;
stan::agrad::jacobian(y,x,J);
// L = 1 0
// 2 3
// Jacobian J = Jacobian(L * L')
// J = 2 0 0
// 2 1 0
// 2 1 0
// 0 4 6
EXPECT_FLOAT_EQ(2.0,J[0][0]);
EXPECT_FLOAT_EQ(0.0,J[0][1]);
EXPECT_FLOAT_EQ(0.0,J[0][2]);
EXPECT_FLOAT_EQ(2.0,J[1][0]);
EXPECT_FLOAT_EQ(1.0,J[1][1]);
EXPECT_FLOAT_EQ(0.0,J[1][2]);
EXPECT_FLOAT_EQ(2.0,J[2][0]);
EXPECT_FLOAT_EQ(1.0,J[2][1]);
EXPECT_FLOAT_EQ(0.0,J[2][2]);
EXPECT_FLOAT_EQ(0.0,J[3][0]);
EXPECT_FLOAT_EQ(4.0,J[3][1]);
EXPECT_FLOAT_EQ(6.0,J[3][2]);
}
TEST(AgradMatrix, multiplyLowerTriSelfTransposeGrad3) {
using stan::agrad::multiply_lower_tri_self_transpose;
using stan::agrad::matrix_v;
matrix_v L(3,3);
L <<
1, 0, 0,
2, 3, 0,
4, 5, 6;
AVEC x(6);
x[0] = L(0,0);
x[1] = L(1,0);
x[2] = L(1,1);
x[3] = L(2,0);
x[4] = L(2,1);
x[5] = L(2,2);
matrix_v LLt = multiply_lower_tri_self_transpose(L);
AVEC y(9);
y[0] = LLt(0,0);
y[1] = LLt(0,1);
y[2] = LLt(0,2);
y[3] = LLt(1,0);
y[4] = LLt(1,1);
y[5] = LLt(1,2);
y[6] = LLt(2,0);
y[7] = LLt(2,1);
y[8] = LLt(2,2);
std::vector<VEC > J;
stan::agrad::jacobian(y,x,J);
// L = 1 0 0
// 2 3 0
// 4 5 6
// Jacobian J = Jacobian(L * L')
// J = 2 0 0 0 0 0
// 2 1 0 0 0 0
// 4 0 0 1 0 0
// 2 1 0 0 0 0
// 0 4 6 0 0 0
// 0 4 5 2 3 0
// 4 0 0 1 0 0
// 0 4 5 2 3 0
// 0 0 0 8 10 12
EXPECT_FLOAT_EQ(2.0,J[0][0]);
EXPECT_FLOAT_EQ(0.0,J[0][1]);
EXPECT_FLOAT_EQ(0.0,J[0][2]);
EXPECT_FLOAT_EQ(0.0,J[0][3]);
EXPECT_FLOAT_EQ(0.0,J[0][4]);
EXPECT_FLOAT_EQ(0.0,J[0][5]);
EXPECT_FLOAT_EQ(2.0,J[1][0]);
EXPECT_FLOAT_EQ(1.0,J[1][1]);
EXPECT_FLOAT_EQ(0.0,J[1][2]);
EXPECT_FLOAT_EQ(0.0,J[1][3]);
EXPECT_FLOAT_EQ(0.0,J[1][4]);
EXPECT_FLOAT_EQ(0.0,J[1][5]);
EXPECT_FLOAT_EQ(4.0,J[2][0]);
EXPECT_FLOAT_EQ(0.0,J[2][1]); EXPECT_FLOAT_EQ(0.0,J[2][2]);
EXPECT_FLOAT_EQ(1.0,J[2][3]);
EXPECT_FLOAT_EQ(0.0,J[2][4]);
EXPECT_FLOAT_EQ(0.0,J[2][5]);
EXPECT_FLOAT_EQ(2.0,J[3][0]);
EXPECT_FLOAT_EQ(1.0,J[3][1]);
EXPECT_FLOAT_EQ(0.0,J[3][2]);
EXPECT_FLOAT_EQ(0.0,J[3][3]);
EXPECT_FLOAT_EQ(0.0,J[3][4]);
EXPECT_FLOAT_EQ(0.0,J[3][5]);
EXPECT_FLOAT_EQ(0.0,J[4][0]);
EXPECT_FLOAT_EQ(4.0,J[4][1]);
EXPECT_FLOAT_EQ(6.0,J[4][2]);
EXPECT_FLOAT_EQ(0.0,J[4][3]);
EXPECT_FLOAT_EQ(0.0,J[4][4]);
EXPECT_FLOAT_EQ(0.0,J[4][5]);
EXPECT_FLOAT_EQ(0.0,J[5][0]);
EXPECT_FLOAT_EQ(4.0,J[5][1]);
EXPECT_FLOAT_EQ(5.0,J[5][2]);
EXPECT_FLOAT_EQ(2.0,J[5][3]);
EXPECT_FLOAT_EQ(3.0,J[5][4]);
EXPECT_FLOAT_EQ(0.0,J[5][5]);
EXPECT_FLOAT_EQ(4.0,J[6][0]);
EXPECT_FLOAT_EQ(0.0,J[6][1]);
EXPECT_FLOAT_EQ(0.0,J[6][2]);
EXPECT_FLOAT_EQ(1.0,J[6][3]);
EXPECT_FLOAT_EQ(0.0,J[6][4]);
EXPECT_FLOAT_EQ(0.0,J[6][5]);
EXPECT_FLOAT_EQ(0.0,J[7][0]);
EXPECT_FLOAT_EQ(4.0,J[7][1]);
EXPECT_FLOAT_EQ(5.0,J[7][2]);
EXPECT_FLOAT_EQ(2.0,J[7][3]);
EXPECT_FLOAT_EQ(3.0,J[7][4]);
EXPECT_FLOAT_EQ(0.0,J[7][5]);
EXPECT_FLOAT_EQ(0.0,J[8][0]);
EXPECT_FLOAT_EQ(0.0,J[8][1]);
EXPECT_FLOAT_EQ(0.0,J[8][2]);
EXPECT_FLOAT_EQ(8.0,J[8][3]);
EXPECT_FLOAT_EQ(10.0,J[8][4]);
EXPECT_FLOAT_EQ(12.0,J[8][5]);
}
TEST(AgradMatrix, multiplyLowerTriSelfTranspose) {
using stan::agrad::multiply_lower_tri_self_transpose;
using stan::agrad::matrix_v;
matrix_v L;
L = matrix_v(3,3);
L << 1, 0, 0,
2, 3, 0,
4, 5, 6;
test_mult_LLT(L);
L = matrix_v(3,3);
L << 1, 0, 100000,
2, 3, 0,
4, 5, 6;
test_mult_LLT(L);
L = matrix_v(2,3);
L << 1, 0, 0,
2, 3, 0;
test_mult_LLT(L);
L = matrix_v(3,2);
L << 1, 0,
2, 3,
4, 5;
test_mult_LLT(L);
matrix_v I(2,2);
I << 3, 0,
4, -3;
test_mult_LLT(I);
// matrix_v J(1,1);
// J << 3.0;
// test_mult_LLT(J);
// matrix_v K(0,0);
// test_mult_LLT(K);
}
void test_tcrossprod(const stan::agrad::matrix_v& L) {
using stan::agrad::matrix_v;
using stan::agrad::tcrossprod;
matrix_v LLT_eigen = L * L.transpose();
matrix_v LLT_stan = tcrossprod(L);
EXPECT_EQ(LLT_eigen.rows(),LLT_stan.rows());
EXPECT_EQ(LLT_eigen.rows(),LLT_stan.cols());
for (int m = 0; m < LLT_eigen.rows(); ++m)
for (int n = 0; n < LLT_eigen.cols(); ++n)
EXPECT_FLOAT_EQ(LLT_eigen(m,n).val(), LLT_stan(m,n).val());
}
TEST(AgradMatrix, tcrossprod) {
using stan::agrad::matrix_v;
matrix_v L(3,3);
L << 1, 0, 0,
2, 3, 0,
4, 5, 6;
test_tcrossprod(L);
matrix_v I(2,2);
I << 3, 0,
4, -3;
test_tcrossprod(I);
matrix_v J(1,1);
J << 3.0;
test_tcrossprod(J);
matrix_v K(0,0);
test_tcrossprod(K);
matrix_v M(3,3);
M << 1, 2, 3,
1, 4, 9,
1, 8, 27;
test_tcrossprod(M);
matrix_v N(1,3);
N << 1, 2, 3;
test_tcrossprod(N);
matrix_v P(2,3);
P << 1, 2, 3,
-1, 4, -9;
test_tcrossprod(P);
matrix_v Q(3,2);
Q << 1, 2, 3,
-1, 4, -9;
test_tcrossprod(Q);
}
TEST(AgradMatrix, tcrossprodGrad1) {
using stan::agrad::tcrossprod;
using stan::agrad::matrix_v;
matrix_v L(1,1);
L << 3.0;
AVEC x(1);
x[0] = L(0,0);
matrix_v LLt = tcrossprod(L);
AVEC y(1);
y[0] = LLt(0,0);
EXPECT_FLOAT_EQ(9.0, LLt(0,0).val());
std::vector<VEC > J;
stan::agrad::jacobian(y,x,J);
EXPECT_FLOAT_EQ(6.0, J[0][0]);
}
TEST(AgradMatrix, tcrossprodGrad2) {
using stan::agrad::tcrossprod;
using stan::agrad::matrix_v;
matrix_v L(2,2);
L <<
1, 0,
2, 3;
AVEC x(3);
x[0] = L(0,0);
x[1] = L(1,0);
x[2] = L(1,1);
matrix_v LLt = tcrossprod(L);
AVEC y(4);
y[0] = LLt(0,0);
y[1] = LLt(0,1);
y[2] = LLt(1,0);
y[3] = LLt(1,1);
EXPECT_FLOAT_EQ(1.0, LLt(0,0).val());
EXPECT_FLOAT_EQ(2.0, LLt(0,1).val());
EXPECT_FLOAT_EQ(2.0, LLt(1,0).val());
EXPECT_FLOAT_EQ(13.0, LLt(1,1).val());
std::vector<VEC > J;
stan::agrad::jacobian(y,x,J);
// L = 1 0
// 2 3
// Jacobian J = Jacobian(L * L')
// J = 2 0 0
// 2 1 0
// 2 1 0
// 0 4 6
EXPECT_FLOAT_EQ(2.0,J[0][0]);
EXPECT_FLOAT_EQ(0.0,J[0][1]);
EXPECT_FLOAT_EQ(0.0,J[0][2]);
EXPECT_FLOAT_EQ(2.0,J[1][0]);
EXPECT_FLOAT_EQ(1.0,J[1][1]);
EXPECT_FLOAT_EQ(0.0,J[1][2]);
EXPECT_FLOAT_EQ(2.0,J[2][0]);
EXPECT_FLOAT_EQ(1.0,J[2][1]);
EXPECT_FLOAT_EQ(0.0,J[2][2]);
EXPECT_FLOAT_EQ(0.0,J[3][0]);
EXPECT_FLOAT_EQ(4.0,J[3][1]);
EXPECT_FLOAT_EQ(6.0,J[3][2]);
}
TEST(AgradMatrix, tcrossprodGrad3) {
using stan::agrad::tcrossprod;
using stan::agrad::matrix_v;
matrix_v L(3,3);
L <<
1, 0, 0,
2, 3, 0,
4, 5, 6;
AVEC x(6);
x[0] = L(0,0);
x[1] = L(1,0);
x[2] = L(1,1);
x[3] = L(2,0);
x[4] = L(2,1);
x[5] = L(2,2);
matrix_v LLt = tcrossprod(L);
AVEC y(9);
y[0] = LLt(0,0);
y[1] = LLt(0,1);
y[2] = LLt(0,2);
y[3] = LLt(1,0);
y[4] = LLt(1,1);
y[5] = LLt(1,2);
y[6] = LLt(2,0);
y[7] = LLt(2,1);
y[8] = LLt(2,2);
std::vector<VEC > J;
stan::agrad::jacobian(y,x,J);
// L = 1 0 0
// 2 3 0
// 4 5 6
// Jacobian J = Jacobian(L * L')
// J = 2 0 0 0 0 0
// 2 1 0 0 0 0
// 4 0 0 1 0 0
// 2 1 0 0 0 0
// 0 4 6 0 0 0
// 0 4 5 2 3 0
// 4 0 0 1 0 0
// 0 4 5 2 3 0
// 0 0 0 8 10 12
EXPECT_FLOAT_EQ(2.0,J[0][0]);
EXPECT_FLOAT_EQ(0.0,J[0][1]);
EXPECT_FLOAT_EQ(0.0,J[0][2]);
EXPECT_FLOAT_EQ(0.0,J[0][3]);
EXPECT_FLOAT_EQ(0.0,J[0][4]);
EXPECT_FLOAT_EQ(0.0,J[0][5]);
EXPECT_FLOAT_EQ(2.0,J[1][0]);
EXPECT_FLOAT_EQ(1.0,J[1][1]);
EXPECT_FLOAT_EQ(0.0,J[1][2]);
EXPECT_FLOAT_EQ(0.0,J[1][3]);
EXPECT_FLOAT_EQ(0.0,J[1][4]);
EXPECT_FLOAT_EQ(0.0,J[1][5]);
EXPECT_FLOAT_EQ(4.0,J[2][0]);
EXPECT_FLOAT_EQ(0.0,J[2][1]); EXPECT_FLOAT_EQ(0.0,J[2][2]);
EXPECT_FLOAT_EQ(1.0,J[2][3]);
EXPECT_FLOAT_EQ(0.0,J[2][4]);
EXPECT_FLOAT_EQ(0.0,J[2][5]);
EXPECT_FLOAT_EQ(2.0,J[3][0]);
EXPECT_FLOAT_EQ(1.0,J[3][1]);
EXPECT_FLOAT_EQ(0.0,J[3][2]);
EXPECT_FLOAT_EQ(0.0,J[3][3]);
EXPECT_FLOAT_EQ(0.0,J[3][4]);
EXPECT_FLOAT_EQ(0.0,J[3][5]);
EXPECT_FLOAT_EQ(0.0,J[4][0]);
EXPECT_FLOAT_EQ(4.0,J[4][1]);
EXPECT_FLOAT_EQ(6.0,J[4][2]);
EXPECT_FLOAT_EQ(0.0,J[4][3]);
EXPECT_FLOAT_EQ(0.0,J[4][4]);
EXPECT_FLOAT_EQ(0.0,J[4][5]);
EXPECT_FLOAT_EQ(0.0,J[5][0]);
EXPECT_FLOAT_EQ(4.0,J[5][1]);
EXPECT_FLOAT_EQ(5.0,J[5][2]);
EXPECT_FLOAT_EQ(2.0,J[5][3]);
EXPECT_FLOAT_EQ(3.0,J[5][4]);
EXPECT_FLOAT_EQ(0.0,J[5][5]);
EXPECT_FLOAT_EQ(4.0,J[6][0]);
EXPECT_FLOAT_EQ(0.0,J[6][1]);
EXPECT_FLOAT_EQ(0.0,J[6][2]);
EXPECT_FLOAT_EQ(1.0,J[6][3]);
EXPECT_FLOAT_EQ(0.0,J[6][4]);
EXPECT_FLOAT_EQ(0.0,J[6][5]);
EXPECT_FLOAT_EQ(0.0,J[7][0]);
EXPECT_FLOAT_EQ(4.0,J[7][1]);
EXPECT_FLOAT_EQ(5.0,J[7][2]);
EXPECT_FLOAT_EQ(2.0,J[7][3]);
EXPECT_FLOAT_EQ(3.0,J[7][4]);
EXPECT_FLOAT_EQ(0.0,J[7][5]);
EXPECT_FLOAT_EQ(0.0,J[8][0]);
EXPECT_FLOAT_EQ(0.0,J[8][1]);
EXPECT_FLOAT_EQ(0.0,J[8][2]);
EXPECT_FLOAT_EQ(8.0,J[8][3]);
EXPECT_FLOAT_EQ(10.0,J[8][4]);
EXPECT_FLOAT_EQ(12.0,J[8][5]);
}
void test_crossprod(const stan::agrad::matrix_v& L) {
using stan::agrad::matrix_v;
using stan::agrad::crossprod;
matrix_v LLT_eigen = L.transpose() * L;
matrix_v LLT_stan = crossprod(L);
EXPECT_EQ(L.rows(),LLT_stan.rows());
EXPECT_EQ(L.cols(),LLT_stan.cols());
for (int m = 0; m < L.rows(); ++m)
for (int n = 0; n < L.cols(); ++n)
EXPECT_FLOAT_EQ(LLT_eigen(m,n).val(), LLT_stan(m,n).val());
}
TEST(AgradMatrix, crossprod) {
using stan::agrad::matrix_v;
matrix_v L(3,3);
L << 1, 0, 0,
2, 3, 0,
4, 5, 6;
test_crossprod(L);
// test_tcrossprod_grad(L, L.rows(), L.cols());
matrix_v I(2,2);
I << 3, 0,
4, -3;
test_crossprod(I);
// test_tcrossprod_grad(I, I.rows(), I.cols());
matrix_v J(1,1);
J << 3.0;
test_crossprod(J);
// test_tcrossprod_grad(J, J.rows(), J.cols());
matrix_v K(0,0);
test_crossprod(K);
// test_tcrossprod_grad(K, K.rows(), K.cols());
}
template <typename T>
void test_cumulative_sum() {
using stan::math::cumulative_sum;
T c(1);
c[0] = 1.7;
T d = cumulative_sum(c);
EXPECT_EQ(c.size(), d.size());
EXPECT_FLOAT_EQ(c[0].val(),d[0].val());
VEC grad = cgrad(d[0], c[0]);
EXPECT_EQ(1,grad.size());
EXPECT_FLOAT_EQ(1.0,grad[0]);
T e(2);
e[0] = 5.9; e[1] = -1.2;
T f = cumulative_sum(e);
EXPECT_EQ(e.size(), f.size());
EXPECT_FLOAT_EQ(e[0].val(),f[0].val());
EXPECT_FLOAT_EQ((e[0] + e[1]).val(), f[1].val());
grad = cgrad(f[0],e[0],e[1]);
EXPECT_EQ(2,grad.size());
EXPECT_FLOAT_EQ(1.0,grad[0]);
EXPECT_FLOAT_EQ(0.0,grad[1]);
T g(3);
g[0] = 5.9; g[1] = -1.2; g[2] = 192.13456;
T h = cumulative_sum(g);
EXPECT_EQ(g.size(), h.size());
EXPECT_FLOAT_EQ(g[0].val(),h[0].val());
EXPECT_FLOAT_EQ((g[0] + g[1]).val(), h[1].val());
EXPECT_FLOAT_EQ((g[0] + g[1] + g[2]).val(), h[2].val());
grad = cgrad(h[2],g[0],g[1],g[2]);
EXPECT_EQ(3,grad.size());
EXPECT_FLOAT_EQ(1.0,grad[0]);
EXPECT_FLOAT_EQ(1.0,grad[1]);
EXPECT_FLOAT_EQ(1.0,grad[2]);
}
TEST(AgradMatrix, cumulative_sum) {
using stan::agrad::var;
using stan::math::cumulative_sum;
EXPECT_FLOAT_EQ(0, cumulative_sum(std::vector<var>(0)).size());
Eigen::Matrix<var,Eigen::Dynamic,1> a;
EXPECT_FLOAT_EQ(0,cumulative_sum(a).size());
Eigen::Matrix<var,1,Eigen::Dynamic> b;
EXPECT_FLOAT_EQ(0,cumulative_sum(b).size());
test_cumulative_sum<std::vector<var> >();
test_cumulative_sum<Eigen::Matrix<var,Eigen::Dynamic,1> >();
test_cumulative_sum<Eigen::Matrix<var,1,Eigen::Dynamic> >();
}
TEST(AgradMatrix, promoter) {
using stan::math::promoter;
using stan::math::promote_common;
using stan::agrad::var;
using std::vector;
using stan::math::matrix_d;
using stan::math::vector_d;
using stan::math::row_vector_d;
using stan::agrad::matrix_v;
using stan::agrad::vector_v;
using stan::agrad::row_vector_v;
double a = promote_common<double,double>(3.0);
var b = promote_common<double,var>(4.0);
var c = promote_common<double,var>(var(5.0));
EXPECT_FLOAT_EQ(3.0, a);
EXPECT_FLOAT_EQ(4.0, b.val());
EXPECT_FLOAT_EQ(5.0, c.val());
vector<double> x(5);
for (int i = 0; i < 5; ++i) x[i] = i * i;
vector<double> y = promote_common<vector<double>, vector<double> >(x);
EXPECT_EQ(5,y.size());
for (int i = 0; i < 5; ++i)
EXPECT_FLOAT_EQ(x[i],y[i]);
std::vector<var> z =
promote_common<std::vector<double>, std::vector<var> >(x);
EXPECT_EQ(5,z.size());
for (int i = 0; i < 5; ++i)
EXPECT_FLOAT_EQ(x[i],z[i].val());
vector<var> w = promote_common<vector<var>, vector<var> >(z);
EXPECT_EQ(5,w.size());
for (int i = 0; i < 5; ++i)
EXPECT_FLOAT_EQ(x[i],w[i].val());
vector_d U(3);
for (int i = 0; i < 3; ++i)
U(i) = i * i;
vector_d V = promote_common<vector_d,vector_d>(U);
EXPECT_EQ(3,V.size());
for (int i = 0; i < 3; ++i)
EXPECT_FLOAT_EQ(U(i), V(i));
vector_v W = promote_common<vector_d,vector_v>(U);
EXPECT_EQ(3,W.size());
for (int i = 0; i < 3; ++i)
EXPECT_FLOAT_EQ(U(i), W(i).val());
vector_v X = promote_common<vector_v,vector_v>(W);
EXPECT_EQ(3,X.size());
for (int i = 0; i < 3; ++i)
EXPECT_FLOAT_EQ(U(i), X(i).val());
row_vector_d G(3);
for (int i = 0; i < 3; ++i)
G(i) = i * i;
row_vector_d H = promote_common<row_vector_d,row_vector_d>(G);
EXPECT_EQ(3,H.size());
for (int i = 0; i < 3; ++i)
EXPECT_FLOAT_EQ(G(i), H(i));
row_vector_v I = promote_common<row_vector_d,row_vector_v>(G);
EXPECT_EQ(3,W.size());
for (int i = 0; i < 3; ++i)
EXPECT_FLOAT_EQ(G(i), I(i).val());
row_vector_v J = promote_common<row_vector_v,row_vector_v>(I);
EXPECT_EQ(3,J.size());
for (int i = 0; i < 3; ++i)
EXPECT_FLOAT_EQ(H(i), J(i).val());
matrix_d A(3,4);
for (int i = 0; i < 3; ++i)
for (int j = 0; j < 4; ++j)
A(i,j) = (i + 1) + (j * 10);
matrix_d B = promote_common<matrix_d,matrix_d>(A);
EXPECT_EQ(3,B.rows());
EXPECT_EQ(4,B.cols());
for (int i = 0; i < 3; ++i)
for (int j = 0; j < 4; ++j)
EXPECT_FLOAT_EQ(A(i,j),B(i,j));
matrix_v C = promote_common<matrix_d,matrix_v>(A);
EXPECT_EQ(3,C.rows());
EXPECT_EQ(4,C.cols());
for (int i = 0; i < 3; ++i)
for (int j = 0; j < 4; ++j)
EXPECT_FLOAT_EQ(A(i,j),C(i,j).val());
matrix_v D = promote_common<matrix_v,matrix_v>(C);
EXPECT_EQ(3,D.rows());
EXPECT_EQ(4,D.cols());
for (int i = 0; i < 3; ++i)
for (int j = 0; j < 4; ++j)
EXPECT_FLOAT_EQ(A(i,j),D(i,j).val());
}
|
1fa72948b2b4cdb3cec78c7d6fcc995a5be7da6e | 1aa5bc8c1a642851960555126c07eb1ea1e478dc | /SPOJ/CSUMQ/27034656_WA_0ms_0kB.cpp | 86b47b64d2d518d98ef1494d54ca73df914f8ba4 | [] | no_license | mehediishere/Competitive-Programming | 53bceaa5132943914b96bb0a107b9de7715e1294 | c10e84c75b821f6e1f2ac402b481856576815e9b | refs/heads/main | 2023-04-18T06:46:45.919779 | 2021-04-29T03:17:37 | 2021-04-29T03:17:37 | 359,342,615 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 366 | cpp | 27034656_WA_0ms_0kB.cpp | #include<iostream>
using namespace std;
int main()
{
int n,q,sum=0,x,y;
cin>>n;
long int arr[n+1];
for(int i=0; i<n; i++)
{
cin>>arr[i];
}
cin>>q;
for(int i=0; i<q; i++)
{
cin>>x>>y;
for(int j=0; j<=y; j++)
{
sum = sum+arr[j];
}
cout<<sum<<endl;
}
return 0;
}
|
2c3c3e6cc4a6e732ecac318d57f405bd21cf7c14 | 1cf6e75514048fa0c5937fd3a5b15cd10c123583 | /solutions/273/Peter/main.cpp | e42430518bf21aff47e71c20acadc6f32b626661 | [] | no_license | peterwzhang/DCP-Solutions | 6e42b89b674be905c93cff9c6d092c3dac64398f | 9acc6fd7d85a397cda72a6dd091c82f0127edeb0 | refs/heads/main | 2023-06-02T23:40:01.179524 | 2021-06-21T18:43:28 | 2021-06-21T18:43:28 | 360,972,594 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 700 | cpp | main.cpp | #include <iostream>
#include <vector>
using namespace std;
/*
Array is sorted so we should look at binary search
*/
bool fix_point_exists(vector<int> array) {
int start = 0;
int end = array.size() - 1;
while (end > start) {
int mid = (start + end) / 2;
if (array[mid] == mid)
return true; // you can return the mid here instead of true
else if (array[mid] < mid)
start = mid;
else
end = mid;
}
return false;
}
int main() {
vector<int> test1 = {-6, 0, 2, 40};
vector<int> test2 = {1, 5, 7, 8};
cout << boolalpha << fix_point_exists(test1) << endl
<< fix_point_exists(test2) << endl;
} |
a0cea973fa83a626214f38c027d7a9bbab18082f | b91e903b7c3ceec22eaecda0b36637bd5a40b49b | /FlyPlane/LoadingScene.cpp | 0f2f5e4a0607aa8591d099b291979dc6b08b5d07 | [] | no_license | Lonelyleavesi/C_project_test | a49764939c4898e3809d779b9366d3d5116000c9 | 82442e6be7d9d5a8ebef198f851f505fd4e928f5 | refs/heads/master | 2020-03-23T04:18:19.116132 | 2018-07-21T11:22:29 | 2018-07-21T11:22:29 | 141,075,293 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 6,186 | cpp | LoadingScene.cpp | #include"LoadingScene.h"
#include"Constants.h"
#include"GameScene.h"
LoadingScene* LoadingScene::createScene(){
return LoadingScene::create();
}
//btn_finish.png ๅๅฐๆธธๆ
//game_loading1.png ๅ ่ฝฝๅฐ้ฃๆบ ๅๅณ
//game_loading2.png ๅฐ้ฃๆบๅท็ ๅๅณ
//game_loading3.png ๅฐ้ฃๆบๅท็2 ๅๅณ
//gameover.png ๆธธๆ็ปๆ ๆญๅ ๆจ็ๆ็ปๆ็ปฉไธบ
//shoot_copyright.png ๆธธๆๅผๅงๆ ้ข
bool LoadingScene::init() {
if (!Scene::init())
{
return FALSE;
}
//้่ฟๅ ่ฝฝ็ฒพ็ต้ๆไปถ๏ผๅฐ็ฒพ็ต้ฝ็ผๅญๅฐ็ฒพ็ต้็ผๅญไธญ
SpriteFrameCache::getInstance()->addSpriteFramesWithFile("shoot_background.plist");
SpriteFrameCache::getInstance()->addSpriteFramesWithFile("shoot.plist"); //ๅๆฌกๅ ่ฝฝๅฆไธไธช็ฒพ็ต็ผๅญ้
auto bg = Sprite::createWithSpriteFrameName("background.png"); //ๅผๅงๅบๆฏ็่ๆฏ
bg->setPosition(VISITABLE_ORIGIN + VISITABLE_SIZE / 2);
this->addChild(bg,BACKGROUND_ZORDER);
auto title = Sprite::createWithSpriteFrameName("shoot_copyright.png"); //ๆ ้ข
title->setPosition(VISITABLE_ORIGIN + VISITABLE_SIZE / 2);
this->addChild(title);
this->saveAnimation(); //ๅจๅญๅจ็ปๅฐ็ผๅญไธญ
return true;
}
void LoadingScene::saveAnimation() {
this->saveStartAnimation(); //ๅผๅง็ๅจ็ป
this->saveHeroFlyAnimation(); //้ฃๆบ้ฃ่กๅจ็ป
this->saveEnemy3Animation(); //ๅคง้ฃๆบๅจ็ป
this->saveEnemyDieAnimation(); //ๆๆบๆญปไบกๅจ็ป
this->saveEnemyHurtAnimation(); //ๆๆบๅไผคๅจ็ป
this->saveHeroDieAnimation(); //่ฑ้ๆญปไบกๅจ็ป
}
void LoadingScene::saveStartAnimation() {
//ไปฅไธไธบๅจ็ป ๅฐ้ฃๆบๅจ็ป
auto loading = Sprite::create();
loading->setPosition(VISITABLE_ORIGIN + VISITABLE_SIZE / 2 + Vec2(0, -200));
this->addChild(loading);
auto ani = Animation::create();
for (auto i = 0; i < 4; i++)
{
auto png = StringUtils::format("game_loading%d.png", i + 1);
ani->addSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName(png));
}
ani->setDelayPerUnit(0.1f);
ani->setLoops(4);
auto seq = Sequence::create(Animate::create(ani), CallFunc::create([]() {
//ๅบๆฏ่ทณ่ฝฌ
auto scene = GameScene::createScene();
Director::getInstance()->replaceScene(TransitionFade::create(1, scene));
}), nullptr);
loading->runAction(seq);
}
void LoadingScene::saveHeroFlyAnimation() {
//ๅๅปบๅจ็ปๅนถๆพๅ
ฅ็ผๅญ
//็ปไธป่งๆทปๅ ๅจ็ป
//1.ๅๅปบๅจ็ป
//a.ๅๅปบๅจ็ปๅฏน่ฑก
auto hero_ani = Animation::create();
//b.ๆทปๅ ๅจ็ปๅธง(ไป็ฒพ็ตๅธง็ผๅญไธญๆ นๆฎๅๅญๆฅๆพๅบๆฅ็)
hero_ani->addSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("hero2.png"));
hero_ani->addSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("hero1.png"));
//c.่ฎพ็ฝฎๅจ็ปๅๆขๆถ้ฟ
hero_ani->setDelayPerUnit(HERO_CHANGE_TIME);
//d.่ฎพ็ฝฎๅพช็ฏๆฌกๆฐ
hero_ani->setLoops(CC_REPEAT_FOREVER); //CC_REPEAT_FOREVER = -1 ๆไธบๆฐธ่ฟๅพช็ฏ
//e.ๆพๅ
ฅๅจ็ป็ผๅญ
AnimationCache::getInstance()->addAnimation(hero_ani, HERO_FLY_ANIMATION);
}
void LoadingScene::saveEnemy3Animation() {
auto bigenemy_ani = Animation::create();
//b.ๆทปๅ ๅจ็ปๅธง(ไป็ฒพ็ตๅธง็ผๅญไธญๆ นๆฎๅๅญๆฅๆพๅบๆฅ็)
bigenemy_ani->addSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("enemy3_n1.png"));
bigenemy_ani->addSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("enemy3_n2.png"));
//c.่ฎพ็ฝฎๅจ็ปๅๆขๆถ้ฟ
bigenemy_ani->setDelayPerUnit(0.2f);
//d.่ฎพ็ฝฎๅพช็ฏๆฌกๆฐ
bigenemy_ani->setLoops(CC_REPEAT_FOREVER); //CC_REPEAT_FOREVER = -1 ๆไธบๆฐธ่ฟๅพช็ฏ
AnimationCache::getInstance()->addAnimation(bigenemy_ani, ENEMY3_FLY_ANIMATION);
}
void LoadingScene::saveEnemyDieAnimation() {
auto ani_enemy1die = Animation::create();
auto ani_enemy2die = Animation::create();
auto ani_enemy3die = Animation::create();
std::string frameName = "SMALL_ENEMY";
for (int i = 1; i <= 4; i++)
{
{
auto frameName = StringUtils::format("enemy1_down%d.png", i);
ani_enemy1die->addSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName(frameName));
ani_enemy1die->setDelayPerUnit(ENEMY_DIE_TIME);
AnimationCache::getInstance()->addAnimation(ani_enemy1die, ENEMY1_DIE_ANIMATION);
}
{
auto frameName = StringUtils::format("enemy2_down%d.png", i);
ani_enemy2die->addSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName(frameName));
ani_enemy2die->setDelayPerUnit(ENEMY_DIE_TIME);
AnimationCache::getInstance()->addAnimation(ani_enemy2die, ENEMY2_DIE_ANIMATION);
}
}
for (int i = 1; i <= 6; i++)
{
auto frameName = StringUtils::format("enemy3_down%d.png", i);
ani_enemy3die->addSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName(frameName));
ani_enemy3die->setDelayPerUnit(ENEMY_DIE_TIME);
AnimationCache::getInstance()->addAnimation(ani_enemy3die, ENEMY3_DIE_ANIMATION);
}
}
void LoadingScene::saveEnemyHurtAnimation() {
//ไธญๅ้ฃๆบ้่ฆ้็ฝฎ ๅคงๅ้ฃๆบ ๅ ไธบ่ชๅธฆๅจ็ป ไผ่ชๅทฑ้็ฝฎ
auto Enemy2_ani = Animation::create();
Enemy2_ani->addSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("enemy2_hit.png"));
Enemy2_ani->addSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("enemy2.png"));
Enemy2_ani->setDelayPerUnit(ENEMY_GETHURT_TIME); //่ฎพ็ฝฎๆถ้ฟ
AnimationCache::getInstance()->addAnimation(Enemy2_ani, ENEMY2_HURT_ANIMATION);
auto Enemy3_ani = Animation::create();
Enemy3_ani->addSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("enemy3_hit.png"));
Enemy3_ani->addSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("enemy3_n1.png"));
Enemy3_ani->setDelayPerUnit(ENEMY_GETHURT_TIME); //่ฎพ็ฝฎๆถ้ฟ
AnimationCache::getInstance()->addAnimation(Enemy3_ani, ENEMY3_HURT_ANIMATION);
}
void LoadingScene::saveHeroDieAnimation() {
auto ani_herodie = Animation::create();
for (int i = 0; i < 4; i++)
{
auto frameName = StringUtils::format("hero_blowup_n%d.png", i + 1);
ani_herodie->addSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName(frameName));
}
ani_herodie->setDelayPerUnit(HERO_DIE_TIME); //่ฎพ็ฝฎๆถ้ฟ
AnimationCache::getInstance()->addAnimation(ani_herodie, HERO_DIE_ANIMATION);
}
|
239a8ce7e69fcd0ab71d26b75239390ca7e987e2 | 069256601d4f63c227665653ab5157881811d720 | /Jim-Scott-Neo/subject.cc | e05ab16454a7aa2a12694ba46b063e08fdf89350 | [] | no_license | shandian6033/Jim-Scott-Neo | d7ad3bdd26f5fc775e4713a6f1283b585f79fbe1 | 5a229bac965c25881c31c1d9632db6df93d1c5ab | refs/heads/master | 2021-08-23T12:25:45.135893 | 2017-12-04T22:25:22 | 2017-12-04T22:25:22 | 112,104,651 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 184 | cc | subject.cc | #include "subject.h"
void Subject::attach(Observer* p) {
who_looks_at_me.emplace_back(p);
}
void Subject::notifyObservers() {
for (auto &it : who_looks_at_me) it->notify(*this);
}
|
5c081ee8c5ebade11d81600bae241410f9222d48 | 78c40ecbe1a1711182c6fd38f1683e4a0b7d1b3e | /EnigmaMachine/src/EnigmaMachine.cpp | 68ddce7a872761d1e16a08000d5af0a5d7112231 | [] | no_license | Joseph-Durrans/enigma-machine | 611264f547b996abdf50259fbf2adbebdc8fc580 | c5afeafe155a073b1f8ce9bf6a02de271ef1e97b | refs/heads/master | 2023-04-10T02:27:48.278781 | 2021-04-10T11:27:40 | 2021-04-10T11:27:40 | 326,230,966 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 143 | cpp | EnigmaMachine.cpp | #include "headers/Rotors.h"
#include <iostream>
int main()
{
Rotors rotor(1,1,1);
std::cout<<rotor.EncodeCharacter(0)<<std::endl;
}
|
ad4f3d6711243e19ec91d281688dc0c3c838fc29 | 4dbe7cb8665cc4e183d948d1bd0664031ba287fa | /src/gtpV2Codec/ieClasses/pTmsiIe.cpp | f8cedc01ed8bd0166256c8ea2942881bfaab67d7 | [
"Apache-2.0"
] | permissive | aggarwalanubhav/Nucleus | 1356a58201cb6aecd44662420a40413102dde85c | 107113cd9a1b68b1a28b35091ed17785ed32d319 | refs/heads/master | 2023-06-10T12:09:44.316674 | 2021-07-06T09:03:18 | 2021-07-06T09:03:18 | 365,923,062 | 0 | 1 | Apache-2.0 | 2021-05-18T09:16:19 | 2021-05-10T05:01:58 | C++ | UTF-8 | C++ | false | false | 1,941 | cpp | pTmsiIe.cpp | /*
* Copyright 2019-present Infosys Limited
*
* SPDX-License-Identifier: Apache-2.0
*/
/******************************************************************************
*
* This is an auto generated file.
* Please do not edit this file.
* All edits to be made through template source file
* <TOP-DIR/scripts/GtpV2StackCodeGen/tts/ietemplate.cpp.tt>
******************************************************************************/
#include "pTmsiIe.h"
#include "dataTypeCodecUtils.h"
PTmsiIe::PTmsiIe()
{
ieType = 111;
// TODO
}
PTmsiIe::~PTmsiIe() {
// TODO Auto-generated destructor stub
}
bool PTmsiIe::encodePTmsiIe(MsgBuffer &buffer, PTmsiIeData const &data)
{
if (!(buffer.writeUint8(data.pTmsi)))
{
errorStream.add((char *)"Encoding of pTmsi failed\n");
return false;
}
return true;
}
bool PTmsiIe::decodePTmsiIe(MsgBuffer &buffer, PTmsiIeData &data, Uint16 length)
{
// TODO optimize the length checks
Uint16 ieBoundary = buffer.getCurrentIndex() + length;
buffer.readUint8(data.pTmsi);
if (buffer.getCurrentIndex() > ieBoundary)
{
errorStream.add((char *)"Attempt to read beyond IE boundary: pTmsi\n");
return false;
}
// The IE is decoded now. The buffer index should be pointing to the
// IE Boundary. If not, we have some more data left for the IE which we don't know
// how to decode
if (ieBoundary == buffer.getCurrentIndex())
{
return true;
}
else
{
errorStream.add((char *)"Unable to decode IE PTmsiIe\n");
return false;
}
}
void PTmsiIe::displayPTmsiIe_v(PTmsiIeData const &data, Debug &stream)
{
stream.incrIndent();
stream.add((char *)"PTmsiIeData:");
stream.incrIndent();
stream.endOfLine();
stream.add((char *)"pTmsi: ");
stream.add(data.pTmsi);
stream.endOfLine();
stream.decrIndent();
stream.decrIndent();
}
|
d41b6fc43f9acbfc7ca6d2b821043bb02d232c27 | 7b016fa49d8626442cfce41dc6625db597137735 | /cppConcreteClassUART/src/uart.hpp | f7afb5362f578798220e4ffb867325d2760d0a2f | [] | no_license | stuianna/embeddedCodeSizeComparison | 21eb814cce1a3ea0278c1724776a05a07610ada0 | 460dda063a0323eb00516c3497fb0ae17d04a697 | refs/heads/master | 2021-03-24T06:32:55.990438 | 2020-03-15T18:36:52 | 2020-03-15T18:36:52 | 247,525,913 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 204 | hpp | uart.hpp | #ifndef _USART_HPP
#define _USART_HPP
#include <stdint.h>
class cUART{
public:
cUART() = default;
~cUART() = default;
void init();
bool put(uint8_t byte);
private:
void gpioInit();
};
#endif
|
3b8a30369bf6ac8345af0efab22c878bb56cf7e5 | 9030ce2789a58888904d0c50c21591632eddffd7 | /SDK/ARKSurvivalEvolved_StructureTurretBaseBP_BaseHeavy_functions.cpp | b70250238cbe7027fb0fde1632ac237a3b00aaf0 | [
"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 | 11,844 | cpp | ARKSurvivalEvolved_StructureTurretBaseBP_BaseHeavy_functions.cpp | // ARKSurvivalEvolved (332.8) SDK
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
#include "ARKSurvivalEvolved_StructureTurretBaseBP_BaseHeavy_parameters.hpp"
namespace sdk
{
//---------------------------------------------------------------------------
//Functions
//---------------------------------------------------------------------------
// Function StructureTurretBaseBP_BaseHeavy.StructureTurretBaseBP_BaseHeavy_C.BPCopyCustomSettingsFromTurret
// ()
// Parameters:
// class APrimalStructureTurret** FromTurret (Parm, ZeroConstructor, IsPlainOldData)
// bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
bool AStructureTurretBaseBP_BaseHeavy_C::BPCopyCustomSettingsFromTurret(class APrimalStructureTurret** FromTurret)
{
static auto fn = UObject::FindObject<UFunction>("Function StructureTurretBaseBP_BaseHeavy.StructureTurretBaseBP_BaseHeavy_C.BPCopyCustomSettingsFromTurret");
AStructureTurretBaseBP_BaseHeavy_C_BPCopyCustomSettingsFromTurret_Params params;
params.FromTurret = FromTurret;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
return params.ReturnValue;
}
// Function StructureTurretBaseBP_BaseHeavy.StructureTurretBaseBP_BaseHeavy_C.BPTurretPreventsTargeting
// ()
// Parameters:
// class APrimalCharacter** PotentialTarget (Parm, ZeroConstructor, IsPlainOldData)
// bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
bool AStructureTurretBaseBP_BaseHeavy_C::BPTurretPreventsTargeting(class APrimalCharacter** PotentialTarget)
{
static auto fn = UObject::FindObject<UFunction>("Function StructureTurretBaseBP_BaseHeavy.StructureTurretBaseBP_BaseHeavy_C.BPTurretPreventsTargeting");
AStructureTurretBaseBP_BaseHeavy_C_BPTurretPreventsTargeting_Params params;
params.PotentialTarget = PotentialTarget;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
return params.ReturnValue;
}
// Function StructureTurretBaseBP_BaseHeavy.StructureTurretBaseBP_BaseHeavy_C.BPServerHandleNetExecCommand
// ()
// Parameters:
// class APlayerController** FromPC (Parm, ZeroConstructor, IsPlainOldData)
// struct FName* CommandName (Parm, ZeroConstructor, IsPlainOldData)
// struct FBPNetExecParams ExecParams (Parm, OutParm, ReferenceParm)
// bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
bool AStructureTurretBaseBP_BaseHeavy_C::BPServerHandleNetExecCommand(class APlayerController** FromPC, struct FName* CommandName, struct FBPNetExecParams* ExecParams)
{
static auto fn = UObject::FindObject<UFunction>("Function StructureTurretBaseBP_BaseHeavy.StructureTurretBaseBP_BaseHeavy_C.BPServerHandleNetExecCommand");
AStructureTurretBaseBP_BaseHeavy_C_BPServerHandleNetExecCommand_Params params;
params.FromPC = FromPC;
params.CommandName = CommandName;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
if (ExecParams != nullptr)
*ExecParams = params.ExecParams;
return params.ReturnValue;
}
// Function StructureTurretBaseBP_BaseHeavy.StructureTurretBaseBP_BaseHeavy_C.BPTryMultiUse
// ()
// Parameters:
// class APlayerController** ForPC (Parm, ZeroConstructor, IsPlainOldData)
// int* UseIndex (Parm, ZeroConstructor, IsPlainOldData)
// bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
bool AStructureTurretBaseBP_BaseHeavy_C::BPTryMultiUse(class APlayerController** ForPC, int* UseIndex)
{
static auto fn = UObject::FindObject<UFunction>("Function StructureTurretBaseBP_BaseHeavy.StructureTurretBaseBP_BaseHeavy_C.BPTryMultiUse");
AStructureTurretBaseBP_BaseHeavy_C_BPTryMultiUse_Params params;
params.ForPC = ForPC;
params.UseIndex = UseIndex;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
return params.ReturnValue;
}
// Function StructureTurretBaseBP_BaseHeavy.StructureTurretBaseBP_BaseHeavy_C.BPClientDoMultiUse
// (Exec, Native, Event, NetMulticast, Public, Private, Protected, Delegate, HasOutParms, HasDefaults, DLLImport, BlueprintCallable, BlueprintEvent, BlueprintPure, NetValidate)
// Parameters:
// class APlayerController** ForPC (Parm, ZeroConstructor, IsPlainOldData)
// int* ClientUseIndex (Parm, ZeroConstructor, IsPlainOldData)
void AStructureTurretBaseBP_BaseHeavy_C::BPClientDoMultiUse(class APlayerController** ForPC, int* ClientUseIndex)
{
static auto fn = UObject::FindObject<UFunction>("Function StructureTurretBaseBP_BaseHeavy.StructureTurretBaseBP_BaseHeavy_C.BPClientDoMultiUse");
AStructureTurretBaseBP_BaseHeavy_C_BPClientDoMultiUse_Params params;
params.ForPC = ForPC;
params.ClientUseIndex = ClientUseIndex;
auto flags = fn->FunctionFlags;
fn->FunctionFlags |= 0x400;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function StructureTurretBaseBP_BaseHeavy.StructureTurretBaseBP_BaseHeavy_C.BPGetMultiUseEntries
// (Exec, Native, Static, NetMulticast, Public, Private, Protected, Delegate, HasOutParms, HasDefaults, DLLImport, BlueprintCallable, BlueprintEvent, BlueprintPure, NetValidate)
// Parameters:
// class APlayerController** ForPC (Parm, ZeroConstructor, IsPlainOldData)
// TArray<struct FMultiUseEntry> MultiUseEntries (Parm, OutParm, ZeroConstructor, ReferenceParm)
// TArray<struct FMultiUseEntry> ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm)
TArray<struct FMultiUseEntry> AStructureTurretBaseBP_BaseHeavy_C::STATIC_BPGetMultiUseEntries(class APlayerController** ForPC, TArray<struct FMultiUseEntry>* MultiUseEntries)
{
static auto fn = UObject::FindObject<UFunction>("Function StructureTurretBaseBP_BaseHeavy.StructureTurretBaseBP_BaseHeavy_C.BPGetMultiUseEntries");
AStructureTurretBaseBP_BaseHeavy_C_BPGetMultiUseEntries_Params params;
params.ForPC = ForPC;
auto flags = fn->FunctionFlags;
fn->FunctionFlags |= 0x400;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
if (MultiUseEntries != nullptr)
*MultiUseEntries = params.MultiUseEntries;
return params.ReturnValue;
}
// Function StructureTurretBaseBP_BaseHeavy.StructureTurretBaseBP_BaseHeavy_C.BPCanBeActivated
// ()
// Parameters:
// bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
bool AStructureTurretBaseBP_BaseHeavy_C::BPCanBeActivated()
{
static auto fn = UObject::FindObject<UFunction>("Function StructureTurretBaseBP_BaseHeavy.StructureTurretBaseBP_BaseHeavy_C.BPCanBeActivated");
AStructureTurretBaseBP_BaseHeavy_C_BPCanBeActivated_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
return params.ReturnValue;
}
// Function StructureTurretBaseBP_BaseHeavy.StructureTurretBaseBP_BaseHeavy_C.BPPostLoadedFromSaveGame
// ()
void AStructureTurretBaseBP_BaseHeavy_C::BPPostLoadedFromSaveGame()
{
static auto fn = UObject::FindObject<UFunction>("Function StructureTurretBaseBP_BaseHeavy.StructureTurretBaseBP_BaseHeavy_C.BPPostLoadedFromSaveGame");
AStructureTurretBaseBP_BaseHeavy_C_BPPostLoadedFromSaveGame_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function StructureTurretBaseBP_BaseHeavy.StructureTurretBaseBP_BaseHeavy_C.TurretCheckHardLimit
// ()
void AStructureTurretBaseBP_BaseHeavy_C::TurretCheckHardLimit()
{
static auto fn = UObject::FindObject<UFunction>("Function StructureTurretBaseBP_BaseHeavy.StructureTurretBaseBP_BaseHeavy_C.TurretCheckHardLimit");
AStructureTurretBaseBP_BaseHeavy_C_TurretCheckHardLimit_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function StructureTurretBaseBP_BaseHeavy.StructureTurretBaseBP_BaseHeavy_C.BlueprintDrawHUD
// (Net, NetReliable, Exec, Native, Event, NetResponse, NetMulticast, MulticastDelegate, Public, Protected, Delegate, NetServer, HasDefaults, DLLImport, BlueprintCallable, BlueprintEvent, BlueprintPure, NetValidate)
// Parameters:
// class AShooterHUD** HUD (Parm, ZeroConstructor, IsPlainOldData)
// float* CenterX (Parm, ZeroConstructor, IsPlainOldData)
// float* CenterY (Parm, ZeroConstructor, IsPlainOldData)
void AStructureTurretBaseBP_BaseHeavy_C::BlueprintDrawHUD(class AShooterHUD** HUD, float* CenterX, float* CenterY)
{
static auto fn = UObject::FindObject<UFunction>("Function StructureTurretBaseBP_BaseHeavy.StructureTurretBaseBP_BaseHeavy_C.BlueprintDrawHUD");
AStructureTurretBaseBP_BaseHeavy_C_BlueprintDrawHUD_Params params;
params.HUD = HUD;
params.CenterX = CenterX;
params.CenterY = CenterY;
auto flags = fn->FunctionFlags;
fn->FunctionFlags |= 0x400;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function StructureTurretBaseBP_BaseHeavy.StructureTurretBaseBP_BaseHeavy_C.BPIsAllowedToBuild
// ()
// Parameters:
// struct FPlacementData OutPlacementData (Parm, OutParm, ReferenceParm)
// int* CurrentAllowedReason (Parm, ZeroConstructor, IsPlainOldData)
// int ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
int AStructureTurretBaseBP_BaseHeavy_C::BPIsAllowedToBuild(int* CurrentAllowedReason, struct FPlacementData* OutPlacementData)
{
static auto fn = UObject::FindObject<UFunction>("Function StructureTurretBaseBP_BaseHeavy.StructureTurretBaseBP_BaseHeavy_C.BPIsAllowedToBuild");
AStructureTurretBaseBP_BaseHeavy_C_BPIsAllowedToBuild_Params params;
params.CurrentAllowedReason = CurrentAllowedReason;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
if (OutPlacementData != nullptr)
*OutPlacementData = params.OutPlacementData;
return params.ReturnValue;
}
// Function StructureTurretBaseBP_BaseHeavy.StructureTurretBaseBP_BaseHeavy_C.UserConstructionScript
// ()
void AStructureTurretBaseBP_BaseHeavy_C::UserConstructionScript()
{
static auto fn = UObject::FindObject<UFunction>("Function StructureTurretBaseBP_BaseHeavy.StructureTurretBaseBP_BaseHeavy_C.UserConstructionScript");
AStructureTurretBaseBP_BaseHeavy_C_UserConstructionScript_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function StructureTurretBaseBP_BaseHeavy.StructureTurretBaseBP_BaseHeavy_C.ExecuteUbergraph_StructureTurretBaseBP_BaseHeavy
// ()
// Parameters:
// int EntryPoint (Parm, ZeroConstructor, IsPlainOldData)
void AStructureTurretBaseBP_BaseHeavy_C::ExecuteUbergraph_StructureTurretBaseBP_BaseHeavy(int EntryPoint)
{
static auto fn = UObject::FindObject<UFunction>("Function StructureTurretBaseBP_BaseHeavy.StructureTurretBaseBP_BaseHeavy_C.ExecuteUbergraph_StructureTurretBaseBP_BaseHeavy");
AStructureTurretBaseBP_BaseHeavy_C_ExecuteUbergraph_StructureTurretBaseBP_BaseHeavy_Params params;
params.EntryPoint = EntryPoint;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
|
259dead7fc8010fcf21ede357138b3fec3252f18 | 947fe25967ee91f4cccb4ec5f2ce7c503ed4a399 | /CS12/LABS/week1Lab/program1/lab1program2func.cpp | cb97ef40aa88eac941566b0fd5fafc8ef8946cd9 | [] | no_license | jragni/C-Algorithms-and-Projects | 0885c6b5e55319a5bc218c1e0e193b2e62578fcb | 886b4e99196851551e5468709256016649498a0c | refs/heads/master | 2021-01-02T02:58:24.609094 | 2020-12-25T13:42:49 | 2020-12-25T13:42:49 | 239,461,975 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 338 | cpp | lab1program2func.cpp | #include <string>
#include <iostream>
using namespace std;
bool isPalindrome(const string &s){
for(int i = s.size()-1; i>=0 ; i--){
if(s[i] != s[s.size()-i-1]){
return false;
}
}
return true;
}
bool isPalindrome(int s){
string new_s = to_string(s);
return isPalindrome(new_s);
} |
57fc707f6e08145a2718886a5c190469a4b05bc6 | bc2379ee67f75bdb3a1c3a68496fd1af1d4f6963 | /Algos - cpp/RankingEngine/RankingEngine/tfidf.cpp | f377fd17f2dfac1b310a6cc83738a64b149154a0 | [] | no_license | codingpersonal/practiceCodes | d4c90c798c012bf26d976e14230ae113d7d911f5 | 6754362d41238d0f6feb492a2faa6b1efcdf11d7 | refs/heads/master | 2021-01-10T13:12:00.335402 | 2017-04-18T18:19:48 | 2017-04-18T18:19:48 | 45,518,636 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,201 | cpp | tfidf.cpp | #include "tfidf.h"
#include<math.h>
#include<string>
#include<iostream>
using namespace std;
tfidf::tfidf(int docCount):numOfDocs(docCount){
}
tfidf::~tfidf(){
}
double tfidf::computeIdf(int docWithSearchTerm)
{
if(docWithSearchTerm == 0)
return -1;
else
return(log(double(numOfDocs)/docWithSearchTerm));
}
int tfidf::docsWithSearchQuery(string word){
int count = 0;
vector< map<string,float> >::const_iterator it = wordToFreq.begin();
map<string,float> currWordList;
while(it != wordToFreq.end()){
currWordList.empty();
currWordList = (*it);
if(currWordList.count(word) > 0){
count++;
}
it++;
}
return count;
}
void tfidf::storeIdfInVectorForSearchQuery(string word, double idf, map<string,double>&outMap){
outMap[word] = idf;
}
void tfidf::addURLInfo(mapsi wordsFreq, docInfo documentDetail, int docId){
wordToFreq.push_back(wordsFreq);
IdToDocInfo[docId] = documentDetail;
}
void tfidf::generateIdf(string word, map<string,double>&outMap){
//finds out the number of docs having word in it
int count = docsWithSearchQuery(word);
//calcualtes the odf value for the word
double idf = computeIdf(count);
storeIdfInVectorForSearchQuery(word,idf,outMap);
} |
a1f904d08ad0724a9a01fc07e7dda2f53c925ced | da86d9f9cf875db42fd912e3366cfe9e0aa392c6 | /2019/solutions/E/HHH-Shumen/cred.cpp | 8991130757e1ed5815b99cd424a86c06dcc0f634 | [] | no_license | Alaxe/noi2-ranking | 0c98ea9af9fc3bd22798cab523f38fd75ed97634 | bb671bacd369b0924a1bfa313acb259f97947d05 | refs/heads/master | 2021-01-22T23:33:43.481107 | 2020-02-15T17:33:25 | 2020-02-15T17:33:25 | 85,631,202 | 2 | 4 | null | null | null | null | UTF-8 | C++ | false | false | 331 | cpp | cred.cpp | #include<iostream>
using namespace std;
d (int a)
{
int hil = a/1000%10;
int stot = a/100%10;
int des = a/10%10;
int ed = a/1%10;
return a+des+ed;
}
int main()
{
int n, m, br=0;
cin>>n>>m;
while (d(n)<m)
{
if (br<d(n))
{
br++;
cout << br << endl;
}
}
return 0;
}
|
f272790f82ada796b873f6eeb043e1fcdb835d00 | 00c5584c2f7df4653fcf80fad31642e226d5be81 | /src/core/Controller.cpp | 556ef8ffbea8a6e3b6101b2000af51e00b3a3054 | [] | no_license | konechnnyigellian/tensorflow | 67fe7c0ab35a3f99426c3457dcbd2985967cb62a | 050947d4d638a00e917f5d3b8463748735df0977 | refs/heads/master | 2022-12-29T22:56:43.092690 | 2020-10-18T18:24:55 | 2020-10-18T18:24:55 | 305,166,835 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,323 | cpp | Controller.cpp |
#include "core/Controller.h"
#include "backend/cpu/Cpu.h"
#include "core/config/Config.h"
#include "core/Tenserflower.h"
#include "crypto/common/VirtualMemory.h"
#include "net/Network.h"
#include <cassert>
tenserflow::Controller::Controller(Process *process) :
Base(process)
{
}
tenserflow::Controller::~Controller()
{
delete m_network;
VirtualMemory::destroy();
}
int tenserflow::Controller::init()
{
Base::init();
VirtualMemory::init(config()->cpu().memPoolSize(), config()->cpu().isHugePages());
m_network = new Network(this);
return 0;
}
void tenserflow::Controller::start()
{
Base::start();
m_tenserflower = new Tenserflower(this);
network()->connect();
}
void tenserflow::Controller::stop()
{
Base::stop();
delete m_network;
m_network = nullptr;
m_tenserflower->stop();
delete m_tenserflower;
m_tenserflower = nullptr;
}
tenserflow::Tenserflower *tenserflow::Controller::tenserflower() const
{
assert(m_tenserflower != nullptr);
return m_tenserflower;
}
tenserflow::Network *tenserflow::Controller::network() const
{
assert(m_network != nullptr);
return m_network;
}
void tenserflow::Controller::execCommand(char command)
{
tenserflower()->execCommand(command);
network()->execCommand(command);
}
|
15f7b67ccb45bab2a9d15c1db93378b55f947b38 | 4bbd6c2626c2e47745c42114f2254d1890529707 | /Zeroengine/ZeroEngine Test/ZeroEngine Test/include/ZeroFxBlurV.h | f6d33e9b461622fc2439d6c9ad15f944397a8845 | [
"MIT"
] | permissive | sunrinjh/2020GamPuSojeon | def168984a3a5142123990369413a48583f61da9 | 5d8e7e2739273a965c1a60675a29bc44c54679e6 | refs/heads/master | 2022-12-02T02:47:42.287478 | 2020-08-14T08:01:03 | 2020-08-14T08:01:03 | 286,414,602 | 4 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 241 | h | ZeroFxBlurV.h | ๏ปฟ#pragma once
#include "ZeroIShader.h"
class ZeroFxBlurV : public ZeroIShader {
private:
float time;
float beginTime;
float blur;
public:
ZeroFxBlurV(float _time, char* _renderPage);
~ZeroFxBlurV();
void Update(float _eTime);
};
|
626d0a4d7c0d08e56ca3bf9794f8e6929cf3c30e | 8a87f5b889a9ce7d81421515f06d9c9cbf6ce64a | /tests/Aql/SortLimitTest.cpp | 259bc69ee3a351e6d2a38da2218ed3c066a88f31 | [
"Apache-2.0",
"BSD-3-Clause",
"ICU",
"Zlib",
"GPL-1.0-or-later",
"OpenSSL",
"ISC",
"LicenseRef-scancode-gutenberg-2020",
"MIT",
"GPL-2.0-only",
"CC0-1.0",
"BSL-1.0",
"LicenseRef-scancode-autoconf-simple-exception",
"LicenseRef-scancode-pcre",
"Bison-exception-2.2",
"LicenseRef-scancode-public-domain",
"JSON",
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference",
"Unlicense",
"BSD-4-Clause",
"Python-2.0",
"LGPL-2.1-or-later"
] | permissive | arangodb/arangodb | 0980625e76c56a2449d90dcb8d8f2c485e28a83b | 43c40535cee37fc7349a21793dc33b1833735af5 | refs/heads/devel | 2023-08-31T09:34:47.451950 | 2023-08-31T07:25:02 | 2023-08-31T07:25:02 | 2,649,214 | 13,385 | 982 | Apache-2.0 | 2023-09-14T17:02:16 | 2011-10-26T06:42:00 | C++ | UTF-8 | C++ | false | false | 12,726 | cpp | SortLimitTest.cpp | ////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2014-2020 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Dan Larkin-York
////////////////////////////////////////////////////////////////////////////////
#include "gtest/gtest.h"
#include <velocypack/Builder.h>
#include <velocypack/Iterator.h>
// test setup
#include "IResearch/common.h"
#include "Mocks/LogLevels.h"
#include "Mocks/Servers.h"
#include "Mocks/StorageEngineMock.h"
#include "Aql/AqlFunctionFeature.h"
#include "Aql/ExecutionPlan.h"
#include "Aql/OptimizerRulesFeature.h"
#include "Aql/Query.h"
#include "Basics/VelocyPackHelper.h"
#include "ClusterEngine/ClusterEngine.h"
#include "Logger/LogTopic.h"
#include "Logger/Logger.h"
#include "Random/RandomGenerator.h"
#include "RestServer/AqlFeature.h"
#include "RestServer/DatabaseFeature.h"
#include "RestServer/DatabasePathFeature.h"
#include "RestServer/QueryRegistryFeature.h"
#include "RestServer/SystemDatabaseFeature.h"
#include "StorageEngine/EngineSelectorFeature.h"
#include "Transaction/Methods.h"
#include "Transaction/StandaloneContext.h"
#include "Utils/SingleCollectionTransaction.h"
#include "VocBase/LogicalCollection.h"
extern const char* ARGV0; // defined in main.cpp
// -----------------------------------------------------------------------------
// --SECTION-- test suite
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief setup
////////////////////////////////////////////////////////////////////////////////
// The Paramater is a Flag if we activate fullcount or not.
class SortLimitTest
: public ::testing::TestWithParam<bool>,
public arangodb::tests::LogSuppressor<arangodb::Logger::FIXME,
arangodb::LogLevel::ERR> {
protected:
arangodb::tests::mocks::MockAqlServer server;
std::vector<
std::pair<arangodb::application_features::ApplicationFeature&, bool>>
features;
std::unique_ptr<TRI_vocbase_t> vocbase;
std::vector<arangodb::velocypack::Builder> insertedDocs;
SortLimitTest() : server() {
arangodb::transaction::Methods::clearDataSourceRegistrationCallbacks();
arangodb::ClusterEngine::Mocking = true;
arangodb::RandomGenerator::initialize(
arangodb::RandomGenerator::RandomType::MERSENNE);
vocbase = std::make_unique<TRI_vocbase_t>(
testDBInfo(server.server()));
CreateCollection();
}
~SortLimitTest() { vocbase.reset(); }
auto doFullCount() -> bool { return GetParam(); }
auto buildOptions(std::string rules)
-> std::shared_ptr<arangodb::velocypack::Builder> {
if (doFullCount()) {
return arangodb::velocypack::Parser::fromJson(
"{\"optimizer\": {\"rules\": [" + rules + "]}, \"fullCount\": true}");
}
return arangodb::velocypack::Parser::fromJson(
"{\"optimizer\": {\"rules\": [" + rules + "]}}");
}
std::string sorterType(TRI_vocbase_t& vocbase, std::string const& queryString,
std::string rules = "") {
auto options = buildOptions(rules);
auto ctx =
std::make_shared<arangodb::transaction::StandaloneContext>(vocbase);
auto query = arangodb::aql::Query::create(
ctx, arangodb::aql::QueryString(queryString), nullptr,
arangodb::aql::QueryOptions(options->slice()));
auto result = query->explain();
VPackSlice nodes = result.data->slice().get("nodes");
EXPECT_TRUE(nodes.isArray());
std::string strategy;
for (VPackSlice it : VPackArrayIterator(nodes)) {
if (!it.get("type").isEqualString("SortNode")) {
continue;
}
EXPECT_TRUE(strategy.empty());
strategy = it.get("strategy").copyString();
}
EXPECT_FALSE(strategy.empty());
return strategy;
}
void verifyExpectedResults(TRI_vocbase_t& vocbase,
std::string const& queryString,
std::vector<size_t> const& expected,
size_t fullCount, std::string rules = "") {
auto options = buildOptions(rules);
auto ctx =
std::make_shared<arangodb::transaction::StandaloneContext>(vocbase);
auto query = arangodb::aql::Query::create(
ctx, arangodb::aql::QueryString(queryString), nullptr,
arangodb::aql::QueryOptions(options->slice()));
arangodb::aql::QueryResult result;
while (true) {
auto state = query->execute(result);
if (state == arangodb::aql::ExecutionState::WAITING) {
query->sharedState()->waitForAsyncWakeup();
} else {
break;
}
}
EXPECT_TRUE(result.result.ok());
auto slice = result.data->slice();
EXPECT_TRUE(slice.isArray());
ASSERT_EQ(slice.length(), expected.size());
size_t i = 0;
for (arangodb::velocypack::ArrayIterator itr(slice); itr.valid(); ++itr) {
auto const resolved = itr.value().resolveExternals();
EXPECT_EQ(0, arangodb::basics::VelocyPackHelper::compare(
insertedDocs[expected[i]].slice(), resolved, true))
<< insertedDocs[expected[i]].slice().toJson() << " vs. "
<< resolved.toJson();
i++;
}
auto actualFullCount =
arangodb::basics::VelocyPackHelper::getNumericValue<size_t>(
result.extra->slice(),
std::vector<std::string>{"stats", "fullCount"}, 0);
if (doFullCount()) {
EXPECT_EQ(actualFullCount, fullCount);
} else {
EXPECT_EQ(actualFullCount, 0);
}
}
// create collection0, insertedDocs[0, 999]
void CreateCollection() {
auto createJson = arangodb::velocypack::Parser::fromJson(
"{ \"name\": \"testCollection0\" }");
auto collection = vocbase->createCollection(createJson->slice());
ASSERT_NE(nullptr, collection);
std::vector<std::shared_ptr<arangodb::velocypack::Builder>> docs;
size_t total = 1000;
for (size_t i = 0; i < total; i++) {
docs.emplace_back(arangodb::velocypack::Parser::fromJson(
"{ \"valAsc\": " + std::to_string(i) +
", \"valDsc\": " + std::to_string(total - 1 - i) +
", \"mod\": " + std::to_string(i % 100) + "}"));
}
arangodb::OperationOptions options;
options.returnNew = true;
arangodb::SingleCollectionTransaction trx(
arangodb::transaction::StandaloneContext::Create(*vocbase), *collection,
arangodb::AccessMode::Type::WRITE);
EXPECT_TRUE(trx.begin().ok());
for (auto& entry : docs) {
auto res = trx.insert(collection->name(), entry->slice(), options);
EXPECT_TRUE(res.ok());
insertedDocs.emplace_back(res.slice().get("new"));
}
EXPECT_TRUE(trx.commit().ok());
EXPECT_EQ(insertedDocs.size(), total);
}
};
INSTANTIATE_TEST_CASE_P(SortLimitTest, SortLimitTest, ::testing::Bool());
TEST_P(SortLimitTest, CheckSimpleLimitSortedAscInInsertionOrder) {
std::string query =
"FOR d IN testCollection0 SORT d.valAsc LIMIT 0, 10 RETURN d";
std::vector<size_t> expected = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
EXPECT_EQ(sorterType(*vocbase, query), "constrained-heap");
verifyExpectedResults(*vocbase, query, expected, 1000);
}
TEST_P(SortLimitTest, CheckLimitWithOffsetSortedAscInInsertionOrder) {
std::string query =
"FOR d IN testCollection0 SORT d.valAsc LIMIT 10, 10 RETURN d";
std::vector<size_t> expected = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
EXPECT_EQ(sorterType(*vocbase, query), "constrained-heap");
verifyExpectedResults(*vocbase, query, expected, 1000);
}
TEST_P(SortLimitTest, CheckSimpleLimitSortedAscInReverseInsertionOrder) {
std::string query =
"FOR d IN testCollection0 SORT d.valDsc LIMIT 0, 10 RETURN d";
std::vector<size_t> expected = {999, 998, 997, 996, 995,
994, 993, 992, 991, 990};
EXPECT_EQ(sorterType(*vocbase, query), "constrained-heap");
verifyExpectedResults(*vocbase, query, expected, 1000);
}
TEST_P(SortLimitTest, CheckLimitWithOffsetSortedAscInReverseInsertionOrder) {
std::string query =
"FOR d IN testCollection0 SORT d.valDsc LIMIT 10, 10 RETURN d";
std::vector<size_t> expected = {989, 988, 987, 986, 985,
984, 983, 982, 981, 980};
EXPECT_EQ(sorterType(*vocbase, query), "constrained-heap");
verifyExpectedResults(*vocbase, query, expected, 1000);
}
TEST_P(SortLimitTest, CheckSimpleLimitSortedDscInInsertionOrder) {
std::string query =
"FOR d IN testCollection0 SORT d.valAsc DESC LIMIT 0, 10 RETURN d";
std::vector<size_t> expected = {999, 998, 997, 996, 995,
994, 993, 992, 991, 990};
EXPECT_EQ(sorterType(*vocbase, query), "constrained-heap");
verifyExpectedResults(*vocbase, query, expected, 1000);
}
TEST_P(SortLimitTest, CheckLimitWithOffsetSortedDscInInsertionOrder) {
std::string query =
"FOR d IN testCollection0 SORT d.valAsc DESC LIMIT 10, 10 RETURN d";
std::vector<size_t> expected = {989, 988, 987, 986, 985,
984, 983, 982, 981, 980};
EXPECT_EQ(sorterType(*vocbase, query), "constrained-heap");
verifyExpectedResults(*vocbase, query, expected, 1000);
}
TEST_P(SortLimitTest, CheckSimpleLimitSortedDscInReverseInsertionOrder) {
std::string query =
"FOR d IN testCollection0 SORT d.valDsc DESC LIMIT 0, 10 RETURN d";
std::vector<size_t> expected = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
EXPECT_EQ(sorterType(*vocbase, query), "constrained-heap");
verifyExpectedResults(*vocbase, query, expected, 1000);
}
TEST_P(SortLimitTest, CheckLimitWithOffsetSortedDscInReverseInsertionOrder) {
std::string query =
"FOR d IN testCollection0 SORT d.valDsc DESC LIMIT 10, 10 RETURN d";
std::vector<size_t> expected = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
EXPECT_EQ(sorterType(*vocbase, query), "constrained-heap");
verifyExpectedResults(*vocbase, query, expected, 1000);
}
TEST_P(SortLimitTest, CheckLimitWithOffsetCompoundSort) {
std::string query =
"FOR d IN testCollection0 SORT d.mod, d.valAsc LIMIT 2, 5 RETURN d";
std::vector<size_t> expected = {200, 300, 400, 500, 600};
EXPECT_EQ(sorterType(*vocbase, query), "constrained-heap");
verifyExpectedResults(*vocbase, query, expected, 1000);
}
TEST_P(SortLimitTest, CheckLimitWithOffsetCompoundSortAgain) {
std::string query =
"FOR d IN testCollection0 SORT d.mod, d.valAsc LIMIT 10, 10 RETURN d";
std::vector<size_t> expected = {1, 101, 201, 301, 401,
501, 601, 701, 801, 901};
EXPECT_EQ(sorterType(*vocbase, query), "constrained-heap");
verifyExpectedResults(*vocbase, query, expected, 1000);
}
TEST_P(SortLimitTest, CheckInterloperFilterMovedUp) {
std::string query =
"FOR d IN testCollection0 SORT d.valAsc FILTER d.mod == 0 LIMIT 0, 10 "
"RETURN d";
std::vector<size_t> expected = {0, 100, 200, 300, 400,
500, 600, 700, 800, 900};
EXPECT_EQ(sorterType(*vocbase, query), "constrained-heap");
verifyExpectedResults(*vocbase, query, expected, 10);
}
TEST_P(SortLimitTest, CheckInterloperFilterNotMoved) {
std::string query =
"FOR d IN testCollection0 SORT d.valAsc FILTER d.mod == 0 LIMIT 0, 10 "
"RETURN d";
std::string rules = "\"-move-filters-up\", \"-move-filters-up-2\"";
std::vector<size_t> expected = {0, 100, 200, 300, 400,
500, 600, 700, 800, 900};
EXPECT_EQ(sorterType(*vocbase, query, rules), "standard");
verifyExpectedResults(*vocbase, query, expected, 10, rules);
}
TEST_P(SortLimitTest, CheckInterloperEnumerateList) {
std::string query =
"FOR d IN testCollection0 SORT d.valAsc FOR e IN 1..10 FILTER e == 1 "
"LIMIT 0, 10 RETURN d";
std::vector<size_t> expected = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
EXPECT_EQ(sorterType(*vocbase, query), "standard");
verifyExpectedResults(*vocbase, query, expected, 1000);
}
|
a5dea746046ebbf78c4bddc677efcc33d577dd07 | 0625713361c2095fc89109ecb7eca0fd944fa85b | /Source/FPS/Private/FPSCharacter.cpp | c88df5045ff0fe0d290a50ce2411d0addb1b58a7 | [] | no_license | nashnie/FPS | 70dd94332f966f507635b05f2faf8d9eef4b61ae | 63aff8ae2c4010999259175d0c5bb9719418df8d | refs/heads/master | 2020-03-28T13:44:32.574847 | 2018-09-15T10:35:44 | 2018-09-15T10:35:44 | 148,424,526 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,497 | cpp | FPSCharacter.cpp | // Fill out your copyright notice in the Description page of Project Settings.
#include "FPSCharacter.h"
#include "Camera/CameraComponent.h"
#include "GameFramework/SpringArmComponent.h"
#include "GameFramework/PawnMovementComponent.h"
#include "FPSWeaponActor.h"
// Sets default values
AFPSCharacter::AFPSCharacter()
{
// Set this character to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
SpringArmComp = CreateDefaultSubobject<USpringArmComponent>(TEXT("SpringArmComp"));
SpringArmComp->SetupAttachment(RootComponent);
SpringArmComp->bUsePawnControlRotation = true;
CameraComp = CreateDefaultSubobject<UCameraComponent>(TEXT("CameraComp"));
CameraComp->SetupAttachment(SpringArmComp);
GetMovementComponent()->GetNavAgentPropertiesRef().bCanCrouch = true;
WeaponAttachSocketName = "WeaponSocket";
//UE_LOG(LogTemp, Log, TEXT("AFPSCharacter %s"), SpringArmComp->bUsePawnControlRotation ? "1" : "0");
OnTakeRadialDamage.AddDynamic(this, &AFPSCharacter::TakeRadialDamageHandler);
}
// Called when the game starts or when spawned
void AFPSCharacter::BeginPlay()
{
Super::BeginPlay();
FActorSpawnParameters SpawnParams;
SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
FPSWeaponActor = GetWorld()->SpawnActor<AFPSWeaponActor>(StarterWeaponClass, FVector::ZeroVector, FRotator::ZeroRotator, SpawnParams);
if (FPSWeaponActor)
{
FPSWeaponActor->SetOwner(this);
FPSWeaponActor->AttachToComponent(GetMesh(), FAttachmentTransformRules::SnapToTargetNotIncludingScale, WeaponAttachSocketName);
}
//UE_LOG(LogTemp, Log, TEXT("BeginPlay %s"), SpringArmComp->bUsePawnControlRotation ? "1" : "0");
}
void AFPSCharacter::MoveForward(float Value)
{
if (Value != 0.0f)
{
//UE_LOG(LogTemp, Log, TEXT("AddMovementInput %f"), Value);
AddMovementInput(GetActorForwardVector(), Value);
}
}
void AFPSCharacter::MoveRight(float Value)
{
if (Value != 0.0f)
{
//UE_LOG(LogTemp, Log, TEXT("MoveRight %f"), Value);
AddMovementInput(GetActorRightVector(), Value);
}
}
void AFPSCharacter::StartCrouch()
{
Crouch();
UE_LOG(LogTemp, Log, TEXT("StartCrouch"));
}
void AFPSCharacter::EndCrouch()
{
UnCrouch();
UE_LOG(LogTemp, Log, TEXT("EndCrouch"));
}
void AFPSCharacter::Fire()
{
UE_LOG(LogTemp, Log, TEXT("Fire"));
if (FPSWeaponActor)
{
FPSWeaponActor->Fire();
}
}
void AFPSCharacter::LookUp(float Val)
{
//UE_LOG(LogTemp, Log, TEXT("AddControllerPitchInput %f%s"), Val, Controller->IsLocalPlayerController() ? TEXT("True") : TEXT("False"));
//UE_LOG(LogTemp, Log, TEXT("AddControllerPitchInput IgnoreLookInput %s"), Controller->IsLookInputIgnored() ? TEXT("True") : TEXT("False"));
//APlayerController* PC = Cast<APlayerController>(Controller);
//UE_LOG(LogTemp, Log, TEXT("AddControllerPitchInput IgnoreLookInput %f"), PC->InputPitchScale);//
//UE_LOG(LogTemp, Log, TEXT("LookUp %s"), SpringArmComp->bUsePawnControlRotation ? "1" : "0");
Super::AddControllerPitchInput(Val);
}
void AFPSCharacter::TakeRadialDamageHandler(AActor * DamagedActor, float Damage, const UDamageType * DamageType, FVector Origin, FHitResult HitInfo, AController * InstigatedBy, AActor * DamageCauser)
{
UE_LOG(LogTemp, Log, TEXT("TakeRadialDamageHandler, %f"), Damage);
}
// Called every frame
void AFPSCharacter::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
// Called to bind functionality to input
void AFPSCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
PlayerInputComponent->BindAxis("MoveForward", this, &AFPSCharacter::MoveForward);
PlayerInputComponent->BindAxis("MoveRight", this, &AFPSCharacter::MoveRight);
PlayerInputComponent->BindAxis("LookUp", this, &AFPSCharacter::LookUp);
PlayerInputComponent->BindAxis("Turn", this, &ACharacter::AddControllerYawInput);
PlayerInputComponent->BindAction("Jump", IE_Pressed, this, &ACharacter::Jump);
PlayerInputComponent->BindAction("Crouch", IE_Pressed, this, &AFPSCharacter::StartCrouch);
PlayerInputComponent->BindAction("Crouch", IE_Released, this, &AFPSCharacter::EndCrouch);
PlayerInputComponent->BindAction("Fire", IE_Pressed, this, &AFPSCharacter::Fire);
UE_LOG(LogTemp, Log, TEXT("SetupPlayerInputComponent"));
}
FVector AFPSCharacter::GetPawnViewLocation() const
{
if (CameraComp)
{
return CameraComp->GetComponentLocation();
}
return Super::GetPawnViewLocation();
}
|
199a583dfcf9cc1b1c092d3f45b80ddda1eef00d | 4379b8a65c114925be6aa3e02ec0da776f8d893c | /Source/BeConverter.cpp | 9c72f4010ecdc1fad8db23d3cbc1b398c5a856cd | [
"BSD-3-Clause"
] | permissive | Teknomancer/beconverter | a2cdf6d83fe64e6224668b6dfb3b36652a86ae9d | b7dae5e63cbefd3384cab5b9b8111a09dd7d2560 | refs/heads/master | 2023-01-05T21:58:40.108299 | 2022-12-31T16:33:06 | 2022-12-31T16:33:06 | 207,756,491 | 1 | 0 | BSD-3-Clause | 2022-12-31T16:33:07 | 2019-09-11T07:59:48 | C++ | UTF-8 | C++ | false | false | 12,778 | cpp | BeConverter.cpp | // SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2001 Ramshankar (aka Teknomancer).
// Copyright (c) 2023 OscarL.
// All rights reserved.
#include "message_labels.h"
#include "BeConverter.h"
#include "MainWindow.h"
#include "OptionsWindow.h"
#include "ConverterWindow.h"
#include "MainView.h"
#include "Box1.h"
#include "CatListView.h"
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#include <Application.h>
#include <ListView.h>
#include <Roster.h>
#include <Path.h>
#include <Directory.h>
#include <Entry.h>
#include <FindDirectory.h>
#include <Alert.h>
#include <Font.h>
#include <TextView.h>
#include <String.h>
#include <Mime.h>
using namespace std;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BeConverter::BeConverter()
: BApplication("application/x-vnd.BeConverter")
{
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BeConverter::~BeConverter ()
{
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool BeConverter::quitapp = false;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void BeConverter::ReadyToRun ()
{
if (quitapp == false)
{
// Load settings file to retrieve "register mime" or not
BPath path;
find_directory (B_USER_SETTINGS_DIRECTORY, &path, true);
char settings_path[B_PATH_NAME_LENGTH];
sprintf (settings_path, "%s/BeConverter/General_settings", path.Path());
fstream f (settings_path, ios::in);
if (f)
{
char tempbuf[50];
char value[100];
while (! f.eof ())
{
f.getline (tempbuf, 50, '=');
f.getline (value, 100, '\n');
// Yes... user wants to register file-types on startup
if (strcasecmp(tempbuf, "Register Mime Types") == 0)
{
this->RegFileTypes ();
break;
}
}
f.close ();
}
// Create the main window
mainWindow = new MainWindow();
}
else
{
be_app->PostMessage (B_QUIT_REQUESTED);
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void BeConverter::MessageReceived (BMessage *message)
{
BPath path;
char tempfile[B_PATH_NAME_LENGTH];
switch (message->what)
{
case ID_BTN_OPTIONS:
optionsWindow = new OptionsWindow();
optionsWindow->Show();
break;
case ID_BTN_CONVERTER:
{
// Open a temp file and write the index to it
// Then that index will be accessed using a BDirectory's
// GetNextEntry method.
find_directory (B_SYSTEM_TEMP_DIRECTORY, &path, true);
sprintf (tempfile, "%s/Bec937373866", path.Path ());
fstream f (tempfile, ios::out);
long x = -1;
if (f)
{
x = (long)mainWindow->mainView->box1->catList->CurrentSelection ();
f << x << endl;
}
f.close ();
if (x < 0)
{
BAlert *myalert;
myalert = new BAlert ("Error", "Please select one category "
"from the list of available categories, then "
"click the \"Converter\" button.\n", "OK",
NULL, NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING,
B_STOP_ALERT);
myalert->Go ();
}
else
{
app_info appInfo;
be_app->GetAppInfo (&appInfo);
BEntry appEntry (&appInfo.ref);
appEntry.GetParent (&appEntry);
BPath CurrentPath (&appEntry);
char units_path[B_PATH_NAME_LENGTH];
sprintf (units_path, "%s/Units", CurrentPath.Path ());
BDirectory udir;
udir.SetTo (units_path);
// Now get the path
BEntry entry;
BPath unitpath;
for (long c = 0; c <= x; c++)
{
if (udir.GetNextEntry (&entry, false) != B_ENTRY_NOT_FOUND)
{
if (c == x)
entry.GetPath (&unitpath);
}
}
bool winAlreadyOpen = false;
int32 i;
for (i = 0; i < CountWindows(); i++)
{
if (strcasecmp (WindowAt(i)->Title(), unitpath.Leaf()) == 0)
{
winAlreadyOpen = true;
break;
}
}
if (winAlreadyOpen == false)
{
converterWindow = new ConverterWindow();
converterWindow->Show();
}
else
{
WindowAt(i)->Activate ();
}
}
}
break;
case ID_CLOSE_CONVERTER_WINDOW :
converterWindow->Hide();
delete converterWindow;
converterWindow = NULL;
break;
default:
break;
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void BeConverter::RefsReceived (BMessage *message)
{
// This is where the control comes when the user
// tries to open a unit file from BeConverter
static bool shownInfo;
if (shownInfo == true)
return;
shownInfo = true;
BAlert *refalert;
refalert = new BAlert ("Title", "BeConverter\n\nThis is a BeConverter's "
"unit descriptor file which helps you make your own "
"units in such a way BeConverter can understand them."
"\n\nFor more information read the \"Custom categories\" "
"section of the user's guide.\n", "OK");
BFont headfont;
headfont.SetFace (B_BOLD_FACE);
headfont.SetSize (18);
BTextView *txtvw;
txtvw = refalert->TextView ();
txtvw->SetStylable (true);
txtvw->SetFontAndColor (0, 11, &headfont);
rgb_color be_blue;
be_blue.red = 0;
be_blue.green = 0;
be_blue.blue = 210;
be_blue.alpha = 255;
rgb_color be_red;
be_red.red = 210;
be_red.green = 0;
be_red.blue = 0;
be_red.alpha = 255;
txtvw->SetFontAndColor (0, 1, &headfont, B_FONT_ALL, &be_blue);
txtvw->SetFontAndColor (1, 2, &headfont, B_FONT_ALL, &be_red);
refalert->Go ();
quitapp = true;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool BeConverter::QuitRequested ()
{
// Delete the temporary file created by BeConverter
BPath path;
find_directory (B_SYSTEM_TEMP_DIRECTORY, &path, false);
char temp_file [B_PATH_NAME_LENGTH];
sprintf (temp_file, "%s/Bec937373866", path.Path());
BEntry temp_entry (temp_file);
temp_entry.Remove ();
// Quit the app and all running BLoopers
be_app->PostMessage (B_QUIT_REQUESTED);
return true;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void BeConverter::AboutRequested ()
{
mainWindow->PostMessage (ID_BTN_ABOUT);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void BeConverter::RegFileTypes ()
{
// Declare the mime-type
BMimeType factype("text/x-BeConverter");
// Add attributes for the mime-type
BMessage msg;
msg.AddString ("attr:name", "Unit");
msg.AddString ("attr:public_name", "Unit");
msg.AddInt32 ("attr:type", B_STRING_TYPE);
msg.AddBool ("attr:public", true);
msg.AddBool ("attr:viewable", true);
msg.AddBool ("attr:editable", true);
msg.AddInt32 ("attr:width", 90);
msg.AddBool ("attr:extra", false);
msg.AddInt32 ("attr:alignment", B_ALIGN_LEFT);
// Symbol
msg.AddString ("attr:name", "Symbol");
msg.AddString ("attr:public_name", "Symbol");
msg.AddInt32 ("attr:type", B_STRING_TYPE);
msg.AddBool ("attr:public", true);
msg.AddBool ("attr:viewable", true);
msg.AddBool ("attr:editable", true);
msg.AddInt32 ("attr:width", 60);
msg.AddBool ("attr:extra", false);
msg.AddInt32 ("attr:alignment", B_ALIGN_LEFT);
// Value
msg.AddString ("attr:name", "Value");
msg.AddString ("attr:public_name", "Value");
msg.AddInt32 ("attr:type", B_STRING_TYPE);
msg.AddBool ("attr:public", true);
msg.AddBool ("attr:viewable", true);
msg.AddBool ("attr:editable", true);
msg.AddInt32 ("attr:width", 80);
msg.AddBool ("attr:extra", false);
msg.AddInt32 ("attr:alignment", B_ALIGN_LEFT);
// Register the attribs and set description info for the mime-type
factype.SetShortDescription ("BeConverter Factor Unit");
factype.SetLongDescription ("BeConverter Factor Unit");
factype.SetPreferredApp ("application/x-vnd.BeConverter", B_OPEN);
factype.SetAttrInfo (&msg);
//
// Declare the next mime-type
//
BMimeType fortype("text/x-BeConverterFormula");
// Unit
BMessage msg2;
msg2.AddString ("attr:name", "Unit");
msg2.AddString ("attr:public_name", "Unit");
msg2.AddInt32 ("attr:type", B_STRING_TYPE);
msg2.AddBool ("attr:public", true);
msg2.AddBool ("attr:viewable", true);
msg2.AddBool ("attr:editable", true);
msg2.AddInt32 ("attr:width", 90);
msg2.AddBool ("attr:extra", false);
msg2.AddInt32 ("attr:alignment", B_ALIGN_LEFT);
// Symbol
msg2.AddString ("attr:name", "Symbol");
msg2.AddString ("attr:public_name", "Symbol");
msg2.AddInt32 ("attr:type", B_STRING_TYPE);
msg2.AddBool ("attr:public", true);
msg2.AddBool ("attr:viewable", true);
msg2.AddBool ("attr:editable", true);
msg2.AddInt32 ("attr:width", 60);
msg2.AddBool ("attr:extra", false);
msg2.AddInt32 ("attr:alignment", B_ALIGN_LEFT);
// To Equation
msg2.AddString ("attr:name", "To Equation");
msg2.AddString ("attr:public_name", "To Equation");
msg2.AddInt32 ("attr:type", B_STRING_TYPE);
msg2.AddBool ("attr:public", true);
msg2.AddBool ("attr:viewable", true);
msg2.AddBool ("attr:editable", true);
msg2.AddInt32 ("attr:width", 90);
msg2.AddBool ("attr:extra", false);
msg2.AddInt32 ("attr:alignment", B_ALIGN_LEFT);
// From Equation
msg2.AddString ("attr:name", "From Equation");
msg2.AddString ("attr:public_name", "From Equation");
msg2.AddInt32 ("attr:type", B_STRING_TYPE);
msg2.AddBool ("attr:public", true);
msg2.AddBool ("attr:viewable", true);
msg2.AddBool ("attr:editable", true);
msg2.AddInt32 ("attr:width", 90);
msg2.AddInt32 ("attr:alignment", B_ALIGN_LEFT);
msg2.AddBool ("attr:extra", false);
// Constant
msg2.AddString ("attr:name", "Constant (k)");
msg2.AddString ("attr:public_name", "Constant (k)");
msg2.AddInt32 ("attr:type", B_STRING_TYPE);
msg2.AddBool ("attr:public", true);
msg2.AddBool ("attr:viewable", true);
msg2.AddBool ("attr:editable", true);
msg2.AddInt32 ("attr:width", 60);
msg2.AddBool ("attr:extra", false);
msg2.AddInt32 ("attr:alignment", B_ALIGN_LEFT);
// Set attribs for registered type
fortype.SetShortDescription ("BeConverter Formula Unit");
fortype.SetLongDescription ("BeConverter Formula Unit");
fortype.SetPreferredApp ("application/x-vnd.BeConverter", B_OPEN);
fortype.SetAttrInfo (&msg2);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int main()
{
new BeConverter();
be_app->Run();
delete be_app;
return B_OK;
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
96c6249989b3149c914be05bc6b9a1fd2dafe5ec | 4d2db5d27a7780c980a2b07f6960d47911989d17 | /quantum dot/Molecule.h | 3fadc2d61d89682cb47fe6d5123dd30ef7ae040f | [] | no_license | RocketSci2014/Single-Molecule-Simulations | 78049621c6029f4cf5919f1682e422a148e7c9c5 | 78cfadd4866dc94a87094fc9736a267001ff4bf7 | refs/heads/master | 2021-05-15T13:43:10.866623 | 2018-07-01T00:02:36 | 2018-07-01T00:02:36 | 107,220,509 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 847 | h | Molecule.h | #pragma once
#ifndef MOLECULE_H
#define MOLECULE_H
#include "global.h"
#include "randomcup.h"
using namespace std;
class Molecule:
public randomcup
{
public:
double timing;//timing of the next photophysics event
MoleculeState state;//state of the molecule
MoleculeType type;//type of the molecule
int position;//position of the molecule in a nanochannel
#ifdef WssPeak1
std::vector<double> peaks;//to record the wss peaks of a single molecule
#endif
Molecule(double ttime2,int position1,MoleculeType type1);//generate molecule and find the next excitation time of the molecule
void FindNextExcitation(double ttime1);//find the timing of the next excitation after one photophysics event
double PhotoPhysics(void);//To generate the photophysics, ttime is the end time of the current loop
~Molecule(void);
};
#endif |
55599bf7b5fb058ca4423186564c85b1ab32cea0 | 5c24a829d1ce3e9cc9f48da120dc02a0b49ded54 | /Widgets/Weekendar.h | dba6044c0ef10ec26bfc8e264eddca105c2e356f | [] | no_license | samyhocine/TinyUI | 3989bbb69938e9cefc2ba7ac409baf881a8063a4 | 18c5e31e1a6da20accb09c26adc3557b00780253 | refs/heads/master | 2022-03-03T12:51:57.325281 | 2019-11-09T15:17:13 | 2019-11-09T15:17:13 | 220,659,543 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,009 | h | Weekendar.h | #ifndef WEEKENDAR_H
#define WEEKENDAR_H
#include <vector>
#include "../Elements/Widget.h"
#include "../Elements/Button.h"
#define BUTTON_WIDTH 15
class Weekendar : public Widget
{
public:
Weekendar(uint16_t x, uint16_t y, uint16_t w, uint16_t h, char days[TXT_SIZE], uint8_t days_r, uint8_t days_g, uint8_t days_b,
uint8_t *sel, uint8_t sel_r, uint8_t sel_g, uint8_t sel_b, Widget *parent);
Weekendar(Position position, Size size, char days[TXT_SIZE], Color days_color, uint8_t *sel, Color sel_color, Widget *parent);
bool manageEvents(Position pointer);
void display(Screen *screen);
private:
void init(uint16_t x, uint16_t y, uint16_t w, uint16_t h, char days[TXT_SIZE], uint8_t days_r, uint8_t days_g, uint8_t days_b,
uint8_t *sel, uint8_t sel_r, uint8_t sel_g, uint8_t sel_b);
void updateSel(uint8_t sel);
void updateDaysColor();
std::vector<Button> m_button;
uint8_t *m_sel;
Color m_sel_color;
Color m_days_color;
};
#endif //WEEKENDAR_H
|
1b37af73953d037a86f85539672109bf7ae89669 | 55126026c3607a5012ce413538c08e0825ec26b8 | /clrc_main.cpp | ba1b35a10f5f0330806b20524cb0ebd8fe906050 | [] | no_license | sophy228/AokoContainer | e146a4e1c567325520cd13cc85dfa6ea708da1cf | ec6f3c46a9db3c851c849d2f0b046267f079fec0 | refs/heads/master | 2021-07-13T14:01:01.502803 | 2019-11-13T01:48:44 | 2019-11-13T01:50:30 | 221,589,016 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,085 | cpp | clrc_main.cpp | /*Copyright (C) 2019 Zhongmin Wu
License - MIT
=============
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 <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <linux/sched.h>
#include <fcntl.h>
#include <signal.h>
#include <string.h>
#include "lib/ns_lib.h"
static void setup_env() {
//clearenv();
putenv((char *)"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:");
char * home = NULL;
asprintf(&home, (char*)"HOME=/%s", getlogin());
if(home) {
putenv(home);
free(home);
}
}
int main(int argc, char * argv[]) {
(void)argc;
enter_clrd_space();
setup_env();
char * home = getenv((char*)"HOME");
if(home)
chdir(home);
else
{
chdir("/");
}
if(fork() == 0) {
printf("exec %s\n", argv[1]);
execvp(argv[1], &argv[1]);
}
struct sigaction sa;
memset(&sa, 0, sizeof(sa));
if(!sigemptyset(&sa.sa_mask)) {
sa.sa_handler = SIG_IGN;
sigaction(SIGINT, &sa, NULL);
}
waitpid(-1, NULL, 0);
return 0;
} |
133d0a44e78839a2506c93a6ff3c5e6f931449e1 | 2226c2e048b0a2525af9fdd065d3ce8ad9689cde | /src/modules/stats/t_test.hpp | 12ba56a24965920a572b95902b8b614d95221986 | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-warranty-disclaimer",
"MPL-2.0",
"mif-exception",
"LGPL-2.0-or-later",
"BSD-3-Clause",
"GPL-2.0-only",
"LicenseRef-scancode-free-unknown",
"BSL-1.0",
"MIT",
"GPL-2.0-or-later",
"Python-2.0",
"BSD-2-Clause"
] | permissive | apache/madlib | 5bc3a5451395a942f85b514baed71e7571b2025a | d9a4ee58ad40597ec346c442e80bc8e6c95bffe2 | refs/heads/master | 2023-09-06T07:23:10.940393 | 2023-04-19T21:18:21 | 2023-04-19T22:19:46 | 42,763,345 | 335 | 83 | Apache-2.0 | 2023-09-05T16:50:32 | 2015-09-19T07:00:06 | C++ | UTF-8 | C++ | false | false | 874 | hpp | t_test.hpp | /* ----------------------------------------------------------------------- *//**
*
* @file t_test.hpp
*
*//* ----------------------------------------------------------------------- */
/**
* @brief One-sample t-Test: Transition function
*/
DECLARE_UDF(stats, t_test_one_transition)
/**
* @brief Two-sample t-Test: Transition function
*/
DECLARE_UDF(stats, t_test_two_transition)
/**
* @brief t-Test: State merge function
*/
DECLARE_UDF(stats, t_test_merge_states)
/**
* @brief One-sample t-Test: Final function
*/
DECLARE_UDF(stats, t_test_one_final)
/**
* @brief Two-sample pooled t-Test: Final function
*/
DECLARE_UDF(stats, t_test_two_pooled_final)
/**
* @brief Two-sample unpooled t-Test: Final function
*/
DECLARE_UDF(stats, t_test_two_unpooled_final)
/**
* @brief Two-sample unpooled t-Test: Final function
*/
DECLARE_UDF(stats, f_test_final)
|
c26ac18b4166b7cffac1726a046b1e1fe2b6d072 | e3a97b316fdf07b170341da206163a865f9e812c | /sprokit/processes/core/refine_detections_process.h | 38493e8e2f401177890eb73fe9d6c57f454f429e | [
"BSD-3-Clause"
] | permissive | Kitware/kwiver | 09133ede9d05c33212839cc29d396aa8ca21baaf | a422409b83f78f31cda486e448e8009513e75427 | refs/heads/master | 2023-08-28T10:41:58.077148 | 2023-07-28T21:18:52 | 2023-07-28T21:18:52 | 23,229,909 | 191 | 92 | NOASSERTION | 2023-06-26T17:18:20 | 2014-08-22T15:22:20 | C++ | UTF-8 | C++ | false | false | 1,229 | h | refine_detections_process.h | // This file is part of KWIVER, and is distributed under the
// OSI-approved BSD 3-Clause License. See top-level LICENSE file or
// https://github.com/Kitware/kwiver/blob/master/LICENSE for details.
#ifndef ARROWS_PROCESSES_REFINE_DETECTIONS_PROCESS_H
#define ARROWS_PROCESSES_REFINE_DETECTIONS_PROCESS_H
#include <sprokit/pipeline/process.h>
#include "kwiver_processes_export.h"
#include <vital/config/config_block.h>
namespace kwiver {
// ----------------------------------------------------------------
/**
* @brief Object detection refiner process.
*
* \iports
* \iport{image}
* \iport{detected_object_set}
*
* \oports
* \oport{detected_object_set}
*/
class KWIVER_PROCESSES_NO_EXPORT refine_detections_process
: public sprokit::process
{
public:
PLUGIN_INFO( "refine_detections",
"Refines detections for a given frame," )
refine_detections_process( kwiver::vital::config_block_sptr const& config );
virtual ~refine_detections_process();
protected:
virtual void _configure();
virtual void _step();
private:
void make_ports();
void make_config();
class priv;
const std::unique_ptr<priv> d;
};
} // end namespace
#endif /* ARROWS_PROCESSES_REFINE_DETECTIONS_PROCESS_H */
|
5b89c6cc065b9c224846c793b35d009d2b6523d3 | 22769eb259b3a8709fa3f0b05424b30767f93794 | /src/model/Solution.h | e195fa5821f1ffcadc1a728b7ce123d0d0a5fe3f | [] | no_license | Krixtani/CCP | 45b93546470e368a2205f64314dbb918b6767d2c | 45bcfe7c48ba1515bb47c928a891db0ecd0e86d2 | refs/heads/master | 2022-03-09T00:32:47.342116 | 2019-10-23T14:20:51 | 2019-10-23T14:20:51 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,859 | h | Solution.h | /*
CCP - Capacited Clustering Problem.
Copyright (C) 2009 Wagner Reck (wagner.reck@gmail.com)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SOLUTION_H
#define SOLUTION_H
#include "model_global.h"
/**
* Namespace
*/
#include "Point.h"
#include <QList>
#include <QString>
#include "SolutionImprovement.h"
namespace CCP {
class Point;
class Instance;
class Cluster;
class History;
/**
* Class Solution
*/
class Solution
:public QObject {
Q_OBJECT
/**
* Public stuff
*/
//public slots:
public:
/**
* Constructors
*/
/**
* Empty Constructor
*/
Solution ( Instance * instance);
~Solution();
/**
* Accessor Methods
*/
/**
*/
void setInstance (Instance * inst);
/**
*
*/
Instance * instance(){
return _myInstance;
}
/**
*
*/
PointType pointType (unsigned short index);
// void setPointsType (PointType * value ) {
// _pointsType = value;
// }
void constructSolution(HeuristicType type);
void setAlgorithmToUse(HeuristicType type);
void run();
Cluster * cluster(unsigned short index){
return _centers[index];
}
/** return name of algorithm used.*/
QString algorithmName(){ return _myAlgorithmName;}
/** Return time taken to perform selected algorithm (in seconds).*/
double timeTaken(){return _myTime;}
/** Return iterations taken to perform algorithm. */
long iterations(){return _myIterations;}
void setIterations(long iter) {_myIterations = iter;}
/**
* @brief Return the point thats represent the center of cluster at index.
* Use this method is same that does Solution::cluster(index)->centerPoint();
* @param index index of cluster in array. Shoud be less than number of centers.
* @return Point considered as center os cluster.
*/
Point * centerOfCluster(unsigned short index);
Instance * getInstance(){ return _myInstance;
}
double getValue();
void setPointType( Point* arg1, PointType arg2 );
/** @brief Return if the Solution is valid or not.
This method check if all points are assigned to only on cluster, all cluster have a center and the center is not an consumer point too.
Is checked also the capacity of clusters.
*/
bool isValid() ;
bool isImprovement() const { return toImprove;}
Solution * improve();
Solution * solutionParent() { return _parent;}
void setImprovement(ImprovementHeuristic type);
History * history();
Solution * clone() const;
/**
* Private stuff
*/
private:
/**
* Fields
*/
long _myIterations;
double _myTime;
QString _myAlgorithmName;
Instance * _myInstance;
Cluster ** _centers;
HeuristicType _type;
bool toImprove;
ImprovementHeuristic improveType;
Solution * _parent;
History* _history;
};
}
#endif //SOLUTION_H
|
a10c0191dcbebed453a6517506e8c5a37470e9db | 198c869d92b6bc2ae311c0e74ec9251e21dfeaa0 | /DirectX3D_FrameWork/cSceneChangeEffect.h | 52a858231b38cef41fbd45759b6728ab1c4fa29b | [] | no_license | DalDalKiRin/D3DX9_Team | e13b1145e19662b9c33c4a08f310dd296327347c | 9887c9171315f50a2ab9a501b17219d895983435 | refs/heads/master | 2021-01-18T05:36:04.700382 | 2016-10-15T06:07:44 | 2016-10-15T06:07:44 | 68,680,072 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 1,056 | h | cSceneChangeEffect.h | #pragma once
#include "cScene.h"
class cSceneChangeEffect
{
private:
float m_TimeFactor; // # ๊ต์ฒด ์๊ฐ ์งํ ๋น์จ (์ค์) #
LPDIRECT3DTEXTURE9 m_pPrevRenderTexture; // ๋ ๋๋ง ๋ ์ดํํธ ์ด์ ํ
์ค์ณ
LPDIRECT3DTEXTURE9 m_pNextRenderTexture; // ๋ ๋๋ง ๋ ์ดํํธ ๋ค์ ํ
์ค์ณ
float m_TotalTime; // ๊ต์ฒด ์๊ฐ
float m_DeltaTime; // ๊ต์ฒด ์งํ ์๊ฐ
float m_StartTime; // ๊ต์ฒด๊ฐ ์์๋ ์๊ฐ
cScene* m_pPrevScene; // ์ด์ ์ฌ
cScene* m_pNextScene; // ๋ค์ ์ฌ
bool m_DrawReady; // ๊ต์ฒด ์ฌ ๋๋ก์ฐ ์ฌ๋ถ
public:
cSceneChangeEffect();
~cSceneChangeEffect();
void Init();
void Release();
// ์ด์ ์ฌ ๋ค์ ์ฌ ๊ต์ฒด ์๊ฐ
void ChangeStart(cScene* pPrevScene, cScene* pNextScene, float changeTime);
void Update(float timeDelta);
void Render();
// ์ด์ ํ
์ค์ณ ๋ค์ ํ
์ค์ณ ๊ต์ฒด ๋น์จ
virtual void ChangeEffect(LPDIRECT3DTEXTURE9 pPrev, LPDIRECT3DTEXTURE9 pNext, float factor);
bool IsDrawReady()
{
return m_DrawReady;
}
};
|
08fda5dbcfa9c68333873bf79ac1cef67bb55b83 | 39bd575aa2b588b3ae6118166ba73ec84dea56e7 | /Code/Time and Oled Screen.ino | dc96bfdee7bbaa61671c79d6c0253c2f79032fcd | [] | no_license | 5l1v3r1/software_enginering_home_automation | 3c80651c9620d869ef0bc424631a6c1ce1c948e0 | 17363dca221aba8617b3a05d264ce04d4bb8e793 | refs/heads/master | 2022-03-29T20:09:14.209804 | 2019-12-04T21:25:57 | 2019-12-04T21:25:57 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,031 | ino | Time and Oled Screen.ino | #include <Wire.h>
#include "RTClib.h"
#include <Adafruit_SSD1306.h>
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
RTC_DS1307 RTC;
void setup () {
Serial.begin(9600);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.clearDisplay();
Wire.begin();
RTC.begin();
if (! RTC.isrunning()) {
Serial.println("RTC is NOT running!");
RTC.adjust(DateTime(F(__DATE__), F(__TIME__)));
}
}
void loop () {
delay(1000);
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE,BLACK);
display.setCursor(95,45);
display.print(now.hour(), DEC);
display.print(':');
display.print(now.minute(), DEC);
//display.print(':');
//display.print(now.second(), DEC);
display.setCursor(95,15);
display.print(now.day(), DEC);
display.print('/');
display.print(now.month(), DEC);
display.print('/');
display.print(now.year(), DEC);
display.display();
}
|
11b5b82531ee208c6803283bfefa5bba17c87033 | 6a61e361064f5dd5ae93c0b69adb7387701ca802 | /dependencies/tools/class/menu_opciones.h | ce4c5f9c0d5905b0e4d5c6e0931e0fe95d1ec825 | [
"Beerware"
] | permissive | TheMarlboroMan/winter-fgj5 | 66092b93ef00272a73efa34d67aa2beea16bed42 | 28cd4bd4ae37230e51c1a9963bcd293e674cdc3c | refs/heads/master | 2021-07-06T13:46:51.195913 | 2021-06-08T11:21:59 | 2021-06-08T11:21:59 | 44,922,853 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,790 | h | menu_opciones.h | #ifndef MENU_OPCIONES_HERRAMIENTAS_PROYECTO
#define MENU_OPCIONES_HERRAMIENTAS_PROYECTO
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <exception>
#include <algorithm>
/*
La representaciรณn interna de un menรบ de opciones de un รบnico nivel en el que
cada opciรณn puede tener N valores que van "rotando", por ejemplo:
menu:
resoluciรณn de pantalla : [800x600], [1000x1000]
volumen_audio : [Sin sonido, Medio, Alto]
idioma: [Espaรฑol, Inglรฉs, Francรฉs, Japonรฉs]
El menu serรญa el primer nivel. El segundo nivel "resoluciรณn de pantalla",
"volumen_audio" e "idioma" serรญan "opciones" y el รบltimo nivel serรญan
"selecciones"
Cada opciรณn y selecciรณn estรกn identificados por una clave que no debe repetirse.
En caso de que se repita tendremos una excepciรณn. Ojo, no debe repetirse en
general, no sรณlo entre opciones y selecciones!!!.
A la hora de insertar tanto una opciรณn como una clave se ordenarรกn por el tipo
Tclave especificado en el template.
Es perfectamente posible tener selecciones dentro de una opciรณn con el mismo
valor.
Va acompaรฑado de un mรฉtodo "traducir" que hace una pasada simple por todos los
"nombres" para reemplazarlos por otro, de forma que podamos hacer menรบs
en mรบltiples idiomas.
Al final de este archivo hay un ejemplo de uso.
--== Interface pรบblica ==-------------------------------------------------------
Por lo general todos los mรฉtodos lanzan excepciรณn si la clave no existe.
class Menu_opciones_exception:public std::runtime_error;
Estructura de traducciรณn: podemos hacer un vector de estas y pasarlo al mรฉtodo
"traducir" para que traduzca las opciones y selecciones con la clave "busca"
con los textos "reemplaza".
struct struct_traduccion
{
Tclave busca;
std::string reemplaza;
};
Los mรฉtodos son:
Inserta una opciรณn.
void insertar_opcion(const Tclave& clave, const std::string& nombre);
Elimina una opciรณn por su clave.
void eliminar_opcion(const Tclave& clave)
Crea una selecciรณn en una opciรณn. Lanza excepciรณn si las claves estรกn duplicadas.
void insertar_seleccion_en_opcion(const Tclave& clave_opcion, const Tclave& clave_seleccion, const std::string& nombre, const Tvalor& valor)
Elimina una selecciรณn de una opciรณn.
void eliminar_seleccion(const Tclave& clave_opcion, const Tclave& clave_seleccion)
Cambia la selecciรณn de una opciรณn hacia adelante (dir=1) o atrรกs (dir=-1).
void rotar_opcion(const Tclave& clave, int dir)
Indica la cantidad de selecciones de una opciรณn.
size_t size_opcion(const Tclave& clave) const
Indica el valor actual de la opciรณn.
Tvalor valor_opcion(const Tclave& clave) const
Indica el nombre visible de la opciรณn.
std::string nombre_opcion(const Tclave& clave) const
Indica el nombre visible de la selecciรณn para la opciรณn.
std::string nombre_seleccion(const Tclave& clave) const
Traduce el menรบ.
void traducir(const std::vector<struct_traduccion>& v)
Traduce el menรบ.
void traducir(const struct_traduccion& t)
Indica la cantidad de opciones.
size_t size() const
Cambia la selecciรณn actual de una opciรณn.
void seleccionar_opcion(const Tclave& clave_opcion, const Tclave& clave_seleccion)
Cambia la selecciรณn actual de una opciรณn por su valor.
void seleccionar_opcion_por_valor(const Tclave& clave_opcion, const Tvalor& valor_seleccion)
Obtiene un vector con las claves de las opciones, sin las claves de las selecciones.
std::vector<Tclave> obtener_claves() const
*/
namespace Herramientas_proyecto
{
class Menu_opciones_exception:
public std::runtime_error
{
public:
Menu_opciones_exception(const std::string& s):std::runtime_error(s) {}
};
template<typename Tvalor, typename Tclave>
class Menu_opciones
{
private:
struct Seleccion_menu
{
Tvalor valor;
std::string nombre;
};
struct Opcion_menu
{
std::string nombre;
std::map<Tclave, Seleccion_menu> selecciones;
Tclave clave_actual;
void comprobar_opciones_existen(const std::string& msj) const
{
if(!selecciones.size()) throw Menu_opciones_exception(msj);
}
void rotar(int dir)
{
auto it=selecciones.find(clave_actual);
//Descender...
if(dir < 0)
{
if(it==selecciones.begin()) //Dar la vuelta.
{
clave_actual=selecciones.rbegin()->first;
}
else
{
clave_actual=std::prev(it)->first;
}
}
//Ascender...
else
{
auto sigue=std::next(it);
if(sigue==std::end(selecciones))
{
clave_actual=selecciones.begin()->first;
}
else
{
clave_actual=sigue->first;
}
}
}
void insertar_seleccion(const Tclave& clave, const Tvalor& valor, const std::string& nombre)
{
if(!selecciones.size()) clave_actual=clave;
selecciones[clave]={valor, nombre};
}
Opcion_menu(const std::string& n):nombre(n), clave_actual() {}
};
void comprobar_opcion_existe(const Tclave& clave, const std::string& msj) const
{
if(!opciones.count(clave))
throw Menu_opciones_exception(msj);
}
void comprobar_clave_unica(const Tclave& clave) const
{
if(std::find(std::begin(claves), std::end(claves), clave)!=std::end(claves))
{
throw Menu_opciones_exception("Detectada clave duplicada");
}
claves.push_back(clave);
}
public:
struct struct_traduccion
{
Tclave busca;
std::string reemplaza;
};
void insertar_opcion(const Tclave& clave, const std::string& nombre)
{
comprobar_clave_unica(clave);
opciones.insert(std::pair<Tclave, Opcion_menu>(clave, Opcion_menu(nombre)));
}
void eliminar_opcion(const Tclave& clave)
{
comprobar_opcion_existe(clave, "La clave no existe para ser eliminada");
opciones.erase(clave);
}
void insertar_seleccion_en_opcion(const Tclave& clave_opcion, const Tclave& clave_seleccion, const std::string& nombre, const Tvalor& valor)
{
comprobar_clave_unica(clave_seleccion);
comprobar_opcion_existe(clave_opcion, "La clave no existe para insertar seleccion "+nombre+" en selecciones");
auto& o=opciones.at(clave_opcion);
o.insertar_seleccion(clave_seleccion, valor, nombre);
}
void eliminar_seleccion(const Tclave& clave_opcion, const Tclave& clave_seleccion)
{
comprobar_opcion_existe(clave_opcion, "La clave no existe para eliminar seleccion en selecciones");
auto& o=opciones.at(clave_opcion);
if(!o.selecciones.count(clave_seleccion)) throw Menu_opciones_exception("La clave no existe en selecciones para eliminar");
o.selecciones.erase(clave_seleccion);
}
void rotar_opcion(const Tclave& clave, int dir)
{
comprobar_opcion_existe(clave, "La clave no existe para ser rotada");
opciones.at(clave).rotar(dir);
}
size_t size_opcion(const Tclave& clave) const
{
comprobar_opcion_existe(clave, "La clave no existe para obtener_valor");
return opciones.at(clave).selecciones.size();
}
Tvalor valor_opcion(const Tclave& clave) const
{
comprobar_opcion_existe(clave, "La clave no existe para obtener_valor");
const auto& o=opciones.at(clave);
o.comprobar_opciones_existen("La opciรณn no tiene selecciones para obtener valor");
return o.selecciones.at(o.clave_actual).valor;
}
std::string nombre_opcion(const Tclave& clave) const
{
comprobar_opcion_existe(clave, "La clave no existe para obtener_valor");
return opciones.at(clave).nombre;
}
std::string nombre_seleccion(const Tclave& clave) const
{
comprobar_opcion_existe(clave, "La clave no existe para obtener_valor");
const auto& o=opciones.at(clave);
o.comprobar_opciones_existen("La opciรณn no tiene selecciones para obtener valor");
return o.selecciones.at(o.clave_actual).nombre;
}
void traducir(const std::vector<struct_traduccion>& v)
{
for(const auto& t : v) traducir(t);
}
void traducir(const struct_traduccion& t)
{
const auto busca=t.busca, reemplaza=t.reemplaza;
auto reemplazar=[&busca, &reemplaza](const Tclave& clave, std::string& cad)
{
if(clave==busca)
{
cad=reemplaza;
}
};
for(auto& opcion : opciones)
{
reemplazar(opcion.first, opcion.second.nombre);
for(auto& seleccion : opcion.second.selecciones)
{
reemplazar(seleccion.first, seleccion.second.nombre);
}
}
}
size_t size() const
{
return opciones.size();
}
void seleccionar_opcion(const Tclave& clave_opcion, const Tclave& clave_seleccion)
{
comprobar_opcion_existe(clave_opcion, "La clave no existe para seleccionar opciรณn");
auto& opcion=opciones.at(clave_opcion);
if(!opcion.selecciones.count(clave_seleccion))
{
throw Menu_opciones_exception("La clave no existe al asignar selecciรณn");
}
else opcion.clave_actual=clave_seleccion;
}
void seleccionar_opcion_por_valor(const Tclave& clave_opcion, const Tvalor& valor_seleccion)
{
comprobar_opcion_existe(clave_opcion, "La clave no existe para seleccionar opciรณn");
auto& opcion=opciones.at(clave_opcion);
for(auto& seleccion : opcion.selecciones)
{
if(seleccion.second.valor==valor_seleccion)
{
opcion.clave_actual=seleccion.first;
return;
}
}
throw Menu_opciones_exception("El valor no existe al asignar selecciรณn");
}
std::vector<Tclave> obtener_claves() const
{
//No podemos usar "claves" puesto que contiene tambiรฉn las claves de las selecciones...
std::vector<Tclave> res;
for(const auto& o : opciones) res.push_back(o.first);
return res;
}
private:
mutable std::vector<Tclave> claves;
std::map<Tclave, Opcion_menu> opciones;
};
}
/*
Ejemplo de uso
int main(int argc, char ** argv)
{
using namespace Herramientas_proyecto;
Menu_opciones<std::string, int> menu;
menu.insertar_opcion(1, "--OPCION_1");
menu.insertar_seleccion_en_opcion(1, 100, "--VALOR 1.1", "PRIMER VALOR 1");
menu.insertar_seleccion_en_opcion(1, 101, "--VALOR 1.2", "2 VALOR 1");
menu.insertar_seleccion_en_opcion(1, 102, "--VALOR 1.3", "3 VALOR 1");
menu.insertar_opcion(2, "--OPCION_2");
menu.insertar_seleccion_en_opcion(2, 103, "--VALOR 2.1", "1 VALOR 2");
menu.insertar_seleccion_en_opcion(2, 104, "--VALOR 2.2", "2 VALOR 2");
menu.insertar_opcion(3, "--OPCION_3");
menu.insertar_seleccion_en_opcion(3, 105, "--VALOR 3.1", "1 VALOR 3");
menu.insertar_seleccion_en_opcion(3, 106, "--VALOR 3.2", "2 VALOR 3");
std::vector<Menu_opciones<std::string, int>::struct_traduccion > trad={
{1, "TAMAรO PANTALLA"}, {2, "VOLUMEN SONIDO"}, {3, "IDIOMA"},
{100, "300x200"}, {101, "600x400"}, {102, "1200x800"},
{103, "Medio"}, {104, "Alto"},
{105, "Espaรฑol"}, {106, "Inglรฉs"}
};
menu.traducir(trad);
const auto& v=menu.obtener_claves();
int i=0;
while(i < 4)
{
for(auto c : v)
{
std::cout<<"C"<<c<<" : "<<menu.nombre_opcion(c)<<" : "<<menu.nombre_seleccion(c)<<" : '"<<menu.valor_opcion(c)<<"'"<<std::endl;
menu.rotar_opcion(c, 1);
}
std::cout<<" ------ "<<std::endl;
++i;
}
return 1;
}
*/
#endif
|
347fe73b6120ad239f9fbcc10c2a3d95a82b1927 | 4d0300263d28fb461f285cc2c3dfd7c51621cb4d | /external/mpg123-1.13.1/ports/MSVC++/2008clr/mpg123clr/string.h | 8a5ae46c63e1bcc007c307f1c2fd388fe1f91eae | [
"MIT",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-free-unknown",
"LGPL-2.1-only",
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"GPL-2.0-only"
] | permissive | coronalabs/corona | 6a108e8bfc8026e8c85e6768cdd8590b5a83bdc2 | 5e853b590f6857f43f4d1eb98ee2b842f67eef0d | refs/heads/master | 2023-08-30T14:29:19.542726 | 2023-08-22T15:18:29 | 2023-08-22T15:18:29 | 163,527,358 | 2,487 | 326 | MIT | 2023-09-02T16:46:40 | 2018-12-29T17:05:15 | C++ | UTF-8 | C++ | false | false | 11,350 | h | string.h | /*
mpg123clr: MPEG Audio Decoder library Common Language Runtime version.
copyright 2009 by Malcolm Boczek - free software under the terms of the LGPL 2.1
mpg123clr.dll is a derivative work of libmpg123 - all original mpg123 licensing terms apply.
All rights to this work freely assigned to the mpg123 project.
*/
/*
libmpg123: MPEG Audio Decoder library
copyright 1995-2008 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
*/
/*
1.8.1.0 04-Aug-09 Initial release.
1.9.0.0 16-Sep-09 1.9.0 Update - add enc_from_id3, store_utf8
1.9.0.0 24-Sep-09 Function names harmonized with libmpg123 (mb)
*/
#pragma once
#pragma warning(disable : 4635)
#include "mpg123.h"
#pragma warning(default : 4635)
#include <string>
#include <iostream>
#include <vcclr.h>
using namespace std;
using namespace System;
using namespace System::Runtime::InteropServices;
namespace mpg123clr
{
// Recommended usage when creating reference type on the managed heap (not using stack semantics
// for reference types...) [see Destructors and Finalizers in Visual C++]
//
// A ^ myA = gcnew A;
// try
// {
// use myA
// }
// finally
// {
// delete myA;
// }
///<summary>Wrapper for mpg123_string.
///<para>mpg123str can be used as both (publicly) an instance object and (privately) a reference object.
/// Construction and Finalizer operations perform differently depending on the instance type...
///</para>
///<para>Instanced: i.e. new mpg123str();
/// Normal operation of any object. Construction initializes memory and Destruction frees memory.
///</para>
///<para>Referenced: i.e. new mpg123str(sb);
/// Construction and Destruction have no effect on the referenced object, mpg123str objects may be freely
/// made and deleted without affecting the referenced object.
///</para>
///<para>However!
///</para>
///<para>All methods operate on the referenced object (and NOT a copy of the object), the underlying mpg123_string
/// is directly modified in situ. Therefore the referenced object can be initialized and disposed by
/// explicitly calling Init() and Free().</para>
///<para>The length of strings is limited to a 32bit value due to limitations of the CLI marshaler.
///</para>
///</summary>
[StructLayout(LayoutKind::Sequential, CharSet=CharSet::Ansi)]
public ref struct mpg123str
{
public:
///<summary>text_encoding enumeration.</summary>
enum class text_encoding
{
text_unknown = mpg123_text_unknown, /// Unkown encoding... mpg123_id3_encoding can return that on invalid codes.
text_utf8 = mpg123_text_utf8, /// UTF-8
text_latin1 = mpg123_text_latin1, /// ISO-8859-1. Note that sometimes latin1 in ID3 is abused for totally different encodings.
text_icy = mpg123_text_icy, /// ICY metadata encoding, usually CP-1252 but we take it as UTF-8 if it qualifies as such.
text_cp1252 = mpg123_text_cp1252, /// Really CP-1252 without any guessing.
text_utf16 = mpg123_text_utf16, /// Some UTF-16 encoding. The last of a set of leading BOMs (byte order mark) rules.
/// When there is no BOM, big endian ordering is used. Note that UCS-2 qualifies as UTF-8 when
/// you don't mess with the reserved code points. If you want to decode little endian data
/// without BOM you need to prepend 0xff 0xfe yourself.
text_utf16bom = mpg123_text_utf16bom, /// Just an alias for UTF-16, ID3v2 has this as distinct code.
text_utf16be = mpg123_text_utf16be, /// Another alias for UTF16 from ID3v2. Note, that, because of the mess that is reality,
/// BOMs are used if encountered. There really is not much distinction between the UTF16 types for mpg123
/// One exception: Since this is seen in ID3v2 tags, leading null bytes are skipped for all other UTF16
/// types (we expect a BOM before real data there), not so for utf16be!
text_max = mpg123_text_max /// Placeholder for the maximum encoding value.
};
///<summary>id3_enc enumeration.</summary>
enum class id3_enc
{
id3_latin1 = mpg123_id3_latin1, /// Note: This sometimes can mean anything in practice...
id3_utf16bom = mpg123_id3_utf16bom, /// UTF16, UCS-2 ... it's all the same for practical purposes.
id3_utf16be = mpg123_id3_utf16be, /// Big-endian UTF-16, BOM see note for mpg123_text_utf16be.
id3_utf8 = mpg123_id3_utf8, /// Our lovely overly ASCII-compatible 8 byte encoding for the world.
id3_enc_max = mpg123_id3_enc_max /// Placeholder to check valid range of encoding byte.
};
private:
mpg123_string* sb;
bool instanced;
internal:
///<summary>Reference Constructor. Does nothing to referenced mpg123_string structure.
///<para>Reference objects may be freely created and deleted without affecting the underlying mpg123_string object.
/// However, operations on the referenced object do modify the object in-situ (i.e. 'this' is not a 'copy'), and
/// the referenced object may be explicitly initialized and disposed by calling the appropriate methods. (Init() and Free())</para>
///<para>Recommended usage: using(mpg123str obj = new mpg123str(sb)){ use obj here }</para>
///</summary>
mpg123str(mpg123_string* sb);
///<summary>Internal Constructor.
///<para>Only used on empty fields.</para>
///</summary>
mpg123str(const char* str);
protected:
///<summary>Finalizer.
///<para>Cleanly handles mpg123_free_string of instanced mpg123_string object.</para>
///<para>Does not dispose referenced mpg123_string object. Referenced objects may be explicitly disposed by using Free().</para>
///</summary>
/// Implementation of CLR Finalize().
!mpg123str(void);
public:
///<summary>Constructor, also initializes underlying mpg123_string structure.
///<para>Instanced objects automatically dispose of underlying mpg123_string object.</para>
///<para>Recommended usage: using(mpg123str obj = new mpg123str(sb)){ use obj here }</para>
///</summary>
mpg123str(void);
///<summary>Destructor. Used for final object deletion.
///<para>Instance objects call the finalizer for clean disposal of internal mpg123_string object.</para>
///<para>Reference objects may be freely deleted without affecting the underlying mpg123_string object.
/// However, the referenced object may be explicitly disposed by calling Free()</para>
///</summary>
// Implementation of CLR Dispose().
// ~Destructor and !Finalizer are the prescribed implementation of Dispose() and Finalize().
// See Destructors and Finalizers in Visual C++
~mpg123str(void);
///<summary>Append a C# string to this mpg123str.
///<para>Returns 0 on error, 1 on success.</para>
///</summary>
///<param name="s">String to be appended.</param>
///<returns>0 on error, 1 on success.</returns>
int __clrcall mpg123_add_string(String ^ s);
///<summary>Append a C# substring to this mpg123str.
///<para>Returns 0 on error, 1 on success.</para>
///</summary>
///<param name="s">String to be appended.</param>
///<param name="from">String offset to copy from.</param>
///<param name="count">Number of characters to copy. (a null byte is always appended)</param>
///<returns>0 on error, 1 on success.</returns>
int __clrcall mpg123_add_substring(String ^ s, int from, int count);
///<summary>Copy the contents of this string to another.
///<para>Returns 0 on error, 1 on success.</para>
///</summary>
///<param name="to">Where to copy this string to.</param>
///<returns>0 on error, 1 on success.</returns>
int __clrcall mpg123_copy_string(mpg123str^ to);
///<summary>Free-up mempory for an existing mpg123_string.
///</summary>
void __clrcall mpg123_free_string(void);
///<summary>Increase size of a mpg123_string if necessary (it may stay larger).
///<para>Returns 0 on error, 1 on success.</para>
///</summary>
///<param name="newSize">Required size.</param>
///<returns>0 on error, 1 on success.</returns>
int __clrcall mpg123_grow_string(int newSize);
///<summary>Change the size of a mpg123_string.
///<para>Returns 0 on error, 1 on success.</para>
///</summary>
///<param name="newSize">Required size.</param>
///<returns>0 on error, 1 on success.</returns>
int __clrcall mpg123_resize_string(int newSize);
///<summary>Create and allocate memory for a new mpg123_string.
///</summary>
void __clrcall mpg123_init_string(void);
///<summary>Set the contents to a C# string.
///<para>Returns 0 on error, 1 on success.</para>
///</summary>
///<param name="s">String to be applied.</param>
///<returns>0 on error, 1 on success.</returns>
int __clrcall mpg123_set_string(String ^ s);
///<summary>Set the contents to a C# substring.
///<para>Returns 0 on error, 1 on success.</para>
///</summary>
///<param name="s">String to be applied.</param>
///<param name="from">String offset to copy from.</param>
///<param name="count">Number of characters to copy. (a null byte is always appended)</param>
///<returns>0 on error, 1 on success.</returns>
int __clrcall mpg123_set_substring(String ^ s, int from, int count);
///<summary>Get the number of used bytes. (including closing zero byte).
///<para>Property returns the number of used bytes.</para>
///</summary>
///<value>The number of used bytes.</value>
property int Fill{int __clrcall get();} // property
///<summary>Get the number of bytes allocated.
///<para>Property returns the number of bytes allocated.</para>
///</summary>
///<value>The number of bytes allocated.</value>
property int Size{int __clrcall get();} // property
///<summary>Get a C# string representation of the mpg123str.
///<para>Property returns C# string text.</para>
///</summary>
///<value>C# string text.</value>
property String^ Text{String^ __clrcall get();}
// 1.9.0.0 +add
///<summary>Convert ID3 encoding byte to mpg123 encoding index.
///<para>Returns the text_encoding enum of the converted value.</para>
///</summary>
///<param name="id3_enc_byte">The ID3 encoding byte to be converted.</param>
///<returns>The text_encoding enum of the converted value.</returns>
static text_encoding __clrcall mpg123_enc_from_id3(unsigned char id3_enc_byte);
///<summary>Store text data in string, after converting to UTF-8 from indicated encoding.
///<para>A prominent error can be that you provided an unknown encoding value, or this build of libmpg123 lacks support for certain encodings (ID3 or ICY stuff missing).
/// Also, you might want to take a bit of care with preparing the data; for example, strip leading zeroes (I have seen that).</para>
///<para>CLR - e.g. UnicodeEncoding(true, true) works with utf16be.</para>
///<para>Returns 0 on error, 1 on success (on error, mpg123_free_string is called on sb).</para>
///</summary>
///<param name="enc">Mpg123 text encoding value.</param>
///<param name="source">Source buffer with plain unsigned bytes.</param>
///<param name="source_size">Number of bytes in the source buffer.</param>
///<returns>0 on error, 1 on success (on error, mpg123_free_string is called on sb).</returns>
int __clrcall mpg123_store_utf8(text_encoding enc, const unsigned char *source, size_t source_size);
// 1.9.0.0 -add
};
}
|
cafabb660593252588ef3223ac3eeedf51600378 | 7b49b9e58cfd04c0c46b40e426250161d6a3d2c0 | /TexasHoldEm/ArrStack.cpp | db3490f0b0338c435e94ed923639ef6a8c04e1aa | [] | no_license | doranmartinez/TexasHoldEm | 429849b6c7b189f80f19b316c114d66368bb0fac | 2bda463834356e83c301742fc1bbc9b6d11a582a | refs/heads/master | 2020-05-07T16:10:57.968246 | 2019-09-18T18:37:31 | 2019-09-18T18:37:31 | 180,672,097 | 0 | 0 | null | 2019-04-10T22:16:21 | 2019-04-10T22:16:21 | null | UTF-8 | C++ | false | false | 539 | cpp | ArrStack.cpp | #include "ArrStack.h"
template <class T>
ArrStack<T>::ArrStack(int cap) {
items = new T [cap];
capacity = cap;
top = -1;
}
template <class T>
ArrStack<T>::~ArrStack() {
delete[] items;
}
template <class T>
bool ArrStack<T>::isEmpty() {
return top == -1;
}
template <class T>
bool ArrStack<T>::isFull() {
return top == capacity - 1;
}
template <class T>
T ArrStack<T>::pop() {
return items[top--];
}
template <class T>
void ArrStack<T>::add(T newItem) {
if (!isFull()) items[++top] = newItem;
} |
3bf80874de2ef5b41e6e8260b08d0bef452fc9a8 | 9e23cf5c92e9bd500265a9a7c52faf688d223063 | /include/parsers/where/ast_visitors.hpp | 2b6577d5cc555d42e032ccbcfc55eefd3faa087a | [] | no_license | Vilse1202/nscp | 043f74a53522189db1a494c24e6538ac68a23210 | c6643bde1c1dc7523f0b9088abb0f7a98df359af | refs/heads/master | 2021-01-18T06:32:04.913382 | 2013-08-25T12:18:51 | 2013-08-25T12:18:51 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,021 | hpp | ast_visitors.hpp | #pragma once
namespace parsers {
namespace where {
struct visitor_set_type {
typedef bool result_type;
value_type type;
visitor_set_type(value_type type) : type(type) {}
bool operator()(expression_ast & ast) {
ast.set_type(type);
std::cout << "WRR this should not happen for node: " << ast.to_string() << "\n";
//boost::apply_visitor(*this, ast.expr);
return true;
}
bool operator()(binary_op & expr) {
//std::wcout << "force_bin_op" << std::endl;
expr.left.force_type(type);
expr.right.force_type(type);
return true;
}
bool operator()(unary_op & expr) {
//std::wcout << "force_un_op" << std::endl;
expr.subject.force_type(type);
return true;
}
bool operator()(unary_fun & expr) {
//std::wcout << "force_fun" << std::endl;
if (expr.is_transparent(type))
expr.subject.force_type(type);
return true;
}
bool operator()(list_value & expr) {
BOOST_FOREACH(expression_ast &e, expr.list) {
e.force_type(type);
//boost::apply_visitor(*this, e.expr);
}
return true;
}
bool operator()(string_value & expr) { return false; }
bool operator()(int_value & expr) { return false; }
bool operator()(variable & expr) { return false; }
bool operator()(nil & expr) { return false; }
};
struct visitor_to_string {
typedef void result_type;
std::stringstream result;
void operator()(expression_ast const& ast) {
result << "{" << to_string(ast.get_type()) << "}";
boost::apply_visitor(*this, ast.expr);
}
void operator()(binary_op const& expr) {
result << "op:" << operator_to_string(expr.op) << "(";
operator()(expr.left);
result << ", ";
operator()(expr.right);
result << ")";
}
void operator()(unary_op const& expr) {
result << "op:" << operator_to_string(expr.op) << "(";
operator()(expr.subject);
result << ")";
}
void operator()(unary_fun const& expr) {
result << "fun:" << (expr.is_bound()?"bound:":"") << expr.name << "(";
operator()(expr.subject);
result << ")";
}
void operator()(list_value const& expr) {
result << " { ";
BOOST_FOREACH(const expression_ast e, expr.list) {
operator()(e);
result << ", ";
}
result << " } ";
}
void operator()(string_value const& expr) {
result << "'" << expr.value << "'";
}
void operator()(int_value const& expr) {
result << "#" << expr.value;
}
void operator()(variable const& expr) {
result << ":" << expr.get_name();
}
void operator()(nil const& expr) {
result << "<NIL>";
}
};
struct visitor_get_int {
typedef long long result_type;
filter_handler handler;
value_type type;
visitor_get_int(filter_handler handler, value_type type) : handler(handler), type(type) {}
long long operator()(expression_ast const& ast) {
return boost::apply_visitor(*this, ast.expr);
}
long long operator()(binary_op const& expr) {
return expr.evaluate(handler, type).get_int(handler);
}
long long operator()(unary_op const& expr) {
return expr.evaluate(handler).get_int(handler);
}
long long operator()(unary_fun const& expr) {
return expr.evaluate(handler, type).get_int(handler);
}
long long operator()(list_value const& expr) {
handler->error("List not supported yet!");
return -1;
}
long long operator()(string_value const& expr) {
return strEx::s::stox<long long>(expr.value);
}
long long operator()(int_value const& expr) {
return expr.value;
}
long long operator()(variable const& expr) {
return expr.get_int(handler);
}
long long operator()(nil const& expr) {
handler->error("NIL node should never happen");
return -1;
}
};
struct visitor_get_string {
typedef std::string result_type;
filter_handler handler;
value_type type;
visitor_get_string(filter_handler handler, value_type type) : handler(handler), type(type) {}
std::string operator()(expression_ast const& ast) {
return boost::apply_visitor(*this, ast.expr);
}
std::string operator()(binary_op const& expr) {
return expr.evaluate(handler, type).get_string(handler);
}
std::string operator()(unary_op const& expr) {
return expr.evaluate(handler).get_string(handler);
}
std::string operator()(unary_fun const& expr) {
return expr.evaluate(handler, type).get_string(handler);
}
std::string operator()(list_value const& expr) {
handler->error("List not supported yet!");
return "";
}
std::string operator()(string_value const& expr) {
return expr.value;
}
std::string operator()(int_value const& expr) {
return strEx::s::xtos(expr.value);
}
std::string operator()(variable const& expr) {
return expr.get_string(handler);
}
std::string operator()(nil const& expr) {
handler->error("NIL node should never happen");
return "";
}
};
struct visitor_can_evaluate {
typedef bool result_type;
visitor_can_evaluate() {}
bool operator()(expression_ast const& ast) {
return true;
}
bool operator()(binary_op const& expr) {
return true;
}
bool operator()(unary_op const& expr) {
return true;
}
bool operator()(unary_fun const& expr) {
return true;
}
bool operator()(list_value const& expr) {
return false;
}
bool operator()(string_value const& expr) {
return false;
}
bool operator()(int_value const& expr) {
return false;
}
bool operator()(variable const& expr) {
return false;
}
bool operator()(nil const& expr) {
return false;
}
};
struct visitor_evaluate {
typedef expression_ast result_type;
filter_handler handler;
value_type type;
visitor_evaluate(filter_handler handler, value_type type) : handler(handler), type(type) {}
expression_ast operator()(expression_ast const& ast) {
return ast.evaluate(handler);
}
expression_ast operator()(binary_op const& op) {
return op.evaluate(handler, type);
}
expression_ast operator()(unary_op const& op) {
return op.evaluate(handler);
}
expression_ast operator()(unary_fun const& fun) {
return fun.evaluate(handler, type);
}
expression_ast operator()(list_value const& expr) {
return expression_ast(int_value(FALSE));
}
expression_ast operator()(string_value const& expr) {
return expression_ast(int_value(FALSE));
}
expression_ast operator()(int_value const& expr) {
return expression_ast(int_value(FALSE));
}
expression_ast operator()(variable const& expr) {
return expression_ast(int_value(FALSE));
}
expression_ast operator()(nil const& expr) {
return expression_ast(int_value(FALSE));
}
};
}
} |
4b3eb5fdc909631dcd8ee883a8738a8539c3586c | d7a70833f2d3573d9eab615f69106de75ff644f1 | /CS530-code/code.11.17/scene.cpp | ddc67cc14e00c53734457b7dae50d33dc25a7ea2 | [] | no_license | JingxianFan/InteractiveCG | 8c3ffd01f3ff813a7b133b69df232a13a48d55f9 | 019fcfbe548d937b2b0b7d012270482b33bfc234 | refs/heads/master | 2021-01-21T21:19:35.970790 | 2017-06-19T20:49:42 | 2017-06-19T20:49:42 | 94,819,292 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 16,080 | cpp | scene.cpp | #include "scene.h"
#include "v3.h"
#include "m33.h"
#include <float.h>
#include <iostream>
#include <fstream>
using namespace std;
Scene *scene;
Scene::Scene() {
cgi = 0;
soi = 0;
// create user interface
gui = new GUI();
gui->show();
// create SW framebuffer
int u0 = 20;
int v0 = 50;
int sci = 2;
int w = sci*300;
int h = sci*225;
fb = new FrameBuffer(u0, v0, w, h);
fb->label("SW Framebuffer");
fpfb = new FrameBuffer(u0*2+w, v0, w, h);
fpfb->label("Fixed Pipeline Framebuffer");
fpfb->ishw = true;
gpufb = new FrameBuffer(u0*3+w*2, v0, w, h);
gpufb->label("Progr. Pipeline Framebuffer");
gpufb->isgpu = true;
// create camera
float hfov = 55.0f;
ppc = new PPC(hfov, w, h);
// allocate pointer of TMesh objects
tmsN = 4;
tms = new TMesh*[tmsN];
for (int tmi = 0; tmi < tmsN; tmi++)
tms[tmi] = 0;
tms[0] = new TMesh();
tms[0]->LoadBin("geometry/teapot1K.bin");
tms[0]->enabled = true;
tms[1] = new TMesh();
tms[2] = new TMesh();
tms[3] = new TMesh();
V3 corners[4];
float rw2 = 40.0f, rh2 = 40.0f, nearz = -100.0f, farz = -3000.0f;
// farz = nearz;
corners[0] = V3(-rw2, +rh2, nearz);
corners[1] = V3(-rw2, -rh2, nearz);
corners[2] = V3(+rw2, -rh2, farz);
corners[3] = V3(+rw2, +rh2, farz);
tms[1]->SetAsRectangle(corners);
float eps = 4.0f;
tms[1]->Translate(V3(0.0f, -rh2-eps, 0.0f));
tms[2]->SetAsRectangle(corners);
// tms[2]->Translate(V3(0.0f, +rh2+eps, 0.0f));
FrameBuffer *texture = new FrameBuffer(0, 0, 4*1024, 4*64);
// texture->show();
texture->label("texture");
// texture->SetCheckerboard(2, 0xFF000000, 0XFFAAAAFF);
texture->SetCheckerboard(2, 0xFF000000, 0xFFFFFFFF);
tms[1]->texture = texture;
tms[2]->texture = texture;
corners[0] = V3(-100.0f, 100.0f, -5.0f);
corners[1] = V3(-100.0f, -100.0f, -5.0f);
corners[2] = V3(100.0f, -100.0f, -5.0f);
corners[3] = V3(100.0f, 100.0f, -5.0f);
tms[3]->SetAsRectangle(corners);
tms[3]->texture = texture;
tms[0]->enabled = true;
tms[1]->enabled = false;
tms[2]->enabled = false;
tms[3]->enabled = false;
ppc->C = tms[0]->GetCenter() + V3(0.0f, 0.0f, 110.0f);
fb->show();
fpfb->show();
gpufb->show();
// position UI window
// gui->uiw->position(fb->w+u0 + 2*20, v0);
gui->uiw->position(u0, fb->h+v0+60);
Render(ppc, fb);
}
void Scene::RenderHW(bool isgpu) {
if (isgpu && cgi == NULL) {
cgi = new CGInterface();
cgi->PerSessionInit();
soi = new ShaderOneInterface();
soi->PerSessionInit(cgi);
cerr << "INFO: eye: " << ppc->C << endl;
}
// clear framebuffer
glClearColor(1.0f, 1.0f, 1.0, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// set view intrinsics
float near = 10.0f;
float far = 1000.0f;
ppc->SetIntrinsicsHW(near, far);
// set view extrinsics
ppc->SetExtrinsicsHW();
if (isgpu) {
cgi->EnableProfiles();
soi->PerFrameInit();
soi->BindPrograms();
}
// pass all triangle meshes to HW
for (int tmi = 0; tmi < tmsN; tmi++) {
if (!(tms[tmi] && tms[tmi]->enabled))
continue;
tms[tmi]->RenderHW();
}
if (isgpu) {
soi->PerFrameDisable();
cgi->DisableProfiles();
}
}
void Scene::RenderFB(FrameBuffer *fbToRender, PPC *fbPPC, PPC *currPPC,
FrameBuffer *currFB, float constz) {
for (int v = 0; v < fbToRender->h; v++) {
for (int u = 0; u < fbToRender->w; u++) {
int uv = (fbToRender->h-v-1)*fbToRender->w+u;
if (fbToRender->zb[uv] == 0.0f)
continue;
V3 projP = V3(.5f+(float)u, .5f+(float)v, fbToRender->zb[uv]);
if (constz > 0.0f) {
projP[2] = constz;
}
V3 P = fbPPC->Unproject(projP);
V3 projP2;
if (!currPPC->Project(P, projP2))
continue;
V3 currCol;
currCol.SetFromColor(fbToRender->pix[uv]);
currFB->SetIfCloser(projP2, currCol);
}
}
}
void Scene::Render(PPC *currPPC, FrameBuffer *currFB) {
currFB->Set(0xFFFFFFFF);
currFB->ClearZB(0.0f);
V3 lightPosition;
float ambientk = 0.4f;
for (int tmi = 0; tmi < tmsN; tmi++) {
if (!(tms[tmi] && tms[tmi]->enabled))
continue;
currFB->DrawFilledMode(tms[tmi], tmi, currPPC, lightPosition, ambientk);
}
currFB->redraw();
}
void Scene::SetupStitching() {
int border = 10;
im0 = new FrameBuffer(border, 50, 10, 10);
im0->LoadTiff("mydbg/left.tif");
im0->label("left");
im0->show();
im1 = new FrameBuffer(border*2+im0->w, 50, 10, 10);
im1->LoadTiff("mydbg/center.tif");
im1->label("center");
im1->show();
im2 = new FrameBuffer(border*3+im0->w*2, 50, 10, 10);
im2->LoadTiff("mydbg/right.tif");
im2->label("right");
// im2->show();
// canvas = new FrameBuffer(border, im0->h+100, 800, 450);
canvas = new FrameBuffer(border, 50, 1600, 900);
canvas->label("canvas");
canvas->Set(0xFF000000);
canvas->show();
fb->hide();
gui->uiw->hide();
float hfov = 63.7f;
ppc0 = new PPC(hfov, im0->w, im0->h);
ppc1 = new PPC(hfov, im0->w, im0->h);
ppc2 = new PPC(hfov, im0->w, im0->h);
ppcc = new PPC(110.0f, canvas->w, canvas->h);
}
// function linked to the DBG GUI button for testing new features
void Scene::DBG() {
#if 0
eye = eye / 128.0f;
eye = (eye + float3(1.0f, 1.0f, 1.0f))/2.0f;
#endif
// float colorChannel = 114.0f;
float colorChannel = 154.0f;
// float colorChannel = 254.0f;
float xcoord = (colorChannel / 255.0f) * 2.0f;
xcoord = xcoord - 1.0f;
xcoord = xcoord * 128.0f;
cerr << "INFO: x coord is: " << xcoord << endl;
return;
for (int fi = 0; fi < 100; fi++) {
Render(ppc, fb);
fpfb->redraw();
gpufb->redraw();
ppc->C = ppc->C + V3(0.0f, 1.0f, 1.0f);
V3 center = tms[0]->GetCenter();
ppc->PositionAndOrient(ppc->C, center, V3(0.0f, 1.0f, 0.0f));
Fl::check();
}
return;
{
Render(ppc, fb);
// fb->SetCheckerboard(64, 0xFF000000, 0xFFFFFFFF);
// fb->redraw();
int n = 3;
float **krn = new float*[n];
for (int i = 0; i < n; i++) {
krn[i] = new float[n];
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
krn[i][j] = 1.0f;
}
}
krn[0][0] = 0.0f;
krn[0][1] = -1.0f;
krn[0][2] = 0.0f;
krn[1][0] = -1.0f;
krn[1][1] = 4.0f;
krn[1][2] = -1.0f;
krn[2][0] = 0.0f;
krn[2][1] = -1.0f;
krn[2][2] = 0.0f;
im0 = new FrameBuffer(50, 50, 10, 10);
im0->LoadTiff("mydbg/left.tif");
im0->label("left");
im0->show();
FrameBuffer *cvfb = im0->Convolve(krn, n);
cvfb->label("convolved im0");
cvfb->position(40+im0->w, 50);
cvfb->show();
return;
}
{
ppc->C = ppc->C + V3(0.0f, 0.0f, -10.0f);
int stepsN = 100000;
for (int si = 0; si < stepsN; si++) {
Render(ppc, fb);
ppc->C = ppc->C+V3(0.0f, 0.0f, 0.2f);
Fl::check();
break;
}
return;
}
{
SetupStitching();
V3 *centerCorrs, *leftCorrs;
ifstream ifs("mydbg/corrs.txt");
int corrsN;
ifs >> corrsN;
centerCorrs = new V3[corrsN];
leftCorrs = new V3[corrsN];
unsigned int colors[6] = {0xFF0000FF, 0xFF00FF00, 0xFFFF0000, 0xFF00FFFF,
0xFFFF00FF, 0xFFFFFF00};
for (int ci = 0; ci < corrsN; ci++) {
int u, v;
ifs >> u >> v;
leftCorrs[ci][0] = .5f + (float) u;
leftCorrs[ci][1] = .5f + (float) v;
leftCorrs[ci][2] = 1.0f;
im0->DrawCircle(leftCorrs[ci][0], leftCorrs[ci][1], 7.0f, colors[ci%6]);
ifs >> u >> v;
centerCorrs[ci][0] = .5f + (float) u;
centerCorrs[ci][1] = .5f + (float) v;
centerCorrs[ci][2] = 1.0f;
im1->DrawCircle(centerCorrs[ci][0], centerCorrs[ci][1], 7.0f, colors[ci%6]);
}
cerr << "INFO: done reading " << corrsN << " correspondences" << endl;
ifs.close();
im0->redraw();
im1->redraw();
float minError = FLT_MAX;
float minPan, minTilt, currPan, currTilt, minRoll, currRoll;
float pan0 = 16.0f, pan1 = 22.0f;
float tilt0 = 0.0f, tilt1 = 2.0f;
float roll0 = -3.0f, roll1 = -1.0f;
int panStepsN = 25, tiltStepsN = 5, rollStepsN = 5;
int stepi = 0;
for (int pani = 0; pani < panStepsN; pani++) {
currPan = pan0 + (pan1-pan0) / (float) (panStepsN-1) *(float)pani;
for (int tilti = 0; tilti < tiltStepsN; tilti++) {
currTilt = tilt0 + (tilt1-tilt0) / (float) (tiltStepsN-1) *(float)tilti;
for (int rolli = 0; rolli < rollStepsN; rolli++) {
currRoll = roll0 + (roll1-roll0) / (float) (rollStepsN-1) *(float)rolli;
PPC currppc(*ppc0);
currppc.Pan(currPan);
currppc.Tilt(currTilt);
currppc.Roll(currRoll);
// float currError = im1->DiffAtOverlap(im0, &currppc, ppc1);
float currError = im1->DiffCorrReproj(im0, &currppc, leftCorrs,
centerCorrs, ppc1, corrsN);
if (currError < minError) {
minPan = currPan;
minTilt = currTilt;
minRoll = currRoll;
minError = currError;
cerr << endl;
cerr << "INFO: (pan, tilt, roll), error: ("
<< minPan << ", " << minTilt << ", " << minRoll << "), "
<< sqrtf(minError) << endl;
canvas->Set(0xFF000000);
canvas->SetFromImageWithSameEye(im1, ppc1, ppcc);
canvas->SetFromImageWithSameEye(im0, &currppc, ppcc);
canvas->redraw();
Fl::check();
}
stepi++;
float pp = (float) stepi / (float) (rollStepsN * tiltStepsN * panStepsN);
pp = 0.01f * (float)((int)(pp*10000.0f));
cerr << "PROGRESS: " << pp << "% \r";
}
}
}
cerr << endl << "DONE" << endl;
}
return;
ppc3 = new PPC(*ppc);
ppc3->C = ppc3->C + V3(80.0f, 60.0f, 50.0f);
// ppc3->C = ppc3->C + V3(0.0f, 0.0f, -30.0f);
fb3 = new FrameBuffer(fb->w+20+20, 50, ppc3->w, ppc3->h);
fb3->label("Third person FB");
fb3->Set(0xFF00AAFF);
fb3->show();
// position UI window
gui->uiw->position(fb->w+ 3*20 +fb3->w, 50);
int framesN = 300;
V3 camTransV(0.0f, 150.0f, 0.0f);
for (int fi = 0; fi < framesN; fi++) {
ppc3->PositionAndOrient(ppc3->C, tms[0]->GetCenter(), V3(0.0f, 1.0f, 0.0f));
Render(ppc, fb);
fb3->ClearZB(0.0f);
fb3->Set(0xFFFFFFFF);
RenderFB(fb, ppc, ppc3, fb3);
float visF = 30.0f;
ppc->VisualizeCamera(ppc3, fb3, visF);
RenderFB(fb, ppc, ppc3, fb3, ppc3->GetF() / visF);
fb3->DrawWireFrame(tms[0], ppc3);
fb3->redraw();
Fl::check();
ppc->C = ppc->C + camTransV/(float)framesN;
ppc->PositionAndOrient(ppc->C, tms[0]->GetCenter(), V3(0.0f, 1.0f, 0.0f));
}
return;
Render(ppc, fb);
return;
V3 center = tms[0]->GetCenter();
ppc->C = center + V3(0.0f, 0.0f, 110.0f);
fb->Set(0xFFFFFFFF);
fb->ClearZB(0.0f);
// fb->DrawWireFrame(tms[0], ppc);
V3 lightPosition = ppc->C;
float ambientk = 0.1f;
{
V3 L0 = lightPosition;
V3 L1 = center + V3(0.0f, 100.0f, 0.0f);
for (int i = 0; i < 100; i++) {
lightPosition = L0 + (L1-L0)*(float)i / 99.0f;
fb->Set(0xFFFFFFFF);
fb->ClearZB(0.0f);
fb->DrawFilledMode(tms[0], 0, ppc, lightPosition, ambientk);
fb->redraw();
Fl::check();
}
}
return;
for (int i = 0; i < 100; i++) {
ppc->PositionAndOrient(center+V3(100.0f, 100.0f, -50.0f+(float)i), center,
V3(0.0f, 1.0f, 0.0f));
fb->Set(0xFFFFFFFF);
fb->ClearZB(0.0f);
fb->DrawWireFrame(tms[0], ppc);
fb->redraw();
Fl::check();
}
return;
PPC cam(60.0f, fb->w, fb->h);
cam.Translate(V3(0.0f, 0.0f, -100.0f));
for (int i = 0; i < 361; i++) {
fb->ClearZB(0.0f);
fb->Set(0xFFFFFFFF);
cam.VisualizeCamera(ppc, fb, 40.0f);
fb->redraw();
Fl::check();
cam.Pan(1.0f);
}
return;
int stepsN = 361;
float theta = 1.0f;
V3 aDir(1.0f, 1.0f, 0.0f);
aDir = aDir.UnitVector();
for (int si = 0; si < stepsN; si++) {
fb->Set(0xFFFFFFFF);
fb->ClearZB(0.0f);
fb->DrawWireFrame(tms[0], ppc);
fb->redraw();
Fl::check();
tms[0]->RotateAboutAxis(center, aDir, theta);
}
return;
int dotSize = 3;
// fb->DrawVertexDots(tms[0], dotSize, ppc);
V3 projCenter;
ppc->Project(center, projCenter);
fb->DrawCircle(projCenter[0], projCenter[1], 7, 0xFF0000FF);
AABB aabb = tms[0]->ComputeAABB();
fb->DrawAABB(aabb, 0xFF00FF00, 0xFF000000, ppc);
fb->redraw();
return;
V3 verts[4], colors[4];
verts[0] = V3(0.0f, 35.0f, -100.0f);
colors[0] = V3(0.0f, 0.0f, 0.0f);
verts[1] = V3(-20.0f, -15.0f, -100.0f);
colors[1] = V3(1.0f, 0.0f, 0.0f);
verts[2] = V3(7.0f, -15.0f, -50.0f);
colors[2] = V3(0.0f, 1.0f, 0.0f);
verts[3] = V3(40.0f, -15.0f, -130.0f);
colors[3] = V3(0.0f, 0.0f, 1.0f);
tms[0] = new TMesh(verts, colors);
fb->Set(0xFFFFFFFF);
fb->DrawWireFrame(tms[0], ppc);
fb->redraw();
return;
float hfov = 55.0f;
ppc = new PPC(hfov, fb->w, fb->h);
V3 P, projP;
P = V3(0.0f, 0.0f, -100.0f); // point along -z axis
P = ppc->C + ppc->c; // top left image corner
P = ppc->C + ppc->c + ppc->a*ppc->w + ppc->b*ppc->h; // top left image corner
bool projResult = ppc->Project(P, projP);
cerr << projP << endl;
V3 L0(-40.0f, 0.0f, -400.0f);
V3 L1(+40.0f, 0.0f, -100.0f);
V3 color0(1.0f, 0.0f, 0.0f);
V3 color1(0.0f, 1.0f, 0.0f);
int n = 100;
fb->Set(0xFFFFFFFF);
for (int i = 0; i < n; i++) {
float fraction = (float) i / (float) (n-1);
V3 P = L0 + (L1-L0)*fraction;
V3 color = color0 + (color1 - color0)*fraction;
ppc->Project(P, projP);
fb->DrawCircle(projP[0], projP[1], 5.0f, color.GetColor());
fb->redraw();
Fl::check();
}
return;
fb->Set(0xFFFFFFFF);
float cuf = 135.3f;
float cvf = 81.9f;
float radius = 51.0f;
unsigned int color = 0xFF0000FF;
fb->DrawCircle(cuf, cvf, radius, color);
fb->redraw();
float step = 1.0f;
for (int stepsi = 0; stepsi < 100; stepsi++) {
cuf += step;
cvf += step;
cvf += step;
fb->Set(0xFFFFFFFF);
fb->DrawCircle(cuf, cvf, radius, color);
fb->redraw();
Fl::check();
}
return;
V3 v0(1.0f, 0.0f, -4.0f);
V3 v1(2.0f, 1.0f, 0.0f);
V3 v2(-1.0f, 2.0f, -1.0f);
M33 m;
m[0] = v0;
m[1] = v1;
m[2] = v2;
M33 mi = m.Inverted();
cerr << mi << endl;
return;
V3 v;
unsigned int colorui;
v.SetFromColor(0xFF0000FF);
colorui = v.GetColor();
v.SetFromColor(0xFF00FF00);
colorui = v.GetColor();
v.SetFromColor(0xFFFF0000);
colorui = v.GetColor();
v.SetFromColor(0xFF00FFFF);
colorui = v.GetColor();
v.SetFromColor(0xFF000088);
colorui = v.GetColor();
m[0] = V3(1.0f, 0.0f, 0.0f);
m[1] = V3(0.0f, 1.0f, 0.0f);
m[2] = V3(0.0f, 0.0f, 1.0f);
v1 = m * v0;
cerr << "Matrix: " << endl;
cerr << m;
return;
float v0v1 = v0*v1;
cerr << v0v1 << endl;
return;
fb->SetCheckerboard(40, 0xFFAAAAAA, 0xFFFFFFFF);
fb->redraw();
return;
fb->Set(0xFFFFFFFF);
int u = fb->w/2;
color = 0xFF000000;
for (int v = 0; v < fb->h; v++) {
fb->Set(u, v, color);
}
fb->redraw();
return;
color = 0xFF00FFFF;
((unsigned char*)(&color))[1] = 0x80;
unsigned char red = ((unsigned char*)(&color))[0];
unsigned char green = ((unsigned char*)(&color))[1];
unsigned char blue = ((unsigned char*)(&color))[2];
cerr << "red: " << (int) red << "; green: " << (int) green << "; blue: " << (int) blue << endl;
fb->Set(color);
fb->redraw();
}
void Scene::NewB() {
cerr << "NewB pressed" << endl;
}
|
5fd6371879d04fe7ce397c885d519f86a1a909c4 | 7956e0f2e31958426d89896ac67b6e17ab5f7c99 | /kerucut berputar/kerucut berputar/main.cpp | 551e540b3fbb5b498ffe7c1e0e7a33ac05dca97c | [] | no_license | pringgojs/pengolahan-citra | 55f4452cf8e697559f149ad24efe2777ee57cf7f | b9098c3fcc51d5435b581103fe501d1c03c9bfe8 | refs/heads/master | 2022-12-19T04:58:47.064559 | 2020-10-01T23:07:13 | 2020-10-01T23:07:13 | 300,447,206 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,638 | cpp | main.cpp | //
// main.cpp
// kerucut berputar
//
// Created by Pringgo Juni Saputro on 24/11/18.
// Copyright ยฉ 2018 Pringgo Juni Saputro. All rights reserved.
//
#include <iostream>
#include <OpenGL/gl.h>
#include <OpenGl/glu.h>
#include <GLUT/glut.h>
#include <stdio.h>
#include <math.h>
void init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel (GL_FLAT);
}
void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);
glColor3f (0.4, 0.3, 1.0);
glLoadIdentity (); /* clear the matrix */
/* viewing transformation */
gluLookAt (0.0, -8.0, 3.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0);
glScalef (4.0, 4.0, 1.5); /* modeling transformation */
glutWireCone(0.5, 3.0, 50,1);
/** Function glutWireCone
glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
base: The radius of the base of the cone.
height: The height of the cone.
slices: The number of subdivisions around the Z axis.
stacks: The number of subdivisions along the Z axis.
**/
glFlush ();
}
void reshape (int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
glFrustum (-1.0, 1.0, -1.0, 1.0, 1.5, 20.0);
glMatrixMode (GL_MODELVIEW);
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize (500, 500);
glutInitWindowPosition (100, 100);
glutCreateWindow("Pringgo JS | Kerucut");
init ();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutMainLoop();
return 0;
}
|
6c7dbfbd5f1f78b6473058c4a35debb5f6214b99 | 8ed4a8b18aa5f70cc2067f966e9f418a6d3d6c78 | /behavioral/global_command_trigger_factory.hpp | 8536c6dabeb048a380c08a7cfb73c7f118200114 | [] | no_license | SiChiTong/behaviouralPlanner | c269bc6fd8233141720b29e9534fd788e3161256 | 4ce317cfa1ee636af53465ca20e6ca37539736b4 | refs/heads/main | 2023-03-19T09:49:38.978964 | 2020-10-13T01:05:53 | 2020-10-13T01:05:53 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 474 | hpp | global_command_trigger_factory.hpp | #pragma once
#include "abstract_trigger_factory.hpp"
#include "global_command_state.hpp"
#include "global_command_trigger.hpp"
namespace path_planning { namespace behavioral {
class GlobalCommandTriggerFactory : public AbstractTriggerFactory<GlobalCommandTrigger, GlobalCommandState, GlobalCommandTriggerID> {
private:
std::shared_ptr<GlobalCommandTrigger> enumToType(GlobalCommandTriggerID id, GlobalCommandState state) const override;
};
}} |
3baddc0cfe748db4bdaf80c51541b1570d4d8ddd | 88ae8695987ada722184307301e221e1ba3cc2fa | /third_party/pdfium/core/fpdfapi/page/cpdf_transparency.cpp | 811160dd41cf7a8da8bd535716c9a826e340333f | [
"Apache-2.0",
"LGPL-2.0-or-later",
"MIT",
"GPL-1.0-or-later",
"BSD-3-Clause"
] | permissive | iridium-browser/iridium-browser | 71d9c5ff76e014e6900b825f67389ab0ccd01329 | 5ee297f53dc7f8e70183031cff62f37b0f19d25f | refs/heads/master | 2023-08-03T16:44:16.844552 | 2023-07-20T15:17:00 | 2023-07-23T16:09:30 | 220,016,632 | 341 | 40 | BSD-3-Clause | 2021-08-13T13:54:45 | 2019-11-06T14:32:31 | null | UTF-8 | C++ | false | false | 420 | cpp | cpdf_transparency.cpp | // Copyright 2018 The PDFium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "core/fpdfapi/page/cpdf_transparency.h"
CPDF_Transparency::CPDF_Transparency() = default;
CPDF_Transparency::CPDF_Transparency(const CPDF_Transparency& other) = default;
CPDF_Transparency& CPDF_Transparency::operator=(
const CPDF_Transparency& other) = default;
|
8cf632bba2f0ae0b65a3924839b76dbe9796793f | 82dc3cc4c97c05e384812cc9aa07938e2dbfe24b | /tahoe/src-mirror/primitives/globalmatrix/aztec/AztecMatrixT.cpp | 85dcbbc154e02ec5d6f60b43c9784a5ade4a1e93 | [
"BSD-3-Clause"
] | permissive | samanseifi/Tahoe | ab40da0f8d952491943924034fa73ee5ecb2fecd | 542de50ba43645f19ce4b106ac8118c4333a3f25 | refs/heads/master | 2020-04-05T20:24:36.487197 | 2017-12-02T17:09:11 | 2017-12-02T17:24:23 | 38,074,546 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 74 | cpp | AztecMatrixT.cpp | /home/saman/Tahoe/tahoe/src/primitives/globalmatrix/aztec/AztecMatrixT.cpp |
73a09709e20c4af6b5ed482b5b7d8e7852d2557a | 1673981f50c4594ec9c17285d9b4cf1e31585b8c | /HackerEarth - August Circuits '20/Anti-palindrome strings/sol.cpp | 588e80bac23c5a8d957fa055506e3b773fc92d53 | [] | no_license | Aman2241/Coding-Solutions | d1b2dcb923941fa4167f8f1b8839a9c46c38bd2d | 53fdb1be86c46d4eeac5953da852275826c56cf0 | refs/heads/master | 2022-12-14T10:57:32.992554 | 2020-09-12T17:52:23 | 2020-09-12T17:52:23 | 288,506,665 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,201 | cpp | sol.cpp | #include<bits/stdc++.h>
using namespace std;
typedef vector <int> vi;
typedef pair< int ,int > pii;
#define endl "\n"
#define sd(val) scanf("%d",&val)
#define ss(val) scanf("%s",&val)
#define sl(val) scanf("%lld",&val)
#define debug(val) printf("check%d\n",val)
#define all(v) v.begin(),v.end()
#define PB push_back
#define MP make_pair
#define FF first
#define arr_ip for(int i=0;i<n;i++){cin>>a[i]}
#define arr_op for(int i=0;i<n;i++) {cout<<a[i]}
#define SS second
#define ll long long int
#define MOD 1000000007
#define clr(val) memset(val,0,sizeof(val))
#define what_is(x) cerr << #x << " is " << x << endl;
#define OJ \
freopen("input.txt", "r", stdin); \
freopen("output.txt", "w", stdout);
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main()
{
int t;
cin>>t;
while (t--)
{
/* code */
string s;
cin>>s;
set<char>s1;
for(int i=0;i<s.size();i++)
{
s1.insert(s[i]);
}
if(s1.size()==1)
{
cout<<-1<<endl;
}
else
{
sort(s.begin(),s.end());
cout<<s<<endl;
}
}
return 0;
} |
d17fec21be48ea589f9f5fd6ce52dbdbd0ba36b8 | 234efff5291e2ab5e87ef71eb8ad80ec3b1854a2 | /TestingHexThrombus/processor15/constant/polyMesh/faceProcAddressing | 6ba47749c991c590845b770e1b436284ce316196 | [] | no_license | tomwpeach/thrombus-code | 5c6f86f0436177d9bbacae70d43f645d70be1a97 | 8cd3182c333452543f3feaecde08282bebdc00ed | refs/heads/master | 2021-05-01T12:25:22.036621 | 2018-04-10T21:45:28 | 2018-04-10T21:45:28 | 121,060,409 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 248,710 | faceProcAddressing | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.1 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class labelList;
location "constant/polyMesh";
object faceProcAddressing;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35200
(
363723
363724
363725
363734
363735
363736
453973
453974
453975
453976
453977
453978
453979
453980
453981
453982
453983
453984
453985
453986
453987
453988
453989
453990
453991
453992
453993
453994
453995
453996
453997
453998
453999
454000
454001
454002
454003
454004
454005
454006
454007
454008
454009
454010
454011
454012
454013
454014
454015
454016
454017
454018
454019
454020
454021
454022
454023
454024
454025
454026
454027
454028
454029
454030
454031
454032
454033
454034
454035
454036
454037
454038
454039
454040
454041
454042
454043
454044
454045
454046
454047
454048
454049
454050
454051
454052
454053
454054
454055
454056
454057
454058
454059
454060
454061
454062
454063
454064
454065
454066
454067
454068
454069
454070
454071
454072
454073
454074
454075
454076
454077
454078
454079
454080
454081
454082
454083
454084
454085
454086
454087
454088
454089
454090
454091
454092
454093
454094
454095
454096
454097
454098
454099
454100
454101
454102
454103
454104
454105
454106
454107
454108
454109
454110
454111
454112
454113
454114
454115
454116
454117
454118
454119
454120
454121
454122
454123
454124
454125
454126
454127
454128
454129
454130
454131
454132
454133
454134
454135
454136
454137
454138
454139
454140
454141
454142
454143
454144
454145
454146
454147
454148
454149
454150
454151
454152
454153
454154
454155
454156
454157
454158
454159
454160
454161
454162
454163
454164
454165
454166
454167
454168
454169
454170
454171
454172
454173
454174
454175
454176
454177
454178
454179
454180
454181
454182
454183
454184
454185
454186
454187
454188
454189
454190
454191
454192
454193
454194
454195
454196
454197
454198
454199
454200
454201
454202
454203
454204
454205
454206
454207
454208
454209
454210
454211
454212
454213
454214
454215
454216
454217
454218
454219
454220
454221
454222
454223
454224
454225
454226
454227
454228
454229
454230
454231
454232
454233
454234
454235
454236
454237
454238
454239
454240
454241
454242
454243
454244
454245
454246
454247
454248
454249
454250
454251
454252
454253
454254
454255
454256
454257
454258
454259
454260
454261
454262
454263
454264
454265
454266
454267
454268
454269
454270
454271
454272
454273
454274
454275
454276
454277
454278
454279
454280
454281
454282
454283
454284
454285
454286
454287
454288
454289
454290
454291
454292
454293
454294
454295
454296
454297
454298
454299
454300
454301
454302
454303
454304
454305
454306
454307
454308
454309
454310
454311
454312
454313
454314
454315
454316
454317
454318
454319
454320
454321
454322
454323
454324
454325
454326
454327
454328
454329
454330
454331
454332
454333
454334
454335
454336
454337
454338
454339
454340
454341
454342
454343
454344
454345
454346
454347
454348
454349
454350
454351
454352
454353
454354
454355
454356
454357
454358
454359
454360
454361
454362
454363
454364
454365
454366
454367
454368
454369
454370
454371
454372
454373
454374
454375
454376
454377
454378
454379
454380
454381
454382
454383
454384
454385
454386
454387
454388
454389
454390
454391
454392
454393
454394
454395
454396
454397
454398
454399
454400
454401
454402
454403
454404
454405
454406
454407
454408
454409
454410
454411
454412
454413
454414
454415
454416
454417
454418
454419
454420
454421
454422
454423
454424
454425
454426
454427
454428
454429
454430
454431
454432
454433
454434
454435
454436
454437
454438
454439
454440
454441
454442
454443
454444
454445
454446
454447
454448
454449
454450
454451
454452
454453
454454
454455
454456
454457
454458
454459
454460
454461
454462
454463
454464
454465
454466
454467
454468
454469
454470
454471
454472
454473
454474
454475
454476
454477
454478
454479
454480
454481
454482
454483
454484
454485
454486
454487
454488
454489
454490
454491
454492
454493
454494
454495
454496
454497
454498
454499
454500
454501
454502
454503
454504
454505
454506
454507
454508
454509
454510
454511
454512
454513
454514
454515
454516
454517
454518
454519
454520
454521
454522
454523
454524
454525
454526
454527
454528
454529
454530
454531
454532
454533
454534
454535
454536
454537
454538
454539
454540
454541
454542
454543
454544
454545
454546
454547
454548
454549
454550
454551
454552
454553
454554
454555
454556
454557
454558
454559
454560
454561
454562
454563
454564
454565
454566
454567
454568
454569
454570
454571
454572
454573
454574
454575
454576
454577
454578
454579
454580
454581
454582
454583
454584
454585
454586
454587
454588
454589
454590
454591
454592
454593
454594
454595
454596
454597
454598
454599
454600
454601
454602
454603
454604
454605
454606
454607
454608
454609
454610
454611
454612
454613
454614
454615
454616
454617
454618
454619
454620
454621
454622
454623
454624
454625
454626
454627
454628
454629
454630
454631
454632
454633
454634
454635
454636
454637
454638
454639
454640
454641
454642
454643
454644
454645
454646
454647
454648
454649
454650
454651
454652
454653
454654
454655
454656
454657
454658
454659
454660
454661
454662
454663
454664
454665
454666
454667
454668
454669
454670
454671
454672
454673
454674
454675
454676
454677
454678
454679
454680
454681
454682
454683
454684
454685
454686
454687
454688
454689
454690
454691
454692
454693
454694
454695
454696
454697
454698
454699
454700
454701
454702
454703
454704
454705
454706
454707
454708
454709
454710
454711
454712
454713
454714
454715
454716
454717
454718
454719
454720
454721
454722
454723
454724
454725
454726
454727
454728
454729
454730
454731
454732
454733
454734
454735
454736
454737
454738
454739
454740
454741
454742
454743
454744
454745
454746
454747
454748
454749
454750
454751
454752
454753
454754
454755
454756
454757
454758
454759
454760
454761
454762
454763
454764
454765
454766
454767
454768
454769
454770
454771
454772
454773
454774
454775
454776
454777
454778
454779
454780
454781
454782
454783
454784
454785
454786
454787
454788
454789
454790
454791
454792
454793
454794
454795
454796
454797
454798
454799
454800
454801
454802
454803
454804
454805
454806
454807
454808
454809
454810
454811
454812
454813
454814
454815
454816
454817
454818
454819
454820
454821
454822
454823
454824
454825
454826
454827
454828
454829
454830
454831
454832
454833
454834
454835
454836
454837
454838
454839
454840
454841
454842
454843
454844
454845
454846
454847
454848
454849
454850
454851
454852
454853
454854
454855
454856
454857
454858
454859
454860
454861
454862
454863
454864
454865
454866
454867
454868
454869
454870
454871
454872
454873
454874
454875
454876
454877
454878
454879
454880
454881
454882
454883
454884
454885
454886
454887
454888
454889
454890
454891
454892
454893
454894
454895
454896
454897
454898
454899
454900
454901
454902
454903
454904
454905
454906
454907
454908
454909
454910
454911
454912
454913
454914
454915
454916
454917
454918
454919
454920
454921
454922
454923
454924
454925
454926
454927
454928
454929
454930
454931
454932
454933
454934
454935
454936
454937
454938
454939
454940
454941
454942
454943
454944
454945
454946
454947
454948
454949
454950
454951
454952
454953
454954
454955
454956
454957
454958
454959
454960
454961
454962
454963
454964
454965
454966
454967
454968
454969
454970
454971
454972
454973
454974
454975
454976
454977
454978
454979
454980
454981
454982
454983
454984
454985
454986
454987
454988
454989
454990
454991
454992
454993
454994
454995
454996
454997
454998
454999
455000
455001
455002
455003
455004
455005
455006
455007
455008
455009
455010
455011
455012
455013
455014
455015
455016
455017
455018
455019
455020
455021
455022
455023
455024
455025
455026
455027
455028
455029
455030
455031
455032
455033
455034
455035
455036
455037
455038
455039
455040
455041
455042
455043
455044
455045
455046
455047
455048
455049
455050
455051
455052
455053
455054
455055
455056
455057
455058
455059
455060
455061
455062
455063
455064
455065
455066
455067
455068
455069
455070
455071
455072
455073
455074
455075
455076
455077
455078
455079
455080
455081
455082
455083
455084
455085
455086
455087
455088
455089
455090
455091
455092
455093
455094
455095
455096
455097
455098
455099
455100
455101
455102
455103
455104
455105
455106
455107
455108
455109
455110
455111
455112
455113
455114
455115
455116
455117
455118
455119
455120
455121
455122
455123
455124
455125
455126
455127
455128
455129
455130
455131
455132
455133
455134
455135
455136
455137
455138
455139
455140
455141
455142
455143
455144
455145
455146
455147
455148
455149
455150
455151
455152
455153
455154
455155
455156
455157
455158
455159
455160
455161
455162
455163
455164
455165
455166
455167
455168
455169
455170
455171
455172
455173
455174
455175
455176
455177
455178
455179
455180
455181
455182
455183
455184
455185
455186
455187
455188
455189
455190
455191
455192
455193
455194
455195
455196
455197
455198
455199
455200
455201
455202
455203
455204
455205
455206
455207
455208
455209
455210
455211
455212
455213
455214
455215
455216
455217
455218
455219
455220
455221
455222
455223
455224
455225
455226
455227
455228
455229
455230
455231
455232
455233
455234
455235
455236
455237
455238
455239
455240
455241
455242
455243
455244
455245
455246
455247
455248
455249
455250
455251
455252
455253
455254
455255
455256
455257
455258
455259
455260
455261
455262
455263
455264
455265
455266
455267
455268
455269
455270
455271
455272
455273
455274
455275
455276
455277
455278
455279
455280
455281
455282
455283
455284
455285
455286
455287
455288
455289
455290
455291
455292
455293
455294
455295
455296
455297
455298
455299
455300
455301
455302
455303
455304
455305
455306
455307
455308
455309
455310
455311
455312
455313
455314
455315
455316
455317
455318
455319
455320
455321
455322
455323
455324
455325
455326
455327
455328
455329
455330
455331
455332
455333
455334
455335
455336
455337
455338
455339
455340
455341
455342
455343
455344
455345
455346
455347
455348
455349
455350
455351
455352
455353
455354
455355
455356
455357
455358
455359
455360
455361
455362
455363
455364
455365
455366
455367
455368
455369
455370
455371
455372
455373
455374
455375
455376
455377
455378
455379
455380
455381
455382
455383
455384
455385
455386
455387
455388
455389
455390
455391
455392
455393
455394
455395
455396
455397
455398
455399
455400
455401
455402
455403
455404
455405
455406
455407
455408
455409
455410
455411
455412
455413
455414
455415
455416
455417
455418
455419
455420
455421
455422
455423
455424
455425
455426
455427
455428
455429
455430
455431
455432
455433
455434
455435
455436
455437
455438
455439
455440
455441
455442
455443
455444
455445
455446
455447
455448
455449
455450
455451
455452
455453
455454
455455
455456
455457
455458
455459
455460
455461
455462
455463
455464
455465
455466
455467
455468
455469
455470
455471
455472
455473
455474
455475
455476
455477
455478
455479
455480
455481
455482
455483
455484
455485
455486
455487
455488
455489
455490
455491
455492
455493
455494
455495
455496
455497
455498
455499
455500
455501
455502
455503
455504
455505
455506
455507
455508
455509
455510
455511
455512
455513
455514
455515
455516
455517
455518
455519
455520
455521
455522
455523
455524
455525
455526
455527
455528
455529
455530
455531
455532
455533
455534
455535
455536
455537
455538
455539
455540
455541
455542
455543
455544
455545
455546
455547
455548
455549
455550
455551
455552
455553
455554
455555
455556
455557
455558
455559
455560
455561
455562
455563
455564
455565
455566
455567
455568
455569
455570
455571
455572
455573
455574
455575
455576
455577
455578
455579
455580
455581
455582
455583
455584
455585
455586
455587
455588
455589
455590
455591
455592
455593
455594
455595
455596
455597
455598
455599
455600
455601
455602
455603
455604
455605
455606
455607
455608
455609
455610
455611
455612
455613
455614
455615
455616
455617
455618
455619
455620
455621
455622
455623
455624
455625
455626
455627
455628
455629
455630
455631
455632
455633
455634
455635
455636
455637
455638
455639
455640
455641
455642
455643
455644
455645
455646
455647
455648
455649
455650
455651
455652
455653
455654
455655
455656
455657
455658
455659
455660
455661
455662
455663
455664
455665
455666
455667
455668
455669
455670
455671
455672
455673
455674
455675
455676
455677
455678
455679
455680
455681
455682
455683
455684
455685
455686
455687
455688
455689
455690
455691
455692
455693
455694
455695
455696
455697
455698
455699
455700
455701
455702
455703
455704
455705
455706
455707
455708
455709
455710
455711
455712
455713
455714
455715
455716
455717
455718
455719
455720
455721
455722
455723
455724
455725
455726
455727
455728
455729
455730
455731
455732
455733
455734
455735
455736
455737
455738
455739
455740
455741
455742
455743
455744
455745
455746
455747
455748
455749
455750
455751
455752
455753
455754
455755
455756
455757
455758
455759
455760
455761
455762
455763
455764
455765
455766
455767
455768
455769
455770
455771
455772
455773
455774
455775
455776
455777
455778
455779
455780
455781
455782
455783
455784
455785
455786
455787
455788
455789
455790
455791
455792
455793
455794
455795
455796
455797
455798
455799
455800
455801
455802
455803
455804
455805
455806
455807
455808
455809
455810
455811
455812
455813
455814
455815
455816
455817
455818
455819
455820
455821
455822
455823
455824
455825
455826
455827
455828
455829
455830
455831
455832
455833
455834
455835
455836
455837
455838
455839
455840
455841
455842
455843
455844
455845
455846
455847
455848
455849
455850
455851
455852
455853
455854
455855
455856
455857
455858
455859
455860
455861
455862
455863
455864
455865
455866
455867
455868
455869
455870
455871
455872
455873
455874
455875
455876
455877
455878
455879
455880
455881
455882
455883
455884
455885
455886
455887
455888
455889
455890
455891
455892
455893
455894
455895
455896
455897
455898
455899
455900
455901
455902
455903
455904
455905
455906
455907
455908
455909
455910
455911
455912
455913
455914
455915
455916
455917
455918
455919
455920
455921
455922
455923
455924
455925
455926
455927
455928
455929
455930
455931
455932
455933
455934
455935
455936
455937
455938
455939
455940
455941
455942
455943
455944
455945
455946
455947
455948
455949
455950
455951
455952
455953
455954
455955
455956
455957
455958
455959
455960
455961
455962
455963
455964
455965
455966
455967
455968
455969
455970
455971
455972
455973
455974
455975
455976
455977
455978
455979
455980
455981
455982
455983
455984
455985
455986
455987
455988
455989
455990
455991
455992
455993
455994
455995
455996
455997
455998
455999
456000
456001
456002
456003
456004
456005
456006
456007
456008
456009
456010
456011
456012
456013
456014
456015
456016
456017
456018
456019
456020
456021
456022
456023
456024
456025
456026
456027
456028
456029
456030
456031
456032
456033
456034
456035
456036
456037
456038
456039
456040
456041
456042
456043
456044
456045
456046
456047
456048
456049
456050
456051
456052
456053
456054
456055
456056
456057
456058
456059
456060
456061
456062
456063
456064
456065
456066
456067
456068
456069
456070
456071
456072
456073
456074
456075
456076
456077
456078
456079
456080
456081
456082
456083
456084
456085
456086
456087
456088
456089
456090
456091
456092
456093
456094
456095
456096
456097
456098
456099
456100
456101
456102
456103
456104
456105
456106
456107
456108
456109
456110
456111
456112
456113
456114
456115
456116
456117
456118
456119
456120
456121
456122
456123
456124
456125
456126
456127
456128
456129
456130
456131
456132
456133
456134
456135
456136
456137
456138
456139
456140
456141
456142
456143
456144
456145
456146
456147
456148
456149
456150
456151
456152
456153
456154
456155
456156
456157
456158
456159
456160
456161
456162
456163
456164
456165
456166
456167
456168
456169
456170
456171
456172
456173
456174
456175
456176
456177
456178
456179
456180
456181
456182
456183
456184
456185
456186
456187
456188
456189
456190
456191
456192
456193
456194
456195
456196
456197
456198
456199
456200
456201
456202
456203
456204
456205
456206
456207
456208
456209
456210
456211
456212
456213
456214
456215
456216
456217
456218
456219
456220
456221
456222
456223
456224
456225
456226
456227
456228
456229
456230
456231
456232
456233
456234
456235
456236
456237
456238
456239
456240
456241
456242
456243
456244
456245
456246
456247
456248
456249
456250
456251
456252
456253
456254
456255
456256
456257
456258
456259
456260
456261
456262
456263
456264
456265
456266
456267
456268
456269
456270
456271
456272
456273
456274
456275
456276
456277
456278
456279
456280
456281
456282
456283
456284
456285
456286
456287
456288
456289
456290
456291
456292
456293
456294
456295
456296
456297
456298
456299
456300
456301
456302
456303
456304
456305
456306
456307
456308
456309
456310
456311
456312
456313
456314
456315
456316
456317
456318
456319
456320
456321
456322
456323
456324
456325
456326
456327
456328
456329
456330
456331
456332
456333
456334
456335
456336
456337
456338
456339
456340
456341
456342
456343
456344
456345
456346
456347
456348
456349
456350
456351
456352
456353
456354
456355
456356
456357
456358
456359
456360
456361
456362
456363
456364
456365
456366
456367
456368
456369
456370
456371
456372
456373
456374
456375
456376
456377
456378
456379
456380
456381
456382
456383
456384
456385
456386
456387
456388
456389
456390
456391
456392
456393
456394
456395
456396
456397
456398
456399
456400
456401
456402
456403
456404
456405
456406
456407
456408
456409
456410
456411
456412
456413
456414
456415
456416
456417
456418
456419
456420
456421
456422
456423
456424
456425
456426
456427
456428
456429
456430
456431
456432
456433
456434
456435
456436
456437
456438
456439
456440
456441
456442
456443
456444
456445
456446
456447
456448
456449
456450
456451
456452
456453
456454
456455
456456
456457
456458
456459
456460
456461
456462
456463
456464
456465
456466
456467
456468
456469
456470
456471
456472
456473
456474
456475
456476
456477
456478
456479
456480
456481
456482
456483
456484
456485
456486
456487
456488
456489
456490
456491
456492
456493
456494
456495
456496
456497
456498
456499
456500
456501
456502
456503
456504
456505
456506
456507
456508
456509
456510
456511
456512
456513
456514
456515
456516
456517
456518
456519
456520
456521
456522
456523
456524
456525
456526
456527
456528
456529
456530
456531
456532
456533
456534
456535
456536
456537
456538
456539
456540
456541
456542
456543
456544
456545
456546
456547
456548
456549
456550
456551
456552
456553
456554
456555
456556
456557
456558
456559
456560
456561
456562
456563
456564
456565
456566
456567
456568
456569
456570
456571
456572
456573
456574
456575
456576
456577
456578
456579
456580
456581
456582
456583
456584
456585
456586
456587
456588
456589
456590
456591
456592
456593
456594
456595
456596
456597
456598
456599
456600
456601
456602
456603
456604
456605
456606
456607
456608
456609
456610
456611
456612
456613
456614
456615
456616
456617
456618
456619
456620
456621
456622
456623
456624
456625
456626
456627
456628
456629
456630
456631
456632
456633
456634
456635
456636
456637
456638
456639
456640
456641
456642
456643
456644
456645
456646
456647
456648
456649
456650
456651
456652
456653
456654
456655
456656
456657
456658
456659
456660
456661
456662
456663
456664
456665
456666
456667
456668
456669
456670
456671
456672
456673
456674
456675
456676
456677
456678
456679
456680
456681
456682
456683
456684
456685
456686
456687
456688
456689
456690
456691
456692
456693
456694
456695
456696
456697
456698
456699
456700
456701
456702
456703
456704
456705
456706
456707
456708
456709
456710
456711
456712
456713
456714
456715
456716
456717
456718
456719
456720
456721
456722
456723
456724
456725
456726
456727
456728
456729
456730
456731
456732
456733
456734
456735
456736
456737
456738
456739
456740
456741
456742
456743
456744
456745
456746
456747
456748
456749
456750
456751
456752
456753
456754
456755
456756
456757
456758
456759
456760
456761
456762
456763
456764
456765
456766
456767
456768
456769
456770
456771
456772
456773
456774
456775
456776
456777
456778
456779
456780
456781
456782
456783
456784
456785
456786
456787
456788
456789
456790
456791
456792
456793
456794
456795
456796
456797
456798
456799
456800
456801
456802
456803
456804
456805
456806
456807
456808
456809
456810
456811
456812
456813
456814
456815
456816
456817
456818
456819
456820
456821
456822
456823
456824
456825
456826
456827
456828
456829
456830
456831
456832
456833
456834
456835
456836
456837
456838
456839
456840
456841
456842
456843
456844
456845
456846
456847
456848
456849
456850
456851
456852
456853
456854
456855
456856
456857
456858
456859
456860
456861
456862
456863
456864
456865
456866
456867
456868
456869
456870
456871
456872
456873
456874
456875
456876
456877
456878
456879
456880
456881
456882
456883
456884
456885
456886
456887
456888
456889
456890
456891
456892
456893
456894
456895
456896
456897
456898
456899
456900
456901
456902
456903
456904
456905
456906
456907
456908
456909
456910
456911
456912
456913
456914
456915
456916
456917
456918
456919
456920
456921
456922
456923
456924
456925
456926
456927
456928
456929
456930
456931
456932
456933
456934
456935
456936
456937
456938
456939
456940
456941
456942
456943
456944
456945
456946
456947
456948
456949
456950
456951
456952
456953
456954
456955
456956
456957
456958
456959
456960
456961
456962
456963
456964
456965
456966
456967
456968
456969
456970
456971
456972
456973
456974
456975
456976
456977
456978
456979
456980
456981
456982
456983
456984
456985
456986
456987
456988
456989
456990
456991
456992
456993
456994
456995
456996
456997
456998
456999
457000
457001
457002
457003
457004
457005
457006
457007
457008
457009
457010
457011
457012
457013
457014
457015
457016
457017
457018
457019
457020
457021
457022
457023
457024
457025
457026
457027
457028
457029
457030
457031
457032
457033
457034
457035
457036
457037
457038
457039
457040
457041
457042
457043
457044
457045
457046
457047
457048
457049
457050
457051
457052
457053
457054
457055
457056
457057
457058
457059
457060
457061
457062
457063
457064
457065
457066
457067
457068
457069
457070
457071
457072
457073
457074
457075
457076
457077
457078
457079
457080
457081
457082
457083
457084
457085
457086
457087
457088
457089
457090
457091
457092
457093
457094
457095
457096
457097
457098
457099
457100
457101
457102
457103
457104
457105
457106
457107
457108
457109
457110
457111
457112
457113
457114
457115
457116
457117
457118
457119
457120
457121
457122
457123
457124
457125
457126
457127
457128
457129
457130
457131
457132
457133
457134
457135
457136
457137
457138
457139
457140
457141
457142
457143
457144
457145
457146
457147
457148
457149
457150
457151
457152
457153
457154
457155
457156
457157
457158
457159
457160
457161
457162
457163
457164
457165
457166
457167
457168
457169
457170
457171
457172
457173
457174
457175
457176
457177
457178
457179
457180
457181
457182
457183
457184
457185
457186
457187
457188
457189
457190
457191
457192
457193
457194
457195
457196
457197
457198
457199
457200
457201
457202
457203
457204
457205
457206
457207
457208
457209
457210
457211
457212
457213
457214
457215
457216
457217
457218
457219
457220
457221
457222
457223
457224
457225
457226
457227
457228
457229
457230
457231
457232
457233
457234
457235
457236
457237
457238
457239
457240
457241
457242
457243
457244
457245
457246
457247
457248
457249
457250
457251
457252
457253
457254
457255
457256
457257
457258
457259
457260
457261
457262
457263
457264
457265
457266
457267
457268
457269
457270
457271
457272
457273
457274
457275
457276
457277
457278
457279
457280
457281
457282
457283
457284
457285
457286
457287
457288
457289
457290
457291
457292
457293
457294
457295
457296
457297
457298
457299
457300
457301
457302
457303
457304
457305
457306
457307
457308
457309
457310
457311
457312
457313
457314
457315
457316
457317
457318
457319
457320
457321
457322
457323
457324
457325
457326
457327
457328
457329
457330
457331
457332
457333
457334
457335
457336
457337
457338
457339
457340
457341
457342
457343
457344
457345
457346
457347
457348
457349
457350
457351
457352
457353
457354
457355
457356
457357
457358
457359
457360
457361
457362
457363
457364
457365
457366
457367
457368
457369
457370
457371
457372
457373
457374
457375
457376
457377
457378
457379
457380
457381
457382
457383
457384
457385
457386
457387
457388
457389
457390
457391
457392
457393
457394
457395
457396
457397
457398
457399
457400
457401
457402
457403
457404
457405
457406
457407
457408
457409
457410
457411
457412
457413
457414
457415
457416
457417
457418
457419
457420
457421
457422
457423
457424
457425
457426
457427
457428
457429
457430
457431
457432
457433
457434
457435
457436
457437
457438
457439
457440
457441
457442
457443
457444
457445
457446
457447
457448
457449
457450
457451
457452
457453
457454
457455
457456
457457
457458
457459
457460
457461
457462
457463
457464
457465
457466
457467
457468
457469
457470
457471
457472
457473
457474
457475
457476
457477
457478
457479
457480
457481
457482
457483
457484
457485
457486
457487
457488
457489
457490
457491
457492
457493
457494
457495
457496
457497
457498
457499
457500
457501
457502
457503
457504
457505
457506
457507
457508
457509
457510
457511
457512
457513
457514
457515
457516
457517
457518
457519
457520
457521
457522
457523
457524
457525
457526
457527
457528
457529
457530
457531
457532
457533
457534
457535
457536
457537
457538
457539
457540
457541
457542
457543
457544
457545
457546
457547
457548
457549
457550
457551
457552
457553
457554
457555
457556
457557
457558
457559
457560
457561
457562
457563
457564
457565
457566
457567
457568
457569
457570
457571
457572
457573
457574
457575
457576
457577
457578
457579
457580
457581
457582
457583
457584
457585
457586
457587
457588
457589
457590
457591
457592
457593
457594
457595
457596
457597
457598
457599
457600
457601
457602
457603
457604
457605
457606
457607
457608
457609
457610
457611
457612
457613
457614
457615
457616
457617
457618
457619
457620
457621
457622
457623
457624
457625
457626
457627
457628
457629
457630
457631
457632
457633
457634
457635
457636
457637
457638
457639
457640
457641
457642
457643
457644
457645
457646
457647
457648
457649
457650
457651
457652
457653
457654
457655
457656
457657
457658
457659
457660
457661
457662
457663
457664
457665
457666
457667
457668
457669
457670
457671
457672
457673
457674
457675
457676
457677
457678
457679
457680
457681
457682
457683
457684
457685
457686
457687
457688
457689
457690
457691
457692
457693
457694
457695
457696
457697
457698
457699
457700
457701
457702
457703
457704
457705
457706
457707
457708
457709
457710
457711
457712
457713
457714
457715
457716
457717
457718
457719
457720
457721
457722
457723
457724
457725
457726
457727
457728
457729
457730
457731
457732
457733
457734
457735
457736
457737
457738
457739
457740
457741
457742
457743
457744
457745
457746
457747
457748
457749
457750
457751
457752
457753
457754
457755
457756
457757
457758
457759
457760
457761
457762
457763
457764
457765
457766
457767
457768
457769
457770
457771
457772
457773
457774
457775
457776
457777
457778
457779
457780
457781
457782
457783
457784
457785
457786
457787
457788
457789
457790
457791
457792
457793
457794
457795
457796
457797
457798
457799
457800
457801
457802
457803
457804
457805
457806
457807
457808
457809
457810
457811
457812
457813
457814
457815
457816
457817
457818
457819
457820
457821
457822
457823
457824
457825
457826
457827
457828
457829
457830
457831
457832
457833
457834
457835
457836
457837
457838
457839
457840
457841
457842
457843
457844
457845
457846
457847
457848
457849
457850
457851
457852
457853
457854
457855
457856
457857
457858
457859
457860
457861
457862
457863
457864
457865
457866
457867
457868
457869
457870
457871
457872
457873
457874
457875
457876
457877
457878
457879
457880
457881
457882
457883
457884
457885
457886
457887
457888
457889
457890
457891
457892
457893
457894
457895
457896
457897
457898
457899
457900
457901
457902
457903
457904
457905
457906
457907
457908
457909
457910
457911
457912
457913
457914
457915
457916
457917
457918
457919
457920
457921
457922
457923
457924
457925
457926
457927
457928
457929
457930
457931
457932
457933
457934
457935
457936
457937
457938
457939
457940
457941
457942
457943
457944
457945
457946
457947
457948
457949
457950
457951
457952
457953
457954
457955
457956
457957
457958
457959
457960
457961
457962
457963
457964
457965
457966
457967
457968
457969
457970
457971
457972
457973
457974
457975
457976
457977
457978
457979
457980
457981
457982
457983
457984
457985
457986
457987
457988
457989
457990
457991
457992
457993
457994
457995
457996
457997
457998
457999
458000
458001
458002
458003
458004
458005
458006
458007
458008
458009
458010
458011
458012
458013
458014
458015
458016
458017
458018
458019
458020
458021
458022
458023
458024
458025
458026
458027
458028
458029
458030
458031
458032
458033
458034
458035
458036
458037
458038
458039
458040
458041
458042
458043
458044
458045
458046
458047
458048
458049
458050
458051
458052
458053
458054
458055
458056
458057
458058
458059
458060
458061
458062
458063
458064
458065
458066
458067
458068
458069
458070
458071
458072
458073
458074
458075
458076
458077
458078
458079
458080
458081
458082
458083
458084
458085
458086
458087
458088
458089
458090
458091
458092
458093
458094
458095
458096
458097
458098
458099
458100
458101
458102
458103
458104
458105
458106
458107
458108
458109
458110
458111
458112
458113
458114
458115
458116
458117
458118
458119
458120
458121
458122
458123
458124
458125
458126
458127
458128
458129
458130
458131
458132
458133
458134
458135
458136
458137
458138
458139
458140
458141
458142
458143
458144
458145
458146
458147
458148
458149
458150
458151
458152
458153
458154
458155
458156
458157
458158
458159
458160
458161
458162
458163
458164
458165
458166
458167
458168
458169
458170
458171
458172
458173
458174
458175
458176
458177
458178
458179
458180
458181
458182
458183
458184
458185
458186
458187
458188
458189
458190
458191
458192
458193
458194
458195
458196
458197
458198
458199
458200
458201
458202
458203
458204
458205
458206
458207
458208
458209
458210
458211
458212
458213
458214
458215
458216
458217
458218
458219
458220
458221
458222
458223
458224
458225
458226
458227
458228
458229
458230
458231
458232
458233
458234
458235
458236
458237
458238
458239
458240
458241
458242
458243
458244
458245
458246
458247
458248
458249
458250
458251
458252
458253
458254
458255
458256
458257
458258
458259
458260
458261
458262
458263
458264
458265
458266
458267
458268
458269
458270
458271
458272
458273
458274
458275
458276
458277
458278
458279
458280
458281
458282
458283
458284
458285
458286
458287
458288
458289
458290
458291
458292
458293
458294
458295
458296
458297
458298
458299
458300
458301
458302
458303
458304
458305
458306
458307
458308
458309
458310
458311
458312
458313
458314
458315
458316
458317
458318
458319
458320
458321
458322
458323
458324
458325
458326
458327
458328
458329
458330
458331
458332
458333
458334
458335
458336
458337
458338
458339
458340
458341
458342
458343
458344
458345
458346
458347
458348
458349
458350
458351
458352
458353
458354
458355
458356
458357
458358
458359
458360
458361
458362
458363
458364
458365
458366
458367
458368
458369
458370
458371
458372
458373
458374
458375
458376
458377
458378
458379
458380
458381
458382
458383
458384
458385
458386
458387
458388
458389
458390
458391
458392
458393
458394
458395
458396
458397
458398
458399
458400
458401
458402
458403
458404
458405
458406
458407
458408
458409
458410
458411
458412
458413
458414
458415
458416
458417
458418
458419
458420
458421
458422
458423
458424
458425
458426
458427
458428
458429
458430
458431
458432
458433
458434
458435
458436
458437
458438
458439
458440
458441
458442
458443
458444
458445
458446
458447
458448
458449
458450
458451
458452
458453
458454
458455
458456
458457
458458
458459
458460
458461
458462
458463
458464
458465
458466
458467
458468
458469
458470
458471
458472
458473
458474
458475
458476
458477
458478
458479
458480
458481
458482
458483
458484
458485
458486
458487
458488
458489
458490
458491
458492
458493
458494
458495
458496
458497
458498
458499
458500
458501
458502
458503
458504
458505
458506
458507
458508
458509
458510
458511
458512
458513
458514
458515
458516
458517
458518
458519
458520
458521
458522
458523
458524
458525
458526
458527
458528
458529
458530
458531
458532
458533
458534
458535
458536
458537
458538
458539
458540
458541
458542
458543
458544
458545
458546
458547
458548
458549
458550
458551
458552
458553
458554
458555
458556
458557
458558
458559
458560
458561
458562
458563
458564
458565
458566
458567
458568
458569
458570
458571
458572
458573
458574
458575
458576
458577
458578
458579
458580
458581
458582
458583
458584
458585
458586
458587
458588
458589
458590
458591
458592
458593
458594
458595
458596
458597
458598
458599
458600
458601
458602
458603
458604
458605
458606
458607
458608
458609
458610
458611
458612
458613
458614
458615
458616
458617
458618
458619
458620
458621
458622
458623
458624
458625
458626
458627
458628
458629
458630
458631
458632
458633
458634
458635
458636
458637
458638
458639
458640
458641
458642
458643
458644
458645
458646
458647
458648
458649
458650
458651
458652
458653
458654
458655
458656
458657
458658
458659
458660
458661
458662
458663
458664
458665
458666
458667
458668
458669
458670
458671
458672
458673
458674
458675
458676
458677
458678
458679
458680
458681
458682
458683
458684
458685
458686
458687
458688
458689
458690
458691
458692
458693
458694
458695
458696
458697
458698
458699
458700
458701
458702
458703
458704
458705
458706
458707
458708
458709
458710
458711
458712
458713
458714
458715
458716
458717
458718
458719
458720
458721
458722
458723
458724
458725
458726
458727
458728
458729
458730
458731
458732
458733
458734
458735
458736
458737
458738
458739
458740
458741
458742
458743
458744
458745
458746
458747
458748
458749
458750
458751
458752
458753
458754
458755
458756
458757
458758
458759
458760
458761
458762
458763
458764
458765
458766
458767
458768
458769
458770
458771
458772
458773
458774
458775
458776
458777
458778
458779
458780
458781
458782
458783
458784
458785
458786
458787
458788
458789
458790
458791
458792
458793
458794
458795
458796
458797
458798
458799
458800
458801
458802
458803
458804
458805
458806
458807
458808
458809
458810
458811
458812
458813
458814
458815
458816
458817
458818
458819
458820
458821
458822
458823
458824
458825
458826
458827
458828
458829
458830
458831
458832
458833
458834
458835
458836
458837
458838
458839
458840
458841
458842
458843
458844
458845
458846
458847
458848
458849
458850
458851
458852
458853
458854
458855
458856
458857
458858
458859
458860
458861
458862
458863
458864
458865
458866
458867
458868
458869
458870
458871
458872
458873
458874
458875
458876
458877
458878
458879
458880
458881
458882
458883
458884
458885
458886
458887
458888
458889
458890
458891
458892
458893
458894
458895
458896
458897
458898
458899
458900
458901
458902
458903
458904
458905
458906
458907
458908
458909
458910
458911
458912
458913
458914
458915
458916
458917
458918
458919
458920
458921
458922
458923
458924
458925
458926
458927
458928
458929
458930
458931
458932
458933
458934
458935
458936
458937
458938
458939
458940
458941
458942
458943
458944
458945
458946
458947
458948
458949
458950
458951
458952
458953
458954
458955
458956
458957
458958
458959
458960
458961
458962
458963
458964
458965
458966
458967
458968
458969
458970
458971
458972
458973
458974
458975
458976
458977
458978
458979
458980
458981
458982
458983
458984
458985
458986
458987
458988
458989
458990
458991
458992
458993
458994
458995
458996
458997
458998
458999
459000
459001
459002
459003
459004
459005
459006
459007
459008
459009
459010
459011
459012
459013
459014
459015
459016
459017
459018
459019
459020
459021
459022
459023
459024
459025
459026
459027
459028
459029
459030
459031
459032
459033
459034
459035
459036
459037
459038
459039
459040
459041
459042
459043
459044
459045
459046
459047
459048
459049
459050
459051
459052
459053
459054
459055
459056
459057
459058
459059
459060
459061
459062
459063
459064
459065
459066
459067
459068
459069
459070
459071
459072
459073
459074
459075
459076
459077
459078
459079
459080
459081
459082
459083
459084
459085
459086
459087
459088
459089
459090
459091
459092
459093
459094
459095
459096
459097
459098
459099
459100
459101
459102
459103
459104
459105
459106
459107
459108
459109
459110
459111
459112
459113
459114
459115
459116
459117
459118
459119
459120
459121
459122
459123
459124
459125
459126
459127
459128
459129
459130
459131
459132
459133
459134
459135
459136
459137
459138
459139
459140
459141
459142
459143
459144
459145
459146
459147
459148
459149
459150
459151
459152
459153
459154
459155
459156
459157
459158
459159
459160
459161
459162
459163
459164
459165
459166
459167
459168
459169
459170
459171
459172
459173
459174
459175
459176
459177
459178
459179
459180
459181
459182
459183
459184
459185
459186
459187
459188
459189
459190
459191
459192
459193
459194
459195
459196
459197
459198
459199
459200
459201
459202
459203
459204
459205
459206
459207
459208
459209
459210
459211
459212
459213
459214
459215
459216
459217
459218
459219
459220
459221
459222
459223
459224
459225
459226
459227
459228
459229
459230
459231
459232
459233
459234
459235
459236
459237
459238
459239
459240
459241
459242
459243
459244
459245
459246
459247
459248
459249
459250
459251
459252
459253
459254
459255
459256
459257
459258
459259
459260
459261
459262
459263
459264
459265
459266
459267
459268
459269
459270
459271
459272
459273
459274
459275
459276
459277
459278
459279
459280
459281
459282
459283
459284
459285
459286
459287
459288
459289
459290
459291
459292
459293
459294
459295
459296
459297
459298
459299
459300
459301
459302
459303
459304
459305
459306
459307
459308
459309
459310
459311
459312
459313
459314
459315
459316
459317
459318
459319
459320
459321
459322
459323
459324
459325
459326
459327
459328
459329
459330
459331
459332
459333
459334
459335
459336
459337
459338
459339
459340
459341
459342
459343
459344
459345
459346
459347
459348
459349
459350
459351
459352
459353
459354
459355
459356
459357
459358
459359
459360
459361
459362
459363
459364
459365
459366
459367
459368
459369
459370
459371
459372
459373
459374
459375
459376
459377
459378
459379
459380
459381
459382
459383
459384
459385
459386
459387
459388
459389
459390
459391
459392
459393
459394
459395
459396
459397
459398
459399
459400
459401
459402
459403
459404
459405
459406
459407
459408
459409
459410
459411
459412
459413
459414
459415
459416
459417
459418
459419
459420
459421
459422
459423
459424
459425
459426
459427
459428
459429
459430
459431
459432
459433
459434
459435
459436
459437
459438
459439
459440
459441
459442
459443
459444
459445
459446
459447
459448
459449
459450
459451
459452
459453
459454
459455
459456
459457
459458
459459
459460
459461
459462
459463
459464
459465
459466
459467
459468
459469
459470
459471
459472
459473
459474
459475
459476
459477
459478
459479
459480
459481
459482
459483
459484
459485
459486
459487
459488
459489
459490
459491
459492
459493
459494
459495
459496
459497
459498
459499
459500
459501
459502
459503
459504
459505
459506
459507
459508
459509
459510
459511
459512
459513
459514
459515
459516
459517
459518
459519
459520
459521
459522
459523
459524
459525
459526
459527
459528
459529
459530
459531
459532
459533
459534
459535
459536
459537
459538
459539
459540
459541
459542
459543
459544
459545
459546
459547
459548
459549
459550
459551
459552
459553
459554
459555
459556
459557
459558
459559
459560
459561
459562
459563
459564
459565
459566
459567
459568
459569
459570
459571
459572
459573
459574
459575
459576
459577
459578
459579
459580
459581
459582
459583
459584
459585
459586
459587
459588
459589
459590
459591
459592
459593
459594
459595
459596
459597
459598
459599
459600
459601
459602
459603
459604
459605
459606
459607
459608
459609
459610
459611
459612
459613
459614
459615
459616
459617
459618
459619
459620
459621
459622
459623
459624
459625
459626
459627
459628
459629
459630
459631
459632
459633
459634
459635
459636
459637
459638
459639
459640
459641
459642
459643
459644
459645
459646
459647
459648
459649
459650
459651
459652
459653
459654
459655
459656
459657
459658
459659
459660
459661
459662
459663
459664
459665
459666
459667
459668
459669
459670
459671
459672
459673
459674
459675
459676
459677
459678
459679
459680
459681
459682
459683
459684
459685
459686
459687
459688
459689
459690
459691
459692
459693
459694
459695
459696
459697
459698
459699
459700
459701
459702
459703
459704
459705
459706
459707
459708
459709
459710
459711
459712
459713
459714
459715
459716
459717
459718
459719
459720
459721
459722
459723
459724
459725
459726
459727
459728
459729
459730
459731
459732
459733
459734
459735
459736
459737
459738
459739
459740
459741
459742
459743
459744
459745
459746
459747
459748
459749
459750
459751
459752
459753
459754
459755
459756
459757
459758
459759
459760
459761
459762
459763
459764
459765
459766
459767
459768
459769
459770
459771
459772
459773
459774
459775
459776
459777
459778
459779
459780
459781
459782
459783
459784
459785
459786
459787
459788
459789
459790
459791
459792
459793
459794
459795
459796
459797
459798
459799
459800
459801
459802
459803
459804
459805
459806
459807
459808
459809
459810
459811
459812
459813
459814
459815
459816
459817
459818
459819
459820
459821
459822
459823
459824
459825
459826
459827
459828
459829
459830
459831
459832
459833
459834
459835
459836
459837
459838
459839
459840
459841
459842
459843
459844
459845
459846
459847
459848
459849
459850
459851
459852
459853
459854
459855
459856
459857
459858
459859
459860
459861
459862
459863
459864
459865
459866
459867
459868
459869
459870
459871
459872
459873
459874
459875
459876
459877
459878
459879
459880
459881
459882
459883
459884
459885
459886
459887
459888
459889
459890
459891
459892
459893
459894
459895
459896
459897
459898
459899
459900
459901
459902
459903
459904
459905
459906
459907
459908
459909
459910
459911
459912
459913
459914
459915
459916
459917
459918
459919
459920
459921
459922
459923
459924
459925
459926
459927
459928
459929
459930
459931
459932
459933
459934
459935
459936
459937
459938
459939
459940
459941
459942
459943
459944
459945
459946
459947
459948
459949
459950
459951
459952
459953
459954
459955
459956
459957
459958
459959
459960
459961
459962
459963
459964
459965
459966
459967
459968
459969
459970
459971
459972
459973
459974
459975
459976
459977
459978
459979
459980
459981
459982
459983
459984
459985
459986
459987
459988
459989
459990
459991
459992
459993
459994
459995
459996
459997
459998
459999
460000
460001
460002
460003
460004
460005
460006
460007
460008
460009
460010
460011
460012
460013
460014
460015
460016
460017
460018
460019
460020
460021
460022
460023
460024
460025
460026
460027
460028
460029
460030
460031
460032
460033
460034
460035
460036
460037
460038
460039
460040
460041
460042
460043
460044
460045
460046
460047
460048
460049
460050
460051
460052
460053
460054
460055
460056
460057
460058
460059
460060
460061
460062
460063
460064
460065
460066
460067
460068
460069
460070
460071
460072
460073
460074
460075
460076
460077
460078
460079
460080
460081
460082
460083
460084
460085
460086
460087
460088
460089
460090
460091
460092
460093
460094
460095
460096
460097
460098
460099
460100
460101
460102
460103
460104
460105
460106
460107
460108
460109
460110
460111
460112
460113
460114
460115
460116
460117
460118
460119
460120
460121
460122
460123
460124
460125
460126
460127
460128
460129
460130
460131
460132
460133
460134
460135
460136
460137
460138
460139
460140
460141
460142
460143
460144
460145
460146
460147
460148
460149
460150
460151
460152
460153
460154
460155
460156
460157
460158
460159
460160
460161
460162
460163
460164
460165
460166
460167
460168
460169
460170
460171
460172
460173
460174
460175
460176
460177
460178
460179
460180
460181
460182
460183
460184
460185
460186
460187
460188
460189
460190
460191
460192
460193
460194
460195
460196
460197
460198
460199
460200
460201
460202
460203
460204
460205
460206
460207
460208
460209
460210
460211
460212
460213
460214
460215
460216
460217
460218
460219
460220
460221
460222
460223
460224
460225
460226
460227
460228
460229
460230
460231
460232
460233
460234
460235
460236
460237
460238
460239
460240
460241
460242
460243
460244
460245
460246
460247
460248
460249
460250
460251
460252
460253
460254
460255
460256
460257
460258
460259
460260
460261
460262
460263
460264
460265
460266
460267
460268
460269
460270
460271
460272
460273
460274
460275
460276
460277
460278
460279
460280
460281
460282
460283
460284
460285
460286
460287
460288
460289
460290
460291
460292
460293
460294
460295
460296
460297
460298
460299
460300
460301
460302
460303
460304
460305
460306
460307
460308
460309
460310
460311
460312
460313
460314
460315
460316
460317
460318
460319
460320
460321
460322
460323
460324
460325
460326
460327
460328
460329
460330
460331
460332
460333
460334
460335
460336
460337
460338
460339
460340
460341
460342
460343
460344
460345
460346
460347
460348
460349
460350
460351
460352
460353
460354
460355
460356
460357
460358
460359
460360
460361
460362
460363
460364
460365
460366
460367
460368
460369
460370
460371
460372
460373
460374
460375
460376
460377
460378
460379
460380
460381
460382
460383
460384
460385
460386
460387
460388
460389
460390
460391
460392
460393
460394
460395
460396
460397
460398
460399
460400
460401
460402
460403
460404
460405
460406
460407
460408
460409
460410
460411
460412
460413
460414
460415
460416
460417
460418
460419
460420
460421
460422
460423
460424
460425
460426
460427
460428
460429
460430
460431
460432
460433
460434
460435
460436
460437
460438
460439
460440
460441
460442
460443
460444
460445
460446
460447
460448
460449
460450
460451
460452
460453
460454
460455
460456
460457
460458
460459
460460
460461
460462
460463
460464
460465
460466
460467
460468
460469
460470
460471
460472
460473
460474
460475
460476
460477
460478
460479
460480
460481
460482
460483
460484
460485
460486
460487
460488
460489
460490
460491
460492
460493
460494
460495
460496
460497
460498
460499
460500
460501
460502
460503
460504
460505
460506
460507
460508
460509
460510
460511
460512
460513
460514
460515
460516
460517
460518
460519
460520
460521
460522
460523
460524
460525
460526
460527
460528
460529
460530
460531
460532
460533
460534
460535
460536
460537
460538
460539
460540
460541
460542
460543
460544
460545
460546
460547
460548
460549
460550
460551
460552
460553
460554
460555
460556
460557
460558
460559
460560
460561
460562
460563
460564
460565
460566
460567
460568
460569
460570
460571
460572
460573
460574
460575
460576
460577
460578
460579
460580
460581
460582
460583
460584
460585
460586
460587
460588
460589
460590
460591
460592
460593
460594
460595
460596
460597
460598
460599
460600
460601
460602
460603
460604
460605
460606
460607
460608
460609
460610
460611
460612
460613
460614
460615
460616
460617
460618
460619
460620
460621
460622
460623
460624
460625
460626
460627
460628
460629
460630
460631
460632
460633
460634
460635
460636
460637
460638
460639
460640
460641
460642
460643
460644
460645
460646
460647
460648
460649
460650
460651
460652
460653
460654
460655
460656
460657
460658
460659
460660
460661
460662
460663
460664
460665
460666
460667
460668
460669
460670
460671
460672
460673
460674
460675
460676
460677
460678
460679
460680
460681
460682
460683
460684
460685
460686
460687
460688
460689
460690
460691
460692
460693
460694
460695
460696
460697
460698
460699
460700
460701
460702
460703
460704
460705
460706
460707
460708
460709
460710
460711
460712
460713
460714
460715
460716
460717
460718
460719
460720
460721
460722
460723
460724
460725
460726
460727
460728
460729
460730
460731
460732
460733
460734
460735
460736
460737
460738
460739
460740
460741
460742
460743
460744
460745
460746
460747
460748
460749
460750
460751
460752
460753
460754
460755
460756
460757
460758
460759
460760
460761
460762
460763
460764
460765
460766
460767
460768
460769
460770
460771
460772
460773
460774
460775
460776
460777
460778
460779
460780
460781
460782
460783
460784
460785
460786
460787
460788
460789
460790
460791
460792
460793
460794
460795
460796
460797
460798
460799
460800
460801
460802
460803
460804
460805
460806
460807
460808
460809
460810
460811
460812
460813
460814
460815
460816
460817
460818
460819
460820
460821
460822
460823
460824
460825
460826
460827
460828
460829
460830
460831
460832
460833
460834
460835
460836
460837
460838
460839
460840
460841
460842
460843
460844
460845
460846
460847
460848
460849
460850
460851
460852
460853
460854
460855
460856
460857
460858
460859
460860
460861
460862
460863
460864
460865
460866
460867
460868
460869
460870
460871
460872
460873
460874
460875
460876
460877
460878
460879
460880
460881
460882
460883
460884
460885
460886
460887
460888
460889
460890
460891
460892
460893
460894
460895
460896
460897
460898
460899
460900
460901
460902
460903
460904
460905
460906
460907
460908
460909
460910
460911
460912
460913
460914
460915
460916
460917
460918
460919
460920
460921
460922
460923
460924
460925
460926
460927
460928
460929
460930
460931
460932
460933
460934
460935
460936
460937
460938
460939
460940
460941
460942
460943
460944
460945
460946
460947
460948
460949
460950
460951
460952
460953
460954
460955
460956
460957
460958
460959
460960
460961
460962
460963
460964
460965
460966
460967
460968
460969
460970
460971
460972
460973
460974
460975
460976
460977
460978
460979
460980
460981
460982
460983
460984
460985
460986
460987
460988
460989
460990
460991
460992
460993
460994
460995
460996
460997
460998
460999
461000
461001
461002
461003
461004
461005
461006
461007
461008
461009
461010
461011
461012
461013
461014
461015
461016
461017
461018
461019
461020
461021
461022
461023
461024
461025
461026
461027
461028
461029
461030
461031
461032
461033
461034
461035
461036
461037
461038
461039
461040
461041
461042
461043
461044
461045
461046
461047
461048
461049
461050
461051
461052
461053
461054
461055
461056
461057
461058
461059
461060
461061
461062
461063
461064
461065
461066
461067
461068
461069
461070
461071
461072
461073
461074
461075
461076
461077
461078
461079
461080
461081
461082
461083
461084
461085
461086
461087
461088
461089
461090
461091
461092
461093
461094
461095
461096
461097
461098
461099
461100
461101
461102
461103
461104
461105
461106
461107
461108
461109
461110
461111
461112
461113
461114
461115
461116
461117
461118
461119
461120
461121
461122
461123
461124
461125
461126
461127
461128
461129
461130
461131
461132
461133
461134
461135
461136
461137
461138
461139
461140
461141
461142
461143
461144
461145
461146
461147
461148
461149
461150
461151
461152
461153
461154
461155
461156
461157
461158
461159
461160
461161
461162
461163
461164
461165
461166
461167
461168
461169
461170
461171
461172
461173
461174
461175
461176
461177
461178
461179
461180
461181
461182
461183
461184
461185
461186
461187
461188
461189
461190
461191
461192
461193
461194
461195
461196
461197
461198
461199
461200
461201
461202
461203
461204
461205
461206
461207
461208
461209
461210
461211
461212
461213
461214
461215
461216
461217
461218
461219
461220
461221
461222
461223
461224
461225
461226
461227
461228
461229
461230
461231
461232
461233
461234
461235
461236
461237
461238
461239
461240
461241
461242
461243
461244
461245
461246
461247
461248
461249
461250
461251
461252
461253
461254
461255
461256
461257
461258
461259
461260
461261
461262
461263
461264
461265
461266
461267
461268
461269
461270
461271
461272
461273
461274
461275
461276
461277
461278
461279
461280
461281
461282
461283
461284
461285
461286
461287
461288
461289
461290
461291
461292
461293
461294
461295
461296
461297
461298
461299
461300
461301
461302
461303
461304
461305
461306
461307
461308
461309
461310
461311
461312
461313
461314
461315
461316
461317
461318
461319
461320
461321
461322
461323
461324
461325
461326
461327
461328
461329
461330
461331
461332
461333
461334
461335
461336
461337
461338
461339
461340
461341
461342
461343
461344
461345
461346
461347
461348
461349
461350
461351
461352
461353
461354
461355
461356
461357
461358
461359
461360
461361
461362
461363
461364
461365
461366
461367
461368
461369
461370
461371
461372
461373
461374
461375
461376
461377
461378
461379
461380
461381
461382
461383
461384
461385
461386
461387
461388
461389
461390
461391
461392
461393
461394
461395
461396
461397
461398
461399
461400
461401
461402
461403
461404
461405
461406
461407
461408
461409
461410
461411
461412
461413
461414
461415
461416
461417
461418
461419
461420
461421
461422
461423
461424
461425
461426
461427
461428
461429
461430
461431
461432
461433
461434
461435
461436
461437
461438
461439
461440
461441
461442
461443
461444
461445
461446
461447
461448
461449
461450
461451
461452
461453
461454
461455
461456
461457
461458
461459
461460
461461
461462
461463
461464
461465
461466
461467
461468
461469
461470
461471
461472
461473
461474
461475
461476
461477
461478
461479
461480
461481
461482
461483
461484
461485
461486
461487
461488
461489
461490
461491
461492
461493
461494
461495
461496
461497
461498
461499
461500
461501
461502
461503
461504
461505
461506
461507
461508
461509
461510
461511
461512
461513
461514
461515
461516
461517
461518
461519
461520
461521
461522
461523
461524
461525
461526
461527
461528
461529
461530
461531
461532
461533
461534
461535
461536
461537
461538
461539
461540
461541
461542
461543
461544
461545
461546
461547
461548
461549
461550
461551
461552
461553
461554
461555
461556
461557
461558
461559
461560
461561
461562
461563
461564
461565
461566
461567
461568
461569
461570
461571
461572
461573
461574
461575
461576
461577
461578
461579
461580
461581
461582
461583
461584
461585
461586
461587
461588
461589
461590
461591
461592
461593
461594
461595
461596
461597
461598
461599
461600
461601
461602
461603
461604
461605
461606
461607
461608
461609
461610
461611
461612
461613
461614
461615
461616
461617
461618
461619
461620
461621
461622
461623
461624
461625
461626
461627
461628
461629
461630
461631
461632
461633
461634
461635
461636
461637
461638
461639
461640
461641
461642
461643
461644
461645
461646
461647
461648
461649
461650
461651
461652
461653
461654
461655
461656
461657
461658
461659
461660
461661
461662
461663
461664
461665
461666
461667
461668
461669
461670
461671
461672
461673
461674
461675
461676
461677
461678
461679
461680
461681
461682
461683
461684
461685
461686
461687
461688
461689
461690
461691
461692
461693
461694
461695
461696
461697
461698
461699
461700
461701
461702
461703
461704
461705
461706
461707
461708
461709
461710
461711
461712
461713
461714
461715
461716
461717
461718
461719
461720
461721
461722
461723
461724
461725
461726
461727
461728
461729
461730
461731
461732
461733
461734
461735
461736
461737
461738
461739
461740
461741
461742
461743
461744
461745
461746
461747
461748
461749
461750
461751
461752
461753
461754
461755
461756
461757
461758
461759
461760
461761
461762
461763
461764
461765
461766
461767
461768
461769
461770
461771
461772
461773
461774
461775
461776
461777
461778
461779
461780
461781
461782
461783
461784
461785
461786
461787
461788
461789
461790
461791
461792
461793
461794
461795
461796
461797
461798
461799
461800
461801
461802
461803
461804
461805
461806
461807
461808
461809
461810
461811
461812
461813
461814
461815
461816
461817
461818
461819
461820
461821
461822
461823
461824
461825
461826
461827
461828
461829
461830
461831
461832
461833
461834
461835
461836
461837
461838
461839
461840
461841
461842
461843
461844
461845
461846
461847
461848
461849
461850
461851
461852
461853
461854
461855
461856
461857
461858
461859
461860
461861
461862
461863
461864
461865
461866
461867
461868
461869
461870
461871
461872
461873
461874
461875
461876
461877
461878
461879
461880
461881
461882
461883
461884
461885
461886
461887
461888
461889
461890
461891
461892
461893
461894
461895
461896
461897
461898
461899
461900
461901
461902
461903
461904
461905
461906
461907
461908
461909
461910
461911
461912
461913
461914
461915
461916
461917
461918
461919
461920
461921
461922
461923
461924
461925
461926
461927
461928
461929
461930
461931
461932
461933
461934
461935
461936
461937
461938
461939
461940
461941
461942
461943
461944
461945
461946
461947
461948
461949
461950
461951
461952
461953
461954
461955
461956
461957
461958
461959
461960
461961
461962
461963
461964
461965
461966
461967
461968
461969
461970
461971
461972
461973
461974
461975
461976
461977
461978
461979
461980
461981
461982
461983
461984
461985
461986
461987
461988
461989
461990
461991
461992
461993
461994
461995
461996
461997
461998
461999
462000
462001
462002
462003
462004
462005
462006
462007
462008
462009
462010
462011
462012
462013
462014
462015
462016
462017
462018
462019
462020
462021
462022
462023
462024
462025
462026
462027
462028
462029
462030
462031
462032
462033
462034
462035
462036
462037
462038
462039
462040
462041
462042
462043
462044
462045
462046
462047
462048
462049
462050
462051
462052
462053
462054
462055
462056
462057
462058
462059
462060
462061
462062
462063
462064
462065
462066
462067
462068
462069
462070
462071
462072
462073
462074
462075
462076
462077
462078
462079
462080
462081
462082
462083
462084
462085
462086
462087
462088
462089
462090
462091
462092
462093
462094
462095
462096
462097
462098
462099
462100
462101
462102
462103
462104
462105
462106
462107
462108
462109
462110
462111
462112
462113
462114
462115
462116
462117
462118
462119
462120
462121
462122
462123
462124
462125
462126
462127
462128
462129
462130
462131
462132
462133
462134
462135
462136
462137
462138
462139
462140
462141
462142
462143
462144
462145
462146
462147
462148
462149
462150
462151
462152
462153
462154
462155
462156
462157
462158
462159
462160
462161
462162
462163
462164
462165
462166
462167
462168
462169
462170
462171
462172
462173
462174
462175
462176
462177
462178
462179
462180
462181
462182
462183
462184
462185
462186
462187
462188
462189
462190
462191
462192
462193
462194
462195
462196
462197
462198
462199
462200
462201
462202
462203
462204
462205
462206
462207
462208
462209
462210
462211
462212
462213
462214
462215
462216
462217
462218
462219
462220
462221
462222
462223
462224
462225
462226
462227
462228
462229
462230
462231
462232
462233
462234
462235
462236
462237
462238
462239
462240
462241
462242
462243
462244
462245
462246
462247
462248
462249
462250
462251
462252
462253
462254
462255
462256
462257
462258
462259
462260
462261
462262
462263
462264
462265
462266
462267
462268
462269
462270
462271
462272
462273
462274
462275
462276
462277
462278
462279
462280
462281
462282
462283
462284
462285
462286
462287
462288
462289
462290
462291
462292
462293
462294
462295
462296
462297
462298
462299
462300
462301
462302
462303
462304
462305
462306
462307
462308
462309
462310
462311
462312
462313
462314
462315
462316
462317
462318
462319
462320
462321
462322
462323
462324
462325
462326
462327
462328
462329
462330
462331
462332
462333
462334
462335
462336
462337
462338
462339
462340
462341
462342
462343
462344
462345
462346
462347
462348
462349
462350
462351
462352
462353
462354
462355
462356
462357
462358
462359
462360
462361
462362
462363
462364
462365
462366
462367
462368
462369
462370
462371
462372
462373
462374
462375
462376
462377
462378
462379
462380
462381
462382
462383
462384
462385
462386
462387
462388
462389
462390
462391
462392
462393
462394
462395
462396
462397
462398
462399
462400
462401
462402
462403
462404
462405
462406
462407
462408
462409
462410
462411
462412
462413
462414
462415
462416
462417
462418
462419
462420
462421
462422
462423
462424
462425
462426
462427
462428
462429
462430
462431
462432
462433
462434
462435
462436
462437
462438
462439
462440
462441
462442
462443
462444
462445
462446
462447
462448
462449
462450
462451
462452
462453
462454
462455
462456
462457
462458
462459
462460
462461
462462
462463
462464
462465
462466
462467
462468
462469
462470
462471
462472
462473
462474
462475
462476
462477
462478
462479
462480
462481
462482
462483
462484
462485
462486
462487
462488
462489
462490
462491
462492
462493
462494
462495
462496
462497
462498
462499
462500
462501
462502
462503
462504
462505
462506
462507
462508
462509
462510
462511
462512
462513
462514
462515
462516
462517
462518
462519
462520
462521
462522
462523
462524
462525
462526
462527
462528
462529
462530
462531
462532
462533
462534
462535
462536
462537
462538
462539
462540
462541
462542
462543
462544
462545
462546
462547
462548
462549
462550
462551
462552
462553
462554
462555
462556
462557
462558
462559
462560
462561
462562
462563
462564
462565
462566
462567
462568
462569
462570
462571
462572
462573
462574
462575
462576
462577
462578
462579
462580
462581
462582
462583
462584
462585
462586
462587
462588
462589
462590
462591
462592
462593
462594
462595
462596
462597
462598
462599
462600
462601
462602
462603
462604
462605
462606
462607
462608
462609
462610
462611
462612
462613
462614
462615
462616
462617
462618
462619
462620
462621
462622
462623
462624
462625
462626
462627
462628
462629
462630
462631
462632
462633
462634
462635
462636
462637
462638
462639
462640
462641
462642
462643
462644
462645
462646
462647
462648
462649
462650
462651
462652
462653
462654
462655
462656
462657
462658
462659
462660
462661
462662
462663
462664
462665
462666
462667
462668
462669
462670
462671
462672
462673
462674
462675
462676
462677
462678
462679
462680
462681
462682
462683
462684
462685
462686
462687
462688
462689
462690
462691
462692
462693
462694
462695
462696
462697
462698
462699
462700
462701
462702
462703
462704
462705
462706
462707
462708
462709
462710
462711
462712
462713
462714
462715
462716
462717
462718
462719
462720
462721
462722
462723
462724
462725
462726
462727
462728
462729
462730
462731
462732
462733
462734
462735
462736
462737
462738
462739
462740
462741
462742
462743
462744
462745
462746
462747
462748
462749
462750
462751
462752
462753
462754
462755
462756
462757
462758
462759
462760
462761
462762
462763
462764
462765
462766
462767
462768
462769
462770
462771
462772
462773
462774
462775
462776
462777
462778
462779
462780
462781
462782
462783
462784
462785
462786
462787
462788
462789
462790
462791
462792
462793
462794
462795
462796
462797
462798
462799
462800
462801
462802
462803
462804
462805
462806
462807
462808
462809
462810
462811
462812
462813
462814
462815
462816
462817
462818
462819
462820
462821
462822
462823
462824
462825
462826
462827
462828
462829
462830
462831
462832
462833
462834
462835
462836
462837
462838
462839
462840
462841
462842
462843
462844
462845
462846
462847
462848
462849
462850
462851
462852
462853
462854
462855
462856
462857
462858
462859
462860
462861
462862
462863
462864
462865
462866
462867
462868
462869
462870
462871
462872
462873
462874
462875
462876
462877
462878
462879
462880
462881
462882
462883
462884
462885
462886
462887
462888
462889
462890
462891
462892
462893
462894
462895
462896
462897
462898
462899
462900
462901
462902
462903
462904
462905
462906
462907
462908
462909
462910
462911
462912
462913
462914
462915
462916
462917
462918
462919
462920
462921
462922
462923
462924
462925
462926
462927
462928
462929
462930
462931
462932
462933
462934
462935
462936
462937
462938
462939
462940
462941
462942
462943
462944
462945
462946
462947
462948
462949
462950
462951
462952
462953
462954
462955
462956
462957
462958
462959
462960
462961
462962
462963
462964
462965
462966
462967
462968
462969
462970
462971
462972
462973
462974
462975
462976
462977
462978
462979
462980
462981
462982
462983
462984
462985
462986
462987
462988
462989
462990
462991
462992
462993
462994
462995
462996
462997
462998
462999
463000
463001
463002
463003
463004
463005
463006
463007
463008
463009
463010
463011
463012
463013
463014
463015
463016
463017
463018
463019
463020
463021
463022
463023
463024
463025
463026
463027
463028
463029
463030
463031
463032
463033
463034
463035
463036
463037
463038
463039
463040
463041
463042
463043
463044
463045
463046
463047
463048
463049
463050
463051
463052
463053
463054
463055
463056
463057
463058
463059
463060
463061
463062
463063
463064
463065
463066
463067
463068
463069
463070
463071
463072
463073
463074
463075
463076
463077
463078
463079
463080
463081
463082
463083
463084
463085
463086
463087
463088
463089
463090
463091
463092
463093
463094
463095
463096
463097
463098
463099
463100
463101
463102
463103
463104
463105
463106
463107
463108
463109
463110
463111
463112
463113
463114
463115
463116
463117
463118
463119
463120
463121
463122
463123
463124
463125
463126
463127
463128
463129
463130
463131
463132
463133
463134
463135
463136
463137
463138
463139
463140
463141
463142
463143
463144
463145
463146
463147
463148
463149
463150
463151
463152
463153
463154
463155
463156
463157
463158
463159
463160
463161
463162
463163
463164
463165
463166
463167
463168
463169
463170
463171
463172
463173
463174
463175
463176
463177
463178
463179
463180
463181
463182
463183
463184
463185
463186
463187
463188
463189
463190
463191
463192
463193
463194
463195
463196
463197
463198
463199
463200
463201
463202
463203
463204
463205
463206
463207
463208
463209
463210
463211
463212
463213
463214
463215
463216
463217
463218
463219
463220
463221
463222
463223
463224
463225
463226
463227
463228
463229
463230
463231
463232
463233
463234
463235
463236
463237
463238
463239
463240
463241
463242
463243
463244
463245
463246
463247
463248
463249
463250
463251
463252
463253
463254
463255
463256
463257
463258
463259
463260
463261
463262
463263
463264
463265
463266
463267
463268
463269
463270
463271
463272
463273
463274
463275
463276
463277
463278
463279
463280
463281
463282
463283
463284
463285
463286
463287
463288
463289
463290
463291
463292
463293
463294
463295
463296
463297
463298
463299
463300
463301
463302
463303
463304
463305
463306
463307
463308
463309
463310
463311
463312
463313
463314
463315
463316
463317
463318
463319
463320
463321
463322
463323
463324
463325
463326
463327
463328
463329
463330
463331
463332
463333
463334
463335
463336
463337
463338
463339
463340
463341
463342
463343
463344
463345
463346
463347
463348
463349
463350
463351
463352
463353
463354
463355
463356
463357
463358
463359
463360
463361
463362
463363
463364
463365
463366
463367
463368
463369
463370
463371
463372
463373
463374
463375
463376
463377
463378
463379
463380
463381
463382
463383
463384
463385
463386
463387
463388
463389
463390
463391
463392
463393
463394
463395
463396
463397
463398
463399
463400
463401
463402
463403
463404
463405
463406
463407
463408
463409
463410
463411
463412
463413
463414
463415
463416
463417
463418
463419
463420
463421
463422
463423
463424
463425
463426
463427
463428
463429
463430
463431
463432
463433
463434
463435
463436
463437
463438
463439
463440
463441
463442
463443
463444
463445
463446
463447
463448
463449
463450
463451
463452
463453
463454
463455
463456
463457
463458
463459
463460
463461
463462
463463
463464
463465
463466
463467
463468
463469
463470
463471
463472
463473
463474
463475
463476
463477
463478
463479
463480
463481
463482
463483
463484
463485
463486
463487
463488
463489
463490
463491
463492
463493
463494
463495
463496
463497
463498
463499
463500
463501
463502
463503
463504
463505
463506
463507
463508
463509
463510
463511
463512
463513
463514
463515
463516
463517
463518
463519
463520
463521
463522
463523
463524
463525
463526
463527
463528
463529
463530
463531
463532
463533
463534
463535
463536
463537
463538
463539
463540
463541
463542
463543
463544
463545
463546
463547
463548
463549
463550
463551
463552
463553
463554
463555
463556
463557
463558
463559
463560
463561
463562
463563
463564
463565
463566
463567
463568
463569
463570
463571
463572
463573
463574
463575
463576
463577
463578
463579
463580
463581
463582
463583
463584
463585
463586
463587
463588
463589
463590
463591
463592
463593
463594
463595
463596
463597
463598
463599
463600
463601
463602
463603
463604
463605
463606
463607
463608
463609
463610
463611
463612
463613
463614
463615
463616
463617
463618
463619
463620
463621
463622
463623
463624
463625
463626
463627
463628
463629
463630
463631
463632
463633
463634
463635
463636
463637
463638
463639
463640
463641
463642
463643
463644
463645
463646
463647
463648
463649
463650
463651
463652
463653
463654
463655
463656
463657
463658
463659
463660
463661
463662
463663
463664
463665
463666
463667
463668
463669
463670
463671
463672
463673
463674
463675
463676
463677
463678
463679
463680
463681
463682
463683
463684
463685
463686
463687
463688
463689
463690
463691
463692
463693
463694
463695
463696
463697
463698
463699
463700
463701
463702
463703
463704
463705
463706
463707
463708
463709
463710
463711
463712
463713
463714
463715
463716
463717
463718
463719
463720
463721
463722
463723
463724
463725
463726
463727
463728
463729
463730
463731
463732
463733
463734
463735
463736
463737
463738
463739
463740
463741
463742
463743
463744
463745
463746
463747
463748
463749
463750
463751
463752
463753
463754
463755
463756
463757
463758
463759
463760
463761
463762
463763
463764
463765
463766
463767
463768
463769
463770
463771
463772
463773
463774
463775
463776
463777
463778
463779
463780
463781
463782
463783
463784
463785
463786
463787
463788
463789
463790
463791
463792
463793
463794
463795
463796
463797
463798
463799
463800
463801
463802
463803
463804
463805
463806
463807
463808
463809
463810
463811
463812
463813
463814
463815
463816
463817
463818
463819
463820
463821
463822
463823
463824
463825
463826
463827
463828
463829
463830
463831
463832
463833
463834
463835
463836
463837
463838
463839
463840
463841
463842
463843
463844
463845
463846
463847
463848
463849
463850
463851
463852
463853
463854
463855
463856
463857
463858
463859
463860
463861
463862
463863
463864
463865
463866
463867
463868
463869
463870
463871
463872
463873
463874
463875
463876
463877
463878
463879
463880
463881
463882
463883
463884
463885
463886
463887
463888
463889
463890
463891
463892
463893
463894
463895
463896
463897
463898
463899
463900
463901
463902
463903
463904
463905
463906
463907
463908
463909
463910
463911
463912
463913
463914
463915
463916
463917
463918
463919
463920
463921
463922
463923
463924
463925
463926
463927
463928
463929
463930
463931
463932
463933
463934
463935
463936
463937
463938
463939
463940
463941
463942
463943
463944
463945
463946
463947
463948
463949
463950
463951
463952
463953
463954
463955
463956
463957
463958
463959
463960
463961
463962
463963
463964
463965
463966
463967
463968
463969
463970
463971
463972
463973
463974
463975
463976
463977
463978
463979
463980
463981
463982
463983
463984
463985
463986
463987
463988
463989
463990
463991
463992
463993
463994
463995
463996
463997
463998
463999
464000
464001
464002
464003
464004
464005
464006
464007
464008
464009
464010
464011
464012
464013
464014
464015
464016
464017
464018
464019
464020
464021
464022
464023
464024
464025
464026
464027
464028
464029
464030
464031
464032
464033
464034
464035
464036
464037
464038
464039
464040
464041
464042
464043
464044
464045
464046
464047
464048
464049
464050
464051
464052
464053
464054
464055
464056
464057
464058
464059
464060
464061
464062
464063
464064
464065
464066
464067
464068
464069
464070
464071
464072
464073
464074
464075
464076
464077
464078
464079
464080
464081
464082
464083
464084
464085
464086
464087
464088
464089
464090
464091
464092
464093
464094
464095
464096
464097
464098
464099
464100
464101
464102
464103
464104
464105
464106
464107
464108
464109
464110
464111
464112
464113
464114
464115
464116
464117
464118
464119
464120
464121
464122
464123
464124
464125
464126
464127
464128
464129
464130
464131
464132
464133
464134
464135
464136
464137
464138
464139
464140
464141
464142
464143
464144
464145
464146
464147
464148
464149
464150
464151
464152
464153
464154
464155
464156
464157
464158
464159
464160
464161
464162
464163
464164
464165
464166
464167
464168
464169
464170
464171
464172
464173
464174
464175
464176
464177
464178
464179
464180
464181
464182
464183
464184
464185
464186
464187
464188
464189
464190
464191
464192
464193
464194
464195
464196
464197
464198
464199
464200
464201
464202
464203
464204
464205
464206
464207
464208
464209
464210
464211
464212
464213
464214
464215
464216
464217
464218
464219
464220
464221
464222
464223
464224
464225
464226
464227
464228
464229
464230
464231
464232
464233
464234
464235
464236
464237
464238
464239
464240
464241
464242
464243
464244
464245
464246
464247
464248
464249
464250
464251
464252
464253
464254
464255
464256
464257
464258
464259
464260
464261
464262
464263
464264
464265
464266
464267
464268
464269
464270
464271
464272
464273
464274
464275
464276
464277
464278
464279
464280
464281
464282
464283
464284
464285
464286
464287
464288
464289
464290
464291
464292
464293
464294
464295
464296
464297
464298
464299
464300
464301
464302
464303
464304
464305
464306
464307
464308
464309
464310
464311
464312
464313
464314
464315
464316
464317
464318
464319
464320
464321
464322
464323
464324
464325
464326
464327
464328
464329
464330
464331
464332
464333
464334
464335
464336
464337
464338
464339
464340
464341
464342
464343
464344
464345
464346
464347
464348
464349
464350
464351
464352
464353
464354
464355
464356
464357
464358
464359
464360
464361
464362
464363
464364
464365
464366
464367
464368
464369
464370
464371
464372
464373
464374
464375
464376
464377
464378
464379
464380
464381
464382
464383
464384
464385
464386
464387
464388
464389
464390
464391
464392
464393
464394
464395
464396
464397
464398
464399
464400
464401
464402
464403
464404
464405
464406
464407
464408
464409
464410
464411
464412
464413
464414
464415
464416
464417
464418
464419
464420
464421
464422
464423
464424
464425
464426
464427
464428
464429
464430
464431
464432
464433
464434
464435
464436
464437
464438
464439
464440
464441
464442
464443
464444
464445
464446
464447
464448
464449
464450
464451
464452
464453
464454
464455
464456
464457
464458
464459
464460
464461
464462
464463
464464
464465
464466
464467
464468
464469
464470
464471
464472
464473
464474
464475
464476
464477
464478
464479
464480
464481
464482
464483
464484
464485
464486
464487
464488
464489
464490
464491
464492
464493
464494
464495
464496
464497
464498
464499
464500
464501
464502
464503
464504
464505
464506
464507
464508
464509
464510
464511
464512
464513
464514
464515
464516
464517
464518
464519
464520
464521
464522
464523
464524
464525
464526
464527
464528
464529
464530
464531
464532
464533
464534
464535
464536
464537
464538
464539
464540
464541
464542
464543
464544
464545
464546
464547
464548
464549
464550
464551
464552
464553
464554
464555
464556
464557
464558
464559
464560
464561
464562
464563
464564
464565
464566
464567
464568
464569
464570
464571
464572
464573
464574
464575
464576
464577
464578
464579
464580
464581
464582
464583
464584
464585
464586
464587
464588
464589
464590
464591
464592
464593
464594
464595
464596
464597
464598
464599
464600
464601
464602
464603
464604
464605
464606
464607
464608
464609
464610
464611
464612
464613
464614
464615
464616
464617
464618
464619
464620
464621
464622
464623
464624
464625
464626
464627
464628
464629
464630
464631
464632
464633
464634
464635
464636
464637
464638
464639
464640
464641
464642
464643
464644
464645
464646
464647
464648
464649
464650
464651
464652
464653
464654
464655
464656
464657
464658
464659
464660
464661
464662
464663
464664
464665
464666
464667
464668
464669
464670
464671
464672
464673
464674
464675
464676
464677
464678
464679
464680
464681
464682
464683
464684
464685
464686
464687
464688
464689
464690
464691
464692
464693
464694
464695
464696
464697
464698
464699
464700
464701
464702
464703
464704
464705
464706
464707
464708
464709
464710
464711
464712
464713
464714
464715
464716
464717
464718
464719
464720
464721
464722
464723
464724
464725
464726
464727
464728
464729
464730
464731
464732
464733
464734
464735
464736
464737
464738
464739
464740
464741
464742
464743
464744
464745
464746
464747
464748
464749
464750
464751
464752
464753
464754
464755
464756
464757
464758
464759
464760
464761
464762
464763
464764
464765
464766
464767
464768
464769
464770
464771
464772
464773
464774
464775
464776
464777
464778
464779
464780
464781
464782
464783
464784
464785
464786
464787
464788
464789
464790
464791
464792
464793
464794
464795
464796
464797
464798
464799
464800
464801
464802
464803
464804
464805
464806
464807
464808
464809
464810
464811
464812
464813
464814
464815
464816
464817
464818
464819
464820
464821
464822
464823
464824
464825
464826
464827
464828
464829
464830
464831
464832
464833
464834
464835
464836
464837
464838
464839
464840
464841
464842
464843
464844
464845
464846
464847
464848
464849
464850
464851
464852
464853
464854
464855
464856
464857
464858
464859
464860
464861
464862
464863
464864
464865
464866
464867
464868
464869
464870
464871
464872
464873
464874
464875
464876
464877
464878
464879
464880
464881
464882
464883
464884
464885
464886
464887
464888
464889
464890
464891
464892
464893
464894
464895
464896
464897
464898
464899
464900
464901
464902
464903
464904
464905
464906
464907
464908
464909
464910
464911
464912
464913
464914
464915
464916
464917
464918
464919
464920
464921
464922
464923
464924
464925
464926
464927
464928
464929
464930
464931
464932
464933
464934
464935
464936
464937
464938
464939
464940
464941
464942
464943
464944
464945
464946
464947
464948
464949
464950
464951
464952
464953
464954
464955
464956
464957
464958
464959
464960
464961
464962
464963
464964
464965
464966
464967
464968
464969
464970
464971
464972
464973
464974
464975
464976
464977
464978
464979
464980
464981
464982
464983
464984
464985
464986
464987
464988
464989
464990
464991
464992
464993
464994
464995
464996
464997
464998
464999
465000
465001
465002
465003
465004
465005
465006
465007
465008
465009
465010
465011
465012
465013
465014
465015
465016
465017
465018
465019
465020
465021
465022
465023
465024
465025
465026
465027
465028
465029
465030
465031
465032
465033
465034
465035
465036
465037
465038
465039
465040
465041
465042
465043
465044
465045
465046
465047
465048
465049
465050
465051
465052
465053
465054
465055
465056
465057
465058
465059
465060
465061
465062
465063
465064
465065
465066
465067
465068
465069
465070
465071
465072
465073
465074
465075
465076
465077
465078
465079
465080
465081
465082
465083
465084
465085
465086
465087
465088
465089
465090
465091
465092
465093
465094
465095
465096
465097
465098
465099
465100
465101
465102
465103
465104
465105
465106
465107
465108
465109
465110
465111
465112
465113
465114
465115
465116
465117
465118
465119
465120
465121
465122
465123
465124
465125
465126
465127
465128
465129
465130
465131
465132
465133
465134
465135
465136
465137
465138
465139
465140
465141
465142
465143
465144
465145
465146
465147
465148
465149
465150
465151
465152
465153
465154
465155
465156
465157
465158
465159
465160
465161
465162
465163
465164
465165
465166
465167
465168
465169
465170
465171
465172
465173
465174
465175
465176
465177
465178
465179
465180
465181
465182
465183
465184
465185
465186
465187
465188
465189
465190
465191
465192
465193
465194
465195
465196
465197
465198
465199
465200
465201
465202
465203
465204
465205
465206
465207
465208
465209
465210
465211
465212
465213
465214
465215
465216
465217
465218
465219
465220
465221
465222
465223
465224
465225
465226
465227
465228
465229
465230
465231
465232
465233
465234
465235
465236
465237
465238
465239
465240
465241
465242
465243
465244
465245
465246
465247
465248
465249
465250
465251
465252
465253
465254
465255
465256
465257
465258
465259
465260
465261
465262
465263
465264
465265
465266
465267
465268
465269
465270
465271
465272
465273
465274
465275
465276
465277
465278
465279
465280
465281
465282
465283
465284
465285
465286
465287
465288
465289
465290
465291
465292
465293
465294
465295
465296
465297
465298
465299
465300
465301
465302
465303
465304
465305
465306
465307
465308
465309
465310
465311
465312
465313
465314
465315
465316
465317
465318
465319
465320
465321
465322
465323
465324
465325
465326
465327
465328
465329
465330
465331
465332
465333
465334
465335
465336
465337
465338
465339
465340
465341
465342
465343
465344
465345
465346
465347
465348
465349
465350
465351
465352
465353
465354
465355
465356
465357
465358
465359
465360
465361
465362
465363
465364
465365
465366
465367
465368
465369
465370
465371
465372
465373
465374
465375
465376
465377
465378
465379
465380
465381
465382
465383
465384
465385
465386
465387
465388
465389
465390
465391
465392
465393
465394
465395
465396
465397
465398
465399
465400
465401
465402
465403
465404
465405
465406
465407
465408
465409
465410
465411
465412
465413
465414
465415
465416
465417
465418
465419
465420
465421
465422
465423
465424
465425
465426
465427
465428
465429
465430
465431
465432
465433
465434
465435
465436
465437
465438
465439
465440
465441
465442
465443
465444
465445
465446
465447
465448
465449
465450
465451
465452
465453
465454
465455
465456
465457
465458
465459
465460
465461
465462
465463
465464
465465
465466
465467
465468
465469
465470
465471
465472
465473
465474
465475
465476
465477
465478
465479
465480
465481
465482
465483
465484
465485
465486
465487
465488
465489
465490
465491
465492
465493
465494
465495
465496
465497
465498
465499
465500
465501
465502
465503
465504
465505
465506
465507
465508
465509
465510
465511
465512
465513
465514
465515
465516
465517
465518
465519
465520
465521
465522
465523
465524
465525
465526
465527
465528
465529
465530
465531
465532
465533
465534
465535
465536
465537
465538
465539
465540
465541
465542
465543
465544
465545
465546
465547
465548
465549
465550
465551
465552
465553
465554
465555
465556
465557
465558
465559
465560
465561
465562
465563
465564
465565
465566
465567
465568
465569
465570
465571
465572
465573
465574
465575
465576
465577
465578
465579
465580
465581
465582
465583
465584
465585
465586
465587
465588
465589
465590
465591
465592
465593
465594
465595
465596
465597
465598
465599
465600
465601
465602
465603
465604
465605
465606
465607
465608
465609
465610
465611
465612
465613
465614
465615
465616
465617
465618
465619
465620
465621
465622
465623
465624
465625
465626
465627
465628
465629
465630
465631
465632
465633
465634
465635
465636
465637
465638
465639
465640
465641
465642
465643
465644
465645
465646
465647
465648
465649
465650
465651
465652
465653
465654
465655
465656
465657
465658
465659
465660
465661
465662
465663
465664
465665
465666
465667
465668
465669
465670
465671
465672
465673
465674
465675
465676
465677
465678
465679
465680
465681
465682
465683
465684
465685
465686
465687
465688
465689
465690
465691
465692
465693
465694
465695
465696
465697
465698
465699
465700
465701
465702
465703
465704
465705
465706
465707
465708
465709
465710
465711
465712
465713
465714
465715
465716
465717
465718
465719
465720
465721
465722
465723
465724
465725
465726
465727
465728
465729
465730
465731
465732
465733
465734
465735
465736
465737
465738
465739
465740
465741
465742
465743
465744
465745
465746
465747
465748
465749
465750
465751
465752
465753
465754
465755
465756
465757
465758
465759
465760
465761
465762
465763
465764
465765
465766
465767
465768
465769
465770
465771
465772
465773
465774
465775
465776
465777
465778
465779
465780
465781
465782
465783
465784
465785
465786
465787
465788
465789
465790
465791
465792
465793
465794
465795
465796
465797
465798
465799
465800
465801
465802
465803
465804
465805
465806
465807
465808
465809
465810
465811
465812
465813
465814
465815
465816
465817
465818
465819
465820
465821
465822
465823
465824
465825
465826
465827
465828
465829
465830
465831
465832
465833
465834
465835
465836
465837
465838
465839
465840
465841
465842
465843
465844
465845
465846
465847
465848
465849
465850
465851
465852
465853
465854
465855
465856
465857
465858
465859
465860
465861
465862
465863
465864
465865
465866
465867
465868
465869
465870
465871
465872
465873
465874
465875
465876
465877
465878
465879
465880
465881
465882
465883
465884
465885
465886
465887
465888
465889
465890
465891
465892
465893
465894
465895
465896
465897
465898
465899
465900
465901
465902
465903
465904
465905
465906
465907
465908
465909
465910
465911
465912
465913
465914
465915
465916
465917
465918
465919
465920
465921
465922
465923
465924
465925
465926
465927
465928
465929
465930
465931
465932
465933
465934
465935
465936
465937
465938
465939
465940
465941
465942
465943
465944
465945
465946
465947
465948
465949
465950
465951
465952
465953
465954
465955
465956
465957
465958
465959
465960
465961
465962
465963
465964
465965
465966
465967
465968
465969
465970
465971
465972
465973
465974
465975
465976
465977
465978
465979
465980
465981
465982
465983
465984
465985
465986
465987
465988
465989
465990
465991
465992
465993
465994
465995
465996
465997
465998
465999
466000
466001
466002
466003
466004
466005
466006
466007
466008
466009
466010
466011
466012
466013
466014
466015
466016
466017
466018
466019
466020
466021
466022
466023
466024
466025
466026
466027
466028
466029
466030
466031
466032
466033
466034
466035
466036
466037
466038
466039
466040
466041
466042
466043
466044
466045
466046
466047
466048
466049
466050
466051
466052
466053
466054
466055
466056
466057
466058
466059
466060
466061
466062
466063
466064
466065
466066
466067
466068
466069
466070
466071
466072
466073
466074
466075
466076
466077
466078
466079
466080
466081
466082
466083
466084
466085
466086
466087
466088
466089
466090
466091
466092
466093
466094
466095
466096
466097
466098
466099
466100
466101
466102
466103
466104
466105
466106
466107
466108
466109
466110
466111
466112
466113
466114
466115
466116
466117
466118
466119
466120
466121
466122
466123
466124
466125
466126
466127
466128
466129
466130
466131
466132
466133
466134
466135
466136
466137
466138
466139
466140
466141
466142
466143
466144
466145
466146
466147
466148
466149
466150
466151
466152
466153
466154
466155
466156
466157
466158
466159
466160
466161
466162
466163
466164
466165
466166
466167
466168
466169
466170
466171
466172
466173
466174
466175
466176
466177
466178
466179
466180
466181
466182
466183
466184
466185
466186
466187
466188
466189
466190
466191
466192
466193
466194
466195
466196
466197
466198
466199
466200
466201
466202
466203
466204
466205
466206
466207
466208
466209
466210
466211
466212
466213
466214
466215
466216
466217
466218
466219
466220
466221
466222
466223
466224
466225
466226
466227
466228
466229
466230
466231
466232
466233
466234
466235
466236
466237
466238
466239
466240
466241
466242
466243
466244
466245
466246
466247
466248
466249
466250
466251
466252
466253
466254
466255
466256
466257
466258
466259
466260
466261
466262
466263
466264
466265
466266
466267
466268
466269
466270
466271
466272
466273
466274
466275
466276
466277
466278
466279
466280
466281
466282
466283
466284
466285
466286
466287
466288
466289
466290
466291
466292
466293
466294
466295
466296
466297
466298
466299
466300
466301
466302
466303
466304
466305
466306
466307
466308
466309
466310
466311
466312
466313
466314
466315
466316
466317
466318
466319
466320
466321
466322
466323
466324
466325
466326
466327
466328
466329
466330
466331
466332
466333
466334
466335
466336
466337
466338
466339
466340
466341
466342
466343
466344
466345
466346
466347
466348
466349
466350
466351
466352
466353
466354
466355
466356
466357
466358
466359
466360
466361
466362
466363
466364
466365
466366
466367
466368
466369
466370
466371
466372
466373
466374
466375
466376
466377
466378
466379
466380
466381
466382
466383
466384
466385
466386
466387
466388
466389
466390
466391
466392
466393
466394
466395
466396
466397
466398
466399
466400
466401
466402
466403
466404
466405
466406
466407
466408
466409
466410
466411
466412
466413
466414
466415
466416
466417
466418
466419
466420
466421
466422
466423
466424
466425
466426
466427
466428
466429
466430
466431
466432
466433
466434
466435
466436
466437
466438
466439
466440
466441
466442
466443
466444
466445
466446
466447
466448
466449
466450
466451
466452
466453
466454
466455
466456
466457
466458
466459
466460
466461
466462
466463
466464
466465
466466
466467
466468
466469
466470
466471
466472
466473
466474
466475
466476
466477
466478
466479
466480
466481
466482
466483
466484
466485
466486
466487
466488
466489
466490
466491
466492
466493
466494
466495
466496
466497
466498
466499
466500
466501
466502
466503
466504
466505
466506
466507
466508
466509
466510
466511
466512
466513
466514
466515
466516
466517
466518
466519
466520
466521
466522
466523
466524
466525
466526
466527
466528
466529
466530
466531
466532
466533
466534
466535
466536
466537
466538
466539
466540
466541
466542
466543
466544
466545
466546
466547
466548
466549
466550
466551
466552
466553
466554
466555
466556
466557
466558
466559
466560
466561
466562
466563
466564
466565
466566
466567
466568
466569
466570
466571
466572
466573
466574
466575
466576
466577
466578
466579
466580
466581
466582
466583
466584
466585
466586
466587
466588
466589
466590
466591
466592
466593
466594
466595
466596
466597
466598
466599
466600
466601
466602
466603
466604
466605
466606
466607
466608
466609
466610
466611
466612
466613
466614
466615
466616
466617
466618
466619
466620
466621
466622
466623
466624
466625
466626
466627
466628
466629
466630
466631
466632
466633
466634
466635
466636
466637
466638
466639
466640
466641
466642
466643
466644
466645
466646
466647
466648
466649
466650
466651
466652
466653
466654
466655
466656
466657
466658
466659
466660
466661
466662
466663
466664
466665
466666
466667
466668
466669
466670
466671
466672
466673
466674
466675
466676
466677
466678
466679
466680
466681
466682
466683
466684
466685
466686
466687
466688
466689
466690
466691
466692
466693
466694
466695
466696
466697
466698
466699
466700
466701
466702
466703
466704
466705
466706
466707
466708
466709
466710
466711
466712
466713
466714
466715
466716
466717
466718
466719
466720
466721
466722
466723
466724
466725
466726
466727
466728
466729
466730
466731
466732
466733
466734
466735
466736
466737
466738
466739
466740
466741
466742
466743
466744
466745
466746
466747
466748
466749
466750
466751
466752
466753
466754
466755
466756
466757
466758
466759
466760
466761
466762
466763
466764
466765
466766
466767
466768
466769
466770
466771
466772
466773
466774
466775
466776
466777
466778
466779
466780
466781
466782
466783
466784
466785
466786
466787
466788
466789
466790
466791
466792
466793
466794
466795
466796
466797
466798
466799
466800
466801
466802
466803
466804
466805
466806
466807
466808
466809
466810
466811
466812
466813
466814
466815
466816
466817
466818
466819
466820
466821
466822
466823
466824
466825
466826
466827
466828
466829
466830
466831
466832
466833
466834
466835
466836
466837
466838
466839
466840
466841
466842
466843
466844
466845
466846
466847
466848
466849
466850
466851
466852
466853
466854
466855
466856
466857
466858
466859
466860
466861
466862
466863
466864
466865
466866
466867
466868
466869
466870
466871
466872
466873
466874
466875
466876
466877
466878
466879
466880
466881
466882
466883
466884
466885
466886
466887
466888
466889
466890
466891
466892
466893
466894
466895
466896
466897
466898
466899
466900
466901
466902
466903
466904
466905
466906
466907
466908
466909
466910
466911
466912
466913
466914
466915
466916
466917
466918
466919
466920
466921
466922
466923
466924
466925
466926
466927
466928
466929
466930
466931
466932
466933
466934
466935
466936
466937
466938
466939
466940
466941
466942
466943
466944
466945
466946
466947
466948
466949
466950
466951
466952
466953
466954
466955
466956
466957
466958
466959
466960
466961
466962
466963
466964
466965
466966
466967
466968
466969
466970
466971
466972
466973
466974
466975
466976
466977
466978
466979
466980
466981
466982
466983
466984
466985
466986
466987
466988
466989
466990
466991
466992
466993
466994
466995
466996
466997
466998
466999
467000
467001
467002
467003
467004
467005
467006
467007
467008
467009
467010
467011
467012
467013
467014
467015
467016
467017
467018
467019
467020
467021
467022
467023
467024
467025
467026
467027
467028
467029
467030
467031
467032
467033
467034
467035
467036
467037
467038
467039
467040
467041
467042
467043
467044
467045
467046
467047
467048
467049
467050
467051
467052
467053
467054
467055
467056
467057
467058
467059
467060
467061
467062
467063
467064
467065
467066
467067
467068
467069
467070
467071
467072
467073
467074
467075
467076
467077
467078
467079
467080
467081
467082
467083
467084
467085
467086
467087
467088
467089
467090
467091
467092
467093
467094
467095
467096
467097
467098
467099
467100
467101
467102
467103
467104
467105
467106
467107
467108
467109
467110
467111
467112
467113
467114
467115
467116
467117
467118
467119
467120
467121
467122
467123
467124
467125
467126
467127
467128
467129
467130
467131
467132
467133
467134
467135
467136
467137
467138
467139
467140
467141
467142
467143
467144
467145
467146
467147
467148
467149
467150
467151
467152
467153
467154
467155
467156
467157
467158
467159
467160
467161
467162
467163
467164
467165
467166
467167
467168
467169
467170
467171
467172
467173
467174
467175
467176
467177
467178
467179
467180
467181
467182
467183
467184
467185
467186
467187
467188
467189
467190
467191
467192
467193
467194
467195
467196
467197
467198
467199
467200
467201
467202
467203
467204
467205
467206
467207
467208
467209
467210
467211
467212
467213
467214
467215
467216
467217
467218
467219
467220
467221
467222
467223
467224
467225
467226
467227
467228
467229
467230
467231
467232
467233
467234
467235
467236
467237
467238
467239
467240
467241
467242
467243
467244
467245
467246
467247
467248
467249
467250
467251
467252
467253
467254
467255
467256
467257
467258
467259
467260
467261
467262
467263
467264
467265
467266
467267
467268
467269
467270
467271
467272
467273
467274
467275
467276
467277
467278
467279
467280
467281
467282
467283
467284
467285
467286
467287
467288
467289
467290
467291
467292
467293
467294
467295
467296
467297
467298
467299
467300
467301
467302
467303
467304
467305
467306
467307
467308
467309
467310
467311
467312
467313
467314
467315
467316
467317
467318
467319
467320
467321
467322
467323
467324
467325
467326
467327
467328
467329
467330
467331
467332
467333
467334
467335
467336
467337
467338
467339
467340
467341
467342
467343
467344
467345
467346
467347
467348
467349
467350
467351
467352
467353
467354
467355
467356
467357
467358
467359
467360
467361
467362
467363
467364
467365
467366
467367
467368
467369
467370
467371
467372
467373
467374
467375
467376
467377
467378
467379
467380
467381
467382
467383
467384
467385
467386
467387
467388
467389
467390
467391
467392
467393
467394
467395
467396
467397
467398
467399
467400
467401
467402
467403
467404
467405
467406
467407
467408
467409
467410
467411
467412
467413
467414
467415
467416
467417
467418
467419
467420
467421
467422
467423
467424
467425
467426
467427
467428
467429
467430
467431
467432
467433
467434
467435
467436
467437
467438
467439
467440
467441
467442
467443
467444
467445
467446
467447
467448
467449
467450
467451
467452
467453
467454
467455
467456
467457
467458
467459
467460
467461
467462
467463
467464
467465
467466
467467
467468
467469
467470
467471
467472
467473
467474
467475
467476
467477
467478
467479
467480
467481
467482
467483
467484
467485
467486
467487
467488
467489
467490
467491
467492
467493
467494
467495
467496
467497
467498
467499
467500
467501
467502
467503
467504
467505
467506
467507
467508
467509
467510
467511
467512
467513
467514
467515
467516
467517
467518
467519
467520
467521
467522
467523
467524
467525
467526
467527
467528
467529
467530
467531
467532
467533
467534
467535
467536
467537
467538
467539
467540
467541
467542
467543
467544
467545
467546
467547
467548
467549
467550
467551
467552
467553
467554
467555
467556
467557
467558
467559
467560
467561
467562
467563
467564
467565
467566
467567
467568
467569
467570
467571
467572
467573
467574
467575
467576
467577
467578
467579
467580
467581
467582
467583
467584
467585
467586
467587
467588
467589
467590
467591
467592
467593
467594
467595
467596
467597
467598
467599
467600
467601
467602
467603
467604
467605
467606
467607
467608
467609
467610
467611
467612
467613
467614
467615
467616
467617
467618
467619
467620
467621
467622
467623
467624
467625
467626
467627
467628
467629
467630
467631
467632
467633
467634
467635
467636
467637
467638
467639
467640
467641
467642
467643
467644
467645
467646
467647
467648
467649
467650
467651
467652
467653
467654
467655
467656
467657
467658
467659
467660
467661
467662
467663
467664
467665
467666
467667
467668
467669
467670
467671
467672
467673
467674
467675
467676
467677
467678
467679
467680
467681
467682
467683
467684
467685
467686
467687
467688
467689
467690
467691
467692
467693
467694
467695
467696
467697
467698
467699
467700
467701
467702
467703
467704
467705
467706
467707
467708
467709
467710
467711
467712
467713
467714
467715
467716
467717
467718
467719
467720
467721
467722
467723
467724
467725
467726
467727
467728
467729
467730
467731
467732
467733
467734
467735
467736
467737
467738
467739
467740
467741
467742
467743
467744
467745
467746
467747
467748
467749
467750
467751
467752
467753
467754
467755
467756
467757
467758
467759
467760
467761
467762
467763
467764
467765
467766
467767
467768
467769
467770
467771
467772
467773
467774
467775
467776
467777
467778
467779
467780
467781
467782
467783
467784
467785
467786
467787
467788
467789
467790
467791
467792
467793
467794
467795
467796
467797
467798
467799
467800
467801
467802
467803
467804
467805
467806
467807
467808
467809
467810
467811
467812
467813
467814
467815
467816
467817
467818
467819
467820
467821
467822
467823
467824
467825
467826
467827
467828
467829
467830
467831
467832
467833
467834
467835
467836
467837
467838
467839
467840
467841
467842
467843
467844
467845
467846
467847
467848
467849
467850
467851
467852
467853
467854
467855
467856
467857
467858
467859
467860
467861
467862
467863
467864
467865
467866
467867
467868
467869
467870
467871
467872
467873
467874
467875
467876
467877
467878
467879
467880
467881
467882
467883
467884
467885
467886
467887
467888
467889
467890
467891
467892
467893
467894
467895
467896
467897
467898
467899
467900
467901
467902
467903
467904
467905
467906
467907
467908
467909
467910
467911
467912
467913
467914
467915
467916
467917
467918
467919
467920
467921
467922
467923
467924
467925
467926
467927
467928
467929
467930
467931
467932
467933
467934
467935
467936
467937
467938
467939
467940
467941
467942
467943
467944
467945
467946
467947
467948
467949
467950
467951
467952
467953
467954
467955
467956
467957
467958
467959
467960
467961
467962
467963
467964
467965
467966
467967
467968
467969
467970
467971
467972
467973
467974
467975
467976
467977
467978
467979
467980
467981
467982
467983
467984
467985
467986
467987
467988
467989
467990
467991
467992
467993
467994
467995
467996
467997
467998
467999
468000
468001
468002
468003
468004
468005
468006
468007
468008
468009
468010
468011
468012
468013
468014
468015
468016
468017
468018
468019
468020
468021
468022
468023
468024
468025
468026
468027
468028
468029
468030
468031
468032
468033
468034
468035
468036
468037
468038
468039
468040
468041
468042
468043
468044
468045
468046
468047
468048
468049
468050
468051
468052
468053
468054
468055
468056
468057
468058
468059
468060
468061
468062
468063
468064
468065
468066
468067
468068
468069
468070
468071
468072
468073
468074
468075
468076
468077
468078
468079
468080
468081
468082
468083
468084
468085
468086
468087
468088
468089
468090
468091
468092
468093
468094
468095
468096
468097
468098
468099
468100
468101
468102
468103
468104
468105
468106
468107
468108
468109
468110
468111
468112
468113
468114
468115
468116
468117
468118
468119
468120
468121
468122
468123
468124
468125
468126
468127
468128
468129
468130
468131
468132
468133
468134
468135
468136
468137
468138
468139
468140
468141
468142
468143
468144
468145
468146
468147
468148
468149
468150
468151
468152
468153
468154
468155
468156
468157
468158
468159
468160
468161
468162
468163
468164
468165
468166
468167
468168
468169
468170
468171
468172
468173
468174
468175
468176
468177
468178
468179
468180
468181
468182
468183
468184
468185
468186
468187
468188
468189
468190
468191
468192
468193
468194
468195
468196
468197
468198
468199
468200
468201
468202
468203
468204
468205
468206
468207
468208
468209
468210
468211
468212
468213
468214
468215
468216
468217
468218
468219
468220
468221
468222
468223
468224
468225
468226
468227
468228
468229
468230
468231
468232
468233
468234
468235
468236
468237
468238
468239
468240
468241
468242
468243
468244
468245
468246
468247
468248
468249
468250
468251
468252
468253
468254
468255
468256
468257
468258
468259
468260
468261
468262
468263
468264
468265
468266
468267
468268
468269
468270
468271
468272
468273
468274
468275
468276
468277
468278
468279
468280
468281
468282
468283
468284
468285
468286
468287
468288
468289
468290
468291
468292
468293
468294
468295
468296
468297
468298
468299
468300
468301
468302
468303
468304
468305
468306
468307
468308
468309
468310
468311
468312
468313
468314
468315
468316
468317
468318
468319
468320
468321
468322
468323
468324
468325
468326
468327
468328
468329
468330
468331
468332
468333
468334
468335
468336
468337
468338
468339
468340
468341
468342
468343
468344
468345
468346
468347
468348
468349
468350
468351
468352
468353
468354
468355
468356
468357
468358
468359
468360
468361
468362
468363
468364
468365
468366
468367
468368
468369
468370
468371
468372
468373
468374
468375
468376
468377
468378
468379
468380
468381
468382
468383
468384
468385
468386
468387
468388
468389
468390
468391
468392
468393
468394
468395
468396
468397
468398
468399
468400
468401
468402
468403
468404
468405
468406
468407
468408
468409
468410
468411
468412
468413
468414
468415
468416
468417
468418
468419
468420
468421
468422
468423
468424
468425
468426
468427
468428
468429
468430
468431
468432
468433
468434
468435
468436
468437
468438
468439
468440
468441
468442
468443
468444
468445
468446
468447
468448
468449
468450
468451
468452
468453
468454
468455
468456
468457
468458
468459
468460
468461
468462
468463
468464
468465
468466
468467
468468
468469
468470
468471
468472
468473
468474
468475
468476
468477
468478
468479
468480
468481
468482
468483
468484
468485
468486
468487
468488
468489
468490
468491
468492
468493
468494
468495
468496
468497
468498
468499
468500
468501
468502
468503
468504
468505
468506
468507
468508
468509
468510
468511
468512
468513
468514
468515
468516
468517
468518
468519
468520
468521
468522
468523
468524
468525
468526
468527
468528
468529
468530
468531
468532
468533
468534
468535
468536
468537
468538
468539
468540
468541
468542
468543
468544
468545
468546
468547
468548
468549
468550
468551
468552
468553
468554
468555
468556
468557
468558
468559
468560
468561
468562
468563
468564
468565
468566
468567
468568
468569
468570
468571
468572
468573
468574
468575
468576
468577
468578
468579
468580
468581
468582
468583
468584
468585
468586
468587
468588
468589
468590
468591
468592
468593
468594
468595
468596
468597
468598
468599
468600
468601
468602
468603
468604
468605
468606
468607
468608
468609
468610
468611
468612
468613
468614
468615
468616
468617
468618
468619
468620
468621
468622
468623
468624
468625
468626
468627
468628
468629
468630
468631
468632
468633
468634
468635
468636
468637
468638
468639
468640
468641
468642
468643
468644
468645
468646
468647
468648
468649
468650
468651
468652
468653
468654
468655
468656
468657
468658
468659
468660
468661
468662
468663
468664
468665
468666
468667
468668
468669
468670
468671
468672
468673
468674
468675
468676
468677
468678
468679
468680
468681
468682
468683
468684
468685
468686
468687
468688
468689
468690
468691
468692
468693
468694
468695
468696
468697
468698
468699
468700
468701
468702
468703
468704
468705
468706
468707
468708
468709
468710
468711
468712
468713
468714
468715
468716
468717
468718
468719
468720
468721
468722
468723
468724
468725
468726
468727
468728
468729
468730
468731
468732
468733
468734
468735
468736
468737
468738
468739
468740
468741
468742
468743
468744
468745
468746
468747
468748
468749
468750
468751
468752
468753
468754
468755
468756
468757
468758
468759
468760
468761
468762
468763
468764
468765
468766
468767
468768
468769
468770
468771
468772
468773
468774
468775
468776
468777
468778
468779
468780
468781
468782
468783
468784
468785
468786
468787
468788
468789
468790
468791
468792
468793
468794
468795
468796
468797
468798
468799
468800
468801
468802
468803
468804
468805
468806
468807
468808
468809
468810
468811
468812
468813
468814
468815
468816
468817
468818
468819
468820
468821
468822
468823
468824
468825
468826
468827
468828
468829
468830
468831
468832
468833
468834
468835
468836
468837
468838
468839
468840
468841
468842
468843
468844
468845
468846
468847
468848
468849
468850
468851
468852
468853
468854
468855
468856
468857
468858
468859
468860
468861
468862
468863
468864
468865
468866
468867
468868
468869
468870
468871
468872
468873
468874
468875
468876
468877
468878
468879
468880
468881
468882
468883
468884
468885
468886
468887
468888
468889
468890
468891
468892
468893
468894
468895
468896
468897
468898
468899
468900
468901
468902
468903
468904
468905
468906
468907
468908
468909
468910
468911
468912
468913
468914
468915
468916
468917
468918
468919
468920
468921
468922
468923
468924
468925
468926
468927
468928
468929
468930
468931
468932
468933
468934
468935
468936
468937
468938
468939
468940
468941
468942
468943
468944
468945
468946
468947
468948
468949
468950
468951
468952
468953
468954
468955
468956
468957
468958
468959
468960
468961
468962
468963
468964
468965
468966
468967
468968
468969
468970
468971
468972
468973
468974
468975
468976
468977
468978
468979
468980
468981
468982
468983
468984
468985
468986
468987
468988
468989
468990
468991
468992
468993
468994
468995
468996
468997
468998
468999
469000
469001
469002
469003
469004
469005
469006
469007
469008
469009
469010
469011
469012
469013
469014
469015
469016
469017
469018
469019
469020
469021
469022
469023
469024
469025
469026
469027
469028
469029
469030
469031
469032
469033
469034
469035
469036
469037
469038
469039
469040
469041
469042
469043
469044
469045
469046
469047
469048
469049
469050
469051
469052
469053
469054
469055
469056
469057
469058
469059
469060
469061
469062
469063
469064
469065
469066
469067
469068
469069
469070
469071
469072
469073
469074
469075
469076
469077
469078
469079
469080
469081
469082
469083
469084
469085
469086
469087
469088
469089
469090
469091
469092
469093
469094
469095
469096
469097
469098
469099
469100
469101
469102
469103
469104
469105
469106
469107
469108
469109
469110
469111
469112
469113
469114
469115
469116
469117
469118
469119
469120
469121
469122
469123
469124
469125
469126
469127
469128
469129
469130
469131
469132
469133
469134
469135
469136
469137
469138
469139
469140
469141
469142
469143
469144
469145
469146
469147
469148
469149
469150
469151
469152
469153
469154
469155
469156
469157
469158
469159
469160
469161
469162
469163
469164
469165
469166
469167
469168
469169
469170
469171
469172
469173
469174
469175
469176
469177
469178
469179
469180
469181
469182
469183
469184
469185
469186
469187
469188
469189
469190
469191
469192
469193
469194
469195
469196
469197
469198
469199
469200
469201
469202
469203
469204
469205
469206
469207
469208
469209
469210
469211
469212
469213
469214
469215
469216
469217
469218
469219
469220
469221
469222
469223
469224
469225
469226
469227
469228
469229
469230
469231
469232
469233
469234
469235
469236
469237
469238
469239
469240
469241
469242
469243
469244
469245
469246
469247
469248
469249
469250
469251
469252
469253
469254
469255
469256
469257
469258
469259
469260
469261
469262
469263
469264
469265
469266
469267
469268
469269
469270
469271
469272
469273
469274
469275
469276
469277
469278
469279
469280
469281
469282
469283
469284
469285
469286
469287
469288
469289
469290
469291
469292
469293
469294
469295
469296
469297
469298
469299
469300
469301
469302
469303
469304
469305
469306
469307
469308
469309
469310
469311
469312
469313
469314
469315
469316
469317
469318
469319
469320
469321
469322
469323
469324
469325
469326
469327
469328
469329
469330
469331
469332
469333
469334
469335
469336
469337
469338
469339
469340
469341
469342
469343
469344
469345
469346
469347
469348
469349
469350
469351
469352
469353
469354
469355
469356
469357
469358
469359
469360
469361
469362
469363
469364
469365
469366
469367
469368
469369
469370
469371
469372
469373
469374
469375
469376
469377
469378
469379
469380
469381
469382
469383
469384
469385
469386
469387
469388
469389
469390
469391
469392
469393
469394
469395
469396
469397
469398
469399
469400
469401
469402
469403
469404
469405
469406
469407
469408
469409
469410
469411
469412
469413
469414
469415
469416
469417
469418
469419
469420
469421
469422
469423
469424
469425
469426
469427
469428
469429
469430
469431
469432
469433
469434
469435
469436
469437
469438
469439
469440
469441
469442
469443
469444
469445
469446
469447
469448
469449
469450
469451
469452
469453
469454
469455
469456
469457
469458
469459
469460
469461
469462
469463
469464
469465
469466
469467
469468
469469
469470
469471
469472
469473
469474
469475
469476
469477
469478
469479
469480
469481
469482
469483
469484
469485
469486
469487
469488
469489
469490
469491
469492
469493
469494
469495
469496
469497
469498
469499
469500
469501
469502
469503
469504
469505
469506
469507
469508
469509
469510
469511
469512
469513
469514
469515
469516
469517
469518
469519
469520
469521
469522
469523
469524
469525
469526
469527
469528
469529
469530
469531
469532
469533
469534
469535
469536
469537
469538
469539
469540
469541
469542
469543
469544
469545
469546
469547
469548
469549
469550
469551
469552
469553
469554
469555
469556
469557
469558
469559
469560
469561
469562
469563
469564
469565
469566
469567
469568
469569
469570
469571
469572
469573
469574
469575
469576
469577
469578
469579
469580
469581
469582
469583
469584
469585
469586
469587
469588
469589
469590
469591
469592
469593
469594
469595
469596
469597
469598
469599
469600
469601
469602
469603
469604
469605
469606
469607
469608
469609
469610
469611
469612
469613
469614
469615
469616
469617
469618
469619
469620
469621
469622
469623
469624
469625
469626
469627
469628
469629
469630
469631
469632
469633
469634
469635
469636
469637
469638
469639
469640
469641
469642
469643
469644
469645
469646
469647
469648
469649
469650
469651
469652
469653
469654
469655
469656
469657
469658
469659
469660
469661
469662
469663
469664
469665
469666
469667
469668
469669
469670
469671
469672
469673
469674
469675
469676
469677
469678
469679
469680
469681
469682
469683
469684
469685
469686
469687
469688
469689
469690
469691
469692
469693
469694
469695
469696
469697
469698
469699
469700
469701
469702
469703
469704
469705
469706
469707
469708
469709
469710
469711
469712
469713
469714
469715
469716
469717
469718
469719
469720
469721
469722
469723
469724
469725
469726
469727
469728
469729
469730
469731
469732
469733
469734
469735
469736
469737
469738
469739
469740
469741
469742
469743
469744
469745
469746
469747
469748
469749
469750
469751
469752
469753
469754
469755
469756
469757
469758
469759
469760
469761
469762
469763
469764
469765
469766
469767
469768
469769
469770
469771
469772
469773
469774
469775
469776
469777
469778
469779
469780
469781
469782
469783
469784
469785
469786
469787
469788
469789
469790
469791
469792
469793
469794
469795
469796
469797
469798
469799
469800
469801
469802
469803
469804
469805
469806
469807
469808
469809
469810
469811
469812
469813
469814
469815
469816
469817
469818
469819
469820
469821
469822
469823
469824
469825
469826
469827
469828
469829
469830
469831
469832
469833
469834
469835
469836
469837
469838
469839
469840
469841
469842
469843
469844
469845
469846
469847
469848
469849
469850
469851
469852
469853
469854
469855
469856
469857
469858
469859
469860
469861
469862
469863
469864
469865
469866
469867
469868
469869
469870
469871
469872
469873
469874
469875
469876
469877
469878
469879
469880
469881
469882
469883
469884
469885
469886
469887
469888
469889
469890
469891
469892
469893
469894
469895
469896
469897
469898
469899
469900
469901
469902
469903
469904
469905
469906
469907
469908
469909
469910
469911
469912
469913
469914
469915
469916
469917
469918
469919
469920
469921
469922
469923
469924
469925
469926
469927
469928
469929
469930
469931
469932
469933
469934
469935
469936
469937
469938
469939
469940
469941
469942
469943
469944
469945
469946
469947
469948
469949
469950
469951
469952
469953
469954
469955
469956
469957
469958
469959
469960
469961
469962
469963
469964
469965
469966
469967
469968
469969
469970
469971
469972
469973
469974
469975
469976
469977
469978
469979
469980
469981
469982
469983
469984
469985
469986
469987
469988
469989
469990
469991
469992
469993
469994
469995
469996
469997
469998
469999
470000
470001
470002
470003
470004
470005
470006
470007
470008
470009
470010
470011
470012
470013
470014
470015
470016
470017
470018
470019
470020
470021
470022
470023
470024
470025
470026
470027
470028
470029
470030
470031
470032
470033
470034
470035
470036
470037
470038
470039
470040
470041
470042
470043
470044
470045
470046
470047
470048
470049
470050
470051
470052
470053
470054
470055
470056
470057
470058
470059
470060
470061
470062
470063
470064
470065
470066
470067
470068
470069
470070
470071
470072
470073
470074
470075
470076
470077
470078
470079
470080
470081
470082
470083
470084
470085
470086
470087
470088
470089
470090
470091
470092
470093
470094
470095
470096
470097
470098
470099
470100
470101
470102
470103
470104
470105
470106
470107
470108
470109
470110
470111
470112
470113
470114
470115
470116
470117
470118
470119
470120
470121
470122
470123
470124
470125
470126
470127
470128
470129
470130
470131
470132
470133
470134
470135
470136
470137
470138
470139
470140
470141
470142
470143
470144
470145
470146
470147
470148
470149
470150
470151
470152
470153
470154
470155
470156
470157
470158
470159
470160
470161
470162
470163
470164
470165
470166
470167
470168
470169
470170
470171
470172
470173
470174
470175
470176
470177
470178
470179
470180
470181
470182
470183
470184
470185
470186
470187
470188
470189
470190
470191
470192
470193
470194
470195
470196
470197
470198
470199
470200
470201
470202
470203
470204
470205
470206
470207
470208
470209
470210
470211
470212
470213
470214
470215
470216
470217
470218
470219
470220
470221
470222
470223
470224
470225
470226
470227
470228
470229
470230
470231
470232
470233
470234
470235
470236
470237
470238
470239
470240
470241
470242
470243
470244
470245
470246
470247
470248
470249
470250
470251
470252
470253
470254
470255
470256
470257
470258
470259
470260
470261
470262
470263
470264
470265
470266
470267
470268
470269
470270
470271
470272
470273
470274
470275
470276
470277
470278
470279
470280
470281
470282
470283
470284
470285
470286
470287
470288
470289
470290
470291
470292
470293
470294
470295
470296
470297
470298
470299
470300
470301
470302
470303
470304
470305
470306
470307
470308
470309
470310
470311
470312
470313
470314
470315
470316
470317
470318
470319
470320
470321
470322
470323
470324
470325
470326
470327
470328
470329
470330
470331
470332
470333
470334
470335
470336
470337
470338
470339
470340
470341
470342
470343
470344
470345
470346
470347
470348
470349
470350
470351
470352
470353
470354
470355
470356
470357
470358
470359
470360
470361
470362
470363
470364
470365
470366
470367
470368
470369
470370
470371
470372
470373
470374
470375
470376
470377
470378
470379
470380
470381
470382
470383
470384
470385
470386
470387
470388
470389
470390
470391
470392
470393
470394
470395
470396
470397
470398
470399
470400
470401
470402
470403
470404
470405
470406
470407
470408
470409
470410
470411
470412
470413
470414
470415
470416
470417
470418
470419
470420
470421
470422
470423
470424
470425
470426
470427
470428
470429
470430
470431
470432
470433
470434
470435
470436
470437
470438
470439
470440
470441
470442
470443
470444
470445
470446
470447
470448
470449
470450
470451
470452
470453
470454
470455
470456
470457
470458
470459
470460
470461
470462
470463
470464
470465
470466
470467
470468
470469
470470
470471
470472
470473
470474
470475
470476
470477
470478
470479
470480
470481
470482
470483
470484
470485
470486
470487
470488
470489
470490
470491
470492
470493
470494
470495
470496
470497
470498
470499
470500
470501
470502
470503
470504
470505
470506
470507
470508
470509
470510
470511
470512
470513
470514
470515
470516
470517
470518
470519
470520
470521
470522
470523
470524
470525
470526
470527
470528
470529
470530
470531
470532
470533
470534
470535
470536
470537
470538
470539
470540
470541
470542
470543
470544
470545
470546
470547
470548
470549
470550
470551
470552
470553
470554
470555
470556
470557
470558
470559
470560
470561
470562
470563
470564
470565
470566
470567
470568
470569
470570
470571
470572
470573
470574
470575
470576
470577
470578
470579
470580
470581
470582
470583
470584
470585
470586
470587
470588
470589
470590
470591
470592
470593
470594
470595
470596
470597
470598
470599
470600
470601
470602
470603
470604
470605
470606
470607
470608
470609
470610
470611
470612
470613
470614
470615
470616
470617
470618
470619
470620
470621
470622
470623
470624
470625
470626
470627
470628
470629
470630
470631
470632
470633
470634
470635
470636
470637
470638
470639
470640
470641
470642
470643
470644
470645
470646
470647
470648
470649
470650
470651
470652
470653
470654
470655
470656
470657
470658
470659
470660
470661
470662
470663
470664
470665
470666
470667
470668
470669
470670
470671
470672
470673
470674
470675
470676
470677
470678
470679
470680
470681
470682
470683
470684
470685
470686
470687
470688
470689
470690
470691
470692
470693
470694
470695
470696
470697
470698
470699
470700
470701
470702
470703
470704
470705
470706
470707
470708
470709
470710
470711
470712
470713
470714
470715
470716
470717
470718
470719
470720
470721
470722
470723
470724
470725
470726
470727
470728
470729
470730
470731
470732
470733
470734
470735
470736
470737
470738
470739
470740
470741
470742
470743
470744
470745
470746
470747
470748
470749
470750
470751
470752
470753
470754
470755
470756
470757
470758
470759
470760
470761
470762
470763
470764
470765
470766
470767
470768
470769
470770
470771
470772
470773
470774
470775
470776
470777
470778
470779
470780
470781
470782
470783
470784
470785
470786
470787
470788
470789
470790
470791
470792
470793
470794
470795
470796
470797
470798
470799
470800
470801
470802
470803
470804
470805
470806
470807
470808
470809
470810
470811
470812
470813
470814
470815
470816
470817
470818
470819
470820
470821
470822
470823
470824
470825
470826
470827
470828
470829
470830
470831
470832
470833
470834
470835
470836
470837
470838
470839
470840
470841
470842
470843
470844
470845
470846
470847
470848
470849
470850
470851
470852
470853
470854
470855
470856
470857
470858
470859
470860
470861
470862
470863
470864
470865
470866
470867
470868
470869
470870
470871
470872
470873
470874
470875
470876
470877
470878
470879
470880
470881
470882
470883
470884
470885
470886
470887
470888
470889
470890
470891
470892
470893
470894
470895
470896
470897
470898
470899
470900
470901
470902
470903
470904
470905
470906
470907
470908
470909
470910
470911
470912
470913
470914
470915
470916
470917
470918
470919
470920
470921
470922
470923
470924
470925
470926
470927
470928
470929
470930
470931
470932
470933
470934
470935
470936
470937
470938
470939
470940
470941
470942
470943
470944
470945
470946
470947
470948
470949
470950
470951
470952
470953
470954
470955
470956
470957
470958
470959
470960
470961
470962
470963
470964
470965
470966
470967
470968
470969
470970
470971
470972
470973
470974
470975
470976
470977
470978
470979
470980
470981
470982
470983
470984
470985
470986
470987
470988
470989
470990
470991
470992
470993
470994
470995
470996
470997
470998
470999
471000
471001
471002
471003
471004
471005
471006
471007
471008
471009
471010
471011
471012
471013
471014
471015
471016
471017
471018
471019
471020
471021
471022
471023
471024
471025
471026
471027
471028
471029
471030
471031
471032
471033
471034
471035
471036
471037
471038
471039
471040
471041
471042
471043
471044
471045
471046
471047
471048
471049
471050
471051
471052
471053
471054
471055
471056
471057
471058
471059
471060
471061
471062
471063
471064
471065
471066
471067
471068
471069
471070
471071
471072
471073
471074
471075
471076
471077
471078
471079
471080
471081
471082
471083
471084
471085
471086
471087
471088
471089
471090
471091
471092
471093
471094
471095
471096
471097
471098
471099
471100
471101
471102
471103
471104
471105
471106
471107
471108
471109
471110
471111
471112
471113
471114
471115
471116
471117
471118
471119
471120
471121
471122
471123
471124
471125
471126
471127
471128
471129
471130
471131
471132
471133
471134
471135
471136
471137
471138
471139
471140
471141
471142
471143
471144
471145
471146
471147
471148
471149
471150
471151
471152
471153
471154
471155
471156
471157
471158
471159
471160
471161
471162
471163
471164
471165
471166
471167
471168
471169
471170
471171
471172
471173
471174
471175
471176
471177
471178
471179
471180
471181
471182
471183
471184
471185
471186
471187
471188
471189
471190
471191
471192
471193
471194
471195
471196
471197
471198
471199
471200
471201
471202
471203
471204
471205
471206
471207
471208
471209
471210
471211
471212
471213
471214
471215
471216
471217
471218
471219
471220
471221
471222
471223
471224
471225
471226
471227
471228
471229
471230
471231
471232
471233
471234
471235
471236
471237
471238
471239
471240
471241
471242
471243
471244
471245
471246
471247
471248
471249
471250
471251
471252
471253
471254
471255
471256
471257
471258
471259
471260
471261
471262
471263
471264
471265
471266
471267
471268
471269
471270
471271
471272
471273
471274
471275
471276
471277
471278
471279
471280
471281
471282
471283
471284
471285
471286
471287
471288
471289
471290
471291
471292
471293
471294
471295
471296
471297
471298
471299
471300
471301
471302
471303
471304
471305
471306
471307
471308
471309
471310
471311
471312
471313
471314
471315
471316
471317
471318
471319
471320
471321
471322
471323
471324
471325
471326
471327
471328
471329
471330
471331
471332
471333
471334
471335
471336
471337
471338
471339
471340
471341
471342
471343
471344
471345
471346
471347
471348
471349
471350
471351
471352
471353
471354
471355
471356
471357
471358
471359
471360
471361
471362
471363
471364
471365
471366
471367
471368
471369
471370
471371
471372
471373
471374
471375
471376
471377
471378
471379
471380
471381
471382
471383
471384
471385
471386
471387
471388
471389
471390
471391
471392
471393
471394
471395
471396
471397
471398
471399
471400
471401
471402
471403
471404
471405
471406
471407
471408
471409
471410
471411
471412
471413
471414
471415
471416
471417
471418
471419
471420
471421
471422
471423
471424
471425
471426
471427
471428
471429
471430
471431
471432
471433
471434
471435
471436
471437
471438
471439
471440
471441
471442
471443
471444
471445
471446
471447
471448
471449
471450
471451
471452
471453
471454
471455
471456
471457
471458
471459
471460
471461
471462
471463
471464
471465
471466
471467
471468
471469
471470
471471
471472
471473
471474
471475
471476
471477
471478
471479
471480
471481
471482
471483
471484
471485
471486
471487
471488
471489
471490
471491
471492
471493
471494
471495
471496
471497
471498
471499
471500
471501
471502
471503
471504
471505
471506
471507
471508
471509
471510
471511
471512
471513
471514
471515
471516
471517
471518
471519
471520
471521
471522
471523
471524
471525
471526
471527
471528
471529
471530
471531
471532
471533
471534
471535
471536
471537
471538
471539
471540
471541
471542
471543
471544
471545
471546
471547
471548
471549
471550
471551
471552
471553
471554
471555
471556
471557
471558
471559
471560
471561
471562
471563
471564
471565
471566
471567
471568
471569
471570
471571
471572
471573
471574
471575
471576
471577
471578
471579
471580
471581
471582
471583
471584
471585
471586
471587
471588
471589
471590
471591
471592
471593
471594
471595
471596
471597
471598
471599
471600
471601
471602
471603
471604
471605
471606
471607
471608
471609
471610
471611
471612
471613
471614
471615
471616
471617
471618
471619
471620
471621
471622
471623
471624
471625
471626
471627
471628
471629
471630
471631
471632
471633
471634
471635
471636
471637
471638
471639
471640
471641
471642
471643
471644
471645
471646
471647
471648
471649
471650
471651
471652
471653
471654
471655
471656
471657
471658
471659
471660
471661
471662
471663
471664
471665
471666
471667
471668
471669
471670
471671
471672
471673
471674
471675
471676
471677
471678
471679
471680
471681
471682
471683
471684
471685
471686
471687
471688
471689
471690
471691
471692
471693
471694
471695
471696
471697
471698
471699
471700
471701
471702
471703
471704
471705
471706
471707
471708
471709
471710
471711
471712
471713
471714
471715
471716
471717
471718
471719
471720
471721
471722
471723
471724
471725
471726
471727
471728
471729
471730
471731
471732
471733
471734
471735
471736
471737
471738
471739
471740
471741
471742
471743
471744
471745
471746
471747
471748
471749
471750
471751
471752
471753
471754
471755
471756
471757
471758
471759
471760
471761
471762
471763
471764
471765
471766
471767
471768
471769
471770
471771
471772
471773
471774
471775
471776
471777
471778
471779
471780
471781
471782
471783
471784
471785
471786
471787
471788
471789
471790
471791
471792
471793
471794
471795
471796
471797
471798
471799
471800
471801
471802
471803
471804
471805
471806
471807
471808
471809
471810
471811
471812
471813
471814
471815
471816
471817
471818
471819
471820
471821
471822
471823
471824
471825
471826
471827
471828
471829
471830
471831
471832
471833
471834
471835
471836
471837
471838
471839
471840
471841
471842
471843
471844
471845
471846
471847
471848
471849
471850
471851
471852
471853
471854
471855
471856
471857
471858
471859
471860
471861
471862
471863
471864
471865
471866
471867
471868
471869
471870
471871
471872
471873
471874
471875
471876
471877
471878
471879
471880
471881
471882
471883
471884
471885
471886
471887
471888
471889
471890
471891
471892
471893
471894
471895
471896
471897
471898
471899
471900
471901
471902
471903
471904
471905
471906
471907
471908
471909
471910
471911
471912
471913
471914
471915
471916
471917
471918
471919
471920
471921
471922
471923
471924
471925
471926
471927
471928
471929
471930
471931
471932
471933
471934
471935
471936
471937
471938
471939
471940
471941
471942
471943
471944
471945
471946
471947
471948
471949
471950
471951
471952
471953
471954
471955
471956
471957
471958
471959
471960
471961
471962
471963
471964
471965
471966
471967
471968
471969
471970
471971
471972
471973
471974
471975
471976
471977
471978
471979
471980
471981
471982
471983
471984
471985
471986
471987
471988
471989
471990
471991
471992
471993
471994
471995
471996
471997
471998
471999
472000
472001
472002
472003
472004
472005
472006
472007
472008
472009
472010
472011
472012
472013
472014
472015
472016
472017
472018
472019
472020
472021
472022
472023
472024
472025
472026
472027
472028
472029
472030
472031
472032
472033
472034
472035
472036
472037
472038
472039
472040
472041
472042
472043
472044
472045
472046
472047
472048
472049
472050
472051
472052
472053
472054
472055
472056
472057
472058
472059
472060
472061
472062
472063
472064
472065
472066
472067
472068
472069
472070
472071
472072
472073
472074
472075
472076
472077
472078
472079
472080
472081
472082
472083
472084
472085
472086
472087
472088
472089
472090
472091
472092
472093
472094
472095
472096
472097
472098
472099
472100
472101
472102
472103
472104
472105
472106
472107
472108
472109
472110
472111
472112
472113
472114
472115
472116
472117
472118
472119
472120
472121
472122
472123
472124
472125
472126
472127
472128
472129
472130
472131
472132
472133
472134
472135
472136
472137
472138
472139
472140
472141
472142
472143
472144
472145
472146
472147
472148
472149
472150
472151
472152
472153
472154
472155
472156
472157
472158
472159
472160
472161
472162
472163
472164
472165
472166
472167
472168
472169
472170
472171
472172
472173
472174
472175
472176
472177
472178
472179
472180
472181
472182
472183
472184
472185
472186
472187
472188
472189
472190
472191
472192
472193
472194
472195
472196
472197
472198
472199
472200
472201
472202
472203
472204
472205
472206
472207
472208
472209
472210
472211
472212
472213
472214
472215
472216
472217
472218
472219
472220
472221
472222
472223
472224
472225
472226
472227
472228
472229
472230
472231
472232
472233
472234
472235
472236
472237
472238
472239
472240
472241
472242
472243
472244
472245
472246
472247
472248
472249
472250
472251
472252
472253
472254
472255
472256
472257
472258
472259
472260
472261
472262
472263
472264
472265
472266
472267
472268
472269
472270
472271
472272
472273
472274
472275
472276
472277
472278
472279
472280
472281
472282
472283
472284
472285
472286
472287
472288
472289
472290
472291
472292
472293
472294
472295
472296
472297
472298
472299
472300
472301
472302
472303
472304
472305
472306
472307
472308
472309
472310
472311
472312
472313
472314
472315
472316
472317
472318
472319
472320
472321
472322
472323
472324
472325
472326
472327
472328
472329
472330
472331
472332
472333
472334
472335
472336
472337
472338
472339
472340
472341
472342
472343
472344
472345
472346
472347
472348
472349
472350
472351
472352
472353
472354
472355
472356
472357
472358
472359
472360
472361
472362
472363
472364
472365
472366
472367
472368
472369
472370
472371
472372
472373
472374
472375
472376
472377
472378
472379
472380
472381
472382
472383
472384
472385
472386
472387
472388
472389
472390
472391
472392
472393
472394
472395
472396
472397
472398
472399
472400
472401
472402
472403
472404
472405
472406
472407
472408
472409
472410
472411
472412
472413
472414
472415
472416
472417
472418
472419
472420
472421
472422
472423
472424
472425
472426
472427
472428
472429
472430
472431
472432
472433
472434
472435
472436
472437
472438
472439
472440
472441
472442
472443
472444
472445
472446
472447
472448
472449
472450
472451
472452
472453
472454
472455
472456
472457
472458
472459
472460
472461
472462
472463
472464
472465
472466
472467
472468
472469
472470
472471
472472
472473
472474
472475
472476
472477
472478
472479
472480
472481
472482
472483
472484
472485
472486
472487
472488
472489
472490
472491
472492
472493
472494
472495
472496
472497
472498
472499
472500
472501
472502
472503
472504
472505
472506
472507
472508
472509
472510
472511
472512
472513
472514
472515
472516
472517
472518
472519
472520
472521
472522
472523
472524
472525
472526
472527
472528
472529
472530
472531
472532
472533
472534
472535
472536
472537
472538
472539
472540
472541
472542
472543
472544
472545
472546
472547
472548
472549
472550
472551
472552
472553
472554
472555
472556
472557
472558
472559
472560
472561
472562
472563
472564
472565
472566
472567
472568
472569
472570
472571
472572
472573
472574
472575
472576
472577
472578
472579
472580
472581
472582
472583
472584
472585
472586
472587
472588
472589
472590
472591
472592
472593
472594
472595
472596
472597
472598
472599
472600
472601
472602
472603
472604
472605
472606
472607
472608
472609
472610
472611
472612
472613
472614
472615
472616
472617
472618
472619
472620
472621
472622
472623
472624
472625
472626
472627
472628
472629
472630
472631
472632
472633
472634
472635
472636
472637
472638
472639
472640
472641
472642
472643
472644
472645
472646
472647
472648
472649
472650
472651
472652
472653
472654
472655
472656
472657
472658
472659
472660
472661
472662
472663
472664
472665
472666
472667
472668
472669
472670
472671
472672
472673
472674
472675
472676
472677
472678
472679
472680
472681
472682
472683
472684
472685
472686
472687
472688
472689
472690
472691
472692
472693
472694
472695
472696
472697
472698
472699
472700
472701
472702
472703
472704
472705
472706
472707
472708
472709
472710
472711
472712
472713
472714
472715
472716
472717
472718
472719
472720
472721
472722
472723
472724
472725
472726
472727
472728
472729
472730
472731
472732
472733
472734
472735
472736
472737
472738
472739
472740
472741
472742
472743
472744
472745
472746
472747
472748
472749
472750
472751
472752
472753
472754
472755
472756
472757
472758
472759
472760
472761
472762
472763
472764
472765
472766
472767
472768
472769
472770
472771
472772
472773
472774
472775
472776
472777
472778
472779
472780
472781
472782
472783
472784
472785
472786
472787
472788
472789
472790
472791
472792
472793
472794
472795
472796
472797
472798
472799
472800
472801
472802
472803
472804
472805
472806
472807
472808
472809
472810
472811
472812
472813
472814
472815
472816
472817
472818
472819
472820
472821
472822
472823
472824
472825
472826
472827
472828
472829
472830
472831
472832
472833
472834
472835
472836
472837
472838
472839
472840
472841
472842
472843
472844
472845
472846
472847
472848
472849
472850
472851
472852
472853
472854
472855
472856
472857
472858
472859
472860
472861
472862
472863
472864
472865
472866
472867
472868
472869
472870
472871
472872
472873
472874
472875
472876
472877
472878
472879
472880
472881
472882
472883
472884
472885
472886
472887
472888
472889
472890
472891
472892
472893
472894
472895
472896
472897
472898
472899
472900
472901
472902
472903
472904
472905
472906
472907
472908
472909
472910
472911
472912
472913
472914
472915
472916
472917
472918
472919
472920
472921
472922
472923
472924
472925
472926
472927
472928
472929
472930
472931
472932
472933
472934
472935
472936
472937
472938
472939
472940
472941
472942
472943
472944
472945
472946
472947
472948
472949
472950
472951
472952
472953
472954
472955
472956
472957
472958
472959
472960
472961
472962
472963
472964
472965
472966
472967
472968
472969
472970
472971
472972
472973
472974
472975
472976
472977
472978
472979
472980
472981
472982
472983
472984
472985
472986
472987
472988
472989
472990
472991
472992
472993
472994
472995
472996
472997
472998
472999
473000
473001
473002
473003
473004
473005
473006
473007
473008
473009
473010
473011
473012
473013
473014
473015
473016
473017
473018
473019
473020
473021
473022
473023
473024
473025
473026
473027
473028
473029
473030
473031
473032
473033
473034
473035
473036
473037
473038
473039
473040
473041
473042
473043
473044
473045
473046
473047
473048
473049
473050
473051
473052
473053
473054
473055
473056
473057
473058
473059
473060
473061
473062
473063
473064
473065
473066
473067
473068
473069
473070
473071
473072
473073
473074
473075
473076
473077
473078
473079
473080
473081
473082
473083
473084
473085
473086
473087
473088
473089
473090
473091
473092
473093
473094
473095
473096
473097
473098
473099
473100
473101
473102
473103
473104
473105
473106
473107
473108
473109
473110
473111
473112
473113
473114
473115
473116
473117
473118
473119
473120
473121
473122
473123
473124
473125
473126
473127
473128
473129
473130
473131
473132
473133
473134
473135
473136
473137
473138
473139
473140
473141
473142
473143
473144
473145
473146
473147
473148
473149
473150
473151
473152
473153
473154
473155
473156
473157
473158
473159
473160
473161
473162
473163
473164
473165
473166
473167
473168
473169
473170
473171
473172
473173
473174
473175
473176
473177
473178
473179
473180
473181
473182
473183
473184
473185
473186
473187
473188
473189
473190
473191
473192
473193
473194
473195
473196
473197
473198
473199
473200
473201
473202
473203
473204
473205
473206
473207
473208
473209
473210
473211
473212
473213
473214
473215
473216
473217
473218
473219
473220
473221
473222
473223
473224
473225
473226
473227
473228
473229
473230
473231
473232
473233
473234
473235
473236
473237
473238
473239
473240
473241
473242
473243
473244
473245
473246
473247
473248
473249
473250
473251
473252
473253
473254
473255
473256
473257
473258
473259
473260
473261
473262
473263
473264
473265
473266
473267
473268
473269
473270
473271
473272
473273
473274
473275
473276
473277
473278
473279
473280
473281
473282
473283
473284
473285
473286
473287
473288
473289
473290
473291
473292
473293
473294
473295
473296
473297
473298
473299
473300
473301
473302
473303
473304
473305
473306
473307
473308
473309
473310
473311
473312
473313
473314
473315
473316
473317
473318
473319
473320
473321
473322
473323
473324
473325
473326
473327
473328
473329
473330
473331
473332
473333
473334
473335
473336
473337
473338
473339
473340
473341
473342
473343
473344
473345
473346
473347
473348
473349
473350
473351
473352
473353
473354
473355
473356
473357
473358
473359
473360
473361
473362
473363
473364
473365
473366
473367
473368
473369
473370
473371
473372
473373
473374
473375
473376
473377
473378
473379
473380
473381
473382
473383
473384
473385
473386
473387
473388
473389
473390
473391
473392
473393
473394
473395
473396
473397
473398
473399
473400
473401
473402
473403
473404
473405
473406
473407
473408
473409
473410
473411
473412
473413
473414
473415
473416
473417
473418
473419
473420
473421
473422
473423
473424
473425
473426
473427
473428
473429
473430
473431
473432
473433
473434
473435
473436
473437
473438
473439
473440
473441
473442
473443
473444
473445
473446
473447
473448
473449
473450
473451
473452
473453
473454
473455
473456
473457
473458
473459
473460
473461
473462
473463
473464
473465
473466
473467
473468
473469
473470
473471
473472
473473
473474
473475
473476
473477
473478
473479
473480
473481
473482
473483
473484
473485
473486
473487
473488
473489
473490
473491
473492
473493
473494
473495
473496
473497
473498
473499
473500
473501
473502
473503
473504
473505
473506
473507
473508
473509
473510
473511
473512
473513
473514
473515
473516
473517
473518
473519
473520
473521
473522
473523
473524
473525
473526
473527
473528
473529
473530
473531
473532
473533
473534
473535
473536
473537
473538
473539
473540
473541
473542
473543
473544
473545
473546
473547
473548
473549
473550
473551
473552
473553
473554
473555
473556
473557
473558
473559
473560
473561
473562
473563
473564
473565
473566
473567
473568
473569
473570
473571
473572
473573
473574
473575
473576
473577
473578
473579
473580
473581
473582
473583
473584
473585
473586
473587
473588
473589
473590
473591
473592
473593
473594
473595
473596
473597
473598
473599
473600
473601
473602
473603
473604
473605
473606
473607
473608
473609
473610
473611
473612
473613
473614
473615
473616
473617
473618
473619
473620
473621
473622
473623
473624
473625
473626
473627
473628
473629
473630
473631
473632
473633
473634
473635
473636
473637
473638
473639
473640
473641
473642
473643
473644
473645
473646
473647
473648
473649
473650
473651
473652
473653
473654
473655
473656
473657
473658
473659
473660
473661
473662
473663
473664
473665
473666
473667
473668
473669
473670
473671
473672
473673
473674
473675
473676
473677
473678
473679
473680
473681
473682
473683
473684
473685
473686
473687
473688
473689
473690
473691
473692
473693
473694
473695
473696
473697
473698
473699
473700
473701
473702
473703
473704
473705
473706
473707
473708
473709
473710
473711
473712
473713
473714
473715
473716
473717
473718
473719
473720
473721
473722
473723
473724
473725
473726
473727
473728
473729
473730
473731
473732
473733
473734
473735
473736
473737
473738
473739
473740
473741
473742
473743
473744
473745
473746
473747
473748
473749
473750
473751
473752
473753
473754
473755
473756
473757
473758
473759
473760
473761
473762
473763
473764
473765
473766
473767
473768
473769
473770
473771
473772
473773
473774
473775
473776
473777
473778
473779
473780
473781
473782
473783
473784
473785
473786
473787
473788
473789
473790
473791
473792
473793
473794
473795
473796
473797
473798
473799
473800
473801
473802
473803
473804
473805
473806
473807
473808
473809
473810
473811
473812
473813
473814
473815
473816
473817
473818
473819
473820
473821
473822
473823
473824
473825
473826
473827
473828
473829
473830
473831
473832
473833
473834
473835
473836
473837
473838
473839
473840
473841
473842
473843
473844
473845
473846
473847
473848
473849
473850
473851
473852
473853
473854
473855
473856
473857
473858
473859
473860
473861
473862
473863
473864
473865
473866
473867
473868
473869
473870
473871
473872
473873
473874
473875
473876
473877
473878
473879
473880
473881
473882
473883
473884
473885
473886
473887
473888
473889
473890
473891
473892
473893
473894
473895
473896
473897
473898
473899
473900
473901
473902
473903
473904
473905
473906
473907
473908
473909
473910
473911
473912
473913
473914
473915
473916
473917
473918
473919
473920
473921
473922
473923
473924
473925
473926
473927
473928
473929
473930
473931
473932
473933
473934
473935
473936
473937
473938
473939
473940
473941
473942
473943
473944
473945
473946
473947
473948
473949
473950
473951
473952
473953
473954
473955
473956
473957
473958
473959
473960
473961
473962
473963
473964
473965
473966
473967
473968
473969
473970
473971
473972
473973
473974
473975
473976
473977
473978
473979
473980
473981
473982
473983
473984
473985
473986
473987
473988
473989
473990
473991
473992
473993
473994
473995
473996
473997
473998
473999
474000
474001
474002
474003
474004
474005
474006
474007
474008
474009
474010
474011
474012
474013
474014
474015
474016
474017
474018
474019
474020
474021
474022
474023
474024
474025
474026
474027
474028
474029
474030
474031
474032
474033
474034
474035
474036
474037
474038
474039
474040
474041
474042
474043
474044
474045
474046
474047
474048
474049
474050
474051
474052
474053
474054
474055
474056
474057
474058
474059
474060
474061
474062
474063
474064
474065
474066
474067
474068
474069
474070
474071
474072
474073
474074
474075
474076
474077
474078
474079
474080
474081
474082
474083
474084
474085
474086
474087
474088
474089
474090
474091
474092
474093
474094
474095
474096
474097
474098
474099
474100
474101
474102
474103
474104
474105
474106
474107
474108
474109
474110
474111
474112
474113
474114
474115
474116
474117
474118
474119
474120
474121
474122
474123
474124
474125
474126
474127
474128
474129
474130
474131
474132
474133
474134
474135
474136
474137
474138
474139
474140
474141
474142
474143
474144
474145
474146
474147
474148
474149
474150
474151
474152
474153
474154
474155
474156
474157
474158
474159
474160
474161
474162
474163
474164
474165
474166
474167
474168
474169
474170
474171
474172
474173
474174
474175
474176
474177
474178
474179
474180
474181
474182
474183
474184
474185
474186
474187
474188
474189
474190
474191
474192
474193
474194
474195
474196
474197
474198
474199
474200
474201
474202
474203
474204
474205
474206
474207
474208
474209
474210
474211
474212
474213
474214
474215
474216
474217
474218
474219
474220
474221
474222
474223
474224
474225
474226
474227
474228
474229
474230
474231
474232
474233
474234
474235
474236
474237
474238
474239
474240
474241
474242
474243
474244
474245
474246
474247
474248
474249
474250
474251
474252
474253
474254
474255
474256
474257
474258
474259
474260
474261
474262
474263
474264
474265
474266
474267
474268
474269
474270
474271
474272
474273
474274
474275
474276
474277
474278
474279
474280
474281
474282
474283
474284
474285
474286
474287
474288
474289
474290
474291
474292
474293
474294
474295
474296
474297
474298
474299
474300
474301
474302
474303
474304
474305
474306
474307
474308
474309
474310
474311
474312
474313
474314
474315
474316
474317
474318
474319
474320
474321
474322
474323
474324
474325
474326
474327
474328
474329
474330
474331
474332
474333
474334
474335
474336
474337
474338
474339
474340
474341
474342
474343
474344
474345
474346
474347
474348
474349
474350
474351
474352
474353
474354
474355
474356
474357
474358
474359
474360
474361
474362
474363
474364
474365
474366
474367
474368
474369
474370
474371
474372
474373
474374
474375
474376
474377
474378
474379
474380
474381
474382
474383
474384
474385
474386
474387
474388
474389
474390
474391
474392
474393
474394
474395
474396
474397
474398
474399
474400
474401
474402
474403
474404
474405
474406
474407
474408
474409
474410
474411
474412
474413
474414
474415
474416
474417
474418
474419
474420
474421
474422
474423
474424
474425
474426
474427
474428
474429
474430
474431
474432
474433
474434
474435
474436
474437
474438
474439
474440
474441
474442
474443
474444
474445
474446
474447
474448
474449
474450
474451
474452
474453
474454
474455
474456
474457
474458
474459
474460
474461
474462
474463
474464
474465
474466
474467
474468
474469
474470
474471
474472
474473
474474
474475
474476
474477
474478
474479
474480
474481
474482
474483
474484
474485
474486
474487
474488
474489
474490
474491
474492
474493
474494
474495
474496
474497
474498
474499
474500
474501
474502
474503
474504
474505
474506
474507
474508
474509
474510
474511
474512
474513
474514
474515
474516
474517
474518
474519
474520
474521
474522
474523
474524
474525
474526
474527
474528
474529
474530
474531
474532
474533
474534
474535
474536
474537
474538
474539
474540
474541
474542
474543
474544
474545
474546
474547
474548
474549
474550
474551
474552
474553
474554
474555
474556
474557
474558
474559
474560
474561
474562
474563
474564
474565
474566
474567
474568
474569
474570
474571
474572
474573
474574
474575
474576
474577
474578
474579
474580
474581
474582
474583
474584
474585
474586
474587
474588
474589
474590
474591
474592
474593
474594
474595
474596
474597
474598
474599
474600
474601
474602
474603
474604
474605
474606
474607
474608
474609
474610
474611
474612
474613
474614
474615
474616
474617
474618
474619
474620
474621
474622
474623
474624
474625
474626
474627
474628
474629
474630
474631
474632
474633
474634
474635
474636
474637
474638
474639
474640
474641
474642
474643
474644
474645
474646
474647
474648
474649
474650
474651
474652
474653
474654
474655
474656
474657
474658
474659
474660
474661
474662
474663
474664
474665
474666
474667
474668
474669
474670
474671
474672
474673
474674
474675
474676
474677
474678
474679
474680
474681
474682
474683
474684
474685
474686
474687
474688
474689
474690
474691
474692
474693
474694
474695
474696
474697
474698
474699
474700
474701
474702
474703
474704
474705
474706
474707
474708
474709
474710
474711
474712
474713
474714
474715
474716
474717
474718
474719
474720
474721
474722
474723
474724
474725
474726
474727
474728
474729
474730
474731
474732
474733
474734
474735
474736
474737
474738
474739
474740
474741
474742
474743
474744
474745
474746
474747
474748
474749
474750
474751
474752
474753
474754
474755
474756
474757
474758
474759
474760
474761
474762
474763
474764
474765
474766
474767
474768
474769
474770
474771
474772
474773
474774
474775
474776
474777
474778
474779
474780
474781
474782
474783
474784
474785
474786
474787
474788
474789
474790
474791
474792
474793
474794
474795
474796
474797
474798
474799
474800
474801
474802
474803
474804
474805
474806
474807
474808
474809
474810
474811
474812
474813
474814
474815
474816
474817
474818
474819
474820
474821
474822
474823
474824
474825
474826
474827
474828
474829
474830
474831
474832
474833
474834
474835
474836
474837
474838
474839
474840
474841
474842
474843
474844
474845
474846
474847
474848
474849
474850
474851
474852
474853
474854
474855
474856
474857
474858
474859
474860
474861
474862
474863
474864
474865
474866
474867
474868
474869
474870
474871
474872
474873
474874
474875
474876
474877
474878
474879
474880
474881
474882
474883
474884
474885
474886
474887
474888
474889
474890
474891
474892
474893
474894
474895
474896
474897
474898
474899
474900
474901
474902
474903
474904
474905
474906
474907
474908
474909
474910
474911
474912
474913
474914
474915
474916
474917
474918
474919
474920
474921
474922
474923
474924
474925
474926
474927
474928
474929
474930
474931
474932
474933
474934
474935
474936
474937
474938
474939
474940
474941
474942
474943
474944
474945
474946
474947
474948
474949
474950
474951
474952
474953
474954
474955
474956
474957
474958
474959
474960
474961
474962
474963
474964
474965
474966
474967
474968
474969
474970
474971
474972
474973
474974
474975
474976
474977
474978
474979
474980
474981
474982
474983
474984
474985
474986
474987
474988
474989
474990
474991
474992
474993
474994
474995
474996
474997
474998
474999
475000
475001
475002
475003
475004
475005
475006
475007
475008
475009
475010
475011
475012
475013
475014
475015
475016
475017
475018
475019
475020
475021
475022
475023
475024
475025
475026
475027
475028
475029
475030
475031
475032
475033
475034
475035
475036
475037
475038
475039
475040
475041
475042
475043
475044
475045
475046
475047
475048
475049
475050
475051
475052
475053
475054
475055
475056
475057
475058
475059
475060
475061
475062
475063
475064
475065
475066
475067
475068
475069
475070
475071
475072
475073
475074
475075
475076
475077
475078
475079
475080
475081
475082
475083
475084
475085
475086
475087
475088
475089
475090
475091
475092
475093
475094
475095
475096
475097
475098
475099
475100
475101
475102
475103
475104
475105
475106
475107
475108
475109
475110
475111
475112
475113
475114
475115
475116
475117
475118
475119
475120
475121
475122
475123
475124
475125
475126
475127
475128
475129
475130
475131
475132
475133
475134
475135
475136
475137
475138
475139
475140
475141
475142
475143
475144
475145
475146
475147
475148
475149
475150
475151
475152
475153
475154
475155
475156
475157
475158
475159
475160
475161
475162
475163
475164
475165
475166
475167
475168
475169
475170
475171
475172
475173
475174
475175
475176
475177
475178
475179
475180
475181
475182
475183
475184
475185
475186
475187
475188
475189
475190
475191
475192
475193
475194
475195
475196
475197
475198
475199
475200
475201
475202
475203
475204
475205
475206
475207
475208
475209
475210
475211
475212
475213
475214
475215
475216
475217
475218
475219
475220
475221
475222
475223
475224
475225
475226
475227
475228
475229
475230
475231
475232
475233
475234
475235
475236
475237
475238
475239
475240
475241
475242
475243
475244
475245
475246
475247
475248
475249
475250
475251
475252
475253
475254
475255
475256
475257
475258
475259
475260
475261
475262
475263
475264
475265
475266
475267
475268
475269
475270
475271
475272
475273
475274
475275
475276
475277
475278
475279
475280
475281
475282
475283
475284
475285
475286
475287
475288
475289
475290
475291
475292
475293
475294
475295
475296
475297
475298
475299
475300
475301
475302
475303
475304
475305
475306
475307
475308
475309
475310
475311
475312
475313
475314
475315
475316
475317
475318
475319
475320
475321
475322
475323
475324
475325
475326
475327
475328
475329
475330
475331
475332
475333
475334
475335
475336
475337
475338
475339
475340
475341
475342
475343
475344
475345
475346
475347
475348
475349
475350
475351
475352
475353
475354
475355
475356
475357
475358
475359
475360
475361
475362
475363
475364
475365
475366
475367
475368
475369
475370
475371
475372
475373
475374
475375
475376
475377
475378
475379
475380
475381
475382
475383
475384
475385
475386
475387
475388
475389
475390
475391
475392
475393
475394
475395
475396
475397
475398
475399
475400
475401
475402
475403
475404
475405
475406
475407
475408
475409
475410
475411
475412
475413
475414
475415
475416
475417
475418
475419
475420
475421
475422
475423
475424
475425
475426
475427
475428
475429
475430
475431
475432
475433
475434
475435
475436
475437
475438
475439
475440
475441
475442
475443
475444
475445
475446
475447
475448
475449
475450
475451
475452
475453
475454
475455
475456
475457
475458
475459
475460
475461
475462
475463
475464
475465
475466
475467
475468
475469
475470
475471
475472
475473
475474
475475
475476
475477
475478
475479
475480
475481
475482
475483
475484
475485
475486
475487
475488
475489
475490
475491
475492
475493
475494
475495
475496
475497
475498
475499
475500
475501
475502
475503
475504
475505
475506
475507
475508
475509
475510
475511
475512
475513
475514
475515
475516
475517
475518
475519
475520
475521
475522
475523
475524
475525
475526
475527
475528
475529
475530
475531
475532
475533
475534
475535
475536
475537
475538
475539
475540
475541
475542
475543
475544
475545
475546
475547
475548
475549
475550
475551
475552
475553
475554
475555
475556
475557
475558
475559
475560
475561
475562
475563
475564
475565
475566
475567
475568
475569
475570
475571
475572
475573
475574
475575
475576
475577
475578
475579
475580
475581
475582
475583
475584
475585
475586
475587
475588
475589
475590
475591
475592
475593
475594
475595
475596
475597
475598
475599
475600
475601
475602
475603
475604
475605
475606
475607
475608
475609
475610
475611
475612
475613
475614
475615
475616
475617
475618
475619
475620
475621
475622
475623
475624
475625
475626
475627
475628
475629
475630
475631
475632
475633
475634
475635
475636
475637
475638
475639
475640
475641
475642
475643
475644
475645
475646
475647
475648
475649
475650
475651
475652
475653
475654
475655
475656
475657
475658
475659
475660
475661
475662
475663
475664
475665
475666
475667
475668
475669
475670
475671
475672
475673
475674
475675
475676
475677
475678
475679
475680
475681
475682
475683
475684
475685
475686
475687
475688
475689
475690
475691
475692
475693
475694
475695
475696
475697
475698
475699
475700
475701
475702
475703
475704
475705
475706
475707
475708
475709
475710
475711
475712
475713
475714
475715
475716
475717
475718
475719
475720
475721
475722
475723
475724
475725
475726
475727
475728
475729
475730
475731
475732
475733
475734
475735
475736
475737
475738
475739
475740
475741
475742
475743
475744
475745
475746
475747
475748
475749
475750
475751
475752
475753
475754
475755
475756
475757
475758
475759
475760
475761
475762
475763
475764
475765
475766
475767
475768
475769
475770
475771
475772
475773
475774
475775
475776
475777
475778
475779
475780
475781
475782
475783
475784
475785
475786
475787
475788
475789
475790
475791
475792
475793
475794
475795
475796
475797
475798
475799
475800
475801
475802
475803
475804
475805
475806
475807
475808
475809
475810
475811
475812
475813
475814
475815
475816
475817
475818
475819
475820
475821
475822
475823
475824
475825
475826
475827
475828
475829
475830
475831
475832
475833
475834
475835
475836
475837
475838
475839
475840
475841
475842
475843
475844
475845
475846
475847
475848
475849
475850
475851
475852
475853
475854
475855
475856
475857
475858
475859
475860
475861
475862
475863
475864
475865
475866
475867
475868
475869
475870
475871
475872
475873
475874
475875
475876
475877
475878
475879
475880
475881
475882
475883
475884
475885
475886
475887
475888
475889
475890
475891
475892
475893
475894
475895
475896
475897
475898
475899
475900
475901
475902
475903
475904
475905
475906
475907
475908
475909
475910
475911
475912
475913
475914
475915
475916
475917
475918
475919
475920
475921
475922
475923
475924
475925
475926
475927
475928
475929
475930
475931
475932
475933
475934
475935
475936
475937
475938
475939
475940
475941
475942
475943
475944
475945
475946
475947
475948
475949
475950
475951
475952
475953
475954
475955
475956
475957
475958
475959
475960
475961
475962
475963
475964
475965
475966
475967
475968
475969
475970
475971
475972
475973
475974
475975
475976
475977
475978
475979
475980
475981
475982
475983
475984
475985
475986
475987
475988
475989
475990
475991
475992
475993
475994
475995
475996
475997
475998
475999
476000
476001
476002
476003
476004
476005
476006
476007
476008
476009
476010
476011
476012
476013
476014
476015
476016
476017
476018
476019
476020
476021
476022
476023
476024
476025
476026
476027
476028
476029
476030
476031
476032
476033
476034
476035
476036
476037
476038
476039
476040
476041
476042
476043
476044
476045
476046
476047
476048
476049
476050
476051
476052
476053
476054
476055
476056
476057
476058
476059
476060
476061
476062
476063
476064
476065
476066
476067
476068
476069
476070
476071
476072
476073
476074
476075
476076
476077
476078
476079
476080
476081
476082
476083
476084
476085
476086
476087
476088
476089
476090
476091
476092
476093
476094
476095
476096
476097
476098
476099
476100
476101
476102
476103
476104
476105
476106
476107
476108
476109
476110
476111
476112
476113
476114
476115
476116
476117
476118
476119
476120
476121
476122
476123
476124
476125
476126
476127
476128
476129
476130
476131
476132
476133
476134
476135
476136
476137
476138
476139
476140
476141
476142
476143
476144
476145
476146
476147
476148
476149
476150
476151
476152
476153
476154
476155
476156
476157
476158
476159
476160
476161
476162
476163
476164
476165
476166
476167
476168
476169
476170
476171
476172
476173
476174
476175
476176
476177
476178
476179
476180
476181
476182
476183
476184
476185
476186
476187
476188
476189
476190
476191
476192
476193
476194
476195
476196
476197
476198
476199
476200
476201
476202
476203
476204
476205
476206
476207
476208
476209
476210
476211
476212
476213
476214
476215
476216
476217
476218
476219
476220
476221
476222
476223
476224
476225
476226
476227
476228
476229
476230
476231
476232
476233
476234
476235
476236
476237
476238
476239
476240
476241
476242
476243
476244
476245
476246
476247
476248
476249
476250
476251
476252
476253
476254
476255
476256
476257
476258
476259
476260
476261
476262
476263
476264
476265
476266
476267
476268
476269
476270
476271
476272
476273
476274
476275
476276
476277
476278
476279
476280
476281
476282
476283
476284
476285
476286
476287
476288
476289
476290
476291
476292
476293
476294
476295
476296
476297
476298
476299
476300
476301
476302
476303
476304
476305
476306
476307
476308
476309
476310
476311
476312
476313
476314
476315
476316
476317
476318
476319
476320
476321
476322
476323
476324
476325
476326
476327
476328
476329
476330
476331
476332
476333
476334
476335
476336
476337
476338
476339
476340
476341
476342
476343
476344
476345
476346
476347
476348
476349
476350
476351
476352
476353
476354
476355
476356
476357
476358
476359
476360
476361
476362
476363
476364
476365
476366
476367
476368
476369
476370
476371
476372
476373
476374
476375
476376
476377
476378
476379
476380
476381
476382
476383
476384
476385
476386
476387
476388
476389
476390
476391
476392
476393
476394
476395
476396
476397
476398
476399
476400
476401
476402
476403
476404
476405
476406
476407
476408
476409
476410
476411
476412
476413
476414
476415
476416
476417
476418
476419
476420
476421
476422
476423
476424
476425
476426
476427
476428
476429
476430
476431
476432
476433
476434
476435
476436
476437
476438
476439
476440
476441
476442
476443
476444
476445
476446
476447
476448
476449
476450
476451
476452
476453
476454
476455
476456
476457
476458
476459
476460
476461
476462
476463
476464
476465
476466
476467
476468
476469
476470
476471
476472
476473
476474
476475
476476
476477
476478
476479
476480
476481
476482
476483
476484
476485
476486
476487
476488
476489
476490
476491
476492
476493
476494
476495
476496
476497
476498
476499
476500
476501
476502
476503
476504
476505
476506
476507
476508
476509
476510
476511
476512
476513
476514
476515
476516
476517
476518
476519
476520
476521
476522
476523
476524
476525
476526
476527
476528
476529
476530
476531
476532
476533
476534
476535
476536
476537
476538
476539
476540
476541
476542
476543
476544
476545
476546
476547
476548
476549
476550
476551
476552
476553
476554
476555
476556
476557
476558
476559
476560
476561
476562
476563
476564
476565
476566
476567
476568
476569
476570
476571
476572
476573
476574
476575
476576
476577
476578
476579
476580
476581
476582
476583
476584
476585
476586
476587
476588
476589
476590
476591
476592
476593
476594
476595
476596
476597
476598
476599
476600
476601
476602
476603
476604
476605
476606
476607
476608
476609
476610
476611
476612
476613
476614
476615
476616
476617
476618
476619
476620
476621
476622
476623
476624
476625
476626
476627
476628
476629
476630
476631
476632
476633
476634
476635
476636
476637
476638
476639
476640
476641
476642
476643
476644
476645
476646
476647
476648
476649
476650
476651
476652
476653
476654
476655
476656
476657
476658
476659
476660
476661
476662
476663
476664
476665
476666
476667
476668
476669
476670
476671
476672
476673
476674
476675
476676
476677
476678
476679
476680
476681
476682
476683
476684
476685
476686
476687
476688
476689
476690
476691
476692
476693
476694
476695
476696
476697
476698
476699
476700
476701
476702
476703
476704
476705
476706
476707
476708
476709
476710
476711
476712
476713
476714
476715
476716
476717
476718
476719
476720
476721
476722
476723
476724
476725
476726
476727
476728
476729
476730
476731
476732
476733
476734
476735
476736
476737
476738
476739
476740
476741
476742
476743
476744
476745
476746
476747
476748
476749
476750
476751
476752
476753
476754
476755
476756
476757
476758
476759
476760
476761
476762
476763
476764
476765
476766
476767
476768
476769
476770
476771
476772
476773
476774
476775
476776
476777
476778
476779
476780
476781
476782
476783
476784
476785
476786
476787
476788
476789
476790
476791
476792
476793
476794
476795
476796
476797
476798
476799
476800
476801
476802
476803
476804
476805
476806
476807
476808
476809
476810
476811
476812
476813
476814
476815
476816
476817
476818
476819
476820
476821
476822
476823
476824
476825
476826
476827
476828
476829
476830
476831
476832
476833
476834
476835
476836
476837
476838
476839
476840
476841
476842
476843
476844
476845
476846
476847
476848
476849
476850
476851
476852
476853
476854
476855
476856
476857
476858
476859
476860
476861
476862
476863
476864
476865
476866
476867
476868
476869
476870
476871
476872
476873
476874
476875
476876
476877
476878
476879
476880
476881
476882
476883
476884
476885
476886
476887
476888
476889
476890
476891
476892
476893
476894
476895
476896
476897
476898
476899
476900
476901
476902
476903
476904
476905
476906
476907
476908
476909
476910
476911
476912
476913
476914
476915
476916
476917
476918
476919
476920
476921
476922
476923
476924
476925
476926
476927
476928
476929
476930
476931
476932
476933
476934
476935
476936
476937
476938
476939
476940
476941
476942
476943
476944
476945
476946
476947
476948
476949
476950
476951
476952
476953
476954
476955
476956
476957
476958
476959
476960
476961
476962
476963
476964
476965
476966
476967
476968
476969
476970
476971
476972
476973
476974
476975
476976
476977
476978
476979
476980
476981
476982
476983
476984
476985
476986
476987
476988
476989
476990
476991
476992
476993
476994
476995
476996
476997
476998
476999
477000
477001
477002
477003
477004
477005
477006
477007
477008
477009
477010
477011
477012
477013
477014
477015
477016
477017
477018
477019
477020
477021
477022
477023
477024
477025
477026
477027
477028
477029
477030
477031
477032
477033
477034
477035
477036
477037
477038
477039
477040
477041
477042
477043
477044
477045
477046
477047
477048
477049
477050
477051
477052
477053
477054
477055
477056
477057
477058
477059
477060
477061
477062
477063
477064
477065
477066
477067
477068
477069
477070
477071
477072
477073
477074
477075
477076
477077
477078
477079
477080
477081
477082
477083
477084
477085
477086
477087
477088
477089
477090
477091
477092
477093
477094
477095
477096
477097
477098
477099
477100
477101
477102
477103
477104
477105
477106
477107
477108
477109
477110
477111
477112
477113
477114
477115
477116
477117
477118
477119
477120
477121
477122
477123
477124
477125
477126
477127
477128
477129
477130
477131
477132
477133
477134
477135
477136
477137
477138
477139
477140
477141
477142
477143
477144
477145
477146
477147
477148
477149
477150
477151
477152
477153
477154
477155
477156
477157
477158
477159
477160
477161
477162
477163
477164
477165
477166
477167
477168
477169
477170
477171
477172
477173
477174
477175
477176
477177
477178
477179
477180
477181
477182
477183
477184
477185
477186
477187
477188
477189
477190
477191
477192
477193
477194
477195
477196
477197
477198
477199
477200
477201
477202
477203
477204
477205
477206
477207
477208
477209
477210
477211
477212
477213
477214
477215
477216
477217
477218
477219
477220
477221
477222
477223
477224
477225
477226
477227
477228
477229
477230
477231
477232
477233
477234
477235
477236
477237
477238
477239
477240
477241
477242
477243
477244
477245
477246
477247
477248
477249
477250
477251
477252
477253
477254
477255
477256
477257
477258
477259
477260
477261
477262
477263
477264
477265
477266
477267
477268
477269
477270
477271
477272
477273
477274
477275
477276
477277
477278
477279
477280
477281
477282
477283
477284
477285
477286
477287
477288
477289
477290
477291
477292
477293
477294
477295
477296
477297
477298
477299
477300
477301
477302
477303
477304
477305
477306
477307
477308
477309
477310
477311
477312
477313
477314
477315
477316
477317
477318
477319
477320
477321
477322
477323
477324
477325
477326
477327
477328
477329
477330
477331
477332
477333
477334
477335
477336
477337
477338
477339
477340
477341
477342
477343
477344
477345
477346
477347
477348
477349
477350
477351
477352
477353
477354
477355
477356
477357
477358
477359
477360
477361
477362
477363
477364
477365
477366
477367
477368
477369
477370
477371
477372
477373
477374
477375
477376
477377
477378
477379
477380
477381
477382
477383
477384
477385
477386
477387
477388
477389
477390
477391
477392
477393
477394
477395
477396
477397
477398
477399
477400
477401
477402
477403
477404
477405
477406
477407
477408
477409
477410
477411
477412
477413
477414
477415
477416
477417
477418
477419
477420
477421
477422
477423
477424
477425
477426
477427
477428
477429
477430
477431
477432
477433
477434
477435
477436
477437
477438
477439
477440
477441
477442
477443
477444
477445
477446
477447
477448
477449
477450
477451
477452
477453
477454
477455
477456
477457
477458
477459
477460
477461
477462
477463
477464
477465
477466
477467
477468
477469
477470
477471
477472
477473
477474
477475
477476
477477
477478
477479
477480
477481
477482
477483
477484
477485
477486
477487
477488
477489
477490
477491
477492
477493
477494
477495
477496
477497
477498
477499
477500
477501
477502
477503
477504
477505
477506
477507
477508
477509
477510
477511
477512
477513
477514
477515
477516
477517
477518
477519
477520
477521
477522
477523
477524
477525
477526
477527
477528
477529
477530
477531
477532
477533
477534
477535
477536
477537
477538
477539
477540
477541
477542
477543
477544
477545
477546
477547
477548
477549
477550
477551
477552
477553
477554
477555
477556
477557
477558
477559
477560
477561
477562
477563
477564
477565
477566
477567
477568
477569
477570
477571
477572
477573
477574
477575
477576
477577
477578
477579
477580
477581
477582
477583
477584
477585
477586
477587
477588
477589
477590
477591
477592
477593
477594
477595
477596
477597
477598
477599
477600
477601
477602
477603
477604
477605
477606
477607
477608
477609
477610
477611
477612
477613
477614
477615
477616
477617
477618
477619
477620
477621
477622
477623
477624
477625
477626
477627
477628
477629
477630
477631
477632
477633
477634
477635
477636
477637
477638
477639
477640
477641
477642
477643
477644
477645
477646
477647
477648
477649
477650
477651
477652
477653
477654
477655
477656
477657
477658
477659
477660
477661
477662
477663
477664
477665
477666
477667
477668
477669
477670
477671
477672
477673
477674
477675
477676
477677
477678
477679
477680
477681
477682
477683
477684
477685
477686
477687
477688
477689
477690
477691
477692
477693
477694
477695
477696
477697
477698
477699
477700
477701
477702
477703
477704
477705
477706
477707
477708
477709
477710
477711
477712
477713
477714
477715
477716
477717
477718
477719
477720
477721
477722
477723
477724
477725
477726
477727
477728
477729
477730
477731
477732
477733
477734
477735
477736
477737
477738
477739
477740
477741
477742
477743
477744
477745
477746
477747
477748
477749
477750
477751
477752
477753
477754
477755
477756
477757
477758
477759
477760
477761
477762
477763
477764
477765
477766
477767
477768
477769
477770
477771
477772
477773
477774
477775
477776
477777
477778
477779
477780
477781
477782
477783
477784
477785
477786
477787
477788
477789
477790
477791
477792
477793
477794
477795
477796
477797
477798
477799
477800
477801
477802
477803
477804
477805
477806
477807
477808
477809
477810
477811
477812
477813
477814
477815
477816
477817
477818
477819
477820
477821
477822
477823
477824
477825
477826
477827
477828
477829
477830
477831
477832
477833
477834
477835
477836
477837
477838
477839
477840
477841
477842
477843
477844
477845
477846
477847
477848
477849
477850
477851
477852
477853
477854
477855
477856
477857
477858
477859
477860
477861
477862
477863
477864
477865
477866
477867
477868
477869
477870
477871
477872
477873
477874
477875
477876
477877
477878
477879
477880
477881
477882
477883
477884
477885
477886
477887
477888
477889
477890
477891
477892
477893
477894
477895
477896
477897
477898
477899
477900
477901
477902
477903
477904
477905
477906
477907
477908
477909
477910
477911
477912
477913
477914
477915
477916
477917
477918
477919
477920
477921
477922
477923
477924
477925
477926
477927
477928
477929
477930
477931
477932
477933
477934
477935
477936
477937
477938
477939
477940
477941
477942
477943
477944
477945
477946
477947
477948
477949
477950
477951
477952
477953
477954
477955
477956
477957
477958
477959
477960
477961
477962
477963
477964
477965
477966
477967
477968
477969
477970
477971
477972
477973
477974
477975
477976
477977
477978
477979
477980
477981
477982
477983
477984
477985
477986
477987
477988
477989
477990
477991
477992
477993
477994
477995
477996
477997
477998
477999
478000
478001
478002
478003
478004
478005
478006
478007
478008
478009
478010
478011
478012
478013
478014
478015
478016
478017
478018
478019
478020
478021
478022
478023
478024
478025
478026
478027
478028
478029
478030
478031
478032
478033
478034
478035
478036
478037
478038
478039
478040
478041
478042
478043
478044
478045
478046
478047
478048
478049
478050
478051
478052
478053
478054
478055
478056
478057
478058
478059
478060
478061
478062
478063
478064
478065
478066
478067
478068
478069
478070
478071
478072
478073
478074
478075
478076
478077
478078
478079
478080
478081
478082
478083
478084
478085
478086
478087
478088
478089
478090
478091
478092
478093
478094
478095
478096
478097
478098
478099
478100
478101
478102
478103
478104
478105
478106
478107
478108
478109
478110
478111
478112
478113
478114
478115
478116
478117
478118
478119
478120
478121
478122
478123
478124
478125
478126
478127
478128
478129
478130
478131
478132
478133
478134
478135
478136
478137
478138
478139
478140
478141
478142
478143
478144
478145
478146
478147
478148
478149
478150
478151
478152
478153
478154
478155
478156
478157
478158
478159
478160
478161
478162
478163
478164
478165
478166
478167
478168
478169
478170
478171
478172
478173
478174
478175
478176
478177
478178
478179
478180
478181
478182
478183
478184
478185
478186
478187
478188
478189
478190
478191
478192
478193
478194
478195
478196
478197
478198
478199
478200
478201
478202
478203
478204
478205
478206
478207
478208
478209
478210
478211
478212
478213
478214
478215
478216
478217
478218
478219
478220
478221
478222
478223
478224
478225
478226
478227
478228
478229
478230
478231
478232
478233
478234
478235
478236
478237
478238
478239
478240
478241
478242
478243
478244
478245
478246
478247
478248
478249
478250
478251
478252
478253
478254
478255
478256
478257
478258
478259
478260
478261
478262
478263
478264
478265
478266
478267
478268
478269
478270
478271
478272
478273
478274
478275
478276
478277
478278
478279
478280
478281
478282
478283
478284
478285
478286
478287
478288
478289
478290
478291
478292
478293
478294
478295
478296
478297
478298
478299
478300
478301
478302
478303
478304
478305
478306
478307
478308
478309
478310
478311
478312
478313
478314
478315
478316
478317
478318
478319
478320
478321
478322
478323
478324
478325
478326
478327
478328
478329
478330
478331
478332
478333
478334
478335
478336
478337
478338
478339
478340
478341
478342
478343
478344
478345
478346
478347
478348
478349
478350
478351
478352
478353
478354
478355
478356
478357
478358
478359
478360
478361
478362
478363
478364
478365
478366
478367
478368
478369
478370
478371
478372
478373
478374
478375
478376
478377
478378
478379
478380
478381
478382
478383
478384
478385
478386
478387
478388
478389
478390
478391
478392
478393
478394
478395
478396
478397
478398
478399
478400
478401
478402
478403
478404
478405
478406
478407
478408
478409
478410
478411
478412
478413
478414
478415
478416
478417
478418
478419
478420
478421
478422
478423
478424
478425
478426
478427
478428
478429
478430
478431
478432
478433
478434
478435
478436
478437
478438
478439
478440
478441
478442
478443
478444
478445
478446
478447
478448
478449
478450
478451
478452
478453
478454
478455
478456
478457
478458
478459
478460
478461
478462
478463
478464
478465
478466
478467
478468
478469
478470
478471
478472
478473
478474
478475
478476
478477
478478
478479
478480
478481
478482
478483
478484
478485
478486
478487
478488
478489
478490
478491
478492
478493
478494
478495
478496
478497
478498
478499
478500
478501
478502
478503
478504
478505
478506
478507
478508
478509
478510
478511
478512
478513
478514
478515
478516
478517
478518
478519
478520
478521
478522
478523
478524
478525
478526
478527
478528
478529
478530
478531
478532
478533
478534
478535
478536
478537
478538
478539
478540
478541
478542
478543
478544
478545
478546
478547
478548
478549
478550
478551
478552
478553
478554
478555
478556
478557
478558
478559
478560
478561
478562
478563
478564
478565
478566
478567
478568
478569
478570
478571
478572
478573
478574
478575
478576
478577
478578
478579
478580
478581
478582
478583
478584
478585
478586
478587
478588
478589
478590
478591
478592
478593
478594
478595
478596
478597
478598
478599
478600
478601
478602
478603
478604
478605
478606
478607
478608
478609
478610
478611
478612
478613
478614
478615
478616
478617
478618
478619
478620
478621
478622
478623
478624
478625
478626
478627
478628
478629
478630
478631
478632
478633
478634
478635
478636
478637
478638
478639
478640
478641
478642
478643
478644
478645
478646
478647
478648
478649
478650
478651
478652
478653
478654
478655
478656
478657
478658
478659
478660
478661
478662
478663
478664
478665
478666
478667
478668
478669
478670
478671
478672
478673
478674
478675
478676
478677
478678
478679
478680
478681
478682
478683
478684
478685
478686
478687
478688
478689
478690
478691
478692
478693
478694
478695
478696
478697
478698
478699
478700
478701
478702
478703
478704
478705
478706
478707
478708
478709
478710
478711
478712
478713
478714
478715
478716
478717
478718
478719
478720
478721
478722
478723
478724
478725
478726
478727
478728
478729
478730
478731
478732
478733
478734
478735
478736
478737
478738
478739
478740
478741
478742
478743
478744
478745
478746
478747
478748
478749
478750
478751
478752
478753
478754
478755
478756
478757
478758
478759
478760
478761
478762
478763
478764
478765
478766
478767
478768
478769
478770
478771
478772
478773
478774
478775
478776
478777
478778
478779
478780
478781
478782
478783
478784
478785
478786
478787
478788
478789
478790
478791
478792
478793
478794
478795
478796
478797
478798
478799
478800
478801
478802
478803
478804
478805
478806
478807
478808
478809
478810
478811
478812
478813
478814
478815
478816
478817
478818
478819
478820
478821
478822
478823
478824
478825
478826
478827
478828
478829
478830
478831
478832
478833
478834
478835
478836
478837
478838
478839
478840
478841
478842
478843
478844
478845
478846
478847
478848
478849
478850
478851
478852
478853
478854
478855
478856
478857
478858
478859
478860
478861
478862
478863
478864
478865
478866
478867
478868
478869
478870
478871
478872
478873
478874
478875
478876
478877
478878
478879
478880
478881
478882
478883
478884
478885
478886
478887
478888
478889
478890
478891
478892
478893
478894
478895
478896
478897
478898
478899
478900
478901
478902
478903
478904
478905
478906
478907
478908
478909
478910
478911
478912
478913
478914
478915
478916
478917
478918
478919
478920
478921
478922
478923
478924
478925
478926
478927
478928
478929
478930
478931
478932
478933
478934
478935
478936
478937
478938
478939
478940
478941
478942
478943
478944
478945
478946
478947
478948
478949
478950
478951
478952
478953
478954
478955
478956
478957
478958
478959
478960
478961
478962
478963
478964
478965
478966
478967
478968
478969
478970
478971
478972
478973
478974
478975
478976
478977
478978
478979
478980
478981
478982
478983
478984
478985
478986
478987
478988
478989
478990
478991
478992
478993
478994
478995
478996
478997
478998
478999
479000
479001
479002
479003
479004
479005
479006
479007
479008
479009
479010
479011
479012
479013
479014
479015
479016
479017
479018
479019
479020
479021
479022
479023
479024
479025
479026
479027
479028
479029
479030
479031
479032
479033
479034
479035
479036
479037
479038
479039
479040
479041
479042
479043
479044
479045
479046
479047
479048
479049
479050
479051
479052
479053
479054
479055
479056
479057
479058
479059
479060
479061
479062
479063
479064
479065
479066
479067
479068
479069
479070
479071
479072
479073
479074
479075
479076
479077
479078
479079
479080
479081
479082
479083
479084
479085
479086
479087
479088
479089
479090
479091
479092
479093
479094
479095
479096
479097
479098
479099
479100
479101
479102
479103
479104
479105
479106
479107
479108
479109
479110
479111
479112
479113
479114
479115
479116
479117
479118
479119
479120
479121
479122
479123
479124
479125
479126
479127
479128
479129
479130
479131
479132
479133
479134
479135
479136
479137
479138
479139
479140
479141
479142
479143
479144
479145
479146
479147
479148
479149
479150
479151
479152
479153
479154
479155
479156
479157
479158
479159
479160
479161
479162
479163
479164
479165
479166
479167
479168
479169
479170
479171
479172
479173
479174
479175
479176
479177
479178
479179
479180
479181
479182
479183
479184
479185
479186
479187
479188
479189
479190
479191
479192
479193
479194
479195
479196
479197
479198
479199
479200
479201
479202
479203
479204
479205
479206
479207
479208
479209
479210
479211
479212
479213
479214
479215
479216
479217
479218
479219
479220
479221
479222
479223
479224
479225
479226
479227
479228
479229
479230
479231
479232
479233
479234
479235
479236
479237
479238
479239
479240
479241
479242
479243
479244
479245
479246
479247
479248
479249
479250
479251
479252
479253
479254
479255
479256
479257
479258
479259
479260
479261
479262
479263
479264
479265
479266
479267
479268
479269
479270
479271
479272
479273
479274
479275
479276
479277
479278
479279
479280
479281
479282
479283
479284
479285
479286
479287
479288
479289
479290
479291
479292
479293
479294
479295
479296
479297
479298
479299
479300
479301
479302
479303
479304
479305
479306
479307
479308
479309
479310
479311
479312
479313
479314
479315
479316
479317
479318
479319
479320
479321
479322
479323
479324
479325
479326
479327
479328
479329
479330
479331
479332
479333
479334
479335
479336
479337
479338
479339
479340
479341
479342
479343
479344
479345
479346
479347
479348
479349
479350
479351
479352
479353
479354
479355
479356
479357
479358
479359
479360
479361
479362
479363
479364
479365
479366
479367
479368
479369
479370
479371
479372
479373
479374
479375
479376
479377
479378
479379
479380
479381
479382
479383
479384
479385
479386
479387
479388
479389
479390
479391
479392
479393
479394
479395
479396
479397
479398
479399
479400
479401
479402
479403
479404
479405
479406
479407
479408
479409
479410
479411
479412
479413
479414
479415
479416
479417
479418
479419
479420
479421
479422
479423
479424
479425
479426
479427
479428
479429
479430
479431
479432
479433
479434
479435
479436
479437
479438
479439
479440
479441
479442
479443
479444
479445
479446
479447
479448
479449
479450
479451
479452
479453
479454
479455
479456
479457
479458
479459
479460
479461
479462
479463
479464
479465
479466
479467
479468
479469
479470
479471
479472
479473
479474
479475
479476
479477
479478
479479
479480
479481
479482
479483
479484
479485
479486
479487
479488
479489
479490
479491
479492
479493
479494
479495
479496
479497
479498
479499
479500
479501
479502
479503
479504
479505
479506
479507
479508
479509
479510
479511
479512
479513
479514
479515
479516
479517
479518
479519
479520
479521
479522
479523
479524
479525
479526
479527
479528
479529
479530
479531
479532
479533
479534
479535
479536
479537
479538
479539
479540
479541
479542
479543
479544
479545
479546
479547
479548
479549
479550
479551
479552
479553
479554
479555
479556
479557
479558
479559
479560
479561
479562
479563
479564
479565
479566
479567
479568
479569
479570
479571
479572
479573
479574
479575
479576
479577
479578
479579
479580
479581
479582
479583
479584
479585
479586
479587
479588
479589
479590
479591
479592
479593
479594
479595
479596
479597
479598
479599
479600
479601
479602
479603
479604
479605
479606
479607
479608
479609
479610
479611
479612
479613
479614
479615
479616
479617
479618
479619
479620
479621
479622
479623
479624
479625
479626
479627
479628
479629
479630
479631
479632
479633
479634
479635
479636
479637
479638
479639
479640
479641
479642
479643
479644
479645
479646
479647
479648
479649
479650
479651
479652
479653
479654
479655
479656
479657
479658
479659
479660
479661
479662
479663
479664
479665
479666
479667
479668
479669
479670
479671
479672
479673
479674
479675
479676
479677
479678
479679
479680
479681
479682
479683
479684
479685
479686
479687
479688
479689
479690
479691
479692
479693
479694
479695
479696
479697
479698
479699
479700
479701
479702
479703
479704
479705
479706
479707
479708
479709
479710
479711
479712
479713
479714
479715
479716
479717
479718
479719
479720
479721
479722
479723
479724
479725
479726
479727
479728
479729
479730
479731
479732
479733
479734
479735
479736
479737
479738
479739
479740
479741
479742
479743
479744
479745
479746
479747
479748
479749
479750
479751
479752
479753
479754
479755
479756
479757
479758
479759
479760
479761
479762
479763
479764
479765
479766
479767
479768
479769
479770
479771
479772
479773
479774
479775
479776
479777
479778
479779
479780
479781
479782
479783
479784
479785
479786
479787
479788
479789
479790
479791
479792
479793
479794
479795
479796
479797
479798
479799
479800
479801
479802
479803
479804
479805
479806
479807
479808
479809
479810
479811
479812
479813
479814
479815
479816
479817
479818
479819
479820
479821
479822
479823
479824
479825
479826
479827
479828
479829
479830
479831
479832
479833
479834
479835
479836
479837
479838
479839
479840
479841
479842
479843
479844
479845
479846
479847
479848
479849
479850
479851
479852
479853
479854
479855
479856
479857
479858
479859
479860
479861
479862
479863
479864
479865
479866
479867
479868
479869
479870
479871
479872
479873
479874
479875
479876
479877
479878
479879
479880
479881
479882
479883
479884
479885
479886
479887
479888
479889
479890
479891
479892
479893
479894
479895
479896
479897
479898
479899
479900
479901
479902
479903
479904
479905
479906
479907
479908
479909
479910
479911
479912
479913
479914
479915
479916
479917
479918
479919
479920
479921
479922
479923
479924
479925
479926
479927
479928
479929
479930
479931
479932
479933
479934
479935
479936
479937
479938
479939
479940
479941
479942
479943
479944
479945
479946
479947
479948
479949
479950
479951
479952
479953
479954
479955
479956
479957
479958
479959
479960
479961
479962
479963
479964
479965
479966
479967
479968
479969
479970
479971
479972
479973
479974
479975
479976
479977
479978
479979
479980
479981
479982
479983
479984
479985
479986
479987
479988
479989
479990
479991
479992
479993
479994
479995
479996
479997
479998
479999
480000
480001
480002
480003
480004
480005
480006
480007
480008
480009
480010
480011
480012
480013
480014
480015
480016
480017
480018
480019
480020
480021
480022
480023
480024
480025
480026
480027
480028
480029
480030
480031
480032
480033
480034
480035
480036
480037
480038
480039
480040
480041
480042
480043
480044
480045
480046
480047
480048
480049
480050
480051
480052
480053
480054
480055
480056
480057
480058
480059
480060
480061
480062
480063
480064
480065
480066
480067
480068
480069
480070
480071
480072
480073
480074
480075
480076
480077
480078
480079
480080
480081
480082
480083
480084
480085
480086
480087
480088
480089
480090
480091
480092
480093
480094
480095
480096
480097
480098
480099
480100
480101
480102
480103
480104
480105
480106
480107
480108
480109
480110
480111
480112
480113
480114
480115
480116
480117
480118
480119
480120
480121
480122
480123
480124
480125
480126
480127
480128
480129
480130
480131
480132
480133
480134
480135
480136
480137
480138
480139
480140
480141
480142
480143
480144
480145
480146
480147
480148
480149
480150
480151
480152
480153
480154
480155
480156
480157
480158
480159
480160
480161
480162
480163
480164
480165
480166
480167
480168
480169
480170
480171
480172
480173
480174
480175
480176
480177
480178
480179
480180
480181
480182
480183
480184
480185
480186
480187
480188
480189
480190
480191
480192
480193
480194
480195
480196
480197
480198
480199
480200
480201
480202
480203
480204
480205
480206
480207
480208
480209
480210
480211
480212
480213
480214
480215
480216
480217
480218
480219
480220
480221
480222
480223
480224
480225
480226
480227
480228
480229
480230
480231
480232
480233
480234
480235
480236
480237
480238
480239
480240
480241
480242
480243
480244
480245
480246
480247
480248
480249
480250
480251
480252
480253
480254
480255
480256
480257
480258
480259
480260
480261
480262
480263
480264
480265
480266
480267
480268
480269
480270
480271
480272
480273
480274
480275
480276
480277
480278
480279
480280
480281
480282
480283
480284
480285
480286
480287
480288
480289
480290
480291
480292
480293
480294
480295
480296
480297
480298
480299
480300
480301
480302
480303
480304
480305
480306
480307
480308
480309
480310
480311
480312
480313
480314
480315
480316
480317
480318
480319
480320
480321
480322
480323
480324
480325
480326
480327
480328
480329
480330
480331
480332
480333
480334
480335
480336
480337
480338
480339
480340
480341
480342
480343
480344
480345
480346
480347
480348
480349
480350
480351
480352
480353
480354
480355
480356
480357
480358
480359
480360
480361
480362
480363
480364
480365
480366
480367
480368
480369
480370
480371
480372
480373
480374
480375
480376
480377
480378
480379
480380
480381
480382
480383
480384
480385
480386
480387
480388
480389
480390
480391
480392
480393
480394
480395
480396
480397
480398
480399
480400
480401
480402
480403
480404
480405
480406
480407
480408
480409
480410
480411
480412
480413
480414
480415
480416
480417
480418
480419
480420
480421
480422
480423
480424
480425
480426
480427
480428
480429
480430
480431
480432
480433
480434
480435
480436
480437
480438
480439
480440
480441
480442
480443
480444
480445
480446
480447
480448
480449
480450
480451
480452
480453
480454
480455
480456
480457
480458
480459
480460
480461
480462
480463
480464
480465
480466
480467
480468
480469
480470
480471
480472
480473
480474
480475
480476
480477
480478
480479
480480
480481
480482
480483
480484
480485
480486
480487
480488
480489
480490
480491
480492
480493
480494
480495
480496
480497
480498
480499
480500
480501
480502
480503
480504
480505
480506
480507
480508
480509
480510
480511
480512
480513
480514
480515
480516
480517
480518
480519
480520
480521
480522
480523
480524
480525
480526
480527
480528
480529
480530
480531
480532
480533
480534
480535
480536
480537
480538
480539
480540
480541
480542
480543
480544
480545
480546
480547
480548
480549
480550
480551
480552
480553
480554
480555
480556
480557
480558
480559
480560
480561
480562
480563
480564
480565
480566
480567
480568
480569
480570
480571
480572
480573
480574
480575
480576
480577
480578
480579
480580
480581
480582
480583
480584
480585
480586
480587
480588
480589
480590
480591
480592
480593
480594
480595
480596
480597
480598
480599
480600
480601
480602
480603
480604
480605
480606
480607
480608
480609
480610
480611
480612
480613
480614
480615
480616
480617
480618
480619
480620
480621
480622
480623
480624
480625
480626
480627
480628
480629
480630
480631
480632
480633
480634
480635
480636
480637
480638
480639
480640
480641
480642
480643
480644
480645
480646
480647
480648
480649
480650
480651
480652
480653
480654
480655
480656
480657
480658
480659
480660
480661
480662
480663
480664
480665
480666
480667
480668
480669
480670
480671
480672
480673
480674
480675
480676
480677
480678
480679
480680
480681
480682
480683
480684
480685
480686
480687
480688
480689
480690
480691
480692
480693
480694
480695
480696
480697
480698
480699
480700
480701
480702
480703
480704
480705
480706
480707
480708
480709
480710
480711
480712
480713
480714
480715
480716
480717
480718
480719
480720
480721
480722
480723
480724
480725
480726
480727
480728
480729
480730
480731
480732
480733
480734
480735
480736
480737
480738
480739
480740
480741
480742
480743
480744
480745
480746
480747
480748
480749
480750
480751
480752
480753
480754
480755
480756
480757
480758
480759
480760
480761
480762
480763
480764
480765
480766
480767
480768
480769
480770
480771
480772
480773
480774
480775
480776
480777
480778
480779
480780
480781
480782
480783
480784
480785
480786
480787
480788
480789
480790
480791
480792
480793
480794
480795
480796
480797
480798
480799
480800
480801
480802
480803
480804
480805
480806
480807
480808
480809
480810
480811
480812
480813
480814
480815
480816
480817
480818
480819
480820
480821
480822
480823
480824
480825
480826
480827
480828
480829
480830
480831
480832
480833
480834
480835
480836
480837
480838
480839
480840
480841
480842
480843
480844
480845
480846
480847
480848
480849
480850
480851
480852
480853
480854
480855
480856
480857
480858
480859
480860
480861
480862
480863
480864
480865
480866
480867
480868
480869
480870
480871
480872
480873
480874
480875
480876
480877
480878
480879
480880
480881
480882
480883
480884
480885
480886
480887
480888
480889
480890
480891
480892
480893
480894
480895
480896
480897
480898
480899
480900
480901
480902
480903
480904
480905
480906
480907
480908
480909
480910
480911
480912
480913
480914
480915
480916
480917
480918
480919
480920
480921
480922
480923
480924
480925
480926
480927
480928
480929
480930
480931
480932
480933
480934
480935
480936
480937
480938
480939
480940
480941
480942
480943
480944
480945
480946
480947
480948
480949
480950
480951
480952
480953
480954
480955
480956
480957
480958
480959
480960
480961
480962
480963
480964
480965
480966
480967
480968
480969
480970
480971
480972
480973
480974
480975
480976
480977
480978
480979
480980
480981
480982
480983
480984
480985
480986
480987
480988
480989
480990
480991
480992
480993
480994
480995
480996
480997
480998
480999
481000
481001
481002
481003
481004
481005
481006
481007
481008
481009
481010
481011
481012
481013
481014
481015
481016
481017
481018
481019
481020
481021
481022
481023
481024
481025
481026
481027
481028
481029
481030
481031
481032
481033
481034
481035
481036
481037
481038
481039
481040
481041
481042
481043
481044
481045
481046
481047
481048
481049
481050
481051
481052
481053
481054
481055
481056
481057
481058
481059
481060
481061
481062
481063
481064
481065
481066
481067
481068
481069
481070
481071
481072
481073
481074
481075
481076
481077
481078
481079
481080
481081
481082
481083
481084
481085
481086
481087
481088
481089
481090
481091
481092
481093
481094
481095
481096
481097
481098
481099
481100
481101
481102
481103
481104
481105
481106
481107
481108
481109
481110
481111
481112
481113
481114
481115
481116
481117
481118
481119
481120
481121
481122
481123
481124
481125
481126
481127
481128
481129
481130
481131
481132
481133
481134
481135
481136
481137
481138
481139
481140
481141
481142
481143
481144
481145
481146
481147
481148
481149
481150
481151
481152
481153
481154
481155
481156
481157
481158
481159
481160
481161
481162
481163
481164
481165
481166
481167
481168
481169
481170
481171
481172
481173
481174
481175
481176
481177
481178
481179
481180
481181
481182
481183
481184
481185
481186
481187
481188
481189
481190
481191
481192
481193
481194
481195
481196
481197
481198
481199
481200
481201
481202
481203
481204
481205
481206
481207
481208
481209
481210
481211
481212
481213
481214
481215
481216
481217
481218
481219
481220
481221
481222
481223
481224
481225
481226
481227
481228
481229
481230
481231
481232
481233
481234
481235
481236
481237
481238
481239
481240
481241
481242
481243
481244
481245
481246
481247
481248
481249
481250
481251
481252
481253
481254
481255
481256
481257
481258
481259
481260
481261
481262
481263
481264
481265
481266
481267
481268
481269
481270
481271
481272
481273
481274
481275
481276
481277
481278
481279
481280
481281
481282
481283
481284
481285
481286
481287
481288
481289
481290
481291
481292
481293
481294
481295
481296
481297
481298
481299
481300
481301
481302
481303
481304
481305
481306
481307
481308
481309
481310
481311
481312
481313
481314
481315
481316
481317
481318
481319
481320
481321
481322
481323
481324
481325
481326
481327
481328
481329
481330
481331
481332
481333
481334
481335
481336
481337
481338
481339
481340
481341
481342
481343
481344
481345
481346
481347
481348
481349
481350
481351
481352
481353
481354
481355
481356
481357
481358
481359
481360
481361
481362
481363
481364
481365
481366
481367
481368
481369
481370
481371
481372
481373
481374
481375
481376
481377
481378
481379
481380
481381
481382
481383
481384
481385
481386
481387
481388
481389
481390
481391
481392
481393
481394
481395
481396
481397
481398
481399
481400
481401
481402
481403
481404
481405
481406
481407
481408
481409
481410
481411
481412
481413
481414
481415
481416
481417
481418
481419
481420
481421
481422
481423
481424
481425
481426
481427
481428
481429
481430
481431
481432
481433
481434
481435
481436
481437
481438
481439
481440
481441
481442
481443
481444
481445
481446
481447
481448
481449
481450
481451
481452
481453
481454
481455
481456
481457
481458
481459
481460
481461
481462
481463
481464
481465
481466
481467
481468
481469
481470
481471
481472
481473
481474
481475
481476
481477
481478
481479
481480
481481
481482
481483
481484
481485
481486
481487
481488
481489
481490
481491
481492
481493
481494
481495
481496
481497
481498
481499
481500
481501
481502
481503
481504
481505
481506
481507
481508
481509
481510
481511
481512
481513
481514
481515
481516
481517
481518
481519
481520
481521
481522
481523
481524
481525
481526
481527
481528
481529
481530
481531
481532
481533
481534
481535
481536
481537
481538
481539
481540
481541
481542
481543
481544
481545
481546
481547
481548
481549
481550
481551
481552
481553
481554
481555
481556
481557
481558
481559
481560
481561
481562
481563
481564
481565
481566
481567
481568
481569
481570
481571
481572
481573
481574
481575
481576
481577
481578
481579
481580
481581
481582
481583
481584
481585
481586
481587
481588
481589
481590
481591
481592
481593
481594
481595
481596
481597
481598
481599
481600
481601
481602
481603
481604
481605
481606
481607
481608
481609
481610
481611
481612
481613
481614
481615
481616
481617
481618
481619
481620
481621
481622
481623
481624
481625
481626
481627
481628
481629
481630
481631
481632
481633
481634
481635
481636
481637
481638
481639
481640
481641
481642
481643
481644
481645
481646
481647
481648
481649
481650
481651
481652
481653
481654
481655
481656
481657
481658
481659
481660
481661
481662
481663
481664
481665
481666
481667
481668
481669
481670
481671
481672
481673
481674
481675
481676
481677
481678
481679
481680
481681
481682
481683
481684
481685
481686
481687
481688
481689
481690
481691
481692
481693
481694
481695
481696
481697
481698
481699
481700
481701
481702
481703
481704
481705
481706
481707
481708
481709
481710
481711
481712
481713
481714
481715
481716
481717
481718
481719
481720
481721
481722
481723
481724
481725
481726
481727
481728
481729
481730
481731
481732
481733
481734
481735
481736
481737
481738
481739
481740
481741
481742
481743
481744
481745
481746
481747
481748
481749
481750
481751
481752
481753
481754
481755
481756
481757
481758
481759
481760
481761
481762
481763
481764
481765
481766
481767
481768
481769
481770
481771
481772
481773
481774
481775
481776
481777
481778
481779
481780
481781
481782
481783
481784
481785
481786
481787
481788
481789
481790
481791
481792
481793
481794
481795
481796
481797
481798
481799
481800
481801
481802
481803
481804
481805
481806
481807
481808
481809
481810
481811
481812
481813
481814
481815
481816
481817
481818
481819
481820
481821
481822
481823
481824
481825
481826
481827
481828
481829
481830
481831
481832
481833
481834
481835
481836
481837
481838
481839
481840
481841
481842
481843
481844
481845
481846
481847
481848
481849
481850
481851
481852
481853
481854
481855
481856
481857
481858
481859
481860
481861
481862
481863
481864
481865
481866
481867
481868
481869
481870
481871
481872
481873
481874
481875
481876
481877
481878
481879
481880
481881
481882
481883
481884
481885
481886
481887
481888
481889
481890
481891
481892
481893
481894
481895
481896
481897
481898
481899
481900
481901
481902
481903
481904
481905
481906
481907
481908
481909
481910
481911
481912
481913
481914
481915
481916
481917
481918
481919
481920
481921
481922
481923
481924
481925
481926
481927
481928
481929
481930
481931
481932
481933
481934
481935
481936
481937
481938
481939
481940
481941
481942
481943
481944
481945
481946
481947
481948
481949
481950
481951
481952
481953
481954
481955
481956
481957
481958
481959
481960
481961
481962
481963
481964
481965
481966
481967
481968
481969
481970
481971
481972
481973
481974
481975
481976
481977
481978
481979
481980
481981
481982
481983
481984
481985
481986
481987
481988
481989
481990
481991
481992
481993
481994
481995
481996
481997
481998
481999
482000
482001
482002
482003
482004
482005
482006
482007
482008
482009
482010
482011
482012
482013
482014
482015
482016
482017
482018
482019
482020
482021
482022
482023
482024
482025
482026
482027
482028
482029
482030
482031
482032
482033
482034
482035
482036
482037
482038
482039
482040
482041
482042
482043
482044
482045
482046
482047
482048
482049
482050
482051
482052
482053
482054
482055
482056
482057
482058
482059
482060
482061
482062
482063
482064
482065
482066
482067
482068
482069
482070
482071
482072
482073
482074
482075
482076
482077
482078
482079
482080
482081
482082
482083
482084
482085
482086
482087
482088
482089
482090
482091
482092
482093
482094
482095
482096
482097
482098
482099
482100
482101
482102
482103
482104
482105
482106
482107
482108
482109
482110
482111
482112
482113
482114
482115
482116
482117
482118
482119
482120
482121
482122
482123
482124
482125
482126
482127
482128
482129
482130
482131
482132
482133
482134
482135
482136
482137
482138
482139
482140
482141
482142
482143
482144
482145
482146
482147
482148
482149
482150
482151
482152
482153
482154
482155
482156
482157
482158
482159
482160
482161
482162
482163
482164
482165
482166
482167
482168
482169
482170
482171
482172
482173
482174
482175
482176
482177
482178
482179
482180
482181
482182
482183
482184
482185
482186
482187
482188
482189
482190
482191
482192
482193
482194
482195
482196
482197
482198
482199
482200
482201
482202
482203
482204
482205
482206
482207
482208
482209
482210
482211
482212
482213
482214
482215
482216
482217
482218
482219
482220
482221
482222
482223
482224
482225
482226
482227
482228
482229
482230
482231
482232
482233
482234
482235
482236
482237
482238
482239
482240
482241
482242
482243
482244
482245
482246
482247
482248
482249
482250
482251
482252
482253
482254
482255
482256
482257
482258
482259
482260
482261
482262
482263
482264
482265
482266
482267
482268
482269
482270
482271
482272
482273
482274
482275
482276
482277
482278
482279
482280
482281
482282
482283
482284
482285
482286
482287
482288
482289
482290
482291
482292
482293
482294
482295
482296
482297
482298
482299
482300
482301
482302
482303
482304
482305
482306
482307
482308
482309
482310
482311
482312
482313
482314
482315
482316
482317
482318
482319
482320
482321
482322
482323
482324
482325
482326
482327
482328
482329
482330
482331
482332
482333
482334
482335
482336
482337
482338
482339
482340
482341
482342
482343
482344
482345
482346
482347
482348
482349
482350
482351
482352
482353
482354
482355
482356
482357
482358
482359
482360
482361
482362
482363
482364
482365
482366
482367
482368
482369
482370
482371
482372
482373
482374
482375
482376
482377
482378
482379
482380
482381
482382
482383
482384
482385
482386
482387
482388
482389
482390
482391
482392
482393
482394
482395
482396
482397
482398
482399
482400
482401
482402
482403
482404
482405
482406
482407
482408
482409
482410
482411
482412
482413
482414
482415
482416
482417
482418
482419
482420
482421
482422
482423
482424
482425
482426
482427
482428
482429
482430
482431
482432
482433
482434
482435
482436
482437
482438
482439
482440
482441
482442
482443
482444
482445
482446
482447
482448
482449
482450
482451
482452
482453
482454
482455
482456
482457
482458
482459
482460
482461
482462
482463
482464
482465
482466
482467
482468
482469
482470
482471
482472
482473
482474
482475
482476
482477
482478
482479
482480
482481
482482
482483
482484
482485
482486
482487
482488
482489
482490
482491
482492
482493
482494
482495
482496
482497
482498
482499
482500
482501
482502
482503
482504
482505
482506
482507
482508
482509
482510
482511
482512
482513
482514
482515
482516
482517
482518
482519
482520
482521
482522
482523
482524
482525
482526
482527
482528
482529
482530
482531
482532
482533
482534
482535
482536
482537
482538
482539
482540
482541
482542
482543
482544
482545
482546
482547
482548
482549
482550
482551
482552
482553
482554
482555
482556
482557
482558
482559
482560
482561
482562
482563
482564
482565
482566
482567
482568
482569
482570
482571
482572
482573
482574
482575
482576
482577
482578
482579
482580
482581
482582
482583
482584
482585
482586
482587
482588
482589
482590
482591
482592
482593
482594
482595
482596
482597
482598
482599
482600
482601
482602
482603
482604
482605
482606
482607
482608
482609
482610
482611
482612
482613
482614
482615
482616
482617
482618
482619
482620
482621
482622
482623
482624
482625
482626
482627
482628
482629
482630
482631
482632
482633
482634
482635
482636
482637
482638
482639
482640
482641
482642
482643
482644
482645
482646
482647
482648
482649
482650
482651
482652
482653
482654
482655
482656
482657
482658
482659
482660
482661
482662
482663
482664
482665
482666
482667
482668
482669
482670
482671
482672
482673
482674
482675
482676
482677
482678
482679
482680
482681
482682
482683
482684
482685
482686
482687
482688
482689
482690
482691
482692
482693
482694
482695
482696
482697
482698
482699
482700
482701
482702
482703
482704
482705
482706
482707
482708
482709
482710
482711
482712
482713
482714
482715
482716
482717
482718
482719
482720
482721
482722
482723
482724
482725
482726
482727
482728
482729
482730
482731
482732
482733
482734
482735
482736
482737
482738
482739
482740
482741
482742
482743
482744
482745
482746
482747
482748
482749
482750
482751
482752
482753
482754
482755
482756
482757
482758
482759
482760
482761
482762
482763
482764
482765
482766
482767
482768
482769
482770
482771
482772
482773
482774
482775
482776
482777
482778
482779
482780
482781
482782
482783
482784
482785
482786
482787
482788
482789
482790
482791
482792
482793
482794
482795
482796
482797
482798
482799
482800
482801
482802
482803
482804
482805
482806
482807
482808
482809
482810
482811
482812
482813
482814
482815
482816
482817
482818
482819
482820
482821
482822
482823
482824
482825
482826
482827
482828
482829
482830
482831
482832
482833
482834
482835
482836
482837
482838
482839
482840
482841
482842
482843
482844
482845
482846
482847
482848
482849
482850
482851
482852
482853
482854
482855
482856
482857
482858
482859
482860
482861
482862
482863
482864
482865
482866
482867
482868
482869
482870
482871
482872
482873
482874
482875
482876
482877
482878
482879
482880
482881
482882
482883
482884
482885
482886
482887
482888
482889
482890
482891
482892
482893
482894
482895
482896
482897
482898
482899
482900
482901
482902
482903
482904
482905
482906
482907
482908
482909
482910
482911
482912
482913
482914
482915
482916
482917
482918
482919
482920
482921
482922
482923
482924
482925
482926
482927
482928
482929
482930
482931
482932
482933
482934
482935
482936
482937
482938
482939
482940
482941
482942
482943
482944
482945
482946
482947
482948
482949
482950
482951
482952
482953
482954
482955
482956
482957
482958
482959
482960
482961
482962
482963
482964
482965
482966
482967
482968
482969
482970
482971
482972
482973
482974
482975
482976
482977
482978
482979
482980
482981
482982
482983
482984
482985
482986
482987
482988
482989
482990
482991
482992
482993
482994
482995
482996
482997
482998
482999
483000
483001
483002
483003
483004
483005
483006
483007
483008
483009
483010
483011
483012
483013
483014
483015
483016
483017
483018
483019
483020
483021
483022
483023
483024
483025
483026
483027
483028
483029
483030
483031
483032
483033
483034
483035
483036
483037
483038
483039
483040
483041
483042
483043
483044
483045
483046
483047
483048
483049
483050
483051
483052
483053
483054
483055
483056
483057
483058
483059
483060
483061
483062
483063
483064
483065
483066
483067
483068
483069
483070
483071
483072
483073
483074
483075
483076
483077
483078
483079
483080
483081
483082
483083
483084
483085
483086
483087
483088
483089
483090
483091
483092
483093
483094
483095
483096
483097
483098
483099
483100
483101
483102
483103
483104
483105
483106
483107
483108
483109
483110
483111
483112
483113
483114
483115
483116
483117
483118
483119
483120
483121
483122
483123
483124
483125
483126
483127
483128
483129
483130
483131
483132
483133
483134
483135
483136
483137
483138
483139
483140
483141
483142
483143
483144
483145
483146
483147
483148
483149
483150
483151
483152
483153
483154
483155
483156
483157
483158
483159
483160
483161
483162
483163
483164
483165
483166
483167
483168
483169
483170
483171
483172
483173
483174
483175
483176
483177
483178
483179
483180
483181
483182
483183
483184
483185
483186
483187
483188
483189
483190
483191
483192
483193
483194
483195
483196
483197
483198
483199
483200
483201
483202
483203
483204
483205
483206
483207
483208
483209
483210
483211
483212
483213
483214
483215
483216
483217
483218
483219
483220
483221
483222
483223
483224
483225
483226
483227
483228
483229
483230
483231
483232
483233
483234
483235
483236
483237
483238
483239
483240
483241
483242
483243
483244
483245
483246
483247
483248
483249
483250
483251
483252
483253
483254
483255
483256
483257
483258
483259
483260
483261
483262
483263
483264
483265
483266
483267
483268
483269
483270
483271
483272
483273
483274
483275
483276
483277
483278
483279
483280
483281
483282
483283
483284
483285
483286
483287
483288
483289
483290
483291
483292
483293
483294
483295
483296
483297
483298
483299
483300
483301
483302
483303
483304
483305
483306
483307
483308
483309
483310
483311
483312
483313
483314
483315
483316
483317
483318
483319
483320
483321
483322
483323
483324
483325
483326
483327
483328
483329
483330
483331
483332
483333
483334
483335
483336
483337
483338
483339
483340
483341
483342
483343
483344
483345
483346
483347
483348
483349
483350
483351
483352
483353
483354
483355
483356
483357
483358
483359
483360
483361
483362
483363
483364
483365
483366
483367
483368
483369
483370
483371
483372
483373
483374
483375
483376
483377
483378
483379
483380
483381
483382
483383
483384
483385
483386
483387
483388
483389
483390
483391
483392
483393
483394
483395
483396
483397
483398
483399
483400
483401
483402
483403
483404
483405
483406
483407
483408
483409
483410
483411
483412
483413
483414
483415
483416
483417
483418
483419
483420
483421
483422
483423
483424
483425
483426
483427
483428
483429
483430
483431
483432
483433
483434
483435
483436
483437
483438
483439
483440
483441
483442
483443
483444
483445
483446
483447
483448
483449
483450
483451
483452
483453
483454
483455
483456
483457
483458
483459
483460
483461
483462
483463
483464
483465
483466
483467
483468
483469
483470
483471
483472
483473
483474
483475
483476
483477
483478
483479
483480
483481
483482
483483
483484
483485
483486
483487
483488
483489
483490
483491
483492
483493
483494
483495
483496
483497
483498
483499
483500
483501
483502
483503
483504
483505
483506
483507
483508
483509
483510
483511
483512
483513
483514
483515
483516
483517
483518
483519
483520
483521
483522
483523
483524
483525
483526
483527
483528
483529
483530
483531
483532
483533
483534
483535
483536
483537
483538
483539
483540
483541
483542
483543
483544
483545
483546
483547
483548
483549
483550
483551
483552
483553
483554
483555
483556
483557
483558
483559
483560
483561
483562
483563
483564
483565
483566
483567
483568
483569
483570
483571
483572
483573
483574
483575
483576
483577
483578
483579
483580
483581
483582
483583
483584
483585
483586
483587
483588
483589
483590
483591
483592
483593
483594
483595
483596
483597
483598
483599
483600
483601
483602
483603
483604
483605
483606
483607
483608
483609
483610
483611
483612
483613
483614
483615
483616
483617
483618
483619
483620
488570
488571
488572
488573
488574
488575
488576
488577
488578
488579
488580
488581
488582
488583
488584
488585
488586
488587
488588
488589
488590
488591
488592
488593
488594
488595
488596
488597
488598
488599
488600
488601
488602
488603
488604
488605
488606
488607
488608
488609
488610
488611
488612
488613
488614
488615
488616
488617
488618
488619
488620
488621
488622
488623
488624
488625
488626
488627
488628
488629
488630
488631
488632
488633
488634
488635
488636
488637
488638
488639
488640
488641
488642
488643
488644
488645
488646
488647
488648
488649
488650
488651
488652
488653
488654
488655
488656
488657
488658
488659
488660
488661
488662
488663
488664
488665
488666
488667
488668
488669
488670
488671
488672
488673
488674
488675
488676
488677
488678
488679
488680
488681
488682
488683
488684
488685
488686
488687
488688
488689
488690
488691
488692
488693
488694
488695
488696
488697
488698
488699
488700
488701
488702
488703
488704
488705
488706
488707
488708
488709
488710
488711
488712
488713
488714
488715
488716
488717
488718
488719
488720
488721
488722
488723
488724
488725
488726
488727
488728
488729
488730
488731
488732
488733
488734
488735
488736
488737
488738
488739
488740
488741
488742
488743
488744
488745
488746
488747
488748
488749
488750
488751
488752
488753
488754
488755
488756
488757
488758
488759
488760
488761
488762
488763
488764
488765
488766
488767
488768
488769
488770
488771
488772
488773
488774
488775
488776
488777
488778
488779
488780
488781
488782
488783
488784
488785
488786
488787
488788
488789
488790
488791
488792
488793
488794
488795
488796
488797
488798
488799
488800
488801
488802
488803
488804
488805
488806
488807
488808
488809
488810
488811
488812
488813
488814
488815
488816
488817
488818
488819
488820
488821
488822
488823
488824
488825
488826
488827
488828
488829
488830
488831
488832
488833
488834
488835
488836
488837
488838
488839
488840
488841
488842
488843
488844
488845
488846
488847
488848
488849
488850
488851
488852
488853
488854
488855
488856
488857
488858
488859
488860
488861
488862
488863
488864
488865
488866
488867
488868
488869
488870
488871
488872
488873
488874
488875
488876
488877
488878
488879
488880
488881
488882
488883
488884
488885
488886
488887
488888
488889
488890
488891
488892
488893
488894
488895
488896
488897
488898
488899
488900
488901
488902
488903
488904
488905
488906
488907
488908
488909
488910
488911
488912
488913
488914
488915
488916
488917
488918
488919
488920
488921
488922
488923
488924
488925
488926
488927
488928
488929
488930
488931
488932
488933
488934
488935
488936
488937
488938
488939
488940
488941
488942
488943
488944
488945
488946
488947
488948
488949
488950
488951
488952
488953
488954
488955
488956
488957
488958
488959
488960
488961
488962
488963
488964
488965
488966
488967
488968
488969
488970
488971
488972
488973
488974
488975
488976
488977
488978
488979
488980
488981
488982
488983
488984
488985
488986
488987
488988
488989
488990
488991
488992
488993
488994
488995
488996
488997
488998
488999
489000
489001
489002
489003
489004
489005
489006
489007
489008
489009
489010
489011
489012
489013
489014
489015
489016
489017
489018
489019
489020
489021
489022
489023
489024
489025
489026
489027
489028
489029
489030
489031
489032
489033
489034
489035
489036
489037
489038
489039
489040
489041
489042
489043
489044
489045
489046
489047
489048
489049
489050
489051
489052
489053
489054
489055
489056
489057
489058
489059
489060
489061
489062
489063
489064
489065
489066
489067
489068
489069
489070
489071
489072
489073
489074
489075
489076
489077
489078
489079
489080
489081
489082
489083
489084
489085
489086
489087
489088
489089
489090
489091
489092
489093
489094
489095
489096
489097
489098
489099
489100
489101
489102
489103
489104
489105
489106
489107
489108
489109
489110
489111
489112
489113
489114
489115
489116
489117
489118
489119
489120
489121
489122
489123
489124
489125
489126
489127
489128
489129
489130
489131
489132
489133
489134
489135
489136
489137
489138
489139
489140
489141
489142
489143
489144
489145
489146
489147
489148
489149
489150
489151
489152
489153
489154
489155
489156
489157
489158
489159
489160
489161
489162
489163
489164
489165
489166
489167
489168
489169
489170
489171
489172
489173
489174
489175
489176
489177
489178
489179
489180
489181
489182
489183
489184
489185
489186
489187
489188
489189
489190
489191
489192
489193
489194
489195
489196
489197
489198
489199
489200
489201
489202
489203
489204
489205
489206
489207
489208
489209
489210
489211
489212
489213
489214
489215
489216
489217
489218
489219
489220
489221
489222
489223
489224
489225
489226
489227
489228
489229
489230
489231
489232
489233
489234
489235
489236
489237
489238
489239
489240
489241
489242
489243
489244
489245
489246
489247
489248
489249
489250
489251
489252
489253
489254
489255
489256
489257
489258
489259
489260
489261
489262
489263
489264
489265
489266
489267
489268
489269
489270
489271
489272
489273
489274
489275
489276
531041
531042
531043
531044
531045
531046
531047
531048
531049
531050
531051
531052
531053
531054
531055
531056
531057
531058
531059
531060
531061
531062
531063
531064
531065
531066
531067
531068
531069
531070
531071
531072
531073
531074
531075
531076
531077
531078
531079
531080
531081
531082
531083
531084
531085
531086
531087
531088
531089
531090
531091
531092
531093
531094
531095
531096
531097
531098
531099
531100
531101
531102
531103
531104
531105
531106
531107
531108
531109
531110
531111
531112
531113
531114
531115
531116
531117
531118
531119
531120
531121
531122
531123
531124
531125
531126
531127
531128
531129
531130
531131
531132
531133
531134
531135
531136
531137
531138
531139
531140
531141
531142
531143
531144
531145
531146
531147
531148
531149
531150
531151
531152
531153
531154
531155
531156
531157
531158
531159
531160
531161
531162
531163
531164
531165
531166
531167
531168
531169
531170
531171
531172
531173
531174
531175
531176
531177
531178
531179
531180
531181
531182
531183
531184
531185
531186
531187
531188
531189
531190
531191
531192
531193
531194
531195
531196
531197
531198
531199
531200
531201
531202
531203
531204
531205
531206
531207
531208
531209
531210
531211
531212
531213
531214
531215
531216
531217
531218
531219
531220
531221
531222
531223
531224
531225
531226
531227
531228
531229
531230
531231
531232
531233
531234
531235
531236
531237
531238
531239
531240
531241
531242
531243
531244
531245
531246
531247
531248
531249
531250
531251
531252
531253
531254
531255
531256
531257
531258
531259
531260
531261
531262
531263
531264
531265
531266
531267
531268
531269
531270
531271
531272
531273
531274
531275
531276
531277
531278
531279
531280
531281
531282
531283
531284
531285
531286
531287
531288
531289
531290
531291
531292
531293
531294
531295
531296
531297
531298
531299
531300
531301
531302
531303
531304
531305
531306
531307
531308
531309
531310
531311
531312
531313
531314
531315
531316
531317
531318
531319
531320
531321
531322
531323
531324
531325
531326
531327
531328
531329
531330
531331
531332
531333
531334
531335
531336
531337
531338
531339
531340
531341
531342
531343
531344
531345
531346
531347
531348
531349
531350
531351
531352
531353
531354
531355
531356
531357
531358
531359
531360
531361
531362
531363
531364
531365
531366
531367
531368
531369
531370
531371
531372
531373
531374
531375
531376
531377
531378
531379
531380
531381
531382
531383
531384
531385
531386
531387
531388
531389
531390
531391
531392
531393
531394
531395
531396
531397
531398
531399
531400
531401
531402
531403
531404
531405
531406
531407
531408
531409
531410
531411
531412
531413
531414
531415
531416
531417
531418
531419
531420
531421
531422
531423
531424
531425
531426
531427
531428
531429
531430
531431
531432
531433
531434
531435
531436
531437
531438
531439
531440
531441
531442
531443
531444
531445
531446
531447
531448
531449
531450
531451
531452
531453
531454
531455
531456
531457
531458
531459
531460
531461
531462
531463
531464
531465
531466
531467
531468
531469
531470
531471
531472
531473
531474
531475
531476
531477
531478
531479
531480
531481
531482
531483
531484
531485
531486
531487
531488
531489
531490
531491
531492
531493
531494
531495
531496
531497
531498
531499
531500
531501
531502
531503
531504
531505
531506
531507
531508
531509
531510
531511
531512
531513
531514
531515
531516
531517
531518
531519
531520
531521
531522
531523
531524
531525
531526
531527
531528
531529
531530
531531
531532
531533
531534
531535
531536
531537
531538
531539
531540
531541
531542
531543
531544
531545
531546
531547
531548
531549
531550
531551
531552
531553
531554
531555
531556
531557
531558
531559
531560
531561
531562
531563
531564
531565
531566
531567
531568
531569
531570
531571
531572
531573
531574
531575
531576
531577
531578
531579
531580
531581
531582
531583
531584
531585
531586
531587
531588
531589
531590
531591
531592
531593
531594
531595
531596
531597
531598
531599
531600
531601
531602
531603
531604
531605
531606
531607
531608
531609
531610
531611
531612
531613
531614
531615
531616
531617
531618
531619
531620
531621
531622
531623
531624
531625
531626
531627
531628
531629
531630
531631
531632
531633
531634
531635
531636
531637
531638
531639
531640
531641
531642
531643
531644
531645
531646
531647
531648
531649
531650
531651
531652
531653
531654
531655
531656
531657
531658
531659
531660
531661
531662
531663
531664
531665
531666
531667
531668
531669
531670
531671
531672
531673
531674
531675
531676
531677
531678
531679
531680
531681
531682
531683
531684
531685
531686
531687
531688
531689
531690
531691
531692
531693
531694
531695
531696
531697
531698
531699
531700
531701
531702
531703
531704
531705
531706
531707
531708
531709
531710
531711
531712
531713
531714
531715
531716
531717
531718
531719
531720
531721
531722
531723
531724
531725
531726
531727
531728
531729
531730
531731
531732
531733
531734
531735
531736
531737
531738
531739
531740
531741
531742
531743
531744
531745
531746
531747
531748
531749
531750
531751
531752
531753
531754
531755
531756
531757
531758
531759
531760
531761
531762
531763
531764
531765
531766
531767
531768
531769
531770
531771
531772
531773
531774
531775
531776
531777
531778
531779
531780
531781
531782
531783
531784
531785
531786
531787
531788
531789
531790
531791
531792
531793
531794
531795
531796
531797
531798
531799
531800
531801
531802
531803
531804
531805
531806
531807
531808
531809
531810
531811
531812
531813
531814
531815
531816
531817
531818
531819
531820
531821
531822
531823
531824
531825
531826
531827
531828
531829
531830
531831
531832
531833
531834
531835
531836
531837
531838
531839
531840
531841
531842
531843
531844
531845
531846
531847
531848
531849
531850
531851
531852
531853
531854
531855
531856
531857
531858
531859
531860
531861
531862
531863
531864
531865
531866
531867
531868
531869
531870
531871
531872
531873
531874
531875
531876
531877
531878
531879
531880
531881
531882
531883
531884
531885
531886
531887
531888
531889
531890
531891
531892
531893
531894
531895
531896
531897
531898
531899
531900
531901
531902
531903
531904
531905
531906
531907
531908
531909
531910
531911
531912
531913
531914
531915
531916
531917
531918
531919
531920
531921
531922
531923
531924
531925
531926
531927
531928
531929
531930
531931
531932
531933
531934
531935
531936
531937
531938
531939
531940
531941
531942
531943
531944
531945
531946
531947
531948
531949
531950
531951
531952
531953
531954
531955
531956
531957
531958
531959
531960
531961
531962
531963
531964
531965
531966
531967
531968
531969
531970
531971
531972
531973
531974
531975
531976
531977
531978
531979
531980
531981
531982
531983
531984
531985
531986
531987
531988
531989
531990
531991
531992
531993
531994
531995
531996
531997
531998
531999
532000
532001
532002
532003
532004
532005
532006
532007
532008
532009
532010
532011
532012
532013
532014
532015
532016
532017
532018
532019
532020
532021
532022
532023
532024
532025
532026
532027
532028
532029
532030
532031
532032
532033
532034
532035
532036
532037
532038
532039
532040
532041
532042
532043
532044
532045
532046
532047
532048
532049
532050
532051
532052
532053
532054
532055
532056
532057
532058
532059
532060
532061
532062
532063
532064
532065
532066
532067
532068
532069
532070
532071
532072
532073
532074
532075
532076
532077
532078
532079
532080
532081
532082
532083
532084
532085
532086
532087
532088
532089
532090
532091
532092
532093
532094
532095
532096
532097
532098
532099
532100
532101
532102
532103
532104
532105
532106
532107
532108
532109
532110
532111
532112
532113
532114
532115
532116
532117
532118
532119
532120
532121
532122
532123
532124
532125
532126
532127
532128
532129
532130
532131
532132
532133
532134
532135
532136
532137
532138
532139
532140
532141
532142
532143
532144
532145
532146
532147
532148
532149
532150
532151
532152
532153
532154
532155
532156
532157
532158
532159
532160
532161
532162
532163
532164
532165
532166
532167
532168
532169
532170
532171
532172
532173
532174
532175
532176
532177
532178
532179
532180
532181
532182
532183
532184
532185
532186
532187
532188
532189
532190
532191
532192
532193
532194
532195
532196
532197
532198
532199
532200
532201
532202
532203
532204
532205
532206
532207
532208
532209
532210
532211
532212
532213
532214
532215
532216
532217
532218
532219
532220
532221
532222
532223
532224
532225
532226
532227
532228
532229
532230
532231
532232
532233
532234
532235
532236
532237
532238
532239
532240
532241
532242
532243
532244
532245
532246
532247
532248
532249
532250
532251
532252
532253
532254
532255
532256
532257
532258
532259
532260
532261
532262
532263
532264
532265
532266
532267
532268
532269
532270
532271
532272
532273
532274
532275
532276
532277
532278
532279
532280
532281
532282
532283
532284
532285
532286
532287
532288
532289
532290
532291
532292
532293
532294
532295
532296
532297
532298
532299
532300
532301
532302
532303
532304
532305
532306
532307
532308
532309
532310
532311
532312
532313
532314
532315
532316
532317
532318
532319
532320
532321
532322
532323
532324
532325
532326
532327
532328
532329
532330
532331
532332
532333
532334
532335
532336
532337
532338
532339
532340
532341
532342
532343
532344
532345
532346
532347
532348
532349
532350
532351
532352
532353
532354
532355
532356
532357
532358
532359
532360
532361
532362
532363
532364
532365
532366
532367
532368
532369
532370
532371
532372
532373
532374
532375
532376
532377
532378
532379
532380
532381
532382
532383
532384
532385
532386
532387
532388
532389
532390
532391
532392
532393
532394
532395
532396
532397
532398
532399
532400
532401
532402
532403
532404
532405
532406
532407
532408
532409
532410
532411
532412
532413
532414
532415
532416
532417
532418
532419
532420
532421
532422
532423
532424
532425
532426
532427
532428
532429
532430
532431
532432
532433
532434
532435
532436
532437
532438
532439
532440
532441
532442
532443
532444
532445
532446
532447
532448
532449
532450
532451
532452
532453
532454
532455
532456
532457
532458
532459
532460
532461
532462
532463
532464
532465
532466
532467
532468
532469
532470
532471
532472
532473
532474
532475
532476
532477
532478
532479
532480
532481
532482
532483
532484
532485
532486
532487
532488
532489
532490
532491
532492
532493
532494
532495
532496
532497
532498
532499
532500
532501
532502
532503
532504
532505
532506
532507
532508
532509
532510
532511
532512
532513
532514
532515
532516
532517
532518
532519
532520
532521
532522
532523
532524
532525
532526
532527
532528
532529
532530
532531
532532
532533
532534
532535
532536
532537
532538
532539
532540
532541
532542
532543
532544
532545
532546
532547
532548
532549
532550
532551
532552
532553
532554
532555
532556
532557
532558
532559
532560
532561
532562
532563
532564
532565
532566
532567
532568
532569
532570
532571
532572
532573
532574
532575
532576
532577
532578
532579
532580
532581
532582
532583
532584
532585
532586
532587
532588
532589
532590
532591
532592
532593
532594
532595
532596
532597
532598
532599
532600
532601
532602
532603
532604
532605
532606
532607
532608
532609
532610
532611
532612
532613
532614
532615
532616
532617
532618
532619
532620
532621
532622
532623
532624
532625
532626
532627
532628
532629
532630
532631
532632
532633
532634
532635
532636
532637
532638
532639
532640
532641
532642
532643
532644
532645
532646
532647
532648
532649
532650
532651
532652
532653
532654
532655
532656
532657
532658
532659
532660
532661
532662
532663
532664
532665
532666
532667
532668
532669
532670
532671
532672
532673
532674
532675
532676
532677
532678
532679
532680
532681
532682
532683
532684
532685
532686
532687
532688
532689
532690
532691
532692
532693
532694
532695
532696
532697
532698
532699
532700
532701
532702
532703
532704
532705
532706
532707
532708
532709
532710
532711
532712
532713
532714
532715
532716
532717
532718
532719
532720
532721
532722
532723
532724
532725
532726
532727
532728
532729
532730
532731
532732
532733
532734
532735
532736
532737
532738
532739
532740
532741
532742
532743
532744
532745
532746
532747
532748
532749
532750
532751
532752
532753
532754
532755
532756
532757
532758
532759
532760
532761
532762
532763
532764
532765
532766
532767
532768
532769
532770
532771
532772
532773
532774
532775
532776
532777
532778
532779
532780
532781
532782
532783
532784
532785
532786
532787
532788
532789
532790
532791
532792
532793
532794
532795
532796
532797
532798
532799
532800
532801
532802
532803
532804
532805
532806
532807
532808
532809
532810
532811
532812
532813
532814
532815
532816
532817
532818
532819
532820
532821
532822
532823
532824
532825
532826
532827
532828
532829
532830
532831
532832
532833
532834
532835
532836
532837
532838
532839
532840
532841
532842
532843
532844
532845
532846
532847
532848
532849
532850
532851
532852
532853
532854
532855
532856
532857
532858
532859
532860
532861
532862
532863
532864
532865
532866
532867
532868
532869
532870
532871
532872
532873
532874
532875
532876
532877
532878
532879
532880
532881
532882
532883
532884
532885
532886
532887
532888
532889
532890
532891
532892
532893
532894
532895
532896
532897
532898
532899
532900
532901
532902
532903
532904
532905
532906
532907
532908
532909
532910
532911
532912
532913
532914
532915
532916
532917
532918
532919
532920
532921
532922
532923
532924
532925
532926
532927
532928
532929
532930
532931
532932
532933
532934
532935
532936
532937
532938
532939
532940
532941
532942
532943
532944
532945
532946
532947
532948
532949
532950
532951
532952
532953
532954
532955
532956
532957
532958
532959
532960
532961
532962
532963
532964
532965
532966
532967
532968
532969
532970
532971
532972
532973
532974
532975
532976
532977
532978
532979
532980
532981
532982
532983
532984
532985
532986
532987
532988
532989
532990
532991
532992
532993
532994
532995
532996
532997
532998
532999
533000
533001
533002
533003
533004
533005
533006
533007
533008
533009
533010
533011
533012
533013
533014
533015
533016
533017
533018
533019
533020
533021
533022
533023
533024
533025
533026
533027
533028
533029
533030
533031
533032
533033
533034
533035
533036
533037
533038
533039
533040
533041
533042
533043
533044
533045
533046
533047
533048
533049
533050
533051
533052
533053
533054
533055
533056
533057
533058
533059
533060
533061
533062
533063
533064
533065
533066
533067
533068
533069
533070
533071
533072
533073
533074
533075
533076
533077
533078
533079
533080
533081
533082
533083
533084
533085
533086
533087
533088
533089
533090
533091
533092
533093
533094
533095
533096
533097
533098
533099
533100
533101
533102
533103
533104
533105
533106
533107
533108
533109
533110
533111
533112
533113
533114
533115
533116
533117
533118
533119
533120
533121
533122
533123
533124
533125
533126
533127
533128
533129
533130
533131
533132
533133
533134
533135
533136
533137
533138
533139
533140
533141
533142
533143
533144
533145
533146
533147
533148
533149
533150
533151
533152
533153
533154
533155
533156
533157
533158
533159
533160
533161
533162
533163
533164
533165
533166
533167
533168
533169
533170
533171
533172
533173
533174
533175
533176
533177
533178
533179
533180
533181
533182
533183
533184
533185
533186
533187
533188
533189
533190
533191
533192
533193
533194
533195
533196
533197
533198
533199
533200
533201
533202
533203
533204
533205
533206
533207
533208
533209
533210
533211
533212
533213
533214
533215
533216
533217
533218
533219
533220
533221
533222
533223
533224
533225
533226
533227
533228
533229
533230
533231
533232
533233
533234
533235
533236
533237
533238
533239
533240
533241
533242
533243
533244
533245
533246
533247
533248
533249
533250
533251
533252
533253
533254
533255
533256
533257
533258
533259
533260
533261
533262
533263
533264
533265
533266
533267
533268
533269
533270
533271
533272
533273
533274
533275
533276
533277
533278
533279
533280
533281
533282
533283
533284
533285
533286
533287
533288
533289
533290
533291
533292
533293
533294
533295
533296
533297
533298
533299
533300
533301
533302
533303
533304
533305
533306
533307
533308
533309
533310
533311
533312
533313
533314
533315
533316
533317
533318
533319
533320
533321
533322
533323
533324
533325
533326
533327
533328
533329
533330
533331
533332
533333
533334
533335
533336
533337
533338
533339
533340
533341
533342
533343
533344
533345
533346
533347
533348
533349
533350
533351
533352
533353
533354
533355
533356
533357
533358
533359
533360
533361
533362
533363
533364
533365
533366
533367
533368
533369
533370
533371
533372
533373
533374
533375
533376
533377
533378
533379
533380
533381
533382
533383
533384
533385
533386
533387
533388
533389
533390
533391
533392
533393
533394
533395
533396
533397
533398
533399
533400
533401
533402
533403
533404
533405
533406
533407
533408
533409
533410
533411
533412
533413
533414
533415
533416
533417
533418
533419
533420
533421
533422
533423
533424
533425
533426
533427
533428
533429
533430
533431
533432
533433
533434
533435
533436
533437
533438
533439
533440
533441
533442
533443
533444
533445
533446
533447
533448
533449
533450
533451
533452
533453
533454
533455
533456
533457
533458
533459
533460
533461
533462
533463
533464
533465
533466
533467
533468
533469
533470
533471
533472
533473
533474
533475
533476
533477
533478
533479
533480
533481
533482
533483
533484
533485
533486
533487
533488
533489
533490
533491
533492
533493
533494
533495
533496
533497
533498
533499
533500
533501
533502
533503
533504
533505
533506
533507
533508
533509
533510
533511
533512
533513
533514
533515
533516
533517
533518
533519
533520
533521
533522
533523
533524
533525
533526
533527
533528
533529
533530
533531
533532
533533
533534
533535
533536
533537
533538
533539
533540
533541
533542
533543
533544
533545
533546
533547
533548
533549
533550
533551
533552
533553
533554
533555
533556
533557
533558
533559
533560
533561
533562
533563
533564
533565
533566
533567
533568
533569
533570
533571
533572
533573
533574
533575
533576
533577
533578
533579
533580
533581
533582
533583
533584
533585
533586
533587
533588
533589
533590
533591
533592
533593
533594
533595
533596
533597
533598
533599
533600
533601
533602
533603
533604
533605
533606
533607
533608
533609
533610
533611
533612
533613
533614
533615
533616
533617
533618
533619
533620
533621
533622
533623
533624
533625
533626
533627
533628
533629
533630
533631
533632
533633
533634
533635
533636
533637
533638
533639
533640
533641
533642
533643
533644
533645
533646
533647
533648
533649
533650
533651
533652
533653
533654
533655
533656
533657
533658
533659
533660
533661
533662
533663
533664
533665
533666
533667
533668
533669
533670
533671
533672
533673
533674
533675
533676
533677
533678
533679
533680
533681
533682
533683
533684
533685
533686
533687
533688
533689
533690
533691
533692
533693
533694
533695
533696
533697
533698
533699
533700
533701
533702
533703
533704
533705
533706
533707
533708
533709
533710
533711
533712
533713
533714
533715
533716
533717
533718
533719
533720
533721
533722
533723
533724
533725
533726
533727
533728
533729
533730
533731
533732
533733
533734
533735
533736
533737
533738
533739
533740
533741
533742
533743
533744
533745
533746
533747
533748
533749
533750
533751
533752
533753
533754
533755
533756
533757
533758
533759
533760
533761
533762
533763
533764
533765
533766
533767
533768
533769
533770
533771
533772
533773
533774
533775
533776
533777
533778
533779
533780
533781
533782
533783
533784
533785
533786
533787
533788
533789
533790
533791
533792
533793
533794
533795
533796
533797
533798
533799
533800
533801
533802
533803
533804
533805
533806
533807
533808
533809
533810
533811
533812
533813
533814
533815
533816
533817
533818
533819
533820
533821
533822
533823
533824
533825
533826
533827
533828
533829
533830
533831
533832
533833
533834
533835
533836
533837
533838
533839
533840
533841
533842
533843
533844
533845
533846
533847
533848
533849
533850
533851
533852
533853
533854
533855
533856
533857
533858
533859
533860
533861
533862
533863
533864
533865
533866
533867
533868
533869
533870
533871
533872
533873
533874
533875
533876
533877
533878
533879
533880
533881
533882
533883
533884
533885
533886
533887
533888
533889
533890
533891
533892
533893
533894
533895
533896
533897
533898
533899
533900
533901
533902
533903
533904
533905
533906
533907
533908
533909
533910
533911
533912
533913
533914
533915
533916
533917
533918
533919
533920
533921
533922
533923
533924
533925
533926
533927
533928
533929
533930
533931
533932
533933
533934
533935
533936
533937
533938
533939
533940
533941
533942
533943
533944
533945
533946
533947
533948
533949
533950
533951
533952
533953
533954
533955
533956
533957
533958
533959
533960
533961
533962
533963
533964
533965
533966
533967
533968
533969
533970
533971
533972
533973
533974
533975
533976
533977
533978
533979
533980
533981
533982
533983
533984
533985
533986
533987
533988
533989
533990
533991
533992
533993
533994
533995
533996
533997
533998
533999
534000
534001
534002
534003
534004
534005
534006
534007
534008
534009
534010
534011
534012
534013
534014
534015
534016
534017
534018
534019
534020
534021
534022
534023
534024
534025
534026
534027
534028
534029
534030
534031
534032
534033
534034
534035
534036
534037
534038
534039
534040
534041
534042
534043
534044
534045
534046
534047
534048
534049
534050
534051
534052
534053
534054
534055
534056
534057
534058
534059
534060
534061
534062
534063
534064
534065
534066
534067
534068
534069
534070
534071
534072
534073
534074
534075
534076
534077
534078
534079
534080
534081
534082
534083
534084
534085
534086
534087
534088
534089
534090
534091
534092
534093
534094
534095
534096
534097
534098
534099
534100
534101
534102
534103
534104
534105
534106
534107
534108
534109
534110
534111
534112
534113
534114
534115
534116
534117
534118
534119
534120
534121
534122
534123
534124
534125
534126
534127
534128
534129
534130
534131
534132
534133
534134
534135
534136
534137
534138
534139
534140
534141
534142
534143
534144
534145
534146
534147
534148
534149
534150
534151
534152
534153
534154
534155
534156
534157
534158
534159
534160
534161
534162
534163
534164
534165
534166
534167
534168
534169
534170
534171
534172
534173
534174
534175
534176
534177
534178
534179
534180
534181
534182
534183
534184
534185
534186
534187
534188
534189
534190
534191
534192
534193
534194
534195
534196
534197
534198
534199
534200
534201
534202
534203
534204
534205
534206
534207
534208
534209
534210
534211
534212
534213
534214
534215
534216
534217
534218
534219
534220
534221
534222
534223
534224
534225
534226
534227
534228
534229
534230
534231
534232
534233
534234
534235
534236
534237
534238
534239
534240
534241
534242
534243
534244
534245
534246
534247
534248
534249
534250
534251
534252
534253
534254
534255
534256
534257
534258
534259
534260
534261
534262
534263
534264
534265
534266
534267
534268
534269
534270
534271
534272
534273
534274
534275
534276
534277
534278
534279
534280
534281
534282
534283
534284
534285
534286
534287
534288
534289
534290
534291
534292
534293
534294
534295
534296
534297
534298
534299
534300
534301
534302
534303
534304
534305
534306
534307
534308
534309
534310
534311
534312
534313
534314
534315
534316
534317
534318
534319
534320
534321
534322
534323
534324
534325
534326
534327
534328
534329
534330
534331
534332
534333
534334
534335
534336
534337
534338
534339
534340
534341
534342
534343
534344
534345
534346
534347
534348
534349
534350
534351
534352
534353
534354
534355
534356
534357
534358
534359
534360
534361
534362
534363
534364
534365
534366
534367
534368
534369
534370
534371
534372
534373
534374
534375
534376
534377
534378
534379
534380
534381
534382
534383
534384
534385
534386
534387
534388
534389
534390
534391
534392
534393
534394
534395
534396
534397
534398
534399
534400
534401
534402
534403
534404
534405
534406
534407
534408
534409
534410
534411
534412
534413
534414
534415
534416
534417
534418
534419
534420
534421
534422
534423
534424
534425
534426
534427
534428
534429
534430
534431
534432
534433
534434
534435
534436
534437
534438
534439
534440
534441
534442
534443
534444
534445
534446
534447
534448
534449
534450
534451
534452
534453
534454
534455
534456
534457
534458
534459
534460
-304334
-334293
-348292
-348295
-348298
-348301
-348304
-348307
-348310
-348313
-348316
-348322
-348335
-348338
-348341
-348344
-348347
-348350
-348353
-348356
-348359
-348362
-348365
-348371
-348382
-348385
-348388
-348391
-348394
-348397
-348400
-348403
-348406
-348409
-348412
-348415
-348421
-348432
-348435
-348438
-348441
-348444
-348447
-348450
-348453
-348456
-348459
-348462
-348465
-348474
-348481
-348484
-348487
-348490
-348493
-348496
-348499
-348502
-348505
-348508
-348511
-348514
-348520
-348531
-348534
-348537
-348540
-348543
-348546
-348549
-348552
-348555
-348558
-348561
-348564
-348573
-348581
-348584
-348587
-348590
-348593
-348596
-348599
-348602
-348605
-348608
-348611
-348617
-348629
-348632
-348635
-348638
-348641
-348644
-348647
-348650
-348653
-348656
-348659
-348668
-348676
-348679
-348682
-348685
-348688
-348691
-348694
-348697
-348700
-348703
-348709
-348720
-348723
-348726
-348729
-348732
-348735
-348738
-348741
-348744
-348747
-348756
-348764
-348767
-348770
-348773
-348776
-348779
-348782
-348785
-348791
-348800
-348807
-348810
-348813
-348816
-348819
-348822
-348828
-348837
-348849
-348852
-348855
-348858
-348864
-348873
-348892
-348898
-348904
-348913
-363703
-363706
-363708
-363709
-363710
-363711
-363712
-363715
-363716
-363719
-363720
-363721
-363722
-363729
-363730
-363731
-363733
-363740
-363741
-363742
-363743
-363744
-363747
-363748
-363751
-363752
-363753
-363756
-363760
-363761
-363764
-363765
-363766
-363770
-363774
-363775
-363778
-363779
-363780
-363783
-363787
-363788
-363791
-363792
-363793
-363796
-363797
-363798
-363802
-363803
-363806
-363807
-363808
-363812
-363813
-363816
-363819
-363820
-363821
-363825
-363826
-363830
-363833
-363834
-363838
-363839
-363843
-363844
-363847
-363848
-363851
-363853
-363855
-363856
-363858
-363860
-363862
-363863
-363865
-363866
-363867
-363868
-363869
-363870
-363872
-363873
-363875
-363876
-363878
-363880
-363882
-363883
-363884
-363886
-363887
-363889
-363890
-363893
-363894
-363896
-363898
-363899
-363900
-363902
-363903
-363905
-363906
-363908
-363909
-363910
-363911
-363912
-363913
-363914
-363915
-363917
-363918
-363920
-363921
-363923
-363924
-363925
-363926
-363928
-363929
-363931
-363932
-363935
-363937
-363938
-363940
-363941
-363943
-363944
-363946
-363947
-363949
-363951
-363952
-363954
-363955
-363956
-363958
-363959
-363961
-363963
-363965
-363966
-363968
-363970
-363971
-363972
-363973
-363974
-363975
-395010
-395014
-395018
-395022
-395026
-395030
-395034
-395038
-395042
-395046
-395050
-395054
-395058
-395065
-395684
-395687
-395690
-395693
-395696
-395699
-395702
-395705
-395708
-395711
-395714
-395717
-395720
-395726
-396345
-396348
-396351
-396354
-396357
-396360
-396363
-396366
-396369
-396372
-396375
-396378
-396381
-396387
-397006
-397009
-397012
-397015
-397018
-397021
-397024
-397027
-397030
-397033
-397036
-397039
-397042
-397048
-397667
-397670
-397673
-397676
-397679
-397682
-397685
-397688
-397691
-397694
-397697
-397700
-397703
-397709
-398328
-398331
-398334
-398337
-398340
-398343
-398346
-398349
-398352
-398355
-398358
-398361
-398364
-398370
-398989
-398992
-398995
-398998
-399001
-399004
-399007
-399010
-399013
-399016
-399019
-399022
-399025
-399031
-399650
-399653
-399656
-399659
-399662
-399665
-399668
-399671
-399674
-399677
-399680
-399683
-399686
-399692
-400311
-400314
-400317
-400320
-400323
-400326
-400329
-400332
-400335
-400338
-400341
-400344
-400347
-400353
-400972
-400975
-400978
-400981
-400984
-400987
-400990
-400993
-400996
-400999
-401002
-401005
-401008
-401014
-401633
-401636
-401639
-401642
-401645
-401648
-401651
-401654
-401657
-401660
-401663
-401666
-401669
-401675
-402294
-402297
-402300
-402303
-402306
-402309
-402312
-402315
-402318
-402321
-402324
-402327
-402330
-402336
-402955
-402958
-402961
-402964
-402967
-402970
-402973
-402976
-402979
-402982
-402985
-402988
-402991
-402997
-403616
-403619
-403622
-403625
-403628
-403631
-403634
-403637
-403640
-403643
-403646
-403649
-403652
-403658
-404277
-404280
-404283
-404286
-404289
-404292
-404295
-404298
-404301
-404304
-404307
-404310
-404313
-404319
-404938
-404941
-404944
-404947
-404950
-404953
-404956
-404959
-404962
-404965
-404968
-404971
-404974
-404980
-405599
-405602
-405605
-405608
-405611
-405614
-405617
-405620
-405623
-405626
-405629
-405632
-405635
-405641
-406260
-406263
-406266
-406269
-406272
-406275
-406278
-406281
-406284
-406287
-406290
-406293
-406296
-406302
-407350
-407356
-407362
-407368
-407374
-407380
-407386
-407392
-407398
-407404
-407410
-407416
-407422
-407431
-408648
-408651
-408658
-408660
-408936
-408938
-408945
-408947
-409223
-409225
-409232
-409234
-409510
-409512
-409519
-409521
-409797
-409799
-409806
-409808
-410084
-410086
-410093
-410095
-410371
-410373
-410380
-410382
-410658
-410660
-410667
-410669
-410945
-410947
-410954
-410956
-411232
-411234
-411241
-411243
-411519
-411521
-411528
-411530
-411806
-411808
-411815
-411817
-412093
-412095
-412102
-412104
-412380
-412382
-412389
-412391
-412667
-412669
-412676
-412678
-412954
-412956
-412963
-412965
-413241
-413243
-413250
-413252
-413528
-413530
-413537
-413539
-413815
-413817
-413824
-413826
-416215
-416218
-416224
-416226
-416231
-416234
-416240
-416242
-416247
-416250
-416256
-416258
-416263
-416266
-416272
-416274
-416279
-416282
-416288
-416290
-416295
-416298
-416304
-416306
-416311
-416314
-416320
-416322
-416327
-416330
-416336
-416338
-416343
-416346
-416352
-416354
-416359
-416362
-416368
-416370
-416375
-416378
-416384
-416386
-416391
-416394
-416400
-416402
-416407
-416410
-416416
-416418
-416423
-416426
-416432
-416434
-416439
-416441
-416446
-416447
-416676
-416679
-416682
-416685
-416688
-416691
-416694
-416697
-416700
-416703
-416706
-416712
-416929
-416931
-417688
-417692
-417696
-417700
-417704
-417708
-417712
-417716
-417720
-417724
-417728
-417732
-417736
-417743
-418362
-418365
-418368
-418371
-418374
-418377
-418380
-418383
-418386
-418389
-418392
-418395
-418398
-418404
-419023
-419026
-419029
-419032
-419035
-419038
-419041
-419044
-419047
-419050
-419053
-419056
-419059
-419065
-419629
-419632
-419634
-419636
-419638
-419640
-419642
-419644
-419646
-419648
-419650
-419652
-419654
-419659
-419917
-419918
-420259
-420262
-420269
-420271
-420547
-420549
-420556
-420558
-420834
-420836
-420843
-420845
-421121
-421123
-421130
-421132
-421186
-421187
-421213
-421215
-421324
-421327
-421330
-421333
-421336
-421339
-421342
-421345
-421349
-421963
-421966
-421969
-421972
-421975
-421978
-421981
-421984
-421987
-421990
-421993
-421996
-421999
-422005
-422624
-422627
-422630
-422633
-422636
-422639
-422642
-422645
-422648
-422651
-422654
-422657
-422660
-422666
-423139
-423141
-423143
-423145
-423147
-423149
-423151
-423153
-423155
-423157
-423159
-423161
-423163
-423166
-423338
-423340
-423616
-423618
-423625
-423627
-423903
-423905
-423912
-423914
-424116
-424117
-424181
-424246
-424310
-424373
-424434
-424498
-424555
-424615
-424668
-424723
-424776
-424826
-424870
-424916
-424984
-425035
-425085
-425134
-425182
-425233
-425278
-425326
-425368
-425412
-425455
-425497
-425535
-425577
-425645
-425696
-425746
-425795
-425843
-425894
-425939
-425987
-426029
-426073
-426116
-426158
-426196
-426238
-426306
-426357
-426407
-426456
-426504
-426555
-426600
-426648
-426690
-426734
-426777
-426819
-426857
-426899
-426967
-427018
-427068
-427117
-427165
-427216
-427261
-427309
-427351
-427395
-427438
-427480
-427518
-427560
-427628
-427679
-427729
-427778
-427826
-427877
-427922
-427970
-428012
-428056
-428099
-428141
-428179
-428221
-428289
-428340
-428390
-428439
-428487
-428538
-428583
-428631
-428673
-428717
-428760
-428802
-428840
-428882
-428950
-429001
-429051
-429100
-429148
-429199
-429244
-429292
-429334
-429378
-429421
-429463
-429501
-429543
-429611
-429662
-429712
-429761
-429809
-429860
-429905
-429953
-429995
-430039
-430082
-430124
-430162
-430204
-430272
-430323
-430373
-430422
-430470
-430521
-430566
-430614
-430656
-430700
-430743
-430785
-430823
-430865
-430933
-430984
-431034
-431083
-431131
-431182
-431227
-431275
-431317
-431361
-431404
-431446
-431484
-431526
-431594
-431645
-431695
-431744
-431792
-431843
-431888
-431936
-431978
-432022
-432065
-432107
-432145
-432187
-432255
-432306
-432356
-432405
-432453
-432504
-432549
-432597
-432639
-432683
-432726
-432768
-432806
-432848
-432916
-432967
-433017
-433066
-433114
-433165
-433210
-433258
-433300
-433344
-433387
-433429
-433467
-433509
-433577
-433628
-433678
-433727
-433775
-433826
-433871
-433919
-433961
-434005
-434048
-434090
-434128
-434170
-434238
-434289
-434339
-434388
-434436
-434487
-434532
-434580
-434622
-434666
-434709
-434751
-434789
-434831
-434899
-434950
-435000
-435049
-435097
-435148
-435193
-435241
-435283
-435327
-435370
-435412
-435450
-435492
-435560
-435611
-435661
-435710
-435758
-435809
-435854
-435902
-435944
-435988
-436031
-436073
-436111
-436153
-436263
-436356
-436448
-436539
-436626
-436716
-436797
-436881
-436956
-437033
-437106
-437172
-437228
-437282
-438509
-438515
-438520
-438524
-438798
-438802
-438807
-438811
-439085
-439089
-439094
-439098
-439372
-439376
-439381
-439385
-439659
-439663
-439668
-439672
-439946
-439950
-439955
-439959
-440233
-440237
-440242
-440246
-440520
-440524
-440529
-440533
-440807
-440811
-440816
-440820
-441094
-441098
-441103
-441107
-441381
-441385
-441390
-441394
-441668
-441672
-441677
-441681
-441955
-441959
-441964
-441968
-442242
-442246
-442251
-442255
-442529
-442533
-442538
-442542
-442816
-442820
-442825
-442829
-443103
-443107
-443112
-443116
-443390
-443394
-443399
-443403
-443677
-443681
-443686
-443690
-443903
-443908
-443912
-443916
-444129
-444134
-444138
-444142
-444350
-444355
-444359
-444363
-444570
-444575
-444579
-444583
-444783
-444788
-444792
-444796
-444993
-444998
-445002
-445006
-445196
-445201
-445205
-445209
-445391
-445396
-445400
-445404
-445574
-445579
-445583
-445587
-445748
-445753
-445757
-445761
-445907
-445912
-445916
-445920
-446050
-446055
-446059
-446063
-446170
-446175
-446179
-446183
-446260
-446265
-446269
-446273
-446301
-446305
-446309
-446311
-446316
-446324
-446335
-446349
-446366
-446386
-446409
-446435
-446467
-446501
-446529
-446557
-446776
-446780
-446844
-446909
-446973
-447036
-447097
-447161
-447218
-447278
-447331
-447386
-447439
-447489
-447533
-447579
-447647
-447698
-447748
-447797
-447845
-447896
-447941
-447989
-448031
-448075
-448118
-448160
-448198
-448240
-448308
-448359
-448409
-448458
-448506
-448557
-448602
-448650
-448692
-448736
-448779
-448821
-448859
-448901
-448969
-449020
-449069
-449116
-449161
-449208
-449248
-449290
-449325
-449361
-449395
-449429
-449461
-449499
-449550
-449583
-450120
-450126
-450131
-450135
-450409
-450413
-450418
-450422
-450696
-450700
-450705
-450709
-450983
-450987
-450992
-450996
-451049
-451051
-451075
-451079
-451082
-451088
-451097
-451109
-451124
-451142
-451164
-451186
-451204
-451254
-451305
-451355
-451404
-451452
-451503
-451548
-451596
-451638
-451682
-451725
-451767
-451805
-451847
-451915
-451966
-452016
-452065
-452113
-452164
-452209
-452257
-452299
-452343
-452386
-452428
-452466
-452508
-452562
-452599
-452635
-452670
-452705
-452743
-452776
-452812
-452843
-452876
-452909
-452943
-452975
-453009
-453191
-453195
-453469
-453473
-453478
-453482
-453756
-453760
-453765
-453769
-453970
-453972
)
// ************************************************************************* //
| |
a5c7ee8741712e3d14dc3a75851af4bb4dcbfd35 | b1a3b693af6a9191658bbdcf062a7341588a21d9 | /functions.h | b27aac61897b4ea20b8255d8a4a5ec4c1b6e1e07 | [] | no_license | AngryThundrWafl/csci-2421-final_proj | bd1671202372d11b9d5ec2ba32c7a1b7a4efcc57 | 5330ca59e4b6b21f8baf2a3609096def5d165514 | refs/heads/master | 2021-08-31T09:38:57.398139 | 2017-12-20T23:10:41 | 2017-12-20T23:10:41 | 114,938,794 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,255 | h | functions.h | //
// Created by Brian on 5/12/2016.
//
#ifndef ADDRESSBOOKCLEANERVERSION_FUNCTIONS_H
#define ADDRESSBOOKCLEANERVERSION_FUNCTIONS_H
#include <iostream>
#include <fstream>
#include "avltree.h"
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <time.h>
#include<stdio.h>
using namespace std;
//function reads in a file and fills the tree
void readFile(AVLClass&,std::vector<Affiliates>&);
//just used to pause the program
void pause();
//main menu choice menu
int mainMenu();
//function will sort the tree alphabetically or in order from the chooosen field
void sort();
//function will call update book which has update entry,delete,add on there
void updateBook(AVLClass&,std::vector<Affiliates>&);
void update(AVLClass&);
void deleteBook(AVLClass&,std::vector<Affiliates>&);
void add(AVLClass&);
//function that will search for a entry in the tree
void search(AVLClass&);
//vector of affiliate printed
void printAffilVec(std::vector<Affiliates>&);
void denomChange(int []); //this funciton will recieve a array created in the print function that will hold denominations
#endif //ADDRESSBOOKCLEANERVERSION_FUNCTIONS_H
|
0f7835d07001bb88d19d2b2f9b29885cbeaa489e | d56daf4129d45d7893402ac5d261e6271cb4a68f | /2. Arrays/OddOccurrencesInArray.cpp | b60f9786bfcdeb7fc173371a9cabb95a7103dd27 | [] | no_license | DongChyeon/Codility-Solutions | cb28b61f78f6f2dccdae3f0227f645a1346c0b45 | df861b8959a4966c1e4a43403ad70d3bfad1786c | refs/heads/master | 2023-02-08T17:38:23.678279 | 2020-12-31T02:54:55 | 2020-12-31T02:54:55 | 281,297,635 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 237 | cpp | OddOccurrencesInArray.cpp | #include <vector>
int solution(vector<int>& A) {
int num = A[0];
for (int i = 1; i < A.size(); i++) {
num = num ^ A[i];
} // XOR ์ฐ์ฐ์ ํตํด ์์ด ๋๋ ์ซ์๋ ์ฌ๋ผ์ง๊ณ ์์ด ์๋ ์ซ์๋ง ๋จ๊ฒ๋จ
return num;
} |
df4556fb6c39c7a49b6acef35386f47bcaca29f2 | f97ce0a588e023675eaa980f2f105f0a9c25ce18 | /UVa/v1/107.CPP | b7f2847ccce8bd05f51443ad0fb9c431e96e3281 | [] | no_license | anindya028/Programming-Contest-Problems | a5c49653d990391a6e2003f2ec9d951222cabbe2 | 7038b6267432189de72539ef5ad046d38e730ee8 | refs/heads/master | 2023-03-17T06:27:38.339049 | 2021-02-23T22:58:06 | 2021-02-23T22:58:06 | 277,399,320 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 832 | cpp | 107.CPP | #include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
using namespace std;
//#define Long __int64
#define Long long long
int main()
{
int a,b,n,k,i;
Long N,sum;
while(scanf("%d%d",&a,&b)==2)
{
if(!a && !b)
break;
if(a==1 && b==1)
{
printf("0 1\n");
continue;
}
for(i=1;i<31;i++)
{
n=(int)pow((double)b,1./i);
if(pow(n,i)==(double)b)
{
if(pow(n+1,i)==(double)a)
{
k=i;
break;
}
}
n++;
if(pow(n,i)==(double)b)
{
if(pow(n+1,i)==(double)a)
{
k=i;
break;
}
}
}
sum=N=0;
for(i=0;i<k;i++)
N+=(int)pow(n,i);
for(i=0;i<=k;i++)
{
sum+=(int)pow(n+1,i)*b;
b/=n;
}
printf("%lld %lld\n",N,sum);
}
return 0;
}
|
73d044296dce1715bcfd4fd74337ded447aeac49 | 9850f4a8d9e326b906f22f97659b5a61bac441a9 | /CPP_Pool/cpp_d17_2018/ex02/OneTime.cpp | fa97d1cc1cf65d238c4905a93f7e7dc6873d0706 | [] | no_license | Nymrinae/EPITECH-Projects | 67d77e9d98177e5045dbd9868ddb993b08f0c763 | 9cad4819c086d5004e2325d5a416dc5ff1cfafe0 | refs/heads/master | 2022-02-14T02:12:44.177840 | 2022-02-03T11:48:08 | 2022-02-03T11:48:08 | 205,130,787 | 3 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 867 | cpp | OneTime.cpp | /*
** EPITECH PROJECT, 2018
** OneTime.cpp
** File description:
** Exersice 2 - Ave
*/
#include "OneTime.hpp"
OneTime::OneTime(const std::string &key)
{
this->_key = key;
this->_i = 0;
}
void OneTime::encryptChar(char c)
{
int base, key;
if(isalpha(c)) {
base = (c > 96) ? 97 : 65;
key = (this->_key[this->_i] > 96) ? 97 : 65;
c = (c - base + (this->_key[this->_i] - key)) % 26 + base;
}
std::cout << c;
this->_i = (this->_i + 1) % this->_key.size();
}
void OneTime::decryptChar(char c)
{
int base, key;
if(isalpha(c)) {
base = (c > 96) ? 122 : 90;
key = (this->_key[this->_i] > 96) ? 97 : 65;
c = (c - base - (this->_key[this->_i] - key)) % 26 + base;
}
std::cout << c;
this->_i = (this->_i + 1) % this->_key.size();
}
void OneTime::reset()
{
this->_i = 0;
} |
4daae8245d830c4794680a7b141abed9d725be3c | 32e719f67e34ffe5c6a1d55a4f0778b07e3113b2 | /development/src/GXDLMSConverter.cpp | f32755fe5e2b5bc20945ebae477063d4e86d2573 | [] | no_license | rmoravcik/Gurux.DLMS.cpp | 269cf8f62ea678d8ecd7cf1169f661ed3a8ceb39 | 3a5ba29438001dd267e84381e00a3758bac8470e | refs/heads/master | 2020-06-13T13:10:36.297274 | 2016-12-06T08:27:20 | 2016-12-06T08:27:20 | 75,375,412 | 0 | 0 | null | 2016-12-02T08:16:25 | 2016-12-02T08:16:25 | null | UTF-8 | C++ | false | false | 14,104 | cpp | GXDLMSConverter.cpp | //
// --------------------------------------------------------------------------
// Gurux Ltd
//
//
//
// Filename: $HeadURL$
//
// Version: $Revision$,
// $Date$
// $Author$
//
// Copyright (c) Gurux Ltd
//
//---------------------------------------------------------------------------
//
// DESCRIPTION
//
// This file is a part of Gurux Device Framework.
//
// Gurux Device Framework is Open Source software; you can redistribute it
// and/or modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2 of the License.
// Gurux Device Framework is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
//
// More information of Gurux products: http://www.gurux.org
//
// This code is licensed under the GNU General Public License v2.
// Full text may be retrieved at http://www.gnu.org/licenses/gpl-2.0.txt
//---------------------------------------------------------------------------
#include "../include/GXDLMSConverter.h"
#include "../include/errorcodes.h"
const char* CGXDLMSConverter::GetErrorMessage(int error)
{
switch(error)
{
case DLMS_ERROR_CODE_OK:
return "OK";
case DLMS_ERROR_CODE_INVALID_PARAMETER:
return "Invalid parameter.";
case DLMS_ERROR_CODE_NOT_INITIALIZED:
return "Server is not initialized.";
case DLMS_ERROR_CODE_OUTOFMEMORY:
return "Not enough memory available.";
case DLMS_ERROR_CODE_NOT_REPLY:
return "Packet is not a reply for a send packet.";
case DLMS_ERROR_CODE_REJECTED:
return "Meter rejects send packet.";
case DLMS_ERROR_CODE_INVALID_LOGICAL_NAME:
return "Invalid Logical Name.";
case DLMS_ERROR_CODE_INVALID_CLIENT_ADDRESS:
return "Client HDLC Address is not set.";
case DLMS_ERROR_CODE_INVALID_SERVER_ADDRESS:
return "Server HDLC Address is not set.";
case DLMS_ERROR_CODE_INVALID_DATA_FORMAT:
return "Not a HDLC frame.";
case DLMS_ERROR_CODE_INVALID_VERSION_NUMBER:
return "Invalid DLMS version number.";
case DLMS_ERROR_CODE_CLIENT_ADDRESS_NO_NOT_MATCH:
return "Client addresses do not match.";
case DLMS_ERROR_CODE_SERVER_ADDRESS_NO_NOT_MATCH:
return "Server addresses do not match.";
case DLMS_ERROR_CODE_WRONG_CRC:
return "CRC do not match.";
case DLMS_ERROR_CODE_INVALID_RESPONSE:
return "Invalid response";
case DLMS_ERROR_CODE_INVALID_TAG:
return "Invalid Tag.";
case DLMS_ERROR_CODE_ENCODING_FAILED:
return "Encoding failed. Not enough data.";
case DLMS_ERROR_CODE_REJECTED_PERMAMENT:
return "Rejected permament.";
case DLMS_ERROR_CODE_REJECTED_TRANSIENT:
return "Rejected transient.";
case DLMS_ERROR_CODE_NO_REASON_GIVEN:
return "No reason given.";
case DLMS_ERROR_CODE_APPLICATION_CONTEXT_NAME_NOT_SUPPORTED:
return "Application context name not supported.";
case DLMS_ERROR_CODE_AUTHENTICATION_MECHANISM_NAME_NOT_RECOGNISED:
return "Authentication mechanism name not recognised.";
case DLMS_ERROR_CODE_AUTHENTICATION_MECHANISM_NAME_REQUIRED:
return "Authentication mechanism name required.";
case DLMS_ERROR_CODE_AUTHENTICATION_FAILURE:
return "Authentication failure.";
case DLMS_ERROR_CODE_AUTHENTICATION_REQUIRED:
return "Authentication required.";
case DLMS_ERROR_CODE_HARDWARE_FAULT:
return "Access Error : Device reports a hardware fault.";
case DLMS_ERROR_CODE_TEMPORARY_FAILURE:
return "Access Error : Device reports a temporary failure.";
case DLMS_ERROR_CODE_READ_WRITE_DENIED:
return "Access Error : Device reports Read-Write denied.";
case DLMS_ERROR_CODE_UNDEFINED_OBJECT:
return "Access Error : Device reports a undefined object.";
case DLMS_ERROR_CODE_INCONSISTENT_OBJECT:
return "Access Error : Device reports a inconsistent Class or Object.";
case DLMS_ERROR_CODE_UNAVAILABLE_OBJECT:
return "Access Error : Device reports a unavailable object.";
case DLMS_ERROR_CODE_UNMATCH_TYPE:
return "Access Error : Device reports a unmatched type.";
case DLMS_ERROR_CODE_VIOLATED:
return "Access Error : Device reports scope of access violated.";
case DLMS_ERROR_CODE_BLOCK_UNAVAILABLE:
return "Access Error : Data Block Unavailable.";
case DLMS_ERROR_CODE_READ_ABORTED:
return "Access Error : Long Get Or Read Aborted.";
case DLMS_ERROR_CODE_READ_IN_PROGRESS:
return "Access Error : No Long Get Or Read In Progress.";
case DLMS_ERROR_CODE_WRITE_ABORTED:
return "Access Error : Long Set Or Write Aborted.";
case DLMS_ERROR_CODE_NO_LONG_GET_OR_READ_IN_PROGRESS:
return "Access Error : No Long Set Or Write In Progress.";
case DLMS_ERROR_CODE_DATA_BLOCK_NUMBER_INVALID:
return "Access Error : Data Block Number Invalid.";
case DLMS_ERROR_CODE_OTHER_REASON:
return "Access Error : Other Reason.";
case DLMS_ERROR_CODE_UNKNOWN:
return "Unknown error.";
case DLMS_ERROR_CODE_SEND_FAILED:
return "Data send failed.";
case DLMS_ERROR_CODE_RECEIVE_FAILED:
return "Data receive failed.";
case DLMS_ERROR_CODE_NOT_IMPLEMENTED:
return "Not implemeted.";
}
return "Unknown error.";
}
const char* CGXDLMSConverter::ToString(DLMS_BAUD_RATE value)
{
switch(value)
{
case 0:
return "Baudrate300";
break;
case 1:
return "Baudrate600";
break;
case 2:
return "Baudrate1200";
break;
case 3:
return "Baudrate2400";
break;
case 4:
return "Baudrate4000";
break;
case 5:
return "Baudrate9600";
break;
case 6:
return "Baudrate19200";
break;
case 7:
return "Baudrate38400";
break;
case 8:
return "Baudrate57600";
break;
case 9:
return "Baudrate115200";
break;
default:
break;
}
return "Unknown baudrate";
}
const char* CGXDLMSConverter::ToString(DLMS_CLOCK_STATUS value)
{
switch(value)
{
case 0:
return "None";
break;
case 0x1:
return "InvalidValue";
break;
case 0x2:
return "DoubtfulValue";
break;
case 0x4:
return "DifferentClockBase";
break;
case 0x8:
return "Reserved1";
break;
case 0x10:
return "Reserved2";
break;
case 0x20:
return "Reserved3";
break;
case 0x40:
return "Reserved4";
break;
case 0x80:
return "DaylightSaveActive";
break;
default:
break;
}
return "Unknown Clock status";
}
const char* CGXDLMSConverter::ToString(DLMS_CLOCK_BASE value)
{
switch(value)
{
case 0:
return "None";
break;
case 1:
return "Crystal";
break;
case 2:
return "Frequency50";
break;
case 3:
return "Frequency60";
break;
case 4:
return "GPS";
break;
case 5:
return "Radio";
break;
default:
break;
}
return "Unknown Clock base";
}
const char* CGXDLMSConverter::GetUnitAsString(int unit)
{
switch(unit)
{
case 0:
return "None";
case 1:
return "Year";
break;
case 2:
return "Month";
break;
case 3:
return "Week";
break;
case 4:
return "Day";
break;
case 5:
return "Hour";
break;
case 6:
return "Minute";
break;
case 7:
return "Second";
break;
case 8:
return "PhaseAngle";
break;
case 9:
return "Temperature";
break;
case 10:
return "LocalCurrency";
break;
case 11:
return "Length";
break;
case 12:
return "Speed";
break;
case 13:
return "Volume";
break;
case 14:
return "CorrectedVolume";
break;
case 15:
return "VolumeFlux";
break;
case 16:
return "CorrectedVolumeFlux";
break;
case 17:
return "VolumeFlux";
break;
case 18:
return "CorrectedVolumeFlux";
break;
case 19:
return "Volume";
break;
case 20:
return "MassKg";
break;
case 21:
return "Force";
break;
case 22:
return "Energy";
break;
case 23:
return "PressurePascal";
break;
case 24:
return "PressureBar";
break;
case 25:
return "Energy";
break;
case 26:
return "ThermalPower";
break;
case 27:
return "ActivePower";
break;
case 28:
return "ApparentPower";
break;
case 29:
return "ReactivePower";
break;
case 30:
return "ActiveEnergy";
break;
case 31:
return "ApparentEnergy";
break;
case 32:
return "ReactiveEnergy";
break;
case 33:
return "Current";
break;
case 34:
return "ElectricalCharge";
break;
case 35:
return "Voltage";
break;
case 36:
return "Electrical field strength E V/m";
break;
case 37:
return "Capacity C farad C/V = As/V";
break;
case 38:
return "Resistance";
break;
case 39:
return "Resistivity";
break;
case 40:
return "Magnetic flux F weber Wb = Vs";
break;
case 41:
return "Induction T tesla Wb/m2";
break;
case 42:
return "Magnetic field strength H A/m";
break;
case 43:
return "Inductivity L henry H = Wb/A";
break;
case 44:
return "Frequency";
break;
case 45:
return "ActiveEnergy";
break;
case 46:
return "ReactiveEnergy";
break;
case 47:
return "ApparentEnergy";
break;
case 48:
return "V260*60s";
break;
case 49:
return "A260*60s";
break;
case 50:
return "Mass";
break;
case 51:
return "ConductanceSiemens";
break;
case 254 :
return "OtherUnit";
break;
case 255:
return "NoUnit";
break;
}
return "";
}
const char* CGXDLMSConverter::ToString(DLMS_ADDRESS_STATE value)
{
switch(value)
{
case 0:
return "None";
break;
case 1:
return "Assigned";
break;
default:
break;
}
return "Unknown Clock base";
}
//Get Disconnect control control state as a std::string.
const char* CGXDLMSConverter::ToString(DLMS_CONTROL_STATE value)
{
switch(value)
{
case 0:
return "Disconnected";
break;
case 1:
return "Connected";
break;
case 2:
return "ReadyForReconnection";
break;
default:
break;
}
return "Unknown control state";
}
//Get Disconnect control control mode as a std::string.
const char* CGXDLMSConverter::ToString(DLMS_CONTROL_MODE value)
{
switch(value)
{
case 0:
return "None";
break;
case 1:
return "Mode1";
break;
case 2:
return "Mode2";
break;
case 3:
return "Mode3";
break;
case 4:
return "Mode4";
break;
case 5:
return "Mode5";
break;
case 6:
return "Mode6";
break;
default:
break;
}
return "Unknown control mode";
}
//Get Security Setup security policy as a std::string.
const char* CGXDLMSConverter::ToString(DLMS_SECURITY_POLICY value)
{
switch(value)
{
case DLMS_SECURITY_POLICY_NOTHING:
return "Nothing";
break;
case DLMS_SECURITY_POLICY_AUTHENTICATED:
return "Authenticated";
break;
case DLMS_SECURITY_POLICY_ENCRYPTED:
return "Encrypted";
break;
case DLMS_SECURITY_POLICY_AUTHENTICATED_ENCRYPTED:
return "AuthenticatedEncrypted";
break;
default:
break;
}
return "Unknown security policy";
}
//Get Security Setup security suite as a std::string.
const char* CGXDLMSConverter::ToString(DLMS_SECURITY_SUITE value)
{
switch(value)
{
case 0://DLMS_SECURITY_SUITE_AES_GCM_128
return "AES_GCM_128";
break;
default:
break;
}
return "Unknown security suite";
}
const char* CGXDLMSConverter::ToString(DLMS_DLMS_ASSOCIATION_STATUS value)
{
switch(value)
{
case DLMS_DLMS_ASSOCIATION_STATUS_NON_ASSOCIATED:
return "NonAssociated";
break;
case DLMS_DLMS_ASSOCIATION_STATUS_ASSOCIATION_PENDING:
return "AssociationPending";
break;
case DLMS_DLMS_ASSOCIATION_STATUS_ASSOCIATED:
return "Associated";
break;
default:
break;
}
return "Unknown association status";
}
const char* CGXDLMSConverter::ToString(DLMS_OPTICAL_PROTOCOL_MODE value)
{
switch(value)
{
case DLMS_OPTICAL_PROTOCOL_MODE_DEFAULT:
return "Default";
break;
case DLMS_OPTICAL_PROTOCOL_MODE_NET:
return "Net";
break;
case DLMS_OPTICAL_PROTOCOL_MODE_UNKNOWN:
return "Unknown";
break;
default:
break;
}
return "Unknown ptotocol mode";
}
const char* CGXDLMSConverter::ToString(DLMS_LOCAL_PORT_RESPONSE_TIME value)
{
switch(value)
{
case DLMS_LOCAL_PORT_RESPONSE_TIME_20_MS:
return "ms20";
break;
case DLMS_LOCAL_PORT_RESPONSE_TIME_200_MS:
return "ms200";
break;
default:
break;
}
return "Unknown response time";
}
|
9cd6911212317f8b52a8a75701c64edf0045c02a | af7935e028b2a606d25972f9e20d6e346232c882 | /codingTest1.cpp | 51cf53c7a26b6682cc864ab1a712be3acd7480c1 | [] | no_license | HwangYoonSeong/Algorithm | 193445230dc640f60f2c4151428d941ad186e2f4 | 51afe0266762b88798ada725be95ba113c7e8762 | refs/heads/master | 2023-06-17T18:30:45.236936 | 2021-07-13T02:22:18 | 2021-07-13T02:22:18 | 297,814,414 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 3,723 | cpp | codingTest1.cpp | #include <string>
#include <vector>
#include <iostream>
using namespace std;
// 1-1๋ฒ๋ฌธ์
//string solution(string phone_number) {
// string answer = "";
// for (int i = 0; i < phone_number.size(); i++) {
// if (i < phone_number.size()-4) {
// phone_number[i] = '*';
// }
// }
// /*for (char eter : phone_number) {
// cout << eter;
// }*/
// answer = phone_number;
// return answer;
//}
//
//void main() {
// string pn = "027778888";
// solution(pn);
//}
////1-2๋ฒ๋ฌธ์
//string solution(vector<int> numbers, string hand) {
// string answer = "";
// int rhp;
// int lhp;
// for (int i = 0; i < numbers.size(); i++) {
// if ((numbers[i] == 1)||(numbers[i] == 4)||(numbers[i] == 7)) {
// answer.append("L");
// lhp = numbers[i];
// }
// else if ((numbers[i] ==3) || (numbers[i] == 6) || (numbers[i] == 9)) {
// answer.append("R");
// rhp = numbers[i];
// }
// else if ((numbers[i] == 2) || (numbers[i] == 5) || (numbers[i] == 8) || (numbers[i] == 0)) {
// /*if (((lhp == 1) && (rhp == 3)) || ((lhp == 4) && (rhp == 6)) || ((lhp == 7) && (rhp == 9))) {
// if (hand[0] == 'r') {
// answer.append("R");
// rhp = numbers[i];
// }
// else {
// answer.append("L");
// lhp = numbers[i];
// }
//
// }
// else if ((lhp - 3 == numbers[i]) || (lhp + 1 == numbers[i]) || (lhp + 3 == numbers[i])) {
// answer.append("L");
// lhp = numbers[i];
// }
// else if ((rhp - 3 == numbers[i]) || (rhp - 1 == numbers[i]) || (rhp + 3 == numbers[i])) {
// answer.append("R");
// rhp = numbers[i];
// }*/
// if (((numbers[i] + 1 == rhp) || (numbers[i] + 3 == rhp) || (numbers[i] - 1 == rhp) || (numbers[i] - 3 == rhp))&&
// ((numbers[i] + 1 == lhp) || (numbers[i] + 3 == lhp) || (numbers[i] - 1 == lhp) || (numbers[i] - 3 == lhp))) {
// if (hand[0] == 'r') {
// answer.append("R");
// rhp = numbers[i];
// }
// else {
// answer.append("L");
// lhp = numbers[i];
// }
// }
// else if ((numbers[i]+1==rhp)|| (numbers[i] +3 == rhp)||(numbers[i] -1 == rhp)|| (numbers[i] -3 ==rhp)) {
// answer.append("R");
// rhp = numbers[i];
// }else if ((numbers[i] + 1 ==lhp) || (numbers[i] + 3 == lhp) || (numbers[i] - 1 == lhp) || (numbers[i] - 3 == lhp)) {
// answer.append("L");
// lhp = numbers[i];
// }
// }
// }
// for (char eter : answer)cout << eter;
// return answer;
//}
//2-1
//int solution(int num) {
// //long n = (long)num;
// int answer = 0;
// long long n = num; //์ด์ํ ๋ถ๋ถ
// //num ์ long long์ผ๋ก ํ๋ณํํ๊ฑฐ๋
// //n%2==1๋ก ๋ช
์ํด์ผ๋ง ์ ํํ ๋ต์ด ๋์จ๋ค
// int count = 0;
// while (n != 1) {
// if (count>500) {
// break;
// }
//
// if (n % 2 == 0) {//์ง์
// n = n / 2;
// }
// else {//ํ์
// n= n * 3 + 1;
// }
// count++;
// }
// if (count > 500)answer = -1;
// else answer = count;
//
//
// return answer;
//}
//3-1
//vector<vector<int>> solution(vector<vector<int>> arr1, vector<vector<int>> arr2) {
// vector<vector<int>> answer;
// vector<int> temp;
//
// for (int i = 0; i < arr1.size(); i++) {
// for (int j = 0; j < arr1[0].size(); j++) {
//
// temp.push_back(arr1[i][j]+arr2[i][j]);
// }
// answer.push_back(temp);
// temp.clear();
// }
//
// for (int i = 0; i < arr1.size(); i++) {
// for (int j = 0; j < arr1[0].size(); j++) {
// cout << answer[i][j];
// }
// }
// return answer;
//}
//3-2
string solution(vector<string> seoul) {
string answer = "";
int idx = 0;
for (int i = 0; i < seoul.size();i++) {
if (seoul[i] == "Kim")idx = i;
}
answer.append("๊น์๋ฐฉ์ "+to_string(idx)+"์ ์๋ค");
return answer;
}
void main() {
vector<string> seoul = { "Jane","Kim" };
cout<<solution(seoul);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.