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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a40bbdc0b987fb41587c46644b524b5a69eb502c | 3a28980e797e70e2062b22126574de0a8255db83 | /cprApp/com.cn.ihm/VolumeVisualization.cpp | b5527386f8fc5903a5068d0931f1232450b80ebe | [] | no_license | tianhu9102/myplatForm | aaffb93c8e2f4f27137925137a06d9eab66e3453 | 912448f4ac7a5ead973f4db9e50c6f73063b724a | refs/heads/master | 2021-01-17T17:29:32.917412 | 2016-06-27T08:21:46 | 2016-06-27T08:21:46 | 62,037,814 | 2 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 10,840 | cpp | VolumeVisualization.cpp | #include "VolumeVisualization.h"
VolumeVisualization::VolumeVisualization(QWidget *parent) : QWidget(parent)
{
this->initVariable();
// this->constructIHM();
}
//!---------------------------------------------------------------------------------
//!
//! \brief VolumeVisualization::initVariable
//!
void VolumeVisualization::initVariable(){
volumeReader = vtkMetaImageReader::New();
mapper = vtkFixedPointVolumeRayCastMapper::New();
colorTranFun = vtkColorTransferFunction::New();
pieceFun = vtkPiecewiseFunction::New();
gradientFun = vtkPiecewiseFunction ::New();
volumeProperty = vtkVolumeProperty::New();
volume = vtkVolume::New();
renderer = vtkRenderer::New();
renderwindow = vtkRenderWindow::New();
renderer0 = vtkRenderer::New();
renderwindow0 = vtkRenderWindow::New();
volumeRaycastmapper = vtkVolumeRayCastMapper::New();
}
//!---------------------------------------------------------------------------------
//!
//! \brief VolumeVisualization::constructIHM
//!
void VolumeVisualization::constructIHM(){
qHboxLayout = new QHBoxLayout(this);
qVTKWidget = new QVTKWidget();
qHboxLayout->addWidget(qVTKWidget);
qHboxLayout->setSpacing(0);
qHboxLayout->setMargin(0);
renderer0->SetBackground(55.0/255,85.0/255,95.0/255);
renderwindow0->AddRenderer(renderer0);
qVTKWidget->SetRenderWindow(renderwindow0);
qVTKWidget->update();
}
//!---------------------------------------------------------------------------------
//!
//! \brief VolumeVisualization::mathdisplay
//!
void VolumeVisualization::mathdisplay(QString filename){
mathdisplayofmath(filename);
mathdisplayofQVTKWidget();
}
//!---------------------------------------------------------------------------------
//!
//! \brief VolumeVisualization::mathdisplayofmath
//! \param mhdFile
//! \TODO... read different type of dataset
//!
void VolumeVisualization::mathdisplayofmath(QString filename){
if(filename.toLocal8Bit().contains(".mhd")){
this->mhdpipeline(filename);
} else if(filename.toLocal8Bit().contains(".dcm")){
this->dcmpipeline(filename);
} else if(filename.toLocal8Bit().contains(".vtp")){
this->vtppipeline(filename);
} else if(filename.toLocal8Bit().contains(".vtk")){
this->vtkpipeline(filename);
} else if(filename.toLocal8Bit().contains(".mha")){
this->mhdpipeline(filename);
} else if(filename.toLocal8Bit().contains(".mat")){
this->matpipeline(filename);
}else {
qDebug()<<"this is not conventional medical data";
}
}
//!---------------------------------------------------------------------------------
//!
//! \brief VolumeVisualization::mhdpipeline
//!
void VolumeVisualization::mhdpipeline(QString mhdFile){
//!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
volumeReader->SetFileName(mhdFile.toLocal8Bit());
volumeReader->SetDataScalarTypeToUnsignedShort(); //pixel spacing:0-65536
//volumeReader->SetNumberOfScalarComponents(1);
volumeReader->Update();
mapper->SetInputData(volumeReader->GetOutput());
colorTranFun->AddRGBSegment(0, 1, 1, 1, 255, 1, 1, 1);
pieceFun->AddSegment(0,0,3000,1);
pieceFun->ClampingOff();
gradientFun->AddPoint(0, 1);
gradientFun->AddPoint(255, 1);
mapper->SetBlendModeToMaximumIntensity();
volumeProperty->SetColor(colorTranFun);
volumeProperty->SetScalarOpacity(pieceFun);
//volumeProperty->SetGradientOpacity(gradientFun);
volumeProperty->ShadeOn();
volumeProperty->SetInterpolationTypeToLinear();
volume->SetMapper(mapper);
volume->SetProperty(volumeProperty);
renderer->AddVolume(volume);
//! below are some basic parameters ----used in Class BasicParameters----
int dims[3];
vtkImageData *iamgeData = volumeReader->GetOutput();
iamgeData->GetDimensions(dims);
this->xdim = dims[0];
this->ydim = dims[1];
this->zdim = dims[2];
std::cout<<"**************VolumeVisualization::mhdpipeline(QString mhdFile)****************\n"<<std::endl;
//! obtain the coordinates of a point in a vtkImageData object------->>> useful
std::cout<<"dims:" <<"x:"<<dims[0]<<" y:"<<dims[1]<<" z:"<<dims[2]<<std::endl;
std::cout<<"Number of points:" <<iamgeData->GetNumberOfPoints()<<std::endl;
std::cout<<"Number of cells:" <<iamgeData->GetNumberOfCells()<<std::endl;
double origin[3];
iamgeData->GetOrigin(origin);
this->xorigin = origin[0];
this->yorigin = origin[1];
this->zorigin = origin[2];
std::cout<<"Origin:" <<origin[0]<<" "<<origin[1]<<" "<<origin[2]<<std::endl;
double spaceing[3];
iamgeData->GetSpacing(spaceing);
this->xspacing = spaceing[0];
this->yspacing = spaceing[1];
this->zspacing = spaceing[2];
std::cout<<"spacing:" <<spaceing[0]<<" "<<spaceing[1]<<" "<<spaceing[2]<<std::endl;
std::cout<<"\n****************************************************************************************************\n";
}
void VolumeVisualization::dcmpipeline(QString dcmFile){
}
//!---------------------------------------------------------------------------------
//!
//! \brief VolumeVisualization::vtkpipeline
//! \param vtkFile
//!
void VolumeVisualization::vtkpipeline(QString vtkFile){
vtkPolyDataReader *vtkReader = vtkPolyDataReader::New();
vtkReader->SetFileName(vtkFile.toLocal8Bit());
vtkReader->Update();
vtkPolyDataMapper *skinMapper = vtkPolyDataMapper::New();
skinMapper->SetInputConnection(vtkReader->GetOutputPort());
skinMapper->ScalarVisibilityOff();
vtkActor* skin = vtkActor ::New();
skin->SetMapper (skinMapper);
vtkCamera* thevtkCamera = vtkCamera::New();
thevtkCamera->SetViewUp (0, 0, -1);
thevtkCamera->SetPosition (0, 1, 0);
thevtkCamera->SetFocalPoint (0, 0, 0);
thevtkCamera->ComputeViewPlaneNormal ();
thevtkCamera->Azimuth (30.0);
thevtkCamera->Elevation (30.0);
thevtkCamera->Dolly (1.5);
renderer->AddActor(skin);
renderer->SetActiveCamera (thevtkCamera);
renderer->ResetCamera ();
renderer->ResetCameraClippingRange ();
}
//!---------------------------------------------------------------------------------
//!
//! \brief VolumeVisualization::vtppipeline
//! \param vtpFile
//!
void VolumeVisualization::vtppipeline(QString vtpFile){
vtkXMLPolyDataReader *vtpReader = vtkXMLPolyDataReader::New();
vtkPolyDataMapper *vtpPolyMapper = vtkPolyDataMapper::New();
vtkActor *vtpactor = vtkActor::New();
vtpReader->SetFileName(vtpFile.toLocal8Bit());
vtpReader->Update();
vtpPolyMapper->SetInputConnection(vtpReader->GetOutputPort());
vtpactor->SetMapper(vtpPolyMapper);
renderer->AddActor(vtpactor);
}
void VolumeVisualization::mhapipeline(QString mhaFile){
}
void VolumeVisualization::matpipeline(QString matFile){
}
//!---------------------------------------------------------------------------------
//!
//! \brief VolumeVisualization::mathdisplayofQVTKWidget
//!
void VolumeVisualization::mathdisplayofQVTKWidget(){
renderer->SetBackground(55.0/255,85.0/255,95.0/255);
renderwindow->AddRenderer(renderer);
qVTKWidget->SetRenderWindow(renderwindow);
qVTKWidget->update();
}
//!---------------------------------------------------------------------------------
//!
//! \brief VolumeVisualization::mhdfileChoose
//!
void VolumeVisualization::mhdfileChoose(){
QString filename = QFileDialog::getOpenFileName(this,tr("Load File"),"D:\\school\\dataset\\CoronaryData_CTA\\",
tr("mhdfile(*.mhd*);;dcm(*.dcm*);;"
"vtk(*.vtk*);;vtp(*.vtp*);;"
"allfile(*.*)"));
this->filepathname = filename;
if(filename==NULL){
return ;
} else
this->mathdisplay(filename);
qDebug()<<"VolumeVisualization-mhdfileChoose()"<<filename;
}
//!---------------------------------------------------------------------------------
//!
//! \brief VolumeVisualization::getmhdfilename
//!
QString VolumeVisualization::getmhdfilename(){
return this->filepathname;
}
//!---------------------------------------------------------------------------------
//!
//! \brief VolumeVisualization::get_renderer
//!
vtkRenderer* VolumeVisualization::get_renderer(){
return this->renderer;
}
//!---------------------------------------------------------------------------------
//!
//! \brief VolumeVisualization::get_rendererWindow
//!
vtkRenderWindow* VolumeVisualization::get_rendererWindow(){
return this->renderwindow;
}
//!---------------------------------------------------------------------------------
//!
//! \brief VolumeVisualization::get_volumeReader
//!
vtkMetaImageReader* VolumeVisualization::get_volumeReader(){
return this->volumeReader;
}
//!---------------------------------------------------------------------------------
//!
//! \brief VolumeVisualization::get_colorTranFun
//!
vtkColorTransferFunction *VolumeVisualization::get_colorTranFun(){
return this->colorTranFun;
}
//!---------------------------------------------------------------------------------
//!
//! \brief VolumeVisualization::get_qvtkWidget
//!
QVTKWidget* VolumeVisualization::get_qvtkWidget(){
return this->qVTKWidget;
}
//!---------------------------------------------------------------------------------
//!
//! \brief VolumeVisualization::get_volume
//!
vtkVolume *VolumeVisualization::get_volume(){
return this->volume;
}
//!---------------------------------------------------------------------------------
//!
//! \brief VolumeVisualization::getxDimsion
//!
int VolumeVisualization::getxDimsion(){
return this->xdim;
}
int VolumeVisualization::getyDimsion(){
return this->ydim;
}
int VolumeVisualization::getzDimsion(){
return this->zdim;
}
//!---------------------------------------------------------------------------------
//!
//! \brief VolumeVisualization::getxOrigin
//!
double VolumeVisualization::getxOrigin(){
return this->xorigin;
}
double VolumeVisualization::getyOrigin(){
return this->yorigin;
}
double VolumeVisualization::getzOrigin(){
return this->zorigin;
}
//!---------------------------------------------------------------------------------
//!
//! \brief VolumeVisualization::getxSpacing
//!
double VolumeVisualization::getxSpacing(){
return this->xspacing;
}
double VolumeVisualization::getySpacing(){
return this->yspacing;
}
double VolumeVisualization::getzSpacing(){
return this->zspacing;
}
//!---------------------------------------------------------------------------------
//!
//! \brief VolumeVisualization::getVolume
//! \return
//!
vtkVolume *VolumeVisualization::getVolume(){
return this->volume;
}
|
7e01925fbc1d77966bceb4598a24b3f589266791 | ddb62798ad2739d32add6190367f110324930f43 | /Source/LudumDare49/Private/Game/HUD/UI/GameUserWidget.cpp | 1ddb817ce800bb83ddb34529c0029716f9a8dbce | [] | no_license | markveligod/LudumDare49 | 977b517ddb727f4c3802d3c4657b7656f7d797ba | 98c7ed069f1992ba97bfc1a2b1324eb6aec2aa39 | refs/heads/main | 2023-09-01T15:46:23.088781 | 2021-10-04T20:52:22 | 2021-10-04T20:52:22 | 412,561,034 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 319 | cpp | GameUserWidget.cpp | // Fill out your copyright notice in the Description page of Project Settings.
#include "Game/HUD/UI/GameUserWidget.h"
#include "Kismet/GameplayStatics.h"
#include "Sound/SoundCue.h"
void UGameUserWidget::ShowAnimEnd()
{
UGameplayStatics::PlaySound2D(GetWorld(), this->WastedSound);
Super::ShowAnimEnd();
}
|
076912a605113eafb74d2c5ef124d8d05bd85cf7 | 106ca112fb26acd88e2b232594412cb8a1d614a4 | /Module 2/Lab/Lab2b/Lab2b.cpp | 92c398b5bfdf7fe5c4c7c8243c49c6170b5b19d7 | [] | no_license | juliediliberto/CST370 | 3665ffd78eb4ac540ac45675ddfa1bb914a0158a | 4fcdb38819218ce6305ccca253ce3d77b8ff5a92 | refs/heads/master | 2021-01-16T23:24:22.347342 | 2016-06-07T05:53:41 | 2016-06-07T05:53:41 | 60,585,517 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 966 | cpp | Lab2b.cpp | /* Title: CST 370 Lab 2
Author: Julia Diliberto
ID: 002300804
Date: January 17, 2016
File: Lab2b.cpp
Desc: This program will take a decimal number as input from the user.
It will display that number, calculate the binary equivalent,
then display that number.
Usage: Other files required are Stack.cpp and Stack.h*/
#include <iostream>
#include<stdio.h>
using namespace std;
#include "Stack.h"
int main()
{
Stack binaryDigits;
int num=-1;
// get user input
while (!cin || num<0){
cout <<"Enter a positive integer: ";
cin >> num;
cin.clear();
cin.ignore(10000,'\n');
}
// display input as decimal
cout <<"Decimal: "<<num<<endl;
// compute input as binary
while (num != 0){
binaryDigits.push(abs(num%2));
num=num/2;
}
// display binary
cout <<"Binary: ";
if (binaryDigits.empty())
cout << "0";
else{
while (!binaryDigits.empty()){
cout <<binaryDigits.top();
binaryDigits.pop();
}
}
cout <<endl;
} |
d0f4cf1c472a847852a97a0bde7d29e2c5c56b21 | e9f0b0896d38c47f86e8b7918f7891f585e3ece7 | /HomeWork5.cpp | 0b6b199031de0979b56d0e8e4d1510cb0fe12be8 | [] | no_license | Tegeram/Course3 | a7e2f34f90d6ba0f8bba50251f75b3353fe3532c | 4638c1cc41acb871e84f6b5812cd72bcb20e3551 | refs/heads/main | 2023-08-06T10:51:01.973708 | 2021-09-19T20:47:47 | 2021-09-19T20:47:47 | 399,941,067 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,965 | cpp | HomeWork5.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <list>
#include <map>
#include <sstream>
#include <boost/algorithm/string.hpp>
using namespace std;
//=====Task 1==========================================================================================================
template <typename T>
void UniqueWord(T from, T to) {
auto new_last = from;
for (auto it{ from }; it != to; ++it) {
if (find(from, new_last, *it) == new_last)
{
if (new_last != it) *new_last = *it;
++new_last;
cout << *it << '\n';
}
}
}
//=====Task 2==========================================================================================================
void PhraseSort(string str) {
multimap<int,string> myMap;
istringstream iss(str);
string input;
while (iss) {
getline(iss, input, '.');
boost::algorithm::trim(input);
myMap.insert(make_pair(input.length(),input));
}
for (auto a : myMap) {
cout << a.second << '\n';
}
}
//=====================================================================================================================
int main()
{
cout << "Task 1" << endl;
list<string> line;
line.push_back("No");
line.push_back("will");
line.push_back("No");
line.push_back("I");
line.push_back("will");
line.push_back("forget");
line.push_back("never");
line.push_back("forget");
UniqueWord(line.begin(), line.end());
cout << '\n';
vector<string> tokens{ "duplicates","to","string","remove", "to", "remove", "string","duplicates", "in"};
UniqueWord(tokens.begin(),tokens.end());
//=================================================================================================================
cout << endl << "Task 2" << endl << "Enter text through '.':" << endl;
string str;
getline(cin, str);
PhraseSort(str);
}
|
a65a1742337be0a438851cc3cb7ff304afe6113f | 72676705a58fc326540e7ab43c782c2de313f3ba | /reverse-dpct/main.cpp | f54f42357feda1f3f9fda77bc5be007de1420936 | [
"BSD-3-Clause"
] | permissive | xwentian2020/oneAPI-DirectProgramming | dfdff2fb56357b8aef5e7207760926dc7e8327d9 | a3eab529ddc7794af666e71df728313ac027b69d | refs/heads/master | 2023-08-10T12:05:48.601018 | 2021-09-06T01:56:20 | 2021-09-06T01:56:20 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,286 | cpp | main.cpp | #include <CL/sycl.hpp>
#include <dpct/dpct.hpp>
#include <assert.h>
void reverse (int* d, const int len, sycl::nd_item<3> item_ct1, int *s)
{
int t = item_ct1.get_local_id(2);
int tr = len-t-1;
s[t] = d[t];
item_ct1.barrier();
d[t] = s[tr];
}
int main() {
dpct::device_ext &dev_ct1 = dpct::get_current_device();
sycl::queue &q_ct1 = dev_ct1.default_queue();
const int len = 256;
const int iteration = 1 << 20;
int d[len];
for (int i = 0; i < len; i++) d[i] = i;
int *dd;
dd = sycl::malloc_device<int>(len, q_ct1);
q_ct1.memcpy(dd, d, sizeof(int) * len).wait();
for (int i = 0; i <= iteration; i++)
q_ct1.submit([&](sycl::handler &cgh) {
sycl::accessor<int, 1, sycl::access::mode::read_write,
sycl::access::target::local>
s_acc_ct1(sycl::range<1>(256), cgh);
cgh.parallel_for(sycl::nd_range<3>(sycl::range<3>(1, 1, 256),
sycl::range<3>(1, 1, 256)),
[=](sycl::nd_item<3> item_ct1) {
reverse(dd, len, item_ct1, s_acc_ct1.get_pointer());
});
});
q_ct1.memcpy(d, dd, sizeof(int) * len).wait();
sycl::free(dd, q_ct1);
for (int i = 0; i < len; i++) assert(d[i] == len-i-1);
return 0;
}
|
a6e9c196c148ae12fbd39a2c994606e92bfb06fc | e3c0acd772aa95abb82d026cef77d1cd9e9a941d | /laba 6/tree.h | 69525132ec3a1954f7fe75ba1cbbe963d3996cca | [] | no_license | polinasevko/labs-CPlusPlus | a47dd8a9ab31c44ca29a3974dc79444bcb251144 | deb8d2c2dee779dcceac6b4e880ead71fa2aa282 | refs/heads/master | 2022-09-20T15:56:39.651555 | 2020-06-02T09:57:32 | 2020-06-02T09:57:32 | 259,084,391 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 901 | h | tree.h | #ifndef TREE_H
#define TREE_H
#include <ctime>
#include <cstdlib>
#include <string>
#include <vector>
using namespace std;
class Node
{
public:
int key;
string name;
unsigned char height;
Node* left;
Node* right;
Node();
Node(int k, string str) {key = k; name = str; left = right = nullptr; height = 1;}
};
class Tree
{
void FixHeight(Node*);
int BFactor(Node*);
Node* RotateLeft(Node* );
Node* RotateRight(Node*);
Node* FindMin(Node*);
Node* RemoveMin(Node*);
public:
Tree();
unsigned char Height(Node*);
Node* Add(Node*,int, string);
Node* Remove(Node*, int);
Node* Find(Node*, int);
vector<Node> PreOrderTree(Node*);
vector<Node> PostOrderTree(Node*);
vector<Node> SymmetricOrderTree(Node*);
Node* Balance(Node*);
vector<Node> vect;
Node *tmp;
};
#endif // TREE_H
|
08f77ba8e8569a12aa1c6210b7731684b080f5ae | 64589428b06258be0b9b82a7e7c92c0b3f0778f1 | /URI/1195.cpp | 1490d3707b672081f91e46d49f2055b0ae863a1f | [] | no_license | splucs/Competitive-Programming | b6def1ec6be720c6fbf93f2618e926e1062fdc48 | 4f41a7fbc71aa6ab8cb943d80e82d9149de7c7d6 | refs/heads/master | 2023-08-31T05:10:09.573198 | 2023-08-31T00:40:32 | 2023-08-31T00:40:32 | 85,239,827 | 141 | 27 | null | 2023-01-08T20:31:49 | 2017-03-16T20:42:37 | C++ | UTF-8 | C++ | false | false | 1,352 | cpp | 1195.cpp | #include <cstdio>
#include <cstdlib>
class node{
public:
node(int n){
value = n;
right = left = NULL;
}
virtual ~node(){
if (right!=NULL) delete right;
if (left!=NULL) delete left;
}
int value;
node* left;
node* right;
};
node* add(int n, node* p){
if(p==NULL) return new node(n);
if (p->value==n) return p;
if (p->value<n) p->right = add(n, p->right);
if (p->value>n) p->left = add(n, p->left);
return p;
}
void preorder(node* p){
if (p==NULL) return;
printf(" %d", p->value);
preorder(p->left);
preorder(p->right);
}
void inorder(node* p){
if (p==NULL) return;
inorder(p->left);
printf(" %d", p->value);
inorder(p->right);
}
void posorder(node* p){
if (p==NULL) return;
posorder(p->left);
posorder(p->right);
printf(" %d", p->value);
}
int main()
{
int C, N, x;
node* root;
scanf("%d", &C);
for (int caso=1; caso<=C; caso++){
scanf("%d", &N);
root=NULL;
for (int i=0; i<N; i++){
scanf("%d", &x);
root=add(x, root);
}
printf("Case %d:\nPre.:", caso);
preorder(root);
printf("\nIn..:");
inorder(root);
printf("\nPost:");
posorder(root);
printf("\n\n");
delete root;
}
return 0;
}
|
25b307fbfe3a04cbcebb326c71d0f5520ebd5a3f | 0a850b2a5853041b4302c1f0b4be3947e9306f70 | /Other124-132/PC.h | bfd5734be5ceb5220e00ac2e62b87b330c31b9e1 | [] | no_license | bifrurcated/LearningCpp | 6e1f36681d2ac6b777baff5ffc687f840ff30a7e | 2f6070db2f83838f1a94c60463b9cdb72238a3ae | refs/heads/master | 2023-06-23T05:30:02.594632 | 2021-07-26T08:08:19 | 2021-07-26T08:08:19 | 380,449,597 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 194 | h | PC.h | #pragma once
class PC {
public:
enum PCState {
OFF,
ON,
SLEEP
};
PCState GetState() { return State; }
void SetState(PCState State) { this->State = State; }
private:
PCState State;
}; |
ef840e62eb07edd775496746bba7015d23f174d5 | 7a2425190626dd2e75dd6cbca9fe47727afbad42 | /src/nstd/file/test_context.cpp | d5aa6621fc548445ca1bed34712937b803fd358f | [] | no_license | dietmarkuehl/kuhllib | fadd4073c9b09992479e92112ef34c367cb90fad | 482ddc2b910870398a9a2bcaa0a77a145e081f78 | refs/heads/main | 2023-08-31T22:13:02.079530 | 2023-08-21T22:14:14 | 2023-08-21T22:14:14 | 3,148,966 | 71 | 7 | null | 2023-08-21T22:14:15 | 2012-01-10T21:49:09 | C++ | UTF-8 | C++ | false | false | 5,122 | cpp | test_context.cpp | // nstd/file/test_context.cpp -*-C++-*-
// ----------------------------------------------------------------------------
// Copyright (C) 2021 Dietmar Kuehl http://www.dietmar-kuehl.de
//
// 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 <nstd/file/test_context.hpp>
namespace NF = ::nstd::file;
// ----------------------------------------------------------------------------
namespace nstd::file {
int test_context_dummy = 0;
}
// ----------------------------------------------------------------------------
NF::test_context::test_context()
: on_cancel([this](::nstd::file::context::io_base*, ::nstd::file::context::io_base* cont){ this->make_ready(-1, 0, cont); })
, on_nop([this](::nstd::file::context::io_base* cont){ this->make_ready(-1, 0, cont); })
, on_timer([this](::nstd::file::context::time_spec*, ::nstd::file::context::io_base* cont){ this->make_ready(-1, 0, cont); })
, on_accept([this](int, ::sockaddr*, ::socklen_t*, int, ::nstd::file::context::io_base* cont){ this->make_ready(-1, 0, cont); })
, on_connect([this](int, ::sockaddr const*, ::socklen_t, ::nstd::file::context::io_base* cont){ this->make_ready(-1, 0, cont); })
, on_sendmsg([this](int, ::msghdr const*, int, ::nstd::file::context::io_base* cont){ this->make_ready(-1, 0, cont); })
, on_recvmsg([this](int, ::msghdr*, int, ::nstd::file::context::io_base* cont){ this->make_ready(-1, 0, cont); })
, on_read([this](int, ::iovec*, ::std::size_t, ::nstd::file::context::io_base* cont){ this->make_ready(-1, 0, cont); })
, on_open_at([this](int, char const*, int, ::nstd::file::context::io_base* cont){ this->make_ready(-1, 0, cont); })
{
}
// ----------------------------------------------------------------------------
auto NF::test_context::do_run_one() -> ::nstd::file::context::count_type
{
if (this->d_ready.empty()) {
return 0;
}
auto[rc, flags, cont] = this->d_ready.back();
this->d_ready.pop_back();
cont->result(rc, flags);
return 1;
}
auto NF::test_context::do_cancel(io_base* to_cancel, io_base* cont) -> void
{
this->on_cancel(to_cancel, cont);
}
auto NF::test_context::do_nop(io_base* cont) -> void
{
this->on_nop(cont);
}
auto NF::test_context::do_timer(::nstd::file::context::time_spec* spec, io_base* cont) -> void
{
this->on_timer(spec, cont);
}
auto NF::test_context::do_accept(int fd, ::sockaddr* addr, ::socklen_t* len, int flags, io_base* cont) -> void
{
this->on_accept(fd, addr, len, flags, cont);
}
auto NF::test_context::do_connect(int fd, ::sockaddr const* addr, ::socklen_t len, io_base* cont) -> void
{
this->on_connect(fd, addr, len, cont);
}
auto NF::test_context::do_sendmsg(int fd, ::msghdr const* msg, int len, io_base* cont) -> void
{
this->on_sendmsg(fd, msg, len, cont);
}
auto NF::test_context::do_recvmsg(int fd, ::msghdr* msg, int len, io_base* cont) -> void
{
this->on_recvmsg(fd, msg, len, cont);
}
auto NF::test_context::do_read(int fd, ::iovec* data, ::std::size_t len, io_base* cont) -> void
{
this->on_read(fd, data, len, cont);
}
auto NF::test_context::do_write(int fd, ::iovec* data, ::std::size_t len, io_base* cont) -> void
{
this->on_write(fd, data, len, cont);
}
auto NF::test_context::do_open_at(int fd, char const* path, int flags, io_base* cont) -> void
{
this->on_open_at(fd, path, flags, cont);
}
// ----------------------------------------------------------------------------
auto NF::test_context::make_ready(int rc, int flags, ::nstd::file::context::io_base* cont) -> void
{
this->d_ready.emplace_front(rc, flags, cont);
}
|
7940a12699f65a93a032d8f2f9fa503c62ef6aaf | 02c43cda5f67158c01edbef30866bb5b03206663 | /플밍25기_김종환_할로우 나이트 모작/image+adjRender.cpp | 2f900500b9e21febb5bbc9f35bb7404553747144 | [] | no_license | RKJH-jin/RK_Projects | 81c102a208f2a1a31428154067e67b26ce82c2fe | e568ca59b0a5335805f307aa46c397b8c890117a | refs/heads/master | 2023-03-09T05:59:36.021119 | 2021-02-23T02:51:45 | 2021-02-23T02:51:45 | 341,404,963 | 1 | 0 | null | null | null | null | UHC | C++ | false | false | 2,152 | cpp | image+adjRender.cpp | #include "stdafx.h"
#include "image.h"
#pragma comment(lib, "msimg32.lib")
void image::adjRender(HDC hdc, int destX, int destY, int adjWidth, int adjHeight)
{
if (_trans)
{
GdiTransparentBlt(
hdc, //복사될 영역의 DC
destX, //복사될 좌표 X
destY, //복사될 좌표 Y
adjWidth, //복사될 크기 (가로)
adjHeight, //복사될 크기 (세로)
_imageInfo->hMemDC, //복사해올 DC
0, 0, //복사해올 좌표 X, Y
_imageInfo->width, //복사할 가로크기
_imageInfo->height, //복사할 세로크기
_transColor
);
}
else
{
SetStretchBltMode(hdc, HALFTONE);
StretchBlt(
hdc, //복사할 DC
destX, //복사할 좌표 X (left)
destY, //복사할 좌표 Y (top)
adjWidth, //조절할 width
adjHeight, //조절할 height
_imageInfo->hMemDC, //복사될 DC
0, 0, //복사될 기준점 (left, top)
_imageInfo->width, //이미지 크기
_imageInfo->height,
SRCCOPY); //변형없이 복사할거임
}
}
void image::adjFrameRender(HDC hdc, int destX, int destY, int currentFrameX, int currentFrameY, int adjWidth, int adjHeight)
{
_imageInfo->currentFrameX = currentFrameX;
_imageInfo->currentFrameY = currentFrameY;
if (_trans)
{
GdiTransparentBlt(
hdc, //복사될 영역의 DC
destX, //복사될 좌표 X
destY, //복사될 좌표 Y
adjWidth, //복사될 크기 (가로)
adjHeight, //복사될 크기 (세로)
_imageInfo->hMemDC, //복사해올 DC
_imageInfo->currentFrameX * _imageInfo->frameWidth,
_imageInfo->currentFrameY * _imageInfo->frameHeight,
_imageInfo->frameWidth, //복사할 가로크기
_imageInfo->frameHeight, //복사할 세로크기
_transColor
);
}
else
{
SetStretchBltMode(hdc, HALFTONE);
StretchBlt(hdc,
destX,
destY,
adjWidth,
adjHeight,
_imageInfo->hMemDC,
_imageInfo->currentFrameX * _imageInfo->frameWidth,
_imageInfo->currentFrameY * _imageInfo->frameHeight,
_imageInfo->frameWidth, //복사할 가로크기
_imageInfo->frameHeight, //복사할 세로크기
SRCCOPY
);
}
}
|
2be5abfb65c4c89158549b6ffafe569296089f3d | 0daacde345e6409ad01cda5d52d12855cfba4a99 | /ICT_Server/ICT_ServerDlg.h | 9d5a4f78cc42b98d236c2c4fcfe933ac84ba994a | [] | no_license | HanoiGuo/ICT-Socket-Server | 948dc883000fc7012c188ed838816a607bfc56bb | f0da6e18f3dbaacb89e36146f10d0cc1153a5bd0 | refs/heads/master | 2021-01-10T17:45:24.153469 | 2016-02-01T01:03:55 | 2016-02-01T01:03:55 | 50,804,337 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,353 | h | ICT_ServerDlg.h |
// ICT_ServerDlg.h : 头文件
//
#pragma once
#include "MyStatic.h"
#include "OperateFile.h"
// CICT_ServerDlg 对话框
class CICT_ServerDlg : public CDialogEx
{
// 构造
public:
CICT_ServerDlg(CWnd* pParent = NULL); // 标准构造函数
// 对话框数据
enum { IDD = IDD_ICT_SERVER_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
// 实现
protected:
HICON m_hIcon;
// 生成的消息映射函数
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
private:
OperateFile file;
int port;
char ipAddress[64];
typedef struct _RECVPARAM
{
SOCKET sock;
HWND hwnd;
}RECVPARAM;
public:
MyStatic m_staticTitle;
void DrawBK(UINT bmpID,UINT id);
CStatic m_staticBar;
afx_msg void OnBnClickedButtonConnect();
afx_msg LRESULT OnShowTask(WPARAM wParam,LPARAM lParam);
bool InitSocket(void);
static DWORD WINAPI WorkProc(LPVOID lpParameter);
afx_msg void OnTimer(UINT_PTR nIDEvent);
CStatic m_result;
afx_msg void OnBnClickedButtonClose();
CStatic m_StaticLog;
CStatic m_state;
afx_msg void OnClose();
int GetSysMac(int &macNum,char macList[][18]);
bool CheckMACAddress(string serial,char *macList,int len);
void ToTray(void);
void DeleteTray(void);
};
|
72fa90233a7c1af38c69c3b753dea70e4520e8fa | b2565cb7f7cccda09698a4e87b06a5def3117a2e | /Sources/Level/Loader/Layers/Entities/AnimatedEntity.cpp | 4ff6df168f750ae3b587f154eaeb63f820d3341d | [] | no_license | Olxe/MonsterRules | d147a4a62ebae75fb17f61bbc2f062d02071f071 | 6c61a4dfca924b870a25264519ee690f576339a3 | refs/heads/master | 2022-05-23T17:52:10.635921 | 2020-01-21T23:24:31 | 2020-01-21T23:24:31 | 224,265,373 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,113 | cpp | AnimatedEntity.cpp | #include "AnimatedEntity.h"
namespace entities
{
AnimatedEntity::AnimatedEntity(sf::Sprite* sprite)
: m_sprite(sprite)
, m_currentAnimation(nullptr)
, m_currentTime(0.f)
, m_currentFrame(0)
, isLooped(false)
, isActived(false)
{
}
AnimatedEntity::~AnimatedEntity()
{
}
void AnimatedEntity::setSprite(sf::Sprite* sprite)
{
m_sprite = sprite;
}
void AnimatedEntity::Add(std::string name, const sf::Texture* texture, sf::Vector2i frameSize, float frameTime, std::vector<sf::Vector2i> framePos)
{
m_animations.push_back(std::make_unique<Animation>(name, texture, framePos, frameSize, frameTime));
}
bool AnimatedEntity::Start(const std::string& name, const std::string& type, bool looped, bool reseted)
{
for (auto& animation : m_animations) {
if (animation->Name() == name) {
if (!m_currentAnimation || m_currentAnimation->Name() != name) {
m_currentAnimation = animation.get();
if (m_sprite && m_currentAnimation && m_currentAnimation->Size() > 0) {
isLooped = looped;
m_type = type;
m_sprite->setTexture(*m_currentAnimation->Texture());
if (reseted) {
this->Stop();
}
m_sprite->setTextureRect(m_currentAnimation->Frame(m_currentFrame - 1));
this->Start();
return true;
}
}
}
}
return false;
}
void AnimatedEntity::Update(const float& deltaTime)
{
if (m_currentAnimation && isActived) {
m_currentTime += deltaTime;
while (m_currentTime >= m_currentAnimation->FrameDuration()) {
m_currentTime -= m_currentAnimation->FrameDuration();
if (m_currentFrame >= m_currentAnimation->Size()) {
this->m_callBack(m_currentAnimation->Name(), m_type);
if (isLooped) {
m_currentFrame = 0;
}
else {
isActived = false;
}
}
if (isActived && m_sprite) {
m_currentFrame++;
m_sprite->setTextureRect(m_currentAnimation->Frame(m_currentFrame - 1));
}
}
}
}
void AnimatedEntity::Stop()
{
m_currentFrame = 1;
m_currentTime = 0;
isActived = false;
}
void AnimatedEntity::Start()
{
isActived = true;
}
} |
b927fc90654df520f0c181357185d1f3002a359c | 336632b3aab57699812f47e8942b99eca3e4d805 | /lsimd/fastarray_2f32.h | f7f86a8f73417a9b1d520e9b61c90abd945004ac | [
"MIT"
] | permissive | obskera/godot-lsimd | dbfee8192a5a18dc89cab82226385919d8f1a53b | 2d0bd167bc00c31153044d54789966ce2a9f54f2 | refs/heads/master | 2023-03-17T01:56:41.529938 | 2020-08-27T09:52:32 | 2020-08-27T09:52:32 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,147 | h | fastarray_2f32.h | #pragma once
#include "simd_types.h"
#include "simd_vector.h"
#include "core/reference.h"
#include "simd_f32.h"
class FastArray_2f32: public Reference
{
GDCLASS(FastArray_2f32, Reference);
enum eRangeFlags
{
RF_BEFORE = 1 << 0,
RF_AFTER = 1 << 1,
};
public:
FastArray_2f32();
// sizing
void reserve(int size)
{
m_iSize = size;
m_Array.resize(_calc_quad_size(size));
m_Result.resize(m_Array.size() * 2);
m_Result.zero();
zero();
}
void resize(int size)
{
m_iSize = size;
m_Array.resize(_calc_quad_size(size));
m_Result.resize(m_Array.size() * 2);
m_Result.zero();
}
int size() const {return m_iSize;}
void fill(const Vector2 &v);
void zero() {m_Array.zero();}
void copy_from(const Ref<FastArray_2f32> &arr2);
Vector2 read(int i) const;
void write(int i, const Vector2 &v);
float read_result(int i) const;
void value_add(const Vector2 &val, int from, int num);
void value_subtract(const Vector2 &val, int from, int num);
void value_multiply(const Vector2 &val, int from, int num);
void value_divide(const Vector2 &val, int from, int num);
void sqrt(int from, int num);
void inv_sqrt(int from, int num);
void reciprocal(int from, int num);
void add(const Ref<FastArray_2f32> &arr2, int from, int from2, int num);
void subtract(const Ref<FastArray_2f32> &arr2, int from, int from2, int num);
void multiply(const Ref<FastArray_2f32> &arr2, int from, int from2, int num);
void divide(const Ref<FastArray_2f32> &arr2, int from, int from2, int num);
void dot(const Ref<FastArray_2f32> &arr2, int from, int from2, int num);
void cross(const Ref<FastArray_2f32> &arr2, int from, int from2, int num);
void normalize(int from, int num);
void length(int from, int num);
void length_squared(int from, int num);
protected:
static void _bind_methods();
private:
int _calc_quad_size(int size) const;
unsigned int _find_quad_range(int from, int num, int &q_from, int &num_quads) const;
Simd_4f32 m_Array;
// store the results of operations like dot product in an array of equal length to the number of elements
GSimd::SVector<float> m_Result;
int m_iSize; // in vector 2 units
};
|
8598af5d209a575714d1e012becd895c789c9e2d | 5b46738402f4c4f3c46d0e67c0e6fdc08031d9fa | /Contests/Yandex/18/1/B.cpp | 217fb78cdebb7833c367dff9eaf8d132af60d63a | [] | no_license | gafeol/competitive-programming | a57dcd6fbcc7eed9e4aa77815e7cb525c9ace30c | 1af50554afe4b869f341b16681618aef0e291534 | refs/heads/master | 2021-07-07T09:23:51.984327 | 2021-04-18T18:20:21 | 2021-04-18T18:20:21 | 67,904,346 | 5 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,169 | cpp | B.cpp | #include <bits/stdc++.h>
using namespace std;
#define fst first
#define snd second
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
#define pb push_back
#define for_tests(t, tt) int t; scanf("%d", &t); for(int tt = 1; tt <= t; tt++)
#ifndef ONLINE_JUDGE
#define debug(args...) fprintf(stderr,args)
#else
#define debug(args...)
#endif //ONLINE_JUDGE
template<typename T> inline T abs(T t) { return t < 0? -t : t; }
const ll modn = 1000000007;
inline ll mod(ll x) { return x % modn; }
const int MAXN = 212345;
int n, m, k;
int s[MAXN];
int nxt[MAXN][10];
int pos[MAXN];
char st[MAXN];
vector<char> v;
int main (){
scanf(" %s", st);
n = strlen(st);
for(int a=0;a<n;a++){
s[a] = st[a]-'0';
}
for(int a=0;a<10;a++){
nxt[n][a] = n;
nxt[n+1][a] = n;
}
for(int a=n-1;a>=0;a--){
for(int d=0;d<10;d++)
nxt[a][d] = nxt[a+1][d];
nxt[a][s[a]] = a;
}
for(char c = 'a';c <='j';c++)
v.pb(c);
int res = 0;
do{
int u = 0;
for(int a=0;a<v.size();a++)
pos[v[a]] = a;
for(int a='a';a<='j';a++)
u = nxt[u][pos[a]]+1;
if(u <= n)
res++;
} while(next_permutation(v.begin(), v.end()));
printf("%d\n", res);
}
|
fbea0070f8e468247c3941fdcd91628329ebdc6b | ba7b031365215fe7174959017c5f756fae48bb61 | /impl/filedataprovider/filedataprovider.h | 472bbe5a89128b7841f85783ad904134b68c9bbf | [
"MIT"
] | permissive | sergey-zubkov/2gis-test-app | 10bd372c1686e8541a8780b11491405500502db0 | 4d49794718d3afa2ebbce4f32f39c55294d45d0b | refs/heads/master | 2022-12-05T10:39:21.671720 | 2020-09-07T17:24:03 | 2020-09-07T17:24:03 | 293,588,485 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 545 | h | filedataprovider.h | //
// filedataprovider.h
// 2gis_test_app
//
// Created by Sergey Zubkov on 07.09.2020.
//
#ifndef filedataprovider_h
#define filedataprovider_h
#include <exception>
#include <string>
//
#include "dataprovider.h"
namespace test_app {
class FileDataProvider : public DataProvider {
public:
FileDataProvider(const std::string &filename)
: _filename(filename) {}
virtual void provide(); //throw(std::exception);
~FileDataProvider() {}
private:
std::string _filename;
};
}
#endif /* filedataprovider_h */
|
3dcc74b32cdbf37cb7d7655621634b54d20b4cff | 933c10b822d59422194d9ac2515ae6354eb6a101 | /2017/BSTtest.cpp | ba291295f0c61c81b455faf2cff6bee0bdab4ef4 | [] | no_license | tibousi/PAT_2017 | 9cf8adfd366a27ef1d143b0effebf7040060947b | 4321d04b26503d8b63951694b18664f41b42ac89 | refs/heads/master | 2020-03-23T13:04:35.226042 | 2018-07-20T04:54:36 | 2018-07-20T04:54:36 | 141,597,574 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,455 | cpp | BSTtest.cpp | struct node{
int data;
node* lchild;
node* rchild;
};
void search(node* root,int x){
if(root==NULL){
printf("search failed\n");
return;
}
if(x==root->data){
printf("%d\n",root->data);
}
if(x>root->data){
search(root->rchild,x);
}else{
search(root->lchild,x);
}
}
node* newNode(int v){
node* Node=new node;
Node->data=v;
Node->lchild=Node->rchild=NULL;
return Node;
}
void insert(node* &root,int x){
if(root==NULL){
root=newNode(x);
return;
}
if(x==root->data) return ;
else if(x<root->data){
insert(root->lchild,x);
}else{
insert(root->rchild,x);
}
}
node* create(int data[],int n){
node* root=NULL;
for(int i=0;i<n;i++){
insert(root,data[i]);
}
return root;
}
node* findmax(node* root){
while(root->rchild!=NULL){
root=root->rchild;
}
return root;
}
node* findmin(node* root){
while(root->lchild!=NULL){
root=root->lchild;
}
return root;
}
void deleteNode(node* &root,int x){
if(root==NULL) return;
if(root->data==x){
if(root->lchild==NULL&&root->rchild==NULL){
root=NULL;
}else if(root->lchild!=NULL){
node* pre=finmax(root->lchild);
root->data=pre->data;
deleteNode(root->lchild,pre->data);
}else{
node* post=finmin(root->rchild);
root->data=post->data;
deleteNode(root->rchild,post->data);
}
}else if(root->data>x){
deleteNode(root->lchild,x);
}else{
deleteNode(root->rchild,x);
}
}
|
c4258eb679a6cb9354087a272254c924e41dcb30 | 4081245b8ed21b053664ebd66340db8d38ab8c4f | /N-aryTreeLevelOrderTraversal.cpp | 72f97bef24e43d6ccfdff696a6cf5298f278d9b8 | [] | no_license | anandaditya444/LEETCODE | 5240f0adf1df6a87747e00842f87566b0df59f92 | 82e597c21efa965cfe9e75254011ce4f49c2de36 | refs/heads/master | 2020-05-07T15:48:19.081727 | 2019-08-25T16:03:57 | 2019-08-25T16:03:57 | 180,653,012 | 2 | 1 | null | 2019-10-05T13:45:29 | 2019-04-10T19:48:40 | C++ | UTF-8 | C++ | false | false | 1,023 | cpp | N-aryTreeLevelOrderTraversal.cpp | //Q. 429
/*
// Definition for a Node.
class Node {
public:
int val;
vector<Node*> children;
Node() {}
Node(int _val, vector<Node*> _children) {
val = _val;
children = _children;
}
};
*/
class Solution {
public:
vector<vector<int>> levelOrder(Node* root) {
vector<vector<int> >ans;
if(root == NULL)
return ans;
queue<Node*>q;
q.push(root);
q.push(NULL);
vector<int>v;
while(!q.empty())
{
Node* f = q.front();
if(f == NULL)
{
ans.push_back(v);
v.clear();
q.pop();
if(!q.empty())
q.push(NULL);
}
else
{
v.push_back(f->val);
q.pop();
for(int i=0;i<f->children.size();i++)
{
q.push(f->children[i]);
}
}
}
return ans;
}
}; |
2acfeced1730ec315564a4626d45f6c8106ec621 | b2139a7f5e04114c39faea797f0f619e69b8b4ae | /src/logpolarAttention/src/gazeArbiter/src/gazeArbiterThread.cpp | 2273dad22b584666a3760a7d3d0a17ccf66ce1bb | [] | no_license | hychyc07/contrib_bk | 6b82391a965587603813f1553084a777fb54d9d7 | 6f3df0079b7ea52d5093042112f55a921c9ed14e | refs/heads/master | 2020-05-29T14:01:20.368837 | 2015-04-02T21:00:31 | 2015-04-02T21:00:31 | 33,312,790 | 5 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 82,355 | cpp | gazeArbiterThread.cpp | // -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
/*
* Copyright (C) 2010 RobotCub Consortium, European Commission FP6 Project IST-004370
* Authors: Rea Francesco
* email: francesco.rea@iit.it
* website: www.robotcub.org
* Permission is granted to copy, distribute, and/or modify this program
* under the terms of the GNU General Public License, version 2 or any
* later version published by the Free Software Foundation.
*
* A copy of the license can be found at
* http://www.robotcub.org/icub/license/gpl.txt
*
* 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
*/
/**
* @file gazeCollectorThread.cpp
* @brief Implementation of the gaze arbiter thread(see header gazeArbiterThread.h)
*/
#include <iCub/gazeArbiterThread.h>
#include <yarp/math/Math.h>
#include <yarp/math/SVD.h>
#include <cstring>
using namespace yarp::os;
using namespace yarp::sig;
using namespace yarp::dev;
using namespace std;
using namespace yarp::math;
using namespace iCub::iKin;
#define THRATE 10
#define PI 3.14159265
#define BASELINE 0.068 // distance in meters between eyes
#define TIMEOUT_CONST 8 // time constant after which the motion is considered not-performed
#define ERROR_THRESH 20 // threshold in the spatial error of the saccade
#define INHIB_WIDTH 320
#define INHIB_HEIGHT 240
#define CONFIGFOVEA
static Vector orVector (Vector &a, Vector &b) {
int dim = a.length();
Vector res((const int)dim);
for (int i = 0; i < a.length() ; i++) {
if((a[i]==1)||(b[i]==1)) {
res[i] = 1;
}
else {
res[i] = 0;
}
}
return res;
}
/************************************************************************/
bool getCamPrj(const string &configFile, const string &type, Matrix **Prj)
{
*Prj=NULL;
if (configFile.size())
{
Property par;
par.fromConfigFile(configFile.c_str());
Bottle parType=par.findGroup(type.c_str());
string warning="Intrinsic parameters for "+type+" group not found";
if (parType.size())
{
if (parType.check("w") && parType.check("h") &&
parType.check("fx") && parType.check("fy"))
{
// we suppose that the center distorsion is already compensated
//double cx = parType.find("w").asDouble() / 2.0;
//double cy = parType.find("h").asDouble() / 2.0;
// we suppose that the centerof ditortion is NOT compensated
double cx = parType.find("cx").asDouble();
double cy = parType.find("cy").asDouble();
double fx = parType.find("fx").asDouble();
double fy = parType.find("fy").asDouble();
Matrix K = eye(3,3);
Matrix Pi = zeros(3,4);
K(0,0) = fx;
K(1,1) = fy;
K(0,2) = cx;
K(1,2) = cy;
Pi(0,0) = Pi(1,1) = Pi(2,2) = 1.0;
*Prj = new Matrix;
**Prj = K * Pi;
return true;
}
else
fprintf(stdout,"%s\n",warning.c_str());
}
else
fprintf(stdout,"%s\n",warning.c_str());
}
return false;
}
/**********************************************************************************/
gazeArbiterThread::gazeArbiterThread(string _configFile) : RateThread(THRATE) {
numberState = 4; //null, vergence, smooth pursuit, saccade
countVerNull = 0;
camSel = 0;
configFile = _configFile;
//boolean flag initialisation
firstVer = false;
availableVisualCorr = false;
visualCorrection = true;
isOnWings = false;
onDvs = false;
firstVergence = true;
countRegVerg = 0;
sumRegVerg = 0;
phiTOT = 0;
xOffset = 0;
yOffset = 0;
zOffset = 0;
blockNeckPitchValue =-1;
Matrix trans(5,5);
trans(0,0) = 1.0 ; trans(0,1) = 1.0 ; trans(0,2) = 1.0 ; trans(0,3) = 1.0; trans(0,4) = 1.0;
trans(1,0) = 1.0 ; trans(1,1) = 1.0 ; trans(1,2) = 1.0 ; trans(1,3) = 1.0; trans(1,4) = 1.0;
trans(2,0) = 1.0 ; trans(2,1) = 1.0 ; trans(2,2) = 1.0 ; trans(2,3) = 1.0; trans(2,4) = 1.0;
trans(3,0) = 1.0 ; trans(3,1) = 1.0 ; trans(3,2) = 1.0 ; trans(3,3) = 1.0; trans(3,4) = 1.0;
trans(4,0) = 1.0 ; trans(4,1) = 1.0 ; trans(4,2) = 1.0 ; trans(4,3) = 1.0; trans(4,4) = 1.0;
stateTransition=trans;
Vector req(5);
req(0) = 0;
req(1) = 0;
req(2) = 0;
req(3) = 0;
req(4) = 0;
stateRequest = req;
allowedTransitions = req;
Vector s(5);
s(0) = 1;
s(1) = 0;
s(2) = 0;
s(3) = 0;
s(4) = 0;
state = s;
Vector t(3);
t(0) = -0.6;
t(1) = 0;
t(2) = 0.6;
xFix = t;
printf("extracting kinematic informations \n");
}
gazeArbiterThread::~gazeArbiterThread() {
// MUST BE REMOVED THE RF AND TRACKER ALLOCATED IN THE CONSTRUCTOR
}
bool gazeArbiterThread::threadInit() {
done=true;
executing = false;
printf("starting the thread.... \n");
//initializing gazecontrollerclient
printf("initialising gazeControllerClient \n");
Property option;
option.put("device","gazecontrollerclient");
option.put("remote","/iKinGazeCtrl");
string localCon("/client/gaze");
localCon.append(getName(""));
option.put("local",localCon.c_str());
clientGazeCtrl=new PolyDriver();
clientGazeCtrl->open(option);
igaze=NULL;
if (clientGazeCtrl->isValid()) {
clientGazeCtrl->view(igaze);
}
else
return false;
igaze->storeContext(&originalContext);
if(blockNeckPitchValue != -1) {
igaze->blockNeckPitch(blockNeckPitchValue);
printf("pitch fixed at %f \n",blockNeckPitchValue);
}
else {
printf("pitch free to change\n");
}
// -----------------------------------------------------------------
Bottle info;
igaze->getInfo(info);
printf("just got the info \n");
int head_version = info.check("head_version", Value(1)).asInt();
printf("head_version extracted from gazeArbiter \n");
if(head_version == 1) {
eyeL = new iCubEye("left");
eyeR = new iCubEye("right");
}
else {
eyeL = new iCubEye("left_v2");
eyeR = new iCubEye("right_v2");
}
printf("correctly istantiated the head \n");
// remove constraints on the links
// we use the chains for logging purpose
// eyeL->setAllConstraints(false);
// eyeR->setAllConstraints(false);
// release links
eyeL->releaseLink(0);
eyeR->releaseLink(0);
eyeL->releaseLink(1);
eyeR->releaseLink(1);
eyeL->releaseLink(2);
eyeR->releaseLink(2);
// if it isOnWings, move the eyes on top of the head
if (isOnWings) {
printf("changing the structure of the chain \n");
iKinChain* eyeChain = eyeL->asChain();
//eyeChain->rmLink(7);
//eyeChain->rmLink(6); ;
iKinLink* link = &(eyeChain-> operator ()(5));
//double d_value = link->getD();
//printf("d value %f \n", d_value);
//double a_value = link->getA();
//printf("a value %f \n", a_value);
link->setD(0.145);
link = &(eyeChain-> operator ()(6));
link->setD(0.0);
//eyeChain->blockLink(6,0.0);
//eyeChain->blockLink(7,0.0);
//link = &(eyeChain-> operator ()(6));
//link->setA(0.0);
//link->setD(0.034);
//link->setAlpha(0.0);
//double d_value = link->getD();
//printf("d value %f \n", d_value);
//iKinLink twistLink(0.0,0.034,M_PI/2.0,0.0,-22.0*CTRL_DEG2RAD, 84.0*CTRL_DEG2RAD);
//*eyeChain << twistLink;
//eyeL->releaseLink(6);
}
else {
printf("isOnWing false \n");
}
// get camera projection matrix from the configFile
printf("get Camera configuration Left %s \n", configFile.c_str());
if (getCamPrj(configFile,"CAMERA_CALIBRATION_LEFT",&PrjL)) {
Matrix &Prj = *PrjL;
cxl=Prj(0,2);
cyl=Prj(1,2);
printf("pixel fovea in the config file left %f %f \n", cxl,cyl);
invPrjL=new Matrix(pinv(Prj.transposed()).transposed());
}
else {
printf("ERROR : CAMERA CALIBRARION LEFT was not found \n");
return false;
}
printf("get Camera configuration Right \n");
if (getCamPrj(configFile,"CAMERA_CALIBRATION_RIGHT",&PrjR)) {
Matrix &Prj = *PrjR;
cxr = Prj(0,2);
cyr = Prj(1,2);
printf("pixel fovea in the config file right %f %f \n", cxr,cyr);
invPrjR=new Matrix(pinv(Prj.transposed()).transposed());
}
else {
printf("ERROR : CAMERA CALIBRARION RIGHT was not found \n");
return false;
}
//--------------------------------------------------------------------
string headPort = "/" + robot + "/head";
string nameLocal("gazeArbiter");
//initialising the head polydriver
optionsHead.put("device", "remote_controlboard");
optionsHead.put("local", ("/"+nameLocal+"/localhead").c_str());
optionsHead.put("remote", headPort.c_str());
robotHead = new PolyDriver (optionsHead);
if (!robotHead->isValid()){
printf("cannot connect to robot head\n");
}
robotHead->view(encHead);
//initialising the torso polydriver
printf("starting the polydrive for the torso.... \n");
Property optPolyTorso("(device remote_controlboard)");
optPolyTorso.put("remote",("/"+robot+"/torso").c_str());
optPolyTorso.put("local",("/"+nameLocal+"/torso/position").c_str());
polyTorso=new PolyDriver;
if (!polyTorso->open(optPolyTorso))
{
return false;
}
polyTorso->view(encTorso);
template_size = 20;
search_size = 100;
point.x = INHIB_WIDTH;
point.y = INHIB_HEIGHT;
template_roi.width = template_roi.height = template_size;
search_roi.width = search_roi.height = search_size;
//opening port section
string rootNameStatus("");rootNameStatus.append(getName("/status:o"));
statusPort.open(rootNameStatus.c_str());
string rootNameEgoMotion("");rootNameEgoMotion.append(getName("/egoMotion:o"));
egoMotionFeedback.open(rootNameEgoMotion.c_str());
string rootNameTiming("");rootNameTiming.append(getName("/timing:o"));
timingPort.open(rootNameTiming.c_str());
string rootNameError("");rootNameError.append(getName("/error:o"));
errorPort.open(rootNameError.c_str());
string rootNameTemplate("");rootNameTemplate.append(getName("/template:o"));
templatePort.open(rootNameTemplate.c_str());
string rootNameDatabase("");rootNameDatabase.append(getName("/database:o"));
blobDatabasePort.open(rootNameDatabase.c_str());
string rootNameInhibition("");rootNameInhibition.append(getName("/inhibition:o"));
inhibitionPort.open(rootNameInhibition.c_str());
inLeftPort.open(getName("/gazeArbiter/imgMono:i").c_str());
//inRightPort.open(getName("/matchTracker/img:o").c_str());
firstConsistencyCheck=true;
inhibitionImage = new ImageOf<PixelMono>;
inhibitionImage->resize(INHIB_WIDTH,INHIB_HEIGHT);
inhibitionImage->zero();
unsigned char* pinhi = inhibitionImage->getRawImage();
int padding = inhibitionImage->getPadding();
int rowsizeInhi = inhibitionImage->getRowSize();
int ym = INHIB_HEIGHT >> 1;
int xm = INHIB_WIDTH >> 1;
//calculating the peek value
int dx = 50.0;
int dy = 50.0;
double sx = (dx / 2) / 3 ; //0.99 percentile
double sy = (dy / 2) / 3 ;
double vx = 9; //sx * sx; // variance
double vy = 9; //sy * sy;
double rho = 0;
double a = 0.5 / (3.14159 * vx * vy * sqrt(1-rho * rho));
double b = -0.5 /(1 - rho * rho);
double k = 1 / (a * exp (b));
double f, e, d, z = 1;
double zmax = 0;
pinhi += ((int)(ym-(dy>>1))) * rowsizeInhi + ((int)(xm-(dx>>1)));
//for the whole blob in this loop
for (int r = ym - (dy>>1); r <= ym + (dy>>1); r++) {
for (int c = xm - (dx>>1); c <= xm + (dx>>1); c++){
if((c == xm)&&(r == ym)) {
//z = a * exp (b);
//z = z * k;
z = 1;
}
else {
f = ((c - xm) * (c - xm)) /(vx * vx);
d = ((r - ym) * (r - ym)) /(vy * vy);
//e = (2 * rho* (c - ux) * (r - uy)) / (vx * vy);
e = 0;
z = a * exp ( b * (f + d - e) );
z = z * k;
if(z>zmax) zmax=z;
z = (1 / 1.646172) * z;
//z = 0.5;
}
// restrincting the z gain between two thresholds
if (z > 1) {
z = 1;
}
//set the image
*pinhi++ = 255 * z;
}
//pinhi += rowsizeInhi - dx ; //odd
pinhi += rowsizeInhi - (dx + 1) ; //even
}
printf(" \n zmax = %f \n", zmax);
printf("starting the trackers.... \n");
// active agent for countinuos tracking
ResourceFinder* rf = new ResourceFinder();
tracker = new trackerThread(*rf);
tracker->setName(getName("/matchTracker").c_str());
tracker->start();
printf("tracker successfully started \n");
//active agent for periodic tracking
ptracker = new periodicTrackerThread(*rf);
ptracker->setName(getName("/periodicTracker").c_str());
ptracker->start();
printf("periodic tracker successfully started \n");
ptracker->setUpdate(true);
ptracker->init(160,120);
ptracker->setUpdate(false);
// active agent for velocity control
printf("starting the velocity controller \n");
velControl = new velocityController();
velControl->setName(getName("/velControl").c_str());
velControl->start();
printf("velocity controller successfully started \n");
return true;
}
void gazeArbiterThread::interrupt() {
//inCommandPort
inLeftPort .interrupt();
inRightPort .interrupt();
statusPort .interrupt();
templatePort .interrupt();
inhibitionPort .interrupt();
blobDatabasePort.interrupt();
templatePort .interrupt();
timingPort .interrupt();
errorPort .interrupt();
}
void gazeArbiterThread::setDimension(int w, int h) {
width = w;
height = h;
}
void gazeArbiterThread::setBlockPitch(double value) {
blockNeckPitchValue = value;
}
void gazeArbiterThread::setName(string str) {
this->name=str;
printf("name: %s \n", name.c_str());
}
std::string gazeArbiterThread::getName(const char* p) {
string str(name);
str.append(p);
return str;
}
void gazeArbiterThread::setRobotName(string str) {
this->robot = str;
printf("name: %s \n", name.c_str());
}
void gazeArbiterThread::init(const int x, const int y) {
point.x = x;
point.y = y;
template_roi.width = template_roi.height = template_size;
search_roi.width = search_roi.height = search_size;
}
void gazeArbiterThread::getPoint(CvPoint& p) {
//tracker->getPoint(p);
}
void gazeArbiterThread::interfaceIOR(Bottle& timing) {
//Time::delay(3.0);
//code for accomplished vergence
timetotStop = Time::now();
timetot = timetotStop - timetotStart;
timing = timingPort.prepare();
timing.clear();
timing.addDouble(timetot);
timingPort.write();
accomplished_flag = true;
countVerNull = 0;
//sending an image for inhibition of return
if(imgLeftIn!=NULL){
unsigned char* pinhi = inhibitionImage->getRawImage();
inhibitionImage->resize(320,240);
//inhibitionImage->zero();
/*
int padding = inhibitionImage->getPadding();
int rowsizeInhi = inhibitionImage->getRowSize();
int ym = 240>>1;
int xm = 320>>1;
//calculating the peek value
int dx = 50.0;
int dy = 50.0;
double sx = (dx / 2) / 3 ; //0.99 percentile
double sy = (dy / 2) / 3 ;
double vx = 10; //sx * sx; // variance
double vy = 10; //sy * sy;
double rho = 0;
double a = 0.5 / (3.14159 * vx * vy * sqrt(1-rho * rho));
double b = -0.5 /(1 - rho * rho);
double k = 1 / (a * exp (b));
double f, e, d, z = 1;
double zmax = 0;
pinhi += ((int)(ym-(dy>>1))) * rowsizeInhi + ((int)(xm-(dx>>1)));
//for the whole blob in this loop
for (int r = ym - (dy>>1); r <= ym + (dy>>1); r++) {
for (int c = xm - (dx>>1); c <= xm + (dx>>1); c++){
if((c == xm)&&(r == ym)) {
//z = a * exp (b);
//z = z * k;
z = 1;
}
else {
f = ((c - xm) * (c - xm)) /(vx * vx);
d = ((r - ym) * (r - ym)) /(vy * vy);
//e = (2 * rho* (c - ux) * (r - uy)) / (vx * vy);
e = 0;
z = a * exp ( b * (f + d - e) );
z = z * k;
z = (1 / 1.62) * z;
//z = 0.5;
}
// restrincting the z gain between two thresholds
if (z > 1) {
z = 1;
}
//if (z < 0.3) {
// z = 0.3;
//}
//set the image
*pinhi++ = 255 * z;
}
pinhi += rowsizeInhi - (dx + 1) ;
}
*/
pinhi = inhibitionImage->getRawImage();
//printf("copying the image \n");
//unsigned char* pinLeft = imgLeftIn->getRawImage();
//int padding = inhibitionImage->getPadding();
//int padding3 = imgLeftIn->getPadding();
//for ( int row = 0 ; row < 240; row++) {
// for (int cols = 0; cols< 320; cols++) {
// *pinhi = (unsigned char) floor(0.85 * *pinLeft + 0.15 * *pinhi); //red
// //*portion++ = *mosaic++; //green
//*portion++ = *mosaic++; //blue
// pinhi++; pinLeft+=3;
// }
// pinhi += padding;
// pinLeft += padding3;
//}
}
inhibitionPort.prepare() = *inhibitionImage;
inhibitionPort.write();
//calculating the 3d position and sending it to database
u = 160;
v = 120;
Vector fp(3);
Vector torso(3);
encTorso->getEncoder(0,&torso[0]);
encTorso->getEncoder(1,&torso[1]);
encTorso->getEncoder(2,&torso[2]);
Vector head(5);
encHead->getEncoder(0,&head[0]);
encHead->getEncoder(1,&head[1]);
encHead->getEncoder(2,&head[2]);
encHead->getEncoder(3,&head[3]);
encHead->getEncoder(4,&head[4]);
Vector q(8);
double ratio = M_PI /180;
q[0]=torso[0] * ratio;
q[1]=torso[1]* ratio;
q[2]=torso[2]* ratio;
q[3]=head[0]* ratio;
q[4]=head[1]* ratio;
q[5]=head[2]* ratio;
q[6]=head[3]* ratio;
q[7]=head[4]* ratio;
double ver = head[5];
Vector x(3);
printf("varDistance %f \n", varDistance);
x[0]=varDistance * u; //epipolar correction excluded the focal lenght
x[1]=varDistance * v;
x[2]=varDistance;
// find the 3D position from the 2D projection,
// knowing the distance z from the camera
Vector xe = yarp::math::operator *(*invPrjL, x);
xe[3]=1.0; // impose homogeneous coordinates
// update position wrt the root frame
Matrix eyeH = eyeL->getH(q);
//printf(" %f %f %f ", eyeH(0,0), eyeH(0,1), eyeH(0,2));
Vector xo = yarp::math::operator *(eyeH,xe);
printf("object %f,%f,%f \n",xo[0],xo[1],xo[2]);
//adding novel position to the
Bottle request, reply;
request.clear(); reply.clear();
request.addVocab(VOCAB3('a','d','d'));
Bottle& listAttr=request.addList();
Bottle& sublistX = listAttr.addList();
sublistX.addString("x");
sublistX.addDouble(xo[0] * 1000);
listAttr.append(sublistX);
Bottle& sublistY = listAttr.addList();
sublistY.addString("y");
sublistY.addDouble(xo[1] * 1000);
listAttr.append(sublistY);
Bottle& sublistZ = listAttr.addList();
sublistZ.addString("z");
sublistZ.addDouble(xo[2] * 1000);
listAttr.append(sublistZ);
Bottle& sublistR = listAttr.addList();
sublistR.addString("r");
sublistR.addDouble(255.0);
listAttr.append(sublistR);
Bottle& sublistG = listAttr.addList();
sublistG.addString("g");
sublistG.addDouble(255.0);
listAttr.append(sublistG);
Bottle& sublistB = listAttr.addList();
sublistB.addString("b");
sublistB.addDouble(255.0);
listAttr.append(sublistB);
Bottle& sublistLife = listAttr.addList();
sublistLife.addString("lifeTimer");
sublistLife.addDouble(1.0);
listAttr.append(sublistLife);
if (templatePort.getInputCount()) {
Bottle& templateList = listAttr.addList();
printf("attaching the blob to the item in the list");
templateImage = templatePort.read(false);
if(templateImage!=0) {
int width = templateImage->width();
int height = templateImage->height();
printf("template dim %d %d \n", width, height);
unsigned char* pointerTemplate = templateImage->getRawImage();
int padding = templateImage->getPadding();
templateList.addString("texture");
Bottle& pixelList = templateList.addList();
pixelList.addInt(width);
pixelList.addInt(height);
for (int r = 0; r < height ; r++) {
for (int c = 0; c < width; c++) {
pixelList.addInt((unsigned char)*pointerTemplate++);
//pixelList.addInt(r + c);
}
pointerTemplate += padding;
}
}
}
blobDatabasePort.write(request, reply);
//delay after vergence accomplished ... needed to allow other module to call the control
Time::delay(0.01);
return;
}
void gazeArbiterThread::run() {
//visualCorrection =false; // TODO : check why this should be forced in leaning algorithm
Bottle& status = statusPort.prepare();
Bottle& timing = timingPort.prepare();
//double start = Time::now();
//mutex.wait();
//Vector-vector element-wise product operator between stateRequest possible transitions
if((stateRequest(0) != 0)||(stateRequest(1)!= 0)||(stateRequest(2) != 0)||(stateRequest(3) != 0)||(stateRequest(4) != 0)) {
//printf("stateRequest: %s \n", stateRequest.toString().c_str());
Vector c(5);
c = stateRequest * (state * stateTransition);
allowedTransitions = orVector(allowedTransitions ,c );
stateRequest(0) = 0; stateRequest(1) = 0; stateRequest(2) = 0; stateRequest(3) = 0; stateRequest(4) = 0;
//printf("state: %s \n", state.toString().c_str());
//printf("allowedTransitions: %s \n", allowedTransitions.toString().c_str());
}
if(inLeftPort.getInputCount()){
imgLeftIn = inLeftPort.read(false);
}
//mutex.post();
//double end = Time::now();
//double interval = end - start;
//printf("interval: %f", interval);
//printf("state: %s \n", state.toString().c_str());
//printf("allowedTransitions: %s \n", allowedTransitions.toString().c_str());
if(allowedTransitions(4)>0) {
state(4) = 1; state(3) = 0 ; state(2) = 0 ; state(1) = 0 ; state(0) = 0;
// ---------------- SACCADE -----------------------
if(!executing) {
// starting saccade toward the direction of the required position
// needed timeout because controller kept stucking whenever a difficult position could not be reached
timeoutStart = Time::now();
if(mono){
printf("mono saccade activated \n");
//Time::delay(5.0);
//calculating where the fixation point would end up
executing = true;
bool isLeft = true; // TODO : the left drive is hardcoded but in the future might be either left or right
Matrix *invPrj = (isLeft?invPrjL:invPrjR);
iCubEye *eye = (isLeft?eyeL:eyeR);
//function that calculates the 3DPoint where to redirect saccade and add the offset
Vector torso(3);
encTorso->getEncoder(0,&torso[0]);
encTorso->getEncoder(1,&torso[1]);
encTorso->getEncoder(2,&torso[2]);
Vector head(5);
encHead->getEncoder(0,&head[0]);
encHead->getEncoder(1,&head[1]);
encHead->getEncoder(2,&head[2]);
encHead->getEncoder(3,&head[3]);
encHead->getEncoder(4,&head[4]);
Vector x(3);
x[0] = zDistance * u;
x[1] = zDistance * v;
x[2] = zDistance;
//printf("got the vector x %d %d %d \n",x(0), x(1), x(2));
// find the 3D position from the 2D projection,
// knowing the distance z from the camera
//printf( "%s \n", invPrj->toString().c_str());
Vector xe = yarp::math::operator *(*invPrj, x);
xe[3] = 1.0; // impose homogeneous coordinates
//printf("imposing homogeneous coordinates \n");
Vector xo;
if(isOnWings) {
Vector qw(8);
double ratio = M_PI /180;
qw[0]=torso[0] * ratio;
qw[1]=torso[1] * ratio;
qw[2]=torso[2] * ratio;
qw[3]=head[0] * ratio;
qw[4]=head[1] * ratio;
qw[5]=head[2] * ratio;
qw[6]=0.0 * CTRL_DEG2RAD;
qw[7]=0.0 * CTRL_DEG2RAD;
double ver = head[5];
xo = yarp::math::operator *(eye->getH(qw),xe);
//printf("0:%f 1:%f 2:%f 3:%f 4:%f 5:%f 6:%f 7:%f \n", q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7]);
}
else {
Vector q(8);
double ratio = M_PI /180;
q[0]=torso[0] * ratio;
q[1]=torso[1] * ratio;
q[2]=torso[2] * ratio;
q[3]=head[0] * ratio;
q[4]=head[1] * ratio;
q[5]=head[2] * ratio;
q[6]=head[3] * ratio;
q[7]=head[4] * ratio;
double ver = head[5];
xo = yarp::math::operator *(eye->getH(q),xe);
//printf("0:%f 1:%f 2:%f 3:%f 4:%f 5:%f 6:%f 7:%f \n", q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7]);
}
// update position wrt the root frame
//Vector xo = yarp::math::operator *(eye->getH(q),xe);
printf("fixation point estimated %f %f %f \n",xo[0], xo[1], xo[2]);
if(onDvs){
accomplished_flag = false;
}
else if ( (xo[1] > ymax) || (xo[1] < ymin) || (xo[0] < xmin) || (xo[2] < zmin) || (xo[2] > zmax)) {
printf(" OutOfRange ._._._._._.[%f,%f,%f] [%f,%f,%f] [%f,%f,%f] \n",xmin, xo[0], xmax, ymin, xo[1],ymax, zmin, xo[2], zmax);
accomplished_flag = true; //mono = false; // setting the mono false to inhibith the control of the visual feedback
Vector px(3);
px[0] = -0.5 + xOffset;
px[1] = 0.0 + yOffset;
px[2] = 0.3 + zOffset;
//igaze->lookAtFixationPoint(px);
px[0] = 0;
px[1] = (blockNeckPitchValue == -1)?0:blockNeckPitchValue;
px[2] = 0;
igaze->lookAtAbsAngles(px);
Time::delay(0.05);
printf("waiting for motion done \n");
u = width / 2; //TO DO: check the division! it would be rather better to use shift
v = height / 2; //TO DO: check the division! it would be rather better to use shift
//waitMotionDone();
printf("resetting the position: success! \n");
// sending error message for saccade SAC_FAIL
Bottle& status = statusPort.prepare();
status.clear();
status.addString("SAC_FAIL");
statusPort.write();
return;
}
else {
//sending the timing value -1 when new saccade comes and
//vergence action not fineshed
if(!accomplished_flag){
timing = timingPort.prepare();
timing.clear();
timing.addDouble(-1);
timingPort.write();
}
else {
accomplished_flag = false;
}
}
//printf("offset: %f, %f,%f \n", xOffset, yOffset, zOffset );
//printf("visualCorrection %d \n", visualCorrection);
if (!isOnWings) {
//printf("starting mono saccade with NO offset \n");
//if((tracker->getInputCount()) || (!visualCorrection)) {
if((ptracker->getInputCount()) || (!visualCorrection)) {
//printf("tracker input image ready \n");
double dx = 100.0 , dy = 100;
double dist = sqrt(dx * dx + dy * dy);
if (onDvs) {
u = (((((u - 64)/ 128.0) / 7.4) * 4) * 320) + 160;
v = (((((v - 64)/ 128.0) / 7.4) * 4) * 240) + 120;
printf("onDvs active %d %d \n", u,v);
}
timeout = 0;
timeoutStart = Time::now();
while ((dist > 8) && (timeout < TIMEOUT_CONST)) {
//printf("inside the while \n");
timeoutStop = Time::now();
timeout = timeoutStop - timeoutStart;
// initialisation of the visual correction
if(visualCorrection){
printf("starting visual correction %d %d \n", u, v);
//tracker->init(u,v);
//tracker->waitInitTracker();
ptracker->setUpdate(true);
//Time::delay(0.5);
//ptracker->setUpdate(false);
ptracker->init(u,v);
//printf("just run into the init \n");
ptracker->waitInitTracker();
//Time::delay(0.1); // TODO : check this delay interval trying to make it shorter
}
//printf("visual correction mechanism correctly initialised \n");
Vector px(2);
px(0) = u;
px(1) = v;
//int camSel = 0; //Rea: removed the hardcoded eye drive @ 28/1/13
igaze->lookAtMonoPixel(camSel,px,zDistance);
igaze->checkMotionDone(&done);
//printf("first check motion done %d \n", done);
dist = 10;
Time::delay(0.05);
/**** tracking reinforcement only needed for fast saccades ***
if(visualCorrection){
printf("starting visual correction with tracker refresh\n");
// second init of the tracker to remove postsaccadic error
tracker->init(160,120);
tracker->waitInitTracker();
// sending refinement message to the attPrioritiser TRACK
Bottle& status = statusPort.prepare();
status.clear();
status.addString("TRACK_REF");
statusPort.write();
Time::delay(0.5);
}
*/
//igaze->getFixationPoint(xo);
//printf("looking at %f %f %f \n", xo[0], xo[1], xo[2]);
// check for offlimits reached
if ( (xo[1] > ymax) || (xo[1] < ymin) || (xo[0] < xmin) || (xo[2] < zmin) || (xo[2] > zmax)) {
printf(" OutOfRange ._._._._._.[%f,%f,%f] [%f,%f,%f] [%f,%f,%f] \n",xmin, xo[0], xmax, ymin, xo[1],ymax, zmin, xo[2], zmax);
accomplished_flag = true; //mono = false; // setting the mono false to inhibith the control of the visual feedback
Vector px(3);
px[0] = -0.5 + xOffset;
px[1] = 0.0 + yOffset;
px[2] = 0.3 + zOffset;
//igaze->lookAtFixationPoint(px);
px[0] = 0;
px[1] = (blockNeckPitchValue == -1)?0:blockNeckPitchValue;
px[2] = 0;
igaze->lookAtAbsAngles(px);
Time::delay(0.1);
waitMotionDone();
//printf("waiting for motion done \n");
u = width / 2;
v = height / 2;
//printf("resetting the position: success! \n");
return;
}
/*if(visualCorrection){
tracker->getPoint(point);
dx = (double) (point.x - px(0));
dy = (double) (point.y - px(1));
dist = sqrt(dx * dx + dy * dy);
u = width / 2;
v = height / 2;
}
*/
dist = 0;
//printf("correcting distance %f \n", dist);
} //end while
//printf("saccadic event : started %d %d %f \n",u,v,zDistance);
}//end if
}
else {
// monocular with stereo offsets
Vector fp;
//printf("monocular with stereo offsets \n");
fp.resize(3,0.0);
fp[0] = xo[0];
fp[1] = xo[1];
fp[2] = xo[2];
igaze->lookAtFixationPoint(fp);
visualCorrection = false;
}
}
else { // for non-mono saccades
Vector px(3);
//printf("saccadic event to the absolute 3d point with offset %f, %f, %f \n",xOffset, yOffset, zOffset );
px[0] = xObject;
px[1] = yObject;
px[2] = zObject;
igaze->lookAtFixationPoint(px);
//igaze->waitMotionDone();
Time::delay(0.1);
if(visualCorrection){
//printf("starting visual correction within the stereo saccade\n");
tracker->init(160,120);
tracker->waitInitTracker();
const char BeepChar = '\a'; /* the "alarm" special char */
cout << "Maybe you can hear a beep here---" << BeepChar << endl;
}
else{
goto exiting;
}
printf("saccadic event : started %f %f %f \n",xObject,yObject,zObject);
}
//Time::delay(0.05);
//Vector px(2);
//px(0) = 160; px(1) = 120;
//igaze->lookAtMonoPixel(1,px,0.5);
//igaze->waitMotionDone();
timeout = timeoutStop - timeoutStart;
//printf ("checkMotionDone %d \n", done);
//***********************************************************************************
// constant time in sec after which the action is considered not performed
timeoutStart = Time::now();
while ((!done)&&(timeout < TIMEOUT_CONST)) {
// waiting for completion of the gaze action
while((!done)&&(timeout < TIMEOUT_CONST)) {
timeoutStop = Time::now();
timeout = timeoutStop - timeoutStart;
//printf("saccade timeout %f %d \n", timeout, done);
Time::delay(0.005);
igaze->checkMotionDone(&done);
}
if(timeout >= TIMEOUT_CONST) {
// if the gaze controller runs out of time (timeout)
Vector v(3);
timetotStop = Time::now();
timetot = timetotStop - timetotStart;
//printf("TIMEOUT in reaching with a saccade %f <---- \n", timetot);
timing = timingPort.prepare();
timing.clear();
timing.addDouble(-1);
timingPort.write();
// sending error message for saccade SAC_FAIL
Bottle& status = statusPort.prepare();
status.clear();
status.addString("SAC_FAIL");
statusPort.write();
v(0)= -0.5; v(1) = 0; v(2) = 0.5;
//igaze->stopControl();
igaze->lookAtFixationPoint(v);
timeoutStart = Time::now();
timeout = TIMEOUT_CONST;
}
else {
printf("checkMotionDone %d \n", done);
}
}
//printf("preparing visual correction \n");
Time::delay(0.5); // allowing time for preparation
// *********************************************************************************************
// sending the command to the episodic tracker
ptracker->setCheck(true);
// the actual visiting of the whole portion of the image is time-demanding
// the bigger the area controlled the longer the time interval
// ALLOW necessary time or waitComputation
//printf("waiting for completion in the periodicTracking.... \n");
ptracker->waitCorrComputation();
//printf("computation completed \n");
// *********************************************************************************************
// correcting the macrosaccade using the visual feedback (only if required)
// saccade correction based of visual feedback (tracker implementation)
timeoutStart = Time::now();
timeout = 0;
if (visualCorrection) {
printf("Using visual correction for saccade \n");
double errorVC = 100.0;
double errorVC_pre = 100.0;
int countReach = 0; // counter of the success in reaching
int countDecrement = 0;
double travelDistance = 0.0; // distance travel by the tracked point
float minCumul = 0;
double errorx; // = (width >> 1) - point.x;
double errory; // = (height >> 1) - point.y;
Vector px(2);
timeout = 0;
point_prev = point;
// introducing the fast tracker in the system, initialising the fast with the output of slow
ptracker->getPoint(point);
CvPoint testPoint; testPoint.x = -1; testPoint.y = -1;
while ((testPoint.x != point.x) && (testPoint.y != point.y)) {
tracker->init(point.x, point.y);
tracker->waitInitTracker();
tracker->getPoint(testPoint);
//printf("tracking %d %d \n",testPoint.x, testPoint.y );
}
//printf("-1.just initilisated with the point %d %d \n", point.x , point.y);
Time::delay(0.1); //extra time necessary for the system to reach steady state
//igaze->lookAtMonoPixel(camSel,px,0.5);
//initialisation of the loop
double error_control;
//Rea : 28/1/13 removed while cycle because it converges in one loop
// if the first loop does not suffice increment the number of loops
//while((countDecrement < 1000) && (countReach < 3) && (timeout < 1.0) && (ptracker->getInputCount()) )
for(int i = 0 ; i< 4; i++)
{
timeoutStop = Time::now();
timeout = timeoutStop - timeoutStart;
if(i == 0) {
#ifndef CONFIGFOVEA
errorx = (width >> 1) - point.x;
errory = (height >> 1) - point.y;
px(0) = (width >> 1) - 1 - errorx; // subtracting 1 for the center of image
px(1) = (height >> 1) - 1 - errory; // subtracting 1 for the center of image
#else
errorx = 160.0 - point.x;
errory = 120.0 - point.y;
px(0) = cxl - errorx ;
px(1) = cyl - errory ;
//printf("c = (%d,%d) point = (%f,%f) error= (%f, %f) px = (%f,%f) \n",cxl,cyl,point.x, point.y,errorx, errory, px(0), px(1));
#endif
errorVC_pre = errorVC;
errorVC = sqrt((double) (errorx * errorx + errory * errory));
//printf("time passed in correcting center =[%f, %f] %f (%f, %f : %3f) \n",cxl,cyl, timeout, px(0), px(1), errorVC);
if(errorVC <= 2) {
countReach++;
}
if ((errorVC > 4 ) ) {
//countDecrement++;
if(countReach > 0)
countReach--;
}
//else {
// countDecrement = 0;
//}
printf("norm error %f \n", errorVC);
}
//int camSel = 0;
//if(camSel == 0) {
// px(0) = cxl;
// px(1) = cyl;
//}
igaze->lookAtMonoPixel(camSel,px,0.5);
//Vector xo;
//igaze->getFixationPoint(xo);
//printf("looking at %f %f %f \n", xo[0], xo[1], xo[2]);
// check for offlimits by tracking out the stimulus
//if ( (xo[1] > ymax) || (xo[1] < ymin) || (xo[0] < xmin) || (xo[2] < zmin) || (xo[2] > zmax)) {
// printf(" OutOfRange ._._._._._.[%f,%f,%f] [%f,%f,%f] [%f,%f,%f] \n",xmin, xo[0], xmax, ymin, xo[1],ymax, zmin, xo[2], zmax);
// accomplished_flag = true; //mono = false; // setting the mono false to inhibith the control of the visual feedback
// Vector px(3);
// px[0] = -0.5 + xOffset;
// px[1] = 0.0 + yOffset;
// px[2] = 0.3 + zOffset;
//igaze->lookAtFixationPoint(px);
// px[0] = 0;
// px[1] = (blockNeckPitchValue == -1)?0:blockNeckPitchValue;
// px[2] = 0;
// igaze->lookAtAbsAngles(px);
// Time::delay(0.5);
// printf("waiting for motion done \n");
// u = width / 2;
// v = height / 2;
//waitMotionDone();
// printf("resetting the position: success! \n");
// return;
//}
Time::delay(0.1); //allow time to reach steady state
//igaze->waitMotionDone();
point_prev = point; // changing the position of the tracked point in the previous step
tracker->getPoint(point); // have the get point as far as possible from look@mono
//ptracker->getPoint(point);
travelDistance = sqrt( (double)
(point.x - point_prev.x) * (point.x - point_prev.x) +
(point.y - point_prev.y) * (point.y - point_prev.y)
);
//minCumul = tracker->getLastMinCumul();
minCumul = ptracker->getLastMinCumul();
//printf("countReach:%d> the point ended up in (%d,%d) with minCumul %f travelDistance %f \n",countReach,point.x, point.y, minCumul, travelDistance);
// *********************************************************************************************
// sending the command to the episodic tracker
ptracker->setCheck(true);
// the actual visiting of the whole portion of the image is time-demanding
// the bigger the area controlled the longer the time interval
// ALLOW necessary time or waitComputation
printf("waiting for completion in the periodicTracking.... \n");
ptracker->waitCorrComputation();
printf("computation completed for episodic tracker of SAC \n");
// ******************************************************************************
ptracker->getPoint(point);
//printf("%d.just waiting for initialisation point %d %d... \n",i, point.x , point.y);
double errorx_control = 160 - point.x;
double errory_control = 120 - point.y;
error_control = sqrt( (double)
errorx_control * errorx_control +
errory_control * errory_control
);
if( errorPort.getOutputCount()) {
Bottle& b = errorPort.prepare();
b.clear();
b.addDouble(error_control);
errorPort.write();
}
px(0) = cxl - (errorx_control / 10.0) ;
px(1) = cyl - (errory_control / 10.0) ;
//if(errorx_control > 0)
// px(0) = cxl - 1;
//else
// px(0) = cxl + 1;
//if (errorx_control > 0)
// px(1) = cyl - 1;
//else
// px(1) = cyl + 1;
//px(0) = cxl;
//px(1) = cyl;
printf("error = %f preparing saccade:%f %f \n", error_control,px(0),px(1));
// ending the cycle
// Time::delay(2);
igaze->lookAtMonoPixel(camSel,px,0.5);
}
//error_control = 0; // reseting control error to remove component of the insuccess
timeoutStop = Time::now();
timeout = timeoutStop - timeoutStart;
//printf("Timeout in saccade execution %f \n", timeout);
Time::delay(0.01);
if (minCumul > 5000000) {
printf("Error: out of correlation limits \n");
// sending error message for saccade SAC_FAIL
Bottle& status = statusPort.prepare();
status.clear();
status.addString("SAC_FAIL");
statusPort.write();
px[0] = 0;
px[1] = (blockNeckPitchValue == -1)?0:blockNeckPitchValue;
px[2] = 0;
igaze->lookAtAbsAngles(px);
}
else if((timeout >= 8.0) || (countDecrement >= TIMEOUT_CONST) || error_control >= ERROR_THRESH ) {
Vector px(3);
printf("Error in reaching with visualFeedback timeout %f error_control %f \n",timeout,error_control);
printf("Error in reaching with visualFeedback timeout %f error_control %f \n",timeout,error_control);
printf("Error in reaching with visualFeedback timeout %f error_control %f \n",timeout,error_control);
// sending error message for saccade SAC_FAIL
Bottle& status = statusPort.prepare();
status.clear();
status.addString("SAC_FAIL");
statusPort.write();
timetotStop = Time::now();
timetot = timetotStop - timetotStart;
timing = timingPort.prepare();
timing.clear();
timing.addDouble(-1);
timingPort.write();
//px[0] = -0.5 + xOffset;
//px[1] = 0.0 + yOffset;
//px[2] = 0.0 + zOffset;
//igaze->lookAtFixationPoint(px);
px[0] = 0;
px[1] = (blockNeckPitchValue == -1)?0:blockNeckPitchValue;
px[2] = 0;
igaze->lookAtAbsAngles(px);
/*igaze->checkMotionDone(&done);
while((!done)&&(timeout < TIMEOUT_CONST)) {
timeoutStop = Time::now();
timeout =timeoutStop - timeoutStart;
Time::delay(0.001);
igaze->checkMotionDone(&done);
}*/
}
else {
printf("saccade accomplished. sending command \n");
//printf("\n \n ");
// saccade accomplished
//----------------------------------
//sending the acknowledgement vergence_accomplished
status = statusPort.prepare();
status.clear();
status.addString("SAC_ACC");
statusPort.write();
}
}
//-----------------
//accomplished_flag = true;
Time::delay(0.05);
}
}
else if(allowedTransitions(3)>0) {
// ---------------- SMOOTH PURSUIT -----------------------
state(4) = 0; state(3) = 1 ; state(2) = 0 ; state(1) = 0 ; state(0) = 0;
//printf(" in RUN of gazeArbiter threadSmooth Pursuit %f %f \n", uVel, vVel);
//printf("velocity profile %f %f \n", uVel, vVel);
// sending the egoMotion velocity as Feedback
if(egoMotionFeedback.getOutputCount()) {
Bottle query;
query.addVocab(VOCAB3('E','G','O'));
query.addDouble(uVel);
query.addDouble(vVel);
Bottle response;
egoMotionFeedback.write(query,response);
}
//initilisation
int c = 0;
int u = 64, v = 64;
Vector target(2);
int camSel=0; // select the image plane: 0 (left), 1 (right)
Vector px(2); // specify the pixel where to look
px[0] = (double) cxl + uVel;
px[1] = (double) cyl + vVel;
double z=1.0; // distance [m] of the object from the image plane (extended to infinity): yes, you probably need to guess, but it works pretty robustly
//printf("velocity on the retina (%d %d)->(%f %f) \n",cxl,cyl,px[0], px[1]);
//cycle
double timeend, timeout = 0;
double timestart = Time::now();
bool exitloop = false;
while ((!exitloop)&&(timeout < time)) {
//px[0] = 1.0;
//px[1] = 1.0;
igaze->lookAtMonoPixelWithVergence(camSel,px,4); // look!
Time::delay(0.01);
timeend = Time::now();
timeout = timeend - timestart;
c++;
/*
Vector x(3);
igaze->getFixationPoint(x);
if(x[0] < xmin) {
exitloop = true;
printf("exiting because x< xmin \n");
}
else if(x[0] > xmax) {
exitloop = true;
printf("exiting because x> xmax \n");
}
else if(x[1] < ymin) {
exitloop = true;
printf("exiting because y< ymin \n");
}
else if(x[1] > ymax) {
exitloop = true;
printf("exiting because y> ymax \n");
}
else if(x[2] < zmin) {
exitloop = true;
printf("exiting because z< zmin \n");
}
else if(x[2] > zmax) {
exitloop = true;
printf("exiting because z< zmax \n");
}
*/
}
if(timeout >= time) {
printf("timeout occurred, ");
}
//printf("position reached in %f \n \n \n", timeout);
printf("SM_PUR ACCOMPLISHED \n");
printf("SM_PUR ACCOMPLISHED \n");
printf("SM_PUR ACCOMPLISHED \n");
printf("\n");
//sending the acknowledgement vergence_accomplished
Bottle& status2 = statusPort.prepare();
status2.clear();
status2.addString("SM_ACC");
statusPort.write();
//delete &status2;
// sending the egoMotion velocity null as feedback of SM_ACC
if(egoMotionFeedback.getOutputCount()) {
Bottle query;
query.addVocab(VOCAB3('E','G','O'));
query.addDouble(0);
query.addDouble(0);
Bottle response;
egoMotionFeedback.write(query,response);
}
}
else if(allowedTransitions(2)>0) {
state(4) = 0; state(3) = 0 ; state(2) = 1 ; state(1) = 0 ; state(0) = 0;
// ---------------- VERGENCE -----------------------
//printf("vergence_accomplished : %d \n",accomplished_flag);
printf("---------- VERGENCE ----------------------- \n");
if(!executing) {
Vector gazeVect(3);
Vector objectVect(3);
Vector o(4);
Vector x(3);
Vector l(3);
double theta = 0;
if((mono)) {
printf("phi: %f phi2: %f phi3 : %f abs(phi) %f \n", phi, phi2, phi3, abs(phi));
if((abs(phi) < 0.15) &&(!accomplished_flag) && (!firstVergence)) {
//if(abs(phi2) < 0.15) {
countVerNull += 1; //countVerNull += 3
//printf("CountVerNull %d \n", countVerNull);
//}
//else {
phi = phi2;
//}
}
if((countVerNull >= 3) && (!accomplished_flag)) {
printf("\n");
printf("VERGENCE ACCOMPLISHED \n");
printf("VERGENCE ACCOMPLISHED \n");
printf("VERGENCE ACCOMPLISHED \n");
printf("\n");
//sending the acknowledgement vergence_accomplished
Bottle& status2 = statusPort.prepare();
status2.clear();
status2.addString("VER_ACC");
statusPort.write();
//delete &status2;
interfaceIOR(timing);
firstVergence = true;
//Time::delay(1.0);
goto exiting;
}
/*
*section for revising the vergence
*/
/*
if(accomplished_flag){
if((phi > 0.2) || (phi < -0.2)) {
printf("the vergence is asking to revise its previouos measure ........ \n");
//accomplished_flag = false;
}
else {
return;
}
}
*/
//vergenceInDepth();
vergenceInAngle();
/*
printf("x1 %f y1 %f z1 %f", x1, y1, z1);
double s = sin(theta);
double c = cos(theta);
double t = 1 - c;
// if axis is not already normalised then uncomment this
double magnitude = Math.sqrt(x*x + y*y + z*z);
// if (magnitude==0) throw error;
// x /= magnitude;
// y /= magnitude;
// z /= magnitude;
double heading; //Roll - φ: rotation about the X-axis
double attitude; // Pitch - θ: rotation about the Y-axis
double bank; // Yaw - ψ: rotation about the Z-axis
if ((x1 * y1 * t + z1 * s) > 0.998) { // north pole singularity detected
heading = 2 * atan2(x1 * sin(theta / 2), cos(theta / 2));
attitude = PI / 2;
bank = 0;
printf("north pole singularity detected \n");
return;
}
if ((x1*y1*t + z1*s) < -0.998) { // south pole singularity detected
heading = -2*atan2(x1*sin(theta/2),cos(theta/2));
attitude = -PI/2;
bank = 0;
printf("south pole singularity detected \n");
return;
}
heading = atan2(y1 * s- x1 * z1 * t , 1 - (y1*y1+ z1*z1 ) * t);
attitude = asin(x1 * y1 * t + z1 * s) ;
bank = atan2(x1 * s - y1 * z1 * t , 1 - (x1*x1 + z1*z1) * t);
printf("headPose heading %f attitude %f bank %f \n",heading,attitude,bank);
*/
// in the status port, notification of vergence refinement in action
//printf("Vergence Refinement \n \n");
Bottle& status2 = statusPort.prepare();
status2.clear();
status2.addString("VER_REF");
statusPort.write();
}
else { //else of the MONO branch
//printf("------------- ANGULAR VERGENCE ----------------- \n \n");
// double elev = (anglesVect[1] * PI) / 180;
// (anglesVect[0]-(180 - (anglesVect[2] + phi)/2 - anglesVect[2]/2 - beta))/20
// gazeVect[0] =(- anglesVect[2] / 80) * cos(elev) ; //version (- anglesVect[2] / 80) * cos(elev) * -o[1];
// gazeVect[1] =(anglesVect[2] / 80) * sin(elev) ; //tilt
// gazeVect[2] = phi ; //vergence
// igaze->lookAtRelAngles(gazeVect);
gazeVect[0] = 0 ; //version (- anglesVect[2] / 80) * cos(elev) * -o[1];
gazeVect[1] = 0 ; //tilt
gazeVect[2] = phi; //vergence
//igaze->lookAtRelAngles(gazeVect);
executing = true;
//status = statusPort.prepare();
//status.clear();
//status.addString("vergence_accomplished");
//statusPort.write();
}
}
}
else if(allowedTransitions(1)>0) {
// ---------------- WAIT -----------------------
state(4) = 0; state(3) = 0 ; state(2) = 0 ; state(1) = 1 ; state(0) = 0;
if((160 != u) && (120 != v)) {
// performing saccade
Vector px(2);
//printf("saccadic event before the waiting %d %d \n", u,v );
px[0] = u;
px[1] = v;
igaze->lookAtMonoPixel(camSel,px,0.5);
igaze->waitMotionDone();
}
//cycle for the wait of the action
double timeend, timeout = 0;
double timestart = Time::now();
bool exitloop = false;
while (timeout < time) {
timeout = Time::now() - timestart;
Time::delay(0.05);
}
if(timeout >= time) {
printf("timeout occurred in WAIT \n");
}
//printf("position reached in %f \n \n \n", timeout);
printf("WAIT ACCOMPLISHED \n");
printf("\n");
//sending the acknowledgement vergence_accomplished
Bottle& status2 = statusPort.prepare();
status2.clear();
status2.addString("WAIT_ACC");
statusPort.write();
//delete &status2;
}
else if(allowedTransitions(0)>0) {
//-------------------- NULL -------------------------------------------
state(4) = 0; state(3) = 0 ; state(2) = 0 ; state(1) = 0 ; state(0) = 1;
}
else {
//printf("No transition \n");
}
//printf("--------------------------------------------------------->%d \n",done);
exiting:
if(allowedTransitions(4)>0) { //SACCADE
mutex.wait();
allowedTransitions(4) = 0;
executing = false;
mutex.post();
}
if(allowedTransitions(3)>0) { //SMP
mutex.wait();
allowedTransitions(3) = 0;
executing = false; //executing=false allows new action commands
mutex.post();
}
if(allowedTransitions(2)>0) { //vergence
mutex.wait();
allowedTransitions(2) = 0;
executing = false;
mutex.post();
}
if(allowedTransitions(1)>0) { // wait
mutex.wait();
allowedTransitions(1) = 0;
executing = false;
mutex.post();
// printf("vergence command : done \n");
}
}
void gazeArbiterThread::vergenceInAngle() {
double phiRel; // vergence relative angle to be commanded to the controller
printf("Vergence in Angle ");
timeoutStart = Time::now();
timeout = 0;
Vector anglesVect(3);
//*********************************************************************************
robotHead->view(encHead);
double vg;
encHead->getEncoder(5,&vg);
//printf("%f %f %f %f %f %f \n", head[0],head[1],head[2],head[3],head[4], head[5]);
//*********************************************************************************
//calculating the magnitude of the 3d vector
//igaze->getAngles(anglesVect);
//firstVergence = false;
if (firstVergence) {
printf("firstVergence \n ");
// first vergence command after the vergence accomplished
// the first train of vergence command is critical.
// it has to move the system from an eventual local minima
// the choosen relative angle is derived from the maximum of the collection shifts
//if((abs(phi) > abs(phi2)) && (abs(phi)>abs(phi3)))
// phiRel = phi;
//else if((abs(phi2) > abs(phi)) && (abs(phi2)>abs(phi3)))
// phiRel = phi2;
//else if((abs(phi3) > abs(phi)) && (abs(phi3)>abs(phi2)))
// phiRel = phi3;
phiRel = phi;
//firstVergence = false;
}
else {
// the standard descent the angle is the best choice of vergence model.
// this means that always phi is selected
phiRel = phi;
}
//phiTOT = ((anglesVect[2] + phi) * PI) / 180;
//phiTOT = anglesVect[2] + phiRel ; //phiTOT must be in grads
phiTOT = vg + phiRel;
//printf("phiTOT %f \n", phiTOT);
if (firstVergence) {
// ******************************************************************************
// sending the command to the episodic tracker
ptracker->setCheck(true);
// the actual visiting of the whole portion of the image is time-demanding
// the bigger the area controlled the longer the time interval
// ALLOW necessary time or waitComputation
printf("waiting for completion in the periodicTracking.... \n");
ptracker->waitCorrComputation();
printf("computation completed for episodic tracker of SAC \n");
// ******************************************************************************
ptracker->getPoint(point);
tracker->init(point.x, point.y);
tracker->waitInitTracker();
tracker->getPoint(point);
//********************************************************
double vgrad = phiTOT / 180.0 * 3.1415;
double tg = tan(vgrad/2.0);
double eyesHalfBaseline = BASELINE / 2.0;
z = eyesHalfBaseline * sqrt(1.0+1.0/(tg*tg));
//***********************************************************
firstVergence = false;
}
double errorx; // = (width >> 1) - point.x;
double errory; // = (height >> 1) - point.y;
double error;
Vector px(2);
if (visualCorrection) {
printf("Using visual correction for the vergence \n");
#ifdef MEANVERGENCE
if (countRegVerg == 1){
meanRegVerg = sumRegVerg / 1.0;
errorx = 160 - point.x;
errory = 120 - point.y;
px(0) = cxl;
px(1) = cyl;
printf("norm error in mean %f \n", error);
//int camSel = 0; //Rea: removed the hardcoded eye drive @ 28/1/13
igaze->lookAtMonoPixelWithVergence(camSel,px,meanRegVerg);
//tracker->getPoint(point);
Time::delay(0.5);
countRegVerg = 0;
sumRegVerg = 0;
}
else {
sumRegVerg += phiTOT;
countRegVerg++;
}
#else
printf("else in the define \n");
timeoutStart = Time::now();
error = 2000;
timeout = 0;
// the vergence cannot be initialised if the feedback point hasn`t been defined
// the vergence with visual feedback must be initialized by a saccade command!
if((0 == point.x) && (0 == point.y)) {
timeout = TIMEOUT_CONST;
}
Vector pa(3);
pa[0] = 0; pa[1] = 0; pa[2] = phiRel;
igaze->lookAtRelAngles(pa);
// this is only executed once! To Fix: remove the while
while((error > 5.0)&&(timeout < TIMEOUT_CONST)) {
printf("vergence in the while \n");
printf("computed distance %f from angle %f \n",z, phiTOT);
timeoutStop = Time::now();
timeout = timeoutStop - timeoutStart;
//igaze->getAngles(anglesVect);
//printf(" %f %f %f \n",anglesVect[0],anglesVect[1],anglesVect[2]);
double Ke = 1.0;
printf("got the point %d %d \n", point.x, point.y);
errorx = 160 - point.x;
errory = 120 - point.y;
px(0) = cxl - Ke * errorx;
px(1) = cyl - Ke * errory;
error = sqrt(errorx * errorx + errory * errory);
printf("errox %f errory %f norm error %f from cxl,cyl %f %f vergence %f \n",errorx, errory, error,cxl,cyl, phiRel);
if( errorPort.getOutputCount()) {
printf("errorPort write \n");
Bottle& b = errorPort.prepare();
b.clear();
b.addDouble(error);
errorPort.write();
}
if(error >30.0) {
timeout = TIMEOUT_CONST;
}
//Time::delay(3);
igaze->lookAtMonoPixel(camSel,px,0.5);
//double varDistance = BASELINE / (2 * sin (phiTOT / 2));
//printf("varDistance %f \n", varDistance);
//igaze->getAngles(anglesVect);
//igaze->lookAtMonoPixel(camSel, px);
//igaze->waitMotionDone();
//Time::delay(0.1);
tracker->getPoint(point);
error = 1.0;
} // while
#endif
} // end if (visualCorrection)
else { // else if (visualCorrection)
Vector pa(3);
printf("Vergence : look at relative angle with no feedback; phiRel:%f \n", phiRel);
pa[0] = 0; pa[1] = 0; pa[2] = phiRel;
igaze->lookAtRelAngles(pa);
}
}
void gazeArbiterThread::vergenceInDepth(){
//printf("------------- VERGENCE ----------------- \n");
Vector anglesVect(3);
//calculating the magnitude of the 3d vector
igaze->getAngles(anglesVect);
phiTOT = ((anglesVect[2] + phi) * PI) / 180;
printf("phiTOT %f \n", phiTOT);
//phiTOT = phiTOT + phi;
//double magnitude = sqrt ( x1 * x1 + y1 * y1 + z1 * z1);
varDistance = BASELINE / (2 * sin (phiTOT / 2)); //in m after it is fixation state
//double varDistance = (BASELINE / sin (phiTOT / 2)) * sin (leftHat); //in m after it is fixation state
//double varDistance = h * 1.5 * sqrt(1 + tan(elevation) * tan(elevation)) ;
//double varDistance = sqrt (h * h + (BASELINE + b) * (BASELINE + b)) ;
//double varDistance = ipLeft;
//printf("varDistance %f distance %f of vergence angle tot %f enc %f \n",varDistance,distance, (phiTOT * 180)/PI, _head(5));
//tracker->getPoint(point);
double error = 1000;
timeoutStart=Time::now();
//while ((error > 2.0)&&(timeout < 10)) {
timeoutStop = Time::now();
timeout =timeoutStop - timeoutStart;
//corrected the error
tracker->getPoint(point);
Vector px(2);
//int camSel = 0; //Rea: removed the hardcoded eye drive @ 28/1/13
if(!visualCorrection){
px(0) = cxl;
px(1) = cyl;
printf("no visual correction initialised %f %f \n", px(0), px(1));
igaze->lookAtMonoPixel(camSel,px,varDistance);
}
else {
double errorx = 160 - point.x;
double errory = 120 - point.y;
//tracker->init(u,v);
//tracker->waitInitTracker();
//printf ("error %f,%f \n",errorx, errory);
error = sqrt(errorx * errorx + errory * errory);
//printf("norm error %f \n", error);
//px(0) = (width>>1) - 1 - errorx; //159 - errorx
//px(1) = (height>>1) - 1 - errory; //119 - errory
px(0) = cxl - errorx; //159 - errorx
px(1) = cyl - errory; //119 - errory
igaze->lookAtMonoPixel(camSel,px,varDistance);
}
printf("-------------- %d ------------------varDistance %f,%f->%f->%f \n",countVerNull, phi, anglesVect[2], phiTOT,varDistance);
Time::delay(0.05);
}
void gazeArbiterThread::threadRelease() {
inLeftPort .close();
inRightPort .close();
statusPort .close();
templatePort .close();
blobDatabasePort .close();
inhibitionPort .close();
timingPort .close();
errorPort .close();
if(tracker!=0) {
tracker->stop();
}
//if(ptracker!=0) {
// ptracker->stop();
//}
printf("trying to release the velControl \n");
if(velControl!=0) {
velControl->stop();
}
delete eyeL;
delete eyeR;
igaze->restoreContext(originalContext);
delete clientGazeCtrl;
}
void gazeArbiterThread::update(observable* o, Bottle * arg) {
//printf("ACK. Aware of observable asking for attention \n");
if (arg != 0) {
//printf("bottle: %s ", arg->toString().c_str());
int size = arg->size();
ConstString name = arg->get(0).asString();
if(!strcmp(name.c_str(),"STOP")) {
printf("STOP request!!!!!! \n");
timeout = 100;
suspend();
resume();
}
else if(!strcmp(name.c_str(),"WAIT")) {
// monocular saccades with visualFeedback
printf("WAIT request \n");
u = arg->get(1).asInt();
v = arg->get(2).asInt();
zDistance = 0.5;
time = arg->get(3).asDouble();
mutex.wait();
stateRequest[1] = 1;
mutex.post();
timetotStart = Time::now();
mono = true;
firstVer = true;
firstVergence = true;
}
else if(!strcmp(name.c_str(),"SAC_MONO")) {
// monocular saccades with visualFeedback
printf("MONO SACCADE request \n");
u = arg->get(1).asInt();
v = arg->get(2).asInt();
zDistance = arg->get(3).asDouble();
mutex.wait();
stateRequest[4] = 1;
mutex.post();
timetotStart = Time::now();
mono = true;
firstVer = true;
firstVergence = true;
}
else if(!strcmp(name.c_str(),"SAC_EXPR")) {
// monocular saccades without visualfeedback
printf("EXPRESS SACCADE request \n");
u = arg->get(1).asInt();
v = arg->get(2).asInt();
zDistance = arg->get(3).asDouble();
mutex.wait();
//setVisualFeedback(false);
stateRequest[4] = 1;
//executing = false;
mutex.post();
timetotStart = Time::now();
mono = true;
firstVer = true;
firstVergence = true;
}
else if(!strcmp(name.c_str(),"SAC_ABS")) {
xObject = arg->get(1).asDouble();
yObject = arg->get(2).asDouble();
zObject = arg->get(3).asDouble();
printf("received request of abs saccade in position %f %f %f \n", xObject, yObject, zObject);
mutex.wait();
stateRequest[4] = 1;
//executing = false;
mutex.post();
mono = false;
firstVergence = true;
}
else if(!strcmp(name.c_str(),"SM_PUR")) {
printf("received a command of smooth pursuit ");
uVel = arg->get(1).asDouble();
vVel = arg->get(2).asDouble();
time = arg->get(3).asDouble();
printf("velocity %f %f %f \n", uVel, vVel,time);
mutex.wait();
stateRequest[3] = 1;
//velControl->setVelocityComponents(uVel, vVel);
//executing = false;
mutex.post();
firstVergence = true;
}
else if(!strcmp(name.c_str(),"VER_REL")) {
phi = arg->get(1).asDouble();
phi2 = arg->get(2).asDouble();
phi3 = arg->get(3).asDouble();
mutex.wait();
mono = true;
stateRequest[2] = 1;
//executing = false;
mutex.post();
}
else if(!strcmp(name.c_str(),"VER_ABS")) {
phi = -1;
phiTOT1 = arg->get(1).asDouble();
phiTOT2 = arg->get(2).asDouble();
phiTOT3 = arg->get(3).asDouble();
mutex.wait();
mono = true;
stateRequest[2] = 1;
//executing = false;
mutex.post();
}
else if(!strcmp(name.c_str(),"COR_OFF")) {
printf("visual correction disabled \n");
Time::delay(0.01);
mutex.wait();
setVisualFeedback(false);
mutex.post();
}
else if(!strcmp(name.c_str(),"COR_ON")) {
printf("visual correction enabled \n");
Time::delay(0.01);
mutex.wait();
setVisualFeedback(true);
mutex.post();
}
else {
printf("Command has not been recognised \n");
}
}
}
void gazeArbiterThread::calculateDistance() {
//printf("leftAngle:%f , rightAngle:%f \n", (leftAngle*180)/PI, (rightAngle*180)/PI);
double h,vergence,v,ipLeft, rightHat, rightAngle, leftHat, alfa,b, leftAngle;
if(leftAngle >= 0) {
if(rightAngle >= 0) {
rightHat = PI / 2 - rightAngle;
leftHat = PI / 2 - leftAngle;
alfa = PI / 2 - rightHat;
h = BASELINE * (
(sin(leftHat) * sin(rightHat)) /
(sin(rightHat) * sin(vergence + alfa) - sin(alfa) * sin(leftHat))
);
b = h * (sin(alfa) / sin(rightHat));
ipLeft = sqrt ( h * h + (BASELINE + b) * (BASELINE + b));
}
else {
if(rightAngle >= leftAngle) {
rightHat = PI / 2 + rightAngle;
leftHat = PI / 2 - leftAngle;
alfa = PI / 2 - leftHat;
h = BASELINE * (
(sin(leftHat) * sin(rightHat)) /
(sin(leftHat) * sin(vergence + alfa) + sin(alfa) * sin(rightHat))
);
b = h * (sin(alfa) / sin(leftHat));
ipLeft = sqrt ( h * h + b * b);
}
else {
rightHat = PI / 2 + rightAngle;
leftHat = PI / 2 - leftAngle;
alfa = PI / 2 - rightHat;
h = BASELINE * (
(sin(leftHat) * sin(rightHat)) /
(sin(rightHat) * sin(vergence + alfa) + sin(alfa) * sin(leftHat))
);
b = h * (sin(alfa) / sin(rightHat));
ipLeft = sqrt ( h * h + (BASELINE + b) * (BASELINE + b));
}
}
}
else {
rightHat = PI /2 + rightAngle;
leftHat = PI / 2 + leftAngle;
alfa = PI / 2 - leftHat;
h = BASELINE * (
(sin(leftHat) * sin(rightHat)) /
(sin(leftHat) * sin(vergence + alfa) - sin(alfa) * sin(rightHat))
);
b = h * (sin(alfa) / sin(leftHat));
ipLeft = sqrt ( h * h + b * b);
}
}
|
309c16b58422a250d04ddd9c4899823a550a060f | 13bcf107dbaa8306ed3dfc0d127c218de1023774 | /AeroSimulator/src/shaders/CHealthbarShader.cpp | 70c42bc7ef57c1d03f7ede7dd2991b5bff731b1e | [] | no_license | prodk/AeroSimulator | e33b99325c1d86ccd64a9dc89cc22530979d29fd | e11555fcf3f22c79c172b970be61492dc352c53d | refs/heads/master | 2021-01-10T04:41:46.830256 | 2017-08-28T20:11:46 | 2017-08-28T20:11:46 | 45,316,526 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,079 | cpp | CHealthbarShader.cpp | #include "CHealthbarShader.h"
#include "../CLog.h"
#include "../CRenderable.h"
#include "../CGeometry.h"
#include <cassert>
using namespace AeroSimulatorEngine;
CHealthbarShader::CHealthbarShader()
: CShader()
, mSquadAttribute(0)
, mRightUniform(0)
, mUpUniform(0)
, mWidthUniform(0)
, mHeightUniform(0)
, mColorUniform(0)
, mHealthUniform(0)
{
mVertexShaderCode = readShader("../AeroSimulator/src/shaders/healthbar.glslv");
mFragmentShaderCode = readShader("../AeroSimulator/src/shaders/healthbar.glslf");
CLog::getInstance().log("* CColorBillboardShader created");
}
CHealthbarShader::~CHealthbarShader()
{
}
void CHealthbarShader::link()
{
if (!mIsLinked)
{
CShader::link();
mPositionAttribute = glGetAttribLocation(mProgramId, "aPosition");
//CLog::getInstance().logGL("* CColorBillboardShader: glGetAttribLocation(mProgramId, aPosition): ");
// Add uniform names here
mSquadAttribute = glGetAttribLocation(mProgramId, "aSquad");
//CLog::getInstance().logGL("* CColorBillboardShader: glGetAttribLocation(mProgramId, aSquad): ");
mRightUniform = glGetUniformLocation(mProgramId, "uRight");
//CLog::getInstance().logGL("* CColorBillboardShader: glGetUniformLocation(mProgramId, uRight): ");
mUpUniform = glGetUniformLocation(mProgramId, "uUp");
//CLog::getInstance().logGL("* CColorBillboardShader: glGetUniformLocation(mProgramId, uUp): ");
mWidthUniform = glGetUniformLocation(mProgramId, "uWidth");
//CLog::getInstance().logGL("* CColorBillboardShader: glGetUniformLocation(mProgramId, uWidth): ");
mHeightUniform = glGetUniformLocation(mProgramId, "uHeight");
//CLog::getInstance().logGL("* CColorBillboardShader: glGetUniformLocation(mProgramId, uHeight): ");
mColorUniform = glGetUniformLocation(mProgramId, "uColor");
//CLog::getInstance().logGL("* CColorBillboardShader: glGetUniformLocation(mProgramId, uColor): ");
mMvpUniform = glGetUniformLocation(mProgramId, "MVP");
//CLog::getInstance().logGL("* CColorShader: glGetUniformLocation(mProgramId, MVP): ");
///@todo: remove
mHealthUniform = glGetUniformLocation(mProgramId, "uHealth");
//CLog::getInstance().logGL("* CColorShader: glGetUniformLocation(mProgramId, uHealth): ");
mIsLinked = true;
}
}
void CHealthbarShader::setup(CRenderable & renderable)
{
CShader::setup(renderable);
const CGeometry* pGeometry = renderable.getGeometry();
/// aSquad
if (pGeometry)
{
glVertexAttribPointer(
mPositionAttribute,
pGeometry->getNumOfElementsPerVertex(),
GL_FLOAT,
GL_FALSE,
sizeof(float) * pGeometry->getVertexStride(),
0);
glEnableVertexAttribArray(mPositionAttribute);
// Set additional uniforms here
glVertexAttribPointer(
mSquadAttribute,
2,
GL_FLOAT,
GL_FALSE,
sizeof(float)*pGeometry->getVertexStride(),
(const void*)(3 * sizeof(float))); // Shift relative to the first array element: 3 vertex
glEnableVertexAttribArray(mSquadAttribute);
}
///// uRightUniform
//const glm::vec3 right = renderable.getRightVector();
//glUniform3fv(mRightUniform, 1, &(right.x));
///// mUpUniform
//const glm::vec3 up = renderable.getUpVector();
//glUniform3fv(mUpUniform, 1, &(up.x));
///// mWidthUniform
//const GLfloat width = renderable.getBillboardWidth();
//glUniform1f(mWidthUniform, width);
///// mHeightUniform
//const GLfloat height = renderable.getBillboardHeight();
//glUniform1f(mHeightUniform, height);
//const glm::vec4 color = renderable.getColor();
//glUniform4fv(mColorUniform, 1, &color[0]);
//// Send the transformation to the currently bound shader in the "MVP" uniform
//const glm::mat4 MVP = renderable.getMvpMatrix();
//glUniformMatrix4fv(mMvpUniform, 1, GL_FALSE, &MVP[0][0]);
/////@todo: remove
//const float health = renderable.getHealthValue();
//glUniform1f(mHealthUniform, health);
}
|
2b19910763cbfb019204e6b303fddffbf743bfd9 | f6580d41845929bfe4f299c11a62f72362199f05 | /v0.41/Sources/bbAddon.cpp | e3a10a298f04160b568461b554d9617181f0ac53 | [] | no_license | google-code/bbaddon | a45995140ceef30abdf7ca9bf9857b4b6cc586c8 | a7079033880c542e019caf3e35b17031058cb246 | refs/heads/master | 2016-09-06T01:31:27.925276 | 2015-03-15T19:47:20 | 2015-03-15T19:47:20 | 32,280,397 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,162 | cpp | bbAddon.cpp | #include "stdafx.h"
#ifndef DLL_BBADDON_CPP
#define DLL_BBADDON_CPP
#include "bbAddon.h"
typedef unsigned char uchar;
typedef uchar * achar;
const int TobbObject(void*obj) {return rcast_i(obj);};
BBAEXP const float BBACALL Clamp(float v, float min,float max)
{
if (v<min) return min;
if (v>max) return max;
return v;
};
BBAEXP const float BBACALL RadToDeg(const float a){return a*_RadToDeg;};
BBAEXP const float BBACALL DegToRad(const float a){return a*_DegToRad;};
BBAEXP const float BBACALL Min( const float a, const float b )
{if (b<a) {return b;};return a;};
BBAEXP const float BBACALL Max( const float a, const float b )
{if (b>a) {return b;};return a;};
BBAEXP const float BBACALL LinearInterp ( const float a, const float b, const float rate )
{return a+(b-a)*rate;};
BBAEXP const float BBACALL CosInterp ( const float a, const float b, const float rate )
{return (a+((1-cosf(rate*PI))*.5f)*(b-a));};
BBAEXP const float BBACALL CubicInterp(const float a,const float b,const float c,const float d,const float rate)
{return (((d-c-a+b)*rate+(a+a-b-b-d+c))*rate+c-a)*rate+b;}
#endif //DLL_BBADDON_CPP |
36c021d0bf74c228e5a34dcc96e481c2e7822230 | a58e4057c052c2f4743236f600d06b5191633ee4 | /lc/174/lc_B.cpp | bbd5922f1301a691863b6f94fa419903c6b81624 | [] | no_license | nysanier/cf | d454c6afeaa503b39c78febd42c6c0ac49c8f290 | ced8246c42dcf5d1f63770c466c327d9bc0b8a18 | refs/heads/master | 2020-09-08T01:42:24.193949 | 2020-07-26T09:38:49 | 2020-07-26T09:38:49 | 220,973,764 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,255 | cpp | lc_B.cpp | #include <bits/stdc++.h>
// #include <bits/extc++.h>
#include "lc.h"
// -------------------------------------------------
namespace {
using namespace std;
// # define DUMP(args...)
class Solution {
public:
int minSetSize(vector<int>& arr) {
unordered_map<int, int> ump;
for (auto a : arr) ump[a] += 1;
vector<int> vec;
for (auto& kv : ump) vec.push_back(-kv.second);
int n = arr.size();
int c = 0;
std::sort(vec.begin(), vec.end());
int i = 0;
for (; i < vec.size() && c < n/2; ++i) {
c += -vec[i];
}
return i;
}
};
}
void Init() {}
void Solve() {
using namespace std;
vector<string> in;
std::string out;
lc::Read(in, out);
vector<int> arr;
lc::ParseArg(in[0], arr);
DUMP(arr);
Solution sol;
auto r = sol.minSetSize(arr);
DUMP(out, r);
// assert(out == to_string(r));
}
// -------------------------------------------------
int main() {
#ifndef ONLINE_JUDGE
::freopen("../input.txt", "r", stdin);
#endif
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cout.tie(nullptr);
Init();
int t = 1;
std::cin >> t;
while (t--) Solve();
return 0;
}
|
fbc52f6985ba9dab71ad4b23dd26635c80ae40c7 | 1a20961af3b03b46c109b09812143a7ef95c6caa | /Book/Windows Graphics Programming Win32 GDI and DirectDraw/Src/Chapt_01/Hello4/Hello4.cpp | c2634bff93dfaabc696d31d1cbb4992d3e9ecaa5 | [] | no_license | JetAr/ZNginx | eff4ae2457b7b28115787d6af7a3098c121e8368 | 698b40085585d4190cf983f61b803ad23468cdef | refs/heads/master | 2021-07-16T13:29:57.438175 | 2017-10-23T02:05:43 | 2017-10-23T02:05:43 | 26,522,265 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 5,436 | cpp | Hello4.cpp | //-----------------------------------------------------------------------------------//
// Windows Graphics Programming: Win32 GDI and DirectDraw //
// ISBN 0-13-086985-6 //
// //
// Written by Yuan, Feng www.fengyuan.com //
// Copyright (c) 2000 by Hewlett-Packard Company www.hp.com //
// Published by Prentice Hall PTR, Prentice-Hall, Inc. www.phptr.com //
// //
// FileName : hello4.cpp //
// Description: Hello World Demo 4, DirectDraw, Chapter 1 //
// Version : 1.00.000, May 31, 2000 //
//-----------------------------------------------------------------------------------//
#define STRICT
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <assert.h>
#include <tchar.h>
#include <ddraw.h>
#include "..\..\include\win.h"
const TCHAR szMessage[] = _T("Hello, World !");
const TCHAR szFace[] = _T("Times New Roman");
const TCHAR szHint[] = _T("Press ESC to quit.");
const TCHAR szProgram[] = _T("HelloWorld4");
void CenterText(HDC hDC, int x, int y, LPCTSTR szFace,
LPCTSTR szMessage, int point)
{
HFONT hFont = CreateFont(
- point * GetDeviceCaps(hDC, LOGPIXELSY) / 72,
0, 0, 0, FW_BOLD, TRUE, FALSE, FALSE,
ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS,
PROOF_QUALITY, VARIABLE_PITCH, szFace);
assert(hFont);
HGDIOBJ hOld = SelectObject(hDC, hFont);
SetTextAlign(hDC, TA_CENTER | TA_BASELINE);
SetBkMode(hDC, TRANSPARENT);
SetTextColor(hDC, RGB(0, 0, 0xFF));
TextOut(hDC, x, y, szMessage, _tcslen(szMessage));
SelectObject(hDC, hOld);
DeleteObject(hFont);
}
class KDDrawWindow : public KWindow
{
LPDIRECTDRAW lpdd;
LPDIRECTDRAWSURFACE lpddsprimary;
void OnKeyDown(WPARAM wParam, LPARAM lParam)
{
if ( wParam==VK_ESCAPE )
PostMessage(m_hWnd, WM_CLOSE, 0, 0);
}
void Blend(int left, int right, int top, int bottom);
void OnDraw(HDC hDC)
{
TextOut(hDC, 0, 0, szHint, lstrlen(szHint));
CenterText(hDC, GetSystemMetrics(SM_CXSCREEN)/2,
GetSystemMetrics(SM_CYSCREEN)/2,
szFace, szMessage, 48);
Blend(80, 560, 160, 250);
}
public:
KDDrawWindow(void)
{
lpdd = NULL;
lpddsprimary = NULL;
}
~KDDrawWindow(void)
{
if ( lpddsprimary )
{
lpddsprimary->Release();
lpddsprimary = NULL;
}
if ( lpdd )
{
lpdd->Release();
lpdd = NULL;
}
}
bool CreateSurface(void);
};
bool KDDrawWindow::CreateSurface(void)
{
HRESULT hr;
hr = DirectDrawCreate(NULL, &lpdd, NULL);
if (hr!=DD_OK)
return false;
hr = lpdd->SetCooperativeLevel(m_hWnd, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE);
if (hr!=DD_OK)
return false;
hr = lpdd->SetDisplayMode(640, 480, 32);
if (hr!=DD_OK)
return false;
DDSURFACEDESC ddsd;
memset(& ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
return lpdd->CreateSurface(&ddsd, &lpddsprimary, NULL)==DD_OK;
}
void inline Blend(unsigned char *dest, unsigned char *src)
{
dest[0] = (dest[0] + src[0])/2;
dest[1] = (dest[1] + src[1])/2;
dest[2] = (dest[2] + src[2])/2;
}
void KDDrawWindow::Blend(int left, int right,
int top, int bottom)
{
DDSURFACEDESC ddsd;
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
HRESULT hr = lpddsprimary->Lock(NULL, &ddsd,
DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
assert(hr==DD_OK);
unsigned char *screen = (unsigned char *) ddsd.lpSurface;
for (int y=top; y<bottom; y++)
{
unsigned char * pixel = screen + y * ddsd.lPitch
+ left * 4;
for (int x=left; x<right; x++, pixel+=4)
if ( pixel[0]!=255 || pixel[1]!=255 ||
pixel[2]!=255 ) // non white
{
::Blend(pixel-4, pixel); // left
::Blend(pixel+4, pixel); // right
::Blend(pixel-ddsd.lPitch, pixel); // up
::Blend(pixel+ddsd.lPitch, pixel); // down
}
}
lpddsprimary->Unlock(ddsd.lpSurface);
}
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE,
LPSTR lpCmd, int nShow)
{
KDDrawWindow win;
win.CreateEx(0, szProgram, szProgram,
WS_POPUP,
0, 0,
GetSystemMetrics( SM_CXSCREEN ),
GetSystemMetrics( SM_CYSCREEN ),
NULL, NULL, hInst);
if ( ! win.CreateSurface() )
{
MessageBox(NULL, _T("DirectDraw Initialization failed!"), _T("Hello4"), MB_OK);
return -1;
}
win.ShowWindow(nShow);
win.UpdateWindow();
return win.MessageLoop();
} |
8166f9e059777dcaa5070c197c81e3b8965a8539 | 570fc184f62d1cf8624ca2a5a7fc487af1452754 | /tools/profiler/platform.cpp | 64c8f828bef9637c2e6ee0bbc0ee68d061fd51ad | [] | no_license | roytam1/palemoon26 | 726424415a96fb36fe47d5d414a2cfafabecb3e6 | 43b0deedf05166f30d62bd666c040a3165a761a1 | refs/heads/master | 2023-09-03T15:25:23.800487 | 2018-08-25T16:35:59 | 2018-08-28T12:32:52 | 115,328,093 | 6 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 16,684 | cpp | platform.cpp | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <ostream>
#include <fstream>
#include <sstream>
#include <errno.h>
#include "IOInterposer.h"
#include "ProfilerIOInterposeObserver.h"
#include "platform.h"
#include "PlatformMacros.h"
#include "prenv.h"
#include "mozilla/ThreadLocal.h"
#include "PseudoStack.h"
#include "TableTicker.h"
#include "UnwinderThread2.h"
#include "nsIObserverService.h"
#include "nsDirectoryServiceUtils.h"
#include "nsDirectoryServiceDefs.h"
#include "mozilla/Services.h"
#include "nsThreadUtils.h"
#if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
#include "AndroidBridge.h"
#endif
mozilla::ThreadLocal<PseudoStack *> tlsPseudoStack;
mozilla::ThreadLocal<TableTicker *> tlsTicker;
// We need to track whether we've been initialized otherwise
// we end up using tlsStack without initializing it.
// Because tlsStack is totally opaque to us we can't reuse
// it as the flag itself.
bool stack_key_initialized;
TimeStamp sLastTracerEvent; // is raced on
TimeStamp sStartTime;
int sFrameNumber = 0;
int sLastFrameNumber = 0;
int sInitCount = 0; // Each init must have a matched shutdown.
static bool sIsProfiling = false; // is raced on
/* used to keep track of the last event that we sampled during */
unsigned int sLastSampledEventGeneration = 0;
/* a counter that's incremented everytime we get responsiveness event
* note: it might also be worth trackplaing everytime we go around
* the event loop */
unsigned int sCurrentEventGeneration = 0;
/* we don't need to worry about overflow because we only treat the
* case of them being the same as special. i.e. we only run into
* a problem if 2^32 events happen between samples that we need
* to know are associated with different events */
std::vector<ThreadInfo*>* Sampler::sRegisteredThreads = nullptr;
mozilla::Mutex* Sampler::sRegisteredThreadsMutex = nullptr;
TableTicker* Sampler::sActiveSampler;
static mozilla::ProfilerIOInterposeObserver* sInterposeObserver = nullptr;
void Sampler::Startup() {
sRegisteredThreads = new std::vector<ThreadInfo*>();
sRegisteredThreadsMutex = new mozilla::Mutex("sRegisteredThreads mutex");
}
void Sampler::Shutdown() {
while (sRegisteredThreads->size() > 0) {
delete sRegisteredThreads->back();
sRegisteredThreads->pop_back();
}
delete sRegisteredThreadsMutex;
delete sRegisteredThreads;
// UnregisterThread can be called after shutdown in XPCShell. Thus
// we need to point to null to ignore such a call after shutdown.
sRegisteredThreadsMutex = nullptr;
sRegisteredThreads = nullptr;
}
ThreadInfo::~ThreadInfo() {
free(mName);
if (mProfile)
delete mProfile;
Sampler::FreePlatformData(mPlatformData);
}
bool sps_version2()
{
static int version = 0; // Raced on, potentially
if (version == 0) {
bool allow2 = false; // Is v2 allowable on this platform?
# if defined(SPS_PLAT_amd64_linux) || defined(SPS_PLAT_arm_android) \
|| defined(SPS_PLAT_x86_linux)
allow2 = true;
# elif defined(SPS_PLAT_amd64_darwin) || defined(SPS_PLAT_x86_darwin) \
|| defined(SPS_PLAT_x86_windows) || defined(SPS_PLAT_x86_android) \
|| defined(SPS_PLAT_amd64_windows)
allow2 = false;
# else
# error "Unknown platform"
# endif
bool req2 = PR_GetEnv("MOZ_PROFILER_NEW") != NULL; // Has v2 been requested?
bool elfhackd = false;
# if defined(USE_ELF_HACK)
bool elfhackd = true;
# endif
if (req2 && allow2) {
version = 2;
LOG("------------------- MOZ_PROFILER_NEW set -------------------");
} else if (req2 && !allow2) {
version = 1;
LOG("--------------- MOZ_PROFILER_NEW requested, ----------------");
LOG("---------- but is not available on this platform -----------");
} else if (req2 && elfhackd) {
version = 1;
LOG("--------------- MOZ_PROFILER_NEW requested, ----------------");
LOG("--- but this build was not done with --disable-elf-hack ----");
} else {
version = 1;
LOG("----------------- MOZ_PROFILER_NEW not set -----------------");
}
}
return version == 2;
}
#if !defined(ANDROID)
/* Has MOZ_PROFILER_VERBOSE been set? */
bool moz_profiler_verbose()
{
/* 0 = not checked, 1 = unset, 2 = set */
static int status = 0; // Raced on, potentially
if (status == 0) {
if (PR_GetEnv("MOZ_PROFILER_VERBOSE") != NULL)
status = 2;
else
status = 1;
}
return status == 2;
}
#endif
static inline const char* name_UnwMode(UnwMode m)
{
switch (m) {
case UnwINVALID: return "invalid";
case UnwNATIVE: return "native";
case UnwPSEUDO: return "pseudo";
case UnwCOMBINED: return "combined";
default: return "??name_UnwMode??";
}
}
// Read env vars at startup, so as to set sUnwindMode and sInterval.
void read_profiler_env_vars()
{
bool nativeAvail = false;
# if defined(HAVE_NATIVE_UNWIND)
nativeAvail = true;
# endif
MOZ_ASSERT(sUnwindMode == UnwINVALID);
MOZ_ASSERT(sUnwindInterval == 0);
/* Set defaults */
sUnwindMode = nativeAvail ? UnwCOMBINED : UnwPSEUDO;
sUnwindInterval = 0; /* We'll have to look elsewhere */
const char* strM = PR_GetEnv("MOZ_PROFILER_MODE");
const char* strI = PR_GetEnv("MOZ_PROFILER_INTERVAL");
const char* strF = PR_GetEnv("MOZ_PROFILER_STACK_SCAN");
if (strM) {
if (0 == strcmp(strM, "pseudo"))
sUnwindMode = UnwPSEUDO;
else if (0 == strcmp(strM, "native") && nativeAvail)
sUnwindMode = UnwNATIVE;
else if (0 == strcmp(strM, "combined") && nativeAvail)
sUnwindMode = UnwCOMBINED;
else goto usage;
}
if (strI) {
errno = 0;
long int n = strtol(strI, (char**)NULL, 10);
if (errno == 0 && n >= 1 && n <= 1000) {
sUnwindInterval = n;
}
else goto usage;
}
if (strF) {
errno = 0;
long int n = strtol(strF, (char**)NULL, 10);
if (errno == 0 && n >= 0 && n <= 100) {
sUnwindStackScan = n;
}
else goto usage;
}
goto out;
usage:
LOG( "SPS: ");
LOG( "SPS: Environment variable usage:");
LOG( "SPS: ");
LOG( "SPS: MOZ_PROFILER_MODE=native for native unwind only");
LOG( "SPS: MOZ_PROFILER_MODE=pseudo for pseudo unwind only");
LOG( "SPS: MOZ_PROFILER_MODE=combined for combined native & pseudo unwind");
LOG( "SPS: If unset, default is 'combined' on native-capable");
LOG( "SPS: platforms, 'pseudo' on others.");
LOG( "SPS: ");
LOG( "SPS: MOZ_PROFILER_INTERVAL=<number> (milliseconds, 1 to 1000)");
LOG( "SPS: If unset, platform default is used.");
LOG( "SPS: ");
LOG( "SPS: MOZ_PROFILER_VERBOSE");
LOG( "SPS: If set to any value, increases verbosity (recommended).");
LOG( "SPS: ");
LOG( "SPS: MOZ_PROFILER_STACK_SCAN=<number> (default is zero)");
LOG( "SPS: The number of dubious (stack-scanned) frames allowed");
LOG( "SPS: ");
LOG( "SPS: MOZ_PROFILER_NEW");
LOG( "SPS: Needs to be set to use Breakpad-based unwinding.");
LOG( "SPS: ");
LOGF("SPS: This platform %s native unwinding.",
nativeAvail ? "supports" : "does not support");
LOG( "SPS: ");
/* Re-set defaults */
sUnwindMode = nativeAvail ? UnwCOMBINED : UnwPSEUDO;
sUnwindInterval = 0; /* We'll have to look elsewhere */
sUnwindStackScan = 0;
out:
LOG( "SPS:");
LOGF("SPS: Unwind mode = %s", name_UnwMode(sUnwindMode));
LOGF("SPS: Sampling interval = %d ms (zero means \"platform default\")",
(int)sUnwindInterval);
LOGF("SPS: UnwindStackScan = %d (max dubious frames per unwind).",
(int)sUnwindStackScan);
LOG( "SPS: Use env var MOZ_PROFILER_MODE=help for further information.");
LOG( "SPS:");
return;
}
////////////////////////////////////////////////////////////////////////
// BEGIN externally visible functions
void mozilla_sampler_init(void* stackTop)
{
sInitCount++;
if (stack_key_initialized)
return;
LOG("BEGIN mozilla_sampler_init");
if (!tlsPseudoStack.init() || !tlsTicker.init()) {
LOG("Failed to init.");
return;
}
stack_key_initialized = true;
Sampler::Startup();
PseudoStack *stack = new PseudoStack();
tlsPseudoStack.set(stack);
Sampler::RegisterCurrentThread("Goanna", stack, true, stackTop);
// Read mode settings from MOZ_PROFILER_MODE and interval
// settings from MOZ_PROFILER_INTERVAL and stack-scan threshhold
// from MOZ_PROFILER_STACK_SCAN.
read_profiler_env_vars();
// Allow the profiler to be started using signals
OS::RegisterStartHandler();
// Initialize (but don't enable) I/O interposing
sInterposeObserver = new mozilla::ProfilerIOInterposeObserver();
// We can't open pref so we use an environment variable
// to know if we should trigger the profiler on startup
// NOTE: Default
const char *val = PR_GetEnv("MOZ_PROFILER_STARTUP");
if (!val || !*val) {
return;
}
const char* features[] = {"js"
, "leaf"
#if defined(XP_WIN) || defined(XP_MACOSX)
, "stackwalk"
#endif
};
profiler_start(PROFILE_DEFAULT_ENTRY, PROFILE_DEFAULT_INTERVAL,
features, sizeof(features)/sizeof(const char*),
// TODO Add env variable to select threads
NULL, 0);
LOG("END mozilla_sampler_init");
}
void mozilla_sampler_shutdown()
{
sInitCount--;
if (sInitCount > 0)
return;
// Save the profile on shutdown if requested.
TableTicker *t = tlsTicker.get();
if (t) {
const char *val = PR_GetEnv("MOZ_PROFILER_SHUTDOWN");
if (val) {
std::ofstream stream;
stream.open(val);
if (stream.is_open()) {
t->ToStreamAsJSON(stream);
stream.close();
}
}
}
profiler_stop();
delete sInterposeObserver;
sInterposeObserver = nullptr;
mozilla::IOInterposer::ClearInstance();
Sampler::Shutdown();
// We can't delete the Stack because we can be between a
// sampler call_enter/call_exit point.
// TODO Need to find a safe time to delete Stack
}
void mozilla_sampler_save()
{
TableTicker *t = tlsTicker.get();
if (!t) {
return;
}
t->RequestSave();
// We're on the main thread already so we don't
// have to wait to handle the save request.
t->HandleSaveRequest();
}
char* mozilla_sampler_get_profile()
{
TableTicker *t = tlsTicker.get();
if (!t) {
return NULL;
}
std::stringstream stream;
t->ToStreamAsJSON(stream);
char* profile = strdup(stream.str().c_str());
return profile;
}
JSObject *mozilla_sampler_get_profile_data(JSContext *aCx)
{
TableTicker *t = tlsTicker.get();
if (!t) {
return NULL;
}
return t->ToJSObject(aCx);
}
const char** mozilla_sampler_get_features()
{
static const char* features[] = {
#if defined(MOZ_PROFILING) && defined(HAVE_NATIVE_UNWIND)
// Walk the C++ stack.
"stackwalk",
#endif
#if defined(ENABLE_SPS_LEAF_DATA)
// Include the C++ leaf node if not stackwalking. DevTools
// profiler doesn't want the native addresses.
"leaf",
#endif
#if !defined(SPS_OS_windows)
// Use a seperate thread of walking the stack.
"unwinder",
#endif
"java",
// Only record samples during periods of bad responsiveness
"jank",
// Tell the JS engine to emmit pseudostack entries in the
// pro/epilogue.
"js",
// Profile the registered secondary threads.
"threads",
// Do not include user-identifiable information
"privacy",
// Add main thread I/O to the profile
"mainthreadio",
NULL
};
return features;
}
// Values are only honored on the first start
void mozilla_sampler_start(int aProfileEntries, int aInterval,
const char** aFeatures, uint32_t aFeatureCount,
const char** aThreadNameFilters, uint32_t aFilterCount)
{
if (!stack_key_initialized)
profiler_init(NULL);
/* If the sampling interval was set using env vars, use that
in preference to anything else. */
if (sUnwindInterval > 0)
aInterval = sUnwindInterval;
// Reset the current state if the profiler is running
profiler_stop();
TableTicker* t;
t = new TableTicker(aInterval ? aInterval : PROFILE_DEFAULT_INTERVAL,
aProfileEntries ? aProfileEntries : PROFILE_DEFAULT_ENTRY,
aFeatures, aFeatureCount,
aThreadNameFilters, aFilterCount);
if (t->HasUnwinderThread()) {
// Create the unwinder thread. ATM there is only one.
uwt__init();
}
tlsTicker.set(t);
t->Start();
if (t->ProfileJS() || t->InPrivacyMode()) {
mozilla::MutexAutoLock lock(*Sampler::sRegisteredThreadsMutex);
std::vector<ThreadInfo*> threads = t->GetRegisteredThreads();
for (uint32_t i = 0; i < threads.size(); i++) {
ThreadInfo* info = threads[i];
ThreadProfile* thread_profile = info->Profile();
if (!thread_profile) {
continue;
}
if (t->ProfileJS()) {
thread_profile->GetPseudoStack()->enableJSSampling();
}
if (t->InPrivacyMode()) {
thread_profile->GetPseudoStack()->mPrivacyMode = true;
}
}
}
#if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
if (t->ProfileJava()) {
int javaInterval = aInterval;
// Java sampling doesn't accuratly keep up with 1ms sampling
if (javaInterval < 10) {
aInterval = 10;
}
mozilla::AndroidBridge::Bridge()->StartJavaProfiling(javaInterval, 1000);
}
#endif
if (t->AddMainThreadIO()) {
mozilla::IOInterposer::GetInstance()->Enable(true);
}
sIsProfiling = true;
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
if (os)
os->NotifyObservers(nullptr, "profiler-started", nullptr);
}
void mozilla_sampler_stop()
{
if (!stack_key_initialized)
profiler_init(NULL);
TableTicker *t = tlsTicker.get();
if (!t) {
return;
}
bool disableJS = t->ProfileJS();
bool unwinderThreader = t->HasUnwinderThread();
// Shut down and reap the unwinder thread. We have to do this
// before stopping the sampler, so as to guarantee that the unwinder
// thread doesn't try to access memory that the subsequent call to
// mozilla_sampler_stop causes to be freed.
if (unwinderThreader) {
uwt__stop();
}
t->Stop();
delete t;
tlsTicker.set(NULL);
if (disableJS) {
PseudoStack *stack = tlsPseudoStack.get();
ASSERT(stack != NULL);
stack->disableJSSampling();
}
if (unwinderThreader) {
uwt__deinit();
}
mozilla::IOInterposer::GetInstance()->Enable(false);
sIsProfiling = false;
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
if (os)
os->NotifyObservers(nullptr, "profiler-stopped", nullptr);
}
bool mozilla_sampler_is_active()
{
return sIsProfiling;
}
static double sResponsivenessTimes[100];
static unsigned int sResponsivenessLoc = 0;
void mozilla_sampler_responsiveness(const TimeStamp& aTime)
{
if (!sLastTracerEvent.IsNull()) {
if (sResponsivenessLoc == 100) {
for(size_t i = 0; i < 100-1; i++) {
sResponsivenessTimes[i] = sResponsivenessTimes[i+1];
}
sResponsivenessLoc--;
}
TimeDuration delta = aTime - sLastTracerEvent;
sResponsivenessTimes[sResponsivenessLoc++] = delta.ToMilliseconds();
}
sCurrentEventGeneration++;
sLastTracerEvent = aTime;
}
const double* mozilla_sampler_get_responsiveness()
{
return sResponsivenessTimes;
}
void mozilla_sampler_frame_number(int frameNumber)
{
sFrameNumber = frameNumber;
}
void mozilla_sampler_print_location2()
{
// FIXME
}
void mozilla_sampler_lock()
{
profiler_stop();
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
if (os)
os->NotifyObservers(nullptr, "profiler-locked", nullptr);
}
void mozilla_sampler_unlock()
{
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
if (os)
os->NotifyObservers(nullptr, "profiler-unlocked", nullptr);
}
bool mozilla_sampler_register_thread(const char* aName, void* stackTop)
{
PseudoStack* stack = new PseudoStack();
tlsPseudoStack.set(stack);
return Sampler::RegisterCurrentThread(aName, stack, false, stackTop);
}
void mozilla_sampler_unregister_thread()
{
Sampler::UnregisterCurrentThread();
}
double mozilla_sampler_time()
{
TimeDuration delta = TimeStamp::Now() - sStartTime;
return delta.ToMilliseconds();
}
// END externally visible functions
////////////////////////////////////////////////////////////////////////
|
2f028e7c02f80c5080876e86911a8212a1f304a6 | d4667eeb25575d0dca8e087e90a7935032a01130 | /assignment1/source/exercise12.cpp | 19ecb596a8b0140ae8716c3feca714f25bc6c0da | [] | no_license | AnBenLa/Realtime-Rendering | ce74142f95fc38a441b183eba3125ee668cfacad | c0250867d76e794d835d9069da06b1cc01324016 | refs/heads/master | 2022-04-03T18:05:41.065062 | 2020-02-04T17:18:43 | 2020-02-04T17:18:43 | 218,351,515 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,067 | cpp | exercise12.cpp | // author: Anton Lammert
// authot: Philipp Tornow 118332
#include <iostream>
#include <algorithm>
using namespace std;
struct point{
double x, y;
};
struct triangle{
point a, b, c;
};
point operator * (double a, point const& b){
return {b.x*a, b.y*a};
}
point operator + (point const& a, point const& b){
return {a.x + b.x, a.y + b.y};
}
bool operator == (point const& a, point const& b){
return a.x == b.x && a.y == b.y;
}
//returns -1 for ccw, +1 for cw and 0 if b is collinear with the line through a and c
int orientation(point const& a, point const& b, point const& c){
double dx21 = b.x - a.x;
double dy21 = b.y - a.y;
double dx31 = c.x - a.x;
double dy31 = c.y - a.y;
if(dy31*dx21 > dx31*dy21)
return - 1;
if(dy31*dx21 < dx31*dy21)
return +1;
return 0;
}
//returns the area of the triangle using the implicit line equation
double area(triangle const& t){
double x1y2 = t.a.x*t.b.y;
double x3y1 = t.c.x*t.a.y;
double x2y3 = t.b.x*t.c.y;
double x3y2 = t.c.x*t.b.y;
double x2y1 = t.b.x*t.a.y;
double x1y3 = t.a.x*t.c.y;
return 0.5f * (x1y2 + x3y1 + x2y3 - x3y2 - x2y1 - x1y3);
}
//returns true if the point is inside the triangle
bool inside_triangle(triangle const& t, point const& p){
//if triangle is a point check if p is the same point
if(t.a == t.b && t.b == t.c)
return p == t.a;
double area_t = area(t);
//if triangle is a segment check if p is on the segment
if(area_t == 0){
//check if p is on the line going through the segment
if(orientation(t.a, p, t.b) == 0){
//check if point is on segment
int min_x = min(min(t.a.x, t.b.x), t.c.x);
int max_x = max(max(t.a.x, t.b.x), t.c.x);
int min_y = min(min(t.a.y, t.b.y), t.c.y);
int max_y = max(max(t.a.y, t.b.y), t.c.y);
return p.x <= max_x && p.x >= min_x && p.y <= max_y && p.y >= min_y;
}
return false;
}
double area_p2 = area({t.c, t.a, p});
double area_p3 = area({t.a, t.b, p});
double area_p1 = area({t.b, t.c, p});
if(area_t != 0) {
double f_a = area_p1 / area_t;
double f_b = area_p2 / area_t;
double f_c = area_p3 / area_t;
if (f_a >= 0 && f_b >= 0 && f_c >= 0 && f_a <= 1 && f_b <= 1 && f_c <= 1)
return true;
}
return false;
}
int main(int argc, char const *argv[])
{
double x_0,x_1,x_2,y_0,y_1,y_2;
while(true){
cin >> x_0 >> y_0 >> x_1 >> y_1 >> x_2 >> y_2;
if(x_0 == y_0 && y_0 == x_1 && x_1 == y_1 && y_1 == x_2 && x_2 == y_2 && y_2 == 0){
break;
}
triangle t{{x_0,y_0},{x_1,y_1},{x_2,y_2}};
for(int i = 0; i <= 20; ++i){
for(int j = 0; j <= 20; ++j){
if(inside_triangle(t, {static_cast<double>(j),20.0f - i }))
cout << "*";
else
cout << ".";
}
cout << endl;
}
cout << endl;
}
return 0;
} |
6968b75cb1b9743708719b8c1732c292c24a2e1d | de3bdb02fe65e4bdef2429306aac858b6d87adb9 | /ofApp.cpp | de792d68dafc4b85a439a6cc501b91a5b57600f6 | [] | no_license | junkiyoshi/Insta20181011 | 98c1c16b0fa300e834110db75f9dcbda9bc36f20 | c2ede0df310e050d2372bfdeed590e27bdf382f5 | refs/heads/master | 2020-03-31T20:57:28.465492 | 2018-10-11T09:01:49 | 2018-10-11T09:01:49 | 152,561,823 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 824 | cpp | ofApp.cpp | #include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup() {
ofSetFrameRate(60);
ofSetWindowTitle("openframeworks");
ofBackground(39);
ofSetColor(239);
ofEnableDepthTest();
for (int i = 0; i < 255; i++) { this->particles.push_back(Particle()); }
}
//--------------------------------------------------------------
void ofApp::update() {
for (Particle& particle : particles) { particle.Upate(); }
}
//--------------------------------------------------------------
void ofApp::draw() {
this->cam.begin();
ofRotateY(ofGetFrameNum() * 0.25);
for (Particle& particle : particles) { particle.Draw(); }
this->cam.end();
}
//--------------------------------------------------------------
int main() {
ofSetupOpenGL(720, 720, OF_WINDOW);
ofRunApp(new ofApp());
} |
bdfb9abe5b667af8e50bd64e0595789fff45c835 | 27efb2b2b38eb97be5d91229af7dafe2febe22fb | /problems/codeforces/Calculating_Function_A.cpp | 04ec88e713170262e85a31631324b323e041cbcb | [] | no_license | MohamedHashim/problem-solving | 55449fac185f7649ddb69b8d0d9e0f23cb557a14 | 0d3bf6827d56d1af17aeb01d36290a9615ff67b1 | refs/heads/master | 2023-03-28T11:21:09.748433 | 2021-03-28T21:39:16 | 2021-03-28T21:39:16 | 285,159,810 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 329 | cpp | Calculating_Function_A.cpp | #include"bits/stdc++.h"
#include<iostream>
using namespace std;
const int N = 1e5 + 7;
int main() {
#ifndef ONLINE_JUDGE
FILE *stream;
freopen_s(&stream, "..//input.in", "r", stdin);
#endif
long long n;
cin >> n;
if (n % 2 == 0)
cout << n / 2;
else
cout << -(n+1) / 2;
return 0;
}
|
8cf17520f1ac4097661d308c815918c31590b49b | 2ad2cb0727f3184951e9466fc62473676cd4c7a8 | /AladdiGameC/AladdiGameC/Drill.h | ad2712254b58ed6a3e6ba7b1c9dee865e6d9a2bd | [] | no_license | vantranguit920/AladdinGameC | b0505102c871ed75c667b7abfdb6e5ac8c649298 | e3f9058fd8a46f104871ccae62c60f6cf7de4739 | refs/heads/master | 2022-04-01T19:50:18.070177 | 2019-12-01T09:44:49 | 2019-12-01T09:44:49 | 221,399,389 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 635 | h | Drill.h | #pragma once
#include "Object.h"
#include "Sprite.h"
#include "SpriteSheet.h"
#include "Animation.h"
#include "Keyboard.h"
#include "Viewport.h"
class Drill :public Object
{
protected:
Animation * arrowAnim;
float timecout=0;
Animation * drillAnim;
public:
enum ArrowState
{
oppen,
close,
};
ArrowState state;
void ChangeAnim(Keyboard* key);
void Update(float dt, Keyboard* key);
void Render(Viewport* viewport);
void setstate(ArrowState state);
Arrow();
Arrow(Sprite *sprite, SpriteSheet *info, D3DXVECTOR2 pos);
~Arrow();
Drill();
Drill(Sprite *sprite, SpriteSheet *info, D3DXVECTOR2 pos);
~Drill();
};
|
995f4ef646cf19e023ab2ee8761804d083712ae9 | 3bc41de649fbe77486c0f8ee6ba5d49f5c3ae6d5 | /src/subscriber_node.cpp | 0c0a80d8eadbe96fc5e1cdd600c01850d06cdd12 | [] | no_license | rshah18/ros_workshop_fs | 9594170e576f06a0d86ef4d87e88c6cbcf1f501a | e542c7dbf32353786e9df97bf9140748fdbd3a41 | refs/heads/master | 2020-09-23T11:09:25.513222 | 2019-12-02T23:04:37 | 2019-12-02T23:04:37 | 225,485,709 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 389 | cpp | subscriber_node.cpp | #include "ros/ros.h"
#include "demo/mymsg.h"
void callBack(const demo::mymsg:: ConstPtr & msg){
ROS_INFO("Recieve msg = %d", msg->stamp.sec);
ROS_INFO("recieve msg = %d", msg->data);
}
int main(int argc, char **argv){
ros::init(argc, argv, "subscriber_node");
ros::NodeHandle nh;
ros::Subscriber sub = nh.subscribe("mytopic", 100, callBack);
ros::spin();
return 0;
}
|
4599ae5cf04e0d591006a045debca9387ca02753 | a06515f4697a3dbcbae4e3c05de2f8632f8d5f46 | /corpus/taken_from_cppcheck_tests/stolen_664.cpp | ed05b19c85ed104721f927e9fe56f9b61a40a23c | [] | no_license | pauldreik/fuzzcppcheck | 12d9c11bcc182cc1f1bb4893e0925dc05fcaf711 | 794ba352af45971ff1f76d665b52adeb42dcab5f | refs/heads/master | 2020-05-01T01:55:04.280076 | 2019-03-22T21:05:28 | 2019-03-22T21:05:28 | 177,206,313 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 49 | cpp | stolen_664.cpp | void f() {
gchar x[3];
strcpy(x, "12");
} |
9aea75aeabf2ed26421a76b320d3e5098c95d787 | 1690125cab12f4a38c02a4845b63dea2bf464ec2 | /DNBSkellamCode/src/BidPrice/MCMC.cpp | e5961e6619fc2de92c714f7c2a48fb28eab737d5 | [] | no_license | aborowska/DNB | a97997056a994fceef6e401c113a91b2b49d99a1 | ecd33692811d4d6c86e0ac661d549e33307f6fae | refs/heads/master | 2021-01-19T21:37:23.195006 | 2018-07-06T18:05:55 | 2018-07-06T18:05:55 | 88,676,930 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 43,681 | cpp | MCMC.cpp | /*
* MCMC.cpp
*
* Created on: Mar 17, 2014
* Author: istvan
*/
#include "MCMC.h"
#include "struct.h"
//#include "cuda_functions.h"
#include "basic_functions.h"
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>
#include <math.h>
#include <time.h>
#include <fstream>
#include <sstream>
#include <string.h>
#include <stdlib.h>
#include <vector>
#include <limits>
MCMC::MCMC()
{
}
MCMC::MCMC(vector<double> vParam, int iSeedNo_in)
{
if(vParam.size()==4 || vParam.size()==5 )
{
dMuTrue=vParam[0];
dPhiTrue=vParam[1];
dSigma2True=vParam[2];
dGammaTrue=vParam[3];
if(vParam.size()==5){
dNuTrue=vParam[4];
}
iSeedNo = iSeedNo_in;
}
else
{
cout << "Number of parameters should be either 4 or 5 " << endl ;
}
}
MCMC::~MCMC()
{
delete [] vData;
delete [] vTimes;
// delete [] vSeasonTrue;
// delete [] vXTrue;
// delete [] vNTrue;
// delete [] vTau1True;
// delete [] vTau2True;
cout << "MCMC destructor has been called " << endl;
}
/*
* Simulate from dynamic zero inflated Skellam model
*
* iNumOfSim number of simulated data points
*
* Note that the algorithm uses :
* dMuTrue;
* dPhiTrue;
* Sigma2True;
* dGammaTrue;
*
*/
// void MCMC::SimulateSkellamData( int iNumOfSim)
void MCMC::SimulateSkellamData( int iNumOfSim)
{
string sType;
sType="Sk";
const gsl_rng_type * T;
gsl_rng * r;
T=gsl_rng_default;
r=gsl_rng_alloc(T);
// gsl_rng_set(r, 1);
gsl_rng_set(r, iSeedNo);
vData = new double[iNumOfSim];
vXTrue = new double[iNumOfSim];
vNTrue=new double[iNumOfSim];
vTau1True=new double[iNumOfSim];
vTau2True=new double[iNumOfSim];
vSeasonTrue = new double[iNumOfSim];
vTimes = new double[iNumOfSim];
iNumOfObs=iNumOfSim;
cout<<"dMuTrue "<<dMuTrue<<endl;
cout<<"dPhiTrue "<<dPhiTrue<<endl;
cout<<"dSigma2True "<<dSigma2True<<endl;
cout<<"dGammaTrue "<<dGammaTrue<<endl;
double dStateSigma=sqrt(dSigma2True);
int iNumOfSimPerDay=2000;
// SimulateSeasonal(iNumOfSimPerDay, iNumOfSim/iNumOfSimPerDay, vTimes, vSeasonTrue);
SimulateSeasonal_str(sType, iNumOfSimPerDay, iNumOfSim/iNumOfSimPerDay, vTimes, vSeasonTrue);
for(int i=0; i<iNumOfSim; i++){
if(i==0)
{
/* Log intensity */
vXTrue[i]= gsl_ran_gaussian(r,sqrt(dSigma2True/(1-dPhiTrue*dPhiTrue)) );
}
else
{
vXTrue [i]= dPhiTrue * vXTrue[i-1]+ gsl_ran_gaussian(r,dStateSigma) ;
}
// vXTrue [i]=0;
/* Conditional Skellam return */
double dPoissionMean= exp(dMuTrue +vSeasonTrue[i] + vXTrue[i]);
// int Poission1=gsl_ran_poisson(r,dPoissionMean);
// int Poission2= gsl_ran_poisson(r,dPoissionMean);
// int iSkellam=Poission1 - Poission2;
// vNTrue[i]=Poission1 + Poission2;
int iSkellam=0;
int iN=0;
double dTau1=0;
double dTau2=0;
SimulateSkellam(dPoissionMean, r, &iSkellam, &iN, &dTau1, &dTau2);
vNTrue[i]=iN;
vTau1True[i]=dTau1;
vTau2True[i]=dTau2;
double dU=gsl_rng_uniform(r);
if(dU<=dGammaTrue)
{
vData[i]=0;
}
else
{
vData[i]= iSkellam ;
}
cout << "Data at "<< i<<" is " << vData[i]<< endl;
}
gsl_rng_free(r);
return;
}
/*
* Simulate from dynamic zero inflated negative binomial difference model
*
* iNumOfSim number of simulated data points
*
* Note that the algorithm uses :
* dMuTrue;
* dPhiTrue;
* Sigma2True;
* dGammaTrue;
* dNuTrue;
*
*/
void MCMC::SimulateDNBData( int iNumOfSim)
{
string sType;
sType="DNB";
const gsl_rng_type * T;
gsl_rng * r;
T=gsl_rng_default;
r=gsl_rng_alloc(T);
// gsl_rng_set(r, 1);
gsl_rng_set(r, iSeedNo);
vData = new double[iNumOfSim];
vXTrue = new double[iNumOfSim];
vSeasonTrue = new double[iNumOfSim];
vTimes = new double[iNumOfSim];
iNumOfObs=iNumOfSim;
cout<<"dMuTrue "<< dMuTrue<<endl;
cout<<"dPhiTrue "<< dPhiTrue<<endl;
cout<<"dSigma2True "<< dSigma2True <<endl;
cout<<"dGammaTrue "<< dGammaTrue <<endl;
cout<<"dNuTrue "<< dNuTrue<<endl;
double dStateSigma=sqrt(dSigma2True);
int iNumOfSimPerDay=2000;
// SimulateSeasonal(iNumOfSimPerDay, iNumOfSim/iNumOfSimPerDay, vTimes, vSeasonTrue);
SimulateSeasonal_str(sType, iNumOfSimPerDay, iNumOfSim/iNumOfSimPerDay, vTimes, vSeasonTrue);
for(int i=0; i<iNumOfSim; i++){
if(i==0)
{
/* Log intensity */
vXTrue[i]= gsl_ran_gaussian(r,sqrt(dSigma2True/(1-dPhiTrue*dPhiTrue)) );
}
else
{
vXTrue [i]= dPhiTrue * vXTrue[i-1]+ gsl_ran_gaussian(r,dStateSigma) ;
}
/* Conditional DNB return */
double dPoissionMean1= exp(dMuTrue +vSeasonTrue[i]+ vXTrue[i]) * gsl_ran_gamma(r, dNuTrue, 1/dNuTrue);
double dPoissionMean2= exp(dMuTrue +vSeasonTrue[i]+vXTrue[i]) * gsl_ran_gamma(r, dNuTrue, 1/dNuTrue);
int iDNB =gsl_ran_poisson(r,dPoissionMean1) - gsl_ran_poisson(r,dPoissionMean2) ;
double dU=gsl_rng_uniform(r);
if(dU<=dGammaTrue)
{
vData[i]=0;
}
else
{
vData[i]=iDNB;
}
cout << "Data at "<< i<<" is " << vData[i]<< endl;
}
gsl_rng_free(r);
return;
}
void MCMC::ImportData(string sFile)
{
vector<vector<double> > mData;
sInput=sFile;
fstream ifsDataFile;
ifsDataFile.open(sFile.c_str(), ios::in);
if(!ifsDataFile.is_open()){
cerr << "Cannot open the file" << endl;
return;
}
string line;
iNumOfObs=0;
while ( getline (ifsDataFile,line) )
{
vector<double>vRow;
// cout << line << '\n';
stringstream ssLine(line);
string var;
char* end;
while(getline(ssLine, var,',') )
{
vRow.push_back(strtod( var.c_str() ,&end) );
}
mData.push_back(vRow);
iNumOfObs=iNumOfObs+1;
vRow.clear();
}
ifsDataFile.close();
vTimes = new double[iNumOfObs];
vData = new double[iNumOfObs];
int k=0;
for(vector<vector<double> >::iterator i=mData.begin(); i != mData.end(); ++i)
{
vTimes[k]= (*i)[0];
vData[k]= (*i)[1];
cout<<"vData at "<<k<<" is "<<vData[k]<<endl;
k=k+1;
}
cout <<"The number of observations is: "<<iNumOfObs<<endl;
}
void MCMC::ImportData2(string sPath, string sFile)
{
vector<vector<double> > mData;
sInput=sFile;
string sAddress;
sAddress = sPath + sFile;
fstream ifsDataFile;
// ifsDataFile.open(sFile.c_str(), ios::in);
ifsDataFile.open(sAddress.c_str(), ios::in);
if(!ifsDataFile.is_open()){
cerr << "Cannot open the file" << endl;
return;
}
string line;
iNumOfObs=0;
while ( getline (ifsDataFile,line) )
{
vector<double>vRow;
// cout << line << '\n';
stringstream ssLine(line);
string var;
char* end;
while(getline(ssLine, var,',') )
{
vRow.push_back(strtod( var.c_str() ,&end) );
}
mData.push_back(vRow);
iNumOfObs=iNumOfObs+1;
vRow.clear();
}
ifsDataFile.close();
vTimes = new double[iNumOfObs];
vData = new double[iNumOfObs];
int k=0;
for(vector<vector<double> >::iterator i=mData.begin(); i != mData.end(); ++i)
{
vTimes[k]= (*i)[0];
vData[k]= (*i)[1];
cout<<"vData at "<<k<<" is "<<vData[k]<<endl;
k=k+1;
}
cout <<"The number of observations is: "<<iNumOfObs<<endl;
}
void MCMC::ExportSimulatedData()
{
fstream ofsData;
ofsData.open("SimulatedData.csv", ios::out);
if(!ofsData.is_open()){
cerr << "Cannot open the file" << endl;
return;
}
for(int i=0; i< iNumOfObs; ++i){
ofsData << vData[i] << " , "<< vTimes[i]<< endl;
}
ofsData.close();
fstream ofsLogInt;
ofsLogInt.open("SimulatedLogInt.csv", ios::out);
if(!ofsLogInt.is_open()){
cerr << "Cannot open the file" << endl;
return;
}
for(int i=0; i< iNumOfObs; ++i){
ofsLogInt << vXTrue[i] << endl;
}
ofsLogInt.close();
return;
}
void MCMC::ExportSimulatedData2(string sType)
{
string sPrefix;
CreatPrefix(sInput,sType, &sPrefix );
/* mkdir("OutPut",S_IRWXU|S_IRGRP|S_IXGRP);
fstream ofsData;
ofsData.open(("OutPut/"+sFile).c_str(), ios::out); */
/* fstream ofsData;
ofsData.open((sPrefix+"SimulatedData.csv").c_str(), ios::out); */
mkdir("OutPut",S_IRWXU|S_IRGRP|S_IXGRP);
fstream ofsData;
ofsData.open(("OutPut/"+sPrefix+"SimulatedData.csv").c_str(), ios::out);
if(!ofsData.is_open()){
cerr << "Cannot open the file" << endl;
return;
}
for(int i=0; i< iNumOfObs; ++i){
ofsData << vData[i] << " , "<< vTimes[i]<< endl;
}
ofsData.close();
fstream ofsLogInt;
ofsLogInt.open((sPrefix+"SimulatedLogInt.csv").c_str(), ios::out);
if(!ofsLogInt.is_open()){
cerr << "Cannot open the file" << endl;
return;
}
for(int i=0; i< iNumOfObs; ++i){
ofsLogInt << vXTrue[i] << endl;
}
ofsLogInt.close();
return;
}
void MCMC::ExportEstimationResults()
{
string sPrefix;
CreatPrefix(sInput,sType, &sPrefix );
/* mkdir("OutPut",S_IRWXU|S_IRGRP|S_IXGRP);
fstream ofsData;
ofsData.open(("OutPut/"+sFile).c_str(), ios::out); */
/* fstream ofsData;
ofsData.open((sPrefix+"EstimationResults.csv").c_str(), ios::out); */
mkdir("OutPut",S_IRWXU|S_IRGRP|S_IXGRP);
fstream ofsData;
ofsData.open(("OutPut/"+sPrefix+"EstimationResults.csv").c_str(), ios::out);
if(!ofsData.is_open()){
cerr << " ExportEstimationResults Error: Cannot open the file" << endl;
return;
}
for(vector<vector<double> >::iterator i=mChain.begin(); i != mChain.end(); ++i){
for(vector<double>::iterator j= i->begin(); j != i -> end(); ++j){
if(j==i->end()-1)
{
ofsData << *j << endl;
}
else
{
ofsData << *j << ",";
}
}
}
ofsData.close();
}
void MCMC::EstimateSkellam( int iNumOfIter, int iBurnIn)
{
sType="Sk";
CreatPrefix(sInput,sType, &sPrefix );
cout<< "prefix done" <<endl;
/* Initialize parameters and latent variables */
const gsl_rng_type * T;
gsl_rng * gsl_random_num;
T=gsl_rng_default;
gsl_random_num=gsl_rng_alloc(T);
gsl_rng_set(gsl_random_num, 41);
double* vZeroSkellamDens = new double[iNumOfObs];
double* vSkellamDens = new double[iNumOfObs];
double* vLogBessel = new double[iNumOfObs];
double* vIndicator = new double[iNumOfObs];
double* dCovar = new double;
double* dSum=new double;
double* mCovar = new double[4];
double* mSum=new double[2];
mCovar[0]=0;
mCovar[1]=0;
mCovar[2]=0;
mCovar[3]=0;
mSum[0]=0;
mSum[1]=0;
dCovar[0]=0;
dSum[0]=0;
/* Initialize Parameters*/
AllParam sParam;
sParam.dMu=new double;
sParam.iNumOfObs=new int;
sParam.dPhi=new double;
sParam.dSigma2=new double;
sParam.dGamma=new double;
sParam.dPriorGammaA=new double;
sParam.dPriorGammaB=new double;
sParam.dPriorMuMean=new double;
sParam.dPriorMuSigma2=new double;
sParam.dPriorPhiA=new double;
sParam.dPriorPhiB=new double;
sParam.dPriorSigmaA=new double;
sParam.dPriorSigmaB=new double;
sParam.dPriorSeasonalMean=new double;
sParam.dPriorSeasonalVar=new double;
sParam.vX=new double [iNumOfObs];
sParam.vS=new double [iNumOfObs];
sParam.vN = new int [iNumOfObs];
sParam.vTau1= new double[iNumOfObs];
sParam.vTau2= new double[iNumOfObs];
sParam.mAuxY=new double[2*iNumOfObs];
sParam.mAuxH=new double[4*iNumOfObs];
sParam.iNumOfObs[0]=iNumOfObs;
sParam.dMu[0]=0;
sParam.dPhi[0]=0.95;
sParam.dSigma2[0]=0.01;
sParam.dGamma[0]=0.3;
// sParam.dGamma[0]=0;
// sParam.dMu[0]=2;
// sParam.dPhi[0]=0.90;
// sParam.dSigma2[0]=0.5;
// sParam.dGamma[0]=0.2;
sParam.dPriorGammaA[0]=1.7;
sParam.dPriorGammaB[0]=10;
sParam.dPriorMuMean[0]=0;
sParam.dPriorMuSigma2[0]=1;
sParam.dPriorPhiA[0]=20;
sParam.dPriorPhiB[0]=1.5;
sParam.dPriorSigmaA[0]=2.5;
sParam.dPriorSigmaB[0]=1/0.025;
sParam.dPriorSeasonalMean[0]=0;
sParam.dPriorSeasonalVar[0]=1;
for(int i=0; i<iNumOfObs; i++)
{
// sParam.vS[i]=vSeasonTrue[i];
// sParam.vX[i]=vXTrue[i];
// sParam.vS[i]=vSeasonTrue[i];
// sParam.vX[i]=vXTrue[i];
// sParam.vN[i]=vNTrue[i];
// sParam.vTau1[i]=vTau1True[i];
// sParam.vTau2[i]=vTau2True[i];
}
/*Initializing the iteration*/
time_t start,end;
time (&start);
double * vLogIntEst=new double[iNumOfObs];
double * vXEst=new double[iNumOfObs];
double * vSeasonEst=new double[iNumOfObs];
double * vLambdaEst=new double[iNumOfObs];
double * vVolEst=new double[iNumOfObs];
double * vX2Est=new double[iNumOfObs];
double * vSeason2Est=new double[iNumOfObs];
double * vVol2Est=new double[iNumOfObs];
double * vXVolEst=new double[iNumOfObs];
double * vSeasonVolEst=new double[iNumOfObs];
double * vVolVolEst=new double[iNumOfObs];
for(int j=0; j<iNumOfObs;j++)
{
vXEst[j]=0;
vSeasonEst[j]=0;
vVolEst[j]=0;
vX2Est[j]=0;
vSeason2Est[j]=0;
vVol2Est[j]=0;
vLogIntEst[j]=0;
vLambdaEst[j]=0;
vXVolEst[j]=0;
vSeasonVolEst[j]=0;
vVolVolEst[j]=0;
}
// double * mXDraws=new double[iNumOfObs*iNumOfIter];
// double * mNDraws=new double[iNumOfObs*iNumOfIter];
// double * mSeasonDraws=new double[iNumOfObs*iNumOfIter];
// double * mLogIntDraws=new double[iNumOfObs*iNumOfIter];
// double * mTau1Draws=new double[iNumOfObs*iNumOfIter];
// double * mTau2Draws=new double[iNumOfObs*iNumOfIter];
// string svYTrueFile="mYTrue.csv";
// WriteOutDoubleArray( vData , iNumOfObs, 1, svYTrueFile);
int iNumOfKnots=3;
double * vKnots= new double[iNumOfKnots];
// vKnots[0]=0; /* 9.30 */
// vKnots[1]=5400; /* 11 */
// vKnots[2]=10800; /* 12.30 */
// vKnots[3]=18000;/* 14.30 */
// vKnots[iNumOfKnots-1]=23400; /* 16.00 */
// vKnots[0]=300; /* 9.35 */
// vKnots[1]=5400; /* 11 */
// vKnots[2]=10800; /* 12.30 */
// vKnots[3]=18000;/* 14.30 */
// vKnots[iNumOfKnots-1]=23100; /* 15.55 */
// vKnots[0]=300; /* 9.35 */
// vKnots[1]=1800;
// vKnots[2]=3800;
// vKnots[3]=5400; /* 11 */
// vKnots[4]=6700;
// vKnots[5]=8500;
// vKnots[6]=10800; /* 12.30 */
// vKnots[7]=14000;
// vKnots[8]=18000;/* 14.30 */
// vKnots[9]=20000;
// vKnots[iNumOfKnots-1]=23100; /* 15.55 */
// vKnots[0]=300; /* 9.35 */
// vKnots[1]=23100; /* 15.55 */
vKnots[0]=0; /* 9.30 */
vKnots[1]=10800; /* 12.30 */
vKnots[2]=23400; /* 16.00 */
cout<<"iNumOfKnots "<<iNumOfKnots<<endl;
// vKnots[0]=0; /* 9.30 */
// vKnots[1]=10800;
// vKnots[2]=23400; /* 16.00 */
sParam.vBeta=new double [iNumOfKnots-1];
for(int k=0; k<iNumOfKnots-1; k++)
{
sParam.vBeta[k]=0;
}
gsl_matrix * mWTilde = gsl_matrix_alloc (iNumOfObs, iNumOfKnots-1);
CalculateSplineMatrices(iNumOfObs, vTimes, iNumOfKnots, vKnots, mWTilde );
double * vInitialLogVol=new double[iNumOfObs];
CalculateInitialLogVol(vData, vTimes, iNumOfObs, 50, vInitialLogVol);
CalculateInitialState(sParam, vInitialLogVol, iNumOfObs, iNumOfKnots, mWTilde );
sParam.iNumOfKnots=new int;
sParam.iNumOfKnots[0]=iNumOfKnots;
sParam.W=new gsl_matrix;
sParam.W=mWTilde;
// string svInitLogIntFile="vInitialLogVol.csv";
// WriteOutDoubleArray( vInitialLogVol, iNumOfObs, 1, svInitLogIntFile);
// string svInitSFile="vInitS.csv";
// WriteOutDoubleArray( sParam.vS, iNumOfObs, 1, svInitSFile);
// string svInitXFile="vInitX.csv";
// WriteOutDoubleArray( sParam.vX, iNumOfObs, 1, svInitXFile);
double * mMarkerXLow=new double [iNumOfObs*5];
double * mMarkerSLow=new double [iNumOfObs*5];
double * mMarkerVolLow=new double [iNumOfObs*5];
double * mMarkerXHigh=new double [iNumOfObs*5];
double * mMarkerSHigh=new double [iNumOfObs*5];
double * mMarkerVolHigh=new double [iNumOfObs*5];
double * mNXLow=new double [iNumOfObs*5];
double * mNSLow=new double [iNumOfObs*5];
double * mNVolLow=new double [iNumOfObs*5];
double * mNXHigh=new double [iNumOfObs*5];
double * mNSHigh=new double [iNumOfObs*5];
double * mNVolHigh=new double [iNumOfObs*5];
double * mNDXLow=new double [iNumOfObs*5];
double * mNDSLow=new double [iNumOfObs*5];
double * mNDVolLow=new double [iNumOfObs*5];
double * mNDXHigh=new double [iNumOfObs*5];
double * mNDSHigh=new double [iNumOfObs*5];
double * mNDVolHigh=new double [iNumOfObs*5];
double * vVol=new double [iNumOfObs];
cout<<"start"<<endl;
for( int i=0; i<iNumOfIter; i++)
{
cout <<"==== Iteration: " << i << " ===="<< endl;
CaculateSkellam(vData,iNumOfObs, sParam, vZeroSkellamDens,vIndicator, vSkellamDens,vLogBessel);
cout<<"Skellam Done "<<endl;
// /*Draw N, Tau1, Tau2, S */
// DrawAuxVariables(i, vData, iNumOfObs, sParam, vZeroSkellamDens);
/*Draw N */
DrawN( sParam, vData, iNumOfObs , gsl_random_num, vZeroSkellamDens,vLogBessel );
cout<<"N Done "<<endl;
/*Draw Tau1, Tau2 */
DrawTau( sParam, iNumOfObs , gsl_random_num);
cout<<"Tau Done "<<endl;
/*Draw AuxY AuxH*/
DrawAuxYandAuxH(sParam, iNumOfObs , gsl_random_num);
cout<<"Aux Done "<<endl;
/* Draw Gamma */
// DrawGammaLaplaceApprox(iNumOfObs, gsl_random_num, sParam,vIndicator, vSkellamDens );
DrawGammaAdaptiveRW( iNumOfObs,i, gsl_random_num, sParam,vIndicator, vSkellamDens, dCovar, dSum );
cout << "dGamma " << sParam.dGamma[0] << endl;
/*Draw Seasonal*/
// DrawSesonal(sParam, iNumOfObs, iNumOfKnots,mWTilde ,gsl_random_num);
/*Draw Phi, Sigma2*/
// DrawPhiSigmaFullConditional( sParam, iNumOfObs, gsl_random_num );
// DrawPhiSigmaLaplaceApprox( sParam, iNumOfObs, gsl_random_num );
// DrawPhiSigmaLaplaceApproxWithSeasonal( sParam, iNumOfObs, gsl_random_num );
DrawPhiSigmaAdaptiveRWWithSeasonal( iNumOfKnots, mWTilde,sParam, iNumOfObs, i , gsl_random_num, mCovar, mSum );
// DrawPhiSigmaLaplaceApproxSGD( sParam, iNumOfObs, gsl_random_num );
// DrawPhiSigmaAdaptiveRW( sParam, iNumOfObs, i , gsl_random_num, mCovar, mSum );
cout << "dPhi " << sParam.dPhi[0] << endl;
cout << "dSigma " << sParam.dSigma2[0] << endl;
/*Draw X, Mu*/
// DrawXandMu(sParam,iNumOfObs, gsl_random_num );
DrawXandMuWithSeasonal(iNumOfKnots, mWTilde, sParam,iNumOfObs, gsl_random_num );
cout << "dMu " << sParam.dMu[0] << endl;
if(i>=iBurnIn)
{
for(int k=0; k<iNumOfObs; k++)
{
vVol[k]=sqrt((1-sParam.dGamma[0])*2*exp((sParam.dMu[0]+sParam.vS[k]+sParam.vX[k])));
}
if(i<iBurnIn+5)
{
for(int k=0; k<iNumOfObs; k++)
{
mMarkerXLow[k*5+i-iBurnIn]=sParam.vX[k];
mMarkerSLow[k*5+i-iBurnIn]=sParam.vS[k];;
mMarkerVolLow[k*5+i-iBurnIn]=vVol[k];
mMarkerXHigh[k*5+i-iBurnIn]=sParam.vX[k];
mMarkerSHigh[k*5+i-iBurnIn]=sParam.vS[k];;
mMarkerVolHigh[k*5+i-iBurnIn]=vVol[k];
}
}
else
{
if(i==iBurnIn+5)
{
InitializeQuantilePPAlgo(iNumOfObs, 0.05, mMarkerXLow, mNXLow , mNDXLow);
InitializeQuantilePPAlgo(iNumOfObs, 0.05, mMarkerSLow, mNSLow , mNDSLow);
InitializeQuantilePPAlgo(iNumOfObs, 0.05, mMarkerVolLow, mNVolLow , mNDVolLow);
InitializeQuantilePPAlgo(iNumOfObs, 0.95, mMarkerXHigh, mNXHigh , mNDXHigh);
InitializeQuantilePPAlgo(iNumOfObs, 0.95, mMarkerSHigh, mNSHigh , mNDSHigh);
InitializeQuantilePPAlgo(iNumOfObs, 0.95, mMarkerVolHigh, mNVolHigh , mNDVolHigh);
}
QuantilePPAlgo(iNumOfObs, 0.05,sParam.vX, mMarkerXLow, mNXLow , mNDXLow);
QuantilePPAlgo(iNumOfObs, 0.05, sParam.vS, mMarkerSLow, mNSLow , mNDSLow);
QuantilePPAlgo(iNumOfObs, 0.05,vVol, mMarkerVolLow, mNVolLow , mNDVolLow);
QuantilePPAlgo(iNumOfObs, 0.95,sParam.vX, mMarkerXHigh, mNXHigh , mNDXHigh);
QuantilePPAlgo(iNumOfObs, 0.95,sParam.vS, mMarkerSHigh, mNSHigh , mNDSHigh);
QuantilePPAlgo(iNumOfObs, 0.95,vVol, mMarkerVolHigh, mNVolHigh , mNDVolHigh);
}
// SequentialStore(i-iBurnIn, iNumOfIter-iBurnIn,iNumOfObs, sParam.vX , Xfs, sPrefix+sXDraw);
// SequentialStore(i-iBurnIn, iNumOfIter-iBurnIn,iNumOfObs, sParam.vS , Sfs, sPrefix+sSDraw);
for(int j=0; j<iNumOfObs;j++)
{
vXEst[j]=vXEst[j]+(sParam.vX[j])/(iNumOfIter-iBurnIn);
vSeasonEst[j]=vSeasonEst[j]+(sParam.vS[j])/(iNumOfIter-iBurnIn);
vVolEst[j]=vVolEst[j]+vVol[j]/(iNumOfIter-iBurnIn);
vLogIntEst[j]=vLogIntEst[j]+(sParam.dMu[0]+sParam.vS[j]+sParam.vX[j])/(iNumOfIter-iBurnIn);
vX2Est[j]=vX2Est[j]+sParam.vX[j]*sParam.vX[j]/(iNumOfIter-iBurnIn);
vSeason2Est[j]=vSeason2Est[j]+sParam.vS[j]*sParam.vS[j]/(iNumOfIter-iBurnIn);
vVol2Est[j]=vVol2Est[j]+vVol[j]*vVol[j]/(iNumOfIter-iBurnIn);
}
}
/*Save new draws */
vector<double> vTempRow;
vTempRow.push_back(sParam.dMu[0]);
vTempRow.push_back(sParam.dPhi[0]);
vTempRow.push_back(sParam.dSigma2[0]);
vTempRow.push_back(sParam.dGamma[0]);
for(int k=0; k<iNumOfKnots-1; k++)
{
vTempRow.push_back(sParam.vBeta[k]);
}
mChain.push_back(vTempRow);
}
time (&end);
double dif = difftime (end,start);
printf ("Elapsed time is %.2lf seconds. \n", dif );
FILE * pFile;
pFile = fopen ("Sk_time.txt","w");
fprintf (pFile, "Skellman time = %16.4f s\n",dif);
fclose (pFile);
for(int j=0; j<iNumOfObs;j++)
{
vXVolEst[j]=vX2Est[j]-vXEst[j]*vXEst[j];
vSeasonVolEst[j]=vSeason2Est[j]-vSeasonEst[j]*vSeasonEst[j];
vVolVolEst[j]=vVol2Est[j]-vVolEst[j]*vVolEst[j];
}
// string sXTrueFile="vXTrue.csv";
// WriteOutDoubleArray(vXTrue, iNumOfObs, 1, sXTrueFile);
string sXEstFile="vXEst.csv";
WriteOutDoubleArray( vXEst , iNumOfObs, 1, sPrefix+sXEstFile);
cout<<"X Est Saved!"<<endl;
// string sLogIntTrueFile="vLogIntTrue.csv";
// WriteOutDoubleArray(vLogIntTrue, iNumOfObs, 1, sLogIntTrueFile);
string sLogIntEstFile="vLogIntEst.csv";
WriteOutDoubleArray( vLogIntEst , iNumOfObs, 1, sPrefix+sLogIntEstFile);
cout<<"LogInt Est Saved!"<<endl;
string sSeasonEstFile="vSeasonEst.csv";
WriteOutDoubleArray( vSeasonEst , iNumOfObs, 1, sPrefix+sSeasonEstFile);
cout<<"Season Est Saved!"<<endl;
// string sYStarTrueFile="vYStarTrue.csv";
// WriteOutDoubleArray( vYStarTrue , iNumOfObs, 1, sYStarTrueFile);
//
// string sLambdaTrueFile="vLambdaTrue.csv";
// WriteOutDoubleArray( vLambdaTrue , iNumOfObs, 1, sLambdaTrueFile);
string sVolEstFile="vVolEst.csv";
WriteOutDoubleArray( vVolEst , iNumOfObs, 1, sPrefix+sVolEstFile);
cout<<"Vol Est Saved!"<<endl;
string sXLowFile="vXLow.csv";
WriteOutDoubleArray( mMarkerXLow, iNumOfObs, 5, sPrefix+sXLowFile);
cout<<"X Low Saved!"<<endl;
string sXHighFile="vXHigh.csv";
WriteOutDoubleArray( mMarkerXHigh, iNumOfObs, 5, sPrefix+sXHighFile);
cout<<"X High Saved!"<<endl;
string sSLowFile="vSLow.csv";
WriteOutDoubleArray( mMarkerSLow, iNumOfObs, 5, sPrefix+sSLowFile);
cout<<"S Low Saved!"<<endl;
string sSHighFile="vSHigh.csv";
WriteOutDoubleArray( mMarkerSHigh, iNumOfObs, 5, sPrefix+sSHighFile);
cout<<"S High Saved!"<<endl;
string sVolLowFile="vVolLow.csv";
WriteOutDoubleArray( mMarkerVolLow, iNumOfObs, 5, sPrefix+sVolLowFile);
cout<<"Vol Low Saved!"<<endl;
string sVolHighFile="vVolHigh.csv";
WriteOutDoubleArray( mMarkerVolHigh, iNumOfObs, 5, sPrefix+sVolHighFile);
cout<<"Vol High Saved!"<<endl;
string sXVolFile="vXVol.csv";
WriteOutDoubleArray( vXVolEst, iNumOfObs, 1, sPrefix+sXVolFile);
cout<<"X Vol Saved!"<<endl;
string sSVolFile="vSVol.csv";
WriteOutDoubleArray( vSeasonVolEst, iNumOfObs, 1, sPrefix+sSVolFile);
cout<<"S Vol Saved!"<<endl;
string sVolVolFile="vVolVol.csv";
WriteOutDoubleArray( vVolVolEst, iNumOfObs, 1, sPrefix+sVolVolFile);
cout<<"Vol Vol Saved!"<<endl;
cout <<"Write out done"<<endl;
cout <<"Write out done"<<endl;
delete [] vZeroSkellamDens;
delete [] vIndicator;
delete [] vLogBessel;
delete [] vSkellamDens;
delete [] sParam.vX;
delete [] sParam.vBeta;
delete [] sParam.vS;
delete [] sParam.vN;
delete [] sParam.vTau1;
delete [] sParam.vTau2;
delete [] sParam.mAuxY;
delete [] sParam.mAuxH;
delete [] vLogIntEst;
delete [] vXEst;
delete [] vSeasonEst;
delete [] vVolEst;
delete [] vX2Est;
delete [] vSeason2Est;
delete [] vVol2Est;
delete [] vXVolEst;
delete [] vSeasonVolEst;
delete [] vVolVolEst;
delete [] mMarkerXLow;
delete [] mMarkerSLow;
delete [] mMarkerVolLow;
delete [] mMarkerXHigh;
delete [] mMarkerSHigh;
delete [] mMarkerVolHigh;
delete [] mNXLow;
delete [] mNSLow;
delete [] mNVolLow;
delete [] mNXHigh;
delete [] mNSHigh;
delete [] mNVolHigh;
delete [] vVol;
delete [] mNDXLow;
delete [] mNDSLow;
delete [] mNDVolLow;
delete [] mNDXHigh;
delete [] mNDSHigh;
delete [] mNDVolHigh;
delete [] vKnots;
delete dCovar;
delete dSum;
delete [] mCovar;
delete [] mSum;
delete sParam.iNumOfObs;
delete sParam.dMu;
delete sParam.dPhi;
delete sParam.dSigma2;
delete sParam.dGamma;
delete sParam.dPriorGammaA;
delete sParam.dPriorGammaB;
delete sParam.dPriorMuMean;
delete sParam.dPriorMuSigma2;
delete sParam.dPriorPhiA;
delete sParam.dPriorPhiB;
delete sParam.dPriorSigmaA;
delete sParam.dPriorSigmaB;
cout <<"Clear memory done"<<endl;
}
void MCMC::EstimateDNB(int iNumOfIter, int iBurnIn)
{
sType="DNB";
CreatPrefix(sInput,sType, &sPrefix );
cout<< "prefix done" <<endl;
/* Initialize parameters and latent variables */
const gsl_rng_type * T;
gsl_rng * gsl_random_num;
T=gsl_rng_default;
gsl_random_num=gsl_rng_alloc(T);
gsl_rng_set(gsl_random_num, 50);
double* vZeroDNBDens = new double[iNumOfObs];
double* vDNBDens = new double[iNumOfObs];
double* vIndicator = new double[iNumOfObs];
double* vLogSkellamZ = new double[iNumOfObs];
double* dCovarNu = new double;
double* dSumNu=new double;
double* dCovarGamma = new double;
double* dSumGamma=new double;
double* mCovar = new double[4];
double* mSum=new double[2];
mCovar[0]=0;
mCovar[1]=0;
mCovar[2]=0;
mCovar[3]=0;
mSum[0]=0;
mSum[1]=0;
dCovarGamma[0]=0;
dSumGamma[0]=0;
dCovarNu[0]=0;
dSumNu[0]=0;
/* Initialize Parameters*/
AllParam sParam;
sParam.dMu=new double;
sParam.dNu=new double;
sParam.iNumOfObs=new int;
sParam.dPhi=new double;
sParam.dSigma2=new double;
sParam.dGamma=new double;
sParam.dPriorGammaA=new double;
sParam.dPriorGammaB=new double;
sParam.dPriorNuA=new double;
sParam.dPriorNuB=new double;
sParam.dPriorMuMean=new double;
sParam.dPriorMuSigma2=new double;
sParam.dPriorPhiA=new double;
sParam.dPriorPhiB=new double;
sParam.dPriorSigmaA=new double;
sParam.dPriorSigmaB=new double;
sParam.dPriorSeasonalMean=new double;
sParam.dPriorSeasonalVar=new double;
sParam.vS=new double [iNumOfObs];
sParam.vX=new double [iNumOfObs];
sParam.vZ1=new double [iNumOfObs];
sParam.vZ2=new double [iNumOfObs];
sParam.vN = new int [iNumOfObs];
sParam.vTau1= new double[iNumOfObs];
sParam.vTau2= new double[iNumOfObs];
sParam.mAuxY=new double[2*iNumOfObs];
sParam.mAuxH=new double[4*iNumOfObs];
sParam.iNumOfObs[0]=iNumOfObs;
if (sInput.empty())
{
cout << "Initials for the simulation" << endl;
sParam.dMu[0]= -1.5; // 0;
sParam.dPhi[0]= 0.97; // 0.95;
sParam.dSigma2[0]= 0.02; //0.01;
sParam.dGamma[0]= 0.01; //0.3;
// sParam.dGamma[0]=0;
sParam.dNu[0]=15; //20;
}
else
{
cout << "Initials for the empirical" << endl;
sParam.dMu[0]=0;
sParam.dPhi[0]=0.95;
sParam.dSigma2[0]=0.01;
sParam.dGamma[0]=0.3;
// sParam.dGamma[0]=0;
sParam.dNu[0]=20;
}
// sParam.dMu[0]=2.5;
// sParam.dPhi[0]=0.90;
// sParam.dSigma2[0]=0.5;
// sParam.dGamma[0]=0.2;
// sParam.dNu[0]=8;
sParam.dPriorGammaA[0]=1.7;
sParam.dPriorGammaB[0]=10;
sParam.dPriorNuA[0]=9;
sParam.dPriorNuB[0]=1.5;
sParam.dPriorMuMean[0]=0;
sParam.dPriorMuSigma2[0]=1;
sParam.dPriorPhiA[0]=20;
sParam.dPriorPhiB[0]=1.5;
sParam.dPriorSigmaA[0]=2.5;
sParam.dPriorSigmaB[0]=1/0.025;
sParam.dPriorSeasonalMean[0]=0;
sParam.dPriorSeasonalVar[0]=1;
for(int i=0; i<iNumOfObs; i++)
{
// sParam.vX[i]=vXTrue[i];
sParam.vZ1[i]=0.95;
sParam.vZ2[i]=1.05;
}
/*Initializing the iteration*/
time_t start,end;
time (&start);
double * vLogIntEst=new double[iNumOfObs];
double * vXEst=new double[iNumOfObs];
double * vSeasonEst=new double[iNumOfObs];
double * vLambdaEst=new double[iNumOfObs];
double * vVolEst=new double[iNumOfObs];
double * vX2Est=new double[iNumOfObs];
double * vSeason2Est=new double[iNumOfObs];
double * vVol2Est=new double[iNumOfObs];
double * vXVolEst=new double[iNumOfObs];
double * vSeasonVolEst=new double[iNumOfObs];
double * vVolVolEst=new double[iNumOfObs];
for(int j=0; j<iNumOfObs;j++)
{
vXEst[j]=0;
vSeasonEst[j]=0;
vVolEst[j]=0;
vX2Est[j]=0;
vSeason2Est[j]=0;
vVol2Est[j]=0;
vLogIntEst[j]=0;
vLambdaEst[j]=0;
vXVolEst[j]=0;
vSeasonVolEst[j]=0;
vVolVolEst[j]=0;
}
// double * mXDraws=new double[iNumOfObs*iNumOfIter];
/////////////////////////////////////
//// KNOTS AND BETAS /////////////////
/////////////////////////////////////
int iNumOfKnots=3;
double * vKnots= new double[iNumOfKnots];
// vKnots[0]=0; /* 9.30 */
// vKnots[1]=5400; /* 11 */
// vKnots[2]=10800; /* 12.30 */
// vKnots[3]=18000;/* 14.30 */
// vKnots[iNumOfKnots-1]=23400; /* 16.00 */
// vKnots[0]=300; /* 9.35 */
// vKnots[1]=5400; /* 11 */
// vKnots[2]=10800; /* 12.30 */
// vKnots[3]=18000;/* 14.30 */
// vKnots[iNumOfKnots-1]=23100; /* 15.55 */
// vKnots[0]=300; /* 9.35 */
// vKnots[1]=23100; /* 15.55 */
vKnots[0]=0; /* 9.30 */
vKnots[1]=10800; /* 12.30 */
vKnots[2]=23400; /* 16.00 */
sParam.vBeta=new double [iNumOfKnots-1];
for(int k=0; k<iNumOfKnots-1; k++)
{
sParam.vBeta[k]=0;
}
gsl_matrix * mWTilde = gsl_matrix_alloc (iNumOfObs, iNumOfKnots-1);
CalculateSplineMatrices(iNumOfObs, vTimes, iNumOfKnots, vKnots, mWTilde );
double * vInitialLogVol=new double[iNumOfObs];
CalculateInitialLogVol(vData, vTimes, iNumOfObs, 50, vInitialLogVol);
CalculateInitialState(sParam, vInitialLogVol, iNumOfObs, iNumOfKnots, mWTilde );
sParam.iNumOfKnots=new int;
sParam.iNumOfKnots[0]=iNumOfKnots;
sParam.W=new gsl_matrix;
sParam.W=mWTilde;
double * mMarkerXLow=new double [iNumOfObs*5];
double * mMarkerSLow=new double [iNumOfObs*5];
double * mMarkerVolLow=new double [iNumOfObs*5];
double * mMarkerXHigh=new double [iNumOfObs*5];
double * mMarkerSHigh=new double [iNumOfObs*5];
double * mMarkerVolHigh=new double [iNumOfObs*5];
double * mNXLow=new double [iNumOfObs*5];
double * mNSLow=new double [iNumOfObs*5];
double * mNVolLow=new double [iNumOfObs*5];
double * mNXHigh=new double [iNumOfObs*5];
double * mNSHigh=new double [iNumOfObs*5];
double * mNVolHigh=new double [iNumOfObs*5];
double * mNDXLow=new double [iNumOfObs*5];
double * mNDSLow=new double [iNumOfObs*5];
double * mNDVolLow=new double [iNumOfObs*5];
double * mNDXHigh=new double [iNumOfObs*5];
double * mNDSHigh=new double [iNumOfObs*5];
double * mNDVolHigh=new double [iNumOfObs*5];
double * vVol=new double [iNumOfObs];
// cout<<"hyper Geo " <<HyperGeo(5, -300, 10, 0.5)<<endl;
/////////////////////////////////////
/*MCMC Iterations*/
/////////////////////////////////////
for( int i=0; i<iNumOfIter; i++)
{
cout <<"==== Iteration: " << i << " ===="<< endl;
/* Draw Nu */
// DrawNuAdaptiveRWDNB(iNumOfObs, i, gsl_random_num, sParam, dCovarNu, dSumNu );
// DrawNuLaplaceApproxDNB(sParam , iNumOfObs, gsl_random_num);
// DrawNuDiscreteDNB(sParam , iNumOfObs, gsl_random_num, 0.025,0.05);
DrawNuInBlockDiscreteDNB(vData, sParam , iNumOfObs, gsl_random_num, 0.2,3);
cout << "dNu " << sParam.dNu[0] << endl;
/* Calculate DNB */
CaculateDNB( vData, iNumOfObs, sParam, vDNBDens, vZeroDNBDens,vIndicator);
cout<<"Calculate DNB Done!"<<endl;
/*Draw Z1, Z2, N, Tau1, Tau2, S */
/*Draw Z1, Z2 */
if (i==2040)
{
DrawZ_debug(sParam, vData, iNumOfObs , gsl_random_num,vIndicator, vLogSkellamZ);
}
else
{
DrawZ(sParam, vData, iNumOfObs , gsl_random_num,vIndicator, vLogSkellamZ);
}
cout<<"DrawZ Done!"<<endl;
/*Draw N */
DrawNDNB( sParam, vData, iNumOfObs , gsl_random_num, vLogSkellamZ );
cout<<"DrawN Done!"<<endl;
/*Draw Tau1, Tau2 */
DrawTauDNB( sParam, iNumOfObs , gsl_random_num);
cout<<"DrawTau Done!"<<endl;
/*Draw S */
DrawAuxYandAuxHDNB(sParam, iNumOfObs , gsl_random_num);
cout<<"Draw Aux Done!"<<endl;
/*Draw Seasonal*/
// DrawSesonal(sParam, iNumOfObs, iNumOfKnots,mWTilde ,gsl_random_num);
/* Draw Gamma */
DrawGammaAdaptiveRWDNB( iNumOfObs,i, gsl_random_num, sParam,vIndicator, vDNBDens, dCovarGamma, dSumGamma );
cout << "dGamma " << sParam.dGamma[0] << endl;
/* Draw Phi, Sigma2 THIS IS COMPLETLY THE SAME AS SKELLAM */
// DrawPhiSigmaFullConditional( sParam, iNumOfObs, gsl_random_num );
// DrawPhiSigmaLaplaceApprox( sParam, iNumOfObs, gsl_random_num );
// DrawPhiSigmaLaplaceApproxWithSeasonal( sParam, iNumOfObs, gsl_random_num );
// DrawPhiSigmaLaplaceApproxSGD( sParam, iNumOfObs, gsl_random_num );
// DrawPhiSigmaAdaptiveRW( sParam, iNumOfObs, i , gsl_random_num, mCovar, mSum );
DrawPhiSigmaAdaptiveRWWithSeasonal( iNumOfKnots, mWTilde,sParam, iNumOfObs, i , gsl_random_num, mCovar, mSum );
cout << "dPhi " << sParam.dPhi[0]<< endl;
cout << "dSigma " << sParam.dSigma2[0] << endl;
/* Draw X, Mu THIS IS COMPLETLY THE SAME AS SKELLAM */
// DrawXandMu(sParam,iNumOfObs, gsl_random_num );
DrawXandMuWithSeasonal(iNumOfKnots, mWTilde, sParam,iNumOfObs, gsl_random_num );
// cout << "dMu " << sParam.dMu[0] << endl;
if(i>=iBurnIn)
{
for(int k=0; k<iNumOfObs; k++)
{
vVol[k]=sqrt((1-sParam.dGamma[0])*2*exp(sParam.dMu[0]+sParam.vS[k]+sParam.vX[k])*(1+exp(sParam.dMu[0]+sParam.vS[k]+sParam.vX[k])/sParam.dNu[0]));
}
if(i<iBurnIn+5)
{
for(int k=0; k<iNumOfObs; k++)
{
mMarkerXLow[k*5+i-iBurnIn]=sParam.vX[k];
mMarkerSLow[k*5+i-iBurnIn]=sParam.vS[k];;
mMarkerVolLow[k*5+i-iBurnIn]=vVol[k];
mMarkerXHigh[k*5+i-iBurnIn]=sParam.vX[k];
mMarkerSHigh[k*5+i-iBurnIn]=sParam.vS[k];;
mMarkerVolHigh[k*5+i-iBurnIn]=vVol[k];
}
}
else
{
if(i==iBurnIn+5)
{
InitializeQuantilePPAlgo(iNumOfObs, 0.05, mMarkerXLow, mNXLow , mNDXLow);
InitializeQuantilePPAlgo(iNumOfObs, 0.05, mMarkerSLow, mNSLow , mNDSLow);
InitializeQuantilePPAlgo(iNumOfObs, 0.05, mMarkerVolLow, mNVolLow , mNDVolLow);
InitializeQuantilePPAlgo(iNumOfObs, 0.95, mMarkerXHigh, mNXHigh , mNDXHigh);
InitializeQuantilePPAlgo(iNumOfObs, 0.95, mMarkerSHigh, mNSHigh , mNDSHigh);
InitializeQuantilePPAlgo(iNumOfObs, 0.95, mMarkerVolHigh, mNVolHigh , mNDVolHigh);
}
QuantilePPAlgo(iNumOfObs, 0.05,sParam.vX, mMarkerXLow, mNXLow , mNDXLow);
QuantilePPAlgo(iNumOfObs, 0.05, sParam.vS, mMarkerSLow, mNSLow , mNDSLow);
QuantilePPAlgo(iNumOfObs, 0.05,vVol, mMarkerVolLow, mNVolLow , mNDVolLow);
QuantilePPAlgo(iNumOfObs, 0.95,sParam.vX, mMarkerXHigh, mNXHigh , mNDXHigh);
QuantilePPAlgo(iNumOfObs, 0.95,sParam.vS, mMarkerSHigh, mNSHigh , mNDSHigh);
QuantilePPAlgo(iNumOfObs, 0.95,vVol, mMarkerVolHigh, mNVolHigh , mNDVolHigh);
}
// SequentialStore(i-iBurnIn, iNumOfIter-iBurnIn,iNumOfObs, sParam.vX , Xfs, sPrefix+sXDraw);
// SequentialStore(i-iBurnIn, iNumOfIter-iBurnIn,iNumOfObs, sParam.vS , Sfs, sPrefix+sSDraw);
for(int j=0; j<iNumOfObs;j++)
{
vXEst[j]=vXEst[j]+(sParam.vX[j])/(iNumOfIter-iBurnIn);
vSeasonEst[j]=vSeasonEst[j]+(sParam.vS[j])/(iNumOfIter-iBurnIn);
vVolEst[j]=vVolEst[j]+vVol[j]/(iNumOfIter-iBurnIn);
vLogIntEst[j]=vLogIntEst[j]+(sParam.dMu[0]+sParam.vS[j]+sParam.vX[j])/(iNumOfIter-iBurnIn);
vX2Est[j]=vX2Est[j]+sParam.vX[j]*sParam.vX[j]/(iNumOfIter-iBurnIn);
vSeason2Est[j]=vSeason2Est[j]+sParam.vS[j]*sParam.vS[j]/(iNumOfIter-iBurnIn);
vVol2Est[j]=vVol2Est[j]+vVol[j]*vVol[j]/(iNumOfIter-iBurnIn);
}
}
/*Save new draws */
vector<double> vTempRow;
vTempRow.push_back(sParam.dMu[0]);
vTempRow.push_back(sParam.dPhi[0]);
vTempRow.push_back(sParam.dSigma2[0]);
vTempRow.push_back(sParam.dGamma[0]);
for(int k=0; k<iNumOfKnots-1; k++)
{
vTempRow.push_back(sParam.vBeta[k]);
}
vTempRow.push_back(sParam.dNu[0]);
mChain.push_back(vTempRow);
}
time (&end);
double dif = difftime (end,start);
printf ("Elapsed time is %.2lf seconds. \n", dif );
FILE * pFile;
pFile = fopen ("DNB_time.txt","w");
fprintf (pFile, "DNB time = %16.4f s\n",dif);
fclose (pFile);
for(int j=0; j<iNumOfObs;j++)
{
vXVolEst[j]=vX2Est[j]-vXEst[j]*vXEst[j];
vSeasonVolEst[j]=vSeason2Est[j]-vSeasonEst[j]*vSeasonEst[j];
vVolVolEst[j]=vVol2Est[j]-vVolEst[j]*vVolEst[j];
}
// string sXTrueFile="vXTrue.csv";
// WriteOutDoubleArray(vXTrue, iNumOfObs, 1, sXTrueFile);
string sXEstFile="vXEst.csv";
WriteOutDoubleArray( vXEst , iNumOfObs, 1, sPrefix+sXEstFile);
cout<<"X Est Saved!"<<endl;
// string sLogIntTrueFile="vLogIntTrue.csv";
// WriteOutDoubleArray(vLogIntTrue, iNumOfObs, 1, sLogIntTrueFile);
string sLogIntEstFile="vLogIntEst.csv";
WriteOutDoubleArray( vLogIntEst , iNumOfObs, 1, sPrefix+sLogIntEstFile);
cout<<"LogInt Est Saved!"<<endl;
string sSeasonEstFile="vSeasonEst.csv";
WriteOutDoubleArray( vSeasonEst , iNumOfObs, 1, sPrefix+sSeasonEstFile);
cout<<"Season Est Saved!"<<endl;
// string sYStarTrueFile="vYStarTrue.csv";
// WriteOutDoubleArray( vYStarTrue , iNumOfObs, 1, sYStarTrueFile);
//
// string sLambdaTrueFile="vLambdaTrue.csv";
// WriteOutDoubleArray( vLambdaTrue , iNumOfObs, 1, sLambdaTrueFile);
string sVolEstFile="vVolEst.csv";
WriteOutDoubleArray( vVolEst , iNumOfObs, 1, sPrefix+sVolEstFile);
cout<<"Vol Est Saved!"<<endl;
string sXLowFile="vXLow.csv";
WriteOutDoubleArray( mMarkerXLow, iNumOfObs, 5, sPrefix+sXLowFile);
cout<<"X Low Saved!"<<endl;
string sXHighFile="vXHigh.csv";
WriteOutDoubleArray( mMarkerXHigh, iNumOfObs, 5, sPrefix+sXHighFile);
cout<<"X High Saved!"<<endl;
string sSLowFile="vSLow.csv";
WriteOutDoubleArray( mMarkerSLow, iNumOfObs, 5, sPrefix+sSLowFile);
cout<<"S Low Saved!"<<endl;
string sSHighFile="vSHigh.csv";
WriteOutDoubleArray( mMarkerSHigh, iNumOfObs, 5, sPrefix+sSHighFile);
cout<<"S High Saved!"<<endl;
string sVolLowFile="vVolLow.csv";
WriteOutDoubleArray( mMarkerVolLow, iNumOfObs, 5, sPrefix+sVolLowFile);
cout<<"Vol Low Saved!"<<endl;
string sVolHighFile="vVolHigh.csv";
WriteOutDoubleArray( mMarkerVolHigh, iNumOfObs, 5, sPrefix+sVolHighFile);
cout<<"Vol High Saved!"<<endl;
string sXVolFile="vXVol.csv";
WriteOutDoubleArray( vXVolEst, iNumOfObs, 1, sPrefix+sXVolFile);
cout<<"X Vol Saved!"<<endl;
string sSVolFile="vSVol.csv";
WriteOutDoubleArray( vSeasonVolEst, iNumOfObs, 1, sPrefix+sSVolFile);
cout<<"S Vol Saved!"<<endl;
string sVolVolFile="vVolVol.csv";
WriteOutDoubleArray( vVolVolEst, iNumOfObs, 1, sPrefix+sVolVolFile);
cout<<"Vol Vol Saved!"<<endl;
cout <<"Write out done"<<endl;
// WriteOutDoubleArray(vXTrue, iNumOfObs, 1, sLogIntTrueFile);
delete [] vZeroDNBDens;
delete [] vIndicator;
delete [] vDNBDens;
delete [] vLogSkellamZ;
delete [] sParam.vX;
delete [] sParam.vBeta;
delete [] sParam.vS;
delete [] sParam.vZ1;
delete [] sParam.vZ2;
delete [] sParam.vN;
delete [] sParam.vTau1;
delete [] sParam.vTau2;
delete [] sParam.mAuxY;
delete [] sParam.mAuxH;
delete [] vLogIntEst;
delete [] vXEst;
delete [] vSeasonEst;
delete [] vVolEst;
delete [] vX2Est;
delete [] vSeason2Est;
delete [] vVol2Est;
delete [] vXVolEst;
delete [] vSeasonVolEst;
delete [] vVolVolEst;
delete [] mMarkerXLow;
delete [] mMarkerSLow;
delete [] mMarkerVolLow;
delete [] mMarkerXHigh;
delete [] mMarkerSHigh;
delete [] mMarkerVolHigh;
delete [] mNXLow;
delete [] mNSLow;
delete [] mNVolLow;
delete [] mNXHigh;
delete [] mNSHigh;
delete [] mNVolHigh;
delete [] vVol;
delete [] mNDXLow;
delete [] mNDSLow;
delete [] mNDVolLow;
delete [] mNDXHigh;
delete [] mNDSHigh;
delete [] mNDVolHigh;
delete dCovarGamma;
delete dSumGamma;
delete dCovarNu;
delete dSumNu;
delete [] mCovar;
delete [] mSum;
delete sParam.iNumOfObs;
delete sParam.dMu;
delete sParam.dPhi;
delete sParam.dSigma2;
delete sParam.dGamma;
delete sParam.dPriorGammaA;
delete sParam.dPriorGammaB;
delete sParam.dPriorNuA;
delete sParam.dPriorNuB;
delete sParam.dPriorMuMean;
delete sParam.dPriorMuSigma2;
delete sParam.dPriorPhiA;
delete sParam.dPriorPhiB;
delete sParam.dPriorSigmaA;
delete sParam.dPriorSigmaB;
}
//void MCMC::BootstrapFilterSkellam( vector<double> vParam, int iNumOfParticles)
//{
// double dMu=vParam[0];
// double dPhi=vParam[1];
// double dSigma2=vParam[2];
// double dGamma=vParam[3];
//
//// double dMaxLogWeight=-1e20;
// double dSumWeights;
// double dESS;
//
// double* vParticles=new double[iNumOfParticles];
// double* vLogWeights=new double[iNumOfParticles];
// double* vWeights=new double[iNumOfParticles];
// double* vNormalizedWeights=new double[iNumOfParticles];
// double* vCumNormalizedWeights=new double[iNumOfParticles];
//
// double* vMeans=new double[iNumOfObs];
//
// const gsl_rng_type * T;
// gsl_rng * gsl_random_num;
// T=gsl_rng_default;
// gsl_random_num=gsl_rng_alloc(T);
// gsl_rng_set(gsl_random_num, 2);
//
//
//
// for(int i=0; i<iNumOfObs; i++)
// {
// cout<<"XXXXXX Iter "<<i<<" data "<<vData[i] <<" XXXXXXXX"<<endl;
// /* Initial step*/
// if(i==0)
// {
// dSumWeights=0;
// for(int j=0; j<iNumOfParticles; j++)
// {
// /* Initital draw */
// vParticles[j]= DrawInital(dPhi ,dSigma2, gsl_random_num);
//// cout << "init particles " << vParticles[j] <<endl;
// /*Weights*/
// vWeights[j]=ZeroSkellamPdf(vData[i], dGamma, exp(dMu+vParticles[j]));
//// cout << "weights " << vWeights[j]<<endl;
// /* Sum of weights */
// dSumWeights+=vWeights[j];
//
// }
//
// /* Calculate statistics */
// dESS=0;
// vMeans[i]=0;
// /* Normalized weights */
// for(int j=0; j<iNumOfParticles; j++)
// {
// vNormalizedWeights[j]=vWeights[j]/dSumWeights;
// vMeans[i]+=vNormalizedWeights[j]*vParticles[j];
//// cout << "normalized weights " << vNormalizedWeights[j]<<endl;
// if(j==0)
// {
// vCumNormalizedWeights[j]=vNormalizedWeights[j];
// }
// else
// {
// vCumNormalizedWeights[j]=vCumNormalizedWeights[j-1]+vNormalizedWeights[j];
// }
//// cout << "cum normalized weights " << vCumNormalizedWeights[j]<<endl;
// dESS+=vNormalizedWeights[j]*vNormalizedWeights[j];
// }
// dESS=1/dESS;
//
//// cout << "XXX ESS "<<dESS<<" XXX"<<endl;
// }
// else
// {
//// cout << "XXX ESS "<<dESS<<" XXX"<<endl;
// /*Resample */
//// if(dESS<0.5*iNumOfParticles)
//// {
//
//// cout << "XXX Resampling XXX"<<endl;
//// for(int k=0; k<iNumOfParticles; k++)
//// {
//// cout<<"Old Partciles " << vParticles[k] <<" Weights " << vNormalizedWeights[k] <<endl;
//// }
// SystemicResampling(vParticles, vCumNormalizedWeights,iNumOfParticles,gsl_random_num);
//// for(int k=0; k<iNumOfParticles; k++)
//// {
//// cout<<"New Partciles " << vParticles[k] <<endl;
//// }
//// }
//
// dSumWeights=0;
// for(int j=0; j<iNumOfParticles; j++)
// {
// /* Propagate */
// vParticles[j]=DrawTransition(vParticles[j],dPhi ,dSigma2, gsl_random_num);
//// cout << "particles " << vParticles[j] <<endl;
// /*Weights*/
//// if(dESS<0.5*iNumOfParticles)
//// {
// vWeights[j]=ZeroSkellamPdf(vData[i], dGamma, exp(dMu+vParticles[j]))/iNumOfParticles;
//// }
//// else
//// {
//// vWeights[j]=ZeroSkellamPdf(vData[i], dGamma, exp(dMu+vParticles[j]))*vWeights[j];
//// }
//// cout << "weights " << vWeights[j]<<endl;
// /* Sum of weights */
// dSumWeights+=vWeights[j];
// }
//
//
//
//
// dESS=0;
// vMeans[i]=0;
// for(int j=0; j<iNumOfParticles; j++)
// {
//
// /* Normalized weights */
// vNormalizedWeights[j]=vWeights[j]/dSumWeights;
// /* Calculate statistics */
// vMeans[i]+=vNormalizedWeights[j]*vParticles[j];
//// cout << "normalized weights at " << j <<" is "<< vNormalizedWeights[j]<<endl;
// if(j==0)
// {
//// cout<< "first "<<vNormalizedWeights[0] <<endl;
// vCumNormalizedWeights[j]=vNormalizedWeights[j];
// }
// else
// {
//// cout << "prev cum normalized weights at " << j-1 <<" is "<< vCumNormalizedWeights[j-1]<<endl;
// vCumNormalizedWeights[j]=vCumNormalizedWeights[j-1]+vNormalizedWeights[j];
// }
//// cout << "cum normalized weights at " << j <<" is "<< vCumNormalizedWeights[j]<<endl;
// dESS+=vNormalizedWeights[j]*vNormalizedWeights[j];
// }
// dESS=1/dESS;
// }
//
//
// }
//
// string sXTrue="vXTrue.csv";
// WriteOutDoubleArray( vXTrue , iNumOfObs, 1, sXTrue);
//
// string sBFMeans="vXMeansBF.csv";
// WriteOutDoubleArray( vMeans , iNumOfObs, 1, sBFMeans);
//
// delete [] vParticles;
// delete [] vMeans;
// delete [] vLogWeights;
// delete [] vNormalizedWeights;
// delete [] vWeights;
//}
|
6fa05b745098a40c7c06e57203b2b436d3b5fd46 | 339b421cd9751bd4d747320f8ed24b8940649b12 | /Xlsx/Drawing.cpp | fd8208de1c6902aa0fcbae9304ef928645f2c33d | [] | no_license | MGniew/simplexlsx | 5d460a5857b5d610594af6ed6a20f32854af60ff | cfa23a27f89d80a8e147228fab5da17db5da4123 | refs/heads/master | 2020-03-30T09:36:01.773282 | 2017-09-14T09:35:52 | 2017-09-14T09:35:52 | 151,082,440 | 0 | 0 | null | 2018-10-01T12:10:45 | 2018-10-01T12:10:45 | null | UTF-8 | C++ | false | false | 4,399 | cpp | Drawing.cpp | #include "Drawing.h"
#include "Chart.h"
#include "XlsxHeaders.h"
#include "../PathManager.hpp"
#include "../XMLWriter.hpp"
namespace SimpleXlsx
{
CDrawing::CDrawing( size_t index, PathManager & pathmanager ) : m_index( index ), m_pathManager( pathmanager )
{
}
CDrawing::~CDrawing()
{
}
bool CDrawing::Save()
{
if( ! IsEmpty() )
{
SaveDrawingRels();
SaveDrawing();
}
return true;
}
// [- /xl/drawings/_rels/drawingX.xml.rels
void CDrawing::SaveDrawingRels()
{
_tstringstream FileName;
FileName << _T( "/xl/drawings/_rels/drawing" ) << m_index << _T( ".xml.rels" );
XMLWriter xmlw( m_pathManager.RegisterXML( FileName.str() ) );
xmlw.Tag( "Relationships" ).Attr( "xmlns", ns_relationships );
int rId = 1;
for( std::vector<ChartInfo>::const_iterator it = m_charts.begin(); it != m_charts.end(); it++, rId++ )
{
_tstringstream Target, rIdStream;
Target << "../charts/chart" << ( *it ).Chart->GetIndex() << ".xml";
rIdStream << "rId" << rId;
xmlw.TagL( "Relationship" ).Attr( "Id", rIdStream.str() ).Attr( "Type", type_chart ).Attr( "Target", Target.str() ).EndL();
}
xmlw.End( "Relationships" );
}
// [- /xl/drawings/drawingX.xml
void CDrawing::SaveDrawing()
{
_tstringstream FileName;
FileName << _T( "/xl/drawings/drawing" ) << m_index << _T( ".xml" );
XMLWriter xmlw( m_pathManager.RegisterXML( FileName.str() ) );
xmlw.Tag( "xdr:wsDr" ).Attr( "xmlns:xdr", ns_xdr ).Attr( "xmlns:a", ns_a );
int rId = 1;
for( std::vector<ChartInfo>::const_iterator it = m_charts.begin(); it != m_charts.end(); it++, rId++ )
{
switch( ( * it ).AType )
{
case ChartInfo::absoluteAnchor:
{
xmlw.Tag( "xdr:absoluteAnchor" );
xmlw.TagL( "xdr:pos" ).Attr( "x", 0 ).Attr( "y", 0 ).EndL();
xmlw.TagL( "xdr:ext" ).Attr( "cx", 9312088 ).Attr( "cy", 6084794 ).EndL();
SaveChartSection( xmlw, ( * it ).Chart, rId );
xmlw.End( "xdr:absoluteAnchor" );
break;
}
case ChartInfo::twoCellAnchor:
{
xmlw.Tag( "xdr:twoCellAnchor" );
SaveChartPoint( xmlw, "xdr:from", ( * it ).TopLeft );
SaveChartPoint( xmlw, "xdr:to", ( * it ).BottomRight );
SaveChartSection( xmlw, ( * it ).Chart, rId );
xmlw.End( "xdr:twoCellAnchor" );
break;
}
}
}
xmlw.End( "xdr:wsDr" );
}
void CDrawing::SaveChartSection( XMLWriter & xmlw, CChart * chart, int rId )
{
_tstringstream rIdStream;
rIdStream << "rId" << rId;
xmlw.Tag( "xdr:graphicFrame" ).Attr( "macro", "" ).Tag( "xdr:nvGraphicFramePr" );
xmlw.TagL( "xdr:cNvPr" ).Attr( "id", rId ).Attr( "name", chart->GetTitle() ).EndL();
xmlw.Tag( "xdr:cNvGraphicFramePr" ).TagL( "a:graphicFrameLocks" ).Attr( "noGrp", 1 ).EndL().End( "xdr:cNvGraphicFramePr" );
xmlw.End( "xdr:nvGraphicFramePr" );
xmlw.Tag( "xdr:xfrm" );
xmlw.TagL( "a:off" ).Attr( "x", 0 ).Attr( "y", 0 ).EndL();
xmlw.TagL( "a:ext" ).Attr( "cx", 0 ).Attr( "cy", 0 ).EndL();
xmlw.End( "xdr:xfrm" );
xmlw.Tag( "a:graphic" ).Tag( "a:graphicData" ).Attr( "uri", ns_c );
xmlw.TagL( "c:chart" ).Attr( "xmlns:c", ns_c ).Attr( "xmlns:r", ns_book_r ).Attr( "r:id", rIdStream.str() ).EndL();
xmlw.End( "a:graphicData" ).End( "a:graphic" );
xmlw.End( "xdr:graphicFrame" );
xmlw.TagL( "xdr:clientData" ).EndL();
}
void CDrawing::SaveChartPoint( XMLWriter & xmlw, const char * Tag, const ChartPoint & Point )
{
xmlw.Tag( Tag );
xmlw.TagOnlyContent( "xdr:col", Point.col );
xmlw.TagOnlyContent( "xdr:colOff", Point.colOff );
xmlw.TagOnlyContent( "xdr:row", Point.row );
xmlw.TagOnlyContent( "xdr:rowOff", Point.rowOff );
xmlw.End( Tag );
}
}
|
5ea85db1c1ac4ed0938e2e37e4d3adb2813847a3 | fc8a283e0fc71a14732e06ecf464ce5eec3d5235 | /Abstractions/container.h | 4f768f17e1d78ec87e13d4f6602397930bc04d90 | [] | no_license | alex-t0/clang_examples | b0af2eb1eb268a2cb5b17257cbdd93ab88bc58da | c6bc2566e47139e1ba9d51a3ac33a9c59bf6165a | refs/heads/master | 2021-01-09T06:05:28.213407 | 2017-02-20T21:51:05 | 2017-02-20T21:51:05 | 80,910,858 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 137 | h | container.h | class Container {
public:
virtual double& operator[](int) {}/* = 0*/;
virtual int size() const {}/* = 0*/;
virtual ~Container() {};
}; |
174a08cc095ea5813ee7a4007db08db242196d6b | 9aec97450dbe7291d6bb8937a18daa315f8185ae | /D3DX_PROJECT/cMainGame.h | 3a0be0f8848db2542d33a3ebad8b28220a9ee4a3 | [] | no_license | hyunsang-shim/Project-M | aefc74decc6838114e2b5fdcbcbe4dfa9437254d | 63e03597c1dbfe8dad7e9a913d594f9e81f4244f | refs/heads/master | 2020-04-03T01:54:30.510967 | 2019-01-11T03:53:12 | 2019-01-11T03:53:12 | 154,941,898 | 2 | 3 | null | 2018-12-13T11:38:08 | 2018-10-27T08:21:13 | RPC | UTF-8 | C++ | false | false | 417 | h | cMainGame.h | #pragma once
#include "cSCENE_INGAME.h"
#include "cSCENE_RESULT.h"
#include "cSCENE_TITLE.h"
class cMainGame
{
public:
cMainGame();
~cMainGame();
public:
void Setup();
void Update();
void Render();
void WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); \
void SetSceneChangeTriger(int sceneNum);
int getSceneNum();
private:
void SceneChangeNum();
private:
int SCENENUM;
public:
};
|
3eb6a96646673763eb43dada2d89642115b8a15e | 6e498f5201d3b42c2da291108eb93c62bf2ad53d | /Class Deliverables/Part 4/Source Code/Personnel.h | 5a6b0f8692cf6bbdbd06521035ea9a5b95c8aca3 | [] | no_license | x2110311x/CPSIC | 2b1379e7f7c1538e65985f9f1d6fb5a9080645d7 | ca5f080ae099e6f3369f99f1ea9c4fc56ab25ede | refs/heads/master | 2022-04-26T23:52:40.166471 | 2020-04-30T15:34:12 | 2020-04-30T15:34:12 | 251,119,965 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,209 | h | Personnel.h | #ifndef PERSONNEL_H
#define PERSONNEL_H
#include <string>
#include "AppointmentSlot.h"
#include<vector>
using namespace std;
class Personnel {
private: ///< attributes
string name; ///< The name of the personnel
string type; ///< The type of the peronnel: Nurse or Counselor
long employeeID; ///< The employeeID of the personnel
vector<AppointmentSlot> workingTimes; ///< Dynamic array that defines their schedule...also changed this to vector
///<friend ostream& operator<<(ostream& os, const Personnel& a);
public:
///<constructors
Personnel();
Personnel(string name, string type, long id, vector<AppointmentSlot> workingTimes);
///< Accessors
/** @brief Retrieve the name of the personnel
* @return String the name of the personnel
*/
string getName();
/** @brief Retrieve the type of personnel
* @return String the type of personnel
*/
string getType();
/** @brief Retrieve the ID of the personnel
* @return long The ID of the personnel
*/
long getEmployeeId();
/** @brief Retrieve a vector of working times of the personnel
* @return Vector<AppointmentSlot> a vector of working times of the personnel
*/
vector<AppointmentSlot> getWorkingTimes(); ///<changed this to vector
///<modifiers
/** @brief Set the Type of personnel
* @param String The type of the personnel
* @return None
*/
void setType(string t);
/** @brief Set the Name of the personnel
* @param String The name of the personnel
* @return None
*/
void setName(string n);
/** @brief set the ID of the personnel
* @param long the ID number of the personnel
* @return None
*/
void setEmployeeId(long id);
/** @brief Add an appointment slot to the working times of the personnel
* @param AppointmentSlot The appointment slot that will be added to the working times of the personnel
* @return None
*/
void addWorkingTime(AppointmentSlot w);
/** @brief Remove an appointment slot from the working times of the personnel
* @param AppointmentSlot The appointment slot that will be removed from the working times of the personnel
* @return None
*/
void removeWorkingTime(AppointmentSlot w);
bool operator==(Personnel a);
};
#endif
|
4bf8e1bb4d1a1b32c25aff8cd272da69b3d9d199 | 17268ca7f34701bf72bb19265020d736f5b459bd | /cmd/wmii/mouse.cc | b9c16f76858cfc023558ab46ed60ed45347a66bd | [
"MIT"
] | permissive | DrItanium/xnjj | 76f350a97abce0ae08477b4f8eb34e71c1b8fb62 | 2c3f92f65fb14ca055be38323fae7ba257602c21 | refs/heads/master | 2020-05-30T14:15:19.268031 | 2019-06-03T03:56:35 | 2019-06-03T03:56:35 | 189,785,147 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 13,931 | cc | mouse.cc | /* Copyright ©2006-2010 Kris Maglione <maglione.k at Gmail>
* See LICENSE file for license details.
*/
#include "dat.h"
#include "fns.h"
/* Here be dragons. */
enum {
ButtonMask =
ButtonPressMask | ButtonReleaseMask,
MouseMask =
ButtonMask | PointerMotionMask
};
static Cursor
quad_cursor(Align align) {
switch(align) {
case NEast: return cursor[CurNECorner];
case NWest: return cursor[CurNWCorner];
case SEast: return cursor[CurSECorner];
case SWest: return cursor[CurSWCorner];
case South:
case North: return cursor[CurDVArrow];
case East:
case West: return cursor[CurDHArrow];
default: return cursor[CurMove];
}
}
static bool
cwin_expose(Window *w, void *aux, XExposeEvent *e) {
fill(w, rectsubpt(w->r, w->r.min), &def.focuscolor.bg);
fill(w, w->r, &def.focuscolor.bg);
return false;
}
static Handlers chandler = {
.expose = cwin_expose,
};
Window*
constraintwin(Rectangle r) {
Window *w;
w = createwindow(&scr.root, r, 0, InputOnly, nil, 0);
if(0) {
Window *w2;
w2 = createwindow(&scr.root, r, 0, InputOutput, nil, 0);
selectinput(w2, ExposureMask);
w->aux = w2;
setborder(w2, 1, &def.focuscolor.border);
sethandler(w2, &chandler);
mapwin(w2);
raisewin(w2);
}
mapwin(w);
return w;
}
void
destroyconstraintwin(Window *w) {
if(w->aux)
destroywindow((Window*)w->aux);
destroywindow(w);
}
static Window*
gethsep(Rectangle r) {
Window *w;
WinAttr wa;
wa.background_pixel = pixelvalue(&scr.root, &def.normcolor.border);
w = createwindow(&scr.root, r, scr.depth, InputOutput, &wa, CWBackPixel);
mapwin(w);
raisewin(w);
return w;
}
static void
rect_morph(Rectangle *r, Point d, Align *mask) {
int n;
if(*mask & North)
r->min.y += d.y;
if(*mask & West)
r->min.x += d.x;
if(*mask & South)
r->max.y += d.y;
if(*mask & East)
r->max.x += d.x;
if(r->min.x > r->max.x) {
n = r->min.x;
r->min.x = r->max.x;
r->max.x = n;
*mask = Align(*mask ^ (East|West));
}
if(r->min.y > r->max.y) {
n = r->min.y;
r->min.y = r->max.y;
r->max.y = n;
*mask = Align(*mask ^ (North|South));
}
}
/* Yes, yes, macros are evil. So are patterns. */
#define frob(x, y) \
const Rectangle *rp; \
int i, tx; \
\
for(i=0; i < nrect; i++) { \
rp = &rects[i]; \
if((rp->min.y <= r->max.y) && (rp->max.y >= r->min.y)) { \
tx = rp->min.x; \
if(abs(tx - x) <= abs(dx)) \
dx = tx - x; \
\
tx = rp->max.x; \
if(abs(tx - x) <= abs(dx)) \
dx = tx - x; \
} \
} \
return dx \
static int
snap_hline(const Rectangle *rects, int nrect, int dx, const Rectangle *r, int y) {
frob(y, x);
}
static int
snap_vline(const Rectangle *rects, int nrect, int dx, const Rectangle *r, int x) {
frob(x, y);
}
#undef frob
/* Returns a gravity for increment handling. It's normally the
* opposite of the mask (the directions that we're resizing in),
* unless a snap occurs, in which case, it's the direction of the
* snap.
*/
Align
snap_rect(const Rectangle *rects, int num, Rectangle *r, Align *mask, int snap) {
Align ret;
Point d;
d.x = snap+1;
d.y = snap+1;
if(*mask&North)
d.y = snap_hline(rects, num, d.y, r, r->min.y);
if(*mask&South)
d.y = snap_hline(rects, num, d.y, r, r->max.y);
if(*mask&East)
d.x = snap_vline(rects, num, d.x, r, r->max.x);
if(*mask&West)
d.x = snap_vline(rects, num, d.x, r, r->min.x);
ret = Center;
if(abs(d.x) <= snap)
ret = Align(ret ^ (East | West));
else
d.x = 0;
if(abs(d.y) <= snap)
ret = Align(ret ^ (North|South));
else
d.y = 0;
rect_morph(r, d, mask);
return Align(ret ^ *mask);
}
int
readmouse(Point *p, uint *button) {
XEvent ev;
for(;;) {
XMaskEvent(display, MouseMask|ExposureMask|PropertyChangeMask, &ev);
debug_event(&ev);
switch(ev.type) {
case Expose:
case NoExpose:
case PropertyNotify:
event_dispatch(&ev);
default:
Dprint(DEvent, "readmouse(): ignored: %E\n", &ev);
continue;
case ButtonPress:
case ButtonRelease:
*button = ev.xbutton.button;
case MotionNotify:
p->x = ev.xmotion.x_root;
p->y = ev.xmotion.y_root;
if(p->x == scr.rect.max.x - 1)
p->x = scr.rect.max.x;
if(p->y == scr.rect.max.y - 1)
p->y = scr.rect.max.y;
break;
}
return ev.type;
}
}
bool
readmotion(Point *p) {
uint button;
for(;;)
switch(readmouse(p, &button)) {
case MotionNotify:
return true;
case ButtonRelease:
return false;
}
}
static void
mouse_resizecolframe(Frame *f, Align align) {
Window *cwin, *hwin = nil;
Divide *d;
View *v;
Area *a;
Rectangle r;
Point pt, min;
int s;
assert((align&(East|West)) != (East|West));
assert((align&(North|South)) != (North|South));
f->collapsed = false;
v = selview;
d = divs;
SET(a);
foreach_column(v, s, a) {
if(a == f->area)
break;
d = d->next;
}
if(align & East)
d = d->next;
min.x = column_minwidth();
min.y = /*frame_delta_h() +*/ labelh(def.font);
/* Set the limits of where this box may be dragged. */
#define frob(pred, f, aprev, rmin, rmax, plus, minus, xy, use_screen) BLOCK( \
if(pred) { \
r.rmin.xy = f->aprev->r.rmin.xy plus min.xy; \
r.rmax.xy = f->r.rmax.xy minus min.xy; \
}else if(use_screen) { \
r.rmin.xy = v->r[f->screen].rmin.xy plus 1; \
r.rmax.xy = a->r.rmax.xy minus min.xy; \
}else { \
r.rmin.xy = a->r.rmin.xy; \
r.rmax.xy = r.rmin.xy plus 1; \
})
r = f->r;
if(align & North)
frob(f->aprev, f, aprev, min, max, +, -, y, false);
else if(align & South)
frob(f->anext, f, anext, max, min, -, +, y, false);
if(align & West)
frob(a->prev, a, prev, min, max, +, -, x, true);
else if(align & East)
frob(a->next, a, next, max, min, -, +, x, true);
#undef frob
cwin = constraintwin(r);
r = f->r;
if(align & North)
r.min.y--;
else if(align & South)
r.min.y = r.max.y - 1;
r.max.y = r.min.y + 2;
if(align & (North|South))
hwin = gethsep(r);
if(!grabpointer(&scr.root, cwin, cursor[CurSizing], MouseMask))
goto done;
pt.x = (align & West ? f->r.min.x : f->r.max.x);
pt.y = (align & North ? f->r.min.y : f->r.max.y);
warppointer(pt);
while(readmotion(&pt)) {
if(align & West)
r.min.x = pt.x;
else if(align & East)
r.max.x = pt.x;
if(align & South)
r.min.y = pt.y;
else if(align & North)
r.min.y = pt.y - 1;
r.max.y = r.min.y+2;
if(align & (East|West))
div_set(d, pt.x);
if(hwin)
reshapewin(hwin, r);
}
r = f->r;
if(align & West)
r.min.x = pt.x;
else if(align & East)
r.max.x = pt.x;
if(align & North)
r.min.y = pt.y;
else if(align & South)
r.max.y = pt.y;
column_resizeframe(f, r);
/* XXX: Magic number... */
if(align & West)
pt.x = f->r.min.x + 4;
else if(align & East)
pt.x = f->r.max.x - 4;
if(align & North)
pt.y = f->r.min.y + 4;
else if(align & South)
pt.y = f->r.max.y - 4;
warppointer(pt);
done:
ungrabpointer();
destroyconstraintwin(cwin);
if (hwin)
destroywindow(hwin);
}
void
mouse_resizecol(Divide *d) {
Window *cwin;
View *v;
Rectangle r;
Point pt;
int minw, scrn;
v = selview;
scrn = (d->left ? d->left : d->right)->screen;
pt = querypointer(&scr.root);
minw = column_minwidth();
r.min.x = d->left ? d->left->r.min.x + minw : v->r[scrn].min.x;
r.max.x = d->right ? d->right->r.max.x - minw : v->r[scrn].max.x;
r.min.y = pt.y;
r.max.y = pt.y+1;
cwin = constraintwin(r);
if(!grabpointer(&scr.root, cwin, cursor[CurNone], MouseMask))
goto done;
while(readmotion(&pt))
div_set(d, pt.x);
if(d->left)
d->left->r.max.x = pt.x;
else
v->pad[scrn].min.x = pt.x - v->r[scrn].min.x;
if(d->right)
d->right->r.min.x = pt.x;
else
v->pad[scrn].max.x = pt.x - v->r[scrn].max.x;
view_arrange(v);
done:
ungrabpointer();
destroyconstraintwin(cwin);
}
void
mouse_resize(Client *c, Align align, bool grabmod) {
Rectangle *rects;
Rectangle frect, origin;
Align grav;
Cursor cur;
Point d, pt, hr;
float rx, ry, hrx, hry;
uint nrect;
Frame *f;
f = c->sel;
if(f->client->fullscreen >= 0) {
ungrabpointer();
return;
}
if(!f->area->floating) {
if(align==Center)
mouse_movegrabbox(c, grabmod);
else
mouse_resizecolframe(f, align);
return;
}
cur = quad_cursor(align);
if(align == Center)
cur = cursor[CurSizing];
if(!grabpointer(c->framewin, nil, cur, MouseMask))
return;
origin = f->r;
frect = f->r;
rects = view_rects(f->area->view, &nrect, c->frame);
pt = querypointer(c->framewin);
rx = (float)pt.x / Dx(frect);
ry = (float)pt.y / Dy(frect);
pt = querypointer(&scr.root);
SET(hrx);
SET(hry);
if(align != Center) {
hr = subpt(frect.max, frect.min);
hr = divpt(hr, Pt(2, 2));
d = hr;
if(align&North) d.y -= hr.y;
if(align&South) d.y += hr.y;
if(align&East) d.x += hr.x;
if(align&West) d.x -= hr.x;
pt = addpt(d, f->r.min);
warppointer(pt);
}else {
hrx = (double)(Dx(scr.rect)
+ Dx(frect)
- 2 * labelh(def.font))
/ Dx(scr.rect);
hry = (double)(Dy(scr.rect)
+ Dy(frect)
- 3 * labelh(def.font))
/ Dy(scr.rect);
pt.x = frect.max.x - labelh(def.font);
pt.y = frect.max.y - labelh(def.font);
d.x = pt.x / hrx;
d.y = pt.y / hry;
warppointer(d);
}
stuff_sync();
event_flush(PointerMotionMask, false);
while(readmotion(&d)) {
if(align == Center) {
d.x = (d.x * hrx) - pt.x;
d.y = (d.y * hry) - pt.y;
}else
d = subpt(d, pt);
pt = addpt(pt, d);
rect_morph(&origin, d, &align);
frect = constrain(origin, -1);
grav = snap_rect(rects, nrect, &frect, &align, def.snap);
frect = frame_hints(f, frect, grav);
frect = constrain(frect, -1);
client_resize(c, frect);
}
pt = addpt(c->framewin->r.min,
Pt(Dx(frect) * rx,
Dy(frect) * ry));
if(pt.y > scr.rect.max.y)
pt.y = scr.rect.max.y - 1;
warppointer(pt);
free(rects);
ungrabpointer();
}
static int
pushstack_down(Frame *f, int y) {
int ret;
int dh, dy;
if(f == nil)
return 0;;
ret = 0;
dy = y - f->colr.min.y;
if(dy < 0)
return 0;
if(!f->collapsed) {
dh = Dy(f->colr) - labelh(def.font);
if(dy <= dh) {
f->colr.min.y += dy;
return dy;
}else {
f->collapsed = true;
f->colr.min.y += dh;
ret = dh;
dy -= dh;
}
}
dy = pushstack_down(f->anext, f->colr.max.y + dy);
f->colr.min.y += dy;
f->colr.max.y += dy;
return ret + dy;
}
static int
pushstack_up(Frame *f, int y) {
int ret;
int dh, dy;
if(f == nil)
return 0;
ret = 0;
dy = f->colr.max.y - y;
if(dy < 0)
return 0;
if(!f->collapsed) {
dh = Dy(f->colr) - labelh(def.font);
if(dy <= dh) {
f->colr.max.y -= dy;
return dy;
}else {
f->collapsed = true;
f->colr.max.y -= dh;
ret = dh;
dy -= dh;
}
}
dy = pushstack_up(f->aprev, f->colr.min.y - dy);
f->colr.min.y -= dy;
f->colr.max.y -= dy;
return ret + dy;
}
static void
mouse_tempvertresize(Area *a, Point p) {
Frame *fa, *fb, *f;
Window *cwin;
Rectangle r;
Point pt;
int incmode, nabove, nbelow;
if(a->mode != Coldefault)
return;
for(fa=a->frame; fa; fa=fa->anext)
if(p.y < fa->r.max.y + labelh(def.font)/2)
break;
if(!(fa && fa->anext))
return;
fb = fa->anext;
nabove=0;
nbelow=0;
for(f=fa; f; f=f->aprev)
nabove++;
for(f=fa->anext; f; f=f->anext)
nbelow++;
incmode = def.incmode;
def.incmode = IIgnore;
resizing = true;
column_arrange(a, false);
r.min.x = p.x;
r.max.x = p.x + 1;
r.min.y = a->r.min.y + labelh(def.font) * nabove;
r.max.y = a->r.max.y - labelh(def.font) * nbelow;
cwin = constraintwin(r);
if(!grabpointer(&scr.root, cwin, cursor[CurDVArrow], MouseMask))
goto done;
for(f=a->frame; f; f=f->anext)
f->colr_old = f->colr;
while(readmotion(&pt)) {
for(f=a->frame; f; f=f->anext) {
f->collapsed = false;
f->colr = f->colr_old;
}
if(pt.y > p.y)
pushstack_down(fb, pt.y);
else
pushstack_up(fa, pt.y);
fa->colr.max.y = pt.y;
fb->colr.min.y = pt.y;
column_frob(a);
}
done:
ungrabpointer();
destroyconstraintwin(cwin);
def.incmode = incmode;
resizing = false;
column_arrange(a, false);
}
void
mouse_checkresize(Frame *f, Point p, bool exec) {
Rectangle r;
Cursor cur;
int q;
cur = cursor[CurNormal];
if(rect_haspoint_p(f->crect, p)) {
client_setcursor(f->client, cur);
return;
}
r = rectsubpt(f->r, f->r.min);
q = quadrant(r, p);
if(rect_haspoint_p(f->grabbox, p)) {
cur = cursor[CurTCross];
if(exec)
mouse_movegrabbox(f->client, false);
}
else if(f->area->floating) {
if(p.x <= 2
|| p.y <= 2
|| r.max.x - p.x <= 2
|| r.max.y - p.y <= 2) {
cur = quad_cursor((Align)q);
if(exec) {
mouse_resize(f->client, Align(q), false);
}
}
else if(exec && rect_haspoint_p(f->titlebar, p))
mouse_movegrabbox(f->client, true);
}else {
if(f->aprev && p.y <= 2
|| f->anext && r.max.y - p.y <= 2) {
cur = cursor[CurDVArrow];
if(exec)
mouse_tempvertresize(f->area, addpt(p, f->r.min));
}
}
if(!exec)
client_setcursor(f->client, cur);
}
static void
_grab(XWindow w, uint button, ulong mod) {
XGrabButton(display, button, mod, w, false, ButtonMask,
GrabModeSync, GrabModeSync, None, None);
}
/* Doesn't belong here */
void
grab_button(XWindow w, uint button, ulong mod) {
_grab(w, button, mod);
if((mod != AnyModifier) && numlock_mask) {
_grab(w, button, mod | numlock_mask);
_grab(w, button, mod | numlock_mask | LockMask);
}
}
|
fceb76ac2208223e3e1a300fa933091c5ff817e8 | ea9f0ca126d575adca0833a0253e02bf52674cfe | /src/Array/MaxDistance.cpp | 99a9a27a70e4db6e4620b461835e393fe2368a02 | [
"MIT"
] | permissive | satyam289/Data-structure-and-Algorithm | f4e62696074677e3046c31abc53b2e08f049db18 | 2056eb5f7c82db50a910658f641f15547acf2313 | refs/heads/master | 2022-05-17T17:29:06.086036 | 2022-05-03T19:56:48 | 2022-05-03T19:56:48 | 143,539,978 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,219 | cpp | MaxDistance.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
//https://www.interviewbit.com/problems/max-distance/
// Given an array A of integers, find the maximum of j - i subjected to the constraint of A[i] <= A[j].
class MaxDistance {
public:
int maximumGap(const vector<int> &num){
if(num.size() == 0)
return -1;
if(num.size() == 1)
return 0;
vector<pair<int, int>> toSort;
for(int i =0; i<num.size(); i++){
toSort.push_back(make_pair(num[i], i));
}
sort(toSort.begin(), toSort.end());
int len = toSort.size();
int maxIndex = toSort[len -1].second;
int ans = 0;
for(int i = len -2; i >=0; i--){
ans = max(ans, maxIndex - toSort[i].second);
maxIndex =max(maxIndex, toSort[i].second);
}
return ans;
}
};
/*
public int maximumGap(final List<Integer> A) {
int n = A.size();
int rightMax[] = new int[n];
rightMax[n-1] = A.get(n-1);
for(int i=n-2; i>=0; i--) {
rightMax[i] = Math.max(rightMax[i+1], A.get(i));
}
int i=0, j=0, max=0;
while(i < n && j < n) {
if(A.get(i) <= rightMax[j]) {
max = Math.max(max, j-i);
j++;
}
else {
i++;
}
}
return max;
}
// second Apporach Time Complexity : 0(n) Space : 0(n)
public int maximumGap2(final List<Integer> A) {
int maxDiff;
int i, j;
int n = A.size();
int RMax[] = new int[n];
int LMin[] = new int[n];
LMin[0] = A.get(0);
for (i = 1; i < n; ++i) {
LMin[i] = Math.min(A.get(i), LMin[i - 1]);
}
RMax[n - 1] = A.get(n - 1);
for (j = n - 2; j >= 0; --j) {
RMax[j] = Math.max(A.get(j), RMax[j + 1]);
}
i = 0; j = 0; maxDiff = 0;
while (j < n && i < n) {
if (LMin[i] <= RMax[j]) {
maxDiff = Math.max(maxDiff, j - i);
j++;
}
else {
i++;
}
}
return maxDiff;
} */
|
a04bedea4dabb0d9a94b210abf78bc3693433dbf | 7fd64b86c7e8f63d6238fe93ccf6e62a4b8ebc66 | /codeforces/900/E.cpp | 4ebcefe0aa0f8359b2d9a0c4541d2d6d70b43343 | [] | no_license | Mohammad-Yasser/harwest | 775ba71303cc2849f71e82652263f31e79bd8e04 | d01834a9a41c828c8c548a115ecefd77ff2d6adc | refs/heads/master | 2023-02-02T23:37:54.186079 | 2013-09-19T19:28:00 | 2020-12-21T14:30:32 | 323,233,072 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,071 | cpp | E.cpp | #ifndef Local
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx")
#endif
#include <bits/stdc++.h>
#include <ext/numeric>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace __gnu_cxx;
using namespace std;
#define popCnt(x) (__builtin_popcountll(x))
#define sz(x) ((int)(x.size()))
#define all(v) begin(v), end(v)
typedef long long Long;
typedef double Double;
const int N = 1e5 + 5;
int m;
struct Result {
int occ;
int cost;
bool operator<(const Result& other) const {
return make_tuple(-occ, cost) < make_tuple(-other.occ, other.cost);
}
Result operator+(const Result& other) const {
Result res = other;
res.occ += occ;
res.cost += cost;
return res;
}
Result(int occ = 0, int cost = 0) : occ(occ), cost(cost) {}
};
Result memo[N];
int end_[N];
int cnt_q[N];
string s;
int n;
vector<int> occ[2][2];
Result solve(int ind) {
if (ind + m > n) return Result(0, 0);
auto& res = memo[ind];
if (res.occ != -1) return res;
res = solve(ind + 1);
if (end_[ind] >= ind + m && s[ind] != 'b') {
res = min(res, Result(1, cnt_q[ind + m] - cnt_q[ind]) + solve(ind + m));
}
// cout << ind << " " << res.occ << " " << res.cost << " " << end_[ind] <<
// endl;
return res;
}
int getPos(const vector<int>& v, int val) { return *lower_bound(all(v), val); }
int main() {
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#ifdef Local
freopen("test.in", "r", stdin);
#else
#define endl '\n'
#endif
cin >> n >> s >> m;
for (int i = 0; i < s.size(); ++i) {
if (s[i] == 'a') {
occ[0][i & 1].emplace_back(i);
} else if (s[i] == 'b') {
occ[1][i & 1].emplace_back(i);
}
}
for (int i = 0; i < 2; ++i) {
for (int j = 0; j < 2; ++j) {
occ[i][j].emplace_back(N);
}
}
end_[n] = end_[n + 1] = end_[N] = N;
for (int i = n - 1; i >= 0; --i) {
if (s[i] == 'b') {
end_[i] = getPos(occ[1][~i & 1], i);
} else if (s[i] == 'a') {
end_[i] = getPos(occ[0][~i & 1], i);
int nxt_b = getPos(occ[1][i & 1], i);
end_[i] = min(end_[i], nxt_b);
nxt_b = min(nxt_b, getPos(occ[1][~i & 1], i));
end_[i] = min(end_[i], end_[i + 2]);
end_[i] = min(end_[i], end_[nxt_b]);
} else {
int nxt_a = getPos(occ[0][0], i);
nxt_a = min(nxt_a, getPos(occ[0][1], i));
if (nxt_a == N) {
end_[i] = N;
} else if ((nxt_a & 1) != (i & 1)) {
end_[i] = nxt_a;
} else {
end_[i] = end_[nxt_a];
}
int nxt_b = getPos(occ[1][i & 1], i);
end_[i] = min(end_[i], nxt_b);
nxt_b = min(nxt_b, getPos(occ[1][~i & 1], i));
end_[i] = min(end_[i], end_[nxt_b]);
}
}
for (int i = 1; i <= n; ++i) {
cnt_q[i] = cnt_q[i - 1] + (s[i - 1] == '?');
}
memset(memo, -1, sizeof memo);
cout << solve(0).cost << endl;
return 0;
} |
9a76eaa0ec8b360be6e8d1727b700ffb6715a46b | db666b5c6b5381c55c716f95818a7ecc241d59c7 | /C++/1223-diceRollSimulation.cpp | c9ce246a4fdd3842ce2e5221a85080cb6755ce26 | [] | no_license | SaberDa/LeetCode | ed5ea145ff5baaf28ed104bb08046ff9d5275129 | 7dc681a2124fb9e2190d0ab37bf0965736bb52db | refs/heads/master | 2023-06-25T09:16:14.521110 | 2021-07-26T21:58:33 | 2021-07-26T21:58:33 | 234,479,225 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 545 | cpp | 1223-diceRollSimulation.cpp | #include <iostream>
#include <vector>
using namespace std;
int dieSimulator(int n, vector<int> &rollMax) {
long p = 1e9 + 7;
vector<vector<long>> dp(n + 1, vector<long>(6, 0));
vector<long> sum(n + 1, 0);
sum[0] = 1;
for (int i = 1; i <= n; i++) {
for (int j = 0; j < 6; j++) {
for (int k = 1; k <= rollMax[j] && k <= i; k++) {
dp[i][j] = (dp[i][j] + sum[i - k] - dp[i - k][j] + p) % p;
}
sum[i] = (sum[i] + dp[i][j]) % p;
}
}
return sum.back();
} |
b955180e4a7606ad90883071f8a05432dd49d43a | 48d4cc56a3494276df563013e46cc29c22931bcf | /vs2017/ui/mainwindow/contact/localsearch/LocalSearchListItemWidget.h | af3d28e1de34cfb151d70923738ef049de8592f6 | [
"MIT"
] | permissive | cheechang/cppcc | 8e8fde9eedc84641b3bc64efac116a32471ffa1d | 0292e9a9b27e0579970c83b4f6a75dcdae1558bf | refs/heads/main | 2023-03-16T23:09:56.725184 | 2021-03-05T09:46:28 | 2021-03-05T09:46:28 | 344,737,972 | 0 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 354 | h | LocalSearchListItemWidget.h | #ifndef LOCALSEARCHLISTITEMWIDGET_H
#define LOCALSEARCHLISTITEMWIDGET_H
#include "../group/GroupListItemWidget.h"
namespace ui{
class LocalSearchListItemWidget : public GroupListItemWidget
{
Q_OBJECT
public:
LocalSearchListItemWidget(QWidget *parent=CNull);
~LocalSearchListItemWidget();
private:
};
}
#endif // LOCALSEARCHLISTITEMWIDGET_H
|
b8e656459b6242ce950823512c7ee13594f0b73a | 9e39e452a0bb8c25813003454ee306f03fb535dd | /Assigment1_18435522/Board.h | 5e55dcf0ae51905e77e2ada3a96514c61b7931ef | [] | no_license | vioswift/TicTacToe | 74200615ddd0795cf440d30e8dcdb6c93d92705d | b0880a5e33d0a16958017e5549af056133f18ce6 | refs/heads/master | 2020-08-17T12:27:44.128254 | 2019-10-17T00:06:29 | 2019-10-17T00:06:29 | 215,666,459 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,169 | h | Board.h | #pragma once
#include <iostream>
#include <string>
#include <cstdlib>
#include <time.h>
#include <iomanip>
using namespace std;
class Board {//assuming player X will always make for the first move and the human
private:
const int WHITE = -1;//O
const int BLACK = 1;//X
const int EMPTY = 0;//empty
int numberOfMoves = 0;
int currentPlaying = BLACK;//the current player
int boardSize;//row, column size on board
int winningLength; //K, number of stone sin a row to win
public:
int **board;//M, the size of the board, 1=BLACK, -1=WHITE, 0=EMPTY, bard elmeents are set to 0
//initlizez the board
Board(int bSize = 3, int winLen = 3);
~Board();
int getBoardSize();
/* Displays the board */
void displayBoard();
/* places the piece on the board, if returns false it was an invalid move */
bool placeOnBoard(int onRow, int onCol, char piece);
/* VALIDAATION checks if the user input meets the boundies */
bool validRange(int range);
/* prints the winner or prints draw */
void printWinState();
/* gets number of current moves */
int getNumOfMoves();
/* adds another move and switches to next player */
void addmove(int type);
/* Gets the current player */
char getCurrentPlayer();
/* checks if the board is full */
bool isBoardFull();
/* converts the number to what is seen on the board, 1=BLACK (X), -1=WHITE (O), 0=EMPTY, (num to char) */
char intInterpreter(int num);
/* converts the integer to what is seen on the board, 1=BLACK (X), -1=WHITE (O), 0=EMPTY, (char to number) */
int charInterpreter(char piece);
/* gives a random number between 0 and BOARD_SIZE */
int rndNum(int bSize);
/* gets winning length number */
int getWinLength();
/* Did the move just taken allow the player to win */
bool winningMove();
/* checks rows for wins - */
bool winRow();
/* checks columns for wins | */
bool winCol();
/* checks for win on Primary Diagonal ( \ ) */
bool winPriDiag();
/* checks for win on Secoundary Diagonal ( / ) */
bool winSecDiag();
/* cleans the board setting all values to 0 */
void cleanBoard();
/* checks if the board spot is empty or not, 0 */
bool isEmpty(int row, int col);
}; |
fad18e2f8d41d88b63eb6563358defaed7ccc303 | 7ea5365a0424c50be888cfba52c54fab1779b879 | /Old/대건/iseq_11.cpp | 6c2b4be4064b4f909b17e7b60c9939033a7b0668 | [] | no_license | judemin/AlgorithmSolutions | a3e26fb7685f7357fad7fe05743f975fe2fde406 | cef19d14ab7bf9ca70aa73f87d49834f2ee24f31 | refs/heads/master | 2023-06-29T05:22:00.109993 | 2021-08-04T07:07:25 | 2021-08-04T07:07:25 | 259,854,361 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 233 | cpp | iseq_11.cpp | #include<iostream>
using namespace std;
int main(void){
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int a,b;
cin >> a >> b;
cout << a+b;
if(a+b >= 140)
cout << " 합격";
else
cout << " 불합격";
} |
abcba88804e8d87668363c77c62f62fc57d82f33 | 98921e20fd8b08a5ea2379ac5d65016145f3318b | /0. Test/src/Rectangulo.cpp | a1ab5ab8b0a021b8529865c85f1e059900bdf811 | [] | no_license | OscarArturoGonzalez/Sistemas-Distribuidos | e8769ae6ea17a38c61200f79228d038a3f5e73ab | 782ff5f42a32ecda67a4fb047b98043c0f0ad100 | refs/heads/master | 2020-07-13T08:30:39.999786 | 2019-09-25T23:45:47 | 2019-09-25T23:45:47 | 205,045,369 | 0 | 0 | null | 2019-08-29T00:09:36 | 2019-08-29T00:09:36 | null | UTF-8 | C++ | false | false | 484 | cpp | Rectangulo.cpp | #include "../lib/Rectangulo/Rectangulo.h"
#include "../lib/Coordenada/Coordenada.h"
#include <iostream>
#include <stdlib.h>
#include <math.h>
using namespace std;
Rectangulo::Rectangulo() : superiorIzq(0, 0, 0), inferiorDer(0, 0, 0){
}
Rectangulo::Rectangulo(Coordenada supIzq, Coordenada infDer){
superiorIzq = supIzq;
inferiorDer = infDer;
}
Coordenada Rectangulo::obtieneSupIzq() {
return superiorIzq;
}
Coordenada Rectangulo::obtieneInfDer() {
return inferiorDer;
} |
b84d69145f76ca1573f8c40789d52267e23f42bc | 1bc2fc2e9bb164371d868bd29b0ce99fb5ae6908 | /海提原图处理/海提final/海提final/海提程序/Unit4.~h | 3f03fc5b99d81077f4698f0ea12b0ef212147e7c | [] | no_license | w351565056/DataMining | a76857675c1280d7f6eb37d2f03afdf0fc564d28 | 10421eff9ffaff247fc078d22e308b8cc6d9b623 | refs/heads/master | 2020-03-28T05:46:12.726721 | 2018-09-07T08:44:33 | 2018-09-07T08:44:33 | 147,795,561 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,884 | Unit4.~h | //---------------------------------------------------------------------------
#ifndef Unit4H
#define Unit4H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include <Dialogs.hpp>
//---------------------------------------------------------------------------
class TForm4 : public TForm
{
__published: // IDE-managed Components
TGroupBox *GroupBox1;
TImage *Image1;
TButton *Button1;
TLabel *Label1;
TLabel *Label2;
TLabel *Label3;
TLabel *Label4;
TLabel *Label5;
TLabel *Label6;
TLabel *Label7;
TLabel *Label8;
TLabel *Label9;
TLabel *Label10;
TLabel *Label11;
TLabel *Label12;
TLabel *Label13;
TLabel *Label14;
TLabel *Label15;
TLabel *Label16;
TLabel *Label17;
TLabel *Label18;
TLabel *Label19;
TLabel *Label20;
TLabel *Label21;
TLabel *Label22;
TEdit *Edit1;
TLabel *Label23;
TLabel *Label24;
TEdit *Edit2;
TOpenDialog *OpenDialog1;
TButton *Button3;
void __fastcall Button1Click(TObject *Sender);
void __fastcall Edit1Change(TObject *Sender);
//void __fastcall Button2Click(TObject *Sender);
void __fastcall Edit2Change(TObject *Sender);
void __fastcall Button3Click(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TForm4(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm4 *Form4;
//---------------------------------------------------------------------------
#endif
| |
24995c7b5c67e9a3b84467d421f1407ab23c21ff | 745b47b75192fdee5bd5c5a706d425233e172639 | /golden/golden.cpp | afb3b2c7e265b7162fd901d190fd65a1ca7d7de0 | [] | no_license | andy39866821/EE6470-Implement-of-Many-Core-System-Homework6 | 1609567a90ac8da92c1e7cdef6b0688f7d7eff8b | cc73ad32b57b6a5e06093760d589a67680ca6a3c | refs/heads/main | 2023-04-28T23:30:06.135762 | 2021-05-25T05:13:40 | 2021-05-25T05:13:40 | 370,416,717 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,277 | cpp | golden.cpp | #include <bits/stdc++.h>
using namespace std;
unsigned char* image_s = NULL; // source image array
unsigned char* image_t = NULL; // target image array
int width_s = 0; // image width
int height_s = 0; // image height
int width_t = 0; // image width
int height_t = 0; // image height
unsigned int rgb_raw_data_offset_s = 0; // RGB raw data offset
unsigned int bit_per_pixel_s = 0; // bit per pixel
unsigned int byte_per_pixel_s = 0; // byte per pixel
unsigned int rgb_raw_data_offset_t = 0; // RGB raw data offset
unsigned int bit_per_pixel_t = 0; // bit per pixel
unsigned int byte_per_pixel_t = 0; // byte per pixel
const int filter[3][3] = {
{1,2,1},
{2,4,2},
{1,2,1}
};
const int factor = 16;
int read_input_bmp() {
FILE* fp_s = fopen("input.bmp", "rb");
if (fp_s == NULL) {
std::cerr << "fopen fp_s error" << std::endl;
return -1;
}
fseek(fp_s, 10, SEEK_SET);
assert(fread(&rgb_raw_data_offset_s, sizeof(unsigned int), 1, fp_s));
fseek(fp_s, 18, SEEK_SET);
assert(fread(&width_s, sizeof(unsigned int), 1, fp_s));
assert(fread(&height_s, sizeof(unsigned int), 1, fp_s));
fseek(fp_s, 28, SEEK_SET);
assert(fread(&bit_per_pixel_s, sizeof(unsigned short), 1, fp_s));
byte_per_pixel_s = bit_per_pixel_s / 8;
fseek(fp_s, rgb_raw_data_offset_s, SEEK_SET);
size_t size = width_s * height_s * byte_per_pixel_s;
image_s = reinterpret_cast<unsigned char*>(new void* [size]);
if (image_s == NULL) {
std::cerr << "allocate image_s error" << std::endl;
return -1;
}
image_t = reinterpret_cast<unsigned char*>(new void* [size]);
if (image_t == NULL) {
std::cerr << "allocate image_t error" << std::endl;
return -1;
}
assert(fread(image_s, sizeof(unsigned char),
(size_t)(long)width_s * height_s * byte_per_pixel_s, fp_s));
fclose(fp_s);
return 0;
}
int read_output_bmp() {
FILE* fp_s = fopen("output.bmp", "rb");
if (fp_s == NULL) {
std::cerr << "fopen fp_s error" << std::endl;
return -1;
}
fseek(fp_s, 10, SEEK_SET);
assert(fread(&rgb_raw_data_offset_t, sizeof(unsigned int), 1, fp_s));
fseek(fp_s, 18, SEEK_SET);
assert(fread(&width_t, sizeof(unsigned int), 1, fp_s));
assert(fread(&height_t, sizeof(unsigned int), 1, fp_s));
fseek(fp_s, 28, SEEK_SET);
assert(fread(&bit_per_pixel_t, sizeof(unsigned short), 1, fp_s));
byte_per_pixel_t = bit_per_pixel_t / 8;
fseek(fp_s, rgb_raw_data_offset_t, SEEK_SET);
size_t size = width_t * height_t * byte_per_pixel_t;
image_t = reinterpret_cast<unsigned char*>(new void* [size]);
if (image_t == NULL) {
std::cerr << "allocate image_s error" << std::endl;
return -1;
}
image_t = reinterpret_cast<unsigned char*>(new void* [size]);
if (image_t == NULL) {
std::cerr << "allocate image_t error" << std::endl;
return -1;
}
assert(fread(image_t, sizeof(unsigned char),
(size_t)(long)width_t * height_t * byte_per_pixel_t, fp_s));
fclose(fp_s);
return 0;
}
string dec_to_hex(int num) {
string ans = "0x";
string hex[16] = { "0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f" };
ans += hex[num / 16];
ans += hex[num % 16];
return ans;
}
int main() {
int cnt = 0;
bool pass = true;
read_input_bmp();
cout << "width_s :" << width_s << endl;
cout << "height_s :" << height_s << endl;
cout << "width_s x height_s: " << width_s * height_s << endl;
read_output_bmp();
cout << "width_t :" << width_t << endl;
cout << "height_t :" << height_t << endl;
cout << "width_t x height_t: " << width_t * height_t << endl;
for (int i = 0; i < width_t; i++) {
for (int j = 0; j < height_t; j++) {
int R = 0, G = 0, B = 0;
for (int y = -1; y <= 1; y++) {
for (int x = -1; x <= 1; x++) {
if (0 <= i + y && i + y < height_t && 0 <= j + x && j + x < width_t) {
R += filter[x + 1][y + 1] * (int)image_s[byte_per_pixel_s * ((i + y) * width_t + j + x) + 2];
G += filter[x + 1][y + 1] * (int)image_s[byte_per_pixel_s * ((i + y) * width_t + j + x) + 1];
B += filter[x + 1][y + 1] * (int)image_s[byte_per_pixel_s * ((i + y) * width_t + j + x) + 0];
}
}
}
R /= factor;
G /= factor;
B /= factor;
if (R != (int)image_t[byte_per_pixel_s * (i* width_t + j) + 2]) {
cout << "pixel R:" << i << " " << j << " Error!!!" << endl;
cout << " Current result : " << R << endl;
cout << " Original should be : " << (int)image_s[i * width_t + j + 2] << endl;
cout << " Correct should be : " << (int)image_t[i * width_t + j + 2] << endl;
pass = false;
}
if (G != (int)image_t[byte_per_pixel_s * (i * width_t + j) + 1]) {
cout << "pixel G:" << i << " " << j << " Error!!!" << endl;
cout << " Current result : " << G << endl;
cout << " Original should be : " << (int)image_s[i * width_t + j + 1] << endl;
cout << " Correct should be : " << (int)image_t[i * width_t + j + 1] << endl;
pass = false;
}
if (B != (int)image_t[byte_per_pixel_s * (i * width_t + j) + 0]) {
cout << "pixel B:" << i << " " << j << " Error!!!" << endl;
cout << " Current result : " << B << endl;
cout << " Original should be : " << (int)image_s[i * width_t + j + 0] << endl;
cout << " Correct should be : " << (int)image_t[i * width_t + j + 0] << endl;
pass = false;
}
}
}
if (pass == true) {
cout << "All PASS" << endl;
}
else {
cout << "Failed" << endl;
}
fstream file;
file.open("input_bitmap.h", ios::out);
file << "int width = " << width_s << ";" << endl;
file << "int height = " << height_s << ";" << endl;
file << "int byte_per_pixel = " << byte_per_pixel_s << ";" << endl;
file << "unsigned char input_bmp[] = {" << endl;
for (int i = 0; i < width_s * height_s * byte_per_pixel_s; i++) {
file << dec_to_hex((int)image_s[i]);
if (i != width_s * height_s * byte_per_pixel_s - 1)
file << ", ";
if (i % 12 == 11)
file << endl;
}
file << "};";
file.close();
file.open("output_bitmap.h", ios::out);
file << "int width = " << width_t << ";" << endl;
file << "int height = " << height_t << ";" << endl;
file << "int byte_per_pixel = " << byte_per_pixel_t << ";" << endl;
file << "unsigned char output_bmp[] = {" << endl;
for (int i = 0; i < width_t * height_t * byte_per_pixel_t; i++) {
file << dec_to_hex((int)image_t[i]);
if (i != width_t * height_t * byte_per_pixel_t - 1)
file << ", ";
if (i % 12 == 11)
file << endl;
}
file << "};";
file.close();
}
|
0365166fe65580996ec163c641c86cd40a79b7e4 | 93c65db089da913177dbcc91b0684e7ef4d6f0ac | /openexr-c/abigen/imf_timecode.cpp | 1eeca07fa5e3ba73b3269c9f74b76b73d85a2513 | [
"BSD-3-Clause"
] | permissive | bgyss/openexr-bind | 2e20075fa7b4d237c694d6afc3ddca6fa54e432c | ee4fd6010beedb0247737a39ee61ffb87c586448 | refs/heads/main | 2023-07-10T11:08:05.099940 | 2021-09-02T08:33:45 | 2021-09-02T08:33:45 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 251 | cpp | imf_timecode.cpp | #include <OpenEXR/IexBaseExc.h>
#include <OpenEXR/ImfTimeCode.h>
#include "imf_timecode.hpp"
void abi_gen_imf_timecode(std::ostream& os) {
os << "Imf_3_0::TimeCode" << "|" << sizeof(Imf_3_0::TimeCode) << "|" << alignof(Imf_3_0::TimeCode) << "\n";
}
|
5e94288f4410d663e7c6d3ce06897b95d2c633f9 | 013caff69e41c36c4efe9359c8ce2ecfb5f659ab | /Keywords Search-AC自动机.cpp | 7d13fadbf65247d083d42ad0a474cb34098224d0 | [] | no_license | iamsile/ACM | cbe5754bed56b1abb3cfaed6b25b9bffa1ec04a5 | d51e43780e33b51c70007ba0702448909f9d0553 | refs/heads/master | 2016-08-04T02:31:51.523885 | 2013-09-09T05:36:35 | 2013-09-09T05:36:35 | 12,693,702 | 9 | 5 | null | null | null | null | UTF-8 | C++ | false | false | 2,861 | cpp | Keywords Search-AC自动机.cpp | #include <iostream>
#include <queue>
using namespace std;
struct node {
int cnt;
node *next[26],*fail;
node() {
cnt=0;
memset(next, 0, sizeof(next));
fail=NULL;
}
};
void build(char s[],node *root)
{
int i,k=strlen(s);
node *p=root;
for (i=0; i<k; i++) {
if (p->next[s[i]-'a']==NULL)
p->next[s[i]-'a']=new node();
p=p->next[s[i]-'a'];
}
p->cnt++;
}
void buildac(node *root)
{
root->fail=NULL;
node *cur,*p;
queue<node *> q;
q.push(root);
while (!q.empty()) {
cur=q.front();
q.pop();
for (int i=0; i<26; i++)
if (cur->next[i]) {
p=cur->fail;
while (p) {
if (p->next[i]) {
cur->next[i]->fail=p->next[i];
break;
}
p=p->fail;
}
if (p==NULL)
cur->next[i]->fail=root;
q.push(cur->next[i]);
}
}
}
int query(char s[],node *root)
{
node *p=root;
int i,ans=0,ind,k=strlen(s);
for(i=0; i<k; i++) {
ind=s[i]-'a';
while(p->next[ind]==NULL&&p!=root )
p=p->fail;
p=(p->next[ind]==NULL) ? root : p->next[ind];
node *cur=p;
while(cur!=root&&cur->cnt!=-1) {
ans+=cur->cnt;
cur->cnt=-1;
cur=cur->fail;
}
}
return ans;
}
int main()
{
int t;
scanf("%d",&t);
while (t--) {
int i,n;
char a[90],str[1000005];
scanf("%d",&n);
node *root=new node();
for (i=0; i<n; i++) {
scanf("%s",a);
build(a,root);
}
scanf("%s",str);
buildac(root);
printf("%d\n",query(str,root));
}
return 0;
}
/*
Problem Description
In the modern time, Search engine came into the life of everybody like Google, Baidu, etc.
Wiskey also wants to bring this feature to his image retrieval system.
Every image have a long description, when users type some keywords to find the image, the system will match the keywords with description of image and show the image which the most keywords be matched.
To simplify the problem, giving you a description of image, and some keywords, you should tell me how many keywords will be match.
Input
First line will contain one integer means how many cases will follow by.
Each case will contain two integers N means the number of keywords and N keywords follow. (N <= 10000)
Each keyword will only contains characters 'a'-'z', and the length will be not longer than 50.
The last line is the description, and the length will be not longer than 1000000.
Output
Print how many keywords are contained in the description.
Sample Input
1
5
she
he
say
shr
her
yasherhs
Sample Output
3
*/ |
9a01198d1680cda31fb9c0a8173a2d49f23ea576 | df6c3d7d95507bf452ce8eda24e779a82049fcad | /final-project/simulationInertial/46/phi | bed9acfa0f474ee8b66c781bc9f10aa274308d3f | [] | no_license | aeronau/CFD-course | 5c555e7869f0170f90e9d3532b06f7e78683b770 | e891eb94950cfa0992d6ff003dbe45315af377c5 | refs/heads/master | 2021-09-01T04:18:32.111694 | 2017-12-24T18:18:44 | 2017-12-24T18:18:44 | 104,058,197 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 113,877 | phi | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class surfaceScalarField;
location "46";
object phi;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 3 -1 0 0 0 0];
internalField nonuniform List<scalar>
11516
(
9.98727e+06
307.624
9825.45
9.96862e+06
222.112
21324.6
9.9398e+06
352.483
31468.2
9.90163e+06
387.748
41090.3
9.8543e+06
489.159
50626
9.79778e+06
648.098
60224.1
9.73178e+06
765.148
69985.4
9.65578e+06
788.049
80038.3
9.56906e+06
720.934
90522.5
9.47067e+06
580.147
101747
9.36022e+06
449.574
113478
9.23846e+06
400.344
124911
9.10769e+06
475.119
134974
8.97421e+06
661.232
140072
8.85162e+06
-12.4791
133738
8.75379e+06
-1139.32
112476
8.70451e+06
1065.27
62045.9
8.70664e+06
1369.26
6843.28
8.7176e+06
1084.62
-4736.35
8.6901e+06
2050.64
30833.2
8.62679e+06
-731.604
68279.7
8.52492e+06
-4224.23
110040
8.39024e+06
-7343.16
146245
8.22923e+06
-10077.6
175909
8.04365e+06
-12321.9
203245
7.85628e+06
-14094.5
207815
7.68348e+06
-11594
193007
7.53507e+06
-5733.36
165272
7.41392e+06
-3357.07
137914
7.32267e+06
-6359.04
112639
7.25848e+06
-10829.2
92439.9
7.20875e+06
-17748.7
85237.5
7.19041e+06
-18904.9
55516.8
7.23481e+06
-1618.15
-21188.3
7.38407e+06
19286.1
-124756
7.58068e+06
21783.5
-165752
7.72106e+06
30988.6
-106030
7.83761e+06
28831.1
-53545.5
7.91637e+06
14738.2
-16481
7.99719e+06
1547.45
121.185
8.08989e+06
2697.1
-27121.1
8.18911e+06
16761.8
-64356.3
8.25923e+06
26960.8
-75564.1
8.31886e+06
39925.7
-88090
8.36224e+06
23237.7
-91682.2
8.4332e+06
-5684.1
-154759
8.43564e+06
6006.45
-121289
8.46918e+06
2756.86
-172733
8.56625e+06
45240.4
-285982
8.75452e+06
-29855.9
-395777
9.08726e+06
20640.6
-461874
9.41313e+06
-32822.8
-674098
1.04003e+07
73564.7
-1.03158e+06
61059.2
-1.4358e+06
9.98775e+06
9822.22
9.96862e+06
21332.7
9.9396e+06
31457.2
9.90125e+06
41043.8
9.85386e+06
50556.7
9.79738e+06
60175.7
9.73147e+06
69990.7
9.6555e+06
80144.8
9.56866e+06
90773
9.47007e+06
102127
9.35931e+06
114010
9.23728e+06
125482
9.10605e+06
135658
8.97138e+06
141001
8.84298e+06
136103
8.74148e+06
109505
8.69506e+06
55573.7
8.70399e+06
-1938.98
8.72024e+06
-11001.8
8.69538e+06
30050.3
8.63268e+06
65088.1
8.53297e+06
98735
8.39963e+06
129365
8.23695e+06
156192
8.04543e+06
183280
7.8497e+06
187003
7.66785e+06
177263
7.50687e+06
164056
7.37406e+06
140142
7.2883e+06
93192.4
7.25597e+06
36929.9
7.25568e+06
-80.0086
7.2738e+06
-17290.3
7.32749e+06
-33953.3
7.45159e+06
-75779.9
7.61959e+06
-96450
7.76377e+06
-51714.6
7.89134e+06
-31200
7.99627e+06
-17308.8
8.0862e+06
-31336.5
8.15581e+06
-24552.5
8.23399e+06
-34309.5
8.31987e+06
-32226.9
8.3929e+06
-44932.4
8.4253e+06
-33423.4
8.45876e+06
-94165.5
8.47195e+06
-85920.9
8.5036e+06
-102571
8.54024e+06
-186138
8.85592e+06
-318385
9.03585e+06
-468323
9.55568e+06
-589341
1.04566e+07
-880911
-1.22756e+06
1.00066e+07
308.916
5614.43
1.00148e+07
188.122
15708.2
1.00231e+07
314.011
25758.8
1.00313e+07
367.534
35776.7
1.00392e+07
498.707
45991.2
1.00468e+07
692.587
56559.2
1.00537e+07
859.198
67557
1.00597e+07
952.243
78884.1
1.00641e+07
965.133
91270
1.00668e+07
918.301
104093
1.00674e+07
842.018
117792
1.0065e+07
792.826
132003
1.0058e+07
886.79
146650
1.00426e+07
1151.53
160335
1.00044e+07
2953.38
175350
9.93081e+06
3193.96
188679
9.80163e+06
3067.47
194393
9.59687e+06
2478.91
212124
9.36963e+06
-581.102
224926
9.16988e+06
-1345.51
233844
8.9956e+06
346.332
244353
8.84477e+06
1955.05
261014
8.70479e+06
3394.66
284836
8.5648e+06
4930.98
312881
8.4261e+06
6073.77
338014
8.28405e+06
7517.71
345401
8.13449e+06
9197.48
338042
7.95916e+06
12755.6
334369
7.76236e+06
19455.8
322293
7.56331e+06
22822.7
296139
7.37948e+06
24199.4
258882
7.24964e+06
26799.2
193640
7.20656e+06
23814.2
79885.8
7.25711e+06
17789.5
-80135.8
7.40272e+06
9618.19
-258245
7.53102e+06
4931.26
-246714
7.63517e+06
-8094.68
-124227
7.72994e+06
-14806
-54018.9
7.79212e+06
-19953.2
9424.84
7.88013e+06
-34439.1
-18989.2
7.95969e+06
-29160.3
-51940.6
7.99746e+06
-40891.1
-35865.8
8.01721e+06
-46321.8
-22293
8.02796e+06
-48862.9
-49115.6
8.04248e+06
-57823.1
-73750.6
8.04228e+06
-69994.8
-146240
8.05275e+06
-79588.4
-152089
8.09397e+06
-78774.5
-231723
8.10795e+06
-83675.1
-356718
8.22682e+06
-126720
-563211
8.13857e+06
-65700.6
-450803
8.26255e+06
114000
-1.03483e+06
9.55147e+06
217415
-2.63106e+06
31102.5
-3.07022e+06
1.00071e+07
5609.89
1.00148e+07
15704.6
1.00229e+07
25747
1.00308e+07
35753.7
1.00386e+07
45954.6
1.00462e+07
56511.2
1.00533e+07
67507.9
1.00595e+07
78853.3
1.00641e+07
91296.4
1.0067e+07
104197
1.00678e+07
118013
1.00656e+07
132363
1.00591e+07
146997
1.00448e+07
160721
1.00156e+07
173178
9.94929e+06
183265
9.81229e+06
199247
9.60271e+06
211724
9.37042e+06
222001
9.17088e+06
229656
8.9999e+06
237914
8.85044e+06
251644
8.71327e+06
271405
8.57778e+06
298155
8.44679e+06
322207
8.31475e+06
329569
8.17378e+06
332195
8.01714e+06
339738
7.85413e+06
330649
7.6888e+06
291144
7.50877e+06
249511
7.35185e+06
189731
7.27944e+06
85274.4
7.32356e+06
-48791.8
7.45277e+06
-170097
7.62099e+06
-208415
7.76541e+06
-144277
7.86998e+06
-83645.8
7.93181e+06
-51924.7
8.01379e+06
-104981
8.08977e+06
-106120
8.14903e+06
-106849
8.17959e+06
-92503.2
8.20865e+06
-108266
8.23698e+06
-139529
8.25183e+06
-237620
8.28844e+06
-264857
8.31104e+06
-297308
8.34526e+06
-401054
8.42955e+06
-648938
8.33981e+06
-491910
8.72751e+06
-918670
9.8647e+06
-1.82536e+06
-2.91017e+06
9.99931e+06
304.677
7245.44
9.99571e+06
185.275
21829.8
9.98758e+06
305.236
36385.4
9.97532e+06
355.734
50788.3
9.95915e+06
492.139
65352.2
9.93922e+06
705.272
80264.3
9.91576e+06
903.764
95420.3
9.8881e+06
1035.53
111510
9.85688e+06
1084.44
127819
9.82123e+06
1059.15
145203
9.78155e+06
974.713
162889
9.73749e+06
889.107
181268
9.68856e+06
779.728
200433
9.63274e+06
937.373
220431
9.57111e+06
866.626
240374
9.49696e+06
2118.61
264675
9.40467e+06
2027.1
288104
9.31091e+06
2268.17
305113
9.21081e+06
322.199
326176
9.09627e+06
554.128
349711
8.97072e+06
1043.48
370885
8.8431e+06
1740.4
388922
8.71572e+06
2917.39
411310
8.58654e+06
5117.47
438988
8.45291e+06
6487.92
467538
8.31099e+06
9079.46
482082
8.14753e+06
14050.2
493537
7.93955e+06
20146.2
530068
7.68501e+06
24045.2
561599
7.39915e+06
19171.5
571169
7.11066e+06
13698.7
540257
6.87939e+06
21639.9
407856
6.74198e+06
45814.7
176723
6.74816e+06
70436
-146854
6.93804e+06
53751
-484201
7.11156e+06
-8257.11
-381768
7.17914e+06
-73857.9
-71416.3
7.22062e+06
-97370.6
52962.3
7.20277e+06
-108542
162509
7.27233e+06
-69369.8
1508.24
7.32539e+06
-43381.1
-51879.2
7.32821e+06
-59021
39081.4
7.34364e+06
-79564.6
70386.3
7.39284e+06
-80090.8
9631.26
7.44138e+06
-72413.8
-63201.2
7.41001e+06
-51020.3
-120665
7.43928e+06
-48624.2
-209814
7.50312e+06
-69152.6
-327950
7.66896e+06
-97141.7
-507402
7.97986e+06
-93308.8
-832612
8.60092e+06
-85892.2
-997849
8.82247e+06
-50528
-1.20579e+06
7.16708e+06
433769
-1.36413e+06
300407
-2.62483e+06
9.99977e+06
7242.48
9.99571e+06
21827.8
9.98735e+06
36372.1
9.9749e+06
50763.8
9.95865e+06
65320.7
9.93879e+06
80230.8
9.9155e+06
95392.1
9.88801e+06
111496
9.85691e+06
127830
9.8213e+06
145247
9.78159e+06
162969
9.73751e+06
181361
9.68846e+06
200523
9.6331e+06
220297
9.56935e+06
240403
9.49396e+06
263277
9.4076e+06
289848
9.3139e+06
309625
9.21248e+06
324989
9.09921e+06
344839
8.9758e+06
363891
8.85097e+06
379729
8.7268e+06
400077
8.59805e+06
433632
8.4658e+06
463032
8.32787e+06
480100
8.17261e+06
506832
7.98558e+06
554101
7.7555e+06
593777
7.4693e+06
605268
7.16552e+06
572624
6.93502e+06
446262
6.83873e+06
232895
6.89704e+06
-29505.6
7.10148e+06
-302885
7.27737e+06
-359429
7.38946e+06
-290013
7.45874e+06
-217726
7.48552e+06
-149739
7.56264e+06
-222083
7.61929e+06
-189787
7.61396e+06
-132202
7.60699e+06
-121600
7.62015e+06
-184664
7.6464e+06
-254583
7.64409e+06
-320292
7.6684e+06
-393531
7.72308e+06
-478437
7.82714e+06
-663775
8.06374e+06
-995938
8.59726e+06
-1.0938e+06
8.84172e+06
-1.26148e+06
8.28161e+06
-773694
-2.49578e+06
9.99897e+06
300.91
9283.26
9.99549e+06
185.43
27811.4
9.98773e+06
299.558
46582.5
9.97588e+06
342.696
65297.1
9.95994e+06
469.423
84351.3
9.94005e+06
672.585
103785
9.91542e+06
863.535
124302
9.88634e+06
991.037
145398
9.85215e+06
1039.21
167158
9.81255e+06
1011.06
190018
9.76689e+06
923.113
213613
9.71444e+06
802.739
238364
9.65482e+06
660.356
264142
9.58727e+06
563.942
290911
9.51008e+06
475.447
320137
9.42458e+06
1296.87
351844
9.32693e+06
1197.53
389505
9.2231e+06
1090.67
412616
9.12615e+06
99.624
425390
9.03138e+06
743.613
446024
8.93053e+06
1305.79
472771
8.82213e+06
1358.58
498389
8.70031e+06
1410.75
534138
8.56567e+06
2310.49
573709
8.41837e+06
2364.9
615032
8.25241e+06
3692.05
648204
8.04851e+06
7862.04
694920
7.77847e+06
10238.8
796264
7.42392e+06
7840.93
915631
7.01771e+06
6654.63
976827
6.65475e+06
7906.78
898912
6.39384e+06
13254.9
657519
6.25949e+06
27414
284628
6.3095e+06
49847.8
-245708
6.52324e+06
38064.1
-734855
6.66647e+06
-73666.4
-445547
6.63772e+06
-193335
166256
6.59259e+06
-261828
382012
6.51306e+06
-241461
495648
6.59243e+06
-142673
80243.6
6.62223e+06
-55144.2
-21607.2
6.60988e+06
-77333.6
147780
6.62004e+06
-64932.6
186989
6.65681e+06
-51356.1
61623.4
6.69549e+06
-37188.7
-48708.3
6.64892e+06
-40259.7
-55812.1
6.62453e+06
-60086.2
-169857
6.58951e+06
-50081.2
-309518
6.6539e+06
-54302.2
-581123
6.71421e+06
-48090.9
-891698
6.91573e+06
-42422.2
-1.05193e+06
6.73955e+06
-36354.5
-942956
5.00497e+06
416689
-95169.7
848162
-711951
9.99943e+06
9282
9.99548e+06
27809.9
9.9875e+06
46571.1
9.97546e+06
65284.5
9.95944e+06
84348.1
9.93962e+06
103791
9.91516e+06
124314
9.88626e+06
145408
9.85218e+06
167160
9.81262e+06
190004
9.76689e+06
213580
9.71433e+06
238306
9.65442e+06
264053
9.58684e+06
290747
9.50965e+06
319905
9.42531e+06
351268
9.33241e+06
389103
9.22769e+06
419033
9.12915e+06
425645
9.03471e+06
441974
8.93424e+06
467600
8.82463e+06
492946
8.70109e+06
526950
8.56664e+06
572077
8.42145e+06
612589
8.2543e+06
653845
8.04577e+06
726849
7.77471e+06
839669
7.42672e+06
954197
7.03136e+06
1.01099e+06
6.68493e+06
929108
6.43689e+06
708878
6.29901e+06
398569
6.35041e+06
-29582.1
6.62746e+06
-536140
6.8421e+06
-631721
6.96267e+06
-581788
6.9595e+06
-456115
6.90086e+06
-307577
6.9138e+06
-355762
6.90015e+06
-222071
6.84288e+06
-122694
6.83916e+06
-123792
6.87153e+06
-229880
6.90001e+06
-313045
6.88343e+06
-363777
6.86902e+06
-477089
6.87301e+06
-593323
6.81881e+06
-718492
6.76836e+06
-945103
6.88096e+06
-1.28215e+06
6.8123e+06
-1.13546e+06
6.81538e+06
-351045
-1.29143e+06
9.99901e+06
299.713
11259.7
9.99564e+06
186.221
33682.4
9.98809e+06
300.833
56572.5
9.97652e+06
341.525
79523.6
9.96101e+06
463.87
102942
9.94153e+06
662.004
126901
9.91794e+06
848.367
152112
9.89014e+06
971.658
177891
9.8573e+06
1015.27
204923
9.81908e+06
981.409
233082
9.77501e+06
888.144
262221
9.72461e+06
764.258
292824
9.66768e+06
610.972
324490
9.60317e+06
485.3
358217
9.53089e+06
392.076
394852
9.45176e+06
672.197
435029
9.36853e+06
1765.72
480629
9.26277e+06
2767.69
525730
9.14002e+06
1392.74
551577
9.02785e+06
457.41
562590
8.9197e+06
1982.73
583286
8.80591e+06
2074.19
614921
8.67367e+06
245.729
669768
8.51895e+06
-490.951
731896
8.3423e+06
-2824.24
797150
8.12932e+06
-2881.72
867186
7.86638e+06
1072.07
959924
7.54132e+06
3036.74
1.12124e+06
7.15889e+06
514.271
1.30036e+06
6.76681e+06
695.312
1.37049e+06
6.42685e+06
5648.46
1.23472e+06
6.15342e+06
16000.3
915964
5.96203e+06
32744.2
444864
5.89618e+06
69433.3
-248014
5.99913e+06
150341
-986644
5.76819e+06
-56897.1
-150010
5.86716e+06
-137087
228608
5.94093e+06
-149724
475236
5.77697e+06
-206215
877306
5.78479e+06
-24389
103446
5.74312e+06
-13457.3
38914.3
5.72138e+06
-81104.8
282407
5.79699e+06
-15525.5
225379
5.84393e+06
31310.9
111514
5.84153e+06
36884.1
-5731.53
5.87863e+06
17338.4
-94692.3
5.86742e+06
18116.9
-248973
5.88433e+06
16610.5
-455897
5.77327e+06
40680.8
-611754
5.36783e+06
197628
-657782
4.82536e+06
220321
-762306
4.61316e+06
355950
-1.06972e+06
5.32115e+06
184988
-934158
-11365.2
-1.49721e+06
9.99947e+06
11253.7
9.99563e+06
33681.7
9.98786e+06
56568.6
9.97611e+06
79524
9.96051e+06
102954
9.9411e+06
126924
9.91768e+06
152137
9.89006e+06
177908
9.85732e+06
204918
9.81914e+06
233041
9.77502e+06
262136
9.72447e+06
292695
9.66734e+06
324341
9.60254e+06
358069
9.53026e+06
394795
9.45145e+06
435065
9.36801e+06
480683
9.26826e+06
528935
9.15216e+06
549178
9.03855e+06
561733
8.92599e+06
586978
8.803e+06
622178
8.664e+06
669402
8.50905e+06
728501
8.329e+06
791649
8.10923e+06
872445
7.85026e+06
988446
7.53924e+06
1.15527e+06
7.1779e+06
1.31755e+06
6.80681e+06
1.38406e+06
6.48442e+06
1.25814e+06
6.2392e+06
970693
6.10123e+06
570455
6.14e+06
2337.55
6.43469e+06
-670863
6.72228e+06
-955683
6.8846e+06
-871296
6.89449e+06
-608377
6.69477e+06
-301937
6.471e+06
-141562
6.25434e+06
-8053.63
6.12633e+06
-28345.3
6.17406e+06
-97738.7
6.23556e+06
-183359
6.26354e+06
-255409
6.23745e+06
-319078
6.16076e+06
-436882
6.05235e+06
-571217
5.87225e+06
-582812
5.61665e+06
-626203
5.28227e+06
-700647
5.35466e+06
-850657
5.23244e+06
-160796
-1.13159e+06
9.99905e+06
293.657
13175
9.99581e+06
188.114
39415.1
9.98857e+06
300.571
66267.9
9.97753e+06
343.24
93248.5
9.96288e+06
466.218
120709
9.94426e+06
660.634
149157
9.92182e+06
838.559
178713
9.89514e+06
948.255
209121
9.86372e+06
972.964
240978
9.82723e+06
916.565
273993
9.78481e+06
802.076
308633
9.73646e+06
668.568
344689
9.68168e+06
533.445
382380
9.62029e+06
454.461
422571
9.55314e+06
407.08
465429
9.48101e+06
842.22
512234
9.40853e+06
1795.79
561354
9.32711e+06
4464.88
617072
9.22336e+06
5359.11
663530
9.10362e+06
2402.07
694715
8.9724e+06
3421.95
724774
8.83026e+06
1634.93
767669
8.68092e+06
-2061.25
826320
8.51573e+06
-3603.08
904113
8.314e+06
-7484.72
1.00903e+06
8.05853e+06
-7010.31
1.13187e+06
7.75272e+06
-1292.82
1.26896e+06
7.41953e+06
4129.08
1.45159e+06
7.06657e+06
4187.03
1.6502e+06
6.70301e+06
5908.93
1.72924e+06
6.33912e+06
13233.9
1.58666e+06
5.96466e+06
31171
1.26139e+06
5.53295e+06
70738.8
808397
4.92328e+06
246397
117407
2.91937e+06
994261
30736.6
1.89022e+06
560444
333553
1.3225e+06
356199
477852
2.00507e+06
209093
-404746
2.77644e+06
20667.3
120284
3.65074e+06
130480
-877540
3.97966e+06
63539.6
-328954
4.20111e+06
94065.9
85907.3
4.37203e+06
167687
112371
4.47679e+06
191839
43472.5
4.48418e+06
209097
-55921.5
4.48184e+06
169197
-214668
4.32941e+06
161115
-349582
4.11135e+06
167107
-591687
3.89801e+06
208182
-818112
3.70896e+06
242258
-1.00104e+06
3.83693e+06
188702
-1.20304e+06
4.16516e+06
147523
-1.54695e+06
4.66924e+06
72111.1
-1.74753e+06
133253
-2.30094e+06
9.99949e+06
13172.1
9.9958e+06
39413.1
9.98834e+06
66254.4
9.97713e+06
93238.5
9.9624e+06
120717
9.94385e+06
149183
9.92157e+06
178748
9.89504e+06
209149
9.86372e+06
240984
9.82724e+06
273962
9.78476e+06
308556
9.73628e+06
344566
9.68131e+06
382244
9.61975e+06
422437
9.55245e+06
465446
9.48092e+06
512153
9.40988e+06
561709
9.34011e+06
614740
9.24811e+06
660417
9.12713e+06
698749
8.99189e+06
736379
8.84356e+06
782105
8.68171e+06
835399
8.50102e+06
907859
8.289e+06
997800
8.03348e+06
1.12241e+06
7.75084e+06
1.27077e+06
7.44119e+06
1.46973e+06
7.10471e+06
1.65892e+06
6.75906e+06
1.73645e+06
6.42972e+06
1.60155e+06
6.13274e+06
1.30039e+06
5.86943e+06
905967
5.73461e+06
391840
6.43074e+06
-348616
6.33116e+06
-289333
6.05404e+06
-229447
5.71201e+06
-16481.1
5.38357e+06
105308
5.16991e+06
250682
4.96324e+06
308816
4.89485e+06
222907
4.96728e+06
104059
5.05635e+06
30706
5.09667e+06
-11425.3
5.05832e+06
-105151
4.9683e+06
-255918
4.7919e+06
-363634
4.55211e+06
-335199
4.32557e+06
-281938
4.06995e+06
-348440
3.9128e+06
-710328
4.09778e+06
-323647
-1.32175e+06
9.99909e+06
290.777
15013.7
9.9961e+06
189.407
44875.8
9.98932e+06
305.402
75476.4
9.97898e+06
349.809
106270
9.9652e+06
469.914
137575
9.94763e+06
656.219
170318
9.92638e+06
822.104
204031
9.90099e+06
916.911
238881
9.87118e+06
925.63
275184
9.83583e+06
855.071
313465
9.79526e+06
733.872
352872
9.74883e+06
608.368
394390
9.69633e+06
516.456
437979
9.63819e+06
495.268
483998
9.57499e+06
569.774
532753
9.50816e+06
946.873
584737
9.43826e+06
1615.05
639254
9.36941e+06
2992.03
696685
9.29438e+06
4085.55
752963
9.20148e+06
3846.4
807074
9.0856e+06
3991.23
862594
8.94125e+06
2885.35
933410
8.77302e+06
485.322
1.00607e+06
8.59258e+06
-6160.78
1.09547e+06
8.38152e+06
-12664.8
1.2354e+06
8.11527e+06
-13496.4
1.41429e+06
7.79822e+06
-904.843
1.58821e+06
7.46254e+06
12137.8
1.77484e+06
7.12015e+06
11233.5
1.98099e+06
6.75123e+06
9334.45
2.08906e+06
6.3504e+06
21020.7
1.96751e+06
5.87086e+06
45718
1.69706e+06
5.0695e+06
129193
1.48257e+06
2.75264e+06
661079
1.77634e+06
-40358
963380
1.8698e+06
-92743.3
19561.4
366768
81586.2
43749.8
297108
-354494
72986.4
194133
166904
-368818
208300
864848
-345756
-1.10667e+06
1.59613e+06
-20309.4
-955278
1.79784e+06
465860
-413564
1.82779e+06
452265
-175643
1.96526e+06
382396
-259131
2.202e+06
323773
-452561
2.50827e+06
258819
-710956
2.84873e+06
188465
-901494
3.25736e+06
87157.2
-1.20659e+06
3.71365e+06
21892.9
-1.46921e+06
4.23215e+06
21913.8
-1.73668e+06
4.77809e+06
45855
-1.91768e+06
5.07539e+06
37820.5
-2.14345e+06
5.35387e+06
234754
-2.32342e+06
200505
-2.86671e+06
9.99954e+06
15006.2
9.9961e+06
44872
9.98911e+06
75465.8
9.97859e+06
106261
9.96473e+06
137576
9.94722e+06
170329
9.92612e+06
204043
9.90088e+06
238884
9.87114e+06
275167
9.8358e+06
313422
9.79517e+06
352800
9.74863e+06
394295
9.696e+06
437884
9.63776e+06
483917
9.57459e+06
532749
9.50806e+06
584609
9.4394e+06
639079
9.3715e+06
695466
9.29705e+06
751856
9.20693e+06
807967
9.09702e+06
867951
8.96131e+06
937647
8.78644e+06
1.02299e+06
8.58599e+06
1.10537e+06
8.35377e+06
1.21992e+06
8.07905e+06
1.38489e+06
7.78891e+06
1.56024e+06
7.49022e+06
1.78028e+06
7.17313e+06
1.98678e+06
6.83023e+06
2.08843e+06
6.47012e+06
1.98312e+06
6.10755e+06
1.70943e+06
5.71474e+06
1.43029e+06
5.33596e+06
1.44433e+06
3.68286e+06
2.2718e+06
1.91597e+06
1.50327e+06
841716
946934
202673
870955
-138982
308765
437342
-564009
1.0635e+06
-262703
1.36391e+06
449066
1.79947e+06
214829
2.1787e+06
146716
2.47512e+06
113481
2.72314e+06
-25778.4
2.81534e+06
-151356
2.72581e+06
-241522
2.64305e+06
-342786
2.79493e+06
-539503
3.13182e+06
-790763
3.37677e+06
-1.0166e+06
4.32186e+06
-1.08742e+06
-1.80908e+06
9.99917e+06
283.196
16726.5
9.99648e+06
189.121
49989.1
9.99026e+06
300.076
84099.8
9.9807e+06
342.154
118458
9.96782e+06
456.747
153454
9.95154e+06
632.642
190038
9.93186e+06
785.641
227568
9.90792e+06
867.729
266936
9.8795e+06
867.093
307700
9.8464e+06
794.424
350408
9.8077e+06
683.031
395057
9.76349e+06
582.491
441826
9.7138e+06
536.238
490921
9.65877e+06
566.006
542631
9.59899e+06
675.152
596773
9.53524e+06
907.639
653671
9.46817e+06
1277.7
712653
9.39914e+06
1727.33
773515
9.32691e+06
1778.58
835797
9.2486e+06
1578.43
899891
9.16016e+06
1639.98
969309
9.05788e+06
2408.43
1.05463e+06
8.92378e+06
4400.56
1.15692e+06
8.74916e+06
-3643.39
1.28233e+06
8.55013e+06
-14925.6
1.45292e+06
8.32439e+06
-17729.7
1.65892e+06
8.05695e+06
-1002.64
1.85499e+06
7.71811e+06
16217.1
2.09142e+06
7.34549e+06
18667.1
2.32767e+06
6.95428e+06
10764.9
2.46369e+06
6.57016e+06
17257
2.33233e+06
6.16979e+06
30340.6
2.06715e+06
5.69061e+06
63277.8
1.89853e+06
4.91616e+06
381271
2.17014e+06
2.53339e+06
848991
3.40533e+06
650076
379907
1.88624e+06
-95959.1
182258
1.0036e+06
45733.2
-151559
454060
788852
-323544
-22327.6
944551
-677121
-494350
1.30612e+06
-606649
-653072
1.7811e+06
-8868.85
-857486
2.30189e+06
178545
-832392
2.82994e+06
126832
-838545
3.34949e+06
108089
-985896
3.87743e+06
74587.5
-1.18714e+06
4.42586e+06
61191.3
-1.39516e+06
4.92994e+06
20723.4
-1.66987e+06
5.41642e+06
-8873.62
-1.95431e+06
5.81616e+06
-24756.7
-2.17266e+06
6.05118e+06
-40886.2
-2.31112e+06
6.16074e+06
-26455
-2.33708e+06
6.09031e+06
36296.7
-2.38657e+06
162718
-2.81757e+06
9.99959e+06
16723.9
9.99648e+06
49986.4
9.99005e+06
84082.5
9.98032e+06
118442
9.96737e+06
153454
9.95114e+06
190053
9.9316e+06
227587
9.90778e+06
266945
9.87944e+06
307686
9.84635e+06
350362
9.8076e+06
394977
9.76331e+06
441717
9.71353e+06
490800
9.65844e+06
542520
9.5987e+06
596692
9.53505e+06
653568
9.46831e+06
712485
9.39901e+06
773229
9.32583e+06
835401
9.24714e+06
899070
9.16045e+06
969519
9.06296e+06
1.05256e+06
8.93596e+06
1.16623e+06
8.76036e+06
1.28483e+06
8.53481e+06
1.43493e+06
8.27468e+06
1.62792e+06
7.98024e+06
1.85151e+06
7.68849e+06
2.08483e+06
7.4008e+06
2.29007e+06
7.0697e+06
2.42725e+06
6.68608e+06
2.38197e+06
6.30437e+06
2.12108e+06
5.91129e+06
1.88796e+06
5.73813e+06
1.99842e+06
6.07276e+06
2.7836e+06
5.11716e+06
2.84487e+06
4.00321e+06
2.27428e+06
3.13614e+06
1.64468e+06
2.13196e+06
1.06096e+06
355260
603318
-973804
505463
-888445
397507
-286848
-137914
289828
-216304
823087
-182194
1.31552e+06
-297120
1.83308e+06
-489232
2.45016e+06
-787453
3.17549e+06
-1.09102e+06
3.87222e+06
-1.33975e+06
4.43327e+06
-1.50879e+06
4.9154e+06
-1.60892e+06
5.48721e+06
-1.67913e+06
-2.16216e+06
9.99924e+06
280.424
18315.6
9.99693e+06
189.99
54698.2
9.99135e+06
302.793
92036.2
9.9827e+06
343.918
129684
9.97097e+06
452.358
168105
9.95606e+06
617.522
208271
9.93776e+06
758.429
249564
9.91579e+06
829.777
292799
9.88936e+06
822.289
337985
9.85824e+06
749.215
385124
9.82215e+06
644.968
434407
9.78048e+06
558.953
486538
9.73345e+06
532.722
541071
9.6815e+06
580.537
598047
9.62455e+06
676.718
657675
9.56331e+06
808.395
719357
9.49799e+06
939.216
782870
9.42959e+06
1065.28
847391
9.35928e+06
1165.91
912824
9.28775e+06
1346.17
980138
9.21579e+06
1659.92
1.05256e+06
9.1439e+06
2766.85
1.14067e+06
9.06073e+06
3543.11
1.25281e+06
8.93979e+06
10813.7
1.40786e+06
8.77622e+06
3889.99
1.6194e+06
8.60263e+06
-7345.78
1.84047e+06
8.38871e+06
-7049.9
2.07056e+06
8.10755e+06
4372.78
2.35158e+06
7.80315e+06
14311.6
2.59852e+06
7.44654e+06
23059.1
2.78169e+06
6.97497e+06
32714.3
2.76367e+06
6.4414e+06
33113.8
2.56289e+06
5.96805e+06
44223.9
2.32607e+06
5.84609e+06
73191.8
2.21311e+06
5.88123e+06
316199
3.05468e+06
4.70288e+06
202343
2.8864e+06
3.75062e+06
4454.48
2.03409e+06
3.2929e+06
-141511
1.18985e+06
3.19029e+06
-253394
484192
3.29377e+06
-399989
-77705.2
3.71264e+06
-561103
-434825
4.10623e+06
-544848
-678137
4.45474e+06
-334848
-864202
4.80515e+06
-177900
-1.06357e+06
5.16306e+06
-59120.4
-1.31084e+06
5.53355e+06
14752.3
-1.54602e+06
5.91498e+06
49141.2
-1.75227e+06
6.25657e+06
32881.6
-1.96888e+06
6.51626e+06
-9175.99
-2.17905e+06
6.65396e+06
-45206.6
-2.32448e+06
6.66381e+06
-38195.3
-2.35807e+06
6.59759e+06
-32779.6
-2.33961e+06
6.3926e+06
17078.3
-2.23149e+06
208592
-2.6281e+06
9.99967e+06
18307.6
9.99693e+06
54691.6
9.99115e+06
92022
9.98233e+06
129671
9.97052e+06
168099
9.95566e+06
208271
9.93749e+06
249563
9.91564e+06
292788
9.88928e+06
337955
9.85817e+06
385071
9.82203e+06
434327
9.78031e+06
486429
9.73321e+06
540932
9.6812e+06
597875
9.62423e+06
657471
9.56297e+06
719104
9.49765e+06
782515
9.42924e+06
846882
9.35882e+06
912012
9.28708e+06
978951
9.21532e+06
1.05154e+06
9.14286e+06
1.13789e+06
9.07089e+06
1.25313e+06
8.97523e+06
1.40256e+06
8.81462e+06
1.60593e+06
8.59644e+06
1.83835e+06
8.31087e+06
2.12273e+06
8.02002e+06
2.37135e+06
7.75123e+06
2.56449e+06
7.48007e+06
2.71292e+06
7.12898e+06
2.75917e+06
6.66035e+06
2.61806e+06
6.17917e+06
2.40892e+06
5.92121e+06
2.32656e+06
6.37796e+06
2.64944e+06
6.62854e+06
2.8236e+06
6.40831e+06
2.54622e+06
5.93661e+06
2.03484e+06
5.31722e+06
1.49295e+06
4.59252e+06
991504
3.9813e+06
612579
3.50646e+06
357119
2.96897e+06
45159.6
2.77905e+06
-248714
3.05965e+06
-546683
3.62289e+06
-820130
4.33627e+06
-1.09719e+06
5.03375e+06
-1.40259e+06
5.60487e+06
-1.65936e+06
5.99172e+06
-1.81685e+06
6.25386e+06
-1.87262e+06
6.46609e+06
-1.92349e+06
6.71926e+06
-1.96695e+06
-2.71511e+06
9.99934e+06
272.506
19732.7
9.99745e+06
186.863
58936.7
9.9926e+06
292.689
99185.2
9.98497e+06
328.799
139803
9.97454e+06
429.256
181324
9.96118e+06
583.006
224762
9.94469e+06
712.496
269515
9.92466e+06
775.73
316454
9.9006e+06
765.982
365636
9.87199e+06
697.044
417085
9.83843e+06
601.681
471025
9.79973e+06
521.448
528053
9.75571e+06
491.584
587871
9.70622e+06
514.598
650418
9.65162e+06
562.991
715303
9.5919e+06
595.736
782082
9.52787e+06
586.553
849737
9.46061e+06
593.039
917303
9.39274e+06
606.991
983627
9.32837e+06
788.165
1.0484e+06
9.27303e+06
1254.29
1.11406e+06
9.23107e+06
1491.32
1.19139e+06
9.19831e+06
2449.07
1.29518e+06
9.1589e+06
11148.4
1.45221e+06
9.06471e+06
20278.6
1.70194e+06
8.90317e+06
14979.5
1.98821e+06
8.67433e+06
1744.05
2.29027e+06
8.45223e+06
-7707.4
2.56822e+06
8.24086e+06
-3964.57
2.79873e+06
8.01233e+06
8638.88
2.98696e+06
7.66725e+06
13991.5
3.08067e+06
7.14559e+06
22424.6
3.05267e+06
6.56658e+06
39770.1
2.85873e+06
6.13873e+06
1952.49
2.64355e+06
6.38577e+06
65350
2.76759e+06
6.44964e+06
78162
2.79973e+06
6.13977e+06
21524
2.40894e+06
5.76741e+06
-65375.2
1.74398e+06
5.52697e+06
-160484
1.02683e+06
5.45687e+06
-231047
374071
5.5723e+06
-275328
-156188
5.78605e+06
-295697
-550004
6.01269e+06
-270550
-862365
6.21894e+06
-228476
-1.12351e+06
6.391e+06
-182635
-1.3765e+06
6.57485e+06
-153417
-1.60042e+06
6.78436e+06
-136178
-1.78715e+06
6.96163e+06
-125032
-1.95194e+06
7.04635e+06
-119582
-2.09454e+06
7.02957e+06
-112602
-2.1968e+06
6.9268e+06
-89014.4
-2.21884e+06
6.83599e+06
-71697.6
-2.19638e+06
6.62181e+06
-62562.2
-2.02073e+06
227099
-2.51961e+06
9.99975e+06
19730.8
9.99745e+06
58933.8
9.99241e+06
99167.5
9.98461e+06
139785
9.9741e+06
181319
9.96079e+06
224770
9.94441e+06
269523
9.9245e+06
316451
9.9005e+06
365609
9.8719e+06
417028
9.8383e+06
470936
9.79955e+06
527933
9.75545e+06
587722
9.7059e+06
650242
9.65123e+06
715102
9.59145e+06
781844
9.52734e+06
849429
9.46002e+06
916887
9.39215e+06
982977
9.32761e+06
1.04762e+06
9.27171e+06
1.11385e+06
9.22829e+06
1.19002e+06
9.19963e+06
1.29444e+06
9.17489e+06
1.4483e+06
9.1146e+06
1.69293e+06
8.96509e+06
2.00149e+06
8.74994e+06
2.33231e+06
8.49501e+06
2.60968e+06
8.22938e+06
2.81833e+06
7.97029e+06
2.97388e+06
7.67768e+06
3.0602e+06
7.27488e+06
3.03882e+06
6.78577e+06
2.93663e+06
6.31651e+06
2.80618e+06
6.29504e+06
2.76076e+06
6.55472e+06
2.68363e+06
6.76568e+06
2.41422e+06
6.81785e+06
1.98642e+06
6.74062e+06
1.48691e+06
6.61596e+06
965295
6.53512e+06
479438
6.52614e+06
83570
6.51773e+06
-250180
6.55943e+06
-575758
6.68056e+06
-893275
6.85905e+06
-1.1582e+06
7.03759e+06
-1.38352e+06
7.14167e+06
-1.59274e+06
7.15773e+06
-1.77781e+06
7.13597e+06
-1.93223e+06
7.20498e+06
-2.07404e+06
7.44496e+06
-2.28307e+06
7.90973e+06
-2.47682e+06
-3.5162e+06
9.99944e+06
270.38
20991.9
9.99803e+06
187.565
62664.2
9.994e+06
294.462
105463
9.9875e+06
328.425
148708
9.97853e+06
421.643
192992
9.96693e+06
564.373
239363
9.95227e+06
682.837
287455
9.93455e+06
738.06
337595
9.91329e+06
724.977
390255
9.88754e+06
657.74
445957
9.85683e+06
566.676
504547
9.82118e+06
487.544
566259
9.77999e+06
449.68
631484
9.73327e+06
452.19
699520
9.6804e+06
469.741
770533
9.62163e+06
459.507
843005
9.55726e+06
394.871
915832
9.48907e+06
344.577
986810
9.42073e+06
227.316
1.05303e+06
9.35884e+06
711.365
1.11211e+06
9.31476e+06
998.596
1.16184e+06
9.29764e+06
3285.15
1.21284e+06
9.31638e+06
3898.57
1.2825e+06
9.37553e+06
6720.01
1.40138e+06
9.37972e+06
16981.8
1.6952e+06
9.24464e+06
16200.9
2.11042e+06
9.01428e+06
5002.21
2.51405e+06
8.76962e+06
-3463.86
2.81723e+06
8.53697e+06
-4616.51
3.04118e+06
8.31119e+06
-1960.31
3.22109e+06
8.05349e+06
-2285.95
3.34609e+06
7.71436e+06
-2482.15
3.39793e+06
7.23884e+06
-3395.45
3.34345e+06
6.71544e+06
-10417.4
3.1944e+06
6.51024e+06
3135.61
3.00531e+06
6.56252e+06
16872.7
2.78337e+06
6.61384e+06
14315.7
2.41148e+06
6.57485e+06
-16612.7
1.87868e+06
6.50768e+06
-68707.6
1.25235e+06
6.48655e+06
-121668
607638
6.53749e+06
-154769
17716.1
6.62644e+06
-173664
-450001
6.73253e+06
-176192
-825514
6.84721e+06
-176386
-1.13068e+06
6.93764e+06
-158114
-1.37967e+06
7.01971e+06
-145508
-1.57896e+06
7.10204e+06
-130770
-1.73392e+06
7.17206e+06
-116485
-1.86109e+06
7.18524e+06
-105544
-1.9619e+06
7.1384e+06
-93705.3
-2.02909e+06
7.13536e+06
-89325.4
-2.09038e+06
7.2475e+06
-84804.7
-2.18468e+06
7.68654e+06
-75349.9
-2.25371e+06
109128
-2.90479e+06
9.99985e+06
20984.2
9.99803e+06
62655.5
9.99381e+06
105447
9.98715e+06
148692
9.97809e+06
192982
9.96653e+06
239356
9.95199e+06
287444
9.93437e+06
337572
9.91318e+06
390212
9.88743e+06
445889
9.85668e+06
504447
9.82097e+06
566125
9.7797e+06
631304
9.73292e+06
699291
9.67996e+06
770245
9.62108e+06
842651
9.55657e+06
915418
9.48828e+06
986282
9.41971e+06
1.0525e+06
9.35833e+06
1.11137e+06
9.3146e+06
1.16226e+06
9.30437e+06
1.21123e+06
9.33301e+06
1.27911e+06
9.39243e+06
1.40883e+06
9.39954e+06
1.70805e+06
9.2769e+06
2.14113e+06
9.07713e+06
2.5376e+06
8.85315e+06
2.83417e+06
8.61377e+06
3.06058e+06
8.35716e+06
3.23747e+06
8.07276e+06
3.35075e+06
7.72903e+06
3.38766e+06
7.31597e+06
3.35616e+06
6.87341e+06
3.25581e+06
6.5735e+06
3.09073e+06
6.47845e+06
2.83292e+06
6.50896e+06
2.44177e+06
6.58095e+06
1.9459e+06
6.65494e+06
1.39433e+06
6.72142e+06
822830
6.78763e+06
283160
6.8581e+06
-167916
6.92748e+06
-531592
6.97673e+06
-848207
7.00845e+06
-1.12587e+06
7.02323e+06
-1.3439e+06
7.03863e+06
-1.52639e+06
7.08448e+06
-1.72963e+06
7.2046e+06
-1.97793e+06
7.48401e+06
-2.28186e+06
8.02235e+06
-2.67591e+06
8.86377e+06
-3.12447e+06
9.99101e+06
-3.63302e+06
-4.52061e+06
9.99957e+06
262.817
22036.8
9.99867e+06
181.998
65806.9
9.99555e+06
280.955
110763
9.99033e+06
308.43
156240
9.98276e+06
392.676
203091
9.97331e+06
524.318
251612
9.96114e+06
632.975
302660
9.94606e+06
682.621
355834
9.92734e+06
668.717
412066
9.90485e+06
604.817
471323
9.87779e+06
515.119
534147
9.84545e+06
431.269
600807
9.80758e+06
371.208
671273
9.76318e+06
339.048
745577
9.712e+06
311.514
823094
9.65329e+06
258.74
902692
9.58684e+06
168.982
982775
9.51366e+06
65.2674
1.05981e+06
9.43775e+06
38.5187
1.1288e+06
9.36827e+06
522.364
1.18216e+06
9.32414e+06
1432.44
1.20933e+06
9.33272e+06
5085.43
1.21144e+06
9.43395e+06
9159.2
1.188e+06
9.65783e+06
15712.1
1.1864e+06
9.75068e+06
24367.1
1.59048e+06
9.60556e+06
20206.6
2.24666e+06
9.33445e+06
2122.98
2.79852e+06
9.0519e+06
-1703.53
3.12321e+06
8.78074e+06
5686.89
3.33416e+06
8.51125e+06
9602.22
3.50994e+06
8.23631e+06
7436.7
3.63998e+06
7.94269e+06
3757.07
3.71009e+06
7.59549e+06
-2476.46
3.71336e+06
7.19159e+06
-4245.34
3.62607e+06
6.82199e+06
-5332.18
3.40916e+06
6.59016e+06
-7725.01
3.05766e+06
6.48144e+06
-12584.9
2.56679e+06
6.43966e+06
-20018.4
1.96951e+06
6.44611e+06
-37729.1
1.3035e+06
6.50508e+06
-65005.3
626289
6.60899e+06
-92900.5
5906.13
6.73529e+06
-103080
-486823
6.85845e+06
-109086
-870771
6.98145e+06
-119691
-1.17834e+06
7.08233e+06
-127902
-1.41046e+06
7.15966e+06
-139356
-1.57489e+06
7.21634e+06
-143975
-1.67395e+06
7.27163e+06
-139997
-1.75098e+06
7.35705e+06
-125056
-1.84214e+06
7.52598e+06
-108770
-1.98589e+06
7.8781e+06
-100964
-2.20484e+06
8.45276e+06
-60149.2
-2.51247e+06
9.24958e+06
-113304
-2.82312e+06
61514.1
-3.53237e+06
9.99996e+06
22035.9
9.99867e+06
65804.2
9.99536e+06
110747
9.98998e+06
156221
9.98233e+06
203083
9.97292e+06
251613
9.96085e+06
302658
9.94587e+06
355817
9.92721e+06
412025
9.90472e+06
471251
9.87761e+06
534043
9.8452e+06
600672
9.80725e+06
671105
9.76277e+06
745376
9.71149e+06
822857
9.65266e+06
902427
9.58604e+06
982487
9.51278e+06
1.05952e+06
9.43682e+06
1.1286e+06
9.3681e+06
1.18178e+06
9.32684e+06
1.20951e+06
9.33858e+06
1.21217e+06
9.45038e+06
1.19042e+06
9.68047e+06
1.2036e+06
9.75679e+06
1.66417e+06
9.598e+06
2.33115e+06
9.3492e+06
2.80445e+06
9.09492e+06
3.10808e+06
8.84202e+06
3.34258e+06
8.57736e+06
3.53283e+06
8.28828e+06
3.66619e+06
7.96595e+06
3.7294e+06
7.61272e+06
3.72152e+06
7.24469e+06
3.63547e+06
6.9022e+06
3.44764e+06
6.62302e+06
3.12575e+06
6.42908e+06
2.64397e+06
6.32511e+06
2.04562e+06
6.31601e+06
1.37664e+06
6.38841e+06
687762
6.50294e+06
67538.6
6.62962e+06
-414545
6.74845e+06
-781902
6.84158e+06
-1.09248e+06
6.93023e+06
-1.38181e+06
7.0729e+06
-1.65699e+06
7.34183e+06
-1.94453e+06
7.7906e+06
-2.2944e+06
8.4517e+06
-2.7203e+06
9.31992e+06
-3.20013e+06
1.0329e+07
-3.69628e+06
1.14094e+07
-4.18169e+06
1.22936e+07
-4.54711e+06
-5.03683e+06
9.99969e+06
261.484
22890.5
9.99939e+06
182.634
68317.6
9.99727e+06
282.159
115017
9.99346e+06
306.827
162281
9.98789e+06
383.634
211085
9.98026e+06
504.883
261910
9.97072e+06
604.019
315064
9.95849e+06
647.559
371023
9.94327e+06
632.309
430171
9.92431e+06
570.767
492941
9.90101e+06
484.903
559777
9.87273e+06
401.291
631071
9.83856e+06
334.235
707079
9.79758e+06
288.508
787883
9.74843e+06
247.764
873261
9.68951e+06
198.588
962329
9.61937e+06
131.024
1.0533e+06
9.5367e+06
68.7333
1.14255e+06
9.44311e+06
195.042
1.22256e+06
9.34677e+06
514.766
1.27925e+06
9.27838e+06
2235.71
1.28244e+06
9.2852e+06
4173.82
1.21109e+06
9.49768e+06
15330.4
979341
1.00326e+07
38709.7
158760
150216
166032
157728
1.0197e+07
78472.7
279412
377236
305646
414296
9.99532e+06
66032
2.42068e+06
9.61943e+06
2600.33
3.2112e+06
9.253e+06
-26436.5
3.55924e+06
8.92031e+06
-24192.7
3.73186e+06
8.60007e+06
-19692.9
3.88368e+06
8.28375e+06
-17325.7
4.00143e+06
7.96374e+06
-11113.4
4.06161e+06
7.63741e+06
-7181.71
4.06212e+06
7.29524e+06
-5304.68
3.98682e+06
6.93773e+06
-6539.57
3.78878e+06
6.60181e+06
-13213
3.42205e+06
6.34759e+06
-28509.8
2.85893e+06
6.19426e+06
-42584.7
2.16448e+06
6.19079e+06
-62916.3
1.36256e+06
6.31564e+06
-72342.2
555582
6.50965e+06
-79932.1
-127829
6.7143e+06
-97913.6
-606293
6.90692e+06
-128583
-940075
7.07875e+06
-165653
-1.19965e+06
7.2238e+06
-191986
-1.40064e+06
7.36679e+06
-201237
-1.56815e+06
7.56153e+06
-191051
-1.72041e+06
7.86044e+06
-163825
-1.89806e+06
8.31728e+06
-128355
-2.14466e+06
8.97592e+06
-88540.5
-2.49066e+06
9.83945e+06
-49924.1
-2.92596e+06
1.08333e+07
2440.49
-3.39381e+06
1.19077e+07
16740.7
-3.79631e+06
122163
-4.37057e+06
1.00001e+07
22883.3
9.9994e+06
68307.7
9.99708e+06
115001
9.99311e+06
162264
9.98746e+06
211070
9.97986e+06
261897
9.97042e+06
315044
9.95828e+06
370990
9.94311e+06
430118
9.92415e+06
492862
9.90081e+06
559671
9.87245e+06
630933
9.8382e+06
706910
9.79713e+06
787678
9.74789e+06
873027
9.68885e+06
962077
9.61858e+06
1.05306e+06
9.53584e+06
1.14238e+06
9.44232e+06
1.22244e+06
9.34694e+06
1.27931e+06
9.27978e+06
1.28342e+06
9.29611e+06
1.20876e+06
9.53051e+06
980051
1.00878e+07
176300
178371
171323
171878
1.01912e+07
344015
476345
338298
505719
9.93769e+06
2.68805e+06
9.61327e+06
3.16872e+06
9.29818e+06
3.43361e+06
9.02116e+06
3.62602e+06
8.73797e+06
3.81942e+06
8.42894e+06
3.97651e+06
8.09187e+06
4.06798e+06
7.73186e+06
4.08271e+06
7.36203e+06
4.00743e+06
7.0001e+06
3.81041e+06
6.65452e+06
3.46444e+06
6.37495e+06
2.89581e+06
6.17235e+06
2.20127e+06
6.15556e+06
1.31662e+06
6.27235e+06
483325
6.45314e+06
-204294
6.6521e+06
-715332
6.89625e+06
-1.15789e+06
7.23304e+06
-1.60717e+06
7.71181e+06
-2.07603e+06
8.37251e+06
-2.54759e+06
9.21551e+06
-3.00213e+06
1.01895e+07
-3.44043e+06
1.12188e+07
-3.86443e+06
1.2223e+07
-4.25708e+06
1.31315e+07
-4.59837e+06
1.39024e+07
-4.87494e+06
1.44658e+07
-5.04916e+06
-5.24551e+06
9.99984e+06
254.639
23491.4
1.00001e+07
175.56
70177
9.9991e+06
266.618
118092
9.99676e+06
284.057
166737
9.99312e+06
351.812
216993
9.98801e+06
463.021
269481
9.98117e+06
554.391
324535
9.97229e+06
594.438
382625
9.9608e+06
580.687
444318
9.94606e+06
522.672
510133
9.92738e+06
441.052
580593
9.90388e+06
353.9
656327
9.87451e+06
279.355
737819
9.83785e+06
216.952
825540
9.79207e+06
169.133
919746
9.73455e+06
131.845
1.02038e+06
9.66165e+06
110.056
1.12667e+06
9.56815e+06
149.98
1.23657e+06
9.44648e+06
284.982
1.34443e+06
9.29077e+06
899.841
1.43715e+06
9.10886e+06
2425.87
1.4672e+06
8.98235e+06
6179.68
1.3421e+06
2.31986e+06
13562.1
233466
2.38329e+06
2.19222e+06
2.32823e+06
132593
239879
135299
2.43104e+06
23299.7
34940.2
-2.57942e+06
2.65856e+06
33128.3
191471
1.0702e+07
209092
502811
-2.69989e+06
-2.77532e+06
-2.72065e+06
-2.87374e+06
667144
695671
799531
1.02195e+07
102221
3.65602e+06
9.81692e+06
91398.7
3.92863e+06
9.38946e+06
63684.8
4.14153e+06
8.92628e+06
23327.6
4.35735e+06
8.45466e+06
-1039.27
4.49523e+06
7.99187e+06
-9987.24
4.54412e+06
7.54641e+06
-11542.3
4.52009e+06
7.12169e+06
-11485.2
4.41991e+06
6.71959e+06
-13687.1
4.20019e+06
6.33443e+06
-3299.88
3.8021e+06
6.03835e+06
-22249.2
3.1628e+06
5.79505e+06
-22021.4
2.41085e+06
5.84728e+06
-170363
1.44831e+06
6.09295e+06
-242041
530019
6.4053e+06
-264102
-182122
6.71677e+06
-261304
-647895
7.05839e+06
-253478
-1.01551e+06
7.45326e+06
-233271
-1.35927e+06
7.91245e+06
-197636
-1.68341e+06
8.45859e+06
-152164
-2.01006e+06
9.13248e+06
-100159
-2.35694e+06
9.95013e+06
-41623.2
-2.72652e+06
1.08895e+07
16430.1
-3.11972e+06
1.18855e+07
63351.2
-3.53299e+06
1.28525e+07
94573.1
-3.94555e+06
1.37166e+07
118360
-4.31876e+06
1.44422e+07
115165
-4.59189e+06
141869
-4.93081e+06
1.00002e+07
23491.2
1.00001e+07
70174.5
9.99891e+06
118078
9.99642e+06
166720
9.9927e+06
216982
9.98761e+06
269475
9.98086e+06
324523
9.97207e+06
382596
9.96063e+06
444265
9.94588e+06
510053
9.92715e+06
580486
9.90357e+06
656198
9.87411e+06
737673
9.83736e+06
825385
9.7915e+06
919588
9.73391e+06
1.02023e+06
9.66095e+06
1.12656e+06
9.56738e+06
1.2365e+06
9.44623e+06
1.34458e+06
9.29156e+06
1.43735e+06
9.11117e+06
1.4703e+06
8.98546e+06
1.34579e+06
2.39472e+06
253507
2.33693e+06
2.33269e+06
2.20113e+06
96789.5
242904
128887
-5649.6
2.55988e+06
-10533.6
36348.8
-43921.4
-2.73843e+06
2.79189e+06
31965.7
322528
1.04285e+07
841751
-2.76309e+06
-2.67846e+06
-2.82261e+06
-2.68674e+06
915392
827137
903603
9.84302e+06
3.90354e+06
9.42402e+06
3.98532e+06
9.06765e+06
4.07809e+06
8.7226e+06
4.20904e+06
8.37536e+06
4.3335e+06
8.01446e+06
4.42109e+06
7.62956e+06
4.45305e+06
7.21854e+06
4.40147e+06
6.83207e+06
4.17599e+06
6.42687e+06
3.85798e+06
6.16098e+06
3.12753e+06
5.71594e+06
2.60235e+06
5.81097e+06
1.03241e+06
6.07221e+06
-33864.3
6.54615e+06
-944633
7.25052e+06
-1.6749e+06
8.16024e+06
-2.31441e+06
9.20472e+06
-2.88541e+06
1.02996e+07
-3.38159e+06
1.1372e+07
-3.79713e+06
1.23706e+07
-4.13007e+06
1.32578e+07
-4.39058e+06
1.40036e+07
-4.59862e+06
1.45914e+07
-4.76767e+06
1.50203e+07
-4.90416e+06
1.53135e+07
-5.01484e+06
1.54661e+07
-5.06008e+06
-5.16544e+06
9.99998e+06
253.974
23869.9
1.0001e+07
176.223
71310.9
1.00011e+07
267.584
120000
1.00004e+07
281.98
169468
9.99883e+06
342.722
220715
9.99631e+06
444.895
274329
9.99262e+06
528.827
330708
9.98737e+06
565.545
390434
9.98008e+06
553.089
454115
9.97013e+06
501.213
522403
9.95676e+06
427.785
596010
9.93908e+06
350.138
675737
9.91588e+06
283.962
762418
9.88559e+06
232.479
856954
9.84597e+06
203.114
960326
9.79374e+06
201.826
1.07359e+06
9.72369e+06
237.06
1.19785e+06
9.62701e+06
338.001
1.33451e+06
9.48799e+06
538.839
1.48475e+06
9.27351e+06
1475.86
1.65178e+06
8.89773e+06
4015.39
1.84136e+06
2.03711e+06
14909.7
2.09971e+06
2.07376e+06
1.98465e+06
2.03218e+06
1.90662e+06
34027.1
332852
11511.3
-441629
428809
33132.4
-29100
-516700
6555.51
528568
3327.68
4686.54
-6089.07
-6344.44
337.252
-657210
2.43839e+06
118290
42543.7
-784996
-251523
-395215
8.48863e+06
-37681.2
2.75137e+06
-2.45802e+06
-2.67896e+06
-825503
-1.47396e+06
9.06133e+06
83867.5
3.34465e+06
9.26925e+06
90574.8
3.89174e+06
9.16039e+06
39697.6
4.45103e+06
8.7941e+06
5554.31
4.86073e+06
8.25121e+06
-9596.9
5.08769e+06
7.61569e+06
-16734.7
5.15503e+06
6.95962e+06
-16658.5
5.07253e+06
6.35577e+06
-37141.5
4.81906e+06
5.81507e+06
-54547.9
4.3777e+06
5.55809e+06
-142495
3.53533e+06
5.03752e+06
42502.1
2.84815e+06
5.1286e+06
-214968
1.53893e+06
5.70222e+06
-336729
269938
6.49838e+06
-275605
-704489
7.40679e+06
-185969
-1.35434e+06
8.4034e+06
-110577
-1.87716e+06
9.43806e+06
-37159.1
-2.33481e+06
1.04785e+07
33194.2
-2.7504e+06
1.15024e+07
92335.4
-3.14236e+06
1.24831e+07
138023
-3.50958e+06
1.33878e+07
171597
-3.83887e+06
1.418e+07
191452
-4.12479e+06
1.48247e+07
193408
-4.37225e+06
1.52976e+07
179816
-4.58116e+06
1.56084e+07
156184
-4.76265e+06
1.57574e+07
131422
-4.84516e+06
95959.6
-5.08323e+06
1.00004e+07
23863.6
1.0001e+07
71301.5
1.00009e+07
119985
1e+07
169452
9.9984e+06
220700
9.9959e+06
274313
9.9923e+06
330687
9.98713e+06
390401
9.97989e+06
454065
9.96994e+06
522337
9.95652e+06
595926
9.93876e+06
675642
9.91547e+06
762315
9.88511e+06
856857
9.84543e+06
960242
9.79316e+06
1.07353e+06
9.72306e+06
1.19784e+06
9.62644e+06
1.33446e+06
9.48793e+06
1.48483e+06
9.27588e+06
1.65143e+06
8.90771e+06
1.84196e+06
2.08247e+06
2.09537e+06
2.04796e+06
2.04874e+06
1.99461e+06
-7425.76
2.02571e+06
-26004.3
348290
-6077.52
29678.3
-546896
570472
1644.58
-48109.7
-38258.6
-860641
-12946.3
848163
25401.5
15185.4
6603.91
21148.8
-2755.71
-808704
-299570
2.97637e+06
245847
1.04595e+06
-795973
-732246
-765901
9.90661e+06
3.99405e+06
-2.78746e+06
-2.70129e+06
-2.21087e+06
-2.27354e+06
9.78284e+06
4.23486e+06
9.57186e+06
4.40742e+06
9.18733e+06
4.64472e+06
8.68964e+06
4.83421e+06
8.14091e+06
4.94804e+06
7.56372e+06
4.99558e+06
6.98239e+06
4.9453e+06
6.32437e+06
4.77872e+06
5.63181e+06
4.48377e+06
5.57579e+06
3.02174e+06
4.9339e+06
3.25794e+06
5.59451e+06
142330
7.0865e+06
-1.8711e+06
8.71522e+06
-2.84785e+06
1.0235e+07
-3.37102e+06
1.157e+07
-3.74606e+06
1.26908e+07
-4.03186e+06
1.35932e+07
-4.24825e+06
1.42896e+07
-4.41094e+06
1.48076e+07
-4.52955e+06
1.51812e+07
-4.61328e+06
1.54388e+07
-4.67745e+06
1.56017e+07
-4.73772e+06
1.56872e+07
-4.79763e+06
1.57205e+07
-4.87552e+06
1.56986e+07
-4.89216e+06
-5.0631e+06
1.00001e+07
248.045
23965.5
1.00019e+07
169.272
71665
1.00032e+07
252.07
120599
1.00042e+07
259.347
170358
1.00049e+07
312.018
222041
1.00052e+07
406.54
276209
1.00049e+07
486.138
333350
1.00036e+07
523.978
394089
1.0001e+07
517.669
459116
9.99649e+06
476.829
529237
9.9893e+06
414.437
605278
9.97861e+06
350.379
688262
9.96326e+06
294.226
779357
9.94176e+06
259.179
879894
9.91195e+06
250.065
991558
9.87062e+06
273.461
1.11651e+06
9.81271e+06
350.583
1.25765e+06
9.72916e+06
402.417
1.41969e+06
9.60338e+06
615.204
1.61099e+06
9.40318e+06
1228.1
1.84914e+06
9.05416e+06
3900.99
2.17912e+06
2.05429e+06
13640.2
2.66993e+06
2.09999e+06
2.13519e+06
2.17244e+06
-563848
1.81253e+06
37912.2
766100
-130757
-275985
40823.7
228967
47299.2
21459.3
38853.8
26860
107805
550638
-731236
-140130
-262117
159741
149489
199800
2.32493e+06
-767917
290034
412939
17305.5
424765
241841
4.87049e+06
-185574
1.08243e+06
6.61871e+06
-51506.9
2.2403e+06
7.74683e+06
-33361.6
3.36265e+06
8.26572e+06
-23393.8
4.3474e+06
8.2137e+06
-17450.8
5.12646e+06
7.70737e+06
-15158.4
5.64153e+06
6.89605e+06
-22882.3
5.86951e+06
5.9312e+06
-7176.87
5.7584e+06
4.99928e+06
-73097.2
5.35353e+06
4.55769e+06
-439801
4.38658e+06
4.58129e+06
166391
2.61611e+06
6.01703e+06
290442
-208394
8.03792e+06
79960.1
-1.84331e+06
9.79189e+06
103820
-2.55799e+06
1.12806e+07
156566
-2.9784e+06
1.25333e+07
205037
-3.30359e+06
1.35603e+07
240858
-3.573e+06
1.43843e+07
258363
-3.81159e+06
1.50196e+07
255631
-4.02959e+06
1.54763e+07
236306
-4.21862e+06
1.57742e+07
207145
-4.37123e+06
1.59416e+07
173454
-4.49032e+06
1.6012e+07
138307
-4.59068e+06
1.60075e+07
105696
-4.68016e+06
1.59645e+07
74339
-4.785e+06
1.58907e+07
47980.6
-4.80484e+06
24002.6
-5.07265e+06
1.00005e+07
23965.8
1.00018e+07
71663.1
1.0003e+07
120587
1.00039e+07
170342
1.00045e+07
222030
1.00048e+07
276199
1.00046e+07
333332
1.00034e+07
394056
1.00008e+07
459064
9.99628e+06
529165
9.98904e+06
605192
9.97828e+06
688173
9.96286e+06
779279
9.94129e+06
879845
9.91144e+06
991558
9.87008e+06
1.11658e+06
9.8121e+06
1.25778e+06
9.72857e+06
1.41991e+06
9.60331e+06
1.61133e+06
9.40508e+06
1.84938e+06
9.06586e+06
2.17971e+06
2.11411e+06
2.67194e+06
2.05952e+06
2.18052e+06
2.14582e+06
-595570
-4864.96
1.94194e+06
-27958.4
801568
-188034
5058.76
-364989
17461.4
324962
52158.6
56633.4
31204
61709.8
56439.8
-492709
171786
442049
-179310
-22541.8
-15533
42440.7
23459.9
4.9182e+06
1.52241e+06
-964108
-1.09074e+06
-426835
-654361
6.72917e+06
2.27523e+06
7.89772e+06
3.19996e+06
8.48233e+06
4.01962e+06
8.58041e+06
4.69328e+06
8.27668e+06
5.20937e+06
7.66061e+06
5.57085e+06
6.79809e+06
5.7615e+06
5.64873e+06
5.90454e+06
4.82882e+06
5.22637e+06
5.28902e+06
2.10785e+06
7.67313e+06
1.0255e+06
1.02375e+07
-2.13338e+06
1.18913e+07
-3.44679e+06
1.30409e+07
-3.88979e+06
1.38966e+07
-4.05704e+06
1.45409e+07
-4.16593e+06
1.50023e+07
-4.2354e+06
1.53142e+07
-4.2925e+06
1.55096e+07
-4.35179e+06
1.56189e+07
-4.4141e+06
1.56714e+07
-4.47515e+06
1.56906e+07
-4.53624e+06
1.56938e+07
-4.60552e+06
1.56871e+07
-4.68471e+06
1.56895e+07
-4.79293e+06
1.56801e+07
-4.82912e+06
-5.07149e+06
1.00003e+07
247.831
23813.7
1.00028e+07
170.22
71259.1
1.00054e+07
253.412
119826
1.00083e+07
257.924
169377
1.00114e+07
304.698
220883
1.00146e+07
392.341
275028
1.00179e+07
467.566
332262
1.0021e+07
505.532
393307
1.00235e+07
505.157
458977
1.0025e+07
475.144
530079
1.00248e+07
429.281
607675
1.00222e+07
385.347
692936
1.00163e+07
356.035
787256
1.00059e+07
354.507
892382
9.98945e+06
387.756
1.01043e+06
9.96459e+06
461.945
1.14427e+06
9.92791e+06
576.42
1.29783e+06
9.87454e+06
680.425
1.47693e+06
9.79787e+06
931.538
1.69123e+06
9.693e+06
1370.03
1.95557e+06
9.57118e+06
4273.48
2.30087e+06
9.50864e+06
13838.6
2.72657e+06
2.28685e+06
41179.2
3.39653e+06
-816079
-954613
-836896
-1.01155e+06
2.43748e+06
2.45804e+06
2.52336e+06
-267625
2.40154e+06
34755.6
1.05662e+06
-277279
-305268
-343412
-233009
-2.55037e+06
2.4072e+06
69044.8
1.12263e+06
-218664
-299922
-267829
6.94483e+06
-43398.5
3.04217e+06
86196.1
-29295.3
78771.1
95916.1
-1.9266e+06
-2.50424e+06
-2.75579e+06
-2.88435e+06
4.84089e+06
-255957
2.70707e+06
3.93404e+06
-290833
2.30973e+06
4.2746e+06
-293591
2.18278e+06
5.36816e+06
-271888
2.5026e+06
6.53478e+06
-206496
3.34251e+06
7.26715e+06
-134076
4.4904e+06
7.34284e+06
-63946.3
5.59927e+06
6.79959e+06
8475.22
6.37995e+06
5.72945e+06
238461
6.56417e+06
4.75664e+06
-562.127
6.30978e+06
6.1659e+06
33551.2
2.92045e+06
9.6391e+06
-16390.1
-847315
1.24796e+07
15745
-3.06852e+06
1.39847e+07
172723
-3.52381e+06
1.47782e+07
300211
-3.6433e+06
1.53233e+07
285241
-3.78875e+06
1.56857e+07
255332
-3.89253e+06
1.5908e+07
224454
-3.98798e+06
1.60197e+07
185966
-4.08476e+06
1.60471e+07
144748
-4.18554e+06
1.60109e+07
106262
-4.28593e+06
1.59378e+07
73626
-4.38073e+06
1.58572e+07
46386.7
-4.46861e+06
1.57913e+07
25327.7
-4.55909e+06
1.57438e+07
10739.3
-4.64645e+06
1.57336e+07
-775.744
-4.76683e+06
1.57675e+07
-18259.5
-4.80743e+06
-4993.1
-5.11098e+06
1.00007e+07
23808.4
1.00028e+07
71252.1
1.00052e+07
119814
1.00079e+07
169364
1.0011e+07
220871
1.00142e+07
275016
1.00176e+07
332248
1.00208e+07
393286
1.00233e+07
458950
1.00248e+07
530047
1.00245e+07
607647
1.00219e+07
692920
1.00159e+07
787273
1.00055e+07
892451
9.98901e+06
1.01057e+06
9.96412e+06
1.14452e+06
9.9274e+06
1.2982e+06
9.874e+06
1.47752e+06
9.79758e+06
1.69205e+06
9.69452e+06
1.95704e+06
9.58238e+06
2.30192e+06
9.55576e+06
2.72363e+06
2.4734e+06
3.38267e+06
-833619
-1.01063e+06
-811112
-942416
2.33131e+06
2.53899e+06
2.48198e+06
-316271
-28252.1
2.75622e+06
5510.99
1.08558e+06
-356983
-311621
-355351
-270104
-125894
-3.09179e+06
3.04863e+06
140568
1.02931e+06
-213041
-281713
-207221
8.68261e+06
2.88209e+06
-185538
46048.3
-111337
-34412
-2.82256e+06
-2.64511e+06
-2.93747e+06
-2.84387e+06
7.16413e+06
2.80209e+06
6.40419e+06
2.74052e+06
6.44224e+06
2.84588e+06
6.93185e+06
3.22595e+06
7.47414e+06
3.91332e+06
7.73896e+06
4.78704e+06
7.56116e+06
5.66621e+06
6.96846e+06
6.34698e+06
5.84834e+06
7.25685e+06
6.93562e+06
4.1362e+06
9.57843e+06
-503830
1.26669e+07
-2.08372e+06
1.37965e+07
-3.2475e+06
1.43312e+07
-3.80885e+06
1.47389e+07
-3.99333e+06
1.50586e+07
-4.07782e+06
1.52648e+07
-4.0975e+06
1.54004e+07
-4.12872e+06
1.54933e+07
-4.18274e+06
1.55459e+07
-4.25017e+06
1.5567e+07
-4.32817e+06
1.55713e+07
-4.41203e+06
1.55741e+07
-4.50066e+06
1.55849e+07
-4.59847e+06
1.56115e+07
-4.70064e+06
1.56632e+07
-4.8462e+06
1.57159e+07
-4.8899e+06
-5.14407e+06
1.00005e+07
242.983
23363.2
1.00038e+07
165.494
69978.9
1.00078e+07
240.601
117670
1.00126e+07
239.126
166379
1.00182e+07
280.136
217123
1.00244e+07
363.854
270751
1.00317e+07
439.899
327183
1.00393e+07
485.083
387991
1.00473e+07
499.102
453371
1.00552e+07
488.656
524673
1.00626e+07
468.792
602803
1.00692e+07
453.395
689026
1.00741e+07
461.489
785122
1.00767e+07
503.378
892915
1.00762e+07
589.56
1.01475e+06
1.00714e+07
728.561
1.15379e+06
1.00613e+07
904.682
1.31381e+06
1.00454e+07
1166.61
1.5003e+06
1.00257e+07
1558.64
1.72028e+06
1.00133e+07
2544.49
1.98137e+06
1.00368e+07
5093.93
2.29669e+06
1.01312e+07
10801.3
2.65704e+06
1.04655e+07
21845.4
3.08783e+06
1.09428e+07
40981.6
3.43713e+06
-959498
-974529
-975129
-979294
1.13461e+07
71768.6
3.52623e+06
-987023
-1.03003e+06
-960810
-953503
1.06756e+07
137455
3.5989e+06
9.46073e+06
148892
3.76742e+06
7.77149e+06
90273.4
3.87463e+06
6.15606e+06
-2385.58
3.74364e+06
5.23523e+06
-118422
3.47739e+06
5.28112e+06
-219472
3.46417e+06
5.92686e+06
-253116
4.06933e+06
6.42992e+06
-175511
5.26025e+06
5.99919e+06
-48047.6
6.85303e+06
5.12954e+06
770761
6.66016e+06
7.82659e+06
717709
2.88613e+06
1.2113e+07
259815
-1.63123e+06
1.43741e+07
24285
-3.13428e+06
1.48436e+07
10781.9
-3.54938e+06
1.4993e+07
77944.1
-3.75046e+06
1.51408e+07
113354
-3.89974e+06
1.5318e+07
71871.6
-4.02135e+06
1.54284e+07
47875.8
-4.01055e+06
1.54889e+07
29537.8
-4.04585e+06
1.55351e+07
22047.7
-4.11437e+06
1.55605e+07
13521.1
-4.19347e+06
1.55698e+07
5576.14
-4.28273e+06
1.55777e+07
-2169.31
-4.38361e+06
1.56005e+07
-10550
-4.48829e+06
1.5639e+07
-16137.6
-4.59151e+06
1.56828e+07
-17674.9
-4.67282e+06
1.57556e+07
-25049.4
-4.80476e+06
1.58571e+07
-30500.6
-4.86152e+06
-4556.33
-5.2445e+06
1.00008e+07
23363.7
1.00038e+07
69977.9
1.00076e+07
117661
1.00122e+07
166367
1.00177e+07
217113
1.0024e+07
270741
1.00313e+07
327167
1.0039e+07
387965
1.00471e+07
453332
1.0055e+07
524627
1.00624e+07
602759
1.00689e+07
689001
1.00738e+07
785138
1.00764e+07
893002
1.00759e+07
1.01494e+06
1.00711e+07
1.1541e+06
1.0061e+07
1.3143e+06
1.00451e+07
1.50097e+06
1.0026e+07
1.72123e+06
1.00153e+07
1.98254e+06
1.00445e+07
2.29767e+06
1.01494e+07
2.65646e+06
1.05054e+07
3.07914e+06
1.09973e+07
3.40331e+06
-967952
-956827
-949109
-929130
1.12231e+07
3.39063e+06
-903601
-888452
-858634
-847370
1.07979e+07
3.45413e+06
1.00745e+07
3.66207e+06
9.0313e+06
3.84585e+06
7.97809e+06
3.85993e+06
7.2356e+06
3.81492e+06
6.96231e+06
3.94294e+06
7.02037e+06
4.46336e+06
7.16556e+06
5.34315e+06
6.70119e+06
6.77067e+06
7.5933e+06
7.1386e+06
1.12929e+07
1.15383e+06
1.33755e+07
-2.32707e+06
1.45297e+07
-3.21432e+06
1.4827e+07
-3.53416e+06
1.49155e+07
-3.81947e+06
1.50306e+07
-3.99466e+06
1.51464e+07
-4.11695e+06
1.52831e+07
-4.17317e+06
1.5368e+07
-4.15524e+06
1.54376e+07
-4.20174e+06
1.54915e+07
-4.26778e+06
1.55241e+07
-4.34301e+06
1.55474e+07
-4.43501e+06
1.55746e+07
-4.54084e+06
1.56133e+07
-4.65428e+06
1.56647e+07
-4.77015e+06
1.57467e+07
-4.93777e+06
1.58143e+07
-4.97393e+06
-5.25663e+06
1.00006e+07
243.048
22651.6
1.00047e+07
167.148
67896.3
1.00101e+07
243.122
114118
1.00168e+07
239.628
161413
1.00248e+07
276.409
210975
1.00346e+07
355.937
262843
1.00457e+07
430.915
318181
1.00583e+07
480.162
377773
1.00719e+07
503.8
442255
1.00868e+07
509.704
512453
1.01025e+07
511.739
589896
1.01187e+07
526.308
675959
1.01353e+07
572.008
772081
1.01521e+07
661.547
880367
1.01689e+07
803.635
1.00319e+06
1.01855e+07
999.687
1.1438e+06
1.02025e+07
1251.92
1.30514e+06
1.02214e+07
1573.56
1.4919e+06
1.02462e+07
2122.76
1.70901e+06
1.02859e+07
3038.14
1.96025e+06
1.03575e+07
5370.35
2.24986e+06
1.04752e+07
7815.16
2.56887e+06
1.06837e+07
14345.9
2.90948e+06
1.09158e+07
24750.7
3.2212e+06
1.10657e+07
25299.3
3.3795e+06
1.11213e+07
25610.6
3.52487e+06
1.09518e+07
52740
3.8632e+06
1.03089e+07
102737
4.37617e+06
9.08507e+06
145850
4.77889e+06
7.51598e+06
135947
4.87367e+06
6.18233e+06
41262.6
4.74129e+06
5.67673e+06
-121845
4.70397e+06
5.62769e+06
-263062
5.59906e+06
5.14555e+06
95362.3
7.2749e+06
8.81838e+06
692219
2.30519e+06
1.37039e+07
64546.9
-2.0649e+06
1.48576e+07
56596.5
-2.84281e+06
1.50174e+07
31432.3
-3.32602e+06
1.50916e+07
11189.5
-3.63489e+06
1.51576e+07
27121
-3.84387e+06
1.52286e+07
27661.3
-3.99816e+06
1.53216e+07
22094.3
-4.12848e+06
1.54537e+07
21980.5
-4.14207e+06
1.55222e+07
4983.29
-4.05094e+06
1.55794e+07
12777.4
-4.12093e+06
1.56177e+07
16731.3
-4.196e+06
1.56371e+07
11387.9
-4.27662e+06
1.5662e+07
-823.573
-4.3839e+06
1.57098e+07
-11611.3
-4.50528e+06
1.57679e+07
-12417.1
-4.60839e+06
1.5829e+07
-13440.6
-4.68133e+06
1.59202e+07
-17415
-4.83894e+06
1.60079e+07
-23736.1
-4.9064e+06
3769.73
-5.34757e+06
1.0001e+07
22647.6
1.00047e+07
67893.6
1.00099e+07
114112
1.00165e+07
161407
1.00244e+07
210971
1.00342e+07
262841
1.00454e+07
318180
1.0058e+07
377775
1.00717e+07
442261
1.00866e+07
512470
1.01023e+07
589934
1.01185e+07
676037
1.0135e+07
772221
1.01519e+07
880601
1.01687e+07
1.00356e+06
1.01853e+07
1.14433e+06
1.02024e+07
1.30587e+06
1.02214e+07
1.49288e+06
1.02467e+07
1.71019e+06
1.0288e+07
1.96162e+06
1.03616e+07
2.25019e+06
1.04851e+07
2.56952e+06
1.0706e+07
2.90197e+06
1.09496e+07
3.20553e+06
1.10208e+07
3.3605e+06
1.09919e+07
3.50273e+06
1.08594e+07
3.82731e+06
1.04862e+07
4.29504e+06
9.79197e+06
4.67524e+06
8.87448e+06
4.8527e+06
7.97162e+06
4.88688e+06
7.35091e+06
4.97815e+06
7.30234e+06
5.15704e+06
8.02145e+06
6.17826e+06
1.1653e+07
4.20818e+06
1.42474e+07
-1.37615e+06
1.48235e+07
-2.84674e+06
1.50028e+07
-3.36235e+06
1.51146e+07
-3.63495e+06
1.51768e+07
-3.85458e+06
1.52225e+07
-4.01274e+06
1.52661e+07
-4.13805e+06
1.53743e+07
-4.24913e+06
1.54846e+07
-4.22425e+06
1.5521e+07
-4.17734e+06
1.55516e+07
-4.24368e+06
1.55767e+07
-4.33031e+06
1.56034e+07
-4.44335e+06
1.56434e+07
-4.57382e+06
1.56994e+07
-4.70096e+06
1.57785e+07
-4.82766e+06
1.58584e+07
-4.99639e+06
1.58469e+07
-5.02105e+06
-5.38114e+06
1.00008e+07
239.497
21643.8
1.00057e+07
166.511
64970.6
1.00125e+07
235.458
109151
1.00212e+07
227.884
154444
1.0032e+07
261.974
202007
1.00449e+07
341.972
251868
1.00598e+07
423.023
305397
1.00772e+07
485.85
362785
1.00972e+07
530.657
425122
1.01191e+07
565.909
493608
1.01431e+07
603.335
569421
1.01695e+07
662.399
653560
1.01983e+07
760.35
748059
1.02296e+07
914.082
854844
1.02637e+07
1132.03
976419
1.03017e+07
1415.21
1.11498e+06
1.03442e+07
1769.52
1.27401e+06
1.03934e+07
2207.26
1.4568e+06
1.04531e+07
2795.61
1.66655e+06
1.05287e+07
3648.72
1.90514e+06
1.06296e+07
4714.68
2.17393e+06
1.07595e+07
6884.92
2.46558e+06
1.09216e+07
7951.13
2.76761e+06
1.10869e+07
8892.83
3.06858e+06
1.11458e+07
5888.04
3.32449e+06
1.11146e+07
-9131.49
3.55503e+06
1.10769e+07
-16108.3
3.89337e+06
1.09946e+07
11806.2
4.42014e+06
1.06158e+07
79166.4
5.05957e+06
9.72662e+06
162818
5.59899e+06
8.35575e+06
183546
5.94745e+06
7.34751e+06
90563.2
5.66265e+06
6.84948e+06
-540820
6.68778e+06
1.08642e+07
-750374
4.04609e+06
1.44285e+07
-17087.9
-1.23839e+06
1.4874e+07
-2898.95
-2.50752e+06
1.51346e+07
-17579.2
-3.0863e+06
1.52465e+07
-1832.12
-3.43651e+06
1.53063e+07
1046.64
-3.69594e+06
1.53498e+07
5233.87
-3.8928e+06
1.53805e+07
8058.75
-4.03691e+06
1.53966e+07
8584.07
-4.15259e+06
1.55162e+07
4830.75
-4.24476e+06
1.55794e+07
-16636.6
-4.02057e+06
1.56244e+07
-12321.3
-4.06214e+06
1.56555e+07
-5043.27
-4.14679e+06
1.5677e+07
-6516.01
-4.23458e+06
1.5708e+07
-14067
-4.35294e+06
1.57557e+07
-14215.6
-4.48755e+06
1.57984e+07
-2701.53
-4.58709e+06
1.58641e+07
8714.36
-4.69552e+06
1.59692e+07
22028.6
-4.90619e+06
1.60055e+07
-8219.55
-4.98367e+06
117119
-5.165e+06
1.00012e+07
21644.1
1.00057e+07
64970.9
1.00123e+07
109145
1.00209e+07
154436
1.00315e+07
202001
1.00444e+07
251863
1.00595e+07
305389
1.0077e+07
362771
1.00969e+07
425104
1.01189e+07
493593
1.01429e+07
569422
1.01694e+07
653596
1.01982e+07
748156
1.02296e+07
855031
1.02637e+07
976728
1.03017e+07
1.11544e+06
1.03444e+07
1.27464e+06
1.03938e+07
1.45761e+06
1.04539e+07
1.6675e+06
1.05303e+07
1.90613e+06
1.06332e+07
2.17462e+06
1.07643e+07
2.46447e+06
1.09267e+07
2.76474e+06
1.10926e+07
3.06219e+06
1.1142e+07
3.31554e+06
1.10729e+07
3.55304e+06
1.0971e+07
3.89627e+06
1.08605e+07
4.4012e+06
1.06218e+07
4.98469e+06
1.01392e+07
5.50327e+06
9.38417e+06
5.84381e+06
8.63501e+06
5.84535e+06
7.14737e+06
6.14229e+06
9.24864e+06
3.34593e+06
1.38346e+07
-389505
1.50232e+07
-2.56826e+06
1.51984e+07
-3.03983e+06
1.52619e+07
-3.4279e+06
1.53196e+07
-3.69174e+06
1.53623e+07
-3.89205e+06
1.53954e+07
-4.03786e+06
1.54165e+07
-4.15048e+06
1.54263e+07
-4.25233e+06
1.54998e+07
-4.29306e+06
1.55603e+07
-4.19805e+06
1.56002e+07
-4.2406e+06
1.56322e+07
-4.33045e+06
1.56605e+07
-4.45373e+06
1.56897e+07
-4.58713e+06
1.57386e+07
-4.71364e+06
1.58348e+07
-4.86823e+06
1.58526e+07
-5.01608e+06
1.57834e+07
-4.92415e+06
-5.24809e+06
1.0001e+07
239.708
20375.8
1.00067e+07
169.099
61222.7
1.00149e+07
239.497
102799
1.00256e+07
230.857
145506
1.00389e+07
262.371
190443
1.00551e+07
340.794
237608
1.00743e+07
423.506
288387
1.00966e+07
492.678
342951
1.01223e+07
549.667
402380
1.01514e+07
602.732
467887
1.0184e+07
664.73
540630
1.02206e+07
754.168
621594
1.02616e+07
889.727
712677
1.03074e+07
1086.5
815928
1.03589e+07
1349.95
933518
1.04172e+07
1674.67
1.06738e+06
1.04833e+07
2060.54
1.22081e+06
1.05597e+07
2509.79
1.39588e+06
1.0649e+07
3047.88
1.59525e+06
1.07546e+07
3628.57
1.81997e+06
1.08785e+07
4337.14
2.06998e+06
1.10189e+07
4150.18
2.34317e+06
1.11673e+07
4539.88
2.63408e+06
1.13032e+07
3387.01
2.93825e+06
1.13719e+07
1584.39
3.25206e+06
1.13365e+07
-2268.76
3.5833e+06
1.12495e+07
-11116.6
3.97575e+06
1.11862e+07
-13245.7
4.48409e+06
1.10986e+07
9891.57
5.13044e+06
1.07755e+07
87967.9
5.84398e+06
1.01564e+07
143277
6.43097e+06
9.64123e+06
247704
5.93171e+06
1.04861e+07
-1.11952e+06
6.97295e+06
1.45645e+07
-449999
412518
1.51876e+07
-19478.1
-1.84227e+06
1.53119e+07
16043.1
-2.6483e+06
1.53721e+07
-3599.69
-3.14338e+06
1.54259e+07
-1480.77
-3.48912e+06
1.54693e+07
-712.846
-3.73883e+06
1.55005e+07
110.864
-3.9242e+06
1.55213e+07
574.3
-4.05821e+06
1.55241e+07
2509.21
-4.15734e+06
1.55282e+07
6909.04
-4.24235e+06
1.55878e+07
55759.8
-4.0308e+06
1.56613e+07
5742.43
-4.02428e+06
1.57228e+07
-3753.35
-4.11426e+06
1.57673e+07
-1727.33
-4.21618e+06
1.5798e+07
-42.9148
-4.35067e+06
1.58005e+07
7728.64
-4.48188e+06
1.57723e+07
20797
-4.5711e+06
1.58247e+07
34053.9
-4.74144e+06
1.58925e+07
35463.3
-4.97267e+06
1.57476e+07
88574.3
-4.81202e+06
185119
-4.51744e+06
1.00014e+07
20373.1
1.00067e+07
61224.8
1.00147e+07
102798
1.00252e+07
145507
1.00385e+07
190447
1.00547e+07
237617
1.00739e+07
288402
1.00963e+07
342973
1.01221e+07
402415
1.01512e+07
467941
1.01839e+07
540717
1.02205e+07
621730
1.02615e+07
712882
1.03074e+07
816222
1.0359e+07
933914
1.04174e+07
1.06789e+06
1.04837e+07
1.22139e+06
1.05603e+07
1.3965e+06
1.06499e+07
1.59582e+06
1.07559e+07
1.82043e+06
1.08797e+07
2.06992e+06
1.10213e+07
2.34318e+06
1.11682e+07
2.6325e+06
1.13011e+07
2.935e+06
1.13705e+07
3.2469e+06
1.13341e+07
3.57928e+06
1.1229e+07
3.98113e+06
1.11166e+07
4.49489e+06
1.09759e+07
5.13668e+06
1.07549e+07
5.81898e+06
1.00191e+07
6.72984e+06
9.13229e+06
6.98895e+06
1.01566e+07
4.00183e+06
1.35245e+07
-472065
1.51744e+07
-2.05987e+06
1.52963e+07
-2.67447e+06
1.53823e+07
-3.12963e+06
1.5435e+07
-3.48226e+06
1.54772e+07
-3.73469e+06
1.55069e+07
-3.9217e+06
1.55267e+07
-4.05701e+06
1.55338e+07
-4.15491e+06
1.55262e+07
-4.23434e+06
1.55523e+07
-4.24509e+06
1.56421e+07
-4.24728e+06
1.56921e+07
-4.24926e+06
1.57124e+07
-4.31954e+06
1.57109e+07
-4.44091e+06
1.56913e+07
-4.55825e+06
1.56964e+07
-4.69711e+06
1.57181e+07
-4.85635e+06
1.56778e+07
-4.83101e+06
1.57005e+07
-4.72044e+06
-4.80463e+06
1.00012e+07
237.532
18833.4
1.00077e+07
173.129
56671.5
1.00172e+07
237.922
95102.4
1.00298e+07
227.017
134668
1.00457e+07
258.859
176385
1.00651e+07
341.209
220223
1.00882e+07
433.858
267555
1.01154e+07
519.907
318535
1.01469e+07
601.661
374197
1.0183e+07
686.316
435708
1.02243e+07
786.957
504023
1.02708e+07
919.431
580640
1.03236e+07
1101.9
666663
1.03834e+07
1345.67
764437
1.04516e+07
1646.21
875393
1.05289e+07
1989
1.00219e+06
1.06171e+07
2347.73
1.14661e+06
1.07176e+07
2706.77
1.31102e+06
1.08325e+07
3039.23
1.49728e+06
1.09626e+07
3342
1.70726e+06
1.11078e+07
3352.13
1.94184e+06
1.12636e+07
3505.41
2.20121e+06
1.14204e+07
2519.67
2.48569e+06
1.15651e+07
1735.06
2.79811e+06
1.16726e+07
1552.32
3.14428e+06
1.17114e+07
923.039
3.53922e+06
1.16753e+07
-369.727
4.00893e+06
1.15773e+07
-1897.33
4.57852e+06
1.14351e+07
5138.38
5.27512e+06
1.11739e+07
87168.9
6.00456e+06
1.00283e+07
291732
7.26742e+06
1.05476e+07
792559
4.61173e+06
1.36735e+07
-394344
4.17863e+06
1.52664e+07
-123277
-1.06425e+06
1.54697e+07
43222
-2.08994e+06
1.55175e+07
20775.2
-2.71738e+06
1.55542e+07
3156.88
-3.18359e+06
1.55875e+07
272.702
-3.52283e+06
1.56158e+07
-624.736
-3.76658e+06
1.56354e+07
-1028.06
-3.94267e+06
1.56456e+07
-1412.6
-4.06671e+06
1.56321e+07
2561.82
-4.14443e+06
1.55853e+07
26160.1
-4.1806e+06
1.56303e+07
101107
-4.03586e+06
1.57302e+07
42248.5
-4.04867e+06
1.5793e+07
17751.4
-4.10872e+06
1.58193e+07
12679.5
-4.21677e+06
1.58236e+07
10996.9
-4.37747e+06
1.57688e+07
16564.5
-4.49456e+06
1.57154e+07
17896.2
-4.5837e+06
1.58137e+07
17134.5
-4.82137e+06
1.58481e+07
53192.4
-4.90068e+06
1.56987e+07
87513
-4.40552e+06
93639.8
-3.95842e+06
1.00015e+07
18833.2
1.00077e+07
56672
1.0017e+07
95099.1
1.00295e+07
134663
1.00453e+07
176382
1.00646e+07
220222
1.00879e+07
267553
1.01152e+07
318532
1.01467e+07
374198
1.01829e+07
435720
1.02242e+07
504058
1.02708e+07
580714
1.03237e+07
666794
1.03836e+07
764642
1.04519e+07
875684
1.05293e+07
1.00256e+06
1.06175e+07
1.14705e+06
1.07181e+07
1.3115e+06
1.08332e+07
1.49774e+06
1.09632e+07
1.7076e+06
1.11087e+07
1.94211e+06
1.12637e+07
2.20053e+06
1.14207e+07
2.4852e+06
1.15646e+07
2.79683e+06
1.16699e+07
3.14163e+06
1.17116e+07
3.53653e+06
1.16799e+07
4.01062e+06
1.15888e+07
4.58416e+06
1.14249e+07
5.30694e+06
1.13011e+07
6.02819e+06
1.08589e+07
7.46203e+06
1.21033e+07
6.53478e+06
1.46394e+07
1.06888e+06
1.52859e+07
-1.24237e+06
1.54128e+07
-2.14394e+06
1.54946e+07
-2.73582e+06
1.55522e+07
-3.18418e+06
1.55903e+07
-3.5202e+06
1.5619e+07
-3.76402e+06
1.56369e+07
-3.94059e+06
1.56447e+07
-4.06591e+06
1.56405e+07
-4.14695e+06
1.56203e+07
-4.18191e+06
1.56652e+07
-4.17643e+06
1.56951e+07
-4.21444e+06
1.57279e+07
-4.23327e+06
1.57248e+07
-4.28829e+06
1.56959e+07
-4.40932e+06
1.56536e+07
-4.52973e+06
1.56446e+07
-4.68868e+06
1.56023e+07
-4.73177e+06
1.56173e+07
-4.61827e+06
1.58878e+07
-4.7602e+06
-4.41327e+06
1.00013e+07
237.504
17047.3
1.00087e+07
175.664
51339.9
1.00195e+07
242.402
86112.8
1.00339e+07
230.777
121991
1.00522e+07
261.54
159900
1.00747e+07
344.014
199776
1.01018e+07
439.53
242752
1.01337e+07
532.7
289544
1.01706e+07
627.151
340730
1.02136e+07
729.252
396928
1.02628e+07
850.069
459805
1.03191e+07
1004.55
530390
1.03831e+07
1208.66
610072
1.04565e+07
1470.22
700102
1.05398e+07
1778.12
802831
1.06349e+07
2108.16
919747
1.07428e+07
2423.9
1.05291e+06
1.0865e+07
2701.82
1.20427e+06
1.10026e+07
2914.31
1.37571e+06
1.11562e+07
2996.75
1.5695e+06
1.13244e+07
2998.73
1.78724e+06
1.15041e+07
2311.53
2.03241e+06
1.16899e+07
2220.37
2.30848e+06
1.18709e+07
1611
2.62114e+06
1.20346e+07
731.272
2.98169e+06
1.21622e+07
962.97
3.41225e+06
1.2239e+07
2010.07
3.92979e+06
1.22038e+07
4146.37
4.6145e+06
1.20792e+07
27747.5
5.36721e+06
1.10191e+07
89698.8
6.97683e+06
1.0991e+07
739819
6.55658e+06
1.28126e+07
685081
2.0888e+06
1.56731e+07
333483
945717
1.56964e+07
12951.4
-1.1074e+06
1.57032e+07
6769.15
-2.10438e+06
1.5725e+07
1627.02
-2.74131e+06
1.57472e+07
-328.343
-3.20577e+06
1.57667e+07
-816.797
-3.54154e+06
1.57812e+07
-1022.09
-3.78003e+06
1.57883e+07
-1317.91
-3.94822e+06
1.57833e+07
-1833.69
-4.05948e+06
1.57593e+07
-235.217
-4.11867e+06
1.56835e+07
20557
-4.11176e+06
1.57011e+07
52247.4
-4.05881e+06
1.57094e+07
44988
-4.01818e+06
1.57235e+07
29846.4
-4.07253e+06
1.57131e+07
16947.8
-4.16383e+06
1.56926e+07
14155
-4.36212e+06
1.56264e+07
18641.5
-4.48504e+06
1.56415e+07
13511.6
-4.65417e+06
1.57388e+07
27203.5
-4.94159e+06
1.57575e+07
80546
-4.74378e+06
1.60061e+07
28990.5
-4.55281e+06
108495
-4.13249e+06
1.00017e+07
17045.4
1.00087e+07
51345.1
1.00193e+07
86114.9
1.00336e+07
121995
1.00518e+07
159908
1.00743e+07
199790
1.01015e+07
242774
1.01334e+07
289578
1.01705e+07
340783
1.02135e+07
397008
1.02628e+07
459920
1.03192e+07
530545
1.03833e+07
610274
1.04567e+07
700352
1.05402e+07
803124
1.06353e+07
920060
1.07433e+07
1.05321e+06
1.08655e+07
1.20452e+06
1.1003e+07
1.37588e+06
1.11566e+07
1.56959e+06
1.13243e+07
1.78707e+06
1.15045e+07
2.03251e+06
1.16895e+07
2.30788e+06
1.18701e+07
2.62037e+06
1.20332e+07
2.98183e+06
1.21614e+07
3.4097e+06
1.22394e+07
3.9352e+06
1.22433e+07
4.586e+06
1.21473e+07
5.43194e+06
1.18916e+07
6.37554e+06
1.18082e+07
8.27927e+06
1.43523e+07
4.65786e+06
1.5687e+07
61263.9
1.57194e+07
-1.2625e+06
1.57116e+07
-2.12983e+06
1.57279e+07
-2.7508e+06
1.57501e+07
-3.20687e+06
1.57694e+07
-3.5404e+06
1.57834e+07
-3.77893e+06
1.57895e+07
-3.94786e+06
1.57829e+07
-4.06067e+06
1.57579e+07
-4.12081e+06
1.57154e+07
-4.11574e+06
1.56981e+07
-4.09914e+06
1.5675e+07
-4.12713e+06
1.56796e+07
-4.17788e+06
1.56644e+07
-4.21912e+06
1.56303e+07
-4.35314e+06
1.56266e+07
-4.53334e+06
1.56056e+07
-4.69479e+06
1.5572e+07
-4.62349e+06
1.61288e+07
-4.97711e+06
1.708e+07
-5.52038e+06
-4.32166e+06
1.00015e+07
235.933
15022.1
1.00096e+07
182.762
45281.5
1.00216e+07
244.924
75923.5
1.00378e+07
232.941
107628
1.00583e+07
265.587
141210
1.00837e+07
353.587
176546
1.01142e+07
459.652
214761
1.01505e+07
570.425
256472
1.01931e+07
688.728
301969
1.02422e+07
823.254
352533
1.02989e+07
977.968
408694
1.03642e+07
1164.17
471993
1.04389e+07
1394.8
543618
1.05243e+07
1669.55
624544
1.06218e+07
1972.25
716717
1.07328e+07
2262.76
821689
1.08586e+07
2505.92
941001
1.10006e+07
2670.22
1.07678e+06
1.11595e+07
2738.92
1.23109e+06
1.13367e+07
2722.38
1.40595e+06
1.15315e+07
2474.91
1.60479e+06
1.17423e+07
2371.53
1.83142e+06
1.19665e+07
1690.54
2.09111e+06
1.21993e+07
1264.23
2.39386e+06
1.24337e+07
1696.05
2.7507e+06
1.26628e+07
-121.973
3.18599e+06
1.28751e+07
4935.72
3.71404e+06
1.3072e+07
-17339.1
4.43911e+06
1.32282e+07
50373.3
5.16465e+06
1.30596e+07
-234073
7.3834e+06
1.45487e+07
758001
4.30927e+06
1.48182e+07
127461
1.69043e+06
1.56294e+07
161171
-32768.9
1.58927e+07
-59682.1
-1.313e+06
1.59572e+07
-28441
-2.14139e+06
1.59755e+07
-7784.47
-2.75231e+06
1.59833e+07
-2922.12
-3.21072e+06
1.59865e+07
-1665.63
-3.5431e+06
1.5985e+07
-1101.56
-3.77726e+06
1.59726e+07
-787.917
-3.93481e+06
1.59435e+07
-925.984
-4.02892e+06
1.58871e+07
-1801.73
-4.05914e+06
1.58046e+07
2247.07
-4.02837e+06
1.5726e+07
19026.6
-3.98076e+06
1.56302e+07
29572.9
-3.89405e+06
1.55582e+07
34222.9
-3.95504e+06
1.54814e+07
20133.1
-4.01206e+06
1.54219e+07
22399.4
-4.27924e+06
1.53709e+07
16399.7
-4.46858e+06
1.54008e+07
14483.6
-4.75012e+06
1.53307e+07
83558.1
-4.92958e+06
1.54905e+07
51757.7
-4.92393e+06
1.65854e+07
159536
-5.54271e+06
281125
-4.99662e+06
1.00018e+07
15020.4
1.00096e+07
45279.4
1.00214e+07
75916.4
1.00374e+07
107620
1.00579e+07
141204
1.00833e+07
176549
1.01139e+07
214758
1.01502e+07
256473
1.01929e+07
302002
1.02421e+07
352600
1.0299e+07
408788
1.03643e+07
472112
1.04391e+07
543766
1.05246e+07
624726
1.06222e+07
716930
1.07332e+07
821921
1.08591e+07
941233
1.10009e+07
1.07699e+06
1.11599e+07
1.23127e+06
1.13368e+07
1.40605e+06
1.15317e+07
1.6049e+06
1.17418e+07
1.83106e+06
1.19662e+07
2.09113e+06
1.21991e+07
2.39367e+06
1.24331e+07
2.75132e+06
1.26599e+07
3.18491e+06
1.28784e+07
3.7236e+06
1.30438e+07
4.40526e+06
1.32901e+07
5.24009e+06
1.26781e+07
6.75101e+06
1.31069e+07
8.59078e+06
1.55564e+07
2.32055e+06
1.60676e+07
-296199
1.6038e+07
-1.29314e+06
1.60013e+07
-2.12197e+06
1.59909e+07
-2.74836e+06
1.59902e+07
-3.20914e+06
1.59903e+07
-3.54212e+06
1.59875e+07
-3.77719e+06
1.59751e+07
-3.93606e+06
1.59448e+07
-4.03083e+06
1.5882e+07
-4.05879e+06
1.57972e+07
-4.02678e+06
1.57166e+07
-3.99478e+06
1.56324e+07
-4.00036e+06
1.55684e+07
-4.04497e+06
1.55086e+07
-4.0908e+06
1.54478e+07
-4.25134e+06
1.54499e+07
-4.54588e+06
1.53455e+07
-4.56363e+06
1.57001e+07
-4.84636e+06
1.72504e+07
-6.43881e+06
1.83928e+07
-6.5102e+06
-3.70794e+06
1.00016e+07
234.365
12779.2
1.00104e+07
182.745
38500.1
1.00236e+07
246.013
64585
1.00414e+07
234.614
91672.9
1.00642e+07
267.56
120239
1.0092e+07
361.58
150934
1.01258e+07
470.42
183601
1.0166e+07
592.668
219501
1.02131e+07
720.09
258798
1.02683e+07
859.988
302304
1.03318e+07
1019.5
351135
1.04051e+07
1207.78
405820
1.04892e+07
1436.59
468018
1.05855e+07
1702.27
538272
1.06956e+07
1983.05
618132
1.08209e+07
2235.63
709206
1.09626e+07
2424.38
812753
1.11224e+07
2522.17
930723
1.1302e+07
2530.8
1.06482e+06
1.15024e+07
2422.24
1.21805e+06
1.17247e+07
2291.6
1.39309e+06
1.19696e+07
1749.49
1.59513e+06
1.22376e+07
1784.45
1.83058e+06
1.25287e+07
1507.42
2.10795e+06
1.2841e+07
2254.83
2.44062e+06
1.31804e+07
183.024
2.84978e+06
1.35377e+07
10918.6
3.35082e+06
1.39855e+07
-43012.5
4.03385e+06
1.45298e+07
8396.79
4.6145e+06
1.56648e+07
-361443
6.61249e+06
1.61628e+07
-107664
3.91183e+06
1.64117e+07
104034
1.33575e+06
1.64222e+07
11419.3
-55062.9
1.63878e+07
-12755.2
-1.26645e+06
1.63521e+07
-10606.9
-2.09538e+06
1.63163e+07
-4862.72
-2.71182e+06
1.62846e+07
-2639.61
-3.1763e+06
1.62551e+07
-1604.52
-3.51187e+06
1.62205e+07
-820.955
-3.74168e+06
1.61708e+07
-127.096
-3.88468e+06
1.60937e+07
-26.4233
-3.95128e+06
1.5982e+07
-1920.78
-3.94477e+06
1.58356e+07
-1683.52
-3.87754e+06
1.56392e+07
13480.8
-3.78342e+06
1.54085e+07
35746.4
-3.65215e+06
1.51891e+07
44985.2
-3.72024e+06
1.50322e+07
33802
-3.76169e+06
1.49273e+07
26349.2
-4.08409e+06
1.49327e+07
-11281.4
-4.35063e+06
1.49155e+07
58721.7
-4.69737e+06
1.46865e+07
85540.1
-4.81049e+06
1.57928e+07
-203813
-5.98495e+06
1.74621e+07
19836.7
-7.39681e+06
355663
-5.97694e+06
1.00019e+07
12776.7
1.00104e+07
38502.8
1.00234e+07
64583.5
1.0041e+07
91671.8
1.00638e+07
120251
1.00916e+07
150951
1.01255e+07
183619
1.01657e+07
219592
1.0213e+07
258900
1.02682e+07
302457
1.03318e+07
351312
1.04052e+07
405999
1.04894e+07
468196
1.05858e+07
538449
1.0696e+07
618297
1.08213e+07
709347
1.0963e+07
812849
1.11227e+07
930765
1.13022e+07
1.0648e+06
1.15025e+07
1.21798e+06
1.17244e+07
1.39292e+06
1.19696e+07
1.59526e+06
1.22375e+07
1.83045e+06
1.25282e+07
2.1077e+06
1.28428e+07
2.44294e+06
1.31803e+07
2.84985e+06
1.35172e+07
3.39885e+06
1.39114e+07
3.96893e+06
1.45398e+07
4.61626e+06
1.48993e+07
6.01903e+06
1.55866e+07
7.79344e+06
1.6621e+07
1.38498e+06
1.64602e+07
-124404
1.64193e+07
-1.26511e+06
1.63695e+07
-2.08285e+06
1.63249e+07
-2.70864e+06
1.62893e+07
-3.1761e+06
1.6258e+07
-3.5123e+06
1.6223e+07
-3.74281e+06
1.61734e+07
-3.88637e+06
1.60938e+07
-3.95094e+06
1.5973e+07
-3.93926e+06
1.5824e+07
-3.87788e+06
1.5656e+07
-3.80887e+06
1.54574e+07
-3.74999e+06
1.52752e+07
-3.78521e+06
1.50971e+07
-3.79943e+06
1.49723e+07
-4.01801e+06
1.49331e+07
-4.38869e+06
1.48932e+07
-4.38326e+06
1.57698e+07
-5.86237e+06
1.67104e+07
-7.74767e+06
1.57762e+07
-5.88077e+06
-1.60855e+06
1.00017e+07
231.829
10336.1
1.00112e+07
187.991
31091.2
1.00254e+07
248.931
52256.8
1.00446e+07
236.503
74340.7
1.00691e+07
277.963
97690.7
1.00995e+07
376.227
122851
1.01361e+07
491.617
149816
1.01802e+07
707.049
178978
1.02316e+07
868.407
211625
1.02916e+07
1035.76
247511
1.03611e+07
1210.49
287943
1.04413e+07
1414.27
333187
1.05338e+07
1651.06
384295
1.06395e+07
1909.55
442698
1.07602e+07
2159.41
508825
1.08979e+07
2364.18
583853
1.10536e+07
2483.27
669730
1.12294e+07
2505.26
767400
1.14271e+07
2430.44
878964
1.16493e+07
2290.3
1.00668e+06
1.18985e+07
2055.66
1.15383e+06
1.2177e+07
1950.79
1.32491e+06
1.24883e+07
1714.86
1.52516e+06
1.2837e+07
1343.02
1.76391e+06
1.32278e+07
4573.41
2.04993e+06
1.36729e+07
4415.61
2.40346e+06
1.41699e+07
28860
2.82482e+06
1.47965e+07
9653.3
3.39406e+06
1.55717e+07
-66569.5
3.90201e+06
1.71001e+07
-223302
5.28677e+06
1.74451e+07
-980086
4.55255e+06
1.74439e+07
-121818
1.45858e+06
1.731e+07
29766.1
49127.5
1.7061e+07
39089.1
-1.0562e+06
1.68788e+07
8569.7
-1.92145e+06
1.67431e+07
-737.892
-2.57509e+06
1.66393e+07
-1939.03
-3.07031e+06
1.65512e+07
-1222.15
-3.42228e+06
1.64619e+07
-363.072
-3.65183e+06
1.63496e+07
370.913
-3.7724e+06
1.61938e+07
572.533
-3.79546e+06
1.59861e+07
-1324.13
-3.73454e+06
1.57262e+07
-1170.6
-3.61248e+06
1.53696e+07
12188.2
-3.42282e+06
1.496e+07
37888.6
-3.24172e+06
1.45616e+07
39937.6
-3.28564e+06
1.43066e+07
39287.9
-3.32009e+06
1.41272e+07
21017.9
-3.65907e+06
1.40644e+07
-23648.8
-3.97547e+06
1.38654e+07
42089.3
-4.43466e+06
1.39854e+07
-447044
-4.96334e+06
1.62888e+07
-888823
-7.67356e+06
1.68407e+07
-238038
-8.17386e+06
-444457
-4.94906e+06
1.0002e+07
10331.8
1.00112e+07
31086.3
1.00252e+07
52243.5
1.00442e+07
74321.5
1.00687e+07
97682.1
1.00991e+07
122882
1.01359e+07
149694
1.018e+07
179195
1.02316e+07
211886
1.02917e+07
247865
1.03612e+07
288298
1.04414e+07
333530
1.05341e+07
384640
1.06399e+07
443037
1.07606e+07
509152
1.08983e+07
584157
1.10539e+07
670003
1.12297e+07
767637
1.14273e+07
879163
1.16494e+07
1.00683e+06
1.18986e+07
1.15403e+06
1.21766e+07
1.32482e+06
1.24884e+07
1.52528e+06
1.28378e+07
1.76419e+06
1.32342e+07
2.05325e+06
1.36878e+07
2.40206e+06
1.42122e+07
2.9025e+06
1.48446e+07
3.3426e+06
1.54754e+07
3.90851e+06
1.62891e+07
4.98041e+06
1.72966e+07
5.80245e+06
1.72261e+07
1.33414e+06
1.71467e+07
-15022.1
1.70098e+07
-1.08897e+06
1.68665e+07
-1.93076e+06
1.67422e+07
-2.58496e+06
1.66414e+07
-3.07701e+06
1.65532e+07
-3.42513e+06
1.64643e+07
-3.65412e+06
1.63519e+07
-3.77333e+06
1.61916e+07
-3.78958e+06
1.59736e+07
-3.72156e+06
1.57113e+07
-3.61423e+06
1.54007e+07
-3.47636e+06
1.50202e+07
-3.31067e+06
1.46241e+07
-3.29581e+06
1.42925e+07
-3.29045e+06
1.40605e+07
-3.55187e+06
1.38085e+07
-3.98919e+06
1.36913e+07
-4.41315e+06
1.39514e+07
-6.66575e+06
1.19045e+07
-7.14635e+06
5.33733e+06
56962.5
4.22972e+06
1.00019e+07
227.196
7533
1.0012e+07
186.581
23108.1
1.0027e+07
249.329
39154.3
1.00473e+07
239.293
55955.8
1.00732e+07
270.366
73697.8
1.01057e+07
380.784
92763.2
1.01447e+07
522.77
113627
1.01915e+07
643.483
135378
1.02464e+07
702.165
161234
1.03109e+07
898.649
188523
1.03856e+07
1082.74
219699
1.04717e+07
1296.32
254804
1.05706e+07
1546.39
294241
1.06844e+07
1806.94
339020
1.08142e+07
2048.12
390354
1.09617e+07
2234.05
448295
1.11291e+07
2330.7
514393
1.13184e+07
2330.55
589935
1.15322e+07
2245.59
676245
1.17739e+07
2091.9
775252
1.20466e+07
1977.22
890009
1.2355e+07
1649.63
1.02369e+06
1.27048e+07
1479.55
1.18135e+06
1.31031e+07
2584
1.36799e+06
1.35628e+07
3049.62
1.58985e+06
1.40882e+07
20894.2
1.8578e+06
1.47064e+07
32302
2.17147e+06
1.54701e+07
21363.9
2.60589e+06
1.63312e+07
-29200.9
3.05484e+06
1.7916e+07
-44986.1
3.74553e+06
1.86572e+07
-547209
4.35206e+06
1.82011e+07
-29436.5
1.94445e+06
1.79355e+07
31281
284020
1.76805e+07
25108
-825864
1.74302e+07
3320.32
-1.67408e+06
1.71998e+07
-3934.25
-2.34039e+06
1.70021e+07
-1804.49
-2.87045e+06
1.68241e+07
227.778
-3.24407e+06
1.66483e+07
361.551
-3.47594e+06
1.64357e+07
39.4936
-3.55928e+06
1.61499e+07
1431.66
-3.51024e+06
1.57701e+07
1353.96
-3.35438e+06
1.53057e+07
399.341
-3.14385e+06
1.47777e+07
-443.204
-2.88113e+06
1.41997e+07
-2522.45
-2.62853e+06
1.35926e+07
19439.5
-2.59921e+06
1.31734e+07
42811.7
-2.66466e+06
1.28203e+07
20016.2
-2.92702e+06
1.23794e+07
-178.726
-3.20386e+06
1.17737e+07
-230173
-3.59066e+06
1.25143e+07
-1.26744e+06
-4.13087e+06
1.38473e+07
-2.14969e+06
-7.06044e+06
1.09091e+07
-286001
-4.86102e+06
-71843.5
-1.38532e+06
1.00023e+07
7528.75
1.0012e+07
23108.1
1.00268e+07
39148.8
1.00469e+07
55939.6
1.00728e+07
73703.2
1.01053e+07
92779.6
1.01443e+07
113616
1.01911e+07
136094
1.02461e+07
161356
1.03106e+07
188831
1.03854e+07
220035
1.04715e+07
255142
1.05706e+07
294597
1.06845e+07
339374
1.08142e+07
390693
1.09617e+07
448602
1.11292e+07
514660
1.13184e+07
590156
1.15322e+07
676416
1.17737e+07
775424
1.20461e+07
890102
1.23548e+07
1.02397e+06
1.27043e+07
1.18166e+06
1.31065e+07
1.36663e+06
1.35732e+07
1.59097e+06
1.41695e+07
1.82584e+06
1.49123e+07
2.18947e+06
1.55394e+07
2.73373e+06
1.62715e+07
3.14158e+06
1.72439e+07
3.95672e+06
1.83205e+07
4.17845e+06
1.80603e+07
1.56505e+06
1.78818e+07
194983
1.76596e+07
-841461
1.74254e+07
-1.69298e+06
1.72045e+07
-2.36772e+06
1.70049e+07
-2.87893e+06
1.68229e+07
-3.2427e+06
1.66458e+07
-3.47635e+06
1.64339e+07
-3.56101e+06
1.61436e+07
-3.49726e+06
1.57521e+07
-3.32749e+06
1.52829e+07
-3.14147e+06
1.47699e+07
-2.95585e+06
1.42007e+07
-2.72551e+06
1.35928e+07
-2.61135e+06
1.31252e+07
-2.59738e+06
1.26905e+07
-2.83535e+06
1.19123e+07
-3.10294e+06
1.1002e+07
-3.45418e+06
7.79766e+06
-4.6286e+06
680327
-1.85655e+06
-5.14317e+06
5.85008e+06
2.69513e+06
1.00026e+07
220.858
3889.14
1.00135e+07
191.688
14197.2
1.00296e+07
260.092
25038.2
1.00511e+07
233.476
36401.9
1.00784e+07
329.047
48473.1
1.01124e+07
332.112
61260.7
1.01529e+07
666.985
75592.7
1.02003e+07
441.933
91187.1
1.02591e+07
276.959
107688
1.03266e+07
684.809
126966
1.04051e+07
883.262
148181
1.04958e+07
1106.88
172155
1.06002e+07
1369.5
199171
1.07195e+07
1609.46
230018
1.08563e+07
1816.64
264808
1.10116e+07
1954.85
304581
1.11879e+07
2002.17
349604
1.13878e+07
1955.17
400961
1.16141e+07
1823.69
460013
1.18709e+07
1706.13
527576
1.21628e+07
1502.5
606460
1.24948e+07
1510.13
698222
1.2874e+07
1060.72
806316
1.33085e+07
1653.21
934209
1.38103e+07
395.029
1.08664e+06
1.43892e+07
4924.99
1.26991e+06
1.50767e+07
-13828.8
1.49144e+06
1.59384e+07
-23617.7
1.75926e+06
1.6906e+07
-982.663
2.08148e+06
1.82474e+07
11892.5
2.37855e+06
1.9475e+07
72018.2
3.04173e+06
1.91125e+07
20291.4
2.28507e+06
1.8781e+07
8740.95
605881
1.84553e+07
3158.23
-503151
1.80735e+07
-19761.6
-1.2719e+06
1.77176e+07
-9549.15
-1.97452e+06
1.73555e+07
8090.42
-2.51605e+06
1.69975e+07
10055.6
-2.89571e+06
1.66437e+07
5813.18
-3.1275e+06
1.62513e+07
556.426
-3.16683e+06
1.57426e+07
1099.26
-3.00139e+06
1.50922e+07
8257.01
-2.70964e+06
1.43189e+07
8296.73
-2.373e+06
1.35647e+07
-3934.84
-2.11025e+06
1.28378e+07
-27537.8
-1.83759e+06
1.20881e+07
2056.91
-1.72523e+06
1.15046e+07
43385.3
-1.77645e+06
1.08681e+07
35921.1
-1.92091e+06
1.00512e+07
89980.9
-1.96962e+06
9.37555e+06
-267322
-1.81453e+06
9.72851e+06
-1.63524e+06
-2.09269e+06
8.93358e+06
-2.3812e+06
-2.62194e+06
5.38753e+06
156631
-1.06245e+06
659793
1.42844e+06
1.00029e+07
3879.77
1.00135e+07
14181.3
1.00294e+07
25003.1
1.00507e+07
36387.9
1.00781e+07
48440.8
1.01119e+07
61380.5
1.01532e+07
75476
1.0202e+07
91047
1.02598e+07
107808
1.03272e+07
126914
1.04056e+07
148136
1.04963e+07
172120
1.06007e+07
199140
1.07201e+07
229998
1.08569e+07
264786
1.10122e+07
304546
1.11884e+07
349545
1.13882e+07
400866
1.16144e+07
459896
1.18711e+07
527419
1.21628e+07
606340
1.24947e+07
697866
1.28738e+07
806047
1.33098e+07
932999
1.38132e+07
1.08575e+06
1.43729e+07
1.26697e+06
1.50691e+07
1.47437e+06
1.59136e+07
1.86039e+06
1.68696e+07
2.17745e+06
1.82899e+07
2.54473e+06
1.94259e+07
3.11137e+06
1.9113e+07
1.89815e+06
1.87691e+07
547754
1.84515e+07
-520576
1.81149e+07
-1.37606e+06
1.77524e+07
-2.01454e+06
1.73532e+07
-2.47135e+06
1.69793e+07
-2.85844e+06
1.66178e+07
-3.10866e+06
1.62248e+07
-3.16699e+06
1.573e+07
-3.00055e+06
1.50849e+07
-2.67227e+06
1.43122e+07
-2.3562e+06
1.35403e+07
-2.17974e+06
1.27961e+07
-1.99167e+06
1.20831e+07
-1.83727e+06
1.15139e+07
-1.7829e+06
1.09098e+07
-1.95973e+06
9.9999e+06
-1.77501e+06
8.51849e+06
-1.58106e+06
4.31397e+06
-1.07807e+06
426063
692548
1.911e+06
4.79838e+06
1.61341e+06
1.00021e+07
208.434
773.547
1.00133e+07
179.782
4845.7
1.00299e+07
250.013
10353.2
1.00522e+07
260.201
16099.3
1.00807e+07
326.413
22259.6
1.01157e+07
421.667
28932.8
1.01583e+07
653.302
36193.4
1.0209e+07
760.337
44407.3
1.02684e+07
795.028
53370.4
1.03383e+07
966.98
63048.4
1.04195e+07
1147.88
74012.2
1.05131e+07
1355.28
86559.8
1.06212e+07
1578.33
100326
1.0745e+07
1789.08
116344
1.08864e+07
1955.39
134247
1.10475e+07
2045.87
154486
1.12301e+07
2037.21
177634
1.14374e+07
1931.32
203458
1.16727e+07
1763.94
233451
1.19403e+07
1595.39
267821
1.22457e+07
1440.78
307405
1.2594e+07
1186.68
354250
1.29937e+07
818.439
408615
1.34525e+07
469.374
473707
1.39841e+07
-508.045
550859
1.46041e+07
-2263.63
644601
1.53368e+07
-7652.14
757605
1.62238e+07
-28973.8
891410
1.72776e+07
-31573.8
1.05015e+06
1.84502e+07
7489.18
1.18796e+06
2.01095e+07
-53025.1
1.42771e+06
2.08129e+07
-60503.2
1.63411e+06
2.03933e+07
6723.82
1.01701e+06
1.96026e+07
-36906.4
327772
1.89871e+07
-23815.8
-629042
1.85231e+07
38050.7
-1.54732e+06
1.7795e+07
33279.1
-1.81831e+06
1.69828e+07
14877.8
-2.09504e+06
1.61287e+07
10195.8
-2.27905e+06
1.52974e+07
16672.1
-2.3457e+06
1.43242e+07
14715
-2.0298e+06
1.33087e+07
14140.5
-1.69052e+06
1.22244e+07
6621.4
-1.26763e+06
1.12028e+07
10622.7
-1.0693e+06
1.03362e+07
25799.3
-951640
9.50062e+06
37825.3
-814978
8.71436e+06
37206.5
-799139
7.9762e+06
72563.2
-792248
7.09382e+06
218441
-677355
6.37438e+06
-110605
-147414
6.37776e+06
-1.59509e+06
756734
7.39252e+06
-3.93327e+06
1.00859e+06
6.95531e+06
-1.33326e+06
1.28443e+06
-2.07402e+06
1.78647e+06
1.00024e+07
771.237
1.00133e+07
4827.52
1.00297e+07
10335.2
1.00519e+07
16120.3
1.00803e+07
22303.8
1.01154e+07
29016.7
1.01581e+07
36362.5
1.02091e+07
44344.4
1.02686e+07
53343.2
1.03386e+07
62967.9
1.04198e+07
73938.7
1.05136e+07
86505.4
1.06217e+07
100281
1.07455e+07
116302
1.0887e+07
134172
1.1048e+07
154371
1.12306e+07
177456
1.14378e+07
203211
1.16731e+07
233172
1.19406e+07
267492
1.22457e+07
307030
1.25939e+07
353786
1.29934e+07
408067
1.34517e+07
472983
1.39824e+07
550251
1.45964e+07
644979
1.53021e+07
754278
1.62131e+07
914003
1.72712e+07
1.08261e+06
1.86368e+07
1.18097e+06
2.01133e+07
1.58048e+06
2.0303e+07
1.64688e+06
1.99551e+07
901201
1.96077e+07
-210223
1.91806e+07
-972127
1.85997e+07
-1.39347e+06
1.77738e+07
-1.60814e+06
1.69293e+07
-1.99506e+06
1.6053e+07
-2.21696e+06
1.51963e+07
-2.28686e+06
1.43245e+07
-2.10467e+06
1.33946e+07
-1.7133e+06
1.23327e+07
-1.26376e+06
1.12849e+07
-1.09667e+06
1.03911e+07
-1.04447e+06
9.69569e+06
-1.02976e+06
9.01241e+06
-912525
8.1978e+06
-853178
7.69578e+06
-673254
6.64043e+06
-7714.67
3.24476e+06
1.66078e+06
-2.78934e+06
3.33235e+06
-3.27487e+06
4.11302e+06
4.16806e+06
9.99745e+06
200.375
1.00035e+07
186.829
1.0015e+07
264.872
1.00324e+07
298.847
1.00563e+07
377.888
1.00872e+07
501.962
1.01256e+07
638.532
1.01727e+07
836.501
1.02293e+07
1001.81
1.02962e+07
1178.43
1.03746e+07
1361.4
1.04661e+07
1552.7
1.0572e+07
1743.94
1.06944e+07
1915.52
1.08349e+07
2037.6
1.09954e+07
2074.23
1.11787e+07
2010.44
1.1387e+07
1850.41
1.16247e+07
1650.15
1.1896e+07
1450.64
1.2206e+07
1257.01
1.25615e+07
939.456
1.29693e+07
455.66
1.34406e+07
-155.549
1.39876e+07
-885.198
1.46281e+07
-2221.06
1.53826e+07
-4079.66
1.62784e+07
-11050.9
1.73409e+07
-17901.9
1.85439e+07
-20297.3
2.00404e+07
-74789.9
2.18255e+07
-155690
2.32565e+07
-411782
2.3915e+07
-323394
2.27789e+07
514312
2.05888e+07
650781
1.86731e+07
110421
1.67017e+07
-109011
1.45143e+07
-71923.5
1.20995e+07
98702
9.95217e+06
161994
8.27456e+06
50411.2
7.09574e+06
-7805.36
6.05573e+06
47323.9
4.97782e+06
209040
4.04774e+06
229799
3.36866e+06
120698
2.84221e+06
103375
2.24797e+06
317059
2.73383e+06
-71242.2
4.99777e+06
-1.05481e+06
8.29551e+06
-1.89655e+06
1.20581e+07
-2.34029e+06
-1.763e+06
9.99775e+06
1.00035e+07
1.00149e+07
1.00322e+07
1.0056e+07
1.00869e+07
1.01255e+07
1.01727e+07
1.02294e+07
1.02963e+07
1.03747e+07
1.04664e+07
1.05723e+07
1.06947e+07
1.08352e+07
1.09957e+07
1.11788e+07
1.13871e+07
1.16247e+07
1.18959e+07
1.22057e+07
1.25608e+07
1.29685e+07
1.34393e+07
1.39857e+07
1.46248e+07
1.53715e+07
1.62716e+07
1.73334e+07
1.84926e+07
1.9996e+07
2.14846e+07
2.19736e+07
2.14411e+07
2.09869e+07
2.0251e+07
1.87619e+07
1.66671e+07
1.43899e+07
1.22162e+07
1.0294e+07
8.66262e+06
7.42707e+06
6.40999e+06
5.6149e+06
4.87821e+06
4.20805e+06
3.61517e+06
3.43195e+06
3.71517e+06
4.55666e+06
6.11451e+06
7.92678e+06
57868.1
-492617
17791.4
-40984.4
-11408
-21662.9
-19493.2
18209.1
-537823
-9499.96
571589
-48238.5
843180
26989.6
75616.7
-44235.2
-782945
-57560.2
-2777.57
-34954.2
-18712.6
-222835
-22390.4
38682.4
26792.8
14621
20914.5
16784.8
-15250.4
205693
-281265
-8828.26
15819.7
40250
20471
-1900.9
30282.6
-29785.9
-616549
1746.94
-10155.6
12735.3
-72533.6
827696
8984.19
18693.4
23698.3
-9824.07
77894.1
-119289
816749
-77058.2
-843758
155123
-137204
-105135
149211
27113.6
29828.5
2479.21
26513.7
6230.76
106495
-130530
39324.9
37912.9
-55984.6
2252.02
3300.15
-6269.58
9688.52
80457.7
-781763
14235.2
-52058.5
-23470.3
-31047
-37514.1
26072.6
-455417
25916.5
446552
-42697.5
563276
37204.4
3803.97
-526762
-36114.2
-7021.49
-17467.6
-16049.7
-309662
10782.5
26178.5
67092.2
49868.9
-7581.05
-16563.2
120052
-226804
-14776.1
27727.6
34878.3
14900.3
27548.9
16929.8
-157148
-838380
67913.1
204799
-53368.8
-10216.4
586683
23846
1625.48
4242.82
12571.7
-159816
657643
-51306.5
-630943
190109
-66517.8
188672
-85650.3
135493
-19484.9
-8339.77
-18042.9
-13893.1
882.798
161125
-67600.4
-84050.7
-889.473
-7565.35
-1548.12
-4800.46
-361336
10904.6
341283
61492.9
45932.2
58653.8
50199.9
-475616
-254651
443277
18174.3
401817
252419
-460634
-18632.5
-62285.7
-25170.2
-40935
-34354.9
8614.88
-585799
319242
-337321
-10792.7
604944
693200
45084.1
349280
-58426.5
-739924
-82792.2
-56031.5
-56190.1
-81044.4
28610.9
-89443
22377.3
-177.94
14588.9
3366.57
-11984.2
-85135.6
-4158.94
-64285.2
17961.2
8363.99
11884.6
12833.3
270538
-7946.1
-24837.4
-19044
-25074.5
-13381.3
-174990
65770.2
36965
94096
-18234.5
69852.3
291709
-99597.9
572091
-26498.7
-39033.8
-38431.3
-26920.4
147274
164953
153095
8069.66
-124104
-353118
-275505
37780.1
233844
47235.7
15628.8
35988.9
24652.6
-597023
-336558
619748
5169.57
721052
340642
-758285
27664.5
-86942.9
-55623.4
-81915
-58490.9
-496761
259723
-255830
16194.9
475145
511318
236887
-41693.8
-532825
-65846.3
-25554.8
-44438.8
-35268.2
-26072
-14543.9
4598.65
4629.6
1288.35
12090.2
37527.4
-58868.7
30892.4
1704.09
-7566.04
-547.504
-6009.05
610350
38952.2
-24202.5
-37999.3
-23344.4
-39725.6
294970
146378
12623.2
-423394
116351
193853
-57600.1
463439
-20315
-18299.4
-33182.5
-12762.8
319968
105422
23993.7
-55108.8
-389148
27023.7
-18020.8
2.53474e+06
37890.1
-9026.37
2.71576e+06
23652.7
2.30241e+06
61645.6
-45294.1
-14320.7
-58641
54968.2
2.56919e+06
-75588.3
-84864.5
-105726
2.58204e+06
10862
-14103.2
-65511.1
-61828.2
2.93495e+06
62883.8
-80406.8
-91578.3
-111777
40797.3
309699
2.77894e+06
244270
423158
49361.9
2.64837e+06
58579.8
34402.1
-5067.32
52183.1
60452.3
44130.1
54832.6
59355.3
2.96942e+06
126688
11279.3
82629.8
79134.9
164638
90321.2
115466
102374
5764.36
23743
2.4721e+06
29439.4
30185.4
2.62526e+06
2.61352e+06
-45974.2
-62907.2
-30907.3
-58597.2
17273.7
2.98836e+06
-84494.1
-42480.2
-89494.6
2.37695e+06
-29909.3
-59690.7
-74307.6
2.69152e+06
-54876.2
-71627.4
-97748.6
34424.8
533717
2.67898e+06
326437
546991
2.97123e+06
86412.9
128297
78212.4
177466
157188
160086
187675
197268
2.68563e+06
69622.3
130157
175618
186990
158951
201882
92773.2
135575
505943
390048
479070
2.00217e+06
341925
147093
19243.3
528577
496850
504369
1.71822e+06
40175.5
104042
649689
264058
281832
335289
1.82525e+06
4032.38
589432
44792.9
739633
339548
313767
360976
37354.6
-28802.5
47991.7
-12504.2
-34455.4
-14873.2
14487
534375
7587.04
2377.71
-691.065
7847.27
835154
-863579
47672.4
3298.96
-13131.2
-5619.53
5294.51
65853.4
819739
7065.57
2913.66
-1680.91
12036.4
7285.59
37266
-21189.8
-5024.25
-20378.4
49419.4
609278
2.88145e+06
526209
-834248
-668017
-563118
889559
173233
105432
147312
44446.8
143131
58986.9
41228
-129117
946009
325250
-321373
-186129
26307.2
-60137.9
148026
266944
-72844.1
115175
539725
500420
515512
1.93345e+06
335426
133858
520724
392220
489389
1.83771e+06
-28132.2
-95384.2
685375
375673
329540
397885
1.74117e+06
563167
641810
271043
294176
349540
6897.14
57503.8
160686
-78412.7
-13568.8
-129989
40854.5
-55960.2
856370
27749.9
41556.7
31221.6
41919.2
931893
-931855
8139.9
31195.2
17172.4
9826.89
42987.1
11053
884480
55872.8
72673.3
59589.7
72233.4
-51540.5
40447
126049
39626.8
-52324
-98332.1
114647
1.1698e+06
2.81569e+06
987328
-761063
-582641
-721903
1.13414e+06
1.90922e+06
327269
-401780
-275840
-489148
150300
871158
1.95425e+06
601796
-341651
-272225
-468367
967623
103787
948323
358454
333818
436542
1.91982e+06
799619
1.06958e+06
25422.8
388203
453368
461510
2.05287e+06
28849.4
78263.2
421427
545932
521827
2.1529e+06
8161.05
21802.1
556526
571294
551004
172258
201.208
148220
-166019
-158978
-1385.29
353939
-212806
10861.7
56597
64417
48564.3
75026
57123.2
228496
74923.2
61905.9
84433.2
52146.6
22943.2
335092
98218.5
144382
127725
113303
29370.9
48991.6
2557.71
-26668
-55616.1
-45224.6
26232.8
40040.8
-17219.7
-5132.21
7692.35
-2249.29
-267094
-158246
-368806
-346604
129980
84253
151282
-86145.5
-243465
-736319
-215335
191616
189234
235872
-487391
-277473
-212012
55819.4
-6682.03
138867
-502876
-85297.8
1.07975e+06
380932
449127
460350
1.82584e+06
766990
967651
351191
342156
443515
2.1739e+06
-20150.5
-54256.4
564501
589518
565822
2.08035e+06
441503
568757
542711
163960
5941.41
142417
-156771
-7232.14
-151384
347531
-182330
5098.82
59705.1
68146
30656.8
68411.5
11045.4
2614.14
344040
84426.4
117116
98855.4
116079
-2657.95
134287
115202
3686.46
-123987
-124251
-9401.02
355491
98945.8
134457
110227
124847
2538.67
27669.7
-10901.4
-22726.6
-22773.5
-13790.1
13397.7
20466.6
-85268.1
202710
545307
-5687.72
-27538.2
-57781.8
6946.09
344101
351501
-101054
21892.9
-308913
-74594.1
-319992
664663
-125189
-326626
-101907
-967.045
1.13425e+06
-295422
-335222
-384415
2.70955e+06
1.09642e+06
-315621
-361871
-358729
1.17391e+06
2.9968e+06
62120.8
-349323
-402646
-403099
2.54678e+06
14971.8
4879.71
2.71469e+06
2.6534e+06
14025.3
2.84207e+06
21533.8
51644
903489
-140081
-70868.6
-190115
2.9214e+06
1.10968e+06
-298383
-237995
-250781
904260
204272
-100639
-195295
-180806
2.86683e+06
-5174.83
-10379.8
2.97393e+06
22925.6
36087.8
88755.5
1.14408e+06
-395646
-358623
-406238
2.48403e+06
1.02589e+06
-297966
-273122
-339039
1.05016e+06
2.74657e+06
-322358
-280238
-374349
2.66849e+06
8642.68
28413.6
2.85903e+06
2.57135e+06
2.72762e+06
196037
857907
-178457
-124982
-157376
2.7609e+06
925919
-251644
-145511
-192550
795371
-114049
-109383
-145683
2.97496e+06
45872.1
49056.8
2.84682e+06
415.03
-114694
-145561
95595.9
165319
-1261.66
-1202.38
-423698
-45866.3
-26918.2
-40576.7
-29464.1
-770954
15880.8
-48185.3
-36474.5
-24442.4
-63935.3
7867.75
-624070
-59236.6
-69099
-55218.9
-77716.2
-17524
-50765.7
10254
30654.3
26877.2
-105997
-139823
91339.4
153968
3177.8
-813023
894853
-57131.5
-34967.6
-60597.5
-34659.7
-11774.1
20797.8
-636469
-71723
-62792.2
-59413
-52970.4
-655985
-69209.2
-65305.7
-74513.5
-60380.9
-81661.3
2832.07
-110831
-14455.5
77797.6
123601
114856
658.985
62237.2
-99739.3
-75381.3
-147.518
45708.7
17875.6
47888.6
42723.3
58263.4
32387.8
-26018.8
4457.65
33408
33027.2
24914.6
42562.5
13343.8
31887.5
62273.2
96540.1
76837
79050.5
18055.5
20050
7634.35
-34379
-10765.3
815.93
-434.295
534.164
106586
59913.8
-95694.8
3647.72
-70299.3
13645.1
8932.24
43845
66246.2
75822.9
83555
43023.2
-25860.5
216688
34501.5
38565.7
45653.9
27652.9
36434.5
67773.8
94571.3
87627.6
79918.9
78072.7
3952.81
53383.7
-8814.1
-74443.8
-54207
2186.6
2940.6
-7290.02
-19118.6
67739.9
-14331.9
-41243
45880.8
897172
7862.03
-12425.7
8665.43
-13678.7
-86694.9
840901
19782.9
32272.6
29559.4
23841.9
880195
24081.4
13565.3
19632.7
21907.2
18976.6
109238
-47657.6
-41378.8
-88364.3
-41823.7
10797.4
-2102.33
12121.2
-6074.43
24296.4
24717.6
-35024.4
-50438.8
-13505.3
26359.3
97811
28730.3
969.317
15998.2
12082
181886
51389.7
-197366
31227.2
36035
39186
29883.2
68955.8
78289.5
30303
22296
18793.8
38230.5
-2864.25
9320.55
7052.91
-8609.94
-32480.3
22417.4
21310.8
30488.1
-31601.6
16943
-23688.2
33353.4
-38567.1
-106868
170204
-90183.9
-22458
-46232.3
-26892
-24846.2
126471
-182792
15661.8
23882.8
23076.9
16326.9
11774.2
2315.33
4227.63
-6343.88
12391.1
57888.9
-23702.6
-57121.9
34332.7
10771.3
4122.3
-113808
-149987
91605.2
-2763.49
165458
13549
-632718
-66941.3
-54133.5
-55670.7
-50950
-837944
18352.8
-47059.8
-20865.1
-21282.1
-51527.5
10720.2
-663387
-66802.7
-64742.2
-57441
-75528.5
-86101.9
-103709
-6711.57
74015.9
120050
-120238
-150032
95571.5
176014
1832.51
-807390
921325
-45068
-23319.4
-54351.4
-22551.5
-8547.86
-440339
-49478
-28521.6
-42138.8
-29603.2
-647398
-60595.1
-66729.6
-73888.9
-54691.5
-20521.8
-53079.2
10621.5
34230.1
28535.5
115232
2526.32
58911.9
2080.7
-103366
-76862.9
9116.71
34263.5
103759
84566.7
98735.3
58754.3
-10606.5
4818.63
84209
47762.4
18399.5
45587.3
73803.5
51598.1
-8093.93
-77251.2
-52689.4
-14085.5
42388.7
86992.3
101472
101794
83062.3
1174.95
-205.562
-11076.4
118680
68420.7
-99477.8
-82762.8
1257.95
43466.9
34742.3
46797.2
44851
59126
30165.7
-13332.8
201601
38444.2
33610.4
39039.1
27640.8
58001.3
64923.4
99460.9
77773.7
71205.3
17365.9
23588.7
4169.62
-34101.1
-10565.8
-266.149
-3105.84
65934.5
167387
-81716.5
-138614
244.527
903665
27813
14566.6
41520.9
5637.84
7459.23
577662
37139.5
30430.2
40703.7
28387.5
854947
49215.4
72487.3
69468.3
56634.4
11527.5
60865.2
-15376.8
-27888.9
-27665.9
65889.8
5625.25
-13475.5
48908.5
23151.5
15418.4
-50732.5
-28408.6
101160
29241.8
165182
-203706
-54813.3
-80237.1
-46694.4
-94115.2
-214468
142355
27607.2
-25968.6
-21427.2
-26836.5
-22453.5
-34836.4
56032.4
64150.6
22827.5
111853
-274452
-66818.7
-121951
-111850
-73512.8
74509.4
-1285.93
18647.7
-6675.43
-55562.9
112094
33038.5
1253.96
-72429
-158464
-29000.1
-59558.1
-68038.9
-20827.9
-218624
78746.3
-19902.2
-17063.7
-25788.2
-11201.8
-257782
-66719.5
-132708
-107042
-81534.2
-18823.4
-8440.21
44518
2014.8
1259.07
170183
-868.655
27756.2
1125.21
158924
141095
-153550
-151217
945.264
369862
63756.4
63252.5
72863.7
52310.4
4964.34
342475
103593
119488
101618
121750
350396
112640
138691
124378
129063
131661
115712
-2009.39
-124326
-124266
158205
1111.72
132410
547.882
-897.199
2983.47
-164721
175683
157345
-2781.59
-38919
-435765
-77183.5
-62125.1
-86928.5
-53006.3
-722018
29607.8
651332
-76129.6
-69697.4
-98937.6
-54289.5
1925.45
-648487
-100851
-148121
-117097
-129997
-59175.6
1871.89
30082.2
53801
-158305
163883
3621.15
151628
-776878
713071
-87109.4
-64050
-93227.3
-60171.6
-24634.2
22661.1
-665873
-111286
-123945
-127350
-108956
4138.76
-136995
-3650.87
140898
128758
-683214
-116848
-142645
-125122
-133298
42149.3
15500.7
-25841.2
-44223.2
-25529.2
-116293
19698.4
26545.7
22798.8
17985
32465
15733.5
-57203
33769.6
23319
36604.8
15161.3
3714.3
-78723.3
40644.2
52768.2
49997.1
43803
9080.57
4100.81
-4599.49
-12587
-35604.5
35249.9
28484.3
-17028.5
18962.2
-25788.9
22956.2
-28106
-33300.8
51956.5
-107817
21027
18849.6
15088.6
28967.6
27924.3
-53594
-39210.6
28792
14866.9
22290.5
21137.6
-58009.6
31276.9
41134.9
43820.1
29360
39760.1
32110.9
-48704
-25365.8
-13980.7
46818.6
-48476
41013.8
31543.3
-29570.7
53102.1
73360.6
-19326.2
-16707.4
-22799.1
-13109.4
421706
79345.4
-28601.5
-48063.6
-34259.4
-35744.7
135540
191021
-24732.2
-34447.7
-28343.5
-27995.5
-18080.5
6230.28
6984.81
12920.9
-30417
25982.6
57552.7
31210.9
547956
-30610.3
-43963.3
-41774.3
-29824
-164967
124314
440906
-12043.8
-18843.7
-24930.7
-9827.78
60927.8
-1128.84
-61966.3
2902.58
16016.2
372005
-18020
-32102.1
-21048.8
-29905.8
2834.23
164582
-3318.03
134177
1454.43
177823
146365
-165082
-160966
3828.92
347211
60839.9
61970.1
72997.5
50028.5
51438.9
232724
79798.2
65931.6
88987.7
54299.7
343882
103053
144189
122443
115593
30169.8
51074
4915.15
-27260
-59380.2
177846
2234.56
29217.6
765.994
4980.39
-172720
-5766.66
180965
157504
23470
-676944
-115619
-124136
-110112
-127033
-840724
29769.5
816334
-94493.4
-74872.8
-102869
-62833.8
-139839
3969.93
144341
130788
26804
-715105
-123779
-142820
-133997
-134738
-180261
193708
164734
3691
-807599
794568
-82235.5
-73510.7
-106678
-58271.1
-50989.5
-473728
-82528.2
-62203.9
-88596.7
-55529.6
-693097
-107643
-149466
-137586
-118880
-64809
3340.6
33638.6
56397.4
840.761
26131.4
-19987.8
-6359.91
-922.713
-20951.1
22214.4
-621.553
-4912.25
-3093.53
-5754.75
-65652.8
-20820.6
14265.9
13704.2
19355.7
7656.6
29831.6
30390.6
-22378.9
-12070
-69283.8
-46826.4
14178.9
10942.3
15145.4
7396.41
12652.6
-11057.7
25520
9522.98
5373.4
-15074.9
6667.31
-6162.75
-4392.13
18702.9
10551.4
2555.05
-103.081
1118.53
1159.26
29879.2
-18005.7
6553.15
-21109
-26536
-4483.74
-53590.2
11003.2
18759
23411.4
-21614.7
8401.68
-15084.9
-5910.21
21068.3
70742.3
14358.8
-68922.7
-7115.55
-9074.19
77071.8
483971
-8722.26
-12064.8
-7052.7
-6504.42
689997
24162
-32018.4
-56720.9
-38799.4
-16073.9
4410.03
61393.8
-1565.92
9715.14
59209
531190
-9108.36
-821.227
-1219.63
-9575.54
14934.7
-5428.52
-10666.7
61018.8
667748
-25933.8
-57731.3
-44595.8
-25135.4
-38010.9
391583
-12189.8
-5914.32
-10184.7
-7037.58
528452
-12529.8
-5977.17
-3305.51
-8947.58
14588.9
-6168.09
-4160.04
-585.592
123995
-494487
-26763.9
13631.5
167670
109901
132011
-33453.9
-47353
-25958.5
40676.1
-79962.6
539618
-39352.6
25950.4
49151
330778
21718.5
26670.7
97527.2
70323.5
101485
-42417.5
-13641.3
-19768.1
117526
-20310
-535419
-14178.8
168650
141128
160927
-50118.2
-34556
-29600.9
8928.09
-127618
-10312.7
580984
-51043.9
-19397.4
486323
5241.43
-8678.66
-14506.1
-11632.7
121392
134000
144311
-55942.9
-25900.7
-28132.3
-23140.9
129445
-520160
2706.09
161938
130200
153778
-32698.2
-52551.4
-32596.3
574707
-43123.7
-8057.43
-131114
-4190.17
489860
122019
140921
143973
-46522.6
-33193.2
-31751.7
6736.73
340969
-41464.8
121134
-128248
-20230.9
-102835
-41067.2
-27951
-41532.4
-23938.9
-14610.9
-814328
44276.2
43219.9
38216.8
-205965
48795.9
106688
-12421.9
-62878.3
-78814.4
-19350.9
-24720.2
-35016.1
-65001
500174
171106
-139255
-76296.7
-134412
-35493.7
9728.01
-21182.3
-878673
102423
-87691.2
132274
73430.2
-157942
-588711
147540
133338
-80537.5
-160332
-136196
21202.4
23805.8
2606.62
148500
-515901
-22452.1
172984
116276
136801
-45511.6
-49598.8
-35439.9
553943
-56351.9
33769.3
-87346.3
48004
336270
105318
73367.4
105557
-41776.5
-18563.9
-25888.4
-248805
-80443.1
773136
49306
-208861
-138464
-193532
49404.3
58499.1
58100.2
56500
198756
-845374
246550
63522.7
-676363
96158.8
45659.8
-115819
-176904
-170690
42409.1
40139.1
50355.3
76638.1
-249653
729049
33845.2
-215152
-121357
-164956
60103.6
46915.8
50844.2
-799971
241191
-52864.5
161317
-67193
-481504
-106330
-93946.3
-125062
27018.6
25230.6
30896.9
-548289
429921
-8007.87
8669.64
-133790
-112118
-106383
182184
123865
143151
30681.5
362703
11798.3
-281857
-318205
560408
16052.4
20468.7
10561.6
-99955.8
-54237.8
-81373.3
110154
76683.3
110020
-579351
6976.72
448035
-127289
-127739
-119795
146141
175988
166724
-5103.8
559790
5915.06
-337414
598010
-421736
-14662.9
13687.7
12042.2
-120093
-109053
-113762
138841
156500
159469
-224642
45603.3
-37212.9
81521.2
-11.4066
-9432.44
1284.18
41541.7
42212.1
36948.9
454.027
173495
61772.7
-32474.9
67261.8
12438.4
23069.6
1419.55
121486
-5477.16
-443.565
2337.95
40677.9
25695.4
34587.2
-102032
117470
71520.2
-5345.33
-28896.1
-14505.5
15426.6
21557.6
6749.63
7712.89
15629.9
-5723.67
12041.4
-217746
-90546.5
-166459
148648
132103
-28889.9
-21223.4
-15646.5
6840.97
-3142.8
1714.12
-16422.6
-603153
429768
4616.76
-122870
-131200
-115708
161067
186561
176088
569914
8029.51
-413976
13847.1
-338699
629991
-9278.86
-119258
-108552
-111460
146154
157807
164001
-13086.2
2933.03
-580892
421785
-6512.55
-132266
-115673
-105714
196236
135178
154686
28668.6
388349
-321283
598090
9327.7
-281946
-102986
-57128.6
-81486.6
121415
83934.5
120888
-130596
81908.6
57253.3
121742
-27297.8
-15264.3
-10310.2
-13708.5
-10705
-8432.01
-38659.5
40178.3
-83583.1
114395
35837.6
-449100
97519.1
-29730.2
-17366.6
-20580.3
-7832.7
-5658.38
-6140.46
36335.6
97446.3
92884.9
29917.4
40578.3
20371.1
9128.4
-8593.54
-16333.7
-7776.29
-19631.5
-12873
-108092
39149.9
-436111
-74022.1
-32690.8
-2400.82
-12371.7
-4190.81
-20501.8
-20958.8
-21413.9
108699
26367.8
17528.5
-127321
-14400.7
-21284.1
-143276
27693.8
-36150.1
-14337.6
19323.2
-1742.03
-6629.72
4555.63
-35688.8
-18940.8
-171886
34406.3
-3891.27
-116634
5427.14
-9518.22
134242
-2961.15
35967.2
-34595.5
-2197.23
-120456
41827.5
-144915
14814
-9708.65
171761
-185431
14993.4
-161112
20867.6
97508
6692.83
22678.2
1502.41
10289.6
-46236.4
-564.126
-64920.9
-13091.1
-7432.06
193989
2052.13
105290
-4758.72
-237132
-2996.97
-216301
6408.4
-64186.5
-108151
-21636
44330.6
-124431
-5006.26
2220.39
-6637.21
-268272
3765.31
-7376.79
-11720.5
-175840
200698
2895.19
184821
9709.9
-15824.5
-172357
217692
-23507.6
2698.4
-171080
-20458.6
166267
80020.5
-52690.9
-83298
40700.8
-177561
21831.3
-31052
-88826.2
10654.3
-19373.3
-37806.8
-203445
1441.18
-610.639
228637
-213007
3989.21
-191395
5290.12
122297
-643.139
112302
-148791
8783.43
-177.502
-169011
382.049
-148942
-1288.26
-12.7386
-123007
-117804
-1686.39
125811
-1319.08
-193178
728.006
-396.997
-83557
-12163.2
-14504.5
155377
11341.1
19959.1
-9891.81
4044.28
-37533.9
34470.4
-104182
-3172.25
906.468
120962
-57866.6
-544.9
-50537.1
-850.971
141222
100798
-5966.32
-143274
-104492
146454
3371.24
-30652.4
1031.51
-49998.3
-8878.09
-36925.2
31493.5
-42771.4
34527.9
138990
4778.8
127692
-166429
-9184.65
-4069.33
-155563
911.964
-136273
-137209
-4932.91
149156
-148076
-4834.88
3743.82
-1056.56
-191389
878.312
-4963.62
-109619
-13267
2415.4
171427
23098
77990.8
-33443.7
-7541.03
3485.44
-52741.5
137837
-11617.1
-103902
487.196
1505.81
122068
-58554
6793.39
-64530.5
-770.152
-7068.12
128943
126107
-130706
-125527
137614
-125581
2819.21
-777.306
-113025
-235.243
-2166.58
-9216
-20816.9
-5417.37
2758.38
-8879.62
7786.97
-145793
4842.43
-121100
217268
-14138.5
-2912.8
195457
1491.92
165067
-1903.71
1941.14
71928.9
122508
-769.441
-85283.2
-36.967
285094
3074.83
-710.716
148786
5746.86
30651.8
-222780
-4297.83
-38953
3354.22
-52733.5
190223
10886.7
-8022.82
-222787
9893.64
9382.07
-129172
-140515
-14035.3
63788.9
141456
-98740.2
4512.34
69416.3
-230.26
26816.7
-5791.89
-175217
-140735
245102
12454.4
188586
1543.05
153796
3371.7
83474.6
141052
8842.16
-94574.8
265405
3466.54
3939.46
180261
-126.368
-7982.29
-227900
-1207.34
-198472
183648
13819.6
-6745.48
151939
-227666
11161
-8634.98
189561
-205555
9905.5
172696
158903
-160420
-129559
3914.03
77611.2
128968
-87797.6
-5217.62
156806
4423.12
-3348.65
125772
1684.05
5963.55
25693.2
55893.6
-247.704
-19000.3
3621.32
-1357.87
-34217.9
454.995
-107.821
-73353.8
319.218
-75707.1
-56254.6
-41.8243
85720.2
-149.857
-198.687
-24637.4
-1535.72
14252.1
-9320.33
4307.01
20484.5
9185.08
-4215.26
6950.41
3308.45
19165.6
661.782
-493.473
-21211.4
-1006.8
-1580.57
22779.4
63477.4
-12578.7
-66723.8
-65541.9
98201
5599.02
-10311.6
2263.2
-12805.9
5.02074
32180.6
-977.744
62918.2
3967.7
-22157.4
936.325
-32699.5
-85674.1
-61058
7660.65
96679.5
-70101.2
2600.15
3230.54
-23728.3
5165.59
7400.73
16896.9
24017.5
1883.17
1771.64
-5335.97
-3588.14
40826.2
13174.2
9518.24
-2854.25
43788
29822.8
59999.5
9220.9
-79534.4
-54337
90105.6
-5322.28
-29667.6
2776.69
-10828.1
-43141.6
-953.415
-8614.17
-2415.44
17644.8
-17929.6
4287.14
51659.8
45944.6
4982.02
-41118.1
139604
49376.3
-160603
42271.8
-144851
33981.7
-39139.4
21129
-23804
-50793.3
52137.1
-5386.41
-169265
37669.8
20105.1
25379.1
-144019
-21373.4
150990
196132
-9488.03
221838
-10669.4
-22822.6
-149299
162555
14745.1
40782.6
127948
45903.9
-22574.4
-43849.9
-7257.76
-169340
-30688.9
-85033.4
-22159.2
1728.31
-43675.1
-55162.4
59704.8
47811.8
15410.3
-94595.1
-5643.83
-10433.5
-69426.3
22838.6
-6567.41
-60837.7
13056.7
-35822.6
-44490.7
-11584.8
-11491.1
-4926.19
-111610
33928.3
-66724.3
375.526
-6394.08
99706.2
-2268.05
18330.9
-13198.7
4556.54
-46135.8
24588.5
11942.1
-81469.4
87676.3
-13734.2
27134
-63636.1
26956.1
-59833.9
54409.7
56477.3
1481.92
-29983.3
-52436.4
6082.62
-27330.7
885.332
-10821.6
32912.4
-16217.3
-5476.37
46846.6
-38602.6
21944.6
40826.4
-74028.9
27121
-60604.8
-7971.39
-18563.3
51479.6
-40156.4
11824.8
38599.9
-93591
14787.3
32392
-51193.4
55380.1
-35955.5
38283.4
-37445.8
37972
-35183.7
31499.2
31610.6
-36424.2
-41282.9
23316.4
6970.07
42143
9681.67
38.4819
-47312.6
4544.92
54810.2
-21795.9
3750.56
27514.6
56952.5
-32596
-61563.7
76153.9
33135.8
-56705.3
-47467.5
-180575
6107.14
-148810
-4069.57
256280
-4936.2
196147
2959.68
80605.3
152419
6051.08
-104816
164492
-1067.3
-325.234
-1848.34
285016
5714.11
2176.6
195609
-8268.3
-244620
5515.43
9439.1
-190575
3025.8
-225078
-169250
-4906.74
-142892
79044.8
139728
-102584
3413.08
154482
120490
986.988
211093
3599.41
-1441.36
-235656
3101.04
1395.48
-3594.15
-153494
-132847
237656
-9524.66
203986
547.605
173318
1878.27
72972.2
133819
3452.33
-92532.2
305456
1981.52
2645.62
179417
3214.93
31063.5
-250888
-3594.77
-45249.6
41523.4
1384.38
156839
-58094.8
1950.93
221760
-254451
2942.28
232109
203820
-137687
-158124
-15033.2
67285.7
155806
-103745
5002.49
73939.3
-327.403
28791.9
29488.8
78927.4
9065.83
-670.05
-26619.1
-102158
-68142.7
2803.19
111495
10.0931
-35890.4
1047.57
-1793.08
-77678.8
6007.07
-2325.17
6823.88
-29241.9
11040
42821.5
11786.1
25462.5
-1763.32
17769.5
6865.36
3570.19
9688.66
21444.5
10169.6
88339.5
-95314.2
-83966.1
108656
5591.91
-23740.4
-46258
-11197.3
51775.4
10175.5
-9214.55
-11619.6
15769.9
15188.3
5004.47
34482
-4881.42
60113.6
-28182.8
8723.66
1550.72
-44745.7
-72304.8
-1831.02
-78935.4
-62905.3
1587.89
95916.7
109.866
-39157.1
-3573.52
9835.61
-8681.69
1475.03
31973.3
8574.04
-4215.72
9841.74
6504.37
38661.5
4040.23
-4114.19
15383.6
-10956.1
1140.67
58698
50244.1
26765.4
69536.2
-5556.02
-65933.6
-71006.1
103532
5820.75
-13270
5043.47
-15379.9
3318.72
-4104.91
163188
99051.5
-212668
9931.05
-221172
4799.16
-133192
-4.08956
-61710.3
-99144.6
-4261.58
49204.2
-284147
-1094.84
930.938
-168992
232.242
-30215.1
224878
-1979.35
44965.3
-9655.55
57872.8
-8247.23
-206000
245583
6197.46
143117
114097
19806.4
-51732
-109457
41346.7
-5931.42
-84441.6
-5571.25
-21625.1
-18859.9
50167.7
46040.9
-49163.5
-34763.9
55093.8
-70777.9
32520.1
86538.2
27782.9
-42285.5
-24493.8
49548.1
12743.7
-18874.9
35446.6
11478.6
-40566.8
-25702.6
34816.7
31635.5
-28634.9
-9315.69
-18463.6
36156.4
26168.1
31684.8
-28442.1
10907.9
27718.3
-18752.8
-68037.8
-43683.2
-31690.8
75095.8
27759.7
26193.7
52914.2
20678.1
29633.7
38498.1
4288.82
-12436.7
-21419.3
20108
-6518.48
34061.6
-11558.1
-4138.55
54401.1
32119.7
-41044.5
-10342.3
-35183.1
18734.6
866.399
3656.35
48710.2
41516.2
2718.71
86633.8
26807.3
-9753.97
-6742.94
30028.3
-5570.42
-20480.9
7196.14
-22217.4
33294.6
-12123.7
8801.04
-4313.8
-22171.9
-10622.2
11183.5
-25501.1
2997.77
-12800.6
23292.9
-5131.36
-6131.73
-17727.4
24572.6
-1486.83
59125.9
-17768
2486.36
7860.54
-1234.16
3270.71
-813.499
124749
145819
-3664.01
137770
128412
-158837
4508.2
-156757
1452.64
-140631
-447.49
-137577
-136461
2178.05
142787
-176858
1394.45
565.494
8312.7
-90614.6
-5942.31
147202
85456.1
-7343.14
140499
-4374.12
-4216.55
-97828.6
109062
3947.72
6581.23
128128
119383
-127586
-127289
134180
-123754
-1936.83
-115729
-647.73
1209.27
142517
134507
-126720
-141436
7135.96
175770
-14087.9
-2617.72
175138
3606.4
-2546.99
191036
3282.61
128830
117990
-1843.2
-742.403
17.0477
237195
8138.4
90632.5
15044.1
21114.8
-183732
-12469.6
-28196.7
19076.7
500.719
41686.5
-47479.3
11910.9
111806
-137143
-9532.67
14829.8
68912.6
13782.5
51479.9
-147953
-126760
-858.914
150791
104700
-2095.06
31956.2
-1048.51
69388.2
-149919
-9897.03
-172270
207196
10775
3743.45
164663
149846
138701
4039.57
184886
3955.69
3784.89
224094
3968.68
118407
11840.4
-11599.7
-197315
-11738.6
-116313
65536.3
11211
-13201.4
66670.3
-195365
10921.4
-13490.4
124391
-131159
15969.2
70736.1
68564.6
-143036
-164045
10210.2
142324
131827
-3072.79
141731
3260.03
-3869.58
161914
3906.86
9898.52
24493.5
16424.3
-5360.84
24183.3
-5423.01
-15459.8
-25747.2
24209.5
5341.37
-6689.13
16031.5
-16746
-37419.4
-12723.2
-6388.96
25276.2
28153.2
-2866.98
42186.4
-329.177
14594.3
-27821.6
-2787.96
-10063
8679.74
-6953.32
49570.3
18630.3
-16401.1
-48544.1
28584.7
29377.9
28227.5
-8531.57
-12095.4
-17221.8
-35775.9
-4616.76
532.632
8231.73
3354.79
27980.3
-26075
28862.4
-21556.5
23669
-34406.6
25212.7
6406.96
12718
36243.5
-23145.2
25881.8
618.531
22419.9
-28372
-23780.1
52554.8
18640.6
23347.4
20239.9
29218.9
39569.3
-37865.4
-5963.49
-38078.9
-23519.5
37544
-37373.3
-3410.47
34802.7
34725
-35777.3
35027.2
-41208.8
22286.6
7721.3
32960.4
-26316
-18837.1
-19318
-17181.6
14297.5
-15768.2
-10893.9
7480.01
23323.8
-30214.4
-25140.2
40419.2
25886
-30254
-16635.4
35188
24508.5
-24840.5
25857.3
39171.6
36605
24794.5
-16318.3
-10071
-16204.8
21171.1
57172.7
-6771.98
4990.48
16465.6
-26658.6
-11795.8
15246.7
1318.23
6895.34
-5893.11
26086.4
-12645.7
20630.1
19658.6
33852.2
-33632.8
-27782.7
-13274
43545.3
22335.8
158.468
6919.75
9863.62
12568.3
-12068.1
-69504.6
3108.96
-8984.46
75166.9
29687.8
23532.4
14005.9
27146.7
61506
10848.6
50417.8
31645.3
4193.38
57493
-31946.2
30313
-33672.7
14638.5
-13807.1
31904.1
12136.6
-15998.5
14142.4
22511.5
-31550.8
-37664.2
20759
29442.5
-5318.79
6959.84
76251.5
8114.47
21936.6
-34441
1597.82
35946.2
-63172.9
-9555.76
66705.6
73226.7
-1031.83
147759
138501
-975.927
126500
111827
-147885
9852.31
-166703
416.187
-148082
1575.33
-127127
-123258
428.534
135118
-193156
-753.251
-528.28
-80851.4
-7972.92
-17272.3
151561
5640.13
19672.1
-829.675
36343.3
-2832.16
-102169
123761
2725.66
143481
100907
-5623.16
-146945
-110296
157001
4217.4
-31655.9
2416.26
-53363.9
1038.29
135391
157881
-164686
-185653
7793.15
-8237.74
227099
163547
144842
-4650.47
-1829.63
181431
512.66
-6681.31
203298
4184.46
-2789.73
-5264.22
253882
4006.34
-9884.56
124123
-207292
7584.58
-119740
9954.34
67662.4
-200163
5133.42
69236.2
-9605.95
-149899
-170614
149732
134760
145363
2956.98
164619
4149.8
3893.15
135202
-157429
-4717.76
-5946.59
87127
-2660.3
71112.7
-144911
-3201.96
-161035
211054
-10176
559.321
193305
212059
3433.9
145926
125277
2050.64
1301.45
268293
3256.86
124945
15808.5
20600.4
-226419
-15921.6
-36612.6
27549
-7416.5
72719.9
-56099.7
1882.28
147661
-160836
2543.22
79859.2
85185.3
-171295
-146175
-2979.39
172026
111921
-2032.31
35521.4
-1293.96
79087.3
11298.3
-1355.59
3459.8
6283.09
-3506.83
3835.22
-13162.7
-9233.97
-17919
-3493.51
-19031.4
-6309.33
11569
-11491.8
-2650.65
6715.24
-10003.8
8034.24
14728.7
-30143.5
25057.4
-2149.07
34497.3
-19464.8
31987.3
-1925.96
10909.5
20908.5
-28245.2
-6692.58
25734.6
15873.8
13760.5
-15116
10745.8
-20448.1
-7026.22
9338.22
-16410.5
-9227.08
1169.9
29183.6
9942.99
-15125
18578
-9709.97
-4539.54
7037.26
6204.05
-2596.45
6102.89
-18279.4
4971.65
15177.7
8480.76
-7421.09
18288.1
25932.2
7561.68
3718.18
1518.38
-863.876
13158.2
-19069.8
9204.85
-13275.9
1851.62
-24600.3
8967.02
1912.96
-19205.4
27700.5
-5389.32
4876.32
249.524
11140.3
-4528.76
28859
-4065.74
-2148.86
99.9684
-13474.7
3073.81
12068.7
53274
-64721.5
-5907.97
-5596.64
-4002.47
-64273.6
-34239
-2012.06
32182
-69818.4
-8975.66
59540.9
-35949
-71022.5
-20466.6
53715.1
-17704.6
-35102
13398.3
16464.3
32910.1
9930.67
15183.1
2716.81
2799.77
-69615.4
10195
-3900.83
3016.79
37050.1
-833.897
-10907.8
70455.6
-31837.4
6504.6
-3192.71
38805.3
-6976.72
10333.5
-9213.36
-35823.3
16571.5
-11491.4
24133.3
28618.4
1755.43
-13085.3
41037.4
-4977.74
-9201.78
46861.6
12377.4
6960.18
18802.4
-38548.8
9746.74
-6783.57
14607.9
-11308.8
20981.5
-9725.14
17898.9
-35495.4
-5771.69
4631.12
13613.3
-11565
14038.1
15163.9
-1730.13
6720.07
917.722
-5753.44
-7961.96
-20271.7
)
;
boundaryField
{
inlet
{
type calculated;
value nonuniform List<scalar>
60
(
-9.9967e+06
-9.99662e+06
-1.0002e+07
-1.00019e+07
-1.00006e+07
-1.00005e+07
-1.00006e+07
-1.00006e+07
-1.00006e+07
-1.00005e+07
-1.00006e+07
-1.00005e+07
-1.00006e+07
-1.00005e+07
-1.00005e+07
-1.00004e+07
-1.00005e+07
-1.00004e+07
-1.00004e+07
-1.00003e+07
-1.00004e+07
-1.00003e+07
-1.00003e+07
-1.00002e+07
-1.00002e+07
-1.00001e+07
-1.00001e+07
-1.00001e+07
-1e+07
-9.99996e+06
-9.99994e+06
-9.99987e+06
-9.99984e+06
-9.99977e+06
-9.99973e+06
-9.99967e+06
-9.99963e+06
-9.99957e+06
-9.99952e+06
-9.99946e+06
-9.99941e+06
-9.99935e+06
-9.9993e+06
-9.99924e+06
-9.9992e+06
-9.99914e+06
-9.9991e+06
-9.99904e+06
-9.999e+06
-9.99894e+06
-9.99891e+06
-9.99885e+06
-9.9988e+06
-9.99874e+06
-9.99856e+06
-9.99851e+06
-9.99864e+06
-9.99859e+06
-9.99646e+06
-9.9964e+06
)
;
}
outlet
{
type calculated;
value nonuniform List<scalar>
60
(
1.17809e+07
1.17594e+07
1.12237e+07
1.15922e+07
6.39181e+06
8.16492e+06
2.23781e+06
6.42917e+06
5.97544e+06
5.04538e+06
5.31412e+06
4.41178e+06
5.69551e+06
4.99144e+06
5.85422e+06
5.98882e+06
5.96196e+06
7.47255e+06
6.29958e+06
8.94177e+06
7.9858e+06
1.11344e+07
9.88505e+06
1.28925e+07
1.26579e+07
1.48094e+07
1.48816e+07
1.55352e+07
1.58253e+07
1.56949e+07
1.58625e+07
1.57172e+07
1.58199e+07
1.57866e+07
1.59978e+07
1.59118e+07
1.60754e+07
1.59691e+07
1.57058e+07
1.57954e+07
1.5024e+07
1.54974e+07
1.51338e+07
1.56571e+07
1.62258e+07
1.71274e+07
1.71892e+07
1.80568e+07
1.8057e+07
1.39134e+07
1.60978e+07
-1.04414e+06
7.35435e+06
-3.6096e+06
1.99671e+06
3.66429e+06
8.74486e+06
-7.88044e+06
1.56428e+07
1.03318e+07
)
;
}
rightSide
{
type symmetryPlane;
value uniform 0;
}
leftSide
{
type symmetryPlane;
value uniform 0;
}
duct
{
type calculated;
value uniform 0;
}
cylinder
{
type calculated;
value uniform 0;
}
}
// ************************************************************************* //
| |
2f9cc0c3864fe90d3581f76bc5b22d8f1c567144 | 394a46c4fdf0e08aa083161c4b736dae166572ba | /GO_Server/CAdmin.h | 3ea06a4b0248cb0363d371f9d7bf15b78636b21a | [] | no_license | Bia10/Gothic-Sequel-Online | e695511f9f86bf192b37a7570f8545177b907258 | f24ac669310f5ce874ff3bc2020d487f378ff74f | refs/heads/master | 2020-03-29T09:09:32.627161 | 2017-11-27T12:41:01 | 2017-11-27T12:41:01 | 149,744,015 | 1 | 0 | null | 2018-09-21T09:47:41 | 2018-09-21T09:47:40 | null | UTF-8 | C++ | false | false | 186 | h | CAdmin.h | #ifndef CADMIN_H
#define CADMIN_H
//GO Admin interface
class CAdmin
{
public:
CAdmin();
~CAdmin();
void HandleAdminCommand(CPlayer* player, RakString command);
};
#endif //CADMIN_H |
a6803b0af75fcdd5770acb53f11df5d1db2daa71 | 25d01103cdceffd02aa09607791fc85708ba6d50 | /Summer_Training_2018/Final_Exercise/WF_warm_up/D_Defense_Lines.cpp | b65a805ee0c855c8bf3684fea6cd9c5e44456d97 | [] | no_license | MoonChasing/ACM | 3aea87957c695eec5dced21e0cc53c2fcb0fe3e6 | aa5878646a47bf258cb2698d5068edb57fe1d03e | refs/heads/master | 2020-03-24T13:07:31.432360 | 2019-02-27T14:53:10 | 2019-02-27T14:53:10 | 142,735,585 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,380 | cpp | D_Defense_Lines.cpp | #include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
//#define Debug
const int MAXN = 200010;
int n;
int a[MAXN], left[MAXN], right[MAXN];
int dp[MAXN];
void init()
{
left[0] = 1;
right[n-1] = 1;
for(int i=1; i<n; i++)
{
left[i] = 1;
if(a[i] > a[i-1])
left[i] += left[i-1];
}
for(int i=n-2; i>=0; i--)
{
right[i] = 1;
if(a[i] < a[i+1])
right[i] += right[i+1];
}
memset(dp, 0x3f3f3f3f, sizeof(dp));
}
int main()
{
int t;
scanf("%d", &t);
while(t--)
{
scanf("%d",&n);
for(int i=0; i<n; i++)
{
scanf("%d", a+i);
}
init();
#ifdef Debug
puts("------------------");
puts("Left");
for(int i=0; i<n; i++)
printf("%d%c", left[i], " \n"[i==n-1]);
puts("------------------");
puts("Right");
for(int i=0; i<n; i++)
printf("%d%c", right[i], " \n"[i==n-1]);
puts("------------------");
#endif // Debug
int len;
int ans = 0;
for(int i=0; i<n; i++)
{
len = lower_bound(dp+1, dp+n+1, a[i]) - dp;
ans = max(ans, right[i]+len-1);
dp[left[i]] = min(dp[left[i]], a[i]);
}
printf("%d\n", ans);
}
return 0;
}
|
5b759a63bed38e655424e07fadcf3dcac5a50108 | f6c7435c2619bd233a884717e96799bfc28975d0 | /Sunfish/src/Develop/checkTableGenerator.cpp | 87bd37a6de49123050a1bc70a60077050b1214df | [] | no_license | sunfish-shogi/sunfish2 | 734c875675480a4510ab23396b146c9bd4dd79d4 | aa62f30be0955dc97899c1267bb85f3e7315f8f4 | refs/heads/master | 2023-01-23T17:30:28.792055 | 2023-01-07T09:17:46 | 2023-01-07T09:17:46 | 15,472,136 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,025 | cpp | checkTableGenerator.cpp | /*
* checkTableGenerator.cpp
*
* Created on: 2012/09/29
* Author: ryosuke
*/
#include "checkTableGenerator.h"
#include "../Shogi/squareDiff.h"
#include "../Shogi/attack.h"
#include <sstream>
namespace Develop {
using namespace Shogi;
std::string CheckTableGenerator::develop() {
std::ostringstream oss;
oss << "#include \"../attack.h\"\n";
oss << "namespace Shogi {\n";
oss << "const unsigned Attack::_checkTable[][17][17] =\n";
oss << "{\n";
for (Piece piece = Piece::BPAWN; piece <= Piece::WDRAGON; piece.toNext()) {
// 玉の位置
oss << "{";
for (int rank1 = -8; rank1 <= 8; rank1++) {
oss << "{";
for (int file1 = -8; file1 <= 8; file1++) {
DirectionFlags flags;
if (piece != Piece::BKING && piece != Piece::WKING) {
// 移動先
for (int rank2 = -8; rank2 <= 8; rank2++) {
for (int file2 = -8; file2 <= 8; file2++) {
int rank = rank1 - rank2;
int file = file1 - file2;
if (rank >= -8 && rank <= 8 && file >= -8 && file <= 8 &&
Attack::attack(piece, rank2, file2) != 0 && // 移動先に動けるか
(Attack::attack(piece, rank, file) != 0 ||
Attack::attack(piece.getPromoted(), rank, file) != 0)) { // 王手し得る位置か
SquareDiff diff(file2+(rank2<<Square::SHIFT_RANK));
Direction dir = diff.toDirection();
if (piece.getMovableDirection().check(DirectionFlags(dir))) {
flags.add(dir);
} else if (piece.getMovableDirection().check(DirectionFlags(dir, true))) {
flags.add(DirectionFlags(dir, true));
} else {
assert(false);
}
}
}
}
}
oss << std::hex;
oss << "0x" << flags.getInteger() << ",";
oss << std::dec;
}
oss << "},\n";
}
oss << "},\n";
}
oss << "};\n";
oss << "const unsigned (*Attack::checkTable)[17][17] =\n";
oss << "(unsigned (*)[17][17])&_checkTable[-1][8][8];\n";
oss << "}\n"; // namespace
return oss.str();
}
}
|
e4baec4ecde801220b9886272ce5800809088861 | 3fb4c7eb4e3ccfee3acd06f1a8b2114c1187e6a0 | /AirQuality/AirQuality.ino | b54aa5454bfec4e527bceb9b217d97abcbe5dd8e | [] | no_license | jamshehan/arduino | b0352c40fe2a5bbd1060e198c47701e31cbd935a | c325a934e43b5740fc9239b114bb5b8c2fbf8e36 | refs/heads/master | 2020-05-15T13:20:14.216199 | 2019-07-02T12:39:20 | 2019-07-02T12:39:20 | 182,297,283 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,631 | ino | AirQuality.ino | #include <ThingSpeak.h>
#include "secrets.h"
#include <WiFi.h>
#include <SFE_MicroOLED.h>
#include <SparkFunBME280.h>
#include <SparkFunCCS811.h>
#define REFRESH_RATE 15000
#define OLED_RESET_PIN 9
#define OLED_JUMPER_MODE 1
#define BME280_ADDRESS 0x77
#define CCS811_ADDRESS 0x5B
#define RFID_ADDRESS 0x7D
#define RFID_TAG_BYTES 6
#define RFID_TIME_BYTES 4
#define RFID_TOTAL_BYTES 10
WiFiServer server(80);
WiFiClient wifiClient;
unsigned long myChannelNumber = SECRET_CH_ID;
const char* myWriteAPIKey = SECRET_WRITE_APIKEY;
MicroOLED oled(OLED_RESET_PIN, OLED_JUMPER_MODE);
BME280 bme280;
CCS811 ccs881(CCS811_ADDRESS);
bool connecting = false;
void WIFI_Connect()
{
WiFi.disconnect();
connecting = true;
char wifiName[] = SECRET_SSID;
char wifiPassword[] = SECRET_PASS;
Serial.print("Connecting to WiFi ");
Serial.print(wifiName);
Serial.println("...");
WiFi.begin(wifiName, wifiPassword);
for (int i = 0; i < 60; i++)
{
if ( WiFi.status() != WL_CONNECTED )
{
delay ( 250 );
digitalWrite(LED_BUILTIN, LOW);
Serial.print ( "." );
delay ( 250 );
digitalWrite(LED_BUILTIN, HIGH);
}
}
if ( WiFi.status() == WL_CONNECTED )
{
Serial.println("");
Serial.println("WiFi Connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
connecting = false;
digitalWrite(LED_BUILTIN, 0);
}
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(9600);
Serial.println("");
Serial.print("ThingSpeak Channel: ");
Serial.println(myChannelNumber);
WIFI_Connect();
server.begin();
oled.begin();
bme280.settings.commInterface = I2C_MODE;
bme280.settings.I2CAddress = BME280_ADDRESS;
bme280.settings.runMode = MODE_FORCED;
bme280.settings.tStandby = 0;
bme280.settings.filter = 4;
bme280.settings.tempOverSample = 1;
bme280.settings.pressOverSample = 1;
bme280.settings.humidOverSample = 1;
bme280.settings.tempCorrection = -5; // -5C correction for sensor calibration
delay(10);
bme280.begin();
ccs881.begin();
ThingSpeak.begin(wifiClient); // Initialize ThingSpeak
oled.clear(ALL);
delay(2000);
}
long lastUpdate = millis();
long scrollingToggle = 0;
float lastTemperature = 0;
float lastHumidity = 0;
float lastPressure = 0;
float lastCO2 = 0;
float lastTVOC = 0;
int lastHall = 0;
void loop() {
WiFiClient client = server.available();
if (client) {
String currentLine = "";
while (client.connected()) {
if (client.available()) {
char c = client.read();
if (c == '\n') {
if (currentLine.length() == 0) {
client.println("HTTP/1.1 200 OK");
client.println("Content-type:text/html");
client.println();
client.println("<script type='text/javascript'>setInterval(function() { if (document.getElementById('auto-update').checked) { location.reload(); } }, 4000);</script>");
client.println("<h1>Air Quality Monitor</h1>");
client.print("<p>Temperature: ");
client.print(lastTemperature);
client.print(" F</p>");
client.print("<p>Humidity: ");
client.print(lastHumidity);
client.print(" %</p>");
client.print("<p>Pressure: ");
client.print(lastPressure);
client.print(" kPa</p>");
client.print("<p>CO2: ");
client.print(lastCO2);
client.print(" ppm</p>");
client.print("<p>TVOC: ");
client.print(lastTVOC);
client.print(" ppb</p>");
client.print("<p>Hall Value: ");
client.print(lastHall);
client.print("</p>");
client.print("<p>Last update: ");
client.print((millis() - lastUpdate) * 0.001);
client.print(" s</p>");
client.print("<input id='auto-update' type='checkbox' checked>");
client.println();
break;
} else {
currentLine = "";
}
}
}
}
client.stop();
}
if (millis() > lastUpdate + REFRESH_RATE) {
oled.clear(PAGE);
oled.setFontType(0);
oled.setCursor(0, 0);
lastHall = hallRead();
wl_status_t wifiStatus = WiFi.status();
switch (wifiStatus) {
case WL_CONNECTED: {
String ip = WiFi.localIP().toString();
if (ip.length() > 10) {
int start = scrollingToggle % (ip.length() - 10 + 1);
ip = ip.substring(start, start + 10);
}
oled.print(ip);
break;
}
case WL_NO_SHIELD:
oled.print("WiFi error");
break;
case WL_IDLE_STATUS:
oled.print("Connecting");
break;
case WL_NO_SSID_AVAIL:
oled.print("No SSID");
break;
case WL_CONNECTION_LOST:
oled.print("Lost WiFi");
Serial.println("wifi disconnected ");
break;
case WL_DISCONNECTED:
oled.print("No WiFi");
Serial.println("wifi disconnected ");
break;
}
if(wifiStatus != WL_CONNECTED && !connecting) {
WIFI_Connect();
}
lastTemperature = bme280.readTempF();
lastHumidity = bme280.readFloatHumidity();
lastPressure = bme280.readFloatPressure() * 0.001;
oled.setCursor(0, 8);
oled.print(lastTemperature);
oled.print(" F");
oled.setCursor(0, 16);
oled.print(lastHumidity);
oled.print(" %");
oled.setCursor(0, 24);
oled.print(lastPressure);
oled.print(" kPa");
ccs881.readAlgorithmResults();
lastCO2 = ccs881.getCO2();
lastTVOC = ccs881.getTVOC();
oled.setCursor(0, 32);
oled.print(lastCO2, 0);
oled.print(" ppm");
oled.setCursor(0, 40);
oled.print(lastTVOC, 0);
oled.print(" ppb");
oled.display();
scrollingToggle++;
lastUpdate = millis();
// send the values to ThingSpeak
ThingSpeak.setField(1, lastTemperature);
ThingSpeak.setField(2, lastHumidity);
ThingSpeak.setField(3, lastPressure);
ThingSpeak.setField(4, lastCO2);
ThingSpeak.setField(5, lastTVOC);
ThingSpeak.setField(6, lastHall);
int responseCode = ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
if(responseCode == 200){
Serial.println("Channel update successful.");
}
else{
Serial.println("Problem updating channel. HTTP error code " + String(responseCode));
}
digitalWrite(LED_BUILTIN, HIGH);
delay(100);
digitalWrite(LED_BUILTIN, LOW);
}
yield();
}
|
fbdab216f875385a0c2bf85b5f3c050f8eb99c6f | 18f607b5cad4d48de016182804468a7662af359b | /Robot_MattsTaggedBranch/Sonic/primaryStateMachine.cpp | 07dbffb61b19353ac1fa10faef7e39bcb1a3335d | [] | no_license | redwingman1989/mr-bucket | 458a7004f76c3a4887721343cffa65505ee4169a | 7f46a702620d107da4f3329c118295f649988c7f | refs/heads/master | 2021-01-19T06:12:37.836868 | 2015-04-18T16:10:39 | 2015-04-18T16:10:39 | 34,933,495 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,214 | cpp | primaryStateMachine.cpp | #include "primaryStateMachine.h"
#include "MainExecMachine.h"
#include "DoublePointsStateMachine.h"
#include "Globals.h"
PrimaryStateMachine::PrimaryStateMachine() {
currentState = (state) &PrimaryStateMachine::waitForStart;
}
void PrimaryStateMachine::waitForStart(bool firstTime) {
static bool dpServoCmd = false;
static bool debounce1 = false;
static bool buttOneDetected = false;
static bool buttTwoDetected = false;
static bool calibrated = false;
if((buttMan.getButtons() & 0x01) && !debounce1) {
dpServoCmd = !dpServoCmd;
arm.commandDoublePointServo((doublePointStates_t)dpServoCmd);
debounce1 = true;
}
else if (debounce1 && ((buttMan.getButtons() & 0x01) == 0x00)) {
debounce1 = false;
}
/* Calibration requires orienting the robot in the score position,
* then pressing the right front button
* then orienting the robot in the loading heading
* High to low trigger on the left button will commence normal operation.
*/
if(buttMan.getButtons() & 0x02) {
goToWork.setScoreHead(mag.getFiltHead());
buttOneDetected = true;
}
if(buttOneDetected && ((buttMan.getButtons() & 0x02) == 0)) {
calibrated = true;
}
if((buttMan.getButtons() & 0x04) && calibrated) {
goToWork.setLoadHead(mag.getFiltHead());
buttTwoDetected = true;
}
if (((buttMan.getButtons() & 0x04) == 0) && buttTwoDetected) {
currentState = (state) &PrimaryStateMachine::kickSomeAss;
runTimeStart = micros();
}
}
void PrimaryStateMachine::kickSomeAss(bool firstTime) {
goToWork.RunTick();
// goToWork.DebugOutput(&Serial2);
if (((micros() - runTimeStart) > 160000000) && (!goToWork.lockoutDblDwn())) {
currentState = (state) &PrimaryStateMachine::doubleDown;
}
}
void PrimaryStateMachine::doubleDown(bool firstTime) {
bankBreaker.loadHeading = goToWork.loadHeading;
bankBreaker.scoreHeading = goToWork.scoreHeading;
bankBreaker.RunTick();
if ((micros() - runTimeStart) > (minutes_3)) {
currentState = (state) &PrimaryStateMachine::youWon;
}
}
void PrimaryStateMachine::youWon(bool firstTime) {
wheels.KillMotors();
while (1);
}
|
9382273724f36d38689b62e3ef0c83d11be71709 | 2720b9cb2cb05b86f5cfdf1799baea0cf706d159 | /3RVX/Skin/AccentColor.h | 13aa2af3b315abca2fb891e16fdeb0029ab34468 | [
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | malensek/3RVX | baa076679437facab4d00315c3f5030be67fc9bd | 556a0fe742922cd732645b2d1e03065d87e39747 | refs/heads/master | 2023-08-23T16:10:29.905393 | 2022-01-20T23:43:07 | 2022-01-20T23:43:07 | 12,887,841 | 368 | 99 | BSD-2-Clause | 2023-03-10T11:29:31 | 2013-09-17T06:22:24 | C++ | UTF-8 | C++ | false | false | 2,999 | h | AccentColor.h | // Copyright (c) 2016, Matthew Malensek.
// Distributed under the BSD 2-Clause License (see LICENSE.txt for details)
#pragma once
#include <Windows.h>
class AccentColor {
public:
/// <summary>Retrieves the instance of the AccentColor singleton.</summary>
static AccentColor *Instance();
/// <summary>
/// Retrieves the accent color in ARGB format (0xAARRGGBB).
/// </summary>
UINT32 Color() const;
/// <summary>
/// Sets the accent color manually. This will override system accent colors.
/// </summary>
/// <param name="color">
/// Manual accent color in ARGB format (0xAARRGGBB).
/// </param>
void Color(UINT32 color);
/// <summary>
/// Refreshes the system accent color. If an accent was specified manually,
/// calling this method will produce no result. This is helpful when the
/// system color scheme changes (either automatically from a wallpaper
/// slideshow or from a user preference change).
/// <para>
/// The WM_DWMCOLORIZATIONCOLORCHANGED windows message notifies applications
/// of a DWM color change, which can be used to trigger this method.
/// </para>
/// </summary>
void Refresh();
/// <summary>
/// Determines whether or not to use the system accent color.
/// </summary>
/// <param name="enable">
/// If set to true, the system accent color will be queried and cached for
/// future use. Otherwise, a manually-specified color (defined with the
/// Color(UINT32) method) will be used.
/// </param>
void UseSystemColor(bool enable = true);
private:
AccentColor();
~AccentColor();
static AccentColor *instance;
/// <summary>Cached accent color</summary>
UINT32 _color;
/// <summary>Whether or not to override the system color scheme.</summary>
bool _override = false;
/// <summary>
/// Whether or not to use undocumented DWM APIs to retrieve the accurate
/// theme colorization color.
/// </summary>
bool _useUndocumented = false;
/// <summary>
/// If undocumented DWM functions are used, the module handle is cached
/// here for future use.
/// </summary>
HMODULE _dwmLib;
/// <summary>
/// Retrieves system colorization parameters, which includes the raw
/// colorization color used by DWM for titlebars and other accents. This
/// method returns a different color than the DwmGetColorizationColor()
/// function, which doesn't retrieve the actual titlebar color. However,
/// it also doesn't return the titlebar color for some themes in Windows 10
/// or the automatic colorization based on wallpaper.
/// <para>
/// This method uses UNDOCUMENTED API calls and may cause horrific crashes
/// in the future. You have been warned!
/// </para>
/// </summary>
/// <returns>
/// An integer representing the DWM accent color, or -1 if a failure occurs.
/// </returns>
INT64 ColorizationParamColor();
}; |
2dc271e5410a245c5a91c578cd957db39fecf586 | fe9217ad7b69812bcc544febd9c8b5cd06146309 | /d05/ex02/PresidentialPardonForm.cpp | ee3ecbc85580022d2388e1965a7fe12413d2281e | [] | no_license | regien/CPP_piscine | e39d040e843ff6ace818af58ef6f99dadd3b6fb3 | 928e88a0a8c59a72a0cf5c83a1bed33a7920e296 | refs/heads/master | 2020-03-29T23:54:08.288865 | 2018-10-31T02:12:03 | 2018-10-31T02:12:03 | 150,495,218 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,036 | cpp | PresidentialPardonForm.cpp | #include "Form.hpp"
#include "PresidentialPardonForm.hpp"
// CONSTRUCTORS
PresidentialPardonForm::PresidentialPardonForm(std::string Target) :
Form("PresidentialPardonForm", 25, 5), _Target(Target) {}
PresidentialPardonForm::PresidentialPardonForm(PresidentialPardonForm const & rhs) :
Form(rhs.getName(), rhs.getGradeToSign(), rhs.getGradeToExec()), _Target(rhs.getTarget()) {
*this = rhs;
}
// OPERATORS
PresidentialPardonForm &PresidentialPardonForm::operator = (PresidentialPardonForm const &rhs) {
Form::operator = (rhs);
return (*this);
}
// METHODS
void PresidentialPardonForm::execute(Bureaucrat const& executor) const {
Form::execute(executor);
std::cout << _Target << " has been pardoned by Zaphod Beeblebrox" << std::endl;
}
// GETTERS
std::string const PresidentialPardonForm::getTarget() const {
return (_Target);
}
// STREAM
std::ostream &operator << (std::ostream &lfs, PresidentialPardonForm const &rhs) {
lfs << "PresindetialPardonForm Target: " << rhs.getTarget();
return (lfs);
}
|
f867866607f254eb4c9667acaf7a9fe25e86c022 | 0b5d7059838456db4de2fa210aa583dcb214acdb | /Вторая задача/Product.cpp | f43891ab899b921b20dc626b4fb249ca492bc0e7 | [] | no_license | olya757/2-3 | 5a64c874553876a7aff3794952f29ec1ad48427e | 510e9962ce5d1a9dec82e8377cf23716b56179ae | refs/heads/master | 2020-03-20T21:50:25.561124 | 2018-06-19T21:28:20 | 2018-06-19T21:28:20 | 137,763,562 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,867 | cpp | Product.cpp | #pragma once
#include "Product.h"
#include <stdio.h>
#include <stdlib.h>
Product::Product() {
NumOfStock = 0;
Code = 0;
Name = "";
Life = 9;
Count = 0;
Price = 0;
}
void PrintNum(int num, int N) {
string str = to_string(num);
for (int i = str.size(); i < N; i++) {
str += ' ';
}
str.substr(N);
cout << str;
}
void PrintStr(string str, int N) {
for (int i = str.size(); i < N; i++) {
str += ' ';
}
str.substr(N);
cout << str;
}
void PrintDouble(double d, int N) {
string str = to_string(d);
for (int i = str.size(); i < N; i++) {
str += ' ';
}
str.substr(N);
cout << str;
}
//печать в консоль
void Product::Print() {
int N = 20;
PrintNum(Code, N);
PrintStr(Name, N);
PrintNum(NumOfStock, N);
PrintStr(InputDate.ToString(), N);
PrintNum(Life, N);
PrintNum(Count, N);
PrintDouble(Price, N);
cout << endl;
}
//считывание с консоли
void Product::Input() {
InputNum("Введите уникальный код товара", Code);
InputStr("Введите название товара", Name);
InputNum("Введите номер склада", NumOfStock);
InputDate.Input("Введите дату поступления");
InputNum("Введите срок годности в днях", Life);
OutPutDate = InputDate;
OutPutDate.Increase(Life);
InputNum("Введите количество товара", Count);
InputNum("Введите цену товара в симолеонах", Price);
}
//ввод числа с консоли
void InputNum(string str, _int32 &res) {
cout << str << endl;
while (!(cin >> res && res>0));
}
void InputNum(string str, double &res) {
cout << str << endl;
while (!(cin >> res && res>0));
}
//ввод строки с консоли
void InputStr(string str, string &res) {
cout << str << endl;
do {
cin >> res;
} while (res == "");
} |
0621922f83d12ff9e128953c45cb0238afadd1b9 | 8c1e1569726adca8e52c9860cbb03d8b6dd0b056 | /ADXLib/Source/Player/Player.cpp | 6e9b7c74ef5212f183e0019919b8776239938b4a | [] | no_license | y2a3k2/ADXLib | ed2c7d7e29f3d10221a868922aa007e9b8d241da | 26ac71cdee076e4d3c194831669d580f327594d6 | refs/heads/main | 2020-09-04T22:27:52.910881 | 2019-11-26T00:59:35 | 2019-11-26T00:59:35 | 219,909,037 | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 2,892 | cpp | Player.cpp | #include"Player.h"
#include<Library.h>
#include<SceneManager/SceneManager.h>
#include<ResourceManager/ResourceManager.h>
namespace {
GameObject *enemy;
}
struct DATA {
DATA() { num = 0; strcpy_s(name, 256, ""); }
DATA(int nu, const char *na) { num = nu, strcpy_s(name, 256, na); }
int num;
char name[256];
};
Player::Player()
:GameObject("Player") {
/* 画像 */
auto spr = AddComponent<Sprite>();
spr->Load("data\\texture\\solvalou.png");
spr->SetRect(0, 0, 32, 32);
/* 音 */
m_se = AddComponent<Sound>();
m_se->Load("data\\sound\\fire1.mp3");
m_se = AddComponent<Sound>();
m_se->Load("data\\sound\\fire2.mp3");
m_se = AddComponent<Sound>();
m_se->Load("data\\sound\\fire3.mp3");
m_se = AddComponent<Sound>();
m_se->Load("data\\sound\\fire4.mp3");
m_se = AddComponent<Sound>();
m_se->Load("data\\sound\\fire5.mp3");
m_se = AddComponent<Sound>();
m_se->Load("data\\sound\\fire6.mp3");
m_se = AddComponent<Sound>();
m_se->Load("data\\sound\\fire7.mp3");
m_se = AddComponent<Sound>();
m_se->Load("data\\sound\\fire8.mp3");
m_se = AddComponent<Sound>();
m_se->Load("data\\sound\\fire9.mp3");
m_se = AddComponent<Sound>();
m_se->Load("data\\sound\\fire10.mp3");
auto col = AddComponent<CircleCollider>();
}
Player::~Player() {
}
void Player::Initialize() {
// 位置の初期化(画面の真ん中へ)
GetTransform().SetPosition(VGet(WINDOW_WIDTH / 2, WINDOW_HEIGHT / 2, 0));
// 描写順を変更
SetLayer((int)LAYER::PLAYER);
// 構造体をセーブ
auto p = StructSave<DATA>("data\\save\\save.txt");
auto data = p.Read();
p.Write(DATA(data.num + 1, "abc"));
// 自分と同じ階層から検索する
enemy = GetParent()->Search("Enemy");
}
void Player::Update() {
static Timer timer;
const float SPEED = MOVE_SPEED * GetTime()->GetDelta(); // 速度×デルタタイム
VECTOR vec = VGet(0, 0, 0);
auto input = GetInput();
if (input->GetKey(KEY_INPUT_LEFT)) {
vec.x = -SPEED;
}
if (input->GetKey(KEY_INPUT_RIGHT)) {
vec.x = SPEED;
}
if (input->GetKey(KEY_INPUT_UP)) {
vec.y = -SPEED;
}
if (input->GetKey(KEY_INPUT_DOWN)) {
vec.y = SPEED;
}
GetTransform().AddPosition(vec);
if (input->GetKeyDown(KEY_INPUT_SPACE)) {
timer.Reset();
m_se->Replay();
}
// シーン遷移のサンプル
if (input->GetKeyDown(KEY_INPUT_RETURN)) {
SceneManager::GetInstance()->Change(SCENE_ID::TEST2D);
}
GetDebug()->SetLog("Second %0.2f", timer.GetSecond());
GetDebug()->SetLog("ロード率 %0.2f", ResourceManager::GetInstance()->GetLoadPercent() * 100.0f);
}
void Player::OnCollisionEnter(GameObject *collider) {
// エネミーに触れているとき
if (collider->GetName() == "Enemy") {
// 1を押したら
if (GetInput()->GetKeyDown(KEY_INPUT_1)) {
collider->Destroy();
}
}
}
|
86357ccc131771b47aeb56c9547709a897805907 | 0d79cdeadc76cc3250dee42feae52009259b66d4 | /CubeEngine/Application/CubeGame/Attachment.h | 408d0c0d4441f9c194725b9fce3659d1d6499f63 | [
"MIT"
] | permissive | tigertv/Cube-Engine | 2ef4a49e031c375cb2368c04743dacdd793d0396 | 0677562bf1dfdb9dd0e35ee587874ac9788ad6ac | refs/heads/master | 2021-02-06T19:02:33.047381 | 2020-02-29T09:44:26 | 2020-02-29T09:51:07 | 243,941,293 | 0 | 0 | MIT | 2020-02-29T09:36:37 | 2020-02-29T09:36:37 | null | UTF-8 | C++ | false | false | 871 | h | Attachment.h | #pragma once
#include "GamePartType.h"
#include "Interface/Drawable3D.h"
#include "Collision/PhysicsShape.h"
#include "Math/Ray.h"
#include "Base/GuidObj.h"
#include "rapidjson/document.h"
namespace tzw
{
class GamePart;
struct Attachment : public GuidObj
{
vec3 m_pos;
vec3 m_normal;
vec3 m_up;
Attachment(vec3 thePos, vec3 n, vec3 up, GamePart * parent);
Attachment();
void getAttachmentInfo(vec3 & pos, vec3 & N, vec3 & up);
void getAttachmentInfoWorld(vec3 & pos, vec3 & N, vec3 & up);
Matrix44 getAttachmentInfoMat44();
GamePart * m_parent;
//each attachment hase a small AABB to detect collision
bool isHit(Ray rayIn, vec3& hitpointInLocal);
int attachmentType;
Attachment * m_connected;
std::string m_connectedGUID;
std::string m_locale;
void breakConnection();
float m_degree;
float m_collisionSize;
~Attachment();
};
} |
f7cffadce9e8f4a614405fee787ef3c6b52899da | 0a8b224bd47a65dfd87bb02902e7c01e3e71d8f5 | /ios/library/WhirlyGlobe-MaplyComponent/include/private/sqlhelpers.h | 3e67303cbe7aae9f8345f5b7e453824680bfdbda | [
"Apache-2.0"
] | permissive | mousebird-consulting-inc/WhirlyGlobe | 72ea7ffc7b82006d44d2df8e471238f06e93daeb | 07a710bf6deffda8222a7a7864eb855e95aa73b3 | refs/heads/main | 2023-08-31T07:13:46.124930 | 2022-05-05T17:08:18 | 2022-05-05T17:08:18 | 3,139,032 | 106 | 36 | NOASSERTION | 2023-08-22T20:54:16 | 2012-01-09T18:51:52 | C++ | UTF-8 | C++ | false | false | 2,631 | h | sqlhelpers.h | /* sqlhelpers.h
* WhirlyGlobeLib
*
* Created by Steve Gifford on 9/8/09.
* Copyright 2011-2022 mousebird consulting
*
* 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 <Foundation/Foundation.h>
#include "sqlite3.h"
namespace sqlhelpers
{
/// Create the statement, run it, finalize it.
/// Kicks out an exception on failure
void OneShot(sqlite3 *,const char *);
/// NSString version of OneShot
void OneShot(sqlite3 *,NSString *);
/** Encapsulates a SQLite3 statement in a way that does not make me
want to punch someone.
*/
class StatementRead
{
public:
/// Construct with the statement and maybe just run the damn thing
StatementRead(sqlite3 *db,const char *,bool justRun=false);
StatementRead(sqlite3 *db,NSString *,bool justRun=false);
/// Destructor will call finalize
~StatementRead();
/// Returns false if initialization failed
bool isValid();
/// Calls step, expecting a row.
/// Returns false if we're done, throws an exception on error
bool stepRow();
/// You can force a finalize here
void finalize();
/// Return an int from the current row
int getInt();
/// Return a double from the current row
double getDouble();
/// Return an NSString from the current row
NSString *getString();
/// Return a boolean from the current row
BOOL getBool();
/// Return a blob from the current row
NSData *getBlob();
protected:
void init(sqlite3 *db,const char *,bool justRun=false);
bool valid;
sqlite3 *db;
sqlite3_stmt *stmt;
bool isFinalized;
int curField;
};
/** This version is for an insert or update.
*/
class StatementWrite
{
public:
StatementWrite(sqlite3 *db,const char *);
StatementWrite(sqlite3 *db,NSString *);
~StatementWrite();
/// Run the insert/update.
/// Triggers an exception on failure
void go();
/// Finalize it (optional)
void finalize();
/// Add an integer
void add(int);
/// Add a double
void add(double);
/// Add a string
void add(NSString *);
/// Add a boolean
void add(BOOL);
protected:
void init(sqlite3 *db,const char *);
sqlite3_stmt *stmt;
bool isFinalized;
int curField;
};
}
|
501b00fe8b57de3df130e2efc2da2370df670f44 | 329ccd2ef076e7c16219dde08dfb648b98f94990 | /Engine/Tank.cpp | 2d04d8da8aed4817def6ae7bbe0e3647db9d317b | [] | no_license | Neithari/Space-Invaders | b52a96f303d7f03b395f0a8e41424036c9061f47 | 9a146ec5d6d9bc39ccd068adbba800da80a74d70 | refs/heads/master | 2021-01-01T16:36:11.630979 | 2018-01-07T13:59:08 | 2018-01-07T13:59:08 | 97,865,905 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,980 | cpp | Tank.cpp | #include "Tank.h"
Tank::Tank( Graphics& gfx ,const Vec2<float>& in_loc, const Rect<float>* in_pPlaySpace, const int in_maxShotCount )
:
gfx( gfx ),
startLoc( in_loc ),
loc( startLoc ),
pPlaySpace( in_pPlaySpace ),
maxShotCount( in_maxShotCount ),
soundShot( L"Sounds\\shoot.wav" )
{
}
void Tank::Restart()
{
loc = startLoc;
shot.swap( std::vector<TankShot>() );
}
const Vec2<int>& Tank::GetDimention() const
{
return dim;
}
const Vec2<float>& Tank::GetLocation() const
{
return loc;
}
void Tank::Draw()
{
gfx.DrawSprite( (int)loc.x, (int)loc.y, sprite, SpriteEffect::Chroma{ Colors::Magenta } );
for( int i = 0; i < shot.size(); i++ )
{
shot[i].Draw( gfx );
}
}
void Tank::DrawHit()
{
gfx.DrawSprite( (int)loc.x, (int)loc.y, sprite, SpriteEffect::Substitution{ Colors::Magenta, Colors::Red } );
}
float Tank::ClampToPlaySpace()
{
const float left = loc.x;
const float right = loc.x + dim.x;
const float top = loc.y;
const float bottom = loc.y + dim.y;
if( left < pPlaySpace->left )
{
return pPlaySpace->left;
}
if( right >= pPlaySpace->right )
{
return pPlaySpace->right - float( dim.x + 1 );
}
else
{
return loc.x;
}
if( top < pPlaySpace->top )
{
return pPlaySpace->top;
}
if( bottom >= pPlaySpace->bottom )
{
return pPlaySpace->bottom - float( dim.y + 1 );
}
else
{
return loc.y;
}
}
void Tank::Update( const Keyboard& kbd,const float dt )
{
for( int i = 0; i < shot.size(); i++ )
{
if( shot[i].Update( dt ) )
{
DeleteShot( i );
}
}
if( kbd.KeyIsPressed( VK_RIGHT ) )
{
loc.x += speed * dt;
loc.x = ClampToPlaySpace();
}
if( kbd.KeyIsPressed( VK_LEFT ) )
{
loc.x -= speed * dt;
loc.x = ClampToPlaySpace();
}
if( kbd.KeyIsPressed( VK_SPACE ) )
{
if( !rapidShotPrevent && GetShotCount() < maxShotCount )
{
rapidShotPrevent = true;
CreateShot( loc );
soundShot.Play( 1.0f, 0.5f );
}
}
else
{
rapidShotPrevent = false;
}
}
bool Tank::Collision( const Vec2<float>& in_loc,const Vec2<int>& in_dim ) const
{
return Collision( Rect<float>( in_loc, in_dim.x, in_dim.y ) );
}
bool Tank::Collision( const Rect<float>& obj ) const
{
if( isAlive )
{
return GetTankRect().IsOverlappingWith( obj );
}
return false;
}
const Vec2<float> Tank::GetShotLoc( const int i ) const
{
if( i < shot.size() )
{
return shot[i].GetLoc();
}
else
{
return { 0,0 };
}
}
const Vec2<int>& Tank::GetShotDim() const
{
return TankShot::GetDim();
}
const Rect<float> Tank::GetShotRect( const int i ) const
{
Vec2<int> shotDim = GetShotDim();
return Rect<float>( GetShotLoc( i ), shotDim.x, shotDim.y );
}
const Rect<float> Tank::GetTankRect() const
{
return Rect<float>( loc, dim.x, dim.y );
}
const int Tank::GetShotCount() const
{
return int( shot.size() );
}
void Tank::CreateShot( const Vec2<float>& origin )
{
shot.emplace_back( origin, pPlaySpace );
}
void Tank::DeleteShot( const int i )
{
shot.erase( shot.begin() + i );
}
Tank::~Tank()
{
pPlaySpace = nullptr;
}
|
fda530b2957654d10953ec0fd06577b2d5bea91e | c20b459468fa359a6f4c545db72a211d38298909 | /source/tree-graph/minimalTree.cpp | ae6d288782e1dc0e30ea3ee4aa4bf335638bc31d | [] | no_license | mycppfeed/Leetmap | e0340c6ecb85901c9555900a871e159a16940028 | f1f31085de60adce9dabe5eb2e5c4d66a5ba1572 | refs/heads/master | 2021-11-04T00:13:19.882064 | 2019-04-26T21:18:30 | 2019-04-26T21:18:30 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,473 | cpp | minimalTree.cpp |
#include<iostream>
typedef struct _Node {
int data;
struct _Node* left;
struct _Node* right;
} node;
void
insert(node** root, int data)
{
if(NULL == *root) {
node* n = new node;
n->data = data;
n->left = n->right = NULL;
*root = n;
} else {
if(data <= (*root)->data) {
if((*root)->left) {
insert(&((*root)->left), data);
} else {
node* n = new node;
n->data = data;
(*root)->left = n;
}
} else {
if((*root)->right) {
insert(&((*root)->left), data);
} else {
node* n = new node;
n->data = data;
(*root)->right = n;
}
}
}
}
void minBST(node** root, int *arr, int start, int end)
{
if(start > end) {
return;
}
int mid = start + (end - start)/2;
insert(root, arr[mid]);
//left half
int left_end = mid -1;
minBST(&((*root)->left), arr, start, left_end);
//right half
int right_start = mid +1;
minBST(&((*root)->right), arr, right_start, end);
}
void
deleteBST(node* root)
{
if(NULL == root) {
return;
}
deleteBST(root->left);
deleteBST(root->right);
delete root;
}
void
print(node* root)
{
if(NULL == root) {
return;
}
print(root->left);
std::cout << " "<< root->data ;
print(root->right);
delete root;
}
int main()
{
node* root = NULL;
int arr[] = {1,2,3,4,5,6,7,8,9};
int end = sizeof(arr)/sizeof(arr[0]);
minBST(&root, arr, 0, end-1);
print(root);
}
|
0ffe5c17aa434ddc3a848055d5ef4d16ab031a90 | 9150f222170c3a12985673c4d696815cd083163a | /include/dex/dex_ir_collectionmap.h | 8fd77e5a14b8259faa5f7209d58a43a3d6eade33 | [] | no_license | strazzere/DexRewrite | d2a586445b326f38746281c20d7710d57991a44a | b9f27e8cbc0ff0d17d46ab3d929891f5e5f0b723 | refs/heads/master | 2022-11-10T11:42:54.643846 | 2020-06-29T19:12:51 | 2020-06-29T19:12:51 | 275,903,611 | 7 | 1 | null | 2020-06-29T19:09:35 | 2020-06-29T19:09:34 | null | UTF-8 | C++ | false | false | 1,638 | h | dex_ir_collectionmap.h | /**
* @ name unpacker
* @ author xiaobaiyey
* @ email xiaobaiyey@outlook.com
* @ time 2019/4/6 9:24 PM
* @ class describe
*/
#ifndef UNPACKER_COLLECTIONMAP_H
#define UNPACKER_COLLECTIONMAP_H
#include <map>
#include "dex_ir_collectionbase.h"
#include <base/macros.h>
#include <base/logging.h>
namespace dex_ir {
template<class T>
class CollectionMap : public CollectionBase<T> {
public:
CollectionMap() = default;
// Returns the existing item if it is already inserted, null otherwise.
T *GetExistingObject(uint32_t offset) {
auto it = collection_.find(offset);
return it != collection_.end() ? it->second : nullptr;
}
// Lower case for template interop with std::map.
uint32_t size() const { return collection_.size(); }
std::map<uint32_t, T *> &Collection() { return collection_; }
~CollectionMap() {
const char* symbol=typeid(T).name();
int status;
char *demangled = abi::__cxa_demangle(symbol, 0, 0, &status);
int maps_size=size();
//collection_.erase(collection_.end());xx
}
private:
std::map<uint32_t, T *> collection_;
void AddItem(T *object, uint32_t offset) {
auto it = collection_.emplace(offset, object);
CHECK(it.second) << "CollectionMap already has an object with offset " << offset << " "
<< " and address " << it.first->second;
}
friend class Collections;
DISALLOW_COPY_AND_ASSIGN(CollectionMap);
};
}
#endif //UNPACKER_COLLECTIONMAP_H
|
aa21f0015caeec74e4ec19b6855764bd79df095e | 767c69a976f4fb9091050d26a3f259f8cde4a002 | /STM32F103_t1/MyInc/ecg_Checksum.h | 1304885a4fcf30d672f0840973d57559505487e7 | [] | no_license | JeffKuang/STM32F103_t1 | a9f542950524549255ae2d9cc5dc01234a8d5c0a | 39cde6df8b35151493cd6a0ca69f82af5d4d6083 | refs/heads/master | 2021-01-10T16:34:25.223577 | 2015-05-24T12:25:23 | 2015-05-24T12:25:23 | 36,061,445 | 0 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 604 | h | ecg_Checksum.h | /*
*
* Copyright 2008-2015 PHS, All Rights Reserved
*
* Written by Jeff Kuang (kuangjunjie@phs-med.com)
*
*/
#ifndef ECG_CHECKSUM_H
#define ECG_CHECKSUM_H
#include "ecg_Core.h"
namespace ecg {
////////////////////////////////////////////////////////////////////////////////
typedef dword CRC32;
////////////////////////////////////////////////////////////////////////////////
/**
* ¼ÆËãCRC32
*
* ¶àÏîʽ£ºx32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x + 1
*/
CRC32 calcCRC32(const dword* buffer, size_t size);
} // namespace
#endif // ECG_CHECKSUM_H |
0d8a2158caaca324c7aa9ca7dc3906aa8d5dbf0c | c838fa83480722029b96872614816b5c11323d12 | /core_mips_Mips.h | 9b159d9634fb1d4f553d129a86ad9e8975331f44 | [] | no_license | JacquesdeH/BUAA_Compiler2020 | f3fb8581793ee6177ddc8aba037bca2bc5abb92d | c9caa423fc7c9ecc828e37bee47fb5a3d37574ee | refs/heads/master | 2023-02-04T13:18:38.613020 | 2020-12-21T16:03:56 | 2020-12-21T16:03:56 | 306,084,335 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,281 | h | core_mips_Mips.h | //
// Created by JacquesdeH on 2020/11/15.
//
#ifndef PROJECT_CORE_MIPS_MIPS_H
#define PROJECT_CORE_MIPS_MIPS_H
#include <vector>
#include <string>
#include <map>
#include <initializer_list>
#include "core_mips_ObjCodes.h"
#include "utils_inter_typedef.h"
#include "utils_inter_MIR.h"
namespace mips
{
typedef std::map<std::string, mips::SymbolInfo> MipsTable;
class Mips
{
private:
inter::MIR mir;
MipsTable mipsTable; // no reset but update at each proc
BlockRegPool blockRegPool; // reset every block
ProcRegBook procRegBook;
int stackOffset; // reset every proc
int globalOffset; // no reset for $gp use
public:
Mips(const inter::MIR & _mir);
private:
void _resetStackOffset();
void _resetGlobalOffset();
void _resetBlockRegPool();
void _resetProcRegBook();
mips::ObjCodes _alignStack(const std::string & _type);
mips::ObjCodes _alignData(const std::string & _type);
mips::ObjCodes _toReg(std::string & _reg, const std::string &_mark, const bool &_link, const bool &_init,
const std::set<std::string> &_excludedRegs, const std::string &_mustReg);
private:
mips::ObjCodes _compileMain(const inter::Proc & _main);
mips::ObjCodes _compileFuncs(const std::vector<inter::Proc> & funcs);
mips::ObjCodes _compileProc(const inter::Proc & _proc);
mips::ObjCodes _compileBlock(const inter::Block & _block);
mips::ObjCodes _compileQuad(const inter::Quad & _quad);
mips::ObjCodes _compileGlobalStrings(const inter::MapDeclareString & mapGlobalString);
mips::ObjCodes _compileGlobalChars(const inter::MapDeclareChar & mapGlobalChar);
mips::ObjCodes _compileGlobalInts(const inter::MapDeclareInt & mapGlobalInt);
mips::ObjCodes _compileGlobals(const inter::MapDeclareChar & mapGlobalChar,
const inter::MapDeclareInt & mapGlobalInt);
private:
mips::ObjCodes compileDataSegment();
mips::ObjCodes compileTextSegment();
private:
mips::ObjCodes _compileMathOp(const inter::Quad &_quad);
mips::ObjCodes _compileBranchJumpOp(const inter::Quad &_quad);
mips::ObjCodes _compileLoadStoreOp(const inter::Quad &_quad);
mips::ObjCodes _compileLoadOp(const inter::Quad &_quad);
mips::ObjCodes _compileStoreOp(const inter::Quad &_quad);
mips::ObjCodes _compileMoveOp(const inter::Quad &_quad);
mips::ObjCodes _compileReadOp(const inter::Quad &_quad);
mips::ObjCodes _compileWriteOp(const inter::Quad &_quad);
mips::ObjCodes _compileStringOp(const inter::Quad &_quad);
mips::ObjCodes _compilePushOp(const inter::Quad &_quad);
mips::ObjCodes _compileDepushOp(const inter::Quad &_quad);
mips::ObjCodes _compileParaOp(const inter::Quad &_quad);
mips::ObjCodes _compileCallOp(const inter::Quad &_quad);
mips::ObjCodes _compileMoveRetOp(const inter::Quad &_quad);
mips::ObjCodes _compileRetOp(const inter::Quad &_quad);
mips::ObjCodes _compileExitOp(const inter::Quad &_quad);
public:
mips::ObjCodes compile();
};
}
#endif //PROJECT_CORE_MIPS_MIPS_H
|
cef01d39b3b00314c79ba83dcaba58c043ea2e0b | 794e7b157b111fc9fcc396fdf598e22344c6c230 | /Node.h | 535f270beca108abad2a5e7f9f43f23a33929358 | [] | no_license | fonkvan/BST | 51df36b85f019608a7c0e5627250861ec8999233 | 565f2a10b7b2697c79213f3bee83cdc39b2da240 | refs/heads/main | 2023-08-02T02:41:33.808685 | 2021-09-26T19:05:53 | 2021-09-26T19:05:53 | 409,711,337 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 165 | h | Node.h | #pragma once
class Node
{
public:
Node();
Node(int Key, Node* Left, Node* Right, Node* Parent = nullptr);
int Key;
Node* Left;
Node* Right;
Node* Parent;
};
|
81e253cf288ca2557a7395b969e41ebd2890ad1f | 6acb7577385189daf7e2acea8bd2138fd08b7ea1 | /src/Common/gui/chat/ChatTextEditor.cpp | 92271200cf5dde3457eb88ba1f8e243a9e2e372a | [] | no_license | fab672000/JamTaba | c016a731d10fde9bcc656e9e554b079fb7d8f114 | 4bdbe69cfd9bb5a7e5e5842421c9ddf7fba6dc90 | refs/heads/master | 2023-03-16T01:56:03.318215 | 2021-10-30T21:43:13 | 2021-10-31T15:13:48 | 91,271,952 | 1 | 0 | null | 2017-05-14T21:16:23 | 2017-05-14T21:16:23 | null | UTF-8 | C++ | false | false | 1,545 | cpp | ChatTextEditor.cpp | #include "ChatTextEditor.h"
#include <QDebug>
#include <QTextBlock>
#include <QLayout>
#include <QRegularExpression>
ChatTextEditor::ChatTextEditor(QWidget *parent) :
QTextBrowser(parent),
bestWidth(50)
{
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
setReadOnly(true);
setFrameShape(QFrame::NoFrame);
setOpenExternalLinks(true);
viewport()->setAutoFillBackground(false); // transparent
connect(this, &ChatTextEditor::textChanged, this, &ChatTextEditor::updateWidth);
}
void ChatTextEditor::updateWidth()
{
bestWidth = computeBestWidth();
document()->setTextWidth(bestWidth);
updateGeometry();
}
uint ChatTextEditor::getEmojisCount() const
{
const static QRegularExpression REGEX("<img src=\":/emoji/icons");
return document()->toHtml().count(REGEX);
}
quint32 ChatTextEditor::computeBestWidth() const
{
int maxBlockWidth = 0;
auto block = document()->begin();
while (block != document()->end()) {
int w = fontMetrics().width(block.text()) + 30;
w += getEmojisCount() * 22; // add emoji width (22 pixels) because emoji icon is larger than a simple character
if (w > maxBlockWidth)
maxBlockWidth = w;
block = block.next();
}
return qMin(maxBlockWidth, maximumWidth());
}
QSize ChatTextEditor::sizeHint() const
{
return QSize(bestWidth, document()->size().height());
}
QSize ChatTextEditor::minimumSizeHint() const
{
return sizeHint();
}
|
96c28df943173c8909f45dde5012784dcd279d6e | e733459e3365e2a28c736961f0e870d547851bac | /Tsinghua/栈和队列/Queue.cpp | 97cafd859d0a055d71e6a8a542847ae6954830ae | [] | no_license | alexhe101/data-structure-mooc--from-Tsinghua-ZJU | c7717760816dc2e42735b4563016e046e23ca828 | 8ee3b73304446fea656d3fc4bb0ac9074fbd4816 | refs/heads/master | 2020-07-08T20:55:31.026949 | 2019-10-29T14:36:40 | 2019-10-29T14:36:40 | 203,774,767 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 201 | cpp | Queue.cpp | #include"List.h"
template<typename T>class Queue:public List<T>
{
public:
void enqueue(T const&e){insertAsLast(e);}
T dequeue() {return remove(first());}
T &front() {return first()->data;}
};
|
1df31e1825324d3c5e661147f3e3733494156044 | c9c8d3ff1152d5ef700e27769ab19bbe04002c05 | /maths/chocolate.cpp | fb09c013395188129858d340e6a59507c18c3453 | [] | no_license | strikerdpk/Cplusplus | ca1b53e86062cbeeb0f99d3d35a69dd5c4eab7bd | 18240feefc498deedab18cd0f345252075d56eed | refs/heads/master | 2023-07-02T05:37:03.257786 | 2021-08-01T16:46:02 | 2021-08-01T16:46:02 | 389,427,816 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 433 | cpp | chocolate.cpp | #include <iostream>
using namespace std;
int chocolates(int rupee)
{
int rchocolates = 0;
int chocolates = rupee;
int wrappers = chocolates;
while (wrappers >= 3)
{
rchocolates = wrappers / 3;
wrappers = rchocolates + wrappers % 3;
chocolates = rchocolates + chocolates;
}
return chocolates;
}
int main()
{
int rupee;
cin >> rupee;
cout << chocolates(rupee) << " ";
} |
797d10ab78055cc038c8321cbaa47ccaf4213d76 | dd80a584130ef1a0333429ba76c1cee0eb40df73 | /external/libyuv/files/source/row_common.cc | c5f3ce050f5fce13ff6f08390037b50b0dee0c10 | [
"MIT",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | karunmatharu/Android-4.4-Pay-by-Data | 466f4e169ede13c5835424c78e8c30ce58f885c1 | fcb778e92d4aad525ef7a995660580f948d40bc9 | refs/heads/master | 2021-03-24T13:33:01.721868 | 2017-02-18T17:48:49 | 2017-02-18T17:48:49 | 81,847,777 | 0 | 2 | MIT | 2020-03-09T00:02:12 | 2017-02-13T16:47:00 | null | UTF-8 | C++ | false | false | 43,289 | cc | row_common.cc | /*
* Copyright 2011 The LibYuv Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "libyuv/row.h"
#include <string.h> // For memcpy
#include "libyuv/basic_types.h"
#ifdef __cplusplus
namespace libyuv {
extern "C" {
#endif
void BGRAToARGBRow_C(const uint8* src_bgra, uint8* dst_argb, int width) {
for (int x = 0; x < width; ++x) {
// To support in-place conversion.
uint8 a = src_bgra[0];
uint8 r = src_bgra[1];
uint8 g = src_bgra[2];
uint8 b = src_bgra[3];
dst_argb[0] = b;
dst_argb[1] = g;
dst_argb[2] = r;
dst_argb[3] = a;
dst_argb += 4;
src_bgra += 4;
}
}
void ABGRToARGBRow_C(const uint8* src_abgr, uint8* dst_argb, int width) {
for (int x = 0; x < width; ++x) {
// To support in-place conversion.
uint8 r = src_abgr[0];
uint8 g = src_abgr[1];
uint8 b = src_abgr[2];
uint8 a = src_abgr[3];
dst_argb[0] = b;
dst_argb[1] = g;
dst_argb[2] = r;
dst_argb[3] = a;
dst_argb += 4;
src_abgr += 4;
}
}
void RGBAToARGBRow_C(const uint8* src_abgr, uint8* dst_argb, int width) {
for (int x = 0; x < width; ++x) {
// To support in-place conversion.
uint8 a = src_abgr[0];
uint8 b = src_abgr[1];
uint8 g = src_abgr[2];
uint8 r = src_abgr[3];
dst_argb[0] = b;
dst_argb[1] = g;
dst_argb[2] = r;
dst_argb[3] = a;
dst_argb += 4;
src_abgr += 4;
}
}
void RGB24ToARGBRow_C(const uint8* src_rgb24, uint8* dst_argb, int width) {
for (int x = 0; x < width; ++x) {
uint8 b = src_rgb24[0];
uint8 g = src_rgb24[1];
uint8 r = src_rgb24[2];
dst_argb[0] = b;
dst_argb[1] = g;
dst_argb[2] = r;
dst_argb[3] = 255u;
dst_argb += 4;
src_rgb24 += 3;
}
}
void RAWToARGBRow_C(const uint8* src_raw, uint8* dst_argb, int width) {
for (int x = 0; x < width; ++x) {
uint8 r = src_raw[0];
uint8 g = src_raw[1];
uint8 b = src_raw[2];
dst_argb[0] = b;
dst_argb[1] = g;
dst_argb[2] = r;
dst_argb[3] = 255u;
dst_argb += 4;
src_raw += 3;
}
}
void RGB565ToARGBRow_C(const uint8* src_rgb, uint8* dst_argb, int width) {
for (int x = 0; x < width; ++x) {
uint8 b = src_rgb[0] & 0x1f;
uint8 g = (src_rgb[0] >> 5) | ((src_rgb[1] & 0x07) << 3);
uint8 r = src_rgb[1] >> 3;
dst_argb[0] = (b << 3) | (b >> 2);
dst_argb[1] = (g << 2) | (g >> 4);
dst_argb[2] = (r << 3) | (r >> 2);
dst_argb[3] = 255u;
dst_argb += 4;
src_rgb += 2;
}
}
void ARGB1555ToARGBRow_C(const uint8* src_rgb, uint8* dst_argb, int width) {
for (int x = 0; x < width; ++x) {
uint8 b = src_rgb[0] & 0x1f;
uint8 g = (src_rgb[0] >> 5) | ((src_rgb[1] & 0x03) << 3);
uint8 r = (src_rgb[1] & 0x7c) >> 2;
uint8 a = src_rgb[1] >> 7;
dst_argb[0] = (b << 3) | (b >> 2);
dst_argb[1] = (g << 3) | (g >> 2);
dst_argb[2] = (r << 3) | (r >> 2);
dst_argb[3] = -a;
dst_argb += 4;
src_rgb += 2;
}
}
void ARGB4444ToARGBRow_C(const uint8* src_rgb, uint8* dst_argb, int width) {
for (int x = 0; x < width; ++x) {
uint8 b = src_rgb[0] & 0x0f;
uint8 g = src_rgb[0] >> 4;
uint8 r = src_rgb[1] & 0x0f;
uint8 a = src_rgb[1] >> 4;
dst_argb[0] = (b << 4) | b;
dst_argb[1] = (g << 4) | g;
dst_argb[2] = (r << 4) | r;
dst_argb[3] = (a << 4) | a;
dst_argb += 4;
src_rgb += 2;
}
}
void ARGBToRGBARow_C(const uint8* src_argb, uint8* dst_rgb, int width) {
for (int x = 0; x < width; ++x) {
uint8 b = src_argb[0];
uint8 g = src_argb[1];
uint8 r = src_argb[2];
uint8 a = src_argb[3];
dst_rgb[0] = a;
dst_rgb[1] = b;
dst_rgb[2] = g;
dst_rgb[3] = r;
dst_rgb += 4;
src_argb += 4;
}
}
void ARGBToRGB24Row_C(const uint8* src_argb, uint8* dst_rgb, int width) {
for (int x = 0; x < width; ++x) {
uint8 b = src_argb[0];
uint8 g = src_argb[1];
uint8 r = src_argb[2];
dst_rgb[0] = b;
dst_rgb[1] = g;
dst_rgb[2] = r;
dst_rgb += 3;
src_argb += 4;
}
}
void ARGBToRAWRow_C(const uint8* src_argb, uint8* dst_rgb, int width) {
for (int x = 0; x < width; ++x) {
uint8 b = src_argb[0];
uint8 g = src_argb[1];
uint8 r = src_argb[2];
dst_rgb[0] = r;
dst_rgb[1] = g;
dst_rgb[2] = b;
dst_rgb += 3;
src_argb += 4;
}
}
// TODO(fbarchard): support big endian CPU
void ARGBToRGB565Row_C(const uint8* src_argb, uint8* dst_rgb, int width) {
for (int x = 0; x < width - 1; x += 2) {
uint8 b0 = src_argb[0] >> 3;
uint8 g0 = src_argb[1] >> 2;
uint8 r0 = src_argb[2] >> 3;
uint8 b1 = src_argb[4] >> 3;
uint8 g1 = src_argb[5] >> 2;
uint8 r1 = src_argb[6] >> 3;
*reinterpret_cast<uint32*>(dst_rgb) = b0 | (g0 << 5) | (r0 << 11) |
(b1 << 16) | (g1 << 21) | (r1 << 27);
dst_rgb += 4;
src_argb += 8;
}
if (width & 1) {
uint8 b0 = src_argb[0] >> 3;
uint8 g0 = src_argb[1] >> 2;
uint8 r0 = src_argb[2] >> 3;
*reinterpret_cast<uint16*>(dst_rgb) = b0 | (g0 << 5) | (r0 << 11);
}
}
void ARGBToARGB1555Row_C(const uint8* src_argb, uint8* dst_rgb, int width) {
for (int x = 0; x < width - 1; x += 2) {
uint8 b0 = src_argb[0] >> 3;
uint8 g0 = src_argb[1] >> 3;
uint8 r0 = src_argb[2] >> 3;
uint8 a0 = src_argb[3] >> 7;
uint8 b1 = src_argb[4] >> 3;
uint8 g1 = src_argb[5] >> 3;
uint8 r1 = src_argb[6] >> 3;
uint8 a1 = src_argb[7] >> 7;
*reinterpret_cast<uint32*>(dst_rgb) =
b0 | (g0 << 5) | (r0 << 10) | (a0 << 15) |
(b1 << 16) | (g1 << 21) | (r1 << 26) | (a1 << 31);
dst_rgb += 4;
src_argb += 8;
}
if (width & 1) {
uint8 b0 = src_argb[0] >> 3;
uint8 g0 = src_argb[1] >> 3;
uint8 r0 = src_argb[2] >> 3;
uint8 a0 = src_argb[3] >> 7;
*reinterpret_cast<uint16*>(dst_rgb) =
b0 | (g0 << 5) | (r0 << 10) | (a0 << 15);
}
}
void ARGBToARGB4444Row_C(const uint8* src_argb, uint8* dst_rgb, int width) {
for (int x = 0; x < width - 1; x += 2) {
uint8 b0 = src_argb[0] >> 4;
uint8 g0 = src_argb[1] >> 4;
uint8 r0 = src_argb[2] >> 4;
uint8 a0 = src_argb[3] >> 4;
uint8 b1 = src_argb[4] >> 4;
uint8 g1 = src_argb[5] >> 4;
uint8 r1 = src_argb[6] >> 4;
uint8 a1 = src_argb[7] >> 4;
*reinterpret_cast<uint32*>(dst_rgb) =
b0 | (g0 << 4) | (r0 << 8) | (a0 << 12) |
(b1 << 16) | (g1 << 20) | (r1 << 24) | (a1 << 28);
dst_rgb += 4;
src_argb += 8;
}
if (width & 1) {
uint8 b0 = src_argb[0] >> 4;
uint8 g0 = src_argb[1] >> 4;
uint8 r0 = src_argb[2] >> 4;
uint8 a0 = src_argb[3] >> 4;
*reinterpret_cast<uint16*>(dst_rgb) =
b0 | (g0 << 4) | (r0 << 8) | (a0 << 12);
}
}
static __inline int RGBToY(uint8 r, uint8 g, uint8 b) {
return (( 66 * r + 129 * g + 25 * b + 128) >> 8) + 16;
}
static __inline int RGBToU(uint8 r, uint8 g, uint8 b) {
return ((-38 * r - 74 * g + 112 * b + 128) >> 8) + 128;
}
static __inline int RGBToV(uint8 r, uint8 g, uint8 b) {
return ((112 * r - 94 * g - 18 * b + 128) >> 8) + 128;
}
#define MAKEROWY(NAME, R, G, B) \
void NAME ## ToYRow_C(const uint8* src_argb0, uint8* dst_y, int width) { \
for (int x = 0; x < width; ++x) { \
dst_y[0] = RGBToY(src_argb0[R], src_argb0[G], src_argb0[B]); \
src_argb0 += 4; \
dst_y += 1; \
} \
} \
void NAME ## ToUVRow_C(const uint8* src_rgb0, int src_stride_rgb, \
uint8* dst_u, uint8* dst_v, int width) { \
const uint8* src_rgb1 = src_rgb0 + src_stride_rgb; \
for (int x = 0; x < width - 1; x += 2) { \
uint8 ab = (src_rgb0[B] + src_rgb0[B + 4] + \
src_rgb1[B] + src_rgb1[B + 4]) >> 2; \
uint8 ag = (src_rgb0[G] + src_rgb0[G + 4] + \
src_rgb1[G] + src_rgb1[G + 4]) >> 2; \
uint8 ar = (src_rgb0[R] + src_rgb0[R + 4] + \
src_rgb1[R] + src_rgb1[R + 4]) >> 2; \
dst_u[0] = RGBToU(ar, ag, ab); \
dst_v[0] = RGBToV(ar, ag, ab); \
src_rgb0 += 8; \
src_rgb1 += 8; \
dst_u += 1; \
dst_v += 1; \
} \
if (width & 1) { \
uint8 ab = (src_rgb0[B] + src_rgb1[B]) >> 1; \
uint8 ag = (src_rgb0[G] + src_rgb1[G]) >> 1; \
uint8 ar = (src_rgb0[R] + src_rgb1[R]) >> 1; \
dst_u[0] = RGBToU(ar, ag, ab); \
dst_v[0] = RGBToV(ar, ag, ab); \
} \
}
MAKEROWY(ARGB, 2, 1, 0)
MAKEROWY(BGRA, 1, 2, 3)
MAKEROWY(ABGR, 0, 1, 2)
MAKEROWY(RGBA, 3, 2, 1)
// http://en.wikipedia.org/wiki/Grayscale.
// 0.11 * B + 0.59 * G + 0.30 * R
// Coefficients rounded to multiple of 2 for consistency with SSSE3 version.
static __inline int RGBToGray(uint8 r, uint8 g, uint8 b) {
return (( 76 * r + 152 * g + 28 * b) >> 8);
}
void ARGBGrayRow_C(const uint8* src_argb, uint8* dst_argb, int width) {
for (int x = 0; x < width; ++x) {
uint8 y = RGBToGray(src_argb[2], src_argb[1], src_argb[0]);
dst_argb[2] = dst_argb[1] = dst_argb[0] = y;
dst_argb[3] = src_argb[3];
dst_argb += 4;
src_argb += 4;
}
}
// Convert a row of image to Sepia tone.
void ARGBSepiaRow_C(uint8* dst_argb, int width) {
for (int x = 0; x < width; ++x) {
int b = dst_argb[0];
int g = dst_argb[1];
int r = dst_argb[2];
int sb = (b * 17 + g * 68 + r * 35) >> 7;
int sg = (b * 22 + g * 88 + r * 45) >> 7;
int sr = (b * 24 + g * 98 + r * 50) >> 7;
// b does not over flow. a is preserved from original.
if (sg > 255) {
sg = 255;
}
if (sr > 255) {
sr = 255;
}
dst_argb[0] = sb;
dst_argb[1] = sg;
dst_argb[2] = sr;
dst_argb += 4;
}
}
// Apply color matrix to a row of image. Matrix is signed.
void ARGBColorMatrixRow_C(uint8* dst_argb, const int8* matrix_argb, int width) {
for (int x = 0; x < width; ++x) {
int b = dst_argb[0];
int g = dst_argb[1];
int r = dst_argb[2];
int a = dst_argb[3];
int sb = (b * matrix_argb[0] + g * matrix_argb[1] +
r * matrix_argb[2] + a * matrix_argb[3]) >> 7;
int sg = (b * matrix_argb[4] + g * matrix_argb[5] +
r * matrix_argb[6] + a * matrix_argb[7]) >> 7;
int sr = (b * matrix_argb[8] + g * matrix_argb[9] +
r * matrix_argb[10] + a * matrix_argb[11]) >> 7;
if (sb < 0) {
sb = 0;
}
if (sb > 255) {
sb = 255;
}
if (sg < 0) {
sg = 0;
}
if (sg > 255) {
sg = 255;
}
if (sr < 0) {
sr = 0;
}
if (sr > 255) {
sr = 255;
}
dst_argb[0] = sb;
dst_argb[1] = sg;
dst_argb[2] = sr;
dst_argb += 4;
}
}
// Apply color table to a row of image.
void ARGBColorTableRow_C(uint8* dst_argb, const uint8* table_argb, int width) {
for (int x = 0; x < width; ++x) {
int b = dst_argb[0];
int g = dst_argb[1];
int r = dst_argb[2];
int a = dst_argb[3];
dst_argb[0] = table_argb[b * 4 + 0];
dst_argb[1] = table_argb[g * 4 + 1];
dst_argb[2] = table_argb[r * 4 + 2];
dst_argb[3] = table_argb[a * 4 + 3];
dst_argb += 4;
}
}
void ARGBQuantizeRow_C(uint8* dst_argb, int scale, int interval_size,
int interval_offset, int width) {
for (int x = 0; x < width; ++x) {
int b = dst_argb[0];
int g = dst_argb[1];
int r = dst_argb[2];
dst_argb[0] = (b * scale >> 16) * interval_size + interval_offset;
dst_argb[1] = (g * scale >> 16) * interval_size + interval_offset;
dst_argb[2] = (r * scale >> 16) * interval_size + interval_offset;
dst_argb += 4;
}
}
void I400ToARGBRow_C(const uint8* src_y, uint8* dst_argb, int width) {
// Copy a Y to RGB.
for (int x = 0; x < width; ++x) {
uint8 y = src_y[0];
dst_argb[2] = dst_argb[1] = dst_argb[0] = y;
dst_argb[3] = 255u;
dst_argb += 4;
++src_y;
}
}
// C reference code that mimics the YUV assembly.
#define YG 74 /* static_cast<int8>(1.164 * 64 + 0.5) */
#define UB 127 /* min(63,static_cast<int8>(2.018 * 64)) */
#define UG -25 /* static_cast<int8>(-0.391 * 64 - 0.5) */
#define UR 0
#define VB 0
#define VG -52 /* static_cast<int8>(-0.813 * 64 - 0.5) */
#define VR 102 /* static_cast<int8>(1.596 * 64 + 0.5) */
// Bias
#define BB UB * 128 + VB * 128
#define BG UG * 128 + VG * 128
#define BR UR * 128 + VR * 128
static __inline uint32 Clip(int32 val) {
if (val < 0) {
return static_cast<uint32>(0);
} else if (val > 255) {
return static_cast<uint32>(255);
}
return static_cast<uint32>(val);
}
static __inline void YuvPixel(uint8 y, uint8 u, uint8 v, uint8* rgb_buf,
int ashift, int rshift, int gshift, int bshift) {
int32 y1 = (static_cast<int32>(y) - 16) * YG;
uint32 b = Clip(static_cast<int32>((u * UB + v * VB) - (BB) + y1) >> 6);
uint32 g = Clip(static_cast<int32>((u * UG + v * VG) - (BG) + y1) >> 6);
uint32 r = Clip(static_cast<int32>((u * UR + v * VR) - (BR) + y1) >> 6);
*reinterpret_cast<uint32*>(rgb_buf) = (b << bshift) |
(g << gshift) |
(r << rshift) |
(255u << ashift);
}
static __inline void YuvPixel2(uint8 y, uint8 u, uint8 v,
uint8* b, uint8* g, uint8* r) {
int32 y1 = (static_cast<int32>(y) - 16) * YG;
*b = Clip(static_cast<int32>((u * UB + v * VB) - (BB) + y1) >> 6);
*g = Clip(static_cast<int32>((u * UG + v * VG) - (BG) + y1) >> 6);
*r = Clip(static_cast<int32>((u * UR + v * VR) - (BR) + y1) >> 6);
}
void I444ToARGBRow_C(const uint8* y_buf,
const uint8* u_buf,
const uint8* v_buf,
uint8* rgb_buf,
int width) {
for (int x = 0; x < width; ++x) {
YuvPixel(y_buf[0], u_buf[0], v_buf[0], rgb_buf, 24, 16, 8, 0);
y_buf += 1;
u_buf += 1;
v_buf += 1;
rgb_buf += 4; // Advance 1 pixel.
}
}
// Also used for 420
void I422ToARGBRow_C(const uint8* y_buf,
const uint8* u_buf,
const uint8* v_buf,
uint8* rgb_buf,
int width) {
for (int x = 0; x < width - 1; x += 2) {
YuvPixel(y_buf[0], u_buf[0], v_buf[0], rgb_buf + 0, 24, 16, 8, 0);
YuvPixel(y_buf[1], u_buf[0], v_buf[0], rgb_buf + 4, 24, 16, 8, 0);
y_buf += 2;
u_buf += 1;
v_buf += 1;
rgb_buf += 8; // Advance 2 pixels.
}
if (width & 1) {
YuvPixel(y_buf[0], u_buf[0], v_buf[0], rgb_buf + 0, 24, 16, 8, 0);
}
}
void I422ToRGB24Row_C(const uint8* y_buf,
const uint8* u_buf,
const uint8* v_buf,
uint8* rgb_buf,
int width) {
for (int x = 0; x < width - 1; x += 2) {
YuvPixel2(y_buf[0], u_buf[0], v_buf[0],
rgb_buf + 0, rgb_buf + 1, rgb_buf + 2);
YuvPixel2(y_buf[1], u_buf[0], v_buf[0],
rgb_buf + 3, rgb_buf + 4, rgb_buf + 5);
y_buf += 2;
u_buf += 1;
v_buf += 1;
rgb_buf += 6; // Advance 2 pixels.
}
if (width & 1) {
YuvPixel2(y_buf[0], u_buf[0], v_buf[0],
rgb_buf + 0, rgb_buf + 1, rgb_buf + 2);
}
}
void I422ToRAWRow_C(const uint8* y_buf,
const uint8* u_buf,
const uint8* v_buf,
uint8* rgb_buf,
int width) {
for (int x = 0; x < width - 1; x += 2) {
YuvPixel2(y_buf[0], u_buf[0], v_buf[0],
rgb_buf + 2, rgb_buf + 1, rgb_buf + 0);
YuvPixel2(y_buf[1], u_buf[0], v_buf[0],
rgb_buf + 5, rgb_buf + 4, rgb_buf + 3);
y_buf += 2;
u_buf += 1;
v_buf += 1;
rgb_buf += 6; // Advance 2 pixels.
}
if (width & 1) {
YuvPixel2(y_buf[0], u_buf[0], v_buf[0],
rgb_buf + 0, rgb_buf + 1, rgb_buf + 2);
}
}
void I411ToARGBRow_C(const uint8* y_buf,
const uint8* u_buf,
const uint8* v_buf,
uint8* rgb_buf,
int width) {
for (int x = 0; x < width - 3; x += 4) {
YuvPixel(y_buf[0], u_buf[0], v_buf[0], rgb_buf + 0, 24, 16, 8, 0);
YuvPixel(y_buf[1], u_buf[0], v_buf[0], rgb_buf + 4, 24, 16, 8, 0);
YuvPixel(y_buf[2], u_buf[0], v_buf[0], rgb_buf + 8, 24, 16, 8, 0);
YuvPixel(y_buf[3], u_buf[0], v_buf[0], rgb_buf + 12, 24, 16, 8, 0);
y_buf += 4;
u_buf += 1;
v_buf += 1;
rgb_buf += 16; // Advance 4 pixels.
}
if (width & 2) {
YuvPixel(y_buf[0], u_buf[0], v_buf[0], rgb_buf + 0, 24, 16, 8, 0);
YuvPixel(y_buf[1], u_buf[0], v_buf[0], rgb_buf + 4, 24, 16, 8, 0);
y_buf += 2;
rgb_buf += 8; // Advance 2 pixels.
}
if (width & 1) {
YuvPixel(y_buf[0], u_buf[0], v_buf[0], rgb_buf + 0, 24, 16, 8, 0);
}
}
void NV12ToARGBRow_C(const uint8* y_buf,
const uint8* uv_buf,
uint8* rgb_buf,
int width) {
for (int x = 0; x < width - 1; x += 2) {
YuvPixel(y_buf[0], uv_buf[0], uv_buf[1], rgb_buf + 0, 24, 16, 8, 0);
YuvPixel(y_buf[1], uv_buf[0], uv_buf[1], rgb_buf + 4, 24, 16, 8, 0);
y_buf += 2;
uv_buf += 2;
rgb_buf += 8; // Advance 2 pixels.
}
if (width & 1) {
YuvPixel(y_buf[0], uv_buf[0], uv_buf[1], rgb_buf + 0, 24, 16, 8, 0);
}
}
void NV21ToARGBRow_C(const uint8* y_buf,
const uint8* vu_buf,
uint8* rgb_buf,
int width) {
for (int x = 0; x < width - 1; x += 2) {
YuvPixel(y_buf[0], vu_buf[1], vu_buf[0], rgb_buf + 0, 24, 16, 8, 0);
YuvPixel(y_buf[1], vu_buf[1], vu_buf[0], rgb_buf + 4, 24, 16, 8, 0);
y_buf += 2;
vu_buf += 2;
rgb_buf += 8; // Advance 2 pixels.
}
if (width & 1) {
YuvPixel(y_buf[0], vu_buf[1], vu_buf[0], rgb_buf + 0, 24, 16, 8, 0);
}
}
void I422ToBGRARow_C(const uint8* y_buf,
const uint8* u_buf,
const uint8* v_buf,
uint8* rgb_buf,
int width) {
for (int x = 0; x < width - 1; x += 2) {
YuvPixel(y_buf[0], u_buf[0], v_buf[0], rgb_buf + 0, 0, 8, 16, 24);
YuvPixel(y_buf[1], u_buf[0], v_buf[0], rgb_buf + 4, 0, 8, 16, 24);
y_buf += 2;
u_buf += 1;
v_buf += 1;
rgb_buf += 8; // Advance 2 pixels.
}
if (width & 1) {
YuvPixel(y_buf[0], u_buf[0], v_buf[0], rgb_buf, 0, 8, 16, 24);
}
}
void I422ToABGRRow_C(const uint8* y_buf,
const uint8* u_buf,
const uint8* v_buf,
uint8* rgb_buf,
int width) {
for (int x = 0; x < width - 1; x += 2) {
YuvPixel(y_buf[0], u_buf[0], v_buf[0], rgb_buf + 0, 24, 0, 8, 16);
YuvPixel(y_buf[1], u_buf[0], v_buf[0], rgb_buf + 4, 24, 0, 8, 16);
y_buf += 2;
u_buf += 1;
v_buf += 1;
rgb_buf += 8; // Advance 2 pixels.
}
if (width & 1) {
YuvPixel(y_buf[0], u_buf[0], v_buf[0], rgb_buf + 0, 24, 0, 8, 16);
}
}
void I422ToRGBARow_C(const uint8* y_buf,
const uint8* u_buf,
const uint8* v_buf,
uint8* rgb_buf,
int width) {
for (int x = 0; x < width - 1; x += 2) {
YuvPixel(y_buf[0], u_buf[0], v_buf[0], rgb_buf + 0, 0, 24, 16, 8);
YuvPixel(y_buf[1], u_buf[0], v_buf[0], rgb_buf + 4, 0, 24, 16, 8);
y_buf += 2;
u_buf += 1;
v_buf += 1;
rgb_buf += 8; // Advance 2 pixels.
}
if (width & 1) {
YuvPixel(y_buf[0], u_buf[0], v_buf[0], rgb_buf + 0, 0, 24, 16, 8);
}
}
void YToARGBRow_C(const uint8* y_buf, uint8* rgb_buf, int width) {
for (int x = 0; x < width; ++x) {
YuvPixel(y_buf[0], 128, 128, rgb_buf, 24, 16, 8, 0);
y_buf += 1;
rgb_buf += 4; // Advance 1 pixel.
}
}
void MirrorRow_C(const uint8* src, uint8* dst, int width) {
src += width - 1;
for (int x = 0; x < width - 1; x += 2) {
dst[x] = src[0];
dst[x + 1] = src[-1];
src -= 2;
}
if (width & 1) {
dst[width - 1] = src[0];
}
}
void MirrorRowUV_C(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int width) {
src_uv += (width - 1) << 1;
for (int x = 0; x < width - 1; x += 2) {
dst_u[x] = src_uv[0];
dst_u[x + 1] = src_uv[-2];
dst_v[x] = src_uv[1];
dst_v[x + 1] = src_uv[-2 + 1];
src_uv -= 4;
}
if (width & 1) {
dst_u[width - 1] = src_uv[0];
dst_v[width - 1] = src_uv[1];
}
}
void ARGBMirrorRow_C(const uint8* src, uint8* dst, int width) {
const uint32* src32 = reinterpret_cast<const uint32*>(src);
uint32* dst32 = reinterpret_cast<uint32*>(dst);
src32 += width - 1;
for (int x = 0; x < width - 1; x += 2) {
dst32[x] = src32[0];
dst32[x + 1] = src32[-1];
src32 -= 2;
}
if (width & 1) {
dst32[width - 1] = src32[0];
}
}
void SplitUV_C(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int width) {
for (int x = 0; x < width - 1; x += 2) {
dst_u[x] = src_uv[0];
dst_u[x + 1] = src_uv[2];
dst_v[x] = src_uv[1];
dst_v[x + 1] = src_uv[3];
src_uv += 4;
}
if (width & 1) {
dst_u[width - 1] = src_uv[0];
dst_v[width - 1] = src_uv[1];
}
}
void CopyRow_C(const uint8* src, uint8* dst, int count) {
memcpy(dst, src, count);
}
void SetRow8_C(uint8* dst, uint32 v8, int count) {
#ifdef _MSC_VER
// VC will generate rep stosb.
for (int x = 0; x < count; ++x) {
dst[x] = v8;
}
#else
memset(dst, v8, count);
#endif
}
void SetRows32_C(uint8* dst, uint32 v32, int width,
int dst_stride, int height) {
for (int y = 0; y < height; ++y) {
uint32* d = reinterpret_cast<uint32*>(dst);
for (int x = 0; x < width; ++x) {
d[x] = v32;
}
dst += dst_stride;
}
}
// Filter 2 rows of YUY2 UV's (422) into U and V (420).
void YUY2ToUVRow_C(const uint8* src_yuy2, int src_stride_yuy2,
uint8* dst_u, uint8* dst_v, int width) {
// Output a row of UV values, filtering 2 rows of YUY2.
for (int x = 0; x < width; x += 2) {
dst_u[0] = (src_yuy2[1] + src_yuy2[src_stride_yuy2 + 1] + 1) >> 1;
dst_v[0] = (src_yuy2[3] + src_yuy2[src_stride_yuy2 + 3] + 1) >> 1;
src_yuy2 += 4;
dst_u += 1;
dst_v += 1;
}
}
// Copy row of YUY2 UV's (422) into U and V (422).
void YUY2ToUV422Row_C(const uint8* src_yuy2,
uint8* dst_u, uint8* dst_v, int width) {
// Output a row of UV values.
for (int x = 0; x < width; x += 2) {
dst_u[0] = src_yuy2[1];
dst_v[0] = src_yuy2[3];
src_yuy2 += 4;
dst_u += 1;
dst_v += 1;
}
}
// Copy row of YUY2 Y's (422) into Y (420/422).
void YUY2ToYRow_C(const uint8* src_yuy2, uint8* dst_y, int width) {
// Output a row of Y values.
for (int x = 0; x < width - 1; x += 2) {
dst_y[x] = src_yuy2[0];
dst_y[x + 1] = src_yuy2[2];
src_yuy2 += 4;
}
if (width & 1) {
dst_y[width - 1] = src_yuy2[0];
}
}
// Filter 2 rows of UYVY UV's (422) into U and V (420).
void UYVYToUVRow_C(const uint8* src_uyvy, int src_stride_uyvy,
uint8* dst_u, uint8* dst_v, int width) {
// Output a row of UV values.
for (int x = 0; x < width; x += 2) {
dst_u[0] = (src_uyvy[0] + src_uyvy[src_stride_uyvy + 0] + 1) >> 1;
dst_v[0] = (src_uyvy[2] + src_uyvy[src_stride_uyvy + 2] + 1) >> 1;
src_uyvy += 4;
dst_u += 1;
dst_v += 1;
}
}
// Copy row of UYVY UV's (422) into U and V (422).
void UYVYToUV422Row_C(const uint8* src_uyvy,
uint8* dst_u, uint8* dst_v, int width) {
// Output a row of UV values.
for (int x = 0; x < width; x += 2) {
dst_u[0] = src_uyvy[0];
dst_v[0] = src_uyvy[2];
src_uyvy += 4;
dst_u += 1;
dst_v += 1;
}
}
// Copy row of UYVY Y's (422) into Y (420/422).
void UYVYToYRow_C(const uint8* src_uyvy, uint8* dst_y, int width) {
// Output a row of Y values.
for (int x = 0; x < width - 1; x += 2) {
dst_y[x] = src_uyvy[1];
dst_y[x + 1] = src_uyvy[3];
src_uyvy += 4;
}
if (width & 1) {
dst_y[width - 1] = src_uyvy[1];
}
}
#define BLEND(f, b, a) (((256 - a) * b) >> 8) + f
// Blend src_argb0 over src_argb1 and store to dst_argb.
// dst_argb may be src_argb0 or src_argb1.
// This code mimics the SSSE3 version for better testability.
void ARGBBlendRow_C(const uint8* src_argb0, const uint8* src_argb1,
uint8* dst_argb, int width) {
for (int x = 0; x < width - 1; x += 2) {
uint32 fb = src_argb0[0];
uint32 fg = src_argb0[1];
uint32 fr = src_argb0[2];
uint32 a = src_argb0[3];
uint32 bb = src_argb1[0];
uint32 bg = src_argb1[1];
uint32 br = src_argb1[2];
dst_argb[0] = BLEND(fb, bb, a);
dst_argb[1] = BLEND(fg, bg, a);
dst_argb[2] = BLEND(fr, br, a);
dst_argb[3] = 255u;
fb = src_argb0[4 + 0];
fg = src_argb0[4 + 1];
fr = src_argb0[4 + 2];
a = src_argb0[4 + 3];
bb = src_argb1[4 + 0];
bg = src_argb1[4 + 1];
br = src_argb1[4 + 2];
dst_argb[4 + 0] = BLEND(fb, bb, a);
dst_argb[4 + 1] = BLEND(fg, bg, a);
dst_argb[4 + 2] = BLEND(fr, br, a);
dst_argb[4 + 3] = 255u;
src_argb0 += 8;
src_argb1 += 8;
dst_argb += 8;
}
if (width & 1) {
uint32 fb = src_argb0[0];
uint32 fg = src_argb0[1];
uint32 fr = src_argb0[2];
uint32 a = src_argb0[3];
uint32 bb = src_argb1[0];
uint32 bg = src_argb1[1];
uint32 br = src_argb1[2];
dst_argb[0] = BLEND(fb, bb, a);
dst_argb[1] = BLEND(fg, bg, a);
dst_argb[2] = BLEND(fr, br, a);
dst_argb[3] = 255u;
}
}
#undef BLEND
#define ATTENUATE(f, a) (a | (a << 8)) * (f | (f << 8)) >> 24
// Multiply source RGB by alpha and store to destination.
// This code mimics the SSSE3 version for better testability.
void ARGBAttenuateRow_C(const uint8* src_argb, uint8* dst_argb, int width) {
for (int i = 0; i < width - 1; i += 2) {
uint32 b = src_argb[0];
uint32 g = src_argb[1];
uint32 r = src_argb[2];
uint32 a = src_argb[3];
dst_argb[0] = ATTENUATE(b, a);
dst_argb[1] = ATTENUATE(g, a);
dst_argb[2] = ATTENUATE(r, a);
dst_argb[3] = a;
b = src_argb[4];
g = src_argb[5];
r = src_argb[6];
a = src_argb[7];
dst_argb[4] = ATTENUATE(b, a);
dst_argb[5] = ATTENUATE(g, a);
dst_argb[6] = ATTENUATE(r, a);
dst_argb[7] = a;
src_argb += 8;
dst_argb += 8;
}
if (width & 1) {
const uint32 b = src_argb[0];
const uint32 g = src_argb[1];
const uint32 r = src_argb[2];
const uint32 a = src_argb[3];
dst_argb[0] = ATTENUATE(b, a);
dst_argb[1] = ATTENUATE(g, a);
dst_argb[2] = ATTENUATE(r, a);
dst_argb[3] = a;
}
}
#undef ATTENUATE
// Divide source RGB by alpha and store to destination.
// b = (b * 255 + (a / 2)) / a;
// g = (g * 255 + (a / 2)) / a;
// r = (r * 255 + (a / 2)) / a;
// Reciprocal method is off by 1 on some values. ie 125
// 8.16 fixed point inverse table
#define T(a) 0x10000 / a
uint32 fixed_invtbl8[256] = {
0x0100, T(0x01), T(0x02), T(0x03), T(0x04), T(0x05), T(0x06), T(0x07),
T(0x08), T(0x09), T(0x0a), T(0x0b), T(0x0c), T(0x0d), T(0x0e), T(0x0f),
T(0x10), T(0x11), T(0x12), T(0x13), T(0x14), T(0x15), T(0x16), T(0x17),
T(0x18), T(0x19), T(0x1a), T(0x1b), T(0x1c), T(0x1d), T(0x1e), T(0x1f),
T(0x20), T(0x21), T(0x22), T(0x23), T(0x24), T(0x25), T(0x26), T(0x27),
T(0x28), T(0x29), T(0x2a), T(0x2b), T(0x2c), T(0x2d), T(0x2e), T(0x2f),
T(0x30), T(0x31), T(0x32), T(0x33), T(0x34), T(0x35), T(0x36), T(0x37),
T(0x38), T(0x39), T(0x3a), T(0x3b), T(0x3c), T(0x3d), T(0x3e), T(0x3f),
T(0x40), T(0x41), T(0x42), T(0x43), T(0x44), T(0x45), T(0x46), T(0x47),
T(0x48), T(0x49), T(0x4a), T(0x4b), T(0x4c), T(0x4d), T(0x4e), T(0x4f),
T(0x50), T(0x51), T(0x52), T(0x53), T(0x54), T(0x55), T(0x56), T(0x57),
T(0x58), T(0x59), T(0x5a), T(0x5b), T(0x5c), T(0x5d), T(0x5e), T(0x5f),
T(0x60), T(0x61), T(0x62), T(0x63), T(0x64), T(0x65), T(0x66), T(0x67),
T(0x68), T(0x69), T(0x6a), T(0x6b), T(0x6c), T(0x6d), T(0x6e), T(0x6f),
T(0x70), T(0x71), T(0x72), T(0x73), T(0x74), T(0x75), T(0x76), T(0x77),
T(0x78), T(0x79), T(0x7a), T(0x7b), T(0x7c), T(0x7d), T(0x7e), T(0x7f),
T(0x80), T(0x81), T(0x82), T(0x83), T(0x84), T(0x85), T(0x86), T(0x87),
T(0x88), T(0x89), T(0x8a), T(0x8b), T(0x8c), T(0x8d), T(0x8e), T(0x8f),
T(0x90), T(0x91), T(0x92), T(0x93), T(0x94), T(0x95), T(0x96), T(0x97),
T(0x98), T(0x99), T(0x9a), T(0x9b), T(0x9c), T(0x9d), T(0x9e), T(0x9f),
T(0xa0), T(0xa1), T(0xa2), T(0xa3), T(0xa4), T(0xa5), T(0xa6), T(0xa7),
T(0xa8), T(0xa9), T(0xaa), T(0xab), T(0xac), T(0xad), T(0xae), T(0xaf),
T(0xb0), T(0xb1), T(0xb2), T(0xb3), T(0xb4), T(0xb5), T(0xb6), T(0xb7),
T(0xb8), T(0xb9), T(0xba), T(0xbb), T(0xbc), T(0xbd), T(0xbe), T(0xbf),
T(0xc0), T(0xc1), T(0xc2), T(0xc3), T(0xc4), T(0xc5), T(0xc6), T(0xc7),
T(0xc8), T(0xc9), T(0xca), T(0xcb), T(0xcc), T(0xcd), T(0xce), T(0xcf),
T(0xd0), T(0xd1), T(0xd2), T(0xd3), T(0xd4), T(0xd5), T(0xd6), T(0xd7),
T(0xd8), T(0xd9), T(0xda), T(0xdb), T(0xdc), T(0xdd), T(0xde), T(0xdf),
T(0xe0), T(0xe1), T(0xe2), T(0xe3), T(0xe4), T(0xe5), T(0xe6), T(0xe7),
T(0xe8), T(0xe9), T(0xea), T(0xeb), T(0xec), T(0xed), T(0xee), T(0xef),
T(0xf0), T(0xf1), T(0xf2), T(0xf3), T(0xf4), T(0xf5), T(0xf6), T(0xf7),
T(0xf8), T(0xf9), T(0xfa), T(0xfb), T(0xfc), T(0xfd), T(0xfe), 0x0100 };
#undef T
void ARGBUnattenuateRow_C(const uint8* src_argb, uint8* dst_argb, int width) {
for (int i = 0; i < width; ++i) {
uint32 b = src_argb[0];
uint32 g = src_argb[1];
uint32 r = src_argb[2];
const uint32 a = src_argb[3];
if (a) {
const uint32 ia = fixed_invtbl8[a]; // 8.16 fixed point
b = (b * ia) >> 8;
g = (g * ia) >> 8;
r = (r * ia) >> 8;
// Clamping should not be necessary but is free in assembly.
if (b > 255) {
b = 255;
}
if (g > 255) {
g = 255;
}
if (r > 255) {
r = 255;
}
}
dst_argb[0] = b;
dst_argb[1] = g;
dst_argb[2] = r;
dst_argb[3] = a;
src_argb += 4;
dst_argb += 4;
}
}
// Wrappers to handle odd width
#define YANY(NAMEANY, I420TORGB_SSE, I420TORGB_C, UV_SHIFT) \
void NAMEANY(const uint8* y_buf, \
const uint8* u_buf, \
const uint8* v_buf, \
uint8* rgb_buf, \
int width) { \
int n = width & ~7; \
I420TORGB_SSE(y_buf, u_buf, v_buf, rgb_buf, n); \
I420TORGB_C(y_buf + n, \
u_buf + (n >> UV_SHIFT), \
v_buf + (n >> UV_SHIFT), \
rgb_buf + n * 4, width & 7); \
}
// Wrappers to handle odd width
#define Y2NY(NAMEANY, NV12TORGB_SSE, NV12TORGB_C, UV_SHIFT) \
void NAMEANY(const uint8* y_buf, \
const uint8* uv_buf, \
uint8* rgb_buf, \
int width) { \
int n = width & ~7; \
NV12TORGB_SSE(y_buf, uv_buf, rgb_buf, n); \
NV12TORGB_C(y_buf + n, \
uv_buf + (n >> UV_SHIFT), \
rgb_buf + n * 4, width & 7); \
}
#ifdef HAS_I422TOARGBROW_SSSE3
YANY(I444ToARGBRow_Any_SSSE3, I444ToARGBRow_Unaligned_SSSE3, I444ToARGBRow_C, 0)
YANY(I422ToARGBRow_Any_SSSE3, I422ToARGBRow_Unaligned_SSSE3, I422ToARGBRow_C, 1)
YANY(I411ToARGBRow_Any_SSSE3, I411ToARGBRow_Unaligned_SSSE3, I411ToARGBRow_C, 2)
Y2NY(NV12ToARGBRow_Any_SSSE3, NV12ToARGBRow_Unaligned_SSSE3, NV12ToARGBRow_C, 0)
Y2NY(NV21ToARGBRow_Any_SSSE3, NV21ToARGBRow_Unaligned_SSSE3, NV21ToARGBRow_C, 0)
YANY(I422ToBGRARow_Any_SSSE3, I422ToBGRARow_Unaligned_SSSE3, I422ToBGRARow_C, 1)
YANY(I422ToABGRRow_Any_SSSE3, I422ToABGRRow_Unaligned_SSSE3, I422ToABGRRow_C, 1)
#endif
#ifdef HAS_I422TORGB24ROW_SSSE3
YANY(I422ToRGB24Row_Any_SSSE3, I422ToRGB24Row_Unaligned_SSSE3, \
I422ToRGB24Row_C, 1)
YANY(I422ToRAWRow_Any_SSSE3, I422ToRAWRow_Unaligned_SSSE3, I422ToRAWRow_C, 1)
#endif
#ifdef HAS_I422TORGBAROW_SSSE3
YANY(I422ToRGBARow_Any_SSSE3, I422ToRGBARow_Unaligned_SSSE3, I422ToRGBARow_C, 1)
#endif
#ifdef HAS_I422TOARGBROW_NEON
YANY(I422ToARGBRow_Any_NEON, I422ToARGBRow_NEON, I422ToARGBRow_C, 1)
YANY(I422ToBGRARow_Any_NEON, I422ToBGRARow_NEON, I422ToBGRARow_C, 1)
YANY(I422ToABGRRow_Any_NEON, I422ToABGRRow_NEON, I422ToABGRRow_C, 1)
YANY(I422ToRGBARow_Any_NEON, I422ToRGBARow_NEON, I422ToRGBARow_C, 1)
Y2NY(NV12ToARGBRow_Any_NEON, NV12ToARGBRow_NEON, NV12ToARGBRow_C, 0)
Y2NY(NV21ToARGBRow_Any_NEON, NV21ToARGBRow_NEON, NV21ToARGBRow_C, 0)
YANY(I422ToRGB24Row_Any_NEON, I422ToRGB24Row_NEON, I422ToRGB24Row_C, 1)
YANY(I422ToRAWRow_Any_NEON, I422ToRAWRow_NEON, I422ToRAWRow_C, 1)
#endif
#undef YANY
#define RGBANY(NAMEANY, ARGBTORGB, BPP) \
void NAMEANY(const uint8* argb_buf, \
uint8* rgb_buf, \
int width) { \
SIMD_ALIGNED(uint8 row[kMaxStride]); \
ARGBTORGB(argb_buf, row, width); \
memcpy(rgb_buf, row, width * BPP); \
}
#if defined(HAS_ARGBTORGB24ROW_SSSE3)
RGBANY(ARGBToRGB24Row_Any_SSSE3, ARGBToRGB24Row_SSSE3, 3)
RGBANY(ARGBToRAWRow_Any_SSSE3, ARGBToRAWRow_SSSE3, 3)
RGBANY(ARGBToRGB565Row_Any_SSE2, ARGBToRGB565Row_SSE2, 2)
RGBANY(ARGBToARGB1555Row_Any_SSE2, ARGBToARGB1555Row_SSE2, 2)
RGBANY(ARGBToARGB4444Row_Any_SSE2, ARGBToARGB4444Row_SSE2, 2)
#endif
#if defined(HAS_ARGBTORGB24ROW_NEON)
RGBANY(ARGBToRGB24Row_Any_NEON, ARGBToRGB24Row_NEON, 3)
RGBANY(ARGBToRAWRow_Any_NEON, ARGBToRAWRow_NEON, 3)
#endif
#undef RGBANY
#define YANY(NAMEANY, ARGBTOY_SSE, BPP) \
void NAMEANY(const uint8* src_argb, uint8* dst_y, int width) { \
ARGBTOY_SSE(src_argb, dst_y, width - 16); \
ARGBTOY_SSE(src_argb + (width - 16) * BPP, dst_y + (width - 16), 16); \
}
#ifdef HAS_ARGBTOYROW_SSSE3
YANY(ARGBToYRow_Any_SSSE3, ARGBToYRow_Unaligned_SSSE3, 4)
YANY(BGRAToYRow_Any_SSSE3, BGRAToYRow_Unaligned_SSSE3, 4)
YANY(ABGRToYRow_Any_SSSE3, ABGRToYRow_Unaligned_SSSE3, 4)
#endif
#ifdef HAS_RGBATOYROW_SSSE3
YANY(RGBAToYRow_Any_SSSE3, RGBAToYRow_Unaligned_SSSE3, 4)
#endif
#ifdef HAS_YUY2TOYROW_SSE2
YANY(YUY2ToYRow_Any_SSE2, YUY2ToYRow_Unaligned_SSE2, 2)
YANY(UYVYToYRow_Any_SSE2, UYVYToYRow_Unaligned_SSE2, 2)
#endif
#ifdef HAS_YUY2TOYROW_NEON
YANY(YUY2ToYRow_Any_NEON, YUY2ToYRow_NEON, 2)
YANY(UYVYToYRow_Any_NEON, UYVYToYRow_NEON, 2)
#endif
#undef YANY
#define UVANY(NAMEANY, ANYTOUV_SSE, ANYTOUV_C, BPP) \
void NAMEANY(const uint8* src_argb, int src_stride_argb, \
uint8* dst_u, uint8* dst_v, int width) { \
int n = width & ~15; \
ANYTOUV_SSE(src_argb, src_stride_argb, dst_u, dst_v, n); \
ANYTOUV_C(src_argb + n * BPP, src_stride_argb, \
dst_u + (n >> 1), \
dst_v + (n >> 1), \
width & 15); \
}
#ifdef HAS_ARGBTOUVROW_SSSE3
UVANY(ARGBToUVRow_Any_SSSE3, ARGBToUVRow_Unaligned_SSSE3, ARGBToUVRow_C, 4)
UVANY(BGRAToUVRow_Any_SSSE3, BGRAToUVRow_Unaligned_SSSE3, BGRAToUVRow_C, 4)
UVANY(ABGRToUVRow_Any_SSSE3, ABGRToUVRow_Unaligned_SSSE3, ABGRToUVRow_C, 4)
#endif
#ifdef HAS_RGBATOYROW_SSSE3
UVANY(RGBAToUVRow_Any_SSSE3, RGBAToUVRow_Unaligned_SSSE3, RGBAToUVRow_C, 4)
#endif
#ifdef HAS_YUY2TOUVROW_SSE2
UVANY(YUY2ToUVRow_Any_SSE2, YUY2ToUVRow_Unaligned_SSE2, YUY2ToUVRow_C, 2)
UVANY(UYVYToUVRow_Any_SSE2, UYVYToUVRow_Unaligned_SSE2, UYVYToUVRow_C, 2)
#endif
#ifdef HAS_YUY2TOUVROW_NEON
UVANY(YUY2ToUVRow_Any_NEON, YUY2ToUVRow_NEON, YUY2ToUVRow_C, 2)
UVANY(UYVYToUVRow_Any_NEON, UYVYToUVRow_NEON, UYVYToUVRow_C, 2)
#endif
#undef UVANY
#define UV422ANY(NAMEANY, ANYTOUV_SSE, ANYTOUV_C, BPP) \
void NAMEANY(const uint8* src_argb, \
uint8* dst_u, uint8* dst_v, int width) { \
int n = width & ~15; \
ANYTOUV_SSE(src_argb, dst_u, dst_v, n); \
ANYTOUV_C(src_argb + n * BPP, \
dst_u + (n >> 1), \
dst_v + (n >> 1), \
width & 15); \
}
#ifdef HAS_YUY2TOUV422ROW_SSE2
UV422ANY(YUY2ToUV422Row_Any_SSE2, YUY2ToUV422Row_Unaligned_SSE2, \
YUY2ToUV422Row_C, 2)
UV422ANY(UYVYToUV422Row_Any_SSE2, UYVYToUV422Row_Unaligned_SSE2, \
UYVYToUV422Row_C, 2)
#endif
#ifdef HAS_YUY2TOUV422ROW_NEON
UV422ANY(YUY2ToUV422Row_Any_NEON, YUY2ToUV422Row_NEON, \
YUY2ToUV422Row_C, 2)
UV422ANY(UYVYToUV422Row_Any_NEON, UYVYToUV422Row_NEON, \
UYVYToUV422Row_C, 2)
#endif
#undef UV422ANY
void ComputeCumulativeSumRow_C(const uint8* row, int32* cumsum,
const int32* previous_cumsum, int width) {
int32 row_sum[4] = {0, 0, 0, 0};
for (int x = 0; x < width; ++x) {
row_sum[0] += row[x * 4 + 0];
row_sum[1] += row[x * 4 + 1];
row_sum[2] += row[x * 4 + 2];
row_sum[3] += row[x * 4 + 3];
cumsum[x * 4 + 0] = row_sum[0] + previous_cumsum[x * 4 + 0];
cumsum[x * 4 + 1] = row_sum[1] + previous_cumsum[x * 4 + 1];
cumsum[x * 4 + 2] = row_sum[2] + previous_cumsum[x * 4 + 2];
cumsum[x * 4 + 3] = row_sum[3] + previous_cumsum[x * 4 + 3];
}
}
void CumulativeSumToAverage_C(const int32* tl, const int32* bl,
int w, int area, uint8* dst, int count) {
float ooa = 1.0f / area;
for (int i = 0; i < count; ++i) {
dst[0] = static_cast<uint8>((bl[w + 0] + tl[0] - bl[0] - tl[w + 0]) * ooa);
dst[1] = static_cast<uint8>((bl[w + 1] + tl[1] - bl[1] - tl[w + 1]) * ooa);
dst[2] = static_cast<uint8>((bl[w + 2] + tl[2] - bl[2] - tl[w + 2]) * ooa);
dst[3] = static_cast<uint8>((bl[w + 3] + tl[3] - bl[3] - tl[w + 3]) * ooa);
dst += 4;
tl += 4;
bl += 4;
}
}
#define REPEAT8(v) (v) | ((v) << 8)
#define SHADE(f, v) v * f >> 24
void ARGBShadeRow_C(const uint8* src_argb, uint8* dst_argb, int width,
uint32 value) {
const uint32 b_scale = REPEAT8(value & 0xff);
const uint32 g_scale = REPEAT8((value >> 8) & 0xff);
const uint32 r_scale = REPEAT8((value >> 16) & 0xff);
const uint32 a_scale = REPEAT8(value >> 24);
for (int i = 0; i < width; ++i) {
const uint32 b = REPEAT8(src_argb[0]);
const uint32 g = REPEAT8(src_argb[1]);
const uint32 r = REPEAT8(src_argb[2]);
const uint32 a = REPEAT8(src_argb[3]);
dst_argb[0] = SHADE(b, b_scale);
dst_argb[1] = SHADE(g, g_scale);
dst_argb[2] = SHADE(r, r_scale);
dst_argb[3] = SHADE(a, a_scale);
src_argb += 4;
dst_argb += 4;
}
}
#undef REPEAT8
#undef SHADE
// Copy pixels from rotated source to destination row with a slope.
LIBYUV_API
void ARGBAffineRow_C(const uint8* src_argb, int src_argb_stride,
uint8* dst_argb, const float* uv_dudv, int width) {
// Render a row of pixels from source into a buffer.
float uv[2];
uv[0] = uv_dudv[0];
uv[1] = uv_dudv[1];
for (int i = 0; i < width; ++i) {
int x = static_cast<int>(uv[0]);
int y = static_cast<int>(uv[1]);
*reinterpret_cast<uint32*>(dst_argb) =
*reinterpret_cast<const uint32*>(src_argb + y * src_argb_stride +
x * 4);
dst_argb += 4;
uv[0] += uv_dudv[2];
uv[1] += uv_dudv[3];
}
}
// C version 2x2 -> 2x1.
void ARGBInterpolateRow_C(uint8* dst_ptr, const uint8* src_ptr,
ptrdiff_t src_stride,
int dst_width, int source_y_fraction) {
int y1_fraction = source_y_fraction;
int y0_fraction = 256 - y1_fraction;
const uint8* src_ptr1 = src_ptr + src_stride;
uint8* end = dst_ptr + (dst_width << 2);
do {
dst_ptr[0] = (src_ptr[0] * y0_fraction + src_ptr1[0] * y1_fraction) >> 8;
dst_ptr[1] = (src_ptr[1] * y0_fraction + src_ptr1[1] * y1_fraction) >> 8;
dst_ptr[2] = (src_ptr[2] * y0_fraction + src_ptr1[2] * y1_fraction) >> 8;
dst_ptr[3] = (src_ptr[3] * y0_fraction + src_ptr1[3] * y1_fraction) >> 8;
dst_ptr[4] = (src_ptr[4] * y0_fraction + src_ptr1[4] * y1_fraction) >> 8;
dst_ptr[5] = (src_ptr[5] * y0_fraction + src_ptr1[5] * y1_fraction) >> 8;
dst_ptr[6] = (src_ptr[6] * y0_fraction + src_ptr1[6] * y1_fraction) >> 8;
dst_ptr[7] = (src_ptr[7] * y0_fraction + src_ptr1[7] * y1_fraction) >> 8;
src_ptr += 8;
src_ptr1 += 8;
dst_ptr += 8;
} while (dst_ptr < end);
}
#ifdef __cplusplus
} // extern "C"
} // namespace libyuv
#endif
|
0a18fb2a0e6ffcfdfede06bb93f11bf1cbde7e2d | 6321c83c09d1d844237d6e051da43e3326dae4b0 | /BallistaGame/ammo.h | a9dd49af5a7e0c0da14680893300207d113ff5e1 | [] | no_license | progstorage/resume_programs | b1fb7312010b735458901d3db701c9d6608e0569 | ab32bf5cd31456138873a87981970cb73478c77f | refs/heads/master | 2021-01-14T04:23:06.599146 | 2020-08-03T22:20:41 | 2020-08-03T22:20:41 | 242,598,142 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,006 | h | ammo.h | #ifndef AMMO_H
#define AMMO_H
#include <math.h>
#define g 9.81
class Gun {
public:
float HP;
float x, y, R;
Gun(float _x, float _y, float _R = 12, float _HP = 10000) :
x(_x), y(_y), R(_R), HP(_HP) {}
void update(float damage){
HP -= damage;
}
};
class Kernel {
private:
float m, v;
public:
float x, y;
float r;
float damage;
Kernel(float _r) : r(_r) {}
void SetParam(float _m, float _v)
{
m = _m; v = _v;
damage = m * v * v / 2;
}
void SetXtoLeft(float t, float _m, float _v, float _phi){
float phi = _phi * 3.14 / 180;
x = 1390 - _m * _v * cos(phi) * t;
}
void SetXtoRight(float t, float _m, float _v, float _phi){
float phi = _phi * 3.14 / 180;
x = 428 + _m * _v * cos(phi) * t;
}
void SetY(float t, float _m, float _v, float _phi){
float phi = _phi * 3.14 / 180;
y = 896 - _m *_v * sin(phi) * t + g * t * t / 2;
}
};
#endif // AMMO_H
|
ee5378f50ac17ed928d92b5a471810a039a8e551 | 95a327c65243a1851aa6c387e4d5fbc5bcaf79fa | /practical/virtual/crow.h | 9b3a97aab43a50372220c8db8f196a05b34c45f4 | [] | no_license | shunak/cpp-sandbox | 194007d834fcbb1af51a254fc651fb0b4761c67e | 29795b1df850a07758e200ab488d6273fd6b52b7 | refs/heads/master | 2021-06-25T19:34:02.631470 | 2019-07-22T15:20:07 | 2019-07-22T15:20:07 | 148,958,965 | 0 | 0 | null | 2019-07-22T15:20:09 | 2018-09-16T03:14:35 | C++ | UTF-8 | C++ | false | false | 324 | h | crow.h | #ifndef _CROE_H_
#define _CROW_H_
#include "bird.h"
// define bird class
class CCrow : public CBird{
public:
// sing
void sing(){
cout << "カーカー" << endl;
}
void fly(){
cout << "crows fly" << endl;
}
};
#endif
|
e1f023cc22259ccdd4aefd79c1d05ba2de52478a | fd21b6ff7bb56f0671ea41944b98ac07c89b4b25 | /pelican/core/src/PipelineSwitcher.cpp | 17b81e90af73fecbcb68b41d5148bf0279f1ffb7 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | pelican/pelican | 2a17d1555361997f32c62989b7d2e2caf6bc62a7 | 834ae2e5d0e58009500286eb7f7891611d02b50c | refs/heads/master | 2020-12-24T16:15:29.508084 | 2018-07-09T11:20:43 | 2018-07-09T11:20:43 | 349,519 | 7 | 8 | null | 2013-09-13T10:29:40 | 2009-10-26T00:41:12 | C++ | UTF-8 | C++ | false | false | 2,350 | cpp | PipelineSwitcher.cpp | /*
* Copyright (c) 2013, The University of Oxford
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of the University of Oxford nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "PipelineSwitcher.h"
#include <QtCore/QString>
namespace pelican {
/**
* @details Constructs a PipelineSwitcher object.
*/
PipelineSwitcher::PipelineSwitcher( bool cycle )
: _cycle(cycle), _current(-1)
{
}
/**
* @details Destroys the PipelineSwitcher object.
*/
PipelineSwitcher::~PipelineSwitcher()
{
}
void PipelineSwitcher::addPipeline(AbstractPipeline* pipe)
{
_pipelines.append(pipe);
}
AbstractPipeline* PipelineSwitcher::next()
{
int size = _pipelines.size();
if( size == 0 )
throw(QString("PipelineSwitcher: No pipelines defined"));
if( _cycle )
return _pipelines[++_current%size];
if( ++_current < size )
return _pipelines[_current];
return 0;
}
} // namespace pelican
|
9cccfdc8243d4989b76d363dbdbc237d622e8244 | a06515f4697a3dbcbae4e3c05de2f8632f8d5f46 | /corpus/taken_from_cppcheck_tests/stolen_812.cpp | 7cf2b2b7060646f9686c7da9cb41f77feda5be7a | [] | no_license | pauldreik/fuzzcppcheck | 12d9c11bcc182cc1f1bb4893e0925dc05fcaf711 | 794ba352af45971ff1f76d665b52adeb42dcab5f | refs/heads/master | 2020-05-01T01:55:04.280076 | 2019-03-22T21:05:28 | 2019-03-22T21:05:28 | 177,206,313 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 156 | cpp | stolen_812.cpp | class F {
char *p;
F(const F &f) {
p = f.p;
}
F(char *str) {
p = malloc(strlen(str)+1);
}
~F();
F& operator=(const F&f);
}; |
7456311d3640709e1371ed797c3827134386cda2 | ae1d4511a93db751a123ccb590503c2b0584dd86 | /src/parts.cpp | 5908c878577eb0da98be1dfe7a8be241b4503a91 | [] | no_license | Kumokage/task6_sum_of_it_parts | c6b594ab3df9f57d205b95e81bc06519818a5500 | 050274578779ffda8e9b78e3de307361fb3919e8 | refs/heads/master | 2023-06-22T22:48:30.902569 | 2020-06-12T17:39:38 | 2020-06-12T17:39:38 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,513 | cpp | parts.cpp | #include <iostream>
#include "parts.h"
using namespace std;
//**************** Part ****************
void Part::describe(void)
{
cout << "Part " << name << " subparts:" << "\n";
auto it = subpart.begin();
if(it == subpart.end())
{
cout << " " << "It has no subparts" << endl;
return;
}
while (it != subpart.end())
{
cout << " " << it->second << " " << it->first->name << "\n";
++it;
}
}
int Part::count_howmany(const Part *p) const
{
auto it = subpart.find(p);
if(it != subpart.end())
return it->second;
if(subpart.empty())
return 0;
int sum = 0;
for(auto i : subpart)
{
Part* copyPart = new Part(i.first->name);
copyPart->subpart = i.first->subpart;
sum += i.second * copyPart->count_howmany(p);
}
return sum;
}
//**************** NameContainer ****************
Part* NameContainer::lookup(string const &name)
{
auto foundPart = name_map.find(name);
if(foundPart != name_map.end())
{
return foundPart->second;
}
Part* newPart = new Part(name);
name_map[name] = newPart;
return newPart;
}
NameContainer::~NameContainer()
{
for(auto part : name_map)
{
delete(part.second);
}
}
void add_part(string const &x, int q, string const &y)
{
Part* xPart = partContainer.lookup(x);
Part* yPart = partContainer.lookup(y);
xPart->subpart[yPart] = q;
}
|
d37e4b20956b2bf73f0b102ae7527e2dfb3d9a51 | bbeeea25abd526a9f5b42269071b9d95164d2cef | /test/ut-assert/preparing.h | be5227c07a1f47216c52d8507400d0569193ce96 | [
"MIT"
] | permissive | JaredYeDH/capo | 51949d10a48a8502552f4ff325a393d6846ffed4 | 949355e8a9c018d30dc5a932b0fbeb2a70f3700a | refs/heads/master | 2020-04-05T11:16:11.651792 | 2018-10-23T08:29:29 | 2018-10-23T08:29:29 | 156,829,888 | 1 | 0 | null | 2018-11-09T08:05:25 | 2018-11-09T08:05:25 | null | UTF-8 | C++ | false | false | 365 | h | preparing.h | #pragma once
#include "capo/assert.hpp"
namespace ut_assert_ {
bool b = true;
int i = 1, j = 2;
char what[] = "What's up";
void func_1(void)
{
CAPO_ENSURE_(b = false)(i)(j)(what).msg("func_1 -> capo::assert::context\n").except();
}
void func_2(void)
{
CAPO_ENSURE_(b = false)(i)(j)(what).msg("func_2 -> bool\n").except(b);
}
} // namespace ut_assert_
|
3cf6cec7d7acb7663988513836af0b7b198b9c8e | d120d3135f4e7aa53b637ea6637c376adf90171a | /src/http/message.hpp | 4881a4d97c3d5fd3f62bc3d0537a59e07a59addc | [] | no_license | i6o6i/SimpleWeb | e1d38e1680d04dc5780a1296a14bacf0c8530e12 | d42c1faa98a5b34613a478494cedd691a1e3577a | refs/heads/main | 2023-03-22T12:35:52.511930 | 2021-03-21T08:44:40 | 2021-03-21T08:44:40 | 343,071,675 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,812 | hpp | message.hpp | #ifndef HTTP_MESSAGE_HPP
#define HTTP_MESSAGE_HPP
#include <utility>
#include <type_traits>
#include <iostream>
#include <http/fields.hpp>
#include <http/status.hpp>
#include <http/body.hpp>
namespace http{
enum class verb{
unknown = 0,
delete_,
get,
head,
post,
put
};
inline std::string to_string(verb v){
static std::string methodTable[6]={
"UNKNOWN",
"DELETE",
"GET",
"HEAD",
"POST",
"PUT",
};
return methodTable[static_cast<int>(v)];
}
template<bool isRequest, class Fields = fields>
class header;
template<class Fields>
class header<true, Fields> :public Fields{
public:
void method(const verb &m){ method_=m; }
int method(std::string &m){
switch(m[0]){
case 'D': method_=verb::delete_;break;
case 'G': method_=verb::get;break;
case 'H': method_=verb::head;break;
case 'P': method_=m[1]=='O'?verb::post
:verb::put;break;
default: method_=verb::unknown;
}
if(method_!=verb::unknown&&to_string(method_)!=m){
method_=verb::unknown;
return -1;
} else return 0;
}
verb method() { return method_; }
std::string method_string() { return to_string(method_); }
void target(const std::string & t) { target_=t; }
const std::string& target() { return target_; }
void version(unsigned v) { version_=v; }
unsigned version() { return version_; }
std::string version_string() {
switch(version_){
case 11: return "HTTP/1.1";
case 10: return "HTTP/1.0";
default: return "unknown";
}
}
header(
verb method,
const std::string& target_,
unsigned version_,
const std::initializer_list<typename Fields::value_type>&& fields
): Fields(std::move(fields)),method_(method)
{
version(version_);
target(target_);
}
header() = default;
private:
verb method_;
unsigned version_;
std::string target_;
};
template<class Fields>
class header<false, Fields>:public Fields{
public:
void result(status s){ status_=s; }
status result(){ return status_; }
unsigned result_int() { return static_cast<int>(status_); }
const std::string reason() { return to_string(status_); }
header() = default;
void version(unsigned v) { version_=v; }
unsigned version() { return version_; }
std::string version_string() {
switch(version_){
case 11: return "HTTP/1.1";
case 10: return "HTTP/1.0";
default: return "unknown";
}
}
template<class... FieldsArgs>
header(
status status,
const std::initializer_list<typename Fields::value_type>&& fields,
unsigned version
): Fields(std::move(fields)),status_(status),version_(version)
{ }
private:
status status_;
unsigned version_;
};
using request_header = header<true>;
using response_header = header<false>;
template<bool isRequest, class Body, class Fields = fields>
class message: public header<isRequest, Fields>, public Body{
public:
using header_type = header<isRequest, Fields>;
//using body_type = typename Body::value_type;
message() = default;
template<class U = Body>
message(header_type &&h, typename std::enable_if<std::is_empty<U>::value>::type* = 0): header_type(h) {}
template<class U>
message(message<isRequest,U>&& m):header_type(m){}
template<class... BodyArgs>
message(header_type &&h, BodyArgs&&... body_args)
:header_type(h), Body(std::forward<BodyArgs>(body_args)...){
}
/*
template<class... BodyArgs>
message(header_type &h, BodyArgs ... body_args)
:header_type(h), Body(body_args...){
}
*/
//constructor for other body message
template<class OtherBody, class... BodyArgs>
message(message<isRequest, OtherBody> && m, BodyArgs &&... body_args)
:header_type(m), Body(std::forward<BodyArgs>(body_args)...){
}
};
template<class Body , class Fields = fields>
using request_message = message<true,Body,Fields>;
template<class Body , class Fields = fields>
using response_message = message<false,Body,Fields>;
}
#endif
|
8740d7c1867c33ee5fad8112f33da2033a29f06f | 532e563887c8cf25804e3a6236284be2e1d88314 | /keyproject/keyproject/ParaData.h | 94b03f1219b1053d4d405746ab3f640769b1c0b5 | [] | no_license | KaoGu/Key-Project | e16678a084442898659a0bbd01e5f79acab8b820 | becf0107380480c1b770d9759e0afb246567de1e | refs/heads/master | 2021-06-28T23:31:30.820296 | 2020-03-15T02:05:45 | 2020-03-15T02:05:45 | 73,593,709 | 0 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 495 | h | ParaData.h | #pragma once
#ifndef ParaData_H
#define ParaData_H
#include "GlobleType.h"
#include "MyList.h"
#include <Windows.h>
class AnalyticParameter;
class ParaData{
public:
ParaData()
:modelType(UNDEFINE_MODEL),
srcFlag(All_False_Flag)
{
}
void showHelp();
void findModel(AnalyticParameter &analyPara);
MODEL_TYPE modelType;
uChar key[256];
//гÉÔ±
Contain_Flag_TYPE srcFlag;
TypeClass<PathPair>::List pathList;
private:
void initByteKey(uChar key[256]);
};
#endif |
28627a1dc41a2808b1ce18e327aced5bebfe09b5 | 44f7f0513aa956e2fe880ab3537255d4f13940ca | /Engine/Code/Engine/Math/PhysicsShape.cpp | 1705e7308f94fa6afd1563682a825c01b0d08fe7 | [] | no_license | ZanneZankyo/Zankyo-Games | ae1862f174d13c80b70657a3a880952fa6279a3c | e75838242cabb0467b6934704a2eeb7dba1c038c | refs/heads/master | 2020-03-17T20:30:07.300836 | 2018-07-09T22:53:51 | 2018-07-09T22:53:51 | 133,913,193 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 271 | cpp | PhysicsShape.cpp | #include "PhysicsShape.hpp"
#ifdef TOOLS_BUILD
PhysicsShape::PhysicsShape(PxShape* pxShape)
: m_pxShape(pxShape)
{
m_pxShape->userData = this;
}
void PhysicsShape::SetTransform(const Matrix4& transform)
{
m_pxShape->setLocalPose(ToPxTransform(transform));
}
#endif |
649860b308d487dc3b432578b2f41f19c375b477 | 0b73dd79ffb40a3e2812ee1c80ac42e7de56e11c | /ResourceType.h | 4029f0ac0066dcd77be9188e50d0c5deaf1bdb5a | [] | no_license | wutaoyang/SpeciesSelectionCpp | 5bc57389c99a6aed303f10a72f258f1470940acd | bd5b5b89efc7c1b3eb90ffd66fa28c8feb197a28 | refs/heads/master | 2021-05-08T23:36:03.668602 | 2018-01-31T16:42:28 | 2018-01-31T16:42:28 | 119,714,270 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 893 | h | ResourceType.h | /*
* File: ResourceType.h
* Author: mre16utu
*
* Created on 15 January 2018, 14:52
*/
#ifndef RESOURCETYPE_H
#define RESOURCETYPE_H
//#include "Species.h"
#include <vector>
#include <string>
using namespace std;
class Species;
class ResourceType {
protected:
int id;
public:
vector<Species *> specList;
ResourceType();
ResourceType(int);
~ResourceType();
bool noSpecies();
void setID(int);
int getID();
int numSpecies();
void addSpecies(Species*);
bool adjacentTo(Species*);
Species* getFirstSpecies();
int compareTo(ResourceType*);
bool isCoveredBy(ResourceType*);
string toString();
bool isIn(vector<ResourceType*> a);
private:
bool containsAll(vector<Species*> a, vector<Species*> b);
};
bool sortFunctionRT(ResourceType *i, ResourceType *j);
#endif /* RESOURCETYPE_H */
|
f5844e7e4c1b709ad60fcfa51b9885d86ed0543e | d33024b33d0b2f894903916d2db55c69b86306e3 | /src/sema/sema.hpp | a1982589ff2b07e76b391039e032fd479512d269 | [
"MIT"
] | permissive | aaron-michaux/gaffs | 2556f6d81962e7997e5e0678aae6871590e89fdd | de9ba7b24e8ef39f0f13f6f657b7f104d74f58e1 | refs/heads/main | 2022-12-30T02:36:29.142688 | 2020-10-13T13:51:17 | 2020-10-13T13:51:17 | 300,690,761 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 158 | hpp | sema.hpp |
#pragma once
#include "ast/scope.hpp"
#include "build-symbol-table.hpp"
#include "calculate-first-final-follow-sets.hpp"
#include "calculate-ll-rules.hpp"
|
2992b1475c0ab49f8fbfff1abd6dd61a3dd2c704 | 79b3d0eef9163086bf9745c177ea2bc9db02c034 | /ant_code/dsi_framer.cpp | 2cef8d617f48a518f7aebd770bb9e791883d667e | [] | no_license | pepelkod/AntBridge | 8bb36d3ea727711cd1c35c98d0bffa2a0161647f | 2514409914e62a7f3860bfcbb39d299522127022 | refs/heads/master | 2022-09-30T13:40:44.387430 | 2022-09-14T19:25:44 | 2022-09-14T19:25:44 | 113,638,808 | 11 | 1 | null | 2022-09-14T19:25:45 | 2017-12-09T03:33:28 | C++ | UTF-8 | C++ | false | false | 1,281 | cpp | dsi_framer.cpp | /*
This software is subject to the license described in the License.txt file
included with this software distribution. You may not use this file except
in compliance with this license.
Copyright (c) Dynastream Innovations Inc. 2016
All rights reserved.
*/
#include "types.h"
#include "dsi_framer.hpp"
//////////////////////////////////////////////////////////////////////////////////
// Public Class Functions
//////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// Default constructor.
/////////////////////////////////////////////////////////////////
DSIFramer::DSIFramer()
{
pclSerial = (DSISerial*)NULL;
}
/////////////////////////////////////////////////////////////////
// Constructor.
/////////////////////////////////////////////////////////////////
DSIFramer::DSIFramer(DSISerial *pclSerial_)
{
pclSerial = pclSerial_;
}
/////////////////////////////////////////////////////////////////
// Destructor.
/////////////////////////////////////////////////////////////////
DSIFramer::~DSIFramer()
{
}
#if 0
/////////////////////////////////////////////////////////////////
BOOL DSIFramer::WriteMessage(void *pvData_, USHORT usMessageSize_)
{
return FALSE;
}
#endif
|
d5955fa6c9f3fc7638cbf13c4e414f677afdaa49 | 4f41a3ae9e40a7be7a0904112f8430545be4713b | /arduino/fermentationMonitor/fermentationMonitor.ino | 8e9f983d85c82fca3af6998474649dddbe212e4e | [] | no_license | slobrewer/UberFerm | 18c128aaee3d5fad7b3c44a904e8ed69c66f35de | 7780ef54a2fb69a8ae9e5bc35ed45c37af9f40af | refs/heads/master | 2020-04-04T22:35:47.148572 | 2012-06-01T06:57:10 | 2012-06-01T06:57:10 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,535 | ino | fermentationMonitor.ino | #include <OLEDFourBit.h>
#include "globals.h"
#include "enums.h"
void setup()
{
lcdText[0][20]='\0';
lcdText[1][20]='\0';
lcdText[2][20]='\0';
lcdText[3][20]='\0';
pinMode(coolingPin, OUTPUT);
pinMode(heatingPin, OUTPUT);
pinMode(doorPin, INPUT);
// analog pins are input by default
analogReference(2); //set analog reference to internal 1.1V
delay(100);
lcd.begin(20, 4);
lcd.clear();
lcdPrintStationaryText();
loadSettings(); //read previous settings from EEPROM
lcdPrintMode();
Serial.begin(9600);
initFilters();
initControl();
updateSettings();
serialFridgeMessage(ARDUINO_START);
}
void loop()
{
if(millis()- sampleTimerFast > 200){ //update fast filters every 200 ms
sampleTimerFast=millis();
updateTemperatures();
}
if(millis()-sampleTimerSlow > 10000){ //update slow filter every 10 seconds
sampleTimerSlow=millis();
updateSlowFilteredTemperatures();
detectPeaks();
updateSettings();
}
if(millis()-settingsTimer >1000){ //update settings every second
settingsTimer=millis();
updateState();
lcdPrintState();
updateOutputs();
lcdPrintAllTemperatures();
lcdPrintMode();
}
if(millis()- slopeTimer > 60000){//update slope every minute. slope is tempdiff per 30 minutes
slopeTimer = millis();
updateSlope();
}
//listen for incoming serial connections while waiting top update
handleSerialCommunication();
//Check if menu button is pressed
if(analogRead(button3)>900){
menu(MENU_TOP);
}
}
|
0cf24985955abc4baed811e5be43c49f3d9b3026 | ff4a6135ff3fc9bd69b53d1a906f48570dceff29 | /Content/Simulation/BodyInfo.cpp | 2057181232b97d1b2157c851f24e60a42af468e8 | [
"Unlicense"
] | permissive | jodavis42/NBody | 8999ace01b4f23be9071860c78120bf7f1322bfa | 91a40ca60625494a27c517590d12df4a77f776b4 | refs/heads/master | 2021-01-16T00:56:25.441755 | 2017-08-18T14:48:52 | 2017-08-18T14:48:52 | 99,983,729 | 0 | 1 | Unlicense | 2018-12-07T22:22:13 | 2017-08-11T02:33:41 | C++ | UTF-8 | C++ | false | false | 199 | cpp | BodyInfo.cpp | #include "SimulationPrecompiled.hpp"
void BodyInfo::Load(Cog* cog)
{
mCog = cog;
mPosition = cog->has(Transform)->GetWorldTranslation();
mMass = cog->has(RigidBody)->GetMass();
}
|
de06af1f01c62b916b6040135b25d98f6d21e48d | 6197740e6297da2f3d0c8ffd2a1d7ef5d8b3d2cb | /DotNet/Foundations of C++CLI/Chapter08/sealed.cpp | 19094bd1a082708429f15cecb40a54f292f154b3 | [] | no_license | ssh352/cppcode | 1159d4137b68ada253678718b3d416639d3849ba | 5b7c28963286295dfc9af087bed51ac35cd79ce6 | refs/heads/master | 2020-11-24T18:07:17.587795 | 2016-07-15T13:13:05 | 2016-07-15T13:13:05 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 123 | cpp | sealed.cpp | // sealed.cpp
ref class C sealed
{
};
//ref class B : C // Error: cannot inherit from a sealed class.
//{
//};
|
d8e4273ae07307801762f4f54c75af05104310b7 | 7741f425ac616209c7af3fa677907a8f1dd7a1c5 | /libbitcoin/test/oldtests/base58-test.cpp | 0dd74958d2f30ce663e08c210167fe777ca37833 | [
"MIT",
"AGPL-3.0-only",
"LicenseRef-scancode-other-copyleft",
"AGPL-3.0-or-later",
"LicenseRef-scancode-linking-exception-agpl-3.0",
"LicenseRef-scancode-philippe-de-muyter",
"GPL-1.0-or-later",
"OpenSSL"
] | permissive | ivanpustogarov/bcclient | 48ed67e7df49b98663d72f39fb8d480eca5ed421 | 086085011c1eaba06fc0b8b36231a1784e163eae | refs/heads/master | 2020-01-23T22:06:46.988589 | 2017-12-18T17:41:39 | 2017-12-18T17:41:39 | 74,610,620 | 12 | 5 | MIT | 2018-01-17T15:28:45 | 2016-11-23T20:14:12 | C++ | UTF-8 | C++ | false | false | 1,334 | cpp | base58-test.cpp | /*
* Copyright (c) 2011-2013 libbitcoin developers (see AUTHORS)
*
* This file is part of libbitcoin.
*
* libbitcoin is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License with
* additional permissions to the one published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version. For more information see LICENSE.
*
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <bitcoin/utility/base58.hpp>
#include <bitcoin/utility/assert.hpp>
using namespace libbitcoin;
int main()
{
data_chunk pubkey = {0x00, 0x5c, 0xc8, 0x7f, 0x4a, 0x3f, 0xdf, 0xe3, 0xa2, 0x34, 0x6b, 0x69, 0x53, 0x26, 0x7c, 0xa8, 0x67, 0x28, 0x26, 0x30, 0xd3, 0xf9, 0xb7, 0x8e, 0x64};
std::string address = "19TbMSWwHvnxAKy12iNm3KdbGfzfaMFViT";
BITCOIN_ASSERT(encode_base58(pubkey) == address);
BITCOIN_ASSERT(decode_base58(address) == pubkey);
return 0;
}
|
425bac448e447062a08d92423b29443dd9ae1019 | 08068f7092ee809d2447931dc3dd196f3e943108 | /ReproduceState.h | 9af79367a44913455523a92cb4e7ba71acfde2e8 | [] | no_license | Kasia4/Artificial-life-simulator | 103e1895bd3114de8e85abb22f40555797e9315f | 42ea28266e44fdf5813d800ea635f2569a44cdaf | refs/heads/master | 2020-03-14T11:07:46.334899 | 2017-07-02T15:25:40 | 2017-07-02T15:25:40 | 131,583,753 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 354 | h | ReproduceState.h | #ifndef REPRODUCESTATE_H
#define REPRODUCESTATE_H
#include "State.h"
#include "SimulationScene.h"
class ReproduceState : public State
{
public:
ReproduceState();
State* action(Specimen *specimen);
State* clone() const;
void setFactors(Specimen* specimen);
private:
State* reproduce(Specimen* specimen);
};
#endif // REPRODUCESTATE_H
|
b540cf0dc813418dc8f5fe05e27a795d28a480c0 | 968447bedbea5842c2d0f62ff47c0bd4c2258012 | /demos/umlastah/translations/astah-generated-code/astah-gen-c++/package-class-diagrams/PackageD/AG.h | 1728c662817e6c108b9004a781a2c84c7b640c19 | [] | no_license | paulnguyen/cmpe202 | 5c3fe070515e4664385ca8fde5d97564f35557e4 | 153b243e888f083733a180c571e0290ec49a67dd | refs/heads/master | 2022-12-14T13:14:04.001730 | 2022-11-12T21:56:09 | 2022-11-12T21:56:09 | 10,661,668 | 53 | 441 | null | 2022-12-06T19:25:07 | 2013-06-13T08:09:27 | Java | UTF-8 | C++ | false | false | 460 | h | AG.h | #ifndef PACKAGE-CLASS-DIAGRAMS_PACKAGED_A_G_H
#define PACKAGE-CLASS-DIAGRAMS_PACKAGED_A_G_H
#include <string>
#include <vector>
#include <list>
#include <iostream>
#include <assert.h>
#include "package-class-diagrams/PackageD/G.h"
#include "package-class-diagrams/PackageD/A.h"
namespace package-class-diagrams
{
namespace PackageD
{
class AG
{
private:
int attribute;
G g;
A a;
};
} // namespace PackageD
} // namespace package-class-diagrams
#endif
|
9949abda63a9e340ddd05c43fa87a34fd190e2f3 | 1095cfe2e29ddf4e4c5e12d713bd12f45c9b6f7d | /src/mem/cache/write_queue_entry.cc | f71fd1b480931a6385c1a4b03fd1778937a1ba2c | [
"BSD-3-Clause",
"LicenseRef-scancode-proprietary-license",
"LGPL-2.0-or-later",
"MIT"
] | permissive | gem5/gem5 | 9ec715ae036c2e08807b5919f114e1d38d189bce | 48a40cf2f5182a82de360b7efa497d82e06b1631 | refs/heads/stable | 2023-09-03T15:56:25.819189 | 2023-08-31T05:53:03 | 2023-08-31T05:53:03 | 27,425,638 | 1,185 | 1,177 | BSD-3-Clause | 2023-09-14T08:29:31 | 2014-12-02T09:46:00 | C++ | UTF-8 | C++ | false | false | 6,038 | cc | write_queue_entry.cc | /*
* Copyright (c) 2012-2013, 2015-2017 ARM Limited
* All rights reserved.
*
* The license below extends only to copyright in the software and shall
* not be construed as granting a license to any other intellectual
* property including but not limited to intellectual property relating
* to a hardware implementation of the functionality of the software
* licensed hereunder. You may use the software subject to the license
* terms below provided that you ensure that this notice is replicated
* unmodified and in its entirety in all distributions of the software,
* modified or unmodified, in source code or in binary form.
*
* Copyright (c) 2002-2005 The Regents of The University of Michigan
* Copyright (c) 2010 Advanced Micro Devices, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met: redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer;
* redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @file
* Miss Status and Handling Register (WriteQueueEntry) definitions.
*/
#include "mem/cache/write_queue_entry.hh"
#include <cassert>
#include <string>
#include "base/logging.hh"
#include "base/types.hh"
#include "mem/cache/base.hh"
#include "mem/request.hh"
namespace gem5
{
inline void
WriteQueueEntry::TargetList::add(PacketPtr pkt, Tick readyTime,
Counter order)
{
emplace_back(pkt, readyTime, order);
}
bool
WriteQueueEntry::TargetList::trySatisfyFunctional(PacketPtr pkt)
{
for (auto& t : *this) {
if (pkt->trySatisfyFunctional(t.pkt)) {
return true;
}
}
return false;
}
void
WriteQueueEntry::TargetList::print(std::ostream &os, int verbosity,
const std::string &prefix) const
{
for (auto& t : *this) {
ccprintf(os, "%sFromCPU: ", prefix);
t.pkt->print(os, verbosity, "");
}
}
void
WriteQueueEntry::allocate(Addr blk_addr, unsigned blk_size, PacketPtr target,
Tick when_ready, Counter _order)
{
blkAddr = blk_addr;
blkSize = blk_size;
isSecure = target->isSecure();
readyTime = when_ready;
order = _order;
assert(target);
_isUncacheable = target->req->isUncacheable();
inService = false;
// we should never have more than a single target for cacheable
// writes (writebacks and clean evictions)
panic_if(!_isUncacheable && !targets.empty(),
"Write queue entry %#llx should never have more than one "
"cacheable target", blkAddr);
panic_if(!((target->isWrite() && _isUncacheable) ||
(target->isEviction() && !_isUncacheable) ||
target->cmd == MemCmd::WriteClean),
"Write queue entry %#llx should be an uncacheable write or "
"a cacheable eviction or a writeclean");
targets.add(target, when_ready, _order);
// All targets must refer to the same block
assert(target->matchBlockAddr(targets.front().pkt, blkSize));
}
void
WriteQueueEntry::deallocate()
{
assert(targets.empty());
inService = false;
}
bool
WriteQueueEntry::trySatisfyFunctional(PacketPtr pkt)
{
// For printing, we treat the WriteQueueEntry as a whole as single
// entity. For other requests, we iterate over the individual
// targets since that's where the actual data lies.
if (pkt->isPrint()) {
pkt->trySatisfyFunctional(this, blkAddr, isSecure, blkSize, nullptr);
return false;
} else {
return targets.trySatisfyFunctional(pkt);
}
}
bool
WriteQueueEntry::sendPacket(BaseCache &cache)
{
return cache.sendWriteQueuePacket(this);
}
bool
WriteQueueEntry::matchBlockAddr(const Addr addr, const bool is_secure) const
{
assert(hasTargets());
return (blkAddr == addr) && (isSecure == is_secure);
}
bool
WriteQueueEntry::matchBlockAddr(const PacketPtr pkt) const
{
assert(hasTargets());
return pkt->matchBlockAddr(blkAddr, isSecure, blkSize);
}
bool
WriteQueueEntry::conflictAddr(const QueueEntry* entry) const
{
assert(hasTargets());
return entry->matchBlockAddr(blkAddr, isSecure);
}
void
WriteQueueEntry::print(std::ostream &os, int verbosity,
const std::string &prefix) const
{
ccprintf(os, "%s[%#llx:%#llx](%s) %s %s %s state: %s %s %s %s %s\n",
prefix, blkAddr, blkAddr + blkSize - 1,
isSecure ? "s" : "ns",
_isUncacheable ? "Unc" : "",
inService ? "InSvc" : "");
ccprintf(os, "%s Targets:\n", prefix);
targets.print(os, verbosity, prefix + " ");
}
std::string
WriteQueueEntry::print() const
{
std::ostringstream str;
print(str);
return str.str();
}
} // namespace gem5
|
fd6c0dcf292a748810902398d554b359a2cc4b15 | fa391c1affe497abbde266e6ec70710f7c676b94 | /HardwarePlugins/PluginPhidgets/GPhidgetServoMotorWidget.h | eafc42e5889435d0a60c8850f53631a167353171 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | GaelReinaudi/LabExe-UserPlugins | d936d94271e946a2e8b0ebd998f287b30e22f6aa | 3f9de085115947bf9362a7c6f46fd89d5c0f8daa | refs/heads/master | 2021-01-18T21:34:54.755432 | 2017-11-29T04:50:49 | 2017-11-29T04:50:53 | 10,351,469 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 478 | h | GPhidgetServoMotorWidget.h | #ifndef GPHIDGETSERVOMOTORWIDGET_H
#define GPHIDGETSERVOMOTORWIDGET_H
#include <QWidget>
#include "ui_GPhidgetServoMotorWidget.h"
#include "GPhidgetServoMotor.h"
class GPhidgetServoMotorWidget : public QWidget, public Ui::GPhidgetServoMotorWidget
{
Q_OBJECT
public:
GPhidgetServoMotorWidget(GPhidgetServoMotor* pServo, QWidget *parent = 0);
~GPhidgetServoMotorWidget();
private:
GPhidgetServoMotor* m_pServo;
};
#endif // GPHIDGETSERVOMOTORWIDGET_H
|
ca4e7e7682ba250b85b6c6456b58fe7452630003 | 1bd3aec078858c34b4f5a53839c1062358eb055e | /GA based control system/beast/libs/vector2d.h | 9bca23cc211eba108b7ae69f239d0e9222a23f1b | [] | no_license | yeswhos/COMP5200M-MSc-Project | 321a29e2250cc691b1e0bee6351e169bb8953a8f | 03fd3eebcdcf422363e82b7338b95751e6f1fb74 | refs/heads/master | 2022-12-06T07:34:47.279915 | 2020-08-24T15:21:42 | 2020-08-24T15:21:42 | 289,897,926 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,886 | h | vector2d.h | /**
* \file vector2d.h
* \addtogroup framework
*/
#ifndef _VECTOR2D_H_
#define _VECTOR2D_H_
#include <iostream>
#include <cmath>
#include <float.h>
#include "utilities.h"
#include "random.h"
#include "serialfuncs.h"
/// pi defined to a much greater accuracy than will ever be needed
#define PI 3.14159265358979323846
/// A handy define for 2 x pi
#define TWOPI 6.28318530717958647693
namespace BEAST {
/**
* \addtogroup framework
* @{
*/
// non-member helper functions
inline double deg2rad(double);
inline double rad2deg(double);
/**
* A class for representing two-dimensional vectors and coordinates. All
* usual operators are overloaded and other features are provided.
*/
class Vector2D
{
public:
double x, y;
// Constructors & destructor...
Vector2D():x(0.0),y(0.0){}
Vector2D(double X, double Y):x(X),y(Y){}
Vector2D(double X, double Y, double l, double a):
x(l * cos(a) + X), y(l * sin(a) + Y){}
Vector2D(const Vector2D &v, double l, double a):
x(l * cos(a) + v.x), y(l * sin(a) + v.y){}
// destructor
~Vector2D() {};
// Overloaded operators...
inline Vector2D operator+(const Vector2D&)const;
inline Vector2D operator-(const Vector2D&)const;
inline Vector2D operator*(double)const;
inline Vector2D &operator+=(const Vector2D&);
inline Vector2D &operator-=(const Vector2D&);
inline Vector2D &operator*=(double);
inline Vector2D operator-()const;
inline bool operator==(const Vector2D&)const; // equality
inline bool operator!=(const Vector2D&)const;
// Mutators...
inline void SetX(double X) { x = X; }
inline void SetY(double Y) { y = Y; }
inline void SetPolarCoordinates(double,double); // length & angle
inline void SetCartesian(double,double); // standard x,y
inline void SetLength(double);
inline bool incLength(double);
inline bool decLength(double);
inline void SetAngle(double);
inline void normalise(); // convert to a unit vector
inline void rotate(double); // rotate the Vector2D
inline Vector2D rotation(double)const; // rotate and return the rotated vector
// Accessors...
double GetX()const { return x; }
double GetY()const { return y; }
inline double GetLength()const;
inline double GetLengthSquared()const;
inline double GetAngle()const;
inline double GetGradient()const;
inline Vector2D GetReciprocal()const; // return reciprocal vector
inline Vector2D GetNormalised()const; // return unit vector form
inline Vector2D GetPerpendicular()const;
inline double dot(const Vector2D&)const;
inline void Serialise(std::ostream&)const;
inline void Unserialise(std::istream&);
};
/// Returns true if this vector is equal to other
bool Vector2D::operator==(const Vector2D& other)const
{
return (x == other.x && y == other.y);
}
/// Returns true if this vector is not equal to other
bool Vector2D::operator!=(const Vector2D& other)const
{
return (x != other.x || y != other.y);
}
/// Returns this vector multiplied by l.
Vector2D Vector2D::operator*(double l)const
{
return Vector2D(x * l, y * l);
}
/// Returns a vector multiplied by a double.
inline Vector2D operator*(double l, const Vector2D& v)
{
return v * l;
}
/// Multiplies this vector's length by the specified value.
Vector2D& Vector2D::operator*=(double l)
{
x *= l;
y *= l;
return *this;
}
/// Returns this vector plus other.
Vector2D Vector2D::operator+(const Vector2D& other)const
{
return Vector2D(x + other.x, y + other.y);
}
/// Adds other to this vector.
Vector2D& Vector2D::operator +=(const Vector2D& other)
{
x += other.x;
y += other.y;
return *this;
}
/// Returns this vector minus other.
Vector2D Vector2D::operator-(const Vector2D& other)const {
return Vector2D(x - other.x, y - other.y);
}
/// Subtracts other from this vector.
Vector2D& Vector2D::operator -=(const Vector2D& other)
{
x -= other.x;
y -= other.y;
return *this;
}
/// Negates both values of the vector.
Vector2D Vector2D::operator-()const
{
return Vector2D(-x, -y);
}
/// Converts the vector into a unit vector with the same angle.
void Vector2D::normalise()
{
if (x == 0.0 && y == 0.0) {
y = 1.0;
return;
}
double invLength = 1 / GetLength();
x *= invLength;
y *= invLength;
}
/// Rotates the vector by the specified number of radians.
void Vector2D::rotate(double a)
{
double m1 = cos(a);
double m2 = sin(a);
x = m1 * x - m2 * y;
y = m1 * y + m2 * x; // -m2 and m1 stand in for m3 and m4
}
/// Returns the vector rotated by the specified number of radians.
Vector2D Vector2D::rotation(double a)const
{
double m1 = cos(a);
double m2 = sin(a);
return Vector2D(m1 * x - m2 * y, m1 * y + m2 * x); // -m2 and m1 stand in for m3 and m4
}
/** Sets the vector up using polar coordinates.
* \param l The vector's new length.
* \param a The vector's new angle.
*/
void Vector2D::SetPolarCoordinates(double l,double a)
{
x = l * cos(a);
y = l * sin(a);
}
/// Sets the length of the vector.
void Vector2D::SetLength(double l)
{
normalise();
operator*=(l);
}
/// Sets the angle of the vector.
void Vector2D::SetAngle(double a)
{
*this = Vector2D(0.0, 0.0, GetLength(), a);
}
/// Quick way of setting X and Y of vector at the same time.
void Vector2D::SetCartesian(double X, double Y)
{
x = X;
y = Y;
}
/// Returns the opposite vector.
Vector2D Vector2D::GetReciprocal()const
{
return Vector2D(-x, -y);
}
/// Returns a unit vector with the same angle as the current vector.
Vector2D Vector2D::GetNormalised()const
{
if (x == 0.0 && y == 0.0) {
return Vector2D(0.0,1.0);
}
double invLength = 1 / GetLength();
return Vector2D(invLength * x, invLength * y);
}
/// Returns the dot product of the vector with other
double Vector2D::dot(const Vector2D& other)const
{
return x * other.x + y * other.y;
}
/// Returns the length of the vector, if possible use GetLengthSquared instead.
double Vector2D::GetLength()const
{
return sqrt(GetLengthSquared());
}
/// Returns the square of the vector's length, useful for quicker comparisons.
double Vector2D::GetLengthSquared()const
{
return x * x + y * y;
}
/// Returns the angle of the vector in radians.
double Vector2D::GetAngle()const
{
if (x==0) return y>=0 ? PI/2 : -PI/2;
else if (x > 0) return atan(y/x);
else return atan(y/x) + PI;
}
/// Returns the gradient of the vector.
double Vector2D::GetGradient()const
{
return x == 0 ? DBL_MAX : y / x;
}
/// Returns the perpendicular to the vector/
Vector2D Vector2D::GetPerpendicular()const
{
return Vector2D(-y,x);
}
/// Writes a Vector2D to an output stream.
void Vector2D::Serialise(std::ostream& out)const
{
out << "Vector2D " << x << " " << y << "\n";
}
/// Reads a Vector2D from an input stream.
void Vector2D::Unserialise(std::istream& in)
{
std::string name;
in >> name;
if (name != "Vector2D") {
throw SerialException(SERIAL_ERROR_DATA_MISMATCH, "",
"Expected Vector2D but got " + name);
}
in >> x >> y;
}
// Non-member functions...
/// Converts degrees to radians.
double deg2rad(double angle) {
return angle/360.0 * TWOPI;
}
/// Converts radians to degrees.
double rad2deg(double angle) {
double result = (angle/TWOPI) * 360.0;
return result;
}
/**
* Creates a Vector2D object using old PolarVector syntax.
* \param l The length of the vector
* \param a The angle of the vector anticlockwise from due east.
* \deprecated Probably of no use to anyone unless they have a strange
* fascination with polar coordinates.
*/
inline Vector2D PolarVector(double l, double a)
{
return Vector2D(0.0, 0.0, l, a);
}
/**
* Output operator for Vector2D
* \relates Vector2D
*/
inline std::ostream& operator<< (std::ostream& out, const Vector2D& v)
{
v.Serialise(out);
return out;
}
/**
* Input operator for Vector2D
* \relates Vector2D
*/
inline std::istream& operator>> (std::istream& in, Vector2D& v)
{
v.Unserialise(in);
return in;
}
/**
* @}
*/
} // namespace BEAST
#endif
|
8e882089fcda25e406cfa205dd0af6906e7bcea9 | b65af77686e4779759e0afb1af4bed33d37f714f | /StdAfx.h | 7ed11c6073f04e8b0a7c76544545f254e326dcb6 | [] | no_license | kearyo/DM-Helper | 0afa7069a7e6668f011201465d8a724ec469d401 | a90a6bc6d9c3f8f9fe7062a61f1b2888a67e9a50 | refs/heads/master | 2023-05-06T11:49:01.848611 | 2021-05-24T00:38:59 | 2021-05-24T00:38:59 | 80,240,954 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,742 | h | StdAfx.h | // stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#define WINVER 0x0600
#define NO_WARN_MBCS_MFC_DEPRECATION TRUE
#if !defined(AFX_STDAFX_H__4FB782FA_3217_4CF2_9FC1_BAAB14031BE1__INCLUDED_)
#define AFX_STDAFX_H__4FB782FA_3217_4CF2_9FC1_BAAB14031BE1__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <afxtempl.h>
#include <afxmt.h>
#include <afxsock.h> // MFC socket extensions
#include <Unknwn.h>
#include <windows.h>
#include <objidl.h>
#define ULONG_PTR ULONG
#include <gdiplus.h>
using namespace Gdiplus;
#pragma comment (lib,"Gdiplus.lib")
#include <gdiplusbitmap.h>
#include "ImageEx.h"
#include <memory>
#include <vector>
#include <map>
#include "DM Helper Common.h"
#include "ColoredListCtrl.h"
#include "TransparentListBox.h"
#include <curl.h>
#include "SoundClass.h"
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__4FB782FA_3217_4CF2_9FC1_BAAB14031BE1__INCLUDED_)
#include <afxcontrolbars.h>
#include <afxdisp.h>
#include <afxdisp.h>
#include <afxdisp.h>
//#include <afxcontrolbars.h>
// #include <afxcontrolbars.h>
|
c196c1fd02d54e511cb3aead0e9c755f692da271 | 989d0607aa4c767b01d3faeb3cb595f12c7e80f8 | /Classes/SelectMakeOponentFewPlacesPlayer.cpp | cc8d768af60471c84455e885623b649e1c9f50ae | [] | no_license | sukesan1984/Reversi | c56dc6293f352c9a82b35960481d34fd8473fc79 | 325bc43545da0e8c6d89aa6eb223e9494c5b7c37 | refs/heads/master | 2021-01-02T13:00:24.092160 | 2015-05-17T08:32:57 | 2015-05-17T08:32:57 | 34,162,892 | 0 | 0 | null | 2015-04-29T07:58:54 | 2015-04-18T11:11:04 | C++ | UTF-8 | C++ | false | false | 1,301 | cpp | SelectMakeOponentFewPlacesPlayer.cpp | //
// SelectMakeOponentFewPlacesPlayer.cpp
// Reversi
//
// Created by Kosuke Takami on 2015/05/04.
//
//
#include "SelectMakeOponentFewPlacesPlayer.h"
#include <math.h>
SelectMakeOponentFewPlacesPlayer::SelectMakeOponentFewPlacesPlayer(Color playerColor, BoardModel* boardModel) : NPCBase(playerColor, boardModel)
{
}
void SelectMakeOponentFewPlacesPlayer::setTurn(bool isMyTurn)
{
this->isMyTurn = isMyTurn;
if(!this->isMyTurn)
{
return;
}
std::vector<Point> marked = this->boardModel->getMarked();
std::vector<Point>::iterator it;
int count = 64; //盤面の数
Point candidate;
for(it = marked.begin(); it != marked.end(); ++it)
{
int nextCount = this->boardModel->getNextPuttableNum(it->x, it->y, this->playerColor);
cocos2d::log("next:%d", nextCount);
if(nextCount < count)
{
candidate.x = it->x;
cocos2d::log("x:%d", it->x);
candidate.y = it->y;
cocos2d::log("y:%d", it->y);
count = nextCount;
} else if(nextCount == count) {
if(rand() % 2 == 0)
{
candidate.x = it->x;
candidate.y = it->y;
}
}
}
this->put(candidate.x, candidate.y);
return;
} |
bdc67db26b8ec682e4ce9d3a14015a5adb35cc5f | 0f648895eea27b664e9a32035f136ae6ce98bbb4 | /include/Request.h | 8b85ed6817e76ca4a291ae6971a43e587bd15f6a | [] | no_license | Oxbern/CCube_API | d20889a1a3151ca89c1e9e04051fe450a73b4a05 | 003a1030657ca7b0e44e0f5194caf9b1428e7aec | refs/heads/master | 2020-12-24T21:21:31.926289 | 2016-06-10T08:59:41 | 2016-06-10T08:59:41 | 59,000,420 | 4 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,344 | h | Request.h | #ifndef REQUEST_H
#define REQUEST_H
/*!
* \file Request.h
* \brief Creates a request
* \version 1.0
*/
#include "OutgoingMessage.h"
/*!
* \class Request
* \brief Class representing the creation of a request
* which is an outgoing message which does not need an answer from the device
*/
class Request : public OutgoingMessage
{
public :
/*!
* \brief Constructor
*
* Creates a request which can be represented by one single buffer
* or by a list of SIZE_BUFFER sized buffers
*
* \param idDevice device's ID
* \param sizeData message's size
* \param code operation code
*/
Request(uint8_t idDevice, uint8_t sizeData, uint8_t code);
/*!
* \brief Destructor
*
*/
~Request();
/*!
* \fn void encode(uint8_t *dataToEncode)
* \brief Fills the buffers with the data and calculates and sets the crc
*
* Fills the buffers with the data
* if size(dataToEncode) > sizeData,
* only the first sizeData values of dataToEncode will be encoded
*
* \param dataToEncode the data which fills a message
*/
void encode(uint8_t *dataToEncode);
/*!
* \brief Sends a message to a device
* \param c controller
* \return true if the request was sent properly
*/
bool send(Controller &c);
};
#endif
|
6fd0d2de5d40757ffc4074021017bac9d0fbd2db | 386e9266dbd463d261d99a77a7cbe22a80ed61b0 | /K1.SE.14.04.19/Task1/WebPage.h | 32ae07ad7e209ecd11f49db7c68f131b0505f554 | [] | no_license | andy489/Object_Oriented_Programming_with_CPP | f629c756d3aa784a5a5c6fe9fccc6a85717d1633 | 492266ecd99b0de36b3f941b3397d2b69b195206 | refs/heads/master | 2023-04-17T05:38:52.159375 | 2021-05-04T18:16:23 | 2021-05-04T18:16:23 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 505 | h | WebPage.h | #pragma once
#include <iostream>
#include <cstring>
class WebPage
{
char* address = nullptr;
char* ip = nullptr;
public:
WebPage();
WebPage(const char* address, const char* ip);
WebPage(const WebPage& w);
WebPage& operator=(const WebPage& w);
~WebPage();
const char *getAd() const;
const char *getIp() const;
void setAd(const char* a);
void setIp(const char* i);
friend std::ostream& operator<<(std::ostream&, const WebPage&);
friend std::istream& operator>>(std::istream&, WebPage&);
};
|
9b8f41e04c7aea7c790aa701adc787d9508972b2 | 045dc74e7ab07663d815de1d979bd34567066c67 | /common/src/ThreadPool.cpp | 85f12747abfe1e2d81272495f78535e33e84ea4e | [] | no_license | izissise/r-type | 29ad2bd8bd80d6a9cb12020a7b6b937aec754efb | 3f243944596eeb9351db98694c09b0aebd819fdc | refs/heads/master | 2020-04-02T03:11:26.448429 | 2015-05-26T13:25:31 | 2015-05-26T13:25:31 | 26,535,921 | 0 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 862 | cpp | ThreadPool.cpp | #include <iostream>
#include <algorithm>
#include "ThreadPool.hpp"
void ThreadPool::ThreadLoop() {
do {
std::function<void()> task;
{
std::unique_lock<std::mutex> lock(_mutex);
_condition.wait(lock, [this]() {return _stop || !_tasks.empty();});
if (_stop && _tasks.empty()) {
return;
}
task = std::move(_tasks.front());
_tasks.pop();
}
task();
}
while (true);
}
ThreadPool::ThreadPool(size_t nb_thread)
: _stop(false)
{
for (size_t i = 0; i < nb_thread; ++i)
{
_threads.emplace_back(std::thread(&ThreadPool::ThreadLoop, this));
}
}
ThreadPool::~ThreadPool()
{
{
std::unique_lock<std::mutex> lock(_mutex);
_stop = true;
}
_condition.notify_all();
std::for_each(_threads.begin(), _threads.end(), [](std::thread & t) {t.join();});
}
|
3aaaa234081135fa1b6412eb2c0a5e7a5c82eed5 | 5b136479f345e974c20f803d2793e9a470ba33a5 | /src/Texture1D.hpp | b0e2633673c22bafce12c8eddc651cde0cd0666c | [
"WTFPL"
] | permissive | bwiberg/bwgl | d8b0a2810fd3cc644dfab08d5ee3d8fe5e785401 | d3b2cfe2baa723565ad055ea03ca5567d290e8c7 | refs/heads/master | 2021-03-22T02:16:48.810703 | 2016-11-11T04:54:11 | 2016-11-11T04:54:11 | 70,266,340 | 8 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 916 | hpp | Texture1D.hpp | #pragma once
#include <gl3.h>
namespace bwgl {
class Texture1D {
public:
Texture1D(GLenum target, GLenum pixelFormat, GLenum dataType);
~Texture1D();
void bind();
void unbind();
void loadImage1D(GLint internalFormat,
GLsizei width,
const GLvoid *data);
void loadImage1D(GLint internalFormat,
GLsizei width,
const GLvoid *data,
GLint mipmapLevel);
void parameter(GLenum pname, GLfloat param);
void parameter(GLenum pname, GLint param);
void parameter(GLenum pname, const GLfloat *params);
void parameter(GLenum pname, const GLint *params);
GLuint ID() const;
private:
GLuint mID;
GLenum mTarget;
GLenum mPixelFormat;
GLenum mDataType;
};
} |
66fe9ab4411f0f5087eeab1e95910ab1d12f0d44 | 82e20300e4024ec92415fb5923b5e933fdf260a5 | /CENG242/the3/test/mali/Miner.cpp | 20aba90383c6e0f9cea90a3ddc5ee1409509ab78 | [] | no_license | ugurduzel/ODTU-METU | 154e77c03324d09621a03e135db095db496e6889 | 67c87a49ea06d99367916d7f41cb042ec137ac36 | refs/heads/master | 2020-03-27T01:09:28.201973 | 2018-12-05T12:14:42 | 2018-12-05T12:14:42 | 145,682,922 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,904 | cpp | Miner.cpp | #include "Miner.h"
/*
YOU MUST WRITE THE IMPLEMENTATIONS OF THE REQUESTED FUNCTIONS
IN THIS FILE. START YOUR IMPLEMENTATIONS BELOW THIS LINE
*/
int Miner::getNextAvailableBlockchainID() const {
return depo.size();
}
bool Miner::is_in(Koin* p) const {
int l = soft_forked_list.size();
for(int i=0; i<l; ++i) {
if(soft_forked_list[i]==p) {
return true;
}
}
return false;
}
bool Miner::is_inb(Blockchain *p) const {
int l = soft_forked.size();
for(int i=0; i<l; ++i) {
if(soft_forked[i]==p) {
return true;
}
}
return false;
}
Miner::Miner(std::string name) : nm(name), depo(1,NULL), soft_forked(1,NULL), soft_forked_list(1,NULL) {
depo.pop_back();
soft_forked.pop_back();
soft_forked_list.pop_back();
}
void Miner::createNewBlockchain() {
depo.push_back(new Blockchain(getNextAvailableBlockchainID()));
}
Miner::~Miner() {
int k = soft_forked.size();
for(int i=0; i<k; ++i) {
(soft_forked[i])->setHead(NULL);
}
int l = depo.size();
for(int i=0; i<l; ++i) {
delete depo[i];
}
k = soft_forked.size();
depo.clear();
soft_forked.clear();
soft_forked_list.clear();
}
void Miner::mineUntil(int cycleCount) {
int l = depo.size();
for(int i=0; i<l; ++i) {
for(int j=0; j<cycleCount; ++j) {
++(*(depo[i]));
}
}
}
void Miner::demineUntil(int cycleCount) {
int l = depo.size();
for(int i=0; i<l; ++i) {
for(int j=0; j<cycleCount; ++j) {
if(is_in((depo[i])->son())) {
break;
}
--(*(depo[i]));
}
}
}
double Miner::getTotalValue() const {
int l = depo.size();
double thot = 0;
for(int i=0; i<l; ++i) {
if(is_inb(depo[i])) {
continue;
}
thot+=(depo[i])->getTotalValue();
}
return thot;
}
long Miner::getBlockchainCount() const {
return depo.size();
}
Blockchain* Miner::operator[](int id) const {
int l = depo.size();
for(int i=0; i<l; ++i) {
if((depo[i])->getID()==id) {
return depo[i];
}
}
return NULL;
}
std::ostream& operator<<(std::ostream& os, const Miner& miner) {
os<<std::fixed<<std::setprecision(Utilizer::koinPrintPrecision());
os<<"-- BEGIN MINER --\nMiner name: "<<miner.nm<<"\nBlockchain count: ";
os<<miner.getBlockchainCount()<<"\nTotal value: "<<miner.getTotalValue() << "\n\n";
int l = (miner.depo).size();
for(int i=0; i<l; ++i) {
os<<*((miner.depo)[i])<<"\n";
}
os<<"\n-- END MINER --\n";
return os;
}
bool Miner::softFork(int blockchainID) {
Blockchain *b = (*this)[blockchainID], *n;
if(!b) { return false;}
Koin *k=b->son();
int m = getNextAvailableBlockchainID();
n = new Blockchain(m, k);
depo.push_back(n);
soft_forked.push_back(n);
soft_forked_list.push_back(k);
return true;
}
bool Miner::hardFork(int blockchainID) {
Blockchain *b = (*this)[blockchainID], *n;
if(!b) { return false;}
Koin *k=new Koin((b->son())->getValue());
int m = getNextAvailableBlockchainID();
n = new Blockchain(m, k);
depo.push_back(n);
return true;
}
|
b7574c1dd3c4cfbc9a5841c2f3dae7efa9e74f2d | 967cb26a828b7dc35e8c1b6e9f43f9c6310ec263 | /DreamLandWars/FindEmploymant/Soldier.h | 411dc28c3d1fd2b6d078b0bd16d179c3bd2d63d1 | [] | no_license | YuusukeSeki/Presentation-for-employed | bbbab96404f208be129f4c2aafe5d2d897454f0f | d7f149bbd65065c4866f4d829ebad22006692058 | refs/heads/master | 2020-04-03T08:35:10.998568 | 2018-11-22T11:24:02 | 2018-11-22T11:24:02 | 155,138,085 | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 2,394 | h | Soldier.h | // author : yusuke seki
// data : 20181114
#ifndef SOLDIER_H_
#define SOLDIER_H_
#include "Unit.h"
class Player;
class BasePoint;
class Tower;
class Castle;
class Collider;
class SoldierCommander;
class SoldierGauge;
class Soldier : public Unit
{
public:
enum Report
{
NONE,
DEATH,
FIND_FRIEND_UNIT,
FIND_ENEMY_UNIT,
FIND_ENEMY_BASEPOINT,
BREAK_ENEMY_BASEPOINT,
};
enum Behave
{
STOP,
RUN,
ATTACK,
ASSAULT,
BENDING_BACKWORD, // 仰け反る
DOWN,
RISEUP,
DEAD,
};
public:
Soldier();
~Soldier();
static void CreateBuffer(const unsigned int& _numCreate);
static Soldier* Create(SoldierCommander* _soldierCommander);
static Soldier* DynamicCreate(SoldierCommander* _soldierCommander); // 動的生成
void Init(SoldierCommander* _soldierCommander);
void Uninit();
void Update();
void Draw();
void Stop();
void Run();
void ShotBullet();
void AssaultBasePoint();
void Death();
void FormLine();
void SetDestination(const D3DXVECTOR3& _destinationPoint);
void SetEndFront(const D3DXVECTOR3& _endFront);
void SetTargetBasePoint(BasePoint* _targetBasePoint);
//Behave GetBehave();
Collider* GetSearchCollider();
void ReceiveDamage(const float& _damage, Unit* _unit = nullptr);
void SetActive(const bool& _isActive);
private:
static Soldier* FindNonActiveSoldier();
Unit* FindNearEnemy();
Soldier* FindNearEnemySoldier();
Player* FindNearEnemyPlayer();
BasePoint* SearchEnemyBasePoint();
Tower* SearchEnemyTower();
Castle* SearchEnemyCastle();
bool IsSearchEnemyUnit();
bool IsSearchEnemySoldier();
bool IsSearchEnemyPlayer();
bool IsSearchFriendSoldier();
bool CollidedBasePoint();
void BreakBasePoint();
static const float kBreakPower_;
static const float kAttackPower_;
static const float kMaxHp_;
static const float kSearchEnemyRange_;
static const float kSearchFriendRange_;
float speed_;
float currentHp_;
float maxHp_;
float attackPower_;
float defencePower_;
float breakPower_;
float searchEnemyRange_;
float searchFriendRange_;
D3DXVECTOR3 destination_;
D3DXVECTOR3 frontAfterArriveDestination_;
BasePoint* targetBasePoint_;
SoldierCommander* parentCommander_;
Collider* searchEnemyCollider_;
Collider* searchFriendCollider_;
SoldierGauge* hpGauge_;
};
#endif
|
db705c3d75f21ba00ad9cc565155c0111068ff23 | 5b171fb70f3c1a8080ecf170e980a196b322aa8b | /Merging_Array _in_UnSorted_Order.cpp | 3e775629edcb3b6ddeee24fcf7608707905aa7a9 | [] | no_license | KaushalVasava/DataStructure | f8385e5379bf5d9fb7653776c6116045c15c83a7 | 4c5a593d6bc930e1e57616fee3bd10cbee3c1846 | refs/heads/main | 2023-04-23T15:58:40.536908 | 2021-05-04T09:11:51 | 2021-05-04T09:11:51 | 364,192,100 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 997 | cpp | Merging_Array _in_UnSorted_Order.cpp | //Sorting of two sorted array
//and /* code */ aa vadu merging of two unsorted array.
#include<iostream>
using namespace std;
int main(){
int i,j,n,m;
int a[10],b[10],c[10];
cout<<"\nEnter the size of first array:";
cin>>n;
cout<<"\nEnter the Elements in the array:";
//int a[]={3,2,4,5,6,8};
//int b[]={1,9,7};
for(i=0;i<n;i++)
cin>>a[i];
for(i=0;i<n;i++)
cout<<a[i]<<" ";
cout<<endl;
cout<<"\nEnter the size of second array:";
cin>>m;
cout<<"\nEnter the Elements in the array:";
for(i=0;i<m;i++)
cin>>b[i];
for(i=0;i<m;i++)
cout<<b[i]<<" ";
for(i=0;i<n;i++)
c[i]=a[i];
for(i=0;i<m;i++)
c[i+n]=b[i];
cout<<endl;
/*for(i=0;i<m+n;i++){ //comment karvani jyare merging of two unsotred array hoy.
for(j=i;j<m+n;j++){
if(c[i]>c[j])
{
int temp=c[i];
c[i]=c[j];
c[j]=temp;
}
}
}*/
for(i=0;i<m+n;i++)
cout<<c[i]<<" ";
return 0;
}
|
d706a4adf99c1b94d9117a30fdb2f82a41b6163f | 090aae666f6b061a112ba1674c109e09df6a72fb | /FBWinSDK/FBWinSDK.Shared/FacebookLoginButton.h | 8317aa45bc3d90cb8c61b8d18fa0bd7118c29757 | [] | no_license | PhamNguyen/FacebookUWP | f201bb91613207d40c2dc967d8b5839cdff875a8 | ab29897130a9ef1883f72720696e93ebc224b42d | refs/heads/master | 2021-01-10T16:07:05.694925 | 2016-02-23T08:17:46 | 2016-02-23T08:17:46 | 52,340,657 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,796 | h | FacebookLoginButton.h | //******************************************************************************
//
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
//
// This code is licensed under the MIT License (MIT).
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
//******************************************************************************
#pragma once
#include "FacebookSession.h"
#include "FacebookPermissions.h"
namespace Facebook
{
ref class FBLoginButton;
public delegate void FBLoginErrorHandler(
FBLoginButton^ sender,
FBError^ error
);
public delegate void FetchedUserInfoHandler(
FBLoginButton^ sender,
Facebook::Graph::FBUser^ userInfo
);
public delegate void ShowingLoggedInUserHandler(
FBLoginButton^ sender
);
public delegate void ShowingLoggedOutUserHandler(
FBLoginButton^ sender
);
/*!\brief Control providing a Facebook Login/Logout button
*/
public ref class FBLoginButton sealed : Windows::UI::Xaml::Controls::Button
{
public:
FBLoginButton();
virtual void OnApplyTemplate(
) override;
////! Login via Facebook app or Web
//property SessionLoginBehavior LoginBehavior
//{
// SessionLoginBehavior get();
// void set(SessionLoginBehavior);
//}
//! Publish permissions for user
property Facebook::FBPermissions^
Permissions
{
Facebook::FBPermissions^ get();
void set(Facebook::FBPermissions^ value);
}
//! Ask for read permissions at login
void InitWithPermissions(
Facebook::FBPermissions^ permissions
);
event FBLoginErrorHandler^ FBLoginError;
event FetchedUserInfoHandler^ FetchedUserInfo;
event ShowingLoggedInUserHandler^ ShowingLoggedInUser;
event ShowingLoggedOutUserHandler^ ShowingLoggedOutUser;
private:
Platform::String^ GetPermissions(
);
void OnClick(
Platform::Object^ sender,
Windows::UI::Xaml::RoutedEventArgs^ e
);
Facebook::FBPermissions^ _permissions;
};
}
|
e881e008bb3c8e0d087aa91059fbb32de83bdd81 | 04e0fccc6fed4a310b78017cf505a4f5e4dbb3b4 | /Lab4/Controller.cpp | b2f23240c4dc73a1f7a3d997d21f5c37f9cd63c2 | [] | no_license | viorelyo/Pharmacy_Administration | f75d4362dc55a9c2bf3d4e631d6a5db74840c5e4 | e6098e65e85bffcae96fe8aa8991c20d1a4f5876 | refs/heads/master | 2020-04-22T00:18:16.616957 | 2019-02-10T13:17:39 | 2019-02-10T13:17:39 | 169,974,716 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,883 | cpp | Controller.cpp | #include "stdafx.h"
#include "Controller.h"
#include <algorithm>
Controller::Controller()
{
}
Controller::Controller(const Repository& r)
{
this->repo = r;
}
Controller::~Controller()
{
}
Repository Controller::getRepo() const
{
return repo;
}
void Controller::addMedToRepository(const std::string & nume, double concentr, double quant, double pret)
{
int pos = repo.findByID(nume, concentr); //verifies by ID if the product is in repo
if (pos == -1) {
Med obj(nume, concentr, quant, pret); //if not -> creates a new one
this->repo.addMed(obj);
}
else
{
Med obj = repo.getMedicines()[pos]; //otherwise updates the existing one (quantity is increased)
obj.setQuantity(quant);
this->repo.addMed(obj);
}
}
int Controller::updateMedInRepository(const std::string & nume, double concentr, double newPrice)
{
int pos = repo.findByID(nume, concentr);
if (pos == -1)
return -1;
else { //if the object is in repo then updates it
Med obj = repo.getMedicines()[pos];
this->repo.updateMed(obj, newPrice);
return 0;
}
}
int Controller::DeleteFromRepository(const std::string & nume, double concentr, double quantDel)
{
return this->repo.deleteMed(nume, concentr, quantDel);
}
std::vector<Med> Controller::shortSupply(double items) const
{
/*
* Returns vector of Med Objects that has quantity below than that indicated - items
*/
std::vector<Med> allMedicines = this->repo.getMedicines();
std::vector<Med> runOut; //vector with found objects
for (unsigned i = 0; i < allMedicines.size(); i++) {
if (allMedicines[i].getQuantity() < items)
runOut.push_back(allMedicines[i]);
}
return runOut;
}
std::vector<Med> Controller::searchName(const std::string & search) const
{
/*
* Search for available Medications containing given string - search
* If the given string - search is empty return all Medications
* Otherwise returns the vector with founded objects
* The vector is sorted alphabetically
*/
std::vector<Med> allMedicines = this->repo.getMedicines();
std::sort(allMedicines.begin(), allMedicines.end(), [](const Med& lName, const Med& rName) { return lName.getName() < rName.getName(); }); //sort alphabetically (use specified comparator (lambda function)
if (search == "")
return allMedicines;
else
{
std::vector<Med> found; //vector with found objects
for (unsigned i = 0; i < allMedicines.size(); i++) {
if (allMedicines[i].getName().std::string::find(search) != std::string::npos)
found.push_back(allMedicines[i]);
}
return found;
}
}
std::vector<std::vector<Med>> Controller::groupPrice() const
{
/*
* Group Medications by their price
* Returns a matrix of Med Objects
*/
std::vector<Med> allMedicines = this->repo.getMedicines();
std::vector<std::vector<Med>> group; //declaration of "Matrix"
if (allMedicines.size() != 0) { //the algorithm is done in case there are objects in allMedicine vector
std::vector<Med> line; //declaration of vector that will be inserted in "Matrix"
unsigned j = 0;
bool added = false;
line.push_back(allMedicines[0]); //init first element of "Matrix"
group.push_back(line);
for (unsigned i = 1; i < allMedicines.size(); i++) {
j = 0;
added = false;
while (j < group.size()) { //size of group is variable (is permanently modified)
if (allMedicines[i].getPrice() == group[j][0].getPrice()) { //First object of each line-vector contains the group-price
group[j].push_back(allMedicines[i]); //Append an object to it's coresponding price-group
added = true;
break;
}
j++;
}
if (!added) {
std::vector<Med> lines; //Declare the vector-lines that will be inserted in group-"Matrix"
lines.push_back(allMedicines[i]);
group.push_back(lines); //Insert each line-vector
}
}
}
return group;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.