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
743904e6018392cec4c92b3fe632752ffd6e26f4
b115fdbac9e80d46de97fd2bda09ecb7a2541b82
/neo/idlib/math/Simd_Generic.cpp
5901ba0bb026861638c72ab579d477eed718f43e
[]
no_license
jmarshall23/Doom3
2cb78fe81624bce2b7c68af8bcf437973331621f
f12b34e6fbca8a49dc751f71960e1b609ed8d9cd
refs/heads/master
2023-05-25T14:30:49.193713
2023-05-18T19:33:27
2023-05-18T19:33:27
360,633,347
6
2
null
null
null
null
UTF-8
C++
false
false
81,158
cpp
Simd_Generic.cpp
/* =========================================================================== Doom 3 GPL Source Code Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?). Doom 3 Source Code is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Doom 3 Source Code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>. In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. =========================================================================== */ #include "precompiled.h" #pragma hdrstop #include "Simd_Generic.h" //=============================================================== // // Generic implementation of idSIMDProcessor // //=============================================================== #define UNROLL1(Y) { int _IX; for (_IX=0;_IX<count;_IX++) {Y(_IX);} } #define UNROLL2(Y) { int _IX, _NM = count&0xfffffffe; for (_IX=0;_IX<_NM;_IX+=2){Y(_IX+0);Y(_IX+1);} if (_IX < count) {Y(_IX);}} #define UNROLL4(Y) { int _IX, _NM = count&0xfffffffc; for (_IX=0;_IX<_NM;_IX+=4){Y(_IX+0);Y(_IX+1);Y(_IX+2);Y(_IX+3);}for(;_IX<count;_IX++){Y(_IX);}} #define UNROLL8(Y) { int _IX, _NM = count&0xfffffff8; for (_IX=0;_IX<_NM;_IX+=8){Y(_IX+0);Y(_IX+1);Y(_IX+2);Y(_IX+3);Y(_IX+4);Y(_IX+5);Y(_IX+6);Y(_IX+7);} _NM = count&0xfffffffe; for(;_IX<_NM;_IX+=2){Y(_IX); Y(_IX+1);} if (_IX < count) {Y(_IX);} } #ifdef _DEBUG #define NODEFAULT default: assert( 0 ) #elif _WIN32 #define NODEFAULT default: __assume( 0 ) #else #define NODEFAULT #endif /* ============ idSIMD_Generic::GetName ============ */ const char * idSIMD_Generic::GetName( void ) const { return "generic code"; } /* ============ idSIMD_Generic::Add dst[i] = constant + src[i]; ============ */ void VPCALL idSIMD_Generic::Add( float *dst, const float constant, const float *src, const int count ) { #define OPER(X) dst[(X)] = src[(X)] + constant; UNROLL4(OPER) #undef OPER } /* ============ idSIMD_Generic::Add dst[i] = src0[i] + src1[i]; ============ */ void VPCALL idSIMD_Generic::Add( float *dst, const float *src0, const float *src1, const int count ) { #define OPER(X) dst[(X)] = src0[(X)] + src1[(X)]; UNROLL4(OPER) #undef OPER } /* ============ idSIMD_Generic::Sub dst[i] = constant - src[i]; ============ */ void VPCALL idSIMD_Generic::Sub( float *dst, const float constant, const float *src, const int count ) { double c = constant; #define OPER(X) dst[(X)] = c - src[(X)]; UNROLL4(OPER) #undef OPER } /* ============ idSIMD_Generic::Sub dst[i] = src0[i] - src1[i]; ============ */ void VPCALL idSIMD_Generic::Sub( float *dst, const float *src0, const float *src1, const int count ) { #define OPER(X) dst[(X)] = src0[(X)] - src1[(X)]; UNROLL4(OPER) #undef OPER } /* ============ idSIMD_Generic::Mul dst[i] = constant * src[i]; ============ */ void VPCALL idSIMD_Generic::Mul( float *dst, const float constant, const float *src0, const int count) { double c = constant; #define OPER(X) (dst[(X)] = (c * src0[(X)])) UNROLL4(OPER) #undef OPER } /* ============ idSIMD_Generic::Mul dst[i] = src0[i] * src1[i]; ============ */ void VPCALL idSIMD_Generic::Mul( float *dst, const float *src0, const float *src1, const int count ) { #define OPER(X) (dst[(X)] = src0[(X)] * src1[(X)]) UNROLL4(OPER) #undef OPER } /* ============ idSIMD_Generic::Div dst[i] = constant / divisor[i]; ============ */ void VPCALL idSIMD_Generic::Div( float *dst, const float constant, const float *divisor, const int count ) { double c = constant; #define OPER(X) (dst[(X)] = (c / divisor[(X)])) UNROLL4(OPER) #undef OPER } /* ============ idSIMD_Generic::Div dst[i] = src0[i] / src1[i]; ============ */ void VPCALL idSIMD_Generic::Div( float *dst, const float *src0, const float *src1, const int count ) { #define OPER(X) (dst[(X)] = src0[(X)] / src1[(X)]) UNROLL4(OPER) #undef OPER } /* ============ idSIMD_Generic::MulAdd dst[i] += constant * src[i]; ============ */ void VPCALL idSIMD_Generic::MulAdd( float *dst, const float constant, const float *src, const int count ) { double c = constant; #define OPER(X) (dst[(X)] += c * src[(X)]) UNROLL4(OPER) #undef OPER } /* ============ idSIMD_Generic::MulAdd dst[i] += src0[i] * src1[i]; ============ */ void VPCALL idSIMD_Generic::MulAdd( float *dst, const float *src0, const float *src1, const int count ) { #define OPER(X) (dst[(X)] += src0[(X)] * src1[(X)]) UNROLL4(OPER) #undef OPER } /* ============ idSIMD_Generic::MulSub dst[i] -= constant * src[i]; ============ */ void VPCALL idSIMD_Generic::MulSub( float *dst, const float constant, const float *src, const int count ) { double c = constant; #define OPER(X) (dst[(X)] -= c * src[(X)]) UNROLL4(OPER) #undef OPER } /* ============ idSIMD_Generic::MulSub dst[i] -= src0[i] * src1[i]; ============ */ void VPCALL idSIMD_Generic::MulSub( float *dst, const float *src0, const float *src1, const int count ) { #define OPER(X) (dst[(X)] -= src0[(X)] * src1[(X)]) UNROLL4(OPER) #undef OPER } /* ============ idSIMD_Generic::Dot dst[i] = constant * src[i]; ============ */ void VPCALL idSIMD_Generic::Dot( float *dst, const idVec3 &constant, const idVec3 *src, const int count ) { #define OPER(X) dst[(X)] = constant * src[(X)]; UNROLL1(OPER) #undef OPER } /* ============ idSIMD_Generic::Dot dst[i] = constant * src[i].Normal() + src[i][3]; ============ */ void VPCALL idSIMD_Generic::Dot( float *dst, const idVec3 &constant, const idPlane *src, const int count ) { #define OPER(X) dst[(X)] = constant * src[(X)].Normal() + src[(X)][3]; UNROLL1(OPER) #undef OPER } /* ============ idSIMD_Generic::Dot dst[i] = constant * src[i].xyz; ============ */ void VPCALL idSIMD_Generic::Dot( float *dst, const idVec3 &constant, const idDrawVert *src, const int count ) { #define OPER(X) dst[(X)] = constant * src[(X)].xyz; UNROLL1(OPER) #undef OPER } /* ============ idSIMD_Generic::Dot dst[i] = constant.Normal() * src[i] + constant[3]; ============ */ void VPCALL idSIMD_Generic::Dot( float *dst, const idPlane &constant, const idVec3 *src, const int count ) { #define OPER(X) dst[(X)] = constant.Normal() * src[(X)] + constant[3]; UNROLL1(OPER) #undef OPER } /* ============ idSIMD_Generic::Dot dst[i] = constant.Normal() * src[i].Normal() + constant[3] * src[i][3]; ============ */ void VPCALL idSIMD_Generic::Dot( float *dst, const idPlane &constant, const idPlane *src, const int count ) { #define OPER(X) dst[(X)] = constant.Normal() * src[(X)].Normal() + constant[3] * src[(X)][3]; UNROLL1(OPER) #undef OPER } /* ============ idSIMD_Generic::Dot dst[i] = constant.Normal() * src[i].xyz + constant[3]; ============ */ void VPCALL idSIMD_Generic::Dot( float *dst, const idPlane &constant, const idDrawVert *src, const int count ) { #define OPER(X) dst[(X)] = constant.Normal() * src[(X)].xyz + constant[3]; UNROLL1(OPER) #undef OPER } /* ============ idSIMD_Generic::Dot dst[i] = src0[i] * src1[i]; ============ */ void VPCALL idSIMD_Generic::Dot( float *dst, const idVec3 *src0, const idVec3 *src1, const int count ) { #define OPER(X) dst[(X)] = src0[(X)] * src1[(X)]; UNROLL1(OPER) #undef OPER } /* ============ idSIMD_Generic::Dot dot = src1[0] * src2[0] + src1[1] * src2[1] + src1[2] * src2[2] + ... ============ */ void VPCALL idSIMD_Generic::Dot( float &dot, const float *src1, const float *src2, const int count ) { #if 1 switch( count ) { case 0: { dot = 0.0f; return; } case 1: { dot = src1[0] * src2[0]; return; } case 2: { dot = src1[0] * src2[0] + src1[1] * src2[1]; return; } case 3: { dot = src1[0] * src2[0] + src1[1] * src2[1] + src1[2] * src2[2]; return; } default: { int i; double s0, s1, s2, s3; s0 = src1[0] * src2[0]; s1 = src1[1] * src2[1]; s2 = src1[2] * src2[2]; s3 = src1[3] * src2[3]; for ( i = 4; i < count-7; i += 8 ) { s0 += src1[i+0] * src2[i+0]; s1 += src1[i+1] * src2[i+1]; s2 += src1[i+2] * src2[i+2]; s3 += src1[i+3] * src2[i+3]; s0 += src1[i+4] * src2[i+4]; s1 += src1[i+5] * src2[i+5]; s2 += src1[i+6] * src2[i+6]; s3 += src1[i+7] * src2[i+7]; } switch( count - i ) { NODEFAULT; case 7: s0 += src1[i+6] * src2[i+6]; case 6: s1 += src1[i+5] * src2[i+5]; case 5: s2 += src1[i+4] * src2[i+4]; case 4: s3 += src1[i+3] * src2[i+3]; case 3: s0 += src1[i+2] * src2[i+2]; case 2: s1 += src1[i+1] * src2[i+1]; case 1: s2 += src1[i+0] * src2[i+0]; case 0: break; } double sum; sum = s3; sum += s2; sum += s1; sum += s0; dot = sum; } } #else dot = 0.0f; for ( i = 0; i < count; i++ ) { dot += src1[i] * src2[i]; } #endif } /* ============ idSIMD_Generic::CmpGT dst[i] = src0[i] > constant; ============ */ void VPCALL idSIMD_Generic::CmpGT( byte *dst, const float *src0, const float constant, const int count ) { #define OPER(X) dst[(X)] = src0[(X)] > constant; UNROLL4(OPER) #undef OPER } /* ============ idSIMD_Generic::CmpGT dst[i] |= ( src0[i] > constant ) << bitNum; ============ */ void VPCALL idSIMD_Generic::CmpGT( byte *dst, const byte bitNum, const float *src0, const float constant, const int count ) { #define OPER(X) dst[(X)] |= ( src0[(X)] > constant ) << bitNum; UNROLL4(OPER) #undef OPER } /* ============ idSIMD_Generic::CmpGE dst[i] = src0[i] >= constant; ============ */ void VPCALL idSIMD_Generic::CmpGE( byte *dst, const float *src0, const float constant, const int count ) { #define OPER(X) dst[(X)] = src0[(X)] >= constant; UNROLL4(OPER) #undef OPER } /* ============ idSIMD_Generic::CmpGE dst[i] |= ( src0[i] >= constant ) << bitNum; ============ */ void VPCALL idSIMD_Generic::CmpGE( byte *dst, const byte bitNum, const float *src0, const float constant, const int count ) { #define OPER(X) dst[(X)] |= ( src0[(X)] >= constant ) << bitNum; UNROLL4(OPER) #undef OPER } /* ============ idSIMD_Generic::CmpLT dst[i] = src0[i] < constant; ============ */ void VPCALL idSIMD_Generic::CmpLT( byte *dst, const float *src0, const float constant, const int count ) { #define OPER(X) dst[(X)] = src0[(X)] < constant; UNROLL4(OPER) #undef OPER } /* ============ idSIMD_Generic::CmpLT dst[i] |= ( src0[i] < constant ) << bitNum; ============ */ void VPCALL idSIMD_Generic::CmpLT( byte *dst, const byte bitNum, const float *src0, const float constant, const int count ) { #define OPER(X) dst[(X)] |= ( src0[(X)] < constant ) << bitNum; UNROLL4(OPER) #undef OPER } /* ============ idSIMD_Generic::CmpLE dst[i] = src0[i] <= constant; ============ */ void VPCALL idSIMD_Generic::CmpLE( byte *dst, const float *src0, const float constant, const int count ) { #define OPER(X) dst[(X)] = src0[(X)] <= constant; UNROLL4(OPER) #undef OPER } /* ============ idSIMD_Generic::CmpLE dst[i] |= ( src0[i] <= constant ) << bitNum; ============ */ void VPCALL idSIMD_Generic::CmpLE( byte *dst, const byte bitNum, const float *src0, const float constant, const int count ) { #define OPER(X) dst[(X)] |= ( src0[(X)] <= constant ) << bitNum; UNROLL4(OPER) #undef OPER } /* ============ idSIMD_Generic::MinMax ============ */ void VPCALL idSIMD_Generic::MinMax( float &min, float &max, const float *src, const int count ) { min = idMath::INFINITY; max = -idMath::INFINITY; #define OPER(X) if ( src[(X)] < min ) {min = src[(X)];} if ( src[(X)] > max ) {max = src[(X)];} UNROLL1(OPER) #undef OPER } /* ============ idSIMD_Generic::MinMax ============ */ void VPCALL idSIMD_Generic::MinMax( idVec2 &min, idVec2 &max, const idVec2 *src, const int count ) { min[0] = min[1] = idMath::INFINITY; max[0] = max[1] = -idMath::INFINITY; #define OPER(X) const idVec2 &v = src[(X)]; if ( v[0] < min[0] ) { min[0] = v[0]; } if ( v[0] > max[0] ) { max[0] = v[0]; } if ( v[1] < min[1] ) { min[1] = v[1]; } if ( v[1] > max[1] ) { max[1] = v[1]; } UNROLL1(OPER) #undef OPER } /* ============ idSIMD_Generic::MinMax ============ */ void VPCALL idSIMD_Generic::MinMax( idVec3 &min, idVec3 &max, const idVec3 *src, const int count ) { min[0] = min[1] = min[2] = idMath::INFINITY; max[0] = max[1] = max[2] = -idMath::INFINITY; #define OPER(X) const idVec3 &v = src[(X)]; if ( v[0] < min[0] ) { min[0] = v[0]; } if ( v[0] > max[0] ) { max[0] = v[0]; } if ( v[1] < min[1] ) { min[1] = v[1]; } if ( v[1] > max[1] ) { max[1] = v[1]; } if ( v[2] < min[2] ) { min[2] = v[2]; } if ( v[2] > max[2] ) { max[2] = v[2]; } UNROLL1(OPER) #undef OPER } /* ============ idSIMD_Generic::MinMax ============ */ void VPCALL idSIMD_Generic::MinMax( idVec3 &min, idVec3 &max, const idDrawVert *src, const int count ) { min[0] = min[1] = min[2] = idMath::INFINITY; max[0] = max[1] = max[2] = -idMath::INFINITY; #define OPER(X) const idVec3 &v = src[(X)].xyz; if ( v[0] < min[0] ) { min[0] = v[0]; } if ( v[0] > max[0] ) { max[0] = v[0]; } if ( v[1] < min[1] ) { min[1] = v[1]; } if ( v[1] > max[1] ) { max[1] = v[1]; } if ( v[2] < min[2] ) { min[2] = v[2]; } if ( v[2] > max[2] ) { max[2] = v[2]; } UNROLL1(OPER) #undef OPER } /* ============ idSIMD_Generic::MinMax ============ */ void VPCALL idSIMD_Generic::MinMax( idVec3 &min, idVec3 &max, const idDrawVert *src, const int *indexes, const int count ) { min[0] = min[1] = min[2] = idMath::INFINITY; max[0] = max[1] = max[2] = -idMath::INFINITY; #define OPER(X) const idVec3 &v = src[indexes[(X)]].xyz; if ( v[0] < min[0] ) { min[0] = v[0]; } if ( v[0] > max[0] ) { max[0] = v[0]; } if ( v[1] < min[1] ) { min[1] = v[1]; } if ( v[1] > max[1] ) { max[1] = v[1]; } if ( v[2] < min[2] ) { min[2] = v[2]; } if ( v[2] > max[2] ) { max[2] = v[2]; } UNROLL1(OPER) #undef OPER } /* ============ idSIMD_Generic::Clamp ============ */ void VPCALL idSIMD_Generic::Clamp( float *dst, const float *src, const float min, const float max, const int count ) { #define OPER(X) dst[(X)] = src[(X)] < min ? min : src[(X)] > max ? max : src[(X)]; UNROLL1(OPER) #undef OPER } /* ============ idSIMD_Generic::ClampMin ============ */ void VPCALL idSIMD_Generic::ClampMin( float *dst, const float *src, const float min, const int count ) { #define OPER(X) dst[(X)] = src[(X)] < min ? min : src[(X)]; UNROLL1(OPER) #undef OPER } /* ============ idSIMD_Generic::ClampMax ============ */ void VPCALL idSIMD_Generic::ClampMax( float *dst, const float *src, const float max, const int count ) { #define OPER(X) dst[(X)] = src[(X)] > max ? max : src[(X)]; UNROLL1(OPER) #undef OPER } /* ================ idSIMD_Generic::Memcpy ================ */ void VPCALL idSIMD_Generic::Memcpy( void *dst, const void *src, const int count ) { memcpy( dst, src, count ); } /* ================ idSIMD_Generic::Memset ================ */ void VPCALL idSIMD_Generic::Memset( void *dst, const int val, const int count ) { memset( dst, val, count ); } /* ============ idSIMD_Generic::Zero16 ============ */ void VPCALL idSIMD_Generic::Zero16( float *dst, const int count ) { memset( dst, 0, count * sizeof( float ) ); } /* ============ idSIMD_Generic::Negate16 ============ */ void VPCALL idSIMD_Generic::Negate16( float *dst, const int count ) { unsigned int *ptr = reinterpret_cast<unsigned int *>(dst); #define OPER(X) ptr[(X)] ^= ( 1 << 31 ) // IEEE 32 bits float sign bit UNROLL1(OPER) #undef OPER } /* ============ idSIMD_Generic::Copy16 ============ */ void VPCALL idSIMD_Generic::Copy16( float *dst, const float *src, const int count ) { #define OPER(X) dst[(X)] = src[(X)] UNROLL1(OPER) #undef OPER } /* ============ idSIMD_Generic::Add16 ============ */ void VPCALL idSIMD_Generic::Add16( float *dst, const float *src1, const float *src2, const int count ) { #define OPER(X) dst[(X)] = src1[(X)] + src2[(X)] UNROLL1(OPER) #undef OPER } /* ============ idSIMD_Generic::Sub16 ============ */ void VPCALL idSIMD_Generic::Sub16( float *dst, const float *src1, const float *src2, const int count ) { #define OPER(X) dst[(X)] = src1[(X)] - src2[(X)] UNROLL1(OPER) #undef OPER } /* ============ idSIMD_Generic::Mul16 ============ */ void VPCALL idSIMD_Generic::Mul16( float *dst, const float *src1, const float constant, const int count ) { #define OPER(X) dst[(X)] = src1[(X)] * constant UNROLL1(OPER) #undef OPER } /* ============ idSIMD_Generic::AddAssign16 ============ */ void VPCALL idSIMD_Generic::AddAssign16( float *dst, const float *src, const int count ) { #define OPER(X) dst[(X)] += src[(X)] UNROLL1(OPER) #undef OPER } /* ============ idSIMD_Generic::SubAssign16 ============ */ void VPCALL idSIMD_Generic::SubAssign16( float *dst, const float *src, const int count ) { #define OPER(X) dst[(X)] -= src[(X)] UNROLL1(OPER) #undef OPER } /* ============ idSIMD_Generic::MulAssign16 ============ */ void VPCALL idSIMD_Generic::MulAssign16( float *dst, const float constant, const int count ) { #define OPER(X) dst[(X)] *= constant UNROLL1(OPER) #undef OPER } /* ============ idSIMD_Generic::MatX_MultiplyVecX ============ */ void VPCALL idSIMD_Generic::MatX_MultiplyVecX( idVecX &dst, const idMatX &mat, const idVecX &vec ) { int i, j, numRows; const float *mPtr, *vPtr; float *dstPtr; assert( vec.GetSize() >= mat.GetNumColumns() ); assert( dst.GetSize() >= mat.GetNumRows() ); mPtr = mat.ToFloatPtr(); vPtr = vec.ToFloatPtr(); dstPtr = dst.ToFloatPtr(); numRows = mat.GetNumRows(); switch( mat.GetNumColumns() ) { case 1: for ( i = 0; i < numRows; i++ ) { dstPtr[i] = mPtr[0] * vPtr[0]; mPtr++; } break; case 2: for ( i = 0; i < numRows; i++ ) { dstPtr[i] = mPtr[0] * vPtr[0] + mPtr[1] * vPtr[1]; mPtr += 2; } break; case 3: for ( i = 0; i < numRows; i++ ) { dstPtr[i] = mPtr[0] * vPtr[0] + mPtr[1] * vPtr[1] + mPtr[2] * vPtr[2]; mPtr += 3; } break; case 4: for ( i = 0; i < numRows; i++ ) { dstPtr[i] = mPtr[0] * vPtr[0] + mPtr[1] * vPtr[1] + mPtr[2] * vPtr[2] + mPtr[3] * vPtr[3]; mPtr += 4; } break; case 5: for ( i = 0; i < numRows; i++ ) { dstPtr[i] = mPtr[0] * vPtr[0] + mPtr[1] * vPtr[1] + mPtr[2] * vPtr[2] + mPtr[3] * vPtr[3] + mPtr[4] * vPtr[4]; mPtr += 5; } break; case 6: for ( i = 0; i < numRows; i++ ) { dstPtr[i] = mPtr[0] * vPtr[0] + mPtr[1] * vPtr[1] + mPtr[2] * vPtr[2] + mPtr[3] * vPtr[3] + mPtr[4] * vPtr[4] + mPtr[5] * vPtr[5]; mPtr += 6; } break; default: int numColumns = mat.GetNumColumns(); for ( i = 0; i < numRows; i++ ) { float sum = mPtr[0] * vPtr[0]; for ( j = 1; j < numColumns; j++ ) { sum += mPtr[j] * vPtr[j]; } dstPtr[i] = sum; mPtr += numColumns; } break; } } /* ============ idSIMD_Generic::MatX_MultiplyAddVecX ============ */ void VPCALL idSIMD_Generic::MatX_MultiplyAddVecX( idVecX &dst, const idMatX &mat, const idVecX &vec ) { int i, j, numRows; const float *mPtr, *vPtr; float *dstPtr; assert( vec.GetSize() >= mat.GetNumColumns() ); assert( dst.GetSize() >= mat.GetNumRows() ); mPtr = mat.ToFloatPtr(); vPtr = vec.ToFloatPtr(); dstPtr = dst.ToFloatPtr(); numRows = mat.GetNumRows(); switch( mat.GetNumColumns() ) { case 1: for ( i = 0; i < numRows; i++ ) { dstPtr[i] += mPtr[0] * vPtr[0]; mPtr++; } break; case 2: for ( i = 0; i < numRows; i++ ) { dstPtr[i] += mPtr[0] * vPtr[0] + mPtr[1] * vPtr[1]; mPtr += 2; } break; case 3: for ( i = 0; i < numRows; i++ ) { dstPtr[i] += mPtr[0] * vPtr[0] + mPtr[1] * vPtr[1] + mPtr[2] * vPtr[2]; mPtr += 3; } break; case 4: for ( i = 0; i < numRows; i++ ) { dstPtr[i] += mPtr[0] * vPtr[0] + mPtr[1] * vPtr[1] + mPtr[2] * vPtr[2] + mPtr[3] * vPtr[3]; mPtr += 4; } break; case 5: for ( i = 0; i < numRows; i++ ) { dstPtr[i] += mPtr[0] * vPtr[0] + mPtr[1] * vPtr[1] + mPtr[2] * vPtr[2] + mPtr[3] * vPtr[3] + mPtr[4] * vPtr[4]; mPtr += 5; } break; case 6: for ( i = 0; i < numRows; i++ ) { dstPtr[i] += mPtr[0] * vPtr[0] + mPtr[1] * vPtr[1] + mPtr[2] * vPtr[2] + mPtr[3] * vPtr[3] + mPtr[4] * vPtr[4] + mPtr[5] * vPtr[5]; mPtr += 6; } break; default: int numColumns = mat.GetNumColumns(); for ( i = 0; i < numRows; i++ ) { float sum = mPtr[0] * vPtr[0]; for ( j = 1; j < numColumns; j++ ) { sum += mPtr[j] * vPtr[j]; } dstPtr[i] += sum; mPtr += numColumns; } break; } } /* ============ idSIMD_Generic::MatX_MultiplySubVecX ============ */ void VPCALL idSIMD_Generic::MatX_MultiplySubVecX( idVecX &dst, const idMatX &mat, const idVecX &vec ) { int i, j, numRows; const float *mPtr, *vPtr; float *dstPtr; assert( vec.GetSize() >= mat.GetNumColumns() ); assert( dst.GetSize() >= mat.GetNumRows() ); mPtr = mat.ToFloatPtr(); vPtr = vec.ToFloatPtr(); dstPtr = dst.ToFloatPtr(); numRows = mat.GetNumRows(); switch( mat.GetNumColumns() ) { case 1: for ( i = 0; i < numRows; i++ ) { dstPtr[i] -= mPtr[0] * vPtr[0]; mPtr++; } break; case 2: for ( i = 0; i < numRows; i++ ) { dstPtr[i] -= mPtr[0] * vPtr[0] + mPtr[1] * vPtr[1]; mPtr += 2; } break; case 3: for ( i = 0; i < numRows; i++ ) { dstPtr[i] -= mPtr[0] * vPtr[0] + mPtr[1] * vPtr[1] + mPtr[2] * vPtr[2]; mPtr += 3; } break; case 4: for ( i = 0; i < numRows; i++ ) { dstPtr[i] -= mPtr[0] * vPtr[0] + mPtr[1] * vPtr[1] + mPtr[2] * vPtr[2] + mPtr[3] * vPtr[3]; mPtr += 4; } break; case 5: for ( i = 0; i < numRows; i++ ) { dstPtr[i] -= mPtr[0] * vPtr[0] + mPtr[1] * vPtr[1] + mPtr[2] * vPtr[2] + mPtr[3] * vPtr[3] + mPtr[4] * vPtr[4]; mPtr += 5; } break; case 6: for ( i = 0; i < numRows; i++ ) { dstPtr[i] -= mPtr[0] * vPtr[0] + mPtr[1] * vPtr[1] + mPtr[2] * vPtr[2] + mPtr[3] * vPtr[3] + mPtr[4] * vPtr[4] + mPtr[5] * vPtr[5]; mPtr += 6; } break; default: int numColumns = mat.GetNumColumns(); for ( i = 0; i < numRows; i++ ) { float sum = mPtr[0] * vPtr[0]; for ( j = 1; j < numColumns; j++ ) { sum += mPtr[j] * vPtr[j]; } dstPtr[i] -= sum; mPtr += numColumns; } break; } } /* ============ idSIMD_Generic::MatX_TransposeMultiplyVecX ============ */ void VPCALL idSIMD_Generic::MatX_TransposeMultiplyVecX( idVecX &dst, const idMatX &mat, const idVecX &vec ) { int i, j, numColumns; const float *mPtr, *vPtr; float *dstPtr; assert( vec.GetSize() >= mat.GetNumRows() ); assert( dst.GetSize() >= mat.GetNumColumns() ); mPtr = mat.ToFloatPtr(); vPtr = vec.ToFloatPtr(); dstPtr = dst.ToFloatPtr(); numColumns = mat.GetNumColumns(); switch( mat.GetNumRows() ) { case 1: for ( i = 0; i < numColumns; i++ ) { dstPtr[i] = *(mPtr) * vPtr[0]; mPtr++; } break; case 2: for ( i = 0; i < numColumns; i++ ) { dstPtr[i] = *(mPtr) * vPtr[0] + *(mPtr+numColumns) * vPtr[1]; mPtr++; } break; case 3: for ( i = 0; i < numColumns; i++ ) { dstPtr[i] = *(mPtr) * vPtr[0] + *(mPtr+numColumns) * vPtr[1] + *(mPtr+2*numColumns) * vPtr[2]; mPtr++; } break; case 4: for ( i = 0; i < numColumns; i++ ) { dstPtr[i] = *(mPtr) * vPtr[0] + *(mPtr+numColumns) * vPtr[1] + *(mPtr+2*numColumns) * vPtr[2] + *(mPtr+3*numColumns) * vPtr[3]; mPtr++; } break; case 5: for ( i = 0; i < numColumns; i++ ) { dstPtr[i] = *(mPtr) * vPtr[0] + *(mPtr+numColumns) * vPtr[1] + *(mPtr+2*numColumns) * vPtr[2] + *(mPtr+3*numColumns) * vPtr[3] + *(mPtr+4*numColumns) * vPtr[4]; mPtr++; } break; case 6: for ( i = 0; i < numColumns; i++ ) { dstPtr[i] = *(mPtr) * vPtr[0] + *(mPtr+numColumns) * vPtr[1] + *(mPtr+2*numColumns) * vPtr[2] + *(mPtr+3*numColumns) * vPtr[3] + *(mPtr+4*numColumns) * vPtr[4] + *(mPtr+5*numColumns) * vPtr[5]; mPtr++; } break; default: int numRows = mat.GetNumRows(); for ( i = 0; i < numColumns; i++ ) { mPtr = mat.ToFloatPtr() + i; float sum = mPtr[0] * vPtr[0]; for ( j = 1; j < numRows; j++ ) { mPtr += numColumns; sum += mPtr[0] * vPtr[j]; } dstPtr[i] = sum; } break; } } /* ============ idSIMD_Generic::MatX_TransposeMultiplyAddVecX ============ */ void VPCALL idSIMD_Generic::MatX_TransposeMultiplyAddVecX( idVecX &dst, const idMatX &mat, const idVecX &vec ) { int i, j, numColumns; const float *mPtr, *vPtr; float *dstPtr; assert( vec.GetSize() >= mat.GetNumRows() ); assert( dst.GetSize() >= mat.GetNumColumns() ); mPtr = mat.ToFloatPtr(); vPtr = vec.ToFloatPtr(); dstPtr = dst.ToFloatPtr(); numColumns = mat.GetNumColumns(); switch( mat.GetNumRows() ) { case 1: for ( i = 0; i < numColumns; i++ ) { dstPtr[i] += *(mPtr) * vPtr[0]; mPtr++; } break; case 2: for ( i = 0; i < numColumns; i++ ) { dstPtr[i] += *(mPtr) * vPtr[0] + *(mPtr+numColumns) * vPtr[1]; mPtr++; } break; case 3: for ( i = 0; i < numColumns; i++ ) { dstPtr[i] += *(mPtr) * vPtr[0] + *(mPtr+numColumns) * vPtr[1] + *(mPtr+2*numColumns) * vPtr[2]; mPtr++; } break; case 4: for ( i = 0; i < numColumns; i++ ) { dstPtr[i] += *(mPtr) * vPtr[0] + *(mPtr+numColumns) * vPtr[1] + *(mPtr+2*numColumns) * vPtr[2] + *(mPtr+3*numColumns) * vPtr[3]; mPtr++; } break; case 5: for ( i = 0; i < numColumns; i++ ) { dstPtr[i] += *(mPtr) * vPtr[0] + *(mPtr+numColumns) * vPtr[1] + *(mPtr+2*numColumns) * vPtr[2] + *(mPtr+3*numColumns) * vPtr[3] + *(mPtr+4*numColumns) * vPtr[4]; mPtr++; } break; case 6: for ( i = 0; i < numColumns; i++ ) { dstPtr[i] += *(mPtr) * vPtr[0] + *(mPtr+numColumns) * vPtr[1] + *(mPtr+2*numColumns) * vPtr[2] + *(mPtr+3*numColumns) * vPtr[3] + *(mPtr+4*numColumns) * vPtr[4] + *(mPtr+5*numColumns) * vPtr[5]; mPtr++; } break; default: int numRows = mat.GetNumRows(); for ( i = 0; i < numColumns; i++ ) { mPtr = mat.ToFloatPtr() + i; float sum = mPtr[0] * vPtr[0]; for ( j = 1; j < numRows; j++ ) { mPtr += numColumns; sum += mPtr[0] * vPtr[j]; } dstPtr[i] += sum; } break; } } /* ============ idSIMD_Generic::MatX_TransposeMultiplySubVecX ============ */ void VPCALL idSIMD_Generic::MatX_TransposeMultiplySubVecX( idVecX &dst, const idMatX &mat, const idVecX &vec ) { int i, numColumns; const float *mPtr, *vPtr; float *dstPtr; assert( vec.GetSize() >= mat.GetNumRows() ); assert( dst.GetSize() >= mat.GetNumColumns() ); mPtr = mat.ToFloatPtr(); vPtr = vec.ToFloatPtr(); dstPtr = dst.ToFloatPtr(); numColumns = mat.GetNumColumns(); switch( mat.GetNumRows() ) { case 1: for ( i = 0; i < numColumns; i++ ) { dstPtr[i] -= *(mPtr) * vPtr[0]; mPtr++; } break; case 2: for ( i = 0; i < numColumns; i++ ) { dstPtr[i] -= *(mPtr) * vPtr[0] + *(mPtr+numColumns) * vPtr[1]; mPtr++; } break; case 3: for ( i = 0; i < numColumns; i++ ) { dstPtr[i] -= *(mPtr) * vPtr[0] + *(mPtr+numColumns) * vPtr[1] + *(mPtr+2*numColumns) * vPtr[2]; mPtr++; } break; case 4: for ( i = 0; i < numColumns; i++ ) { dstPtr[i] -= *(mPtr) * vPtr[0] + *(mPtr+numColumns) * vPtr[1] + *(mPtr+2*numColumns) * vPtr[2] + *(mPtr+3*numColumns) * vPtr[3]; mPtr++; } break; case 5: for ( i = 0; i < numColumns; i++ ) { dstPtr[i] -= *(mPtr) * vPtr[0] + *(mPtr+numColumns) * vPtr[1] + *(mPtr+2*numColumns) * vPtr[2] + *(mPtr+3*numColumns) * vPtr[3] + *(mPtr+4*numColumns) * vPtr[4]; mPtr++; } break; case 6: for ( i = 0; i < numColumns; i++ ) { dstPtr[i] -= *(mPtr) * vPtr[0] + *(mPtr+numColumns) * vPtr[1] + *(mPtr+2*numColumns) * vPtr[2] + *(mPtr+3*numColumns) * vPtr[3] + *(mPtr+4*numColumns) * vPtr[4] + *(mPtr+5*numColumns) * vPtr[5]; mPtr++; } break; default: int numRows = mat.GetNumRows(); for ( i = 0; i < numColumns; i++ ) { mPtr = mat.ToFloatPtr() + i; float sum = mPtr[0] * vPtr[0]; for ( int j = 1; j < numRows; j++ ) { mPtr += numColumns; sum += mPtr[0] * vPtr[j]; } dstPtr[i] -= sum; } break; } } /* ============ idSIMD_Generic::MatX_MultiplyMatX optimizes the following matrix multiplications: NxN * Nx6 6xN * Nx6 Nx6 * 6xN 6x6 * 6xN with N in the range [1-6]. ============ */ void VPCALL idSIMD_Generic::MatX_MultiplyMatX( idMatX &dst, const idMatX &m1, const idMatX &m2 ) { int i, j, k, l, n; float *dstPtr; const float *m1Ptr, *m2Ptr; double sum; assert( m1.GetNumColumns() == m2.GetNumRows() ); dstPtr = dst.ToFloatPtr(); m1Ptr = m1.ToFloatPtr(); m2Ptr = m2.ToFloatPtr(); k = m1.GetNumRows(); l = m2.GetNumColumns(); switch( m1.GetNumColumns() ) { case 1: { if ( l == 6 ) { for ( i = 0; i < k; i++ ) { // Nx1 * 1x6 *dstPtr++ = m1Ptr[i] * m2Ptr[0]; *dstPtr++ = m1Ptr[i] * m2Ptr[1]; *dstPtr++ = m1Ptr[i] * m2Ptr[2]; *dstPtr++ = m1Ptr[i] * m2Ptr[3]; *dstPtr++ = m1Ptr[i] * m2Ptr[4]; *dstPtr++ = m1Ptr[i] * m2Ptr[5]; } return; } for ( i = 0; i < k; i++ ) { m2Ptr = m2.ToFloatPtr(); for ( j = 0; j < l; j++ ) { *dstPtr++ = m1Ptr[0] * m2Ptr[0]; m2Ptr++; } m1Ptr++; } break; } case 2: { if ( l == 6 ) { for ( i = 0; i < k; i++ ) { // Nx2 * 2x6 *dstPtr++ = m1Ptr[0] * m2Ptr[0] + m1Ptr[1] * m2Ptr[6]; *dstPtr++ = m1Ptr[0] * m2Ptr[1] + m1Ptr[1] * m2Ptr[7]; *dstPtr++ = m1Ptr[0] * m2Ptr[2] + m1Ptr[1] * m2Ptr[8]; *dstPtr++ = m1Ptr[0] * m2Ptr[3] + m1Ptr[1] * m2Ptr[9]; *dstPtr++ = m1Ptr[0] * m2Ptr[4] + m1Ptr[1] * m2Ptr[10]; *dstPtr++ = m1Ptr[0] * m2Ptr[5] + m1Ptr[1] * m2Ptr[11]; m1Ptr += 2; } return; } for ( i = 0; i < k; i++ ) { m2Ptr = m2.ToFloatPtr(); for ( j = 0; j < l; j++ ) { *dstPtr++ = m1Ptr[0] * m2Ptr[0] + m1Ptr[1] * m2Ptr[l]; m2Ptr++; } m1Ptr += 2; } break; } case 3: { if ( l == 6 ) { for ( i = 0; i < k; i++ ) { // Nx3 * 3x6 *dstPtr++ = m1Ptr[0] * m2Ptr[0] + m1Ptr[1] * m2Ptr[6] + m1Ptr[2] * m2Ptr[12]; *dstPtr++ = m1Ptr[0] * m2Ptr[1] + m1Ptr[1] * m2Ptr[7] + m1Ptr[2] * m2Ptr[13]; *dstPtr++ = m1Ptr[0] * m2Ptr[2] + m1Ptr[1] * m2Ptr[8] + m1Ptr[2] * m2Ptr[14]; *dstPtr++ = m1Ptr[0] * m2Ptr[3] + m1Ptr[1] * m2Ptr[9] + m1Ptr[2] * m2Ptr[15]; *dstPtr++ = m1Ptr[0] * m2Ptr[4] + m1Ptr[1] * m2Ptr[10] + m1Ptr[2] * m2Ptr[16]; *dstPtr++ = m1Ptr[0] * m2Ptr[5] + m1Ptr[1] * m2Ptr[11] + m1Ptr[2] * m2Ptr[17]; m1Ptr += 3; } return; } for ( i = 0; i < k; i++ ) { m2Ptr = m2.ToFloatPtr(); for ( j = 0; j < l; j++ ) { *dstPtr++ = m1Ptr[0] * m2Ptr[0] + m1Ptr[1] * m2Ptr[l] + m1Ptr[2] * m2Ptr[2*l]; m2Ptr++; } m1Ptr += 3; } break; } case 4: { if ( l == 6 ) { for ( i = 0; i < k; i++ ) { // Nx4 * 4x6 *dstPtr++ = m1Ptr[0] * m2Ptr[0] + m1Ptr[1] * m2Ptr[6] + m1Ptr[2] * m2Ptr[12] + m1Ptr[3] * m2Ptr[18]; *dstPtr++ = m1Ptr[0] * m2Ptr[1] + m1Ptr[1] * m2Ptr[7] + m1Ptr[2] * m2Ptr[13] + m1Ptr[3] * m2Ptr[19]; *dstPtr++ = m1Ptr[0] * m2Ptr[2] + m1Ptr[1] * m2Ptr[8] + m1Ptr[2] * m2Ptr[14] + m1Ptr[3] * m2Ptr[20]; *dstPtr++ = m1Ptr[0] * m2Ptr[3] + m1Ptr[1] * m2Ptr[9] + m1Ptr[2] * m2Ptr[15] + m1Ptr[3] * m2Ptr[21]; *dstPtr++ = m1Ptr[0] * m2Ptr[4] + m1Ptr[1] * m2Ptr[10] + m1Ptr[2] * m2Ptr[16] + m1Ptr[3] * m2Ptr[22]; *dstPtr++ = m1Ptr[0] * m2Ptr[5] + m1Ptr[1] * m2Ptr[11] + m1Ptr[2] * m2Ptr[17] + m1Ptr[3] * m2Ptr[23]; m1Ptr += 4; } return; } for ( i = 0; i < k; i++ ) { m2Ptr = m2.ToFloatPtr(); for ( j = 0; j < l; j++ ) { *dstPtr++ = m1Ptr[0] * m2Ptr[0] + m1Ptr[1] * m2Ptr[l] + m1Ptr[2] * m2Ptr[2*l] + m1Ptr[3] * m2Ptr[3*l]; m2Ptr++; } m1Ptr += 4; } break; } case 5: { if ( l == 6 ) { for ( i = 0; i < k; i++ ) { // Nx5 * 5x6 *dstPtr++ = m1Ptr[0] * m2Ptr[0] + m1Ptr[1] * m2Ptr[6] + m1Ptr[2] * m2Ptr[12] + m1Ptr[3] * m2Ptr[18] + m1Ptr[4] * m2Ptr[24]; *dstPtr++ = m1Ptr[0] * m2Ptr[1] + m1Ptr[1] * m2Ptr[7] + m1Ptr[2] * m2Ptr[13] + m1Ptr[3] * m2Ptr[19] + m1Ptr[4] * m2Ptr[25]; *dstPtr++ = m1Ptr[0] * m2Ptr[2] + m1Ptr[1] * m2Ptr[8] + m1Ptr[2] * m2Ptr[14] + m1Ptr[3] * m2Ptr[20] + m1Ptr[4] * m2Ptr[26]; *dstPtr++ = m1Ptr[0] * m2Ptr[3] + m1Ptr[1] * m2Ptr[9] + m1Ptr[2] * m2Ptr[15] + m1Ptr[3] * m2Ptr[21] + m1Ptr[4] * m2Ptr[27]; *dstPtr++ = m1Ptr[0] * m2Ptr[4] + m1Ptr[1] * m2Ptr[10] + m1Ptr[2] * m2Ptr[16] + m1Ptr[3] * m2Ptr[22] + m1Ptr[4] * m2Ptr[28]; *dstPtr++ = m1Ptr[0] * m2Ptr[5] + m1Ptr[1] * m2Ptr[11] + m1Ptr[2] * m2Ptr[17] + m1Ptr[3] * m2Ptr[23] + m1Ptr[4] * m2Ptr[29]; m1Ptr += 5; } return; } for ( i = 0; i < k; i++ ) { m2Ptr = m2.ToFloatPtr(); for ( j = 0; j < l; j++ ) { *dstPtr++ = m1Ptr[0] * m2Ptr[0] + m1Ptr[1] * m2Ptr[l] + m1Ptr[2] * m2Ptr[2*l] + m1Ptr[3] * m2Ptr[3*l] + m1Ptr[4] * m2Ptr[4*l]; m2Ptr++; } m1Ptr += 5; } break; } case 6: { switch( k ) { case 1: { if ( l == 1 ) { // 1x6 * 6x1 dstPtr[0] = m1Ptr[0] * m2Ptr[0] + m1Ptr[1] * m2Ptr[1] + m1Ptr[2] * m2Ptr[2] + m1Ptr[3] * m2Ptr[3] + m1Ptr[4] * m2Ptr[4] + m1Ptr[5] * m2Ptr[5]; return; } break; } case 2: { if ( l == 2 ) { // 2x6 * 6x2 for ( i = 0; i < 2; i++ ) { for ( j = 0; j < 2; j++ ) { *dstPtr = m1Ptr[0] * m2Ptr[ 0 * 2 + j ] + m1Ptr[1] * m2Ptr[ 1 * 2 + j ] + m1Ptr[2] * m2Ptr[ 2 * 2 + j ] + m1Ptr[3] * m2Ptr[ 3 * 2 + j ] + m1Ptr[4] * m2Ptr[ 4 * 2 + j ] + m1Ptr[5] * m2Ptr[ 5 * 2 + j ]; dstPtr++; } m1Ptr += 6; } return; } break; } case 3: { if ( l == 3 ) { // 3x6 * 6x3 for ( i = 0; i < 3; i++ ) { for ( j = 0; j < 3; j++ ) { *dstPtr = m1Ptr[0] * m2Ptr[ 0 * 3 + j ] + m1Ptr[1] * m2Ptr[ 1 * 3 + j ] + m1Ptr[2] * m2Ptr[ 2 * 3 + j ] + m1Ptr[3] * m2Ptr[ 3 * 3 + j ] + m1Ptr[4] * m2Ptr[ 4 * 3 + j ] + m1Ptr[5] * m2Ptr[ 5 * 3 + j ]; dstPtr++; } m1Ptr += 6; } return; } break; } case 4: { if ( l == 4 ) { // 4x6 * 6x4 for ( i = 0; i < 4; i++ ) { for ( j = 0; j < 4; j++ ) { *dstPtr = m1Ptr[0] * m2Ptr[ 0 * 4 + j ] + m1Ptr[1] * m2Ptr[ 1 * 4 + j ] + m1Ptr[2] * m2Ptr[ 2 * 4 + j ] + m1Ptr[3] * m2Ptr[ 3 * 4 + j ] + m1Ptr[4] * m2Ptr[ 4 * 4 + j ] + m1Ptr[5] * m2Ptr[ 5 * 4 + j ]; dstPtr++; } m1Ptr += 6; } return; } } case 5: { if ( l == 5 ) { // 5x6 * 6x5 for ( i = 0; i < 5; i++ ) { for ( j = 0; j < 5; j++ ) { *dstPtr = m1Ptr[0] * m2Ptr[ 0 * 5 + j ] + m1Ptr[1] * m2Ptr[ 1 * 5 + j ] + m1Ptr[2] * m2Ptr[ 2 * 5 + j ] + m1Ptr[3] * m2Ptr[ 3 * 5 + j ] + m1Ptr[4] * m2Ptr[ 4 * 5 + j ] + m1Ptr[5] * m2Ptr[ 5 * 5 + j ]; dstPtr++; } m1Ptr += 6; } return; } } case 6: { switch( l ) { case 1: { // 6x6 * 6x1 for ( i = 0; i < 6; i++ ) { *dstPtr = m1Ptr[0] * m2Ptr[ 0 * 1 ] + m1Ptr[1] * m2Ptr[ 1 * 1 ] + m1Ptr[2] * m2Ptr[ 2 * 1 ] + m1Ptr[3] * m2Ptr[ 3 * 1 ] + m1Ptr[4] * m2Ptr[ 4 * 1 ] + m1Ptr[5] * m2Ptr[ 5 * 1 ]; dstPtr++; m1Ptr += 6; } return; } case 2: { // 6x6 * 6x2 for ( i = 0; i < 6; i++ ) { for ( j = 0; j < 2; j++ ) { *dstPtr = m1Ptr[0] * m2Ptr[ 0 * 2 + j ] + m1Ptr[1] * m2Ptr[ 1 * 2 + j ] + m1Ptr[2] * m2Ptr[ 2 * 2 + j ] + m1Ptr[3] * m2Ptr[ 3 * 2 + j ] + m1Ptr[4] * m2Ptr[ 4 * 2 + j ] + m1Ptr[5] * m2Ptr[ 5 * 2 + j ]; dstPtr++; } m1Ptr += 6; } return; } case 3: { // 6x6 * 6x3 for ( i = 0; i < 6; i++ ) { for ( j = 0; j < 3; j++ ) { *dstPtr = m1Ptr[0] * m2Ptr[ 0 * 3 + j ] + m1Ptr[1] * m2Ptr[ 1 * 3 + j ] + m1Ptr[2] * m2Ptr[ 2 * 3 + j ] + m1Ptr[3] * m2Ptr[ 3 * 3 + j ] + m1Ptr[4] * m2Ptr[ 4 * 3 + j ] + m1Ptr[5] * m2Ptr[ 5 * 3 + j ]; dstPtr++; } m1Ptr += 6; } return; } case 4: { // 6x6 * 6x4 for ( i = 0; i < 6; i++ ) { for ( j = 0; j < 4; j++ ) { *dstPtr = m1Ptr[0] * m2Ptr[ 0 * 4 + j ] + m1Ptr[1] * m2Ptr[ 1 * 4 + j ] + m1Ptr[2] * m2Ptr[ 2 * 4 + j ] + m1Ptr[3] * m2Ptr[ 3 * 4 + j ] + m1Ptr[4] * m2Ptr[ 4 * 4 + j ] + m1Ptr[5] * m2Ptr[ 5 * 4 + j ]; dstPtr++; } m1Ptr += 6; } return; } case 5: { // 6x6 * 6x5 for ( i = 0; i < 6; i++ ) { for ( j = 0; j < 5; j++ ) { *dstPtr = m1Ptr[0] * m2Ptr[ 0 * 5 + j ] + m1Ptr[1] * m2Ptr[ 1 * 5 + j ] + m1Ptr[2] * m2Ptr[ 2 * 5 + j ] + m1Ptr[3] * m2Ptr[ 3 * 5 + j ] + m1Ptr[4] * m2Ptr[ 4 * 5 + j ] + m1Ptr[5] * m2Ptr[ 5 * 5 + j ]; dstPtr++; } m1Ptr += 6; } return; } case 6: { // 6x6 * 6x6 for ( i = 0; i < 6; i++ ) { for ( j = 0; j < 6; j++ ) { *dstPtr = m1Ptr[0] * m2Ptr[ 0 * 6 + j ] + m1Ptr[1] * m2Ptr[ 1 * 6 + j ] + m1Ptr[2] * m2Ptr[ 2 * 6 + j ] + m1Ptr[3] * m2Ptr[ 3 * 6 + j ] + m1Ptr[4] * m2Ptr[ 4 * 6 + j ] + m1Ptr[5] * m2Ptr[ 5 * 6 + j ]; dstPtr++; } m1Ptr += 6; } return; } } } } for ( i = 0; i < k; i++ ) { m2Ptr = m2.ToFloatPtr(); for ( j = 0; j < l; j++ ) { *dstPtr++ = m1Ptr[0] * m2Ptr[0] + m1Ptr[1] * m2Ptr[l] + m1Ptr[2] * m2Ptr[2*l] + m1Ptr[3] * m2Ptr[3*l] + m1Ptr[4] * m2Ptr[4*l] + m1Ptr[5] * m2Ptr[5*l]; m2Ptr++; } m1Ptr += 6; } break; } default: { for ( i = 0; i < k; i++ ) { for ( j = 0; j < l; j++ ) { m2Ptr = m2.ToFloatPtr() + j; sum = m1Ptr[0] * m2Ptr[0]; for ( n = 1; n < m1.GetNumColumns(); n++ ) { m2Ptr += l; sum += m1Ptr[n] * m2Ptr[0]; } *dstPtr++ = sum; } m1Ptr += m1.GetNumColumns(); } break; } } } /* ============ idSIMD_Generic::MatX_TransposeMultiplyMatX optimizes the following tranpose matrix multiplications: Nx6 * NxN 6xN * 6x6 with N in the range [1-6]. ============ */ void VPCALL idSIMD_Generic::MatX_TransposeMultiplyMatX( idMatX &dst, const idMatX &m1, const idMatX &m2 ) { int i, j, k, l, n; float *dstPtr; const float *m1Ptr, *m2Ptr; double sum; assert( m1.GetNumRows() == m2.GetNumRows() ); m1Ptr = m1.ToFloatPtr(); m2Ptr = m2.ToFloatPtr(); dstPtr = dst.ToFloatPtr(); k = m1.GetNumColumns(); l = m2.GetNumColumns(); switch( m1.GetNumRows() ) { case 1: if ( k == 6 && l == 1 ) { // 1x6 * 1x1 for ( i = 0; i < 6; i++ ) { *dstPtr++ = m1Ptr[0] * m2Ptr[0]; m1Ptr++; } return; } for ( i = 0; i < k; i++ ) { m2Ptr = m2.ToFloatPtr(); for ( j = 0; j < l; j++ ) { *dstPtr++ = m1Ptr[0] * m2Ptr[0]; m2Ptr++; } m1Ptr++; } break; case 2: if ( k == 6 && l == 2 ) { // 2x6 * 2x2 for ( i = 0; i < 6; i++ ) { *dstPtr++ = m1Ptr[0*6] * m2Ptr[0*2+0] + m1Ptr[1*6] * m2Ptr[1*2+0]; *dstPtr++ = m1Ptr[0*6] * m2Ptr[0*2+1] + m1Ptr[1*6] * m2Ptr[1*2+1]; m1Ptr++; } return; } for ( i = 0; i < k; i++ ) { m2Ptr = m2.ToFloatPtr(); for ( j = 0; j < l; j++ ) { *dstPtr++ = m1Ptr[0] * m2Ptr[0] + m1Ptr[k] * m2Ptr[l]; m2Ptr++; } m1Ptr++; } break; case 3: if ( k == 6 && l == 3 ) { // 3x6 * 3x3 for ( i = 0; i < 6; i++ ) { *dstPtr++ = m1Ptr[0*6] * m2Ptr[0*3+0] + m1Ptr[1*6] * m2Ptr[1*3+0] + m1Ptr[2*6] * m2Ptr[2*3+0]; *dstPtr++ = m1Ptr[0*6] * m2Ptr[0*3+1] + m1Ptr[1*6] * m2Ptr[1*3+1] + m1Ptr[2*6] * m2Ptr[2*3+1]; *dstPtr++ = m1Ptr[0*6] * m2Ptr[0*3+2] + m1Ptr[1*6] * m2Ptr[1*3+2] + m1Ptr[2*6] * m2Ptr[2*3+2]; m1Ptr++; } return; } for ( i = 0; i < k; i++ ) { m2Ptr = m2.ToFloatPtr(); for ( j = 0; j < l; j++ ) { *dstPtr++ = m1Ptr[0] * m2Ptr[0] + m1Ptr[k] * m2Ptr[l] + m1Ptr[2*k] * m2Ptr[2*l]; m2Ptr++; } m1Ptr++; } break; case 4: if ( k == 6 && l == 4 ) { // 4x6 * 4x4 for ( i = 0; i < 6; i++ ) { *dstPtr++ = m1Ptr[0*6] * m2Ptr[0*4+0] + m1Ptr[1*6] * m2Ptr[1*4+0] + m1Ptr[2*6] * m2Ptr[2*4+0] + m1Ptr[3*6] * m2Ptr[3*4+0]; *dstPtr++ = m1Ptr[0*6] * m2Ptr[0*4+1] + m1Ptr[1*6] * m2Ptr[1*4+1] + m1Ptr[2*6] * m2Ptr[2*4+1] + m1Ptr[3*6] * m2Ptr[3*4+1]; *dstPtr++ = m1Ptr[0*6] * m2Ptr[0*4+2] + m1Ptr[1*6] * m2Ptr[1*4+2] + m1Ptr[2*6] * m2Ptr[2*4+2] + m1Ptr[3*6] * m2Ptr[3*4+2]; *dstPtr++ = m1Ptr[0*6] * m2Ptr[0*4+3] + m1Ptr[1*6] * m2Ptr[1*4+3] + m1Ptr[2*6] * m2Ptr[2*4+3] + m1Ptr[3*6] * m2Ptr[3*4+3]; m1Ptr++; } return; } for ( i = 0; i < k; i++ ) { m2Ptr = m2.ToFloatPtr(); for ( j = 0; j < l; j++ ) { *dstPtr++ = m1Ptr[0] * m2Ptr[0] + m1Ptr[k] * m2Ptr[l] + m1Ptr[2*k] * m2Ptr[2*l] + m1Ptr[3*k] * m2Ptr[3*l]; m2Ptr++; } m1Ptr++; } break; case 5: if ( k == 6 && l == 5 ) { // 5x6 * 5x5 for ( i = 0; i < 6; i++ ) { *dstPtr++ = m1Ptr[0*6] * m2Ptr[0*5+0] + m1Ptr[1*6] * m2Ptr[1*5+0] + m1Ptr[2*6] * m2Ptr[2*5+0] + m1Ptr[3*6] * m2Ptr[3*5+0] + m1Ptr[4*6] * m2Ptr[4*5+0]; *dstPtr++ = m1Ptr[0*6] * m2Ptr[0*5+1] + m1Ptr[1*6] * m2Ptr[1*5+1] + m1Ptr[2*6] * m2Ptr[2*5+1] + m1Ptr[3*6] * m2Ptr[3*5+1] + m1Ptr[4*6] * m2Ptr[4*5+1]; *dstPtr++ = m1Ptr[0*6] * m2Ptr[0*5+2] + m1Ptr[1*6] * m2Ptr[1*5+2] + m1Ptr[2*6] * m2Ptr[2*5+2] + m1Ptr[3*6] * m2Ptr[3*5+2] + m1Ptr[4*6] * m2Ptr[4*5+2]; *dstPtr++ = m1Ptr[0*6] * m2Ptr[0*5+3] + m1Ptr[1*6] * m2Ptr[1*5+3] + m1Ptr[2*6] * m2Ptr[2*5+3] + m1Ptr[3*6] * m2Ptr[3*5+3] + m1Ptr[4*6] * m2Ptr[4*5+3]; *dstPtr++ = m1Ptr[0*6] * m2Ptr[0*5+4] + m1Ptr[1*6] * m2Ptr[1*5+4] + m1Ptr[2*6] * m2Ptr[2*5+4] + m1Ptr[3*6] * m2Ptr[3*5+4] + m1Ptr[4*6] * m2Ptr[4*5+4]; m1Ptr++; } return; } for ( i = 0; i < k; i++ ) { m2Ptr = m2.ToFloatPtr(); for ( j = 0; j < l; j++ ) { *dstPtr++ = m1Ptr[0] * m2Ptr[0] + m1Ptr[k] * m2Ptr[l] + m1Ptr[2*k] * m2Ptr[2*l] + m1Ptr[3*k] * m2Ptr[3*l] + m1Ptr[4*k] * m2Ptr[4*l]; m2Ptr++; } m1Ptr++; } break; case 6: if ( l == 6 ) { switch( k ) { case 1: // 6x1 * 6x6 m2Ptr = m2.ToFloatPtr(); for ( j = 0; j < 6; j++ ) { *dstPtr++ = m1Ptr[0*1] * m2Ptr[0*6] + m1Ptr[1*1] * m2Ptr[1*6] + m1Ptr[2*1] * m2Ptr[2*6] + m1Ptr[3*1] * m2Ptr[3*6] + m1Ptr[4*1] * m2Ptr[4*6] + m1Ptr[5*1] * m2Ptr[5*6]; m2Ptr++; } return; case 2: // 6x2 * 6x6 for ( i = 0; i < 2; i++ ) { m2Ptr = m2.ToFloatPtr(); for ( j = 0; j < 6; j++ ) { *dstPtr++ = m1Ptr[0*2] * m2Ptr[0*6] + m1Ptr[1*2] * m2Ptr[1*6] + m1Ptr[2*2] * m2Ptr[2*6] + m1Ptr[3*2] * m2Ptr[3*6] + m1Ptr[4*2] * m2Ptr[4*6] + m1Ptr[5*2] * m2Ptr[5*6]; m2Ptr++; } m1Ptr++; } return; case 3: // 6x3 * 6x6 for ( i = 0; i < 3; i++ ) { m2Ptr = m2.ToFloatPtr(); for ( j = 0; j < 6; j++ ) { *dstPtr++ = m1Ptr[0*3] * m2Ptr[0*6] + m1Ptr[1*3] * m2Ptr[1*6] + m1Ptr[2*3] * m2Ptr[2*6] + m1Ptr[3*3] * m2Ptr[3*6] + m1Ptr[4*3] * m2Ptr[4*6] + m1Ptr[5*3] * m2Ptr[5*6]; m2Ptr++; } m1Ptr++; } return; case 4: // 6x4 * 6x6 for ( i = 0; i < 4; i++ ) { m2Ptr = m2.ToFloatPtr(); for ( j = 0; j < 6; j++ ) { *dstPtr++ = m1Ptr[0*4] * m2Ptr[0*6] + m1Ptr[1*4] * m2Ptr[1*6] + m1Ptr[2*4] * m2Ptr[2*6] + m1Ptr[3*4] * m2Ptr[3*6] + m1Ptr[4*4] * m2Ptr[4*6] + m1Ptr[5*4] * m2Ptr[5*6]; m2Ptr++; } m1Ptr++; } return; case 5: // 6x5 * 6x6 for ( i = 0; i < 5; i++ ) { m2Ptr = m2.ToFloatPtr(); for ( j = 0; j < 6; j++ ) { *dstPtr++ = m1Ptr[0*5] * m2Ptr[0*6] + m1Ptr[1*5] * m2Ptr[1*6] + m1Ptr[2*5] * m2Ptr[2*6] + m1Ptr[3*5] * m2Ptr[3*6] + m1Ptr[4*5] * m2Ptr[4*6] + m1Ptr[5*5] * m2Ptr[5*6]; m2Ptr++; } m1Ptr++; } return; case 6: // 6x6 * 6x6 for ( i = 0; i < 6; i++ ) { m2Ptr = m2.ToFloatPtr(); for ( j = 0; j < 6; j++ ) { *dstPtr++ = m1Ptr[0*6] * m2Ptr[0*6] + m1Ptr[1*6] * m2Ptr[1*6] + m1Ptr[2*6] * m2Ptr[2*6] + m1Ptr[3*6] * m2Ptr[3*6] + m1Ptr[4*6] * m2Ptr[4*6] + m1Ptr[5*6] * m2Ptr[5*6]; m2Ptr++; } m1Ptr++; } return; } } for ( i = 0; i < k; i++ ) { m2Ptr = m2.ToFloatPtr(); for ( j = 0; j < l; j++ ) { *dstPtr++ = m1Ptr[0] * m2Ptr[0] + m1Ptr[k] * m2Ptr[l] + m1Ptr[2*k] * m2Ptr[2*l] + m1Ptr[3*k] * m2Ptr[3*l] + m1Ptr[4*k] * m2Ptr[4*l] + m1Ptr[5*k] * m2Ptr[5*l]; m2Ptr++; } m1Ptr++; } break; default: for ( i = 0; i < k; i++ ) { for ( j = 0; j < l; j++ ) { m1Ptr = m1.ToFloatPtr() + i; m2Ptr = m2.ToFloatPtr() + j; sum = m1Ptr[0] * m2Ptr[0]; for ( n = 1; n < m1.GetNumRows(); n++ ) { m1Ptr += k; m2Ptr += l; sum += m1Ptr[0] * m2Ptr[0]; } *dstPtr++ = sum; } } break; } } /* ============ idSIMD_Generic::MatX_LowerTriangularSolve solves x in Lx = b for the n * n sub-matrix of L if skip > 0 the first skip elements of x are assumed to be valid already L has to be a lower triangular matrix with (implicit) ones on the diagonal x == b is allowed ============ */ void VPCALL idSIMD_Generic::MatX_LowerTriangularSolve( const idMatX &L, float *x, const float *b, const int n, int skip ) { #if 1 int nc; const float *lptr; if ( skip >= n ) { return; } lptr = L.ToFloatPtr(); nc = L.GetNumColumns(); // unrolled cases for n < 8 if ( n < 8 ) { #define NSKIP( n, s ) ((n<<3)|(s&7)) switch( NSKIP( n, skip ) ) { case NSKIP( 1, 0 ): x[0] = b[0]; return; case NSKIP( 2, 0 ): x[0] = b[0]; case NSKIP( 2, 1 ): x[1] = b[1] - lptr[1*nc+0] * x[0]; return; case NSKIP( 3, 0 ): x[0] = b[0]; case NSKIP( 3, 1 ): x[1] = b[1] - lptr[1*nc+0] * x[0]; case NSKIP( 3, 2 ): x[2] = b[2] - lptr[2*nc+0] * x[0] - lptr[2*nc+1] * x[1]; return; case NSKIP( 4, 0 ): x[0] = b[0]; case NSKIP( 4, 1 ): x[1] = b[1] - lptr[1*nc+0] * x[0]; case NSKIP( 4, 2 ): x[2] = b[2] - lptr[2*nc+0] * x[0] - lptr[2*nc+1] * x[1]; case NSKIP( 4, 3 ): x[3] = b[3] - lptr[3*nc+0] * x[0] - lptr[3*nc+1] * x[1] - lptr[3*nc+2] * x[2]; return; case NSKIP( 5, 0 ): x[0] = b[0]; case NSKIP( 5, 1 ): x[1] = b[1] - lptr[1*nc+0] * x[0]; case NSKIP( 5, 2 ): x[2] = b[2] - lptr[2*nc+0] * x[0] - lptr[2*nc+1] * x[1]; case NSKIP( 5, 3 ): x[3] = b[3] - lptr[3*nc+0] * x[0] - lptr[3*nc+1] * x[1] - lptr[3*nc+2] * x[2]; case NSKIP( 5, 4 ): x[4] = b[4] - lptr[4*nc+0] * x[0] - lptr[4*nc+1] * x[1] - lptr[4*nc+2] * x[2] - lptr[4*nc+3] * x[3]; return; case NSKIP( 6, 0 ): x[0] = b[0]; case NSKIP( 6, 1 ): x[1] = b[1] - lptr[1*nc+0] * x[0]; case NSKIP( 6, 2 ): x[2] = b[2] - lptr[2*nc+0] * x[0] - lptr[2*nc+1] * x[1]; case NSKIP( 6, 3 ): x[3] = b[3] - lptr[3*nc+0] * x[0] - lptr[3*nc+1] * x[1] - lptr[3*nc+2] * x[2]; case NSKIP( 6, 4 ): x[4] = b[4] - lptr[4*nc+0] * x[0] - lptr[4*nc+1] * x[1] - lptr[4*nc+2] * x[2] - lptr[4*nc+3] * x[3]; case NSKIP( 6, 5 ): x[5] = b[5] - lptr[5*nc+0] * x[0] - lptr[5*nc+1] * x[1] - lptr[5*nc+2] * x[2] - lptr[5*nc+3] * x[3] - lptr[5*nc+4] * x[4]; return; case NSKIP( 7, 0 ): x[0] = b[0]; case NSKIP( 7, 1 ): x[1] = b[1] - lptr[1*nc+0] * x[0]; case NSKIP( 7, 2 ): x[2] = b[2] - lptr[2*nc+0] * x[0] - lptr[2*nc+1] * x[1]; case NSKIP( 7, 3 ): x[3] = b[3] - lptr[3*nc+0] * x[0] - lptr[3*nc+1] * x[1] - lptr[3*nc+2] * x[2]; case NSKIP( 7, 4 ): x[4] = b[4] - lptr[4*nc+0] * x[0] - lptr[4*nc+1] * x[1] - lptr[4*nc+2] * x[2] - lptr[4*nc+3] * x[3]; case NSKIP( 7, 5 ): x[5] = b[5] - lptr[5*nc+0] * x[0] - lptr[5*nc+1] * x[1] - lptr[5*nc+2] * x[2] - lptr[5*nc+3] * x[3] - lptr[5*nc+4] * x[4]; case NSKIP( 7, 6 ): x[6] = b[6] - lptr[6*nc+0] * x[0] - lptr[6*nc+1] * x[1] - lptr[6*nc+2] * x[2] - lptr[6*nc+3] * x[3] - lptr[6*nc+4] * x[4] - lptr[6*nc+5] * x[5]; return; } return; } // process first 4 rows switch( skip ) { case 0: x[0] = b[0]; case 1: x[1] = b[1] - lptr[1*nc+0] * x[0]; case 2: x[2] = b[2] - lptr[2*nc+0] * x[0] - lptr[2*nc+1] * x[1]; case 3: x[3] = b[3] - lptr[3*nc+0] * x[0] - lptr[3*nc+1] * x[1] - lptr[3*nc+2] * x[2]; skip = 4; } lptr = L[skip]; int i, j; register double s0, s1, s2, s3; for ( i = skip; i < n; i++ ) { s0 = lptr[0] * x[0]; s1 = lptr[1] * x[1]; s2 = lptr[2] * x[2]; s3 = lptr[3] * x[3]; for ( j = 4; j < i-7; j += 8 ) { s0 += lptr[j+0] * x[j+0]; s1 += lptr[j+1] * x[j+1]; s2 += lptr[j+2] * x[j+2]; s3 += lptr[j+3] * x[j+3]; s0 += lptr[j+4] * x[j+4]; s1 += lptr[j+5] * x[j+5]; s2 += lptr[j+6] * x[j+6]; s3 += lptr[j+7] * x[j+7]; } switch( i - j ) { NODEFAULT; case 7: s0 += lptr[j+6] * x[j+6]; case 6: s1 += lptr[j+5] * x[j+5]; case 5: s2 += lptr[j+4] * x[j+4]; case 4: s3 += lptr[j+3] * x[j+3]; case 3: s0 += lptr[j+2] * x[j+2]; case 2: s1 += lptr[j+1] * x[j+1]; case 1: s2 += lptr[j+0] * x[j+0]; case 0: break; } double sum; sum = s3; sum += s2; sum += s1; sum += s0; sum -= b[i]; x[i] = -sum; lptr += nc; } #else int i, j; const float *lptr; double sum; for ( i = skip; i < n; i++ ) { sum = b[i]; lptr = L[i]; for ( j = 0; j < i; j++ ) { sum -= lptr[j] * x[j]; } x[i] = sum; } #endif } /* ============ idSIMD_Generic::MatX_LowerTriangularSolveTranspose solves x in L'x = b for the n * n sub-matrix of L L has to be a lower triangular matrix with (implicit) ones on the diagonal x == b is allowed ============ */ void VPCALL idSIMD_Generic::MatX_LowerTriangularSolveTranspose( const idMatX &L, float *x, const float *b, const int n ) { #if 1 int nc; const float *lptr; lptr = L.ToFloatPtr(); nc = L.GetNumColumns(); // unrolled cases for n < 8 if ( n < 8 ) { switch( n ) { case 0: return; case 1: x[0] = b[0]; return; case 2: x[1] = b[1]; x[0] = b[0] - lptr[1*nc+0] * x[1]; return; case 3: x[2] = b[2]; x[1] = b[1] - lptr[2*nc+1] * x[2]; x[0] = b[0] - lptr[2*nc+0] * x[2] - lptr[1*nc+0] * x[1]; return; case 4: x[3] = b[3]; x[2] = b[2] - lptr[3*nc+2] * x[3]; x[1] = b[1] - lptr[3*nc+1] * x[3] - lptr[2*nc+1] * x[2]; x[0] = b[0] - lptr[3*nc+0] * x[3] - lptr[2*nc+0] * x[2] - lptr[1*nc+0] * x[1]; return; case 5: x[4] = b[4]; x[3] = b[3] - lptr[4*nc+3] * x[4]; x[2] = b[2] - lptr[4*nc+2] * x[4] - lptr[3*nc+2] * x[3]; x[1] = b[1] - lptr[4*nc+1] * x[4] - lptr[3*nc+1] * x[3] - lptr[2*nc+1] * x[2]; x[0] = b[0] - lptr[4*nc+0] * x[4] - lptr[3*nc+0] * x[3] - lptr[2*nc+0] * x[2] - lptr[1*nc+0] * x[1]; return; case 6: x[5] = b[5]; x[4] = b[4] - lptr[5*nc+4] * x[5]; x[3] = b[3] - lptr[5*nc+3] * x[5] - lptr[4*nc+3] * x[4]; x[2] = b[2] - lptr[5*nc+2] * x[5] - lptr[4*nc+2] * x[4] - lptr[3*nc+2] * x[3]; x[1] = b[1] - lptr[5*nc+1] * x[5] - lptr[4*nc+1] * x[4] - lptr[3*nc+1] * x[3] - lptr[2*nc+1] * x[2]; x[0] = b[0] - lptr[5*nc+0] * x[5] - lptr[4*nc+0] * x[4] - lptr[3*nc+0] * x[3] - lptr[2*nc+0] * x[2] - lptr[1*nc+0] * x[1]; return; case 7: x[6] = b[6]; x[5] = b[5] - lptr[6*nc+5] * x[6]; x[4] = b[4] - lptr[6*nc+4] * x[6] - lptr[5*nc+4] * x[5]; x[3] = b[3] - lptr[6*nc+3] * x[6] - lptr[5*nc+3] * x[5] - lptr[4*nc+3] * x[4]; x[2] = b[2] - lptr[6*nc+2] * x[6] - lptr[5*nc+2] * x[5] - lptr[4*nc+2] * x[4] - lptr[3*nc+2] * x[3]; x[1] = b[1] - lptr[6*nc+1] * x[6] - lptr[5*nc+1] * x[5] - lptr[4*nc+1] * x[4] - lptr[3*nc+1] * x[3] - lptr[2*nc+1] * x[2]; x[0] = b[0] - lptr[6*nc+0] * x[6] - lptr[5*nc+0] * x[5] - lptr[4*nc+0] * x[4] - lptr[3*nc+0] * x[3] - lptr[2*nc+0] * x[2] - lptr[1*nc+0] * x[1]; return; } return; } int i, j; register double s0, s1, s2, s3; float *xptr; lptr = L.ToFloatPtr() + n * nc + n - 4; xptr = x + n; // process 4 rows at a time for ( i = n; i >= 4; i -= 4 ) { s0 = b[i-4]; s1 = b[i-3]; s2 = b[i-2]; s3 = b[i-1]; // process 4x4 blocks for ( j = 0; j < n-i; j += 4 ) { s0 -= lptr[(j+0)*nc+0] * xptr[j+0]; s1 -= lptr[(j+0)*nc+1] * xptr[j+0]; s2 -= lptr[(j+0)*nc+2] * xptr[j+0]; s3 -= lptr[(j+0)*nc+3] * xptr[j+0]; s0 -= lptr[(j+1)*nc+0] * xptr[j+1]; s1 -= lptr[(j+1)*nc+1] * xptr[j+1]; s2 -= lptr[(j+1)*nc+2] * xptr[j+1]; s3 -= lptr[(j+1)*nc+3] * xptr[j+1]; s0 -= lptr[(j+2)*nc+0] * xptr[j+2]; s1 -= lptr[(j+2)*nc+1] * xptr[j+2]; s2 -= lptr[(j+2)*nc+2] * xptr[j+2]; s3 -= lptr[(j+2)*nc+3] * xptr[j+2]; s0 -= lptr[(j+3)*nc+0] * xptr[j+3]; s1 -= lptr[(j+3)*nc+1] * xptr[j+3]; s2 -= lptr[(j+3)*nc+2] * xptr[j+3]; s3 -= lptr[(j+3)*nc+3] * xptr[j+3]; } // process left over of the 4 rows s0 -= lptr[0-1*nc] * s3; s1 -= lptr[1-1*nc] * s3; s2 -= lptr[2-1*nc] * s3; s0 -= lptr[0-2*nc] * s2; s1 -= lptr[1-2*nc] * s2; s0 -= lptr[0-3*nc] * s1; // store result xptr[-4] = s0; xptr[-3] = s1; xptr[-2] = s2; xptr[-1] = s3; // update pointers for next four rows lptr -= 4 + 4 * nc; xptr -= 4; } // process left over rows for ( i--; i >= 0; i-- ) { s0 = b[i]; lptr = L[0] + i; for ( j = i + 1; j < n; j++ ) { s0 -= lptr[j*nc] * x[j]; } x[i] = s0; } #else int i, j, nc; const float *ptr; double sum; nc = L.GetNumColumns(); for ( i = n - 1; i >= 0; i-- ) { sum = b[i]; ptr = L[0] + i; for ( j = i + 1; j < n; j++ ) { sum -= ptr[j*nc] * x[j]; } x[i] = sum; } #endif } /* ============ idSIMD_Generic::MatX_LDLTFactor in-place factorization LDL' of the n * n sub-matrix of mat the reciprocal of the diagonal elements are stored in invDiag ============ */ bool VPCALL idSIMD_Generic::MatX_LDLTFactor( idMatX &mat, idVecX &invDiag, const int n ) { #if 1 int i, j, k, nc; float *v, *diag, *mptr; double s0, s1, s2, s3, sum, d; v = (float *) _alloca16( n * sizeof( float ) ); diag = (float *) _alloca16( n * sizeof( float ) ); nc = mat.GetNumColumns(); if ( n <= 0 ) { return true; } mptr = mat[0]; sum = mptr[0]; if ( sum == 0.0f ) { return false; } diag[0] = sum; invDiag[0] = d = 1.0f / sum; if ( n <= 1 ) { return true; } mptr = mat[0]; for ( j = 1; j < n; j++ ) { mptr[j*nc+0] = ( mptr[j*nc+0] ) * d; } mptr = mat[1]; v[0] = diag[0] * mptr[0]; s0 = v[0] * mptr[0]; sum = mptr[1] - s0; if ( sum == 0.0f ) { return false; } mat[1][1] = sum; diag[1] = sum; invDiag[1] = d = 1.0f / sum; if ( n <= 2 ) { return true; } mptr = mat[0]; for ( j = 2; j < n; j++ ) { mptr[j*nc+1] = ( mptr[j*nc+1] - v[0] * mptr[j*nc+0] ) * d; } mptr = mat[2]; v[0] = diag[0] * mptr[0]; s0 = v[0] * mptr[0]; v[1] = diag[1] * mptr[1]; s1 = v[1] * mptr[1]; sum = mptr[2] - s0 - s1; if ( sum == 0.0f ) { return false; } mat[2][2] = sum; diag[2] = sum; invDiag[2] = d = 1.0f / sum; if ( n <= 3 ) { return true; } mptr = mat[0]; for ( j = 3; j < n; j++ ) { mptr[j*nc+2] = ( mptr[j*nc+2] - v[0] * mptr[j*nc+0] - v[1] * mptr[j*nc+1] ) * d; } mptr = mat[3]; v[0] = diag[0] * mptr[0]; s0 = v[0] * mptr[0]; v[1] = diag[1] * mptr[1]; s1 = v[1] * mptr[1]; v[2] = diag[2] * mptr[2]; s2 = v[2] * mptr[2]; sum = mptr[3] - s0 - s1 - s2; if ( sum == 0.0f ) { return false; } mat[3][3] = sum; diag[3] = sum; invDiag[3] = d = 1.0f / sum; if ( n <= 4 ) { return true; } mptr = mat[0]; for ( j = 4; j < n; j++ ) { mptr[j*nc+3] = ( mptr[j*nc+3] - v[0] * mptr[j*nc+0] - v[1] * mptr[j*nc+1] - v[2] * mptr[j*nc+2] ) * d; } for ( i = 4; i < n; i++ ) { mptr = mat[i]; v[0] = diag[0] * mptr[0]; s0 = v[0] * mptr[0]; v[1] = diag[1] * mptr[1]; s1 = v[1] * mptr[1]; v[2] = diag[2] * mptr[2]; s2 = v[2] * mptr[2]; v[3] = diag[3] * mptr[3]; s3 = v[3] * mptr[3]; for ( k = 4; k < i-3; k += 4 ) { v[k+0] = diag[k+0] * mptr[k+0]; s0 += v[k+0] * mptr[k+0]; v[k+1] = diag[k+1] * mptr[k+1]; s1 += v[k+1] * mptr[k+1]; v[k+2] = diag[k+2] * mptr[k+2]; s2 += v[k+2] * mptr[k+2]; v[k+3] = diag[k+3] * mptr[k+3]; s3 += v[k+3] * mptr[k+3]; } switch( i - k ) { NODEFAULT; case 3: v[k+2] = diag[k+2] * mptr[k+2]; s0 += v[k+2] * mptr[k+2]; case 2: v[k+1] = diag[k+1] * mptr[k+1]; s1 += v[k+1] * mptr[k+1]; case 1: v[k+0] = diag[k+0] * mptr[k+0]; s2 += v[k+0] * mptr[k+0]; case 0: break; } sum = s3; sum += s2; sum += s1; sum += s0; sum = mptr[i] - sum; if ( sum == 0.0f ) { return false; } mat[i][i] = sum; diag[i] = sum; invDiag[i] = d = 1.0f / sum; if ( i + 1 >= n ) { return true; } mptr = mat[i+1]; for ( j = i+1; j < n; j++ ) { s0 = mptr[0] * v[0]; s1 = mptr[1] * v[1]; s2 = mptr[2] * v[2]; s3 = mptr[3] * v[3]; for ( k = 4; k < i-7; k += 8 ) { s0 += mptr[k+0] * v[k+0]; s1 += mptr[k+1] * v[k+1]; s2 += mptr[k+2] * v[k+2]; s3 += mptr[k+3] * v[k+3]; s0 += mptr[k+4] * v[k+4]; s1 += mptr[k+5] * v[k+5]; s2 += mptr[k+6] * v[k+6]; s3 += mptr[k+7] * v[k+7]; } switch( i - k ) { NODEFAULT; case 7: s0 += mptr[k+6] * v[k+6]; case 6: s1 += mptr[k+5] * v[k+5]; case 5: s2 += mptr[k+4] * v[k+4]; case 4: s3 += mptr[k+3] * v[k+3]; case 3: s0 += mptr[k+2] * v[k+2]; case 2: s1 += mptr[k+1] * v[k+1]; case 1: s2 += mptr[k+0] * v[k+0]; case 0: break; } sum = s3; sum += s2; sum += s1; sum += s0; mptr[i] = ( mptr[i] - sum ) * d; mptr += nc; } } return true; #else int i, j, k, nc; float *v, *ptr, *diagPtr; double d, sum; v = (float *) _alloca16( n * sizeof( float ) ); nc = mat.GetNumColumns(); for ( i = 0; i < n; i++ ) { ptr = mat[i]; diagPtr = mat[0]; sum = ptr[i]; for ( j = 0; j < i; j++ ) { d = ptr[j]; v[j] = diagPtr[0] * d; sum -= v[j] * d; diagPtr += nc + 1; } if ( sum == 0.0f ) { return false; } diagPtr[0] = sum; invDiag[i] = d = 1.0f / sum; if ( i + 1 >= n ) { continue; } ptr = mat[i+1]; for ( j = i + 1; j < n; j++ ) { sum = ptr[i]; for ( k = 0; k < i; k++ ) { sum -= ptr[k] * v[k]; } ptr[i] = sum * d; ptr += nc; } } return true; #endif } /* ============ idSIMD_Generic::BlendJoints ============ */ void VPCALL idSIMD_Generic::BlendJoints( idJointQuat *joints, const idJointQuat *blendJoints, const float lerp, const int *index, const int numJoints ) { int i; for ( i = 0; i < numJoints; i++ ) { int j = index[i]; joints[j].q.Slerp( joints[j].q, blendJoints[j].q, lerp ); joints[j].t.Lerp( joints[j].t, blendJoints[j].t, lerp ); } } /* ============ idSIMD_Generic::ConvertJointQuatsToJointMats ============ */ void VPCALL idSIMD_Generic::ConvertJointQuatsToJointMats( idJointMat *jointMats, const idJointQuat *jointQuats, const int numJoints ) { int i; for ( i = 0; i < numJoints; i++ ) { jointMats[i].SetRotation( jointQuats[i].q.ToMat3() ); jointMats[i].SetTranslation( jointQuats[i].t ); } } /* ============ idSIMD_Generic::ConvertJointMatsToJointQuats ============ */ void VPCALL idSIMD_Generic::ConvertJointMatsToJointQuats( idJointQuat *jointQuats, const idJointMat *jointMats, const int numJoints ) { int i; for ( i = 0; i < numJoints; i++ ) { jointQuats[i] = jointMats[i].ToJointQuat(); } } /* ============ idSIMD_Generic::TransformJoints ============ */ void VPCALL idSIMD_Generic::TransformJoints( idJointMat *jointMats, const int *parents, const int firstJoint, const int lastJoint ) { int i; for( i = firstJoint; i <= lastJoint; i++ ) { assert( parents[i] < i ); jointMats[i] *= jointMats[parents[i]]; } } /* ============ idSIMD_Generic::UntransformJoints ============ */ void VPCALL idSIMD_Generic::UntransformJoints( idJointMat *jointMats, const int *parents, const int firstJoint, const int lastJoint ) { int i; for( i = lastJoint; i >= firstJoint; i-- ) { assert( parents[i] < i ); jointMats[i] /= jointMats[parents[i]]; } } /* ============ idSIMD_Generic::TransformVerts ============ */ void VPCALL idSIMD_Generic::TransformVerts( idDrawVert *verts, const int numVerts, const idJointMat *joints, const idVec4 *weights, const int *index, int numWeights ) { int i, j; const byte *jointsPtr = (byte *)joints; for( j = i = 0; i < numVerts; i++ ) { idVec3 v; v = ( *(idJointMat *) ( jointsPtr + index[j*2+0] ) ) * weights[j]; while( index[j*2+1] == 0 ) { j++; v += ( *(idJointMat *) ( jointsPtr + index[j*2+0] ) ) * weights[j]; } j++; verts[i].xyz = v; } } /* ============ idSIMD_Generic::TracePointCull ============ */ void VPCALL idSIMD_Generic::TracePointCull( byte *cullBits, byte &totalOr, const float radius, const idPlane *planes, const idDrawVert *verts, const int numVerts ) { int i; byte tOr; tOr = 0; for ( i = 0; i < numVerts; i++ ) { byte bits; float d0, d1, d2, d3, t; const idVec3 &v = verts[i].xyz; d0 = planes[0].Distance( v ); d1 = planes[1].Distance( v ); d2 = planes[2].Distance( v ); d3 = planes[3].Distance( v ); t = d0 + radius; bits = FLOATSIGNBITSET( t ) << 0; t = d1 + radius; bits |= FLOATSIGNBITSET( t ) << 1; t = d2 + radius; bits |= FLOATSIGNBITSET( t ) << 2; t = d3 + radius; bits |= FLOATSIGNBITSET( t ) << 3; t = d0 - radius; bits |= FLOATSIGNBITSET( t ) << 4; t = d1 - radius; bits |= FLOATSIGNBITSET( t ) << 5; t = d2 - radius; bits |= FLOATSIGNBITSET( t ) << 6; t = d3 - radius; bits |= FLOATSIGNBITSET( t ) << 7; bits ^= 0x0F; // flip lower four bits tOr |= bits; cullBits[i] = bits; } totalOr = tOr; } /* ============ idSIMD_Generic::DecalPointCull ============ */ void VPCALL idSIMD_Generic::DecalPointCull( byte *cullBits, const idPlane *planes, const idDrawVert *verts, const int numVerts ) { int i; for ( i = 0; i < numVerts; i++ ) { byte bits; float d0, d1, d2, d3, d4, d5; const idVec3 &v = verts[i].xyz; d0 = planes[0].Distance( v ); d1 = planes[1].Distance( v ); d2 = planes[2].Distance( v ); d3 = planes[3].Distance( v ); d4 = planes[4].Distance( v ); d5 = planes[5].Distance( v ); bits = FLOATSIGNBITSET( d0 ) << 0; bits |= FLOATSIGNBITSET( d1 ) << 1; bits |= FLOATSIGNBITSET( d2 ) << 2; bits |= FLOATSIGNBITSET( d3 ) << 3; bits |= FLOATSIGNBITSET( d4 ) << 4; bits |= FLOATSIGNBITSET( d5 ) << 5; cullBits[i] = bits ^ 0x3F; // flip lower 6 bits } } /* ============ idSIMD_Generic::OverlayPointCull ============ */ void VPCALL idSIMD_Generic::OverlayPointCull( byte *cullBits, idVec2 *texCoords, const idPlane *planes, const idDrawVert *verts, const int numVerts ) { int i; for ( i = 0; i < numVerts; i++ ) { byte bits; float d0, d1; const idVec3 &v = verts[i].xyz; texCoords[i][0] = d0 = planes[0].Distance( v ); texCoords[i][1] = d1 = planes[1].Distance( v ); bits = FLOATSIGNBITSET( d0 ) << 0; d0 = 1.0f - d0; bits |= FLOATSIGNBITSET( d1 ) << 1; d1 = 1.0f - d1; bits |= FLOATSIGNBITSET( d0 ) << 2; bits |= FLOATSIGNBITSET( d1 ) << 3; cullBits[i] = bits; } } /* ============ idSIMD_Generic::DeriveTriPlanes Derives a plane equation for each triangle. ============ */ void VPCALL idSIMD_Generic::DeriveTriPlanes( idPlane *planes, const idDrawVert *verts, const int numVerts, const int *indexes, const int numIndexes ) { int i; for ( i = 0; i < numIndexes; i += 3 ) { const idDrawVert *a, *b, *c; float d0[3], d1[3], f; idVec3 n; a = verts + indexes[i + 0]; b = verts + indexes[i + 1]; c = verts + indexes[i + 2]; d0[0] = b->xyz[0] - a->xyz[0]; d0[1] = b->xyz[1] - a->xyz[1]; d0[2] = b->xyz[2] - a->xyz[2]; d1[0] = c->xyz[0] - a->xyz[0]; d1[1] = c->xyz[1] - a->xyz[1]; d1[2] = c->xyz[2] - a->xyz[2]; n[0] = d1[1] * d0[2] - d1[2] * d0[1]; n[1] = d1[2] * d0[0] - d1[0] * d0[2]; n[2] = d1[0] * d0[1] - d1[1] * d0[0]; f = idMath::RSqrt( n.x * n.x + n.y * n.y + n.z * n.z ); n.x *= f; n.y *= f; n.z *= f; planes->SetNormal( n ); planes->FitThroughPoint( a->xyz ); planes++; } } /* ============ idSIMD_Generic::DeriveTangents Derives the normal and orthogonal tangent vectors for the triangle vertices. For each vertex the normal and tangent vectors are derived from all triangles using the vertex which results in smooth tangents across the mesh. In the process the triangle planes are calculated as well. ============ */ void VPCALL idSIMD_Generic::DeriveTangents( idPlane *planes, idDrawVert *verts, const int numVerts, const int *indexes, const int numIndexes ) { int i; bool *used = (bool *)_alloca16( numVerts * sizeof( used[0] ) ); memset( used, 0, numVerts * sizeof( used[0] ) ); idPlane *planesPtr = planes; for ( i = 0; i < numIndexes; i += 3 ) { idDrawVert *a, *b, *c; unsigned long signBit; float d0[5], d1[5], f, area; idVec3 n, t0, t1; int v0 = indexes[i + 0]; int v1 = indexes[i + 1]; int v2 = indexes[i + 2]; a = verts + v0; b = verts + v1; c = verts + v2; d0[0] = b->xyz[0] - a->xyz[0]; d0[1] = b->xyz[1] - a->xyz[1]; d0[2] = b->xyz[2] - a->xyz[2]; d0[3] = b->st[0] - a->st[0]; d0[4] = b->st[1] - a->st[1]; d1[0] = c->xyz[0] - a->xyz[0]; d1[1] = c->xyz[1] - a->xyz[1]; d1[2] = c->xyz[2] - a->xyz[2]; d1[3] = c->st[0] - a->st[0]; d1[4] = c->st[1] - a->st[1]; // normal n[0] = d1[1] * d0[2] - d1[2] * d0[1]; n[1] = d1[2] * d0[0] - d1[0] * d0[2]; n[2] = d1[0] * d0[1] - d1[1] * d0[0]; f = idMath::RSqrt( n.x * n.x + n.y * n.y + n.z * n.z ); n.x *= f; n.y *= f; n.z *= f; planesPtr->SetNormal( n ); planesPtr->FitThroughPoint( a->xyz ); planesPtr++; // area sign bit area = d0[3] * d1[4] - d0[4] * d1[3]; signBit = ( *(unsigned long *)&area ) & ( 1 << 31 ); // first tangent t0[0] = d0[0] * d1[4] - d0[4] * d1[0]; t0[1] = d0[1] * d1[4] - d0[4] * d1[1]; t0[2] = d0[2] * d1[4] - d0[4] * d1[2]; f = idMath::RSqrt( t0.x * t0.x + t0.y * t0.y + t0.z * t0.z ); *(unsigned long *)&f ^= signBit; t0.x *= f; t0.y *= f; t0.z *= f; // second tangent t1[0] = d0[3] * d1[0] - d0[0] * d1[3]; t1[1] = d0[3] * d1[1] - d0[1] * d1[3]; t1[2] = d0[3] * d1[2] - d0[2] * d1[3]; f = idMath::RSqrt( t1.x * t1.x + t1.y * t1.y + t1.z * t1.z ); *(unsigned long *)&f ^= signBit; t1.x *= f; t1.y *= f; t1.z *= f; if ( used[v0] ) { a->normal += n; a->tangents[0] += t0; a->tangents[1] += t1; } else { a->normal = n; a->tangents[0] = t0; a->tangents[1] = t1; used[v0] = true; } if ( used[v1] ) { b->normal += n; b->tangents[0] += t0; b->tangents[1] += t1; } else { b->normal = n; b->tangents[0] = t0; b->tangents[1] = t1; used[v1] = true; } if ( used[v2] ) { c->normal += n; c->tangents[0] += t0; c->tangents[1] += t1; } else { c->normal = n; c->tangents[0] = t0; c->tangents[1] = t1; used[v2] = true; } } } /* ============ idSIMD_Generic::DeriveUnsmoothedTangents Derives the normal and orthogonal tangent vectors for the triangle vertices. For each vertex the normal and tangent vectors are derived from a single dominant triangle. ============ */ #define DERIVE_UNSMOOTHED_BITANGENT void VPCALL idSIMD_Generic::DeriveUnsmoothedTangents( idDrawVert *verts, const dominantTri_s *dominantTris, const int numVerts ) { int i; for ( i = 0; i < numVerts; i++ ) { idDrawVert *a, *b, *c; float d0, d1, d2, d3, d4; float d5, d6, d7, d8, d9; float s0, s1, s2; float n0, n1, n2; float t0, t1, t2; float t3, t4, t5; const dominantTri_s &dt = dominantTris[i]; a = verts + i; b = verts + dt.v2; c = verts + dt.v3; d0 = b->xyz[0] - a->xyz[0]; d1 = b->xyz[1] - a->xyz[1]; d2 = b->xyz[2] - a->xyz[2]; d3 = b->st[0] - a->st[0]; d4 = b->st[1] - a->st[1]; d5 = c->xyz[0] - a->xyz[0]; d6 = c->xyz[1] - a->xyz[1]; d7 = c->xyz[2] - a->xyz[2]; d8 = c->st[0] - a->st[0]; d9 = c->st[1] - a->st[1]; s0 = dt.normalizationScale[0]; s1 = dt.normalizationScale[1]; s2 = dt.normalizationScale[2]; n0 = s2 * ( d6 * d2 - d7 * d1 ); n1 = s2 * ( d7 * d0 - d5 * d2 ); n2 = s2 * ( d5 * d1 - d6 * d0 ); t0 = s0 * ( d0 * d9 - d4 * d5 ); t1 = s0 * ( d1 * d9 - d4 * d6 ); t2 = s0 * ( d2 * d9 - d4 * d7 ); #ifndef DERIVE_UNSMOOTHED_BITANGENT t3 = s1 * ( d3 * d5 - d0 * d8 ); t4 = s1 * ( d3 * d6 - d1 * d8 ); t5 = s1 * ( d3 * d7 - d2 * d8 ); #else t3 = s1 * ( n2 * t1 - n1 * t2 ); t4 = s1 * ( n0 * t2 - n2 * t0 ); t5 = s1 * ( n1 * t0 - n0 * t1 ); #endif a->normal[0] = n0; a->normal[1] = n1; a->normal[2] = n2; a->tangents[0][0] = t0; a->tangents[0][1] = t1; a->tangents[0][2] = t2; a->tangents[1][0] = t3; a->tangents[1][1] = t4; a->tangents[1][2] = t5; } } /* ============ idSIMD_Generic::NormalizeTangents Normalizes each vertex normal and projects and normalizes the tangent vectors onto the plane orthogonal to the vertex normal. ============ */ void VPCALL idSIMD_Generic::NormalizeTangents( idDrawVert *verts, const int numVerts ) { for ( int i = 0; i < numVerts; i++ ) { idVec3 &v = verts[i].normal; float f; f = idMath::RSqrt( v.x * v.x + v.y * v.y + v.z * v.z ); v.x *= f; v.y *= f; v.z *= f; for ( int j = 0; j < 2; j++ ) { idVec3 &t = verts[i].tangents[j]; t -= ( t * v ) * v; f = idMath::RSqrt( t.x * t.x + t.y * t.y + t.z * t.z ); t.x *= f; t.y *= f; t.z *= f; } } } /* ============ idSIMD_Generic::CreateTextureSpaceLightVectors Calculates light vectors in texture space for the given triangle vertices. For each vertex the direction towards the light origin is projected onto texture space. The light vectors are only calculated for the vertices referenced by the indexes. ============ */ void VPCALL idSIMD_Generic::CreateTextureSpaceLightVectors( idVec3 *lightVectors, const idVec3 &lightOrigin, const idDrawVert *verts, const int numVerts, const int *indexes, const int numIndexes ) { bool *used = (bool *)_alloca16( numVerts * sizeof( used[0] ) ); memset( used, 0, numVerts * sizeof( used[0] ) ); for ( int i = numIndexes - 1; i >= 0; i-- ) { used[indexes[i]] = true; } for ( int i = 0; i < numVerts; i++ ) { if ( !used[i] ) { continue; } const idDrawVert *v = &verts[i]; idVec3 lightDir = lightOrigin - v->xyz; lightVectors[i][0] = lightDir * v->tangents[0]; lightVectors[i][1] = lightDir * v->tangents[1]; lightVectors[i][2] = lightDir * v->normal; } } /* ============ idSIMD_Generic::CreateSpecularTextureCoords Calculates specular texture coordinates for the given triangle vertices. For each vertex the normalized direction towards the light origin is added to the normalized direction towards the view origin and the result is projected onto texture space. The texture coordinates are only calculated for the vertices referenced by the indexes. ============ */ void VPCALL idSIMD_Generic::CreateSpecularTextureCoords( idVec4 *texCoords, const idVec3 &lightOrigin, const idVec3 &viewOrigin, const idDrawVert *verts, const int numVerts, const int *indexes, const int numIndexes ) { bool *used = (bool *)_alloca16( numVerts * sizeof( used[0] ) ); memset( used, 0, numVerts * sizeof( used[0] ) ); for ( int i = numIndexes - 1; i >= 0; i-- ) { used[indexes[i]] = true; } for ( int i = 0; i < numVerts; i++ ) { if ( !used[i] ) { continue; } const idDrawVert *v = &verts[i]; idVec3 lightDir = lightOrigin - v->xyz; idVec3 viewDir = viewOrigin - v->xyz; float ilength; ilength = idMath::RSqrt( lightDir * lightDir ); lightDir[0] *= ilength; lightDir[1] *= ilength; lightDir[2] *= ilength; ilength = idMath::RSqrt( viewDir * viewDir ); viewDir[0] *= ilength; viewDir[1] *= ilength; viewDir[2] *= ilength; lightDir += viewDir; texCoords[i][0] = lightDir * v->tangents[0]; texCoords[i][1] = lightDir * v->tangents[1]; texCoords[i][2] = lightDir * v->normal; texCoords[i][3] = 1.0f; } } /* ============ idSIMD_Generic::CreateShadowCache ============ */ int VPCALL idSIMD_Generic::CreateShadowCache( idVec4 *vertexCache, int *vertRemap, const idVec3 &lightOrigin, const idDrawVert *verts, const int numVerts ) { int outVerts = 0; for ( int i = 0; i < numVerts; i++ ) { if ( vertRemap[i] ) { continue; } const float *v = verts[i].xyz.ToFloatPtr(); vertexCache[outVerts+0][0] = v[0]; vertexCache[outVerts+0][1] = v[1]; vertexCache[outVerts+0][2] = v[2]; vertexCache[outVerts+0][3] = 1.0f; // R_SetupProjection() builds the projection matrix with a slight crunch // for depth, which keeps this w=0 division from rasterizing right at the // wrap around point and causing depth fighting with the rear caps vertexCache[outVerts+1][0] = v[0] - lightOrigin[0]; vertexCache[outVerts+1][1] = v[1] - lightOrigin[1]; vertexCache[outVerts+1][2] = v[2] - lightOrigin[2]; vertexCache[outVerts+1][3] = 0.0f; vertRemap[i] = outVerts; outVerts += 2; } return outVerts; } /* ============ idSIMD_Generic::CreateVertexProgramShadowCache ============ */ int VPCALL idSIMD_Generic::CreateVertexProgramShadowCache( idVec4 *vertexCache, const idDrawVert *verts, const int numVerts ) { for ( int i = 0; i < numVerts; i++ ) { const float *v = verts[i].xyz.ToFloatPtr(); vertexCache[i*2+0][0] = v[0]; vertexCache[i*2+1][0] = v[0]; vertexCache[i*2+0][1] = v[1]; vertexCache[i*2+1][1] = v[1]; vertexCache[i*2+0][2] = v[2]; vertexCache[i*2+1][2] = v[2]; vertexCache[i*2+0][3] = 1.0f; vertexCache[i*2+1][3] = 0.0f; } return numVerts * 2; } /* ============ idSIMD_Generic::UpSamplePCMTo44kHz Duplicate samples for 44kHz output. ============ */ void idSIMD_Generic::UpSamplePCMTo44kHz( float *dest, const short *src, const int numSamples, const int kHz, const int numChannels ) { if ( kHz == 11025 ) { if ( numChannels == 1 ) { for ( int i = 0; i < numSamples; i++ ) { dest[i*4+0] = dest[i*4+1] = dest[i*4+2] = dest[i*4+3] = (float) src[i+0]; } } else { for ( int i = 0; i < numSamples; i += 2 ) { dest[i*4+0] = dest[i*4+2] = dest[i*4+4] = dest[i*4+6] = (float) src[i+0]; dest[i*4+1] = dest[i*4+3] = dest[i*4+5] = dest[i*4+7] = (float) src[i+1]; } } } else if ( kHz == 22050 ) { if ( numChannels == 1 ) { for ( int i = 0; i < numSamples; i++ ) { dest[i*2+0] = dest[i*2+1] = (float) src[i+0]; } } else { for ( int i = 0; i < numSamples; i += 2 ) { dest[i*2+0] = dest[i*2+2] = (float) src[i+0]; dest[i*2+1] = dest[i*2+3] = (float) src[i+1]; } } } else if ( kHz == 44100 ) { for ( int i = 0; i < numSamples; i++ ) { dest[i] = (float) src[i]; } } else { assert( 0 ); } } /* ============ idSIMD_Generic::UpSampleOGGTo44kHz Duplicate samples for 44kHz output. ============ */ void idSIMD_Generic::UpSampleOGGTo44kHz( float *dest, const float * const *ogg, const int numSamples, const int kHz, const int numChannels ) { if ( kHz == 11025 ) { if ( numChannels == 1 ) { for ( int i = 0; i < numSamples; i++ ) { dest[i*4+0] = dest[i*4+1] = dest[i*4+2] = dest[i*4+3] = ogg[0][i] * 32768.0f; } } else { for ( int i = 0; i < numSamples >> 1; i++ ) { dest[i*8+0] = dest[i*8+2] = dest[i*8+4] = dest[i*8+6] = ogg[0][i] * 32768.0f; dest[i*8+1] = dest[i*8+3] = dest[i*8+5] = dest[i*8+7] = ogg[1][i] * 32768.0f; } } } else if ( kHz == 22050 ) { if ( numChannels == 1 ) { for ( int i = 0; i < numSamples; i++ ) { dest[i*2+0] = dest[i*2+1] = ogg[0][i] * 32768.0f; } } else { for ( int i = 0; i < numSamples >> 1; i++ ) { dest[i*4+0] = dest[i*4+2] = ogg[0][i] * 32768.0f; dest[i*4+1] = dest[i*4+3] = ogg[1][i] * 32768.0f; } } } else if ( kHz == 44100 ) { if ( numChannels == 1 ) { for ( int i = 0; i < numSamples; i++ ) { dest[i*1+0] = ogg[0][i] * 32768.0f; } } else { for ( int i = 0; i < numSamples >> 1; i++ ) { dest[i*2+0] = ogg[0][i] * 32768.0f; dest[i*2+1] = ogg[1][i] * 32768.0f; } } } else { assert( 0 ); } } /* ============ idSIMD_Generic::MixSoundTwoSpeakerMono ============ */ void VPCALL idSIMD_Generic::MixSoundTwoSpeakerMono( float *mixBuffer, const float *samples, const int numSamples, const float lastV[2], const float currentV[2] ) { float sL = lastV[0]; float sR = lastV[1]; float incL = ( currentV[0] - lastV[0] ) / MIXBUFFER_SAMPLES; float incR = ( currentV[1] - lastV[1] ) / MIXBUFFER_SAMPLES; assert( numSamples == MIXBUFFER_SAMPLES ); for( int j = 0; j < MIXBUFFER_SAMPLES; j++ ) { mixBuffer[j*2+0] += samples[j] * sL; mixBuffer[j*2+1] += samples[j] * sR; sL += incL; sR += incR; } } /* ============ idSIMD_Generic::MixSoundTwoSpeakerStereo ============ */ void VPCALL idSIMD_Generic::MixSoundTwoSpeakerStereo( float *mixBuffer, const float *samples, const int numSamples, const float lastV[2], const float currentV[2] ) { float sL = lastV[0]; float sR = lastV[1]; float incL = ( currentV[0] - lastV[0] ) / MIXBUFFER_SAMPLES; float incR = ( currentV[1] - lastV[1] ) / MIXBUFFER_SAMPLES; assert( numSamples == MIXBUFFER_SAMPLES ); for( int j = 0; j < MIXBUFFER_SAMPLES; j++ ) { mixBuffer[j*2+0] += samples[j*2+0] * sL; mixBuffer[j*2+1] += samples[j*2+1] * sR; sL += incL; sR += incR; } } /* ============ idSIMD_Generic::MixSoundSixSpeakerMono ============ */ void VPCALL idSIMD_Generic::MixSoundSixSpeakerMono( float *mixBuffer, const float *samples, const int numSamples, const float lastV[6], const float currentV[6] ) { float sL0 = lastV[0]; float sL1 = lastV[1]; float sL2 = lastV[2]; float sL3 = lastV[3]; float sL4 = lastV[4]; float sL5 = lastV[5]; float incL0 = ( currentV[0] - lastV[0] ) / MIXBUFFER_SAMPLES; float incL1 = ( currentV[1] - lastV[1] ) / MIXBUFFER_SAMPLES; float incL2 = ( currentV[2] - lastV[2] ) / MIXBUFFER_SAMPLES; float incL3 = ( currentV[3] - lastV[3] ) / MIXBUFFER_SAMPLES; float incL4 = ( currentV[4] - lastV[4] ) / MIXBUFFER_SAMPLES; float incL5 = ( currentV[5] - lastV[5] ) / MIXBUFFER_SAMPLES; assert( numSamples == MIXBUFFER_SAMPLES ); for( int i = 0; i < MIXBUFFER_SAMPLES; i++ ) { mixBuffer[i*6+0] += samples[i] * sL0; mixBuffer[i*6+1] += samples[i] * sL1; mixBuffer[i*6+2] += samples[i] * sL2; mixBuffer[i*6+3] += samples[i] * sL3; mixBuffer[i*6+4] += samples[i] * sL4; mixBuffer[i*6+5] += samples[i] * sL5; sL0 += incL0; sL1 += incL1; sL2 += incL2; sL3 += incL3; sL4 += incL4; sL5 += incL5; } } /* ============ idSIMD_Generic::MixSoundSixSpeakerStereo ============ */ void VPCALL idSIMD_Generic::MixSoundSixSpeakerStereo( float *mixBuffer, const float *samples, const int numSamples, const float lastV[6], const float currentV[6] ) { float sL0 = lastV[0]; float sL1 = lastV[1]; float sL2 = lastV[2]; float sL3 = lastV[3]; float sL4 = lastV[4]; float sL5 = lastV[5]; float incL0 = ( currentV[0] - lastV[0] ) / MIXBUFFER_SAMPLES; float incL1 = ( currentV[1] - lastV[1] ) / MIXBUFFER_SAMPLES; float incL2 = ( currentV[2] - lastV[2] ) / MIXBUFFER_SAMPLES; float incL3 = ( currentV[3] - lastV[3] ) / MIXBUFFER_SAMPLES; float incL4 = ( currentV[4] - lastV[4] ) / MIXBUFFER_SAMPLES; float incL5 = ( currentV[5] - lastV[5] ) / MIXBUFFER_SAMPLES; assert( numSamples == MIXBUFFER_SAMPLES ); for( int i = 0; i < MIXBUFFER_SAMPLES; i++ ) { mixBuffer[i*6+0] += samples[i*2+0] * sL0; mixBuffer[i*6+1] += samples[i*2+1] * sL1; mixBuffer[i*6+2] += samples[i*2+0] * sL2; mixBuffer[i*6+3] += samples[i*2+0] * sL3; mixBuffer[i*6+4] += samples[i*2+0] * sL4; mixBuffer[i*6+5] += samples[i*2+1] * sL5; sL0 += incL0; sL1 += incL1; sL2 += incL2; sL3 += incL3; sL4 += incL4; sL5 += incL5; } } /* ============ idSIMD_Generic::MixedSoundToSamples ============ */ void VPCALL idSIMD_Generic::MixedSoundToSamples( short *samples, const float *mixBuffer, const int numSamples ) { for ( int i = 0; i < numSamples; i++ ) { if ( mixBuffer[i] <= -32768.0f ) { samples[i] = -32768; } else if ( mixBuffer[i] >= 32767.0f ) { samples[i] = 32767; } else { samples[i] = (short) mixBuffer[i]; } } }
0e16269ce4990db442cba3dd7f7d676d3cc8d33a
2a582f35e436cec0addcb822c9f4a213f4712d47
/include/mgard-x/DataRefactoring/MultiDimension/Correction/LPKFunctor.h
8ed80c9ffbb6228384dd2b28b4e10cb41d4f8137
[ "Apache-2.0" ]
permissive
CODARcode/MGARD
10bd77f5a4ca4739d396a2fbc4fc2d83d6780ca3
7f9fd661cb8083d5fd5d7c345d5453ddabc3633e
refs/heads/master
2023-08-04T16:15:23.518453
2023-07-14T19:04:19
2023-07-21T03:19:57
157,610,031
32
27
Apache-2.0
2023-07-21T03:19:59
2018-11-14T20:57:29
C++
UTF-8
C++
false
false
1,786
h
LPKFunctor.h
/* * Copyright 2022, Oak Ridge National Laboratory. * MGARD-X: MultiGrid Adaptive Reduction of Data Portable across GPUs and CPUs * Author: Jieyang Chen (chenj3@ornl.gov) * Date: March 17, 2022 */ #ifndef MGARD_X_LPK_FUNCTOR #define MGARD_X_LPK_FUNCTOR namespace mgard_x { template <typename T> MGARDX_EXEC T mass_trans(T a, T b, T c, T d, T e, T h1, T h2, T h3, T h4, T r1, T r2, T r3, T r4) { T tb, tc, td, tb1, tb2, tc1, tc2, td1, td2; #ifdef MGARD_X_FMA if (sizeof(T) == sizeof(double)) { tb1 = fma(c, h2 / 6, a * h1 / 6); tb2 = fma(b, h2 / 6, b * h1 / 6); tc1 = fma(d, h3 / 6, b * h2 / 6); tc2 = fma(c, h3 / 6, c * h2 / 6); td1 = fma(c, h4 / 6, e * h3 / 6); td2 = fma(d, h4 / 6, d * h3 / 6); tb = fma(2, tb2, tb1); tc = fma(2, tc2, tc1); td = fma(2, td2, td1); return fma(td, r4, fma(tb, r1, tc)); } else if (sizeof(T) == sizeof(float)) { tb1 = fmaf(c, h2 / 6, a * h1 / 6); tb2 = fmaf(b, h2 / 6, b * h1 / 6); tc1 = fmaf(d, h3 / 6, b * h2 / 6); tc2 = fmaf(c, h3 / 6, c * h2 / 6); td1 = fmaf(c, h4 / 6, e * h3 / 6); td2 = fmaf(d, h4 / 6, d * h3 / 6); tb = fmaf(2, tb2, tb1); tc = fmaf(2, tc2, tc1); td = fmaf(2, td2, td1); return fmaf(td, r4, fmaf(tb, r1, tc)); } #else if (h1 + h2 != 0) { r1 = h1 / (h1 + h2); } else { r1 = 0.0; } if (h3 + h4 != 0) { r4 = h4 / (h3 + h4); } else { r4 = 0.0; } // printf("%f %f %f %f %f (%f %f %f %f)\n", a, b, c, d, e, h1, h2, h3, h4); tb = a * (h1 / 6) + b * ((h1 + h2) / 3) + c * (h2 / 6); tc = b * (h2 / 6) + c * ((h2 + h3) / 3) + d * (h3 / 6); td = c * (h3 / 6) + d * ((h3 + h4) / 3) + e * (h4 / 6); tc += tb * r1 + td * r4; return tc; #endif } } // namespace mgard_x #endif
700eb6381e42308a62175ac9dd042b396b4d8a2f
3a7d140ec93581c61c9c5680cf6bbc319266f688
/Solved Practice problems/A. Creating a Character.cpp
7e2bd6f704964a2f80daed1d1b9c948338886616
[]
no_license
Ovishake1607066/Solved-Codeforces-problems
dcc6e33d471e4e92d1cf76b7c5aab4b0278fbf55
fe038bb365bd666b2bbcad815e9ad3206d7e0988
refs/heads/master
2022-07-17T04:12:21.628142
2020-05-13T19:20:09
2020-05-13T19:20:09
263,710,650
0
0
null
null
null
null
UTF-8
C++
false
false
789
cpp
A. Creating a Character.cpp
#include<bits/stdc++.h> using namespace std; #define read FILE *fp;\ #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define ll long long #define ull unsigned long long #define dl double #define sf(n) scanf("%I64d",&n) #define pf(n) printf("%I64d\n",n) #define loop for(long long i=0;i<n;i++) #define lp(b,n) for(long long i=b;i<=n;i++) #define pb(n) push_back(n) #define srt(v) sort(v.begin(),v.end()) ll mark[5010]; int main() { ios::sync_with_stdio(false); cin.tie(),cout.tie(); ll t; cin>>t; while(t--) { ll s,i,e,a,b=0,c=0; cin>>s>>i>>e; a=s-i; a=(a*-1)+1; b=e-a; if(b>=0) cout<<min(b/2+1,e+1)<<endl; else cout<<0<<endl; } }
888839207385350b9b97e40de153d5273a67b954
f49dce08e87f4f10725c1e44050d5a401549d9d6
/CMakeProject.cpp
dfff8d77508d5f7f257131c6dbb2b99bba441a05
[]
no_license
KseeBMSTU/LR1
6335967c0d9ea34672fe812a19219f79457d43e9
0264fc7759d7134cd44cc2061cb125e073c12a7a
refs/heads/master
2022-12-17T22:49:16.759213
2020-09-08T12:53:26
2020-09-08T12:53:26
293,806,673
0
0
null
null
null
null
UTF-8
C++
false
false
210
cpp
CMakeProject.cpp
// CMakeProject.cpp: определяет точку входа для приложения. // #include <iostream> int main() { std::cout << "Hello from CMake in VS" << std::endl; return 0; }
1e72ddf793db862d509158d80b82bbe76fe06487
9bcb17a001bdc8bd3bf5133621d009139600f532
/src/latch.cpp
31c1f4a3c8e8425b449f063cc2c23f95ad8d5a9f
[]
no_license
fzxs/glog
6db2d8396fb5477c370f508d306b18bf9e36a04b
e416543c271cf5111df5a2c21d731b804552e169
refs/heads/master
2020-04-30T21:49:54.871687
2019-03-22T08:54:02
2019-03-22T08:54:02
177,103,528
0
0
null
null
null
null
UTF-8
C++
false
false
1,515
cpp
latch.cpp
 #include "latch.h" using namespace gtc; /******************************************************** Func Name: CountDownLatch Date Created: 2019-1-14 Description: 构造函数 Input: Output: Return: Caution: *********************************************************/ CountDownLatch::CountDownLatch(int count):condition_(mutex_) { this->count_ = count; } /******************************************************** Func Name: wait Date Created: 2019-1-14 Description: wait Input: Output: Return: Caution: *********************************************************/ void CountDownLatch::wait() { this->mutex_.lock(); while (this->count_ > 0) { this->condition_.wait(); } this->mutex_.unlock(); } /******************************************************** Func Name: countDown Date Created: 2019-1-14 Description: 发送信号 Input: Output: Return: Caution: 倒计时数减一 *********************************************************/ void CountDownLatch::countDown() { this->mutex_.lock(); --this->count_; if (0 == this->count_) { this->condition_.signal(); } this->mutex_.unlock(); } /******************************************************** Func Name: getCount Date Created: 2019-1-14 Description: 获取倒计时 Input: Output: Return: Caution: 倒计时数减一 *********************************************************/ int CountDownLatch::getCount() const { Guard_Mutex_Lock lock(this->mutex_); return count_; }
103c4a95b627f40d1639060345fc2ff0451f126c
2785ccb77f80387609601954fb22ed793f812da0
/Longest Common Prefix.cpp
80a815db35f1690e43ed0a10e0a5c7758569cbb7
[]
no_license
DebabrataMaity/Leetcode100
0785cf1a4c21d84419660e9c255b9582b6a625b7
fad197e0bfc8f7943e9e3df34d8402b4d28bcb33
refs/heads/main
2023-06-05T01:11:42.439899
2021-06-27T15:48:20
2021-06-27T15:48:20
375,687,877
0
0
null
null
null
null
UTF-8
C++
false
false
452
cpp
Longest Common Prefix.cpp
class Solution { public: string longestCommonPrefix(vector<string>& strs) { string prefix = ""; if(strs.size()==0) return prefix; string s = strs[0]; int i = 0; while(i<s.size()){ for(int j=1;j<strs.size();j++){ if(s[i]==strs[j][i]) continue; else return prefix; } prefix += s[i]; i++; } return prefix; } };
bb73952577dd8492097573ecd7159c119eb0471f
7f25ac596812ed201f289248de52d8d616d81b93
/wudo/C.cpp
9feb2fa3f78939041d1f9fef6d80ae0576ac9f57
[]
no_license
AplusB/ACEveryDay
dc6ff890f9926d328b95ff536abf6510cef57eb7
e958245213dcdba8c7134259a831bde8b3d511bb
refs/heads/master
2021-01-23T22:15:34.946922
2018-04-07T01:45:20
2018-04-07T01:45:20
58,846,919
25
49
null
2016-07-14T10:38:25
2016-05-15T06:08:55
C++
UTF-8
C++
false
false
1,363
cpp
C.cpp
#include <cstdio> #include <iostream> #include <cstring> #include <cmath> #include <algorithm> using namespace std; const int MAX = 180 + 3; struct node { int x, y, z; int dp; }; bool cmp (node a, node b) { if (a.x < b.x) return true; if (a.x == b.x && a.y < b.y) return true; return false; } int main() { int n, iCase = 0; while (scanf("%d", &n) != EOF, n) { node s[MAX]; int l, c, r, cnt = 0; for (int i = 0; i < n; ++i) { scanf("%d%d%d", &l, &c, &r); s[cnt++] = (node){l,c,r,r}; s[cnt++] = (node){l,r,c,c}; s[cnt++] = (node){c,l,r,r}; s[cnt++] = (node){c,r,l,l}; s[cnt++] = (node){r,l,c,c}; s[cnt++] = (node){r,c,l,l}; } sort(s, s+cnt, cmp); //cout << cnt << endl; /* for (int i = 0; i < cnt; ++i) { cout << s[i].x << " " << s[i].y << " " << s[i].z << endl; } */ int ans = 0; for (int i = 1; i < cnt; ++i) { for (int j = 0; j < i; ++j) { if (s[i].x > s[j].x && s[i].y > s[j].y) s[i].dp = max(s[j].dp + s[i].z, s[i].dp); } ans = max(ans, s[i].dp); } printf("Case %d: maximum height = %d\n", ++iCase, ans); } return 0; }
669950e4b7975775cd5b36017297f5b66545de18
f150f988fe895ef3632e3b3f5903fd25b27df6a8
/ZED_Xavier/include/Logger.h
c5b4285e99037dd1dd3932b076312023f6399de1
[]
no_license
bmhopkinson/image_acquisition
289c5734ff600fa6aafa796e16394e0eeaa3a112
48d835414962aa78d7d01501911d511d3290a110
refs/heads/master
2023-08-31T08:42:53.420165
2021-10-22T19:33:22
2021-10-22T19:33:22
241,467,574
0
0
null
null
null
null
UTF-8
C++
false
false
1,052
h
Logger.h
#ifndef LOGGER_H_ #define LOGGER_H_ #include <time.h> #include <fstream> #include <chrono> #include <thread> #include <sl/Camera.hpp> #include <yaml-cpp/yaml.h> #include "system/GPSPoller.h" #include "system/Arduino.h" #include "system/Seven_seg.h" class Logger{ public: Logger(YAML::Node config_file_, std::string copt); ~Logger(); void initialize_recording(struct tm * start_time); void record_start(std::chrono::high_resolution_clock::time_point tref_); void record_stop(); private: //major components sl::Camera zed; GPSPoller gps; Arduino ard; Seven_seg disp; YAML::Node config_file; std::string copt_str; //flags bool b_record = false; //data containers, files std::ofstream data_file; std::chrono::high_resolution_clock::time_point tref; time_t rawtime; //threads and thread functions void record(); std::thread rec_thread; }; #endif //include guard
447b9aaefa6514a2c3cbd4777e6773196557bee2
a49f43528e534e8d8fe4bec7ec96d0bef839750d
/FlightController/FlightController.ino
4ad19c01940d91819c04162c6db5182dc869c937
[ "MIT" ]
permissive
ltrooney/quadcopter
33368637904085f15ba476ece7af4e3172b893f2
7a3efef08d20daf7aebf7f47bb23bc08e6622f56
refs/heads/master
2020-03-25T00:29:28.575244
2019-08-16T17:29:50
2019-08-16T17:29:50
143,188,381
1
0
null
null
null
null
UTF-8
C++
false
false
18,951
ino
FlightController.ino
#include <Wire.h> #include <Math.h> // Pinout assignments const int PIN_LOW_VOLT_MON = A0; const int LOW_VOLT_LED_ENABLE = B00100000; const int LOW_VOLT_LED_DISABLE = B11011111; const int ESC_4x_ENABLE = B11110000; /* CONSTANTS */ const int MIN_RX_THROTTLE = 1015; const int MIN_ESC_THROTTLE = 1000; const int REFRESH_RATE_MICROS = 4000; // time interval (in micros) to maintain 250 Hz loop const float VOLTAGE_MIN = 4; // calculated is 4V (BAT - 11.7V, ARDFC_IN - 10.23V) // IMU sensitivities static const float GYRO_SENSITIVITY = 65.5; // +- 500 deg/s gyroscope sensitivity static const int16_t ACC_SENSITIVITY = 4096; // +- 8g accelerometer sensitivity // IMU register addresses static const int MPU6050_addr = 0x68; // I2C slave address of MPU-6050 static const int PWR_MGMT_1 = 0x6B; // power register static const int ACCEL_XOUT_H = 0x3B; // first accelerometer data register static const int GYRO_XOUT_H = 0x43; // first gyroscope data register static const int GYRO_CONFIG = 0x1B; // gyroscope configuration register // Complementary filter coefficients static const float GYRO_FUSION_COEFFICIENT = 0.98; static const float ACC_FUSION_COEFFICIENT = 0.02; // PID gains static const float P_GAIN_ROLL = 5; static const float D_GAIN_ROLL = 0; static const float I_GAIN_ROLL = 0; static const float P_GAIN_PITCH = 5; static const float D_GAIN_PITCH = 0; static const float I_GAIN_PITCH = 0; static const float P_GAIN_YAW = 5; static const float D_GAIN_YAW = 0; static const float I_GAIN_YAW = 0; /* GLOBALS */ // RX byte lastChannel1, lastChannel2, lastChannel3, lastChannel4; // determines which channel was last enabled unsigned long timer1, timer2, timer3, timer4, currentTime; // tracks time of rising RX pulse unsigned int rx_roll_pulse, rx_pitch_pulse, rx_throttle_pulse, rx_yaw_pulse; // RX input pulse // ESC unsigned int esc_1_pulse, esc_2_pulse, esc_3_pulse, esc_4_pulse; // time duration of ESC pulses (in microsec) unsigned int loop_timer; // loop timer to maintain 250Hz refresh rate // IMU raw data static int16_t gyro_bias_x, gyro_bias_y, gyro_bias_z; // average gyro offset in each DOF static int16_t gyro_raw_x, gyro_raw_y, gyro_raw_z; // raw gyro sensor values static int16_t acc_bias_x, acc_bias_y, acc_bias_z; // average acc offset in each DOF static int16_t acc_raw_x, acc_raw_y, acc_raw_z; // converted values // IMU calculated data static float gyro_roll, gyro_pitch, gyro_yaw; // angles derived from gyro readings static float gyro_roll_dot, gyro_pitch_dot, gyro_yaw_dot; // angular velocities derived from gyro readings static float acc_roll, acc_pitch; // angles derived from acc readings static float imu_roll_deg, imu_pitch_deg; // angles derived from gyro/acc fusion static boolean startingGyroAnglesSet = false; // PID calculations static float error_prior_roll = 0; static float error_prior_pitch = 0; static float error_prior_yaw = 0; static float I_roll = 0; /* CONVERSIONS */ const float MILLIS_TO_SECONDS = 1E-3; // convert milliseconds to seconds /* TIMEKEEPING */ static bool first_loop_iteration = true; static float time_elapsed = 0.0; // flight time elapsed unsigned long previous_time = 0; // last time of loop start unsigned long current_time; // current time of loop start static float delta_t = 0.0; // time between loops in sec /* TEST OUTPUT CONTROL */ const bool PRINT_LOW_VOLTAGE_WARNING = false; const bool PRINT_ESC_SIGNALS = false; const bool PRINT_RX_SIGNALS = false; const bool PRINT_GYRO_ANGLES = false; const bool PRINT_ACC_ANGLES = false; const bool PRINT_FUSED_ANGLES = false; const bool PRINT_ELAPSED_TIME = false; void setup() { DDRB |= LOW_VOLT_LED_ENABLE; // set digital pin 13 as output for low voltage status LED DDRC &= B11111110; // set analog pin A1 as input for low voltage monitor DDRD |= ESC_4x_ENABLE; // set digital pins 4-7 as outputs for ESC signal outputs // enable pin change interrupts for RX (by default these pins are enabled as inputs) PCICR |= (1 << PCIE0); // enable PCIEO, any change on PCINT[7:0] will cause interrupt PCMSK0 |= (1 << PCINT0); // enable interrupt on arduino pin 8 PCMSK0 |= (1 << PCINT1); // enable interrupt on arduino pin 9 PCMSK0 |= (1 << PCINT2); // enable interrupt on arduino pin 10 PCMSK0 |= (1 << PCINT3); // enable interrupt on arduino pin 11 Serial.begin(9600); Wire.begin(); // initiate Wire library for IMU scanI2CDevices(); // identify all connected devices that use I2C initializeIMU(); // power up, set IMU sensitivities, and calculate gyro offset // pre-loop setup // wait until receiver inputs are valid and in lowest position before starting // send pulse to ESC to prevent from beeping /* while(rx_throttle_pulse > MIN_RX_THROTTLE || rx_throttle_pulse < MIN_ESC_THROTTLE) { esc_1_pulse = MIN_ESC_THROTTLE; esc_2_pulse = MIN_ESC_THROTTLE; esc_3_pulse = MIN_ESC_THROTTLE; esc_4_pulse = MIN_ESC_THROTTLE; send_esc_pulse(); delay(40); } */ } void loop() { /* MAINTAIN 250HZ LOOP FREQUENCY*/ while(micros() <= loop_timer + REFRESH_RATE_MICROS); loop_timer = micros(); /* LOW VOLTAGE BATTERY MONITOR */ int sensorValue = analogRead(PIN_LOW_VOLT_MON); // read value of pin A0 (value in range 0-1023) float voltage = sensorValue * (5.0 / 1023.0); // convert sensorValue to voltage between 0V-5V if(voltage < VOLTAGE_MIN) { if(PRINT_LOW_VOLTAGE_WARNING) { Serial.print("WARNING: Low voltage - "); Serial.println(voltage); } PORTB |= LOW_VOLT_LED_ENABLE; // set digital output 13 HIGH } else { PORTB &= LOW_VOLT_LED_DISABLE; // set digital output 13 LOW } /* TIMEKEEPING */ current_time = millis(); if(!first_loop_iteration) { // if not first loop iteration delta_t = (current_time - previous_time) * MILLIS_TO_SECONDS; // calculate time passed in seconds } first_loop_iteration = false; time_elapsed += delta_t; previous_time = current_time; if(PRINT_ELAPSED_TIME) printElapsedFlightTime(); /* READ IMU REGISTERS */ getIMURegisterData(); /* GYRO CALCULATIONS */ // convert from integer to angular velocity in deg/s gyro_roll_dot = gyro_raw_y / GYRO_SENSITIVITY; gyro_pitch_dot = gyro_raw_x / GYRO_SENSITIVITY; gyro_yaw_dot = gyro_raw_z / GYRO_SENSITIVITY; // integrate to obtain roll, pitch, and yaw values gyro_roll += gyro_roll_dot * delta_t; gyro_pitch += gyro_pitch_dot * delta_t; gyro_yaw += gyro_yaw_dot * delta_t; /* ACCELEROMETER CALCULATIONS */ const float acc_x_in_g = acc_raw_x/ACC_SENSITIVITY; // convert acc x from int to g const float acc_y_in_g = acc_raw_y/ACC_SENSITIVITY; // convert acc y from int to g const float acc_z_in_g = acc_raw_z/ACC_SENSITIVITY; // convert acc z from int to g const float acc_pitch_radians = atan2(acc_y_in_g, acc_z_in_g); // calculate pitch in radians const float acc_roll_radians = atan2(-acc_x_in_g, sqrt((acc_y_in_g*acc_y_in_g) + (acc_z_in_g*acc_z_in_g))); // calculate roll in radians acc_roll = acc_roll_radians * RAD_TO_DEG; // convert acc roll from radians to degrees acc_pitch = acc_pitch_radians * RAD_TO_DEG; // conver acc pitch from radians to degrees /* GYRO/ACC FUSION CALCULATION */ if(startingGyroAnglesSet) { // use complementary filter to fuse sensor readings imu_roll_deg = (GYRO_FUSION_COEFFICIENT*gyro_roll) + (ACC_FUSION_COEFFICIENT*acc_roll); imu_pitch_deg = (GYRO_FUSION_COEFFICIENT*gyro_pitch) + (ACC_FUSION_COEFFICIENT*acc_pitch); } else { // accomodate for any starting angular offset due to unlevel surface gyro_roll = acc_roll; gyro_pitch = acc_pitch; startingGyroAnglesSet = true; } if(PRINT_GYRO_ANGLES) plotGyroAngles(); if(PRINT_ACC_ANGLES) plotAccAngles(); if(PRINT_FUSED_ANGLES) plotFusedAngles(); /* PID CALCULATIONS - ROLL */ rx_throttle_pulse = 1500; rx_roll_pulse = 1500; // test roll const float rx_roll_deg = (rx_roll_pulse/20) - 75; // convert roll from 1000us -> 2000us to -25 deg -> +25 deg const float error_roll = rx_roll_deg - imu_roll_deg; // error = desired - actual measurement const float P_roll = P_GAIN_ROLL * error_roll; I_roll += I_GAIN_ROLL * error_roll; const float D_roll = D_GAIN_ROLL * (error_roll - error_prior_roll); error_prior_roll = error_roll; const float roll_pid = (int)(P_roll + I_roll + D_roll); /* SEND ESC SIGNALS */ // set esc input pulse to the throttle pulse from RX esc_1_pulse = rx_throttle_pulse; esc_2_pulse = rx_throttle_pulse - roll_pid; esc_3_pulse = rx_throttle_pulse; esc_4_pulse = rx_throttle_pulse + roll_pid; send_esc_pulse(); Serial.print(rx_throttle_pulse); Serial.print("\t"); Serial.print(esc_2_pulse); Serial.print("\t"); Serial.print(esc_4_pulse); Serial.println("\t"); // TODO: compensate ESC pulse for battery voltage drop & PID corrections } // sends pulse to esc with the values of esc_1_pulse, esc_2_pulse, esc_3_pulse, and esc_4_pulse void send_esc_pulse() { if(PRINT_ESC_SIGNALS) print_esc_signals(); if(PRINT_RX_SIGNALS) print_rx_signals(); unsigned long offset_timer = micros(); // remember the current time PORTD |= ESC_4x_ENABLE; // set digital pins 4-7 to HIGH /* * HERE THERE IS A 1000us-2000us gap of time, this is where to perform other calculations */ unsigned long timer_esc_1 = esc_1_pulse + offset_timer; // time that esc 1 pulse should finish unsigned long timer_esc_2 = esc_2_pulse + offset_timer; // time that esc 2 pulse should finish unsigned long timer_esc_3 = esc_3_pulse + offset_timer; // time that esc 3 pulse should finish unsigned long timer_esc_4 = esc_4_pulse + offset_timer; // time that esc 4 pulse should finish /* Delay the ESC signal pulse for time equal * to the pulse width specified by the RX. * Set the digital outputs to LOW when finished */ unsigned long curr_time; while(PORTD >= 16) { // if PORTD == 16, digital pins 4-7 are set to LOW curr_time = micros(); if(curr_time >= timer_esc_1) PORTD &= B11101111; // set digital output 4 to LOW if(curr_time >= timer_esc_2) PORTD &= B11011111; // set digital output 5 to LOW if(curr_time >= timer_esc_3) PORTD &= B10111111; // set digital output 6 to LOW if(curr_time >= timer_esc_4) PORTD &= B01111111; // set digital output 7 to LOW } } /* INTERRUPT SERVICE ROUTINE called when digital inputs 8, 9, 10, or 11 change state */ ISR(PCINT0_vect) { currentTime = micros(); // handle channel 1 if((lastChannel1 == 0) && (PINB & B00000001)) { // pin 8 enabled lastChannel1 = 1; timer1 = currentTime; // time of rising pulse } else if((lastChannel1 == 1) && !(PINB & B00000001)) { // pin 8 disabled lastChannel1 = 0; rx_roll_pulse = currentTime - timer1; // total time of pulse being high } // handle channel 2 if((lastChannel2 == 0) && (PINB & B00000010)) { // pin 9 enabled lastChannel2 = 1; timer2 = currentTime; // time of rising pulse } else if((lastChannel2 == 1) && !(PINB & B00000010)) { // pin 9 disabled lastChannel2 = 0; rx_pitch_pulse = currentTime - timer2; // total time of pulse being high } // handle channel 3 if((lastChannel3 == 0) && (PINB & B00000100)) { // pin 10 enabled lastChannel3 = 1; timer3 = currentTime; // time of rising pulse } else if((lastChannel3 == 1) && !(PINB & B00000100)) { // pin 10 disabled lastChannel3 = 0; rx_throttle_pulse = currentTime - timer3; // total time of pulse being high } // handle channel 4 if((lastChannel4 == 0) && (PINB & B00001000)) { // pin 11 enabled lastChannel4 = 1; timer4 = currentTime; // time of rising pulse } else if((lastChannel4 == 1) && !(PINB & B00001000)) { // pin 11 disabled lastChannel4 = 0; rx_yaw_pulse = currentTime - timer4; // total time of pulse being high } } void initializeIMU() { // power up the MPU-6050 Wire.beginTransmission(MPU6050_addr); Wire.write(PWR_MGMT_1); // PWR_MGMT_1 register Wire.write(0x09); // wake-up MPU-6050 when set to 9 and disable temp. sensor Wire.endTransmission(); Wire.beginTransmission(MPU6050_addr); Wire.write(GYRO_CONFIG); // set the sensitivity of the gyro: byte FS_SEL_1 = B00001000; // +/- 500 deg/s sensitivity Wire.write(FS_SEL_1); // set the sensitivity of the accelerometer: byte AFS_SEL_0 = B00010000; // +/- 2g sensitivity Wire.write(AFS_SEL_0); Wire.endTransmission(true); readAndPrintMPURegister(GYRO_CONFIG, 2); // print the contents of GYRO_CONFIG and ACCEL_CONFIG calculateSensorBias(); // calculate average error offset from gyro reading } void getIMURegisterData() { // initialize data transmission Wire.beginTransmission(MPU6050_addr); Wire.write(ACCEL_XOUT_H); // begin reading at this register Wire.endTransmission(false); Wire.requestFrom(MPU6050_addr, 14, true); // request 14 registers for read access // read accelerometer registers acc_raw_x = Wire.read()<<8|Wire.read(); // 0x3B (ACCEL_XOUT_H) & 0x3B (ACCEL_XOUT_L) acc_raw_y = Wire.read()<<8|Wire.read(); // 0x3D (ACCEL_YOUT_H) & 0x3E (ACCEL_YOUT_L) acc_raw_z = Wire.read()<<8|Wire.read(); // 0x3F (ACCEL_ZOUT_H) & 0x40 (ACCEL_ZOUT_L) // skip the 2 temperature registers Wire.read()<<8|Wire.read(); // read gyroscope registers gyro_raw_x = Wire.read()<<8|Wire.read(); // 0x43 (GYRO_XOUT_H) & 0x44 (GYRO_XOUT_L) gyro_raw_y = Wire.read()<<8|Wire.read(); // 0x45 (GYRO_YOUT_H) & 0x46 (GYRO_YOUT_L) gyro_raw_z = Wire.read()<<8|Wire.read(); // 0x47 (GYRO_ZOUT_H) & 0x48 (GYRO_ZOUT_L) // subtract the calibration offsets acc_raw_x -= acc_bias_x; acc_raw_y -= acc_bias_y; acc_raw_z -= acc_bias_z; gyro_raw_x -= gyro_bias_x; gyro_raw_y -= gyro_bias_y; gyro_raw_z -= gyro_bias_z; } // take the average of the first 2000 gyroscope readings void calculateSensorBias() { Serial.println("Initializing gyroscope calibration..."); long gyro_raw_x = 0, gyro_raw_y = 0, gyro_raw_z = 0; long acc_raw_x = 0, acc_raw_y = 0, acc_raw_z = 0; const int calibrationIterations = 2000; int percent = 0; // calculate offsets for(int i = 0; i < calibrationIterations; i++) { if(i % (calibrationIterations/10) == 0) { percent += 10; Serial.print(percent); Serial.println("%"); } Wire.beginTransmission(MPU6050_addr); Wire.write(ACCEL_XOUT_H); // begin reading at this register Wire.endTransmission(false); Wire.requestFrom(MPU6050_addr, 14, true); // request 14 registers for read access // read accelerometer registers acc_raw_x += Wire.read()<<8|Wire.read(); // 0x3B (ACCEL_XOUT_H) & 0x3B (ACCEL_XOUT_L) acc_raw_y += Wire.read()<<8|Wire.read(); // 0x3D (ACCEL_YOUT_H) & 0x3E (ACCEL_YOUT_L) acc_raw_z += Wire.read()<<8|Wire.read(); // 0x3F (ACCEL_ZOUT_H) & 0x40 (ACCEL_ZOUT_L) // skip the 2 temperature registers Wire.read()<<8|Wire.read(); // read gyroscope registers gyro_raw_x += Wire.read()<<8|Wire.read(); // 0x43 (GYRO_XOUT_H) & 0x44 (GYRO_XOUT_L) gyro_raw_y += Wire.read()<<8|Wire.read(); // 0x45 (GYRO_YOUT_H) & 0x46 (GYRO_YOUT_L) gyro_raw_z += Wire.read()<<8|Wire.read(); // 0x47 (GYRO_ZOUT_H) & 0x48 (GYRO_ZOUT_L) delay(3); } Serial.println("gyroscope calibration values collected!"); acc_bias_x = acc_raw_x / calibrationIterations; acc_bias_y = acc_raw_y / calibrationIterations; acc_bias_z = acc_raw_z / calibrationIterations; gyro_bias_x = gyro_raw_x / calibrationIterations; gyro_bias_y = gyro_raw_y / calibrationIterations; gyro_bias_z = gyro_raw_z / calibrationIterations; // print the averages Serial.print("accelerometer biases [x, y, z]:\t"); plot3Angles(acc_bias_x, acc_bias_y, acc_bias_z); Serial.print("gyroscope biases [x, y, z]:\t"); plot3Angles(gyro_bias_x, gyro_bias_y, gyro_bias_z); } /* HELPERS */ void scanI2CDevices() { Serial.println("Scanning for I2C devices..."); byte error, address; int numDevices = 0; for(address = 1; address < 127; address++) { Wire.beginTransmission(address); error = Wire.endTransmission(); if(error == 0) { // success Serial.print("I2C device found at address 0x"); if(address < 16) Serial.print("0"); Serial.println(address, HEX); numDevices++; } else if(error == 4) { // error Serial.print("Unknown error at address 0x"); if(address < 16) Serial.print("0"); Serial.println(address, HEX); } } if(numDevices == 0) Serial.println("No I2C devices found.\n"); else Serial.println("Finished scanning I2C devices.\n"); } /* PRINT FUNCTIONS */ void readAndPrintMPURegister(const int startingRegisterNumber, const int numRegisters) { Serial.print("<Register dump>: "); Serial.print(numRegisters); Serial.print(" register(s), starting at 0x"); Serial.println(startingRegisterNumber, HEX); // queue the registers for reading Wire.beginTransmission(MPU6050_addr); Wire.write(startingRegisterNumber); // select register Wire.endTransmission(); // read requested registers Wire.requestFrom(MPU6050_addr, numRegisters, true); // request read from 2 registers for(int i = 0; i < numRegisters; i++) { byte REGISTER_VALUE = Wire.read(); Serial.print("Register 0x"); Serial.print(startingRegisterNumber+i, HEX); Serial.print(":\t"); Serial.println(REGISTER_VALUE); } Serial.println(); } void print_esc_signals() { Serial.print("1: "); Serial.print(esc_1_pulse); Serial.print(", 2: "); Serial.print(esc_2_pulse); Serial.print(", 3: "); Serial.print(esc_3_pulse); Serial.print(", 4: "); Serial.println(esc_4_pulse); } void print_rx_signals() { Serial.print("Throttle: "); Serial.print(rx_throttle_pulse); Serial.print(", Yaw: "); Serial.print(rx_yaw_pulse); Serial.print(", Pitch: "); Serial.print(rx_pitch_pulse); Serial.print(", Roll: "); Serial.println(rx_roll_pulse); } void plotAngle(float angle) { Serial.println(angle); } void plot2Angles(float a1, float a2) { Serial.print(a1); Serial.print("\t"); Serial.println(a2); } void plot3Angles(float a1, float a2, float a3) { Serial.print(a1); Serial.print("\t"); Serial.print(a2); Serial.print("\t"); Serial.println(a3); } void plotGyroAngles() { plot3Angles(gyro_roll, gyro_pitch, gyro_yaw); } void plotAccAngles() { plot2Angles(acc_roll, acc_pitch); } void plotFusedAngles() { plot2Angles(imu_roll_deg, imu_pitch_deg); } void plotAngularVelocities() { plot3Angles(gyro_roll_dot, gyro_pitch_dot, gyro_yaw_dot); } void printIMUValues() { Serial.print("gyro [r,p,y]: "); plotGyroAngles(); Serial.print("acc [r,p]: "); plotAccAngles(); } void printElapsedFlightTime() { Serial.print(time_elapsed); Serial.println("s"); }
1efb50f127d394fe71eff3d0659c5015ee38aadf
e618be07df57b7f4e796e946e2c36701415adb83
/bigram_tagger.cpp
d0f3fc4f3a12567973c210af6c2d656b2145cc03
[]
no_license
hubertkarbowy/simplehmmpostagger
565a616bf2a3b1ab110933b73ee696910d0af7cf
7c7f96eec3a36c83128cfc61eeece663729ad5e7
refs/heads/master
2021-06-22T07:19:16.203432
2020-12-20T22:49:03
2020-12-20T22:49:03
164,347,155
1
0
null
null
null
null
UTF-8
C++
false
false
6,850
cpp
bigram_tagger.cpp
#include <iostream> #include <fstream> #include "file_ops.h" #include "string_helpers.h" #include "ugly_global_vars.h" #include "getopt.h" #ifdef __BOOST_SERIALIZATION__ #include <boost/archive/text_iarchive.hpp> #include <boost/archive/text_oarchive.hpp> #include <boost/serialization/map.hpp> #endif using namespace std; int logger = 0; // declared extern in ugly_global_vars.h int process_cli_options(int argc, char** argv, Tagger* x) { } int main (int argc, char** argv) { Tagger* x = NULL; int c; while (1) { static struct option tagger_opts[] = { {"read-raw", no_argument, 0, 'a'}, #ifdef __NATIVE_SERIALIZATION__ {"native-deserialize", no_argument, 0, 'b'}, {"native-serialize", no_argument, 0, 'c'}, #endif #ifdef __BOOST_SERIALIZATION__ {"boost-deserialize", no_argument, 0, 'd'}, {"boost-serialize", no_argument, 0, 'e'}, #endif {0, 0, 0, 0} }; int opt_index = 0; c = getopt_long_only(argc, argv, "", tagger_opts, &opt_index); if (c == -1) break; switch(c) { case 'a': if (tagger_opts[opt_index].flag == 0) { try { x = read_corpus(BROWN, "brown"); // First parameter is enum specifying corpus type, the second param gives the directory with corpus files. Only the Brown corpus is supported for now. // Model building happens while files are being loaded. } catch (const invalid_argument &e) { cout << e.what(); exit (-1); } } break; #ifdef __NATIVE_SERIALIZATION__ case 'b': x = new Tagger(2); x->deserialize_native(); break; case 'c': if (x == NULL) { cout << "Cannot serialize a non-existent tagger\n"; exit(-1); } x->serialize_native(); break; #endif #ifdef __BOOST_SERIALIZATION__ case 'd': { // Create and input archive cout << "Restoring the HMM model from `serialized.txt`..."; std::ifstream ifs( "serialized.txt" ); boost::archive::text_iarchive ar(ifs); // Load the data ar & x; cout << " done." << endl; } break; case 'e': { std::ofstream ofs("serialized.txt"); boost::archive::text_oarchive ar(ofs); ar & x; } break; #endif } } if (x == NULL) { cout << "Cannot instantiate tagger. Please check options:\n"; cout << " --read-raw read the Brown corpus and do the computations from scratch\n"; #ifdef __NATIVE_SERIALIZATION__ cout << " --native-deserialize much, much slower than reading the Brown corpus\n"; #endif #ifdef __BOOST_SERIALIZATION__ cout << " --boost-deserialize deserialize from a Boost text archive\n"; #endif cout << "\nIf you pass --read-raw, you can additionally pass the following: \n"; #ifdef __NATIVE_SERIALIZATION__ cout << " --native-serialize\n"; #endif #ifdef __BOOST_SERIALIZATION__ cout << " --boost-serialize\n"; #endif exit(-1); } // Some examples - I really should have used vectors instead of string arrays to save myself the pain... Sorry. string tags[1] = {"bez"}; string tag_dt[1] = {"dt"}; string tag_nn[1] = {"nn"}; string tag_dt_nn[2] = {"dt", "nn"}; // P(nn | dt): tag transition probability: first element is the preceeding tag, second is the following tag. string tag_to_vb[2] = {"to", "vb"}; // P(to | vb) string tag_to_bos[2] = {"_BOS_", "``"}; // _BOS_ is a beginning-of-sentence symbol. cout << "Simple HMM POS tagger - some data from the Brown corpus (note: below are probabilities, but the tagger uses logprobs):\n\n"; cout << "Number of BEZ tags is " << x->getTagFreq(tags, 1) << endl; cout << "Number of 'is' tokens with BEZ tags is " << x->getTagsPerWord("bez", "is") << endl; cout << "P(is | bez) = " << x->getObservationLikelihood("bez", "is") << endl; cout << "P(race | nn) = " << x->getObservationLikelihood("nn", "race") << endl; cout << "P(race | vb) = " << x->getObservationLikelihood("vb", "race") << endl; cout << "c(DT) = " << x->getTagCounts(tag_dt, 1) << ", c(NN) = " << x->getTagCounts(tag_nn, 1) << endl; cout << "c(DT, NN) = " << x->getTagCounts(tag_dt_nn, 2) << endl; cout << "P(NN | DT) = " << x->getTagFreq(tag_dt_nn, 2) << endl; cout << "P(VB | TO) = " << x->getTagFreq(tag_to_vb, 2) << endl; cout << "P(`` | _BOS_) = " << x->getTagFreq(tag_to_bos, 2) << endl; cout << "c(_BOS_, ``) = " << x->getTagCounts(tag_to_bos, 2) << endl; cout << "P(I | ppss) = " << x->getObservationLikelihood("ppss", "I") << endl; cout << "There are " << x->getTags().size() << " unique tags." << endl; cout << "\nSample sentence: 'I want to race .'\n"; vector<string> sequence = {"I", "want", "to", "race", "."}; x->tag(sequence); // also prints to console cout << "============== USAGE: ==============\n"; cout << "/t dt nn - prints P(dt | nn)\n"; cout << "/w vb want - prints P(want | vb)\n"; cout << "/q - quit\n"; cout << "Type a sentence to run the tagger or use one of the commands (tags must be lowercase, punctuation signs must have a space before them).\n"; sequence.clear(); string line; while (true) { getline(cin, line); if (line.substr(0,2)=="/t") { stringstream explore(line.substr(3)); string tag1, tag2; explore >> tag1; explore >> tag2; string transition[2] = {tag1, tag2}; cout << "P(" << tag1 << " -> " << tag2 << ") = " << x-> getTagFreq(transition, 2) << endl; } else if (line.substr(0,2)=="/w") { stringstream explore(line.substr(3)); string oword, otag; explore >> otag; explore >> oword; cout << "P(" << oword << " | " << otag << ") = " << x-> getObservationLikelihood(otag, oword) << endl; } else if (line == "/q") break; else if (line == "") continue; else { cout << line << endl; sequence = x->tokenize(line); x->tag(sequence); } } delete (x); }
0a4c71d2e86631c5fb215adbba21b1ab88be825d
4a0993484a1f9882dd7ec710d6f26713a12f3d27
/leetcode/MaximalRectangle.cpp
554b17a18ffa8ac28a990ad019e9881df6395ec1
[]
no_license
zhouyuzju/code
fbe6a526260119ba42638d65bffe339063365bb0
8401d6c9eb522abd9cb993818cba9d6587ca13d8
refs/heads/master
2020-05-18T06:34:25.421161
2013-09-06T16:52:55
2013-09-06T16:52:55
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,043
cpp
MaximalRectangle.cpp
class Solution { public: int maximalRectangle(vector<vector<char> > &matrix) { if(matrix.empty()) return 0; int n = matrix[0].size(); vector<int> H(n); vector<int> L(n); vector<int> R(n,n); int result = 0; for(int i = 0;i < matrix.size();i++){ int left = 0,right = n; for(int j = 0;j < n;j++){ if(matrix[i][j] == '1'){ H[j]++; L[j] = max(L[j],left); } else{ left = j + 1; H[j] = 0;L[j] = 0;R[j] = n; } } for(int j = n - 1;j >= 0;j--){ if(matrix[i][j] == '1'){ R[j] = min(R[j],right); result = max(result,H[j] * (R[j] - L[j])); } else{ right = j; } } } return result; } };
a76e418ab4d3b6897b5792487eaa72ca049cad00
04703e01d43d9d9fc6e15f3f8774669d277eebee
/examples/ch2/closure.cc
dfa018b3ef38f0705e8d78bb8f969402dc95af8a
[]
no_license
floiges/webAssembly
4235ac92d2b9c3d072c7228baa6ea0fc37add3ee
95e33cafbb025e1a4bc0a515e432c22bf19b9cf3
refs/heads/master
2020-04-19T04:00:32.619034
2019-01-29T08:32:57
2019-01-29T08:32:57
167,950,375
0
0
null
null
null
null
UTF-8
C++
false
false
158
cc
closure.cc
#include <stdio.h> #include "../em_port_api.h" EM_PORT_API(int) show_me_the_answer(); EM_PORT_API(void) func() { printf("%d\n", show_me_the_answer()); }
b722b9aa8c377dad7dfb3461130bc272b2b17ef4
ee80de6f1823caf0b1150ad373fe55a30546f6ba
/DictionaryHandler.hpp
71708a153bfecdeb15f41ad9f6ca79e6504c46f2
[]
no_license
mlcollard/OOPS21-DictionaryHandler
d2cca7aca5bc42912304bbf5efd29069f7ba268e
f6de7b451fe8e8711a581266a7fdcfc609cfe42f
refs/heads/master
2023-03-29T02:57:45.262077
2021-03-31T12:21:09
2021-03-31T12:21:09
353,327,653
0
0
null
null
null
null
UTF-8
C++
false
false
462
hpp
DictionaryHandler.hpp
/* DictionaryHandler.hpp Declarations for dictionary creation */ #ifndef INCLUDED_DICTIONARYHANDLER_HPP #define INCLUDED_DICTIONARYHANDLER_HPP #include "WordProcessorHandler.hpp" #include <istream> #include <ostream> #include <string> #include <set> class DictionaryHandler : public WordProcessorHandler { public: // output words to out stream void outputWords(std::ostream& out) const; private: std::set<std::string> words; }; #endif
19eebbf7a70ffd5c54e361763465eacab5216bde
8cf95b63f8b7139677536be2de3d7e4f3eca193a
/control_scheme/arduino/main/main.ino
e3e1638ed277e15dc0e5d9ca5f062544aa8bc6c4
[ "MIT" ]
permissive
BHS-AV/software
e3197dedcbc382a5da2cb4a8b26778fe4ec753b1
02ebc93002472cf1502c297d4486602a252d4f1b
refs/heads/master
2020-07-06T08:45:07.217344
2020-02-18T20:41:34
2020-02-18T20:41:34
202,959,912
2
0
MIT
2020-02-18T20:41:35
2019-08-18T04:32:50
Python
UTF-8
C++
false
false
2,215
ino
main.ino
// Benjamin S. Bussell // February 26, 2019 // If having trouble with the code submit an issue here: // https://github.com/BSBussell/VESC #include "Arduino.h" #include <Servo.h> #include <Traxxas.h> // Custom Library made to abstract the code helping readability. // Can be found in Traxxas folder // If modified needs to be recompiled from Sketch > Include Library > Add .ZIP Library // Might need to rename the folder, just add one version number to the name. // Traxxas object(pin, throttle,delta, value, goal) Traxxas Steering(9, 1, 1, 0, 90); // For keeping track of updates unsigned long time; unsigned long prevTime; // if you're new to arduino this code runs before the loop. // Any setup needs to happen here // I initalized variable above so that they are included in the Global scope void setup() { // Initalize the Traxxass. Steering.startup(); // Initalize ports and make sure they are working, code will not run until they do Serial.begin(9600); while (!Serial) { ; } } // This loop called every 'frame' // Main action void loop() { // set the time time = millis(); // Make sure time has passed since last loop, to prevent weird stacking issues if ( prevTime != time ) { Steering.refresh(); prevTime = time; } // Check for inputs from python. if (Serial.available() > 2) { // Byte 1 - Instruction // Byte 2 - High Value // Byte 3 - Low Value // Read the IO Port char instruction = Serial.read(); unsigned int argument = parseBytes(); // Parse Bytes reads the two bytes sent and merges them to a 16 bit int // 3/6/2019 - Added lower case for changing Delta with the Arduino switch(instruction) { case 'S': Steering.setGoal(argument); break; case 's': Steering.setDelta(argument); break; case 'r': Serial.println(Steering.readPhysical()); break; case 'd': Steering.shutDown(); break; } while (Serial.available() > 0) { Serial.read(); } } // Set finish time for use above. } int parseBytes() { byte high = Serial.read(); byte low = Serial.read(); return high * 256 + low; }
81d7318e017e4fde7cb89704e4689d49aafccb37
6aeccfb60568a360d2d143e0271f0def40747d73
/sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/acgi/login/Logout.cpp
1205e12f8911611b76d332f0bdf0e1f65392cf2b
[]
no_license
ttyang/sandbox
1066b324a13813cb1113beca75cdaf518e952276
e1d6fde18ced644bb63e231829b2fe0664e51fac
refs/heads/trunk
2021-01-19T17:17:47.452557
2013-06-07T14:19:55
2013-06-07T14:19:55
13,488,698
1
3
null
2023-03-20T11:52:19
2013-10-11T03:08:51
C++
UTF-8
C++
false
false
323
cpp
Logout.cpp
#include <boost/cgi/acgi.hpp> using namespace cgi::acgi; int main() { service s; request req(s); req.load(); response resp; resp<< cookie("uuid"); boost::system::error_code ec; std::string fwd (req[form_data]["fwd"]); resp<< location(fwd); resp.send(req.client()); return req.close(http::ok); }
33819016e97629acec1955fb4f424fad29eb18c8
b1aa9ad6733efcb53d465809d5109e9174dabf04
/CCode/GameCode/MGProtonCannon.h
c473d94bfafa8ee4ce018ba0f509cf3105e47cd2
[]
no_license
dumpinfo/GameMatrixTest
d21545dbef9ade76fe092343a8362da4c8b142ca
9e4a73ad17555ddb90020c47e2486698b90e4d0d
refs/heads/master
2023-02-04T01:52:05.342214
2020-12-23T17:22:36
2020-12-23T17:22:36
323,961,033
2
0
null
null
null
null
UTF-8
C++
false
false
6,112
h
MGProtonCannon.h
//============================================================= // // C4 Engine version 4.5 // Copyright 1999-2015, by Terathon Software LLC // // This file is part of the C4 Engine and is provided under the // terms of the license agreement entered by the registed user. // // Unauthorized redistribution of source code is strictly // prohibited. Violators will be prosecuted. // //============================================================= #ifndef MGProtonCannon_h #define MGProtonCannon_h #include "C4Lights.h" #include "C4Sources.h" #include "C4Particles.h" #include "MGWeapons.h" #include "MGInput.h" namespace C4 { enum : ControllerType { kControllerProtonCannon = 'pcan' }; enum : ModelType { kModelProtonCannon = 'pcan', kModelProtonAmmo = 'pram' }; enum : ParticleSystemType { kParticleSystemProtonFlames = 'pflm', kParticleSystemProtonSparks = 'pspk', kParticleSystemProtonBeam = 'pbem', kParticleSystemProtonAmmoBeam = 'pabm' }; class ProtonAmmoBeam; class ProtonCannon final : public Weapon { private: ParticleSystemReg<ProtonAmmoBeam> protonAmmoBeamRegistration; ModelRegistration protonCannonModelRegistration; ModelRegistration protonAmmoModelRegistration; WeaponAction protonCannonAction; Texture *protonScorchTexture; ProtonCannon(); ~ProtonCannon(); public: static void Construct(void); static void Destruct(void); WeaponController *NewWeaponController(FighterController *fighter) const; }; class ProtonFlames : public FireParticleSystem { private: enum { kMaxParticleCount = 128 }; ParticlePool<FireParticle> particlePool; FireParticle particleArray[kMaxParticleCount]; public: ProtonFlames(); ~ProtonFlames(); void NewFlame(const Point3D& position); void AnimateParticles(void) override; }; class ProtonSparks : public LineParticleSystem { private: enum { kMaxParticleCount = 512 }; ParticlePool<> particlePool; Particle particleArray[kMaxParticleCount]; public: ProtonSparks(); ~ProtonSparks(); void NewSparks(const Point3D& position, const Vector3D& normal, int32 count); void AnimateParticles(void) override; }; class ProtonBeam : public PolyboardParticleSystem { private: enum { kMaxParticleCount = 256 }; int32 markingTime; int32 flameTime; int32 crackleTime; GameCharacterController *attackerController; ProtonFlames *flamesSystem; ProtonSparks *sparksSystem; Interpolator flickerInterpolator; float flickerIntensity; float controlRadius[4][4]; float controlDistance[4][4]; float controlVelocity[4][4]; float controlAngle[4][4]; PointLight protonLight; FlareEffect protonFlare; QuadEffect protonWarp; OmniSource protonSource; OmniSource shockSource; ParticlePool<PolyParticle> particlePool; PolyParticle particleArray[kMaxParticleCount]; bool CalculateBoundingSphere(BoundingSphere *sphere) const override; public: ProtonBeam(GameCharacterController *attacker); ~ProtonBeam(); void SetSourceVelocity(const Vector3D& velocity) { protonSource.SetSourceVelocity(velocity); } void Preprocess(void) override; void AnimateParticles(void) override; void SetBarrelAngle(float angle); void SetBeamPosition(const Vector3D& firingDirection); }; class ProtonAmmoBeam : public PolyboardParticleSystem { private: enum { kMaxParticleCount = 64 }; float beamLength; float controlRadius[4][2]; float controlDistance[4][2]; float controlVelocity[4][2]; float controlAngle[4][2]; ParticlePool<PolyParticle> particlePool; PolyParticle particleArray[kMaxParticleCount]; ProtonAmmoBeam(const ProtonAmmoBeam& protonAmmoBeam); Node *Replicate(void) const override; bool CalculateBoundingSphere(BoundingSphere *sphere) const override; public: ProtonAmmoBeam(); ~ProtonAmmoBeam(); void Preprocess(void) override; void AnimateParticles(void) override; }; class ProtonCannonController final : public WeaponController { private: enum { kProtonCannonSpin = 1 << 0, kProtonCannonBeam = 1 << 1 }; int32 firingTime; unsigned_int32 firingState; Node *barrelNode; OmniSource *spinSource; ProtonBeam *protonBeam; Transform4D barrelTransform; float barrelAngle; float barrelSpeed; List<Attribute> attributeList; EmissionAttribute emissionAttribute; public: enum { kProtonCannonMessageState = kWeaponMessageBaseCount }; ProtonCannonController(FighterController *fighter); ~ProtonCannonController(); void Preprocess(void) override; ControllerMessage *CreateMessage(ControllerMessageType type) const override; void SendInitialStateMessages(Player *player) const override; void Move(void) override; void BeginFiring(bool primary); void EndFiring(void); void SetFiringState(unsigned_int32 state, float speed); WeaponResult UpdateWeapon(const Point3D& position, const Vector3D& direction, const Point3D& center) override; }; class ProtonCannonStateMessage : public ControllerMessage { friend class ProtonCannonController; private: unsigned_int32 firingState; float barrelSpeed; ProtonCannonStateMessage(int32 index); public: ProtonCannonStateMessage(int32 index, unsigned_int32 state, float speed); ~ProtonCannonStateMessage(); void Compress(Compressor& data) const override; bool Decompress(Decompressor& data) override; void HandleControllerMessage(Controller *controller) const; }; } #endif // ZYUQURM
d8710941d674e7cb630ce651574c6ea61eb1e71d
8d0a53279640a8c8b53645468ac3f06807f4d62e
/Dev/Projects/Libraries/Engine/InputProcessor.h
c1f62c19f8445b5307490a978921294c1bb14f0d
[]
no_license
Hengle/BladeMaster
72acd7b3a4eca3befc6afd0873e8b2d335f09762
3283567d7763aaee60f5e0ffc1d7baeb3f7f530b
refs/heads/master
2020-04-12T23:56:44.323272
2010-11-28T17:31:18
2010-11-28T17:31:18
null
0
0
null
null
null
null
UTF-8
C++
false
false
51
h
InputProcessor.h
#pragma once class ENGINE_DLL InputProcessor { };
58c12ed9985a38086ad39f84977b30e9e3ddbf9f
747f0c4ea2840aaf7806d9944e3bbac9fcb2ec6d
/CV_GT/assets/projets/C++/Librairie/article.cpp
925ca2c02270c934d7346efe01fd68da10c1f2d3
[]
no_license
gtourneur442/depot
6158b51d7e9c51c23d2df45c7ba79a34c5a8d797
9d5373be469fa9145ab3f544133e1beabba15945
refs/heads/master
2023-02-25T08:24:41.218233
2023-02-21T16:38:27
2023-02-21T16:38:27
233,024,695
0
0
null
null
null
null
UTF-8
C++
false
false
260
cpp
article.cpp
#include "article.h" Article::Article() { this->alreadyBorrowed = false; } Article::~Article() { } void Article::setBorrowed(bool borrowed) { this->alreadyBorrowed = borrowed; } bool Article::isBorrowed(void) { return this->alreadyBorrowed; }
6fd08d20f91bb092be35aaead39d42df0eeef869
b0e41de0e785281af388637d61b3757e53f1f429
/phi.cpp
e9a8aed61c1506b7633e4722f4e9dde5d1db96c6
[]
no_license
alexfrederiksen/concurrency-problems
d55c14b08a586c1a962b968be0d0af677c0a79a8
2af0685b17491186fa474ec0e6d971256265f57b
refs/heads/master
2021-01-02T10:09:21.702648
2020-02-10T17:34:48
2020-02-10T17:34:48
239,571,699
0
0
null
null
null
null
UTF-8
C++
false
false
7,677
cpp
phi.cpp
#include <iostream> #include <thread> #include <atomic> #include <chrono> #include <mutex> #include <condition_variable> #include <csignal> #include <cstdio> // I really like printf() #include <cmath> // TODO: encapsulate globals int TABLE_SIZE = 10; const int STARVATION_TIME = 15000; // ms const int THINKING_TIME = 10; // ms const int EATING_TIME = 500; // ms // track starved threads (dead) std::atomic<int> deaths(0); /* * class for debugging / tracking the sticks * (adds no functionality) */ struct StickTracker { std::atomic<int> state; StickTracker() : state(0) { } void set_right() { state.store(1, std::memory_order_relaxed); } void set_left() { state.store(-1, std::memory_order_relaxed); } void drop() { state.store(0, std::memory_order_relaxed); } }; // ### Chopsticks ############################################################## /* * implement a truly fair timed mutex */ struct Stick : public std::timed_mutex { // make using time points less painful template <class Clock, class Duration> using time_point_t = std::chrono::time_point<Clock,Duration>; // spin waiting interval const unsigned int SPIN_WAIT_DELTA = 1; // ms // priority flags const int PRIORITY_NONE = 0; const int PRIORITY_LEFT = 1; const int PRIORITY_RIGHT = 2; // current thread with waiting priority std::atomic<int> priority; // a tracker for debugging sticks, may be removed / disabled on releases StickTracker * tracker; Stick() : priority(PRIORITY_NONE) { } /* attempts to lock in waiting priority */ bool priority_lock(int given) { if ((int) priority == given) return true; int expected = PRIORITY_NONE; return priority.compare_exchange_strong(expected, given); } void priority_unlock() { priority = PRIORITY_NONE; } template <class Clock, class Duration> bool pickup(time_point_t<Clock, Duration> & timeout, int given_priority) { using namespace std::chrono; // spin wait (gcc will soon provide a better c++20 alternative using // hardware interrupts on atomic types) while (!priority_lock(given_priority)) { // wait delta to prevent thread from hoarding cpu cycles std::this_thread::sleep_for(milliseconds(SPIN_WAIT_DELTA)); // fail on timeout if (system_clock::now() >= timeout) return false; } // yay, we have waiting priority, i.e. when the current lock holder // is done, we are guaranteed the lock // try locking with the rest of the time we have left bool succ = try_lock_until(timeout); // unlock priority, if failed to lock, thread should increase timeout. // If thread isn't waiting for this lock, then it's unfair to give it // a priority over threads that are waiting. priority_unlock(); return succ; } template <class Clock, class Duration> bool pickup_right(time_point_t<Clock, Duration> & timeout) { bool succ = pickup(timeout, PRIORITY_RIGHT); if (succ) tracker->set_left(); return succ; } template <class Clock, class Duration> bool pickup_left(time_point_t<Clock, Duration> & timeout) { bool succ = pickup(timeout, PRIORITY_LEFT); if (succ) tracker->set_right(); return succ; } void drop() { unlock(); tracker->drop(); } }; // ### Philosophers ############################################################ struct Person { // unique id int id; // storage for individuals respective shared objects Stick * left = nullptr; Stick * right = nullptr; // hosting thread for the individual std::thread * life = nullptr; // flag for killing the individual on demand std::atomic<bool> running; /* start the individuals life */ void simulate() { running = true; life = new std::thread(&Person::run, this); } void eat(int time, int starve) { using namespace std::chrono; // pickup sticks (key part of algorithm) auto starve_point = system_clock::now() + milliseconds(starve); bool have_left; bool have_right; if (id == 0) { // I'm the cycle breaking individual, pickup left then right have_left = left->pickup_left(starve_point); have_right = right->pickup_right(starve_point); } else { // I'm just a normal individual, pickup right then left have_right = right->pickup_right(starve_point); have_left = left->pickup_left(starve_point); } if (have_left && have_right) { // I can eat for as long as a I need std::this_thread::sleep_for(milliseconds(time)); } else { // I failed to pickup both sticks in time, I starve printf("Number %d has starved and died.\n", id); // and die running = false; deaths++; } // drop the sticks I'm holding if (have_left) left->drop(); if (have_right) right->drop(); } void run() { while (running) { // eat eat(EATING_TIME, STARVATION_TIME); // and think std::this_thread::sleep_for( std::chrono::milliseconds(THINKING_TIME)); } } void kill() { running = false; } void join() { if (life != nullptr) { life->join(); } } bool is_alive() { return (bool) running; } ~Person() { delete life; } }; // ### Function soley for pretty rendering ##################################### // for drawing the circle const int radius = 20; const int center_x = 22; const int center_y = 24; void plot_point(int x, int y, char c) { // use linux terminal escape codes printf("\033[%d;%df", y, 2 * x); printf("%c\n", c); } void plot_point_polar(double r, double theta, char c) { int x = (int) round(center_x + r * cos(theta)); int y = (int) round(center_x + r * sin(theta)); plot_point(x, y, c); } /* draw table to the console using terminal escape code */ void draw_table(Person * people, StickTracker * sticks) { // clear screen printf("\033[2J\033[0;0f"); printf("Deaths: %d Thinking: %dms Starving: %dms Eating: %dms \n", (int) deaths, THINKING_TIME, STARVATION_TIME, EATING_TIME); // draw people for (int i = 0; i < TABLE_SIZE; i++) { double theta = i * (2 * M_PI / TABLE_SIZE); plot_point_polar(radius, theta, people[i].is_alive() ? 'O' : 'X'); } double phase = M_PI / TABLE_SIZE; // draw sticks for (int i = 0; i < TABLE_SIZE; i++) { double theta = phase + i * (2 * M_PI / TABLE_SIZE); int state = sticks[i].state; if (state != 0) { double new_phase = theta + phase * state; double new_radius = radius - 2; if ((int) sticks[(i + state) % TABLE_SIZE].state * state < 0) plot_point_polar(new_radius, new_phase, ':'); else plot_point_polar(new_radius, new_phase, '.'); } else { plot_point_polar(radius, theta, '/'); } } plot_point(center_x, center_y, '#'); } /* handle control-c in the terminal */ Person * people_handles = nullptr; void on_exit_signal(int signum) { printf("Killing everyone...\n"); // kill everyone for (int i = 0; i < TABLE_SIZE; i++) people_handles[i].kill(); // join people for (int i = 0; i < TABLE_SIZE; i++) people_handles[i].join(); printf("Total of %d people starved.\n", (int) deaths); exit(0); } int main(int argc, char ** argv) { if (argc >= 2) { TABLE_SIZE = atoi(argv[1]); } // TODO: dynamically allocate this Stick sticks[TABLE_SIZE]; StickTracker trackers[TABLE_SIZE]; Person people[TABLE_SIZE]; people_handles = people; signal(SIGINT, on_exit_signal); // distribute sticks for (int i = 0; i < TABLE_SIZE; i++) { people[i].id = i; people[i].left = &sticks[(i - 1 + TABLE_SIZE) % TABLE_SIZE]; people[i].right = &sticks[i]; sticks[i].tracker = &trackers[i]; } // simulate people for (Person & p : people) p.simulate(); for (;;) { draw_table(people, trackers); std::this_thread::sleep_for(std::chrono::milliseconds(100)); } return 0; }
e7459be40e5798d83f901235961be65dc1960579
c1b76082ce3752885d5277d91d8735125e223609
/TsCore/Include/MemorySystem.hpp
e4dfb48ca8ccfc21ba8dc150e436dc519154f7d1
[ "MIT" ]
permissive
p4j4dyxcry/TsFramework3.0
6ed99a8de1878f184c559119c99dd82537cae7f1
6f01c23ffcb21583e54497014601ac3e4e5840c3
refs/heads/master
2020-03-27T15:43:25.925492
2019-01-18T08:48:24
2019-01-18T08:48:24
146,735,181
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
2,802
hpp
MemorySystem.hpp
#pragma once namespace TS { template <typename T, typename ... Params> T* MemorySystem::Construct(Params ... params) { const size_t memorySize = sizeof(T) + sizeof(MemoryMetaData); auto pMemory = static_cast<char*>(_pAllocator->Alloc(memorySize)); MemoryMetaData* block = new(pMemory)MemoryMetaData; pMemory += sizeof(MemoryMetaData); block->objectSize = sizeof(T); block->arrayCount = 1; block->typeData = typeid(T).name(); //! 引数付コンストラクタを呼び出す T* pObject = new(pMemory)T(params ...); // ! メタ情報を埋め込んでおく if (IsDebugMode()) { block->objectSize = sizeof(T); block->typeData = typeid(T).name(); RegisterMemoryMetaData(block); } return pObject; } template <typename T> T* MemorySystem::Constructs(size_t itemCount) { const size_t memorySize = sizeof(T) * itemCount + sizeof(MemoryMetaData); auto pMemory = static_cast<char*>(_pAllocator->Alloc(memorySize)); if(pMemory == nullptr) { throw ExceptionMessage::AllocFailed; } MemoryMetaData* block = new(pMemory)MemoryMetaData; pMemory += sizeof(MemoryMetaData); block->arrayCount = itemCount; T* pCurrent = reinterpret_cast<T*>(pMemory); for (size_t i = 0; i < itemCount; ++i) { //! デフォルトコンストラクタを呼び出す new(pCurrent)T; ++pCurrent; } // ! メタ情報を埋め込んでおく if (IsDebugMode()) { block->objectSize = sizeof(T); block->typeData = typeid(T).name(); RegisterMemoryMetaData(block); } return reinterpret_cast<T*>(pMemory); } template <typename T> void MemorySystem::Destruct(T*& ptr) { IAllocator* pAllocator = GetAllocator(); MemoryMetaData* meta = reinterpret_cast<MemoryMetaData*>(reinterpret_cast<char*>(ptr) - sizeof(MemoryMetaData)); if (IsDebugMode()) { MemoryMetaData * p = _pHeadMetaData; while (p != nullptr) { if (p == meta) break; p = p->pNextBlock; } if (p == nullptr) throw; } void* pMemoryHead = meta; T* pCurrent = ptr; // ! デストラクタを呼び出す for (unsigned i = 0; i < meta->arrayCount; ++i) { pCurrent[i].~T(); } if (IsDebugMode()) RemoveMemoryMetaData(meta); pAllocator->Free(pMemoryHead); ptr = nullptr; } }
3b9d4d3f814b37db1297f8e97e9a1f9898bef0de
bd5ae64ba8e4f286a9382b65aee5b6cda71e19ee
/Toy_ver2.0/TOY/MyFunc.h
6723918eadbbf6d5489b6f52aa3a647af25159e2
[]
no_license
jungjai/Toy-Language
af78e710440cb888db49dc21042a353e09465efb
14a9e0c1ad9728b8051256c6d58d4bcfd59f965a
refs/heads/master
2020-05-15T02:50:20.018366
2019-05-11T13:30:43
2019-05-11T13:30:43
182,056,880
3
0
null
null
null
null
UTF-8
C++
false
false
265
h
MyFunc.h
#define MAX_OPR 5 #define MAX_TOKEN 20000 #define MAX_FUNC 200 #ifndef _MYFUNC_H_ #define _MYFUNC_H_ class MyFunc{ public: char op[15]; char *operands[MAX_OPR]; int oprNum; char *tokenTable[MAX_TOKEN]; int tokenNum; public: MyFunc(char*); }; #endif
89295907000793b6866ed88ccaf71a3e5aea72a2
6986f1bf3e45fa60f709554ab8b39154d34274db
/Ability/ARPGCastAction.h
b9e8f84b63843720f751b8d09dfe021035af4364
[]
no_license
xindelvcheng/ARPGBasic
4edb14b5be094c16584a70ffc8c81dc8b1dc5e5c
87cf82797f6caae27f1180ce5094293808d66bd8
refs/heads/master
2023-03-16T14:55:36.112074
2021-03-06T13:17:34
2021-03-06T13:17:34
301,295,288
0
0
null
null
null
null
UTF-8
C++
false
false
10,202
h
ARPGCastAction.h
// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "CoreMinimal.h" #include "ARPGAction.h" #include "ARPGCoreSubsystem.h" #include "ARPGSpellCreature.h" #include "Engine/DataTable.h" #include "ARPGCastAction.generated.h" class AARPGCastAction; DECLARE_DYNAMIC_DELEGATE(FTaskDelegate); USTRUCT(BlueprintType) struct FTaskDescriptionStruct { GENERATED_BODY() UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="ARPGSpell") float CreateEffectCreatureTime = 0.1; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="ARPGSpell") float Duration = 1.4; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="ARPGSpell") TSubclassOf<AARPGSpellCreature> SpecialEffectCreatureClass; }; UCLASS() class UTask : public UObject { GENERATED_BODY() FTaskDelegate OnTaskExecutedDelegate; FTaskDelegate OnTaskFinishedDelegate; protected: virtual void OnTaskExecuted() { OnTaskExecutedDelegate.ExecuteIfBound(); }; virtual void OnTaskFinished(); public: float StartTime = 0.1; float Duration = 0.5; float EndTime = 0.6; FTimerHandle StartTimerHandle; FTimerHandle EndTimerHandle; FTransform Transform; UPROPERTY() AARPGCastAction* OwnerAction; template <typename T> static T* Create(TSubclassOf<UTask> TaskClass, AARPGCastAction* TaskOwnerAction, float TaskStartTime, float TaskDuration, FTaskDelegate TaskOnTaskExecuted, FTaskDelegate TaskOnTaskFinished); UFUNCTION(BlueprintCallable, Category="SpellTask") void ExecuteTask(); UFUNCTION(BlueprintCallable, Category="SpellTask") void FinishTask(); }; struct FSimpleTaskDescriptionStruct; UENUM(BlueprintType) enum class ERotationTypeEnum:uint8 { NoRotation, CircleFaceInner, CircleFaceOuter }; /** * 用于在ARPGCastAction中配置式创建ARPGSimpleTask */ USTRUCT(BlueprintType) struct FSimpleTaskDescriptionStruct : public FTaskDescriptionStruct { GENERATED_BODY() UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="ARPGSpell") FTransform LocalCoordinateTransform; }; UCLASS(BlueprintType) class UARPGSimpleTask : public UTask { GENERATED_BODY() TSubclassOf<AARPGSpellCreature> SpecialEffectCreatureClass; UPROPERTY() AARPGSpellCreature* SpecialEffectCreature; FTransform LocalTransform; virtual void OnTaskExecuted() override; virtual void OnTaskFinished() override; public: float CreatureLifeDuration = 0.5; static UARPGSimpleTask* Create(AARPGCastAction* TaskOwnerAction, FSimpleTaskDescriptionStruct ActionTaskStruct); }; UENUM() enum class ESpellTypeEnum:uint8 { Direction, Target }; UENUM() enum class ESpellCreatureClusterEnum :uint8 { Polygon, Radiation }; UENUM() enum class ESpellCreatureDirectionEnum :uint8 { Outward, Inward, Forward }; /** * 用于在ARPGCastAction中配置式创建ClusterDescriptionTask */ USTRUCT() struct FClusterTaskDescription : public FTaskDescriptionStruct { GENERATED_BODY() UPROPERTY(EditAnywhere, Category="ARPGSpell Definition") ESpellCreatureClusterEnum SpellCreatureClusterEnum; UPROPERTY(EditAnywhere, Category="ARPGSpell Definition") ESpellCreatureDirectionEnum SpellCreatureDirectionEnum; /*半径*/ UPROPERTY(EditAnywhere, Category="ARPGSpell Definition") float Radius = 100; /*弧度*/ UPROPERTY(EditAnywhere, Category="ARPGSpell Definition", meta=(EditCondition="SpellCreatureClusterEnum==ESpellCreatureClusterEnum::Radiation", EditConditionHides)) float Radian = PI / 6; UPROPERTY (EditAnywhere, Category="ARPGSpell Definition") int ElementsNum = 3; /*生成Creature的时间间隔,若不为0,Creature将逆时针依次产生,此时需注意调整Duration包含这些后续生成的Creature的存在时间*/ UPROPERTY(EditAnywhere, Category="ClusterTask") float SpawnTimeInterval = 0; UPROPERTY(EditAnywhere, Category="ClusterTask",meta=(EditCondition="SpawnTimeInterval > 0", EditConditionHides)) bool bAutoCalculateDuration = true; }; UCLASS() class UClusterTask : public UTask { GENERATED_BODY() TSubclassOf<AARPGSpellCreature> SpecialEffectCreatureClass; UPROPERTY(EditAnywhere, Category="ClusterTask") ESpellCreatureClusterEnum SpellCreatureClusterEnum; UPROPERTY(EditAnywhere, Category="ClusterTask") ESpellCreatureDirectionEnum SpellCreatureDirectionEnum; /*半径*/ UPROPERTY(EditAnywhere, Category="ClusterTask") float Radius = 100; /*弧度*/ UPROPERTY(EditAnywhere, Category="ClusterTask", meta=(EditCondition="SpellCreatureClusterEnum==ESpellCreatureClusterEnum::Radiation", EditConditionHides)) float Radian; UPROPERTY(EditAnywhere, Category="ClusterTask") int ElementsNum; int ElementIndex; UPROPERTY(EditAnywhere, Category="ClusterTask") float SpawnTimeInterval = 0; UPROPERTY() TArray<AARPGSpellCreature*> Creatures; TArray<FTimerHandle> TimerHandles; void SpawnCreatures(); void SpawnNextCreature(); protected: virtual void OnTaskExecuted() override; virtual void OnTaskFinished() override; public: static UClusterTask* Create(AARPGCastAction* TaskOwnerAction, FClusterTaskDescription ClusterTaskDescription); }; /** * 用于生成配置式生成AARPGCastAction,不需要手动创建继承AARPGCastAction的蓝图资源 */ USTRUCT(BlueprintType) struct FSimpleCastActionDescriptionStruct : public FTableRowBase { GENERATED_BODY() UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="ARPGSpell Definition") TArray<FSimpleTaskDescriptionStruct> ActionTaskStructs; UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="ARPGCastAction", meta=(AllowPrivateAccess)) TArray<FClusterTaskDescription> ActionClusterTaskStructs; UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="ARPGSpell Definition") ESpellTypeEnum SpellTypeEnum; UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="ARPGSpell Definition") float SPCost = 1; UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="ARPGSpell Definition") float MaxDistance = 1500; UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="ARPGSpell Definition") bool bUseLastTaskEndTimeAsCastActionFinishTime = true; UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="ARPGSpell Definition", meta=(AllowPrivateAccess, EditCondition= "!bUseLastTaskEndTimeAsCastActionFinishTime", EditConditionHides)) float Duration = 1.5; UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="ARPGSpell Information") FText ActionDisplayName; UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="ARPGSpell Information") UTexture2D* ItemIcon; UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="ARPGSpell Information") FText Introduction; UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="ARPGSpell Information") FText DetailDescription; }; /* * 施法型技能 */ UCLASS() class AARPGCastAction : public AARPGMultiMontageAction { GENERATED_BODY() /*ARPGCastAction的位置是定向法术的伤害中心*/ UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="ARPGCastAction", meta=(AllowPrivateAccess)) USceneComponent* DefaultSceneComponent; UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="ARPGCastAction", meta=(AllowPrivateAccess)) ESpellTypeEnum SpellTypeEnum; UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="ARPGCastAction", meta=(AllowPrivateAccess)) float SPCost = 1; UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="ARPGCastAction", meta=(AllowPrivateAccess)) float MaxDistance; UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="ARPGCastAction", meta=(AllowPrivateAccess)) bool bUseLastTaskEndTimeAsCastActionFinishTime = true; UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="ARPGCastAction", meta=(AllowPrivateAccess, EditCondition= "!bUseLastTaskEndTimeAsCastActionFinishTime", EditConditionHides)) float Duration = 1.5; UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="ARPGCastAction", meta=(AllowPrivateAccess)) TArray<FSimpleTaskDescriptionStruct> ActionSimpleTaskStructs; UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="ARPGCastAction", meta=(AllowPrivateAccess)) TArray<FClusterTaskDescription> ActionClusterTaskStructs; UPROPERTY() TArray<UTask*> Tasks; void InitTasks(); void StartAllTask(); void StopAllTask(); virtual void Tick(float DeltaSeconds) override; #if WITH_EDITOR virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override; #endif public: AARPGCastAction(); static AARPGCastAction* Create(AARPGCharacter* ActionOwnerCharacter, const FSimpleCastActionDescriptionStruct& CastActionDescription, TArray<UAnimMontage*> CastAnimMontages, FActionFinishDelegate ActionFinishedDelegate); static AARPGCastAction* Create(AARPGCharacter* ActionOwnerCharacter, const FName& SpellName, FActionFinishDelegate ActionFinishedDelegate); virtual float GetMaxDistance() { return MaxDistance; } protected: virtual void PostInitializeComponents() override; virtual void BeginPlay() override; virtual bool CheckActionActivateConditionAndPayCost() override; virtual void OnActionActivate() override; virtual void OnActionFinished(AARPGAction* Action) override; /*-Start- 施法动画仅是视觉特效 -Start-*/ virtual void OnMontageBegin(UAnimMontage* Montage) override { ; } virtual void OnMontageNotify(FName NotifyName, const FBranchingPointNotifyPayload& PointPayload) override { ; } virtual void OnMontageStop(UAnimMontage* Montage, bool bInterrupted) override { ; } /*-End- 施法动画仅是视觉特效 -End-*/ public: /*-Start- Getter & Setter -Start-*/ virtual TArray<FSimpleTaskDescriptionStruct>& GetActionTaskStructs() { return ActionSimpleTaskStructs; } virtual void SetActionTaskStructs(const TArray<FSimpleTaskDescriptionStruct>& NewActionTaskStructs) { this->ActionSimpleTaskStructs = NewActionTaskStructs; InitTasks(); } TArray<FClusterTaskDescription>& GetActionClusterTaskStructs() { return ActionClusterTaskStructs; } void SetActionClusterTaskStructs(const TArray<FClusterTaskDescription>& NewActionClusterTaskStructs) { this->ActionClusterTaskStructs = NewActionClusterTaskStructs; InitTasks(); } /*-End- Getter & Setter -End-*/ }; class UARPGDamageBoxComponent;
a46645c6176a118ad031eef1baefac2485fb91a8
c4692fbdc122876043a060756aa9ef61e563fca1
/proper/abi/include/abi/dynamic_cast-inl.h
b9b6bd1c537c4be6470176c5b61f8da47d924374
[]
no_license
nahratzah/ilias_os
837b8eabe3d638767d552206b5c2691a176069fa
a63c03a36e656cee1b897eb952a39bccc2616406
refs/heads/master
2021-01-23T13:43:55.103755
2015-06-11T07:37:01
2015-06-11T07:37:01
28,526,656
1
0
null
null
null
null
UTF-8
C++
false
false
1,425
h
dynamic_cast-inl.h
namespace __cxxabiv1 { constexpr __dyn_cast_response::__dyn_cast_response( const void* target, __has_base_result subj_visited) : target_(target), subj_visited_(subj_visited) {} inline bool __dyn_cast_response::return_now( const __dyn_cast_request& req, const void* v, const __class_type_info& v_ti) const noexcept { if (!target_) return false; if (target_ == v && v_ti == req.target_ti_) return true; // Type cannot inherit itself. /* * Stop the search if: * - target located and subject is a non-virtual base class of target * (we'll never find another target having subject as a base, due to * subject being a non-virtual base) * - multiple targets located with subject as base (virtual inheritance) * (we'll never find anything that inherits from subject, but is better * than what we've found) * - multiple targets located and subject is not a base of target-type * (compiler guarantees cross cast, which has been proven to be ambiguous). */ if (subj_visited_ == __has_base_non_virtual) return true; if (subj_visited_ == __has_base_virtual && ambiguous_) return true; if (ambiguous_ && req.is_cross_cast_) return true; /* Default: we are not sure, therefore continue search. */ return false; } inline const void* __dyn_cast_response::resolution() const noexcept { return (ambiguous_ ? nullptr : target_); } } /* namespace __cxxabiv1 */
43daf46548457ab7334b4677f2871cd8067162ee
88b2f6deebd75bbaea1c60c9655b1560fc1675c4
/project5/project5.cpp
a36a9d2fb6154b0ce3f11be2442f088820b09c40
[]
no_license
mitchellreyes/CS202
6ae537a0316717e9d90b8f7b6480f611da73a0e5
55fc557311ef97308a14f02aa4c3bcd3af089643
refs/heads/master
2021-01-10T06:37:58.013331
2016-02-08T19:51:43
2016-02-08T19:51:43
51,321,465
0
0
null
null
null
null
UTF-8
C++
false
false
2,432
cpp
project5.cpp
#include <iostream> #include <fstream> #include <ctime> #include <cstdlib> #include "string.h" #include "class.h" using namespace std; void printReel(symbol *reel); void readIn(ifstream &fin, symbol *readInArray); void populateReel(symbol *readInArray, symbol *reel); void selectReel(symbol *reel); int main(){ srand(time(NULL)); char *filename = new char[20]; cout << "What file needs to be inputted?: "; cin >> filename; ifstream fin(filename); symbol *readInArray = new symbol[6]; symbol *reel = new symbol[10]; if(fin.good()){ int x; readIn(fin, readInArray); do{ do{ cout << endl; cout << "1. Reconfigure/Configure slots" << endl; cout << "2. Print configuration" << endl; cout << "3. Choose a reel and stop" << endl; cout << "4. Quit" << endl; cout << "Choose a option from the menu above: "; cin >> x; cout << endl; }while(x < 0 && x > 4); switch(x){ case 1: populateReel(readInArray, reel); break; case 2: cout << endl; printReel(reel); cout << endl; break; case 3: selectReel(reel); break; default: cout << "Thanks." << endl << endl; break; } }while(x != 4); }else{ cout << "Error: No file to be found." << endl; } } void readIn(ifstream &fin, symbol *readInArray){ symbol *readInArrayHome = readInArray; for(int i = 0; i < 6; i++){ char *temp=new char[20]; fin >> temp; int length = stringLen(temp); (*readInArray).setName(temp, length); int x; fin >> x; (*readInArray).setBonus(x); readInArray++; delete[]temp; } readInArray = readInArrayHome; } void populateReel(symbol *readInArray, symbol *reel){ symbol *readInArrayHome = readInArray; symbol *reelHome = reel; for(int i = 0; i < 10; i++){ for(int k = 0; k < rand()%6; k++){ readInArray++; } int length = stringLen((*readInArray).getName()); (*reel).setName((*readInArray).getName(), length); (*reel).setBonus((*readInArray).getBonus()); readInArray = readInArrayHome; reel++; } readInArray = readInArrayHome; reel = reelHome; } void printReel(symbol *reel){ symbol* reelHome = reel; for(int i = 0; i < 10; i++){ (*reel).print(); reel++; } reel = reelHome; } void selectReel(symbol *reel){ symbol *reelHome = reel; int x; cout << "Which reel do you want? (1-10): "; cin >> x; for(int i = 1; i < x; i++){ reel++; } (*reel).print(); reel = reelHome; }
cf359f8c8f3d5dec4e7c523720bf3bf46d649976
939e2bf9da21ef16f60d418b21ef91601ae03cff
/src/ZeroConfiguration/EspZeroConfiguration.cpp
0929df6becf86c091bec19847fe80a1bc44c879b
[]
no_license
ThingifyIOT/ThingifyEsp
3820418a3c4adfc610f75135fc84b7efcad97a64
1844dd196b4e02266be0a888b46ecab2e2440829
refs/heads/master
2023-08-07T04:30:43.798009
2023-07-30T14:55:30
2023-07-30T14:55:30
203,222,935
0
0
null
null
null
null
UTF-8
C++
false
false
2,965
cpp
EspZeroConfiguration.cpp
#include "EspZeroConfiguration.h" #include "ThingifyUtils.h" EspZeroConfiguration::EspZeroConfiguration(SettingsStorage& settingsStorage): _settingsStorage(settingsStorage), _logger(LoggerInstance) { } void EspZeroConfiguration::Start() { ChangeState(ZeroConfigurationState::SmartConfigWifi); _smartConfigServer.Start(); _espSmartConfig.Start(); } ZeroConfigurationState EspZeroConfiguration::Loop() { if(_state == ZeroConfigurationState::SmartConfigWifi) { auto smartConfigState = _espSmartConfig.Loop(); if(smartConfigState == SmartConfigState::Success) { ChangeState(ZeroConfigurationState::SmartConfigServer); } if(smartConfigState == SmartConfigState::Error) { ChangeState(ZeroConfigurationState::Error); } if(millis() - _stateChangeTime > WifiConfigurationTimeout) { _logger.err(F("Timout waiting for smart config details")); ChangeState(ZeroConfigurationState::Error); } } if(_state == ZeroConfigurationState::SmartConfigServer) { auto zeroConfigurationPacket = _smartConfigServer.Loop(); if(zeroConfigurationPacket != nullptr) { ThingSettings settings; ZeroConfigurationPacketToSettings(zeroConfigurationPacket, settings); delete zeroConfigurationPacket; _logger.info(L("Got settings from smart config:")); ThingifyUtils::LogSettings(_logger, settings); _settingsStorage.Clear(); _settingsStorage.Set(settings); ChangeState(ZeroConfigurationState::Success); } else if(millis() - _stateChangeTime > ServerConfigurationTimeout) { _logger.err(F("Timout waiting for config packet in server")); ChangeState(ZeroConfigurationState::Error); } } return _state; } void EspZeroConfiguration::ChangeState(ZeroConfigurationState state) { if(_state == state) { return; } if(state == ZeroConfigurationState::Error || state == ZeroConfigurationState::Success || state == ZeroConfigurationState::Stopped) { _smartConfigServer.Stop(); _espSmartConfig.Stop(); } _state = state; _stateChangeTime = millis(); } void EspZeroConfiguration::ZeroConfigurationPacketToSettings(ZeroConfigurationPacket *packet, ThingSettings &settings) { settings.Token = packet->Token; settings.ApiServer = packet->ApiServer; settings.ApiPort = packet->ApiPort; for(int i=0; i < packet->WifiNetworks.size(); i++) { auto network = new WifiCredential( packet->WifiNetworks[i]->Name, packet->WifiNetworks[i]->Password ); settings.WifiNetworks.push_back(network); } } bool EspZeroConfiguration::IsReady() { return _state == ZeroConfigurationState::Success || _state == ZeroConfigurationState::Error; }
f3a12a154c5cf71bb90f953e7dd6b713086a15dc
bae01f64040da08d544b47b40e6063be796cbe37
/CppND-System-Monitor/include/processor.h
82d125f5a02fecad70509ce5443ebef003af004b
[ "MIT" ]
permissive
monark12/UDACITY-CPP-Nanodegree
19dc47bb0bd824356b4aed1487d24a935e1a0bc6
2ca7f51ae8b3c46764cc5f111b1eb2b19f05771a
refs/heads/master
2022-11-10T21:21:46.382490
2020-07-03T11:57:10
2020-07-03T11:57:10
269,034,942
1
0
null
null
null
null
UTF-8
C++
false
false
369
h
processor.h
#ifndef PROCESSOR_H #define PROCESSOR_H class Processor { public: float Utilization(); // TODO: See src/processor.cpp // TODO: Declare any necessary private members private: float previdle=0.0; float previowait=0.0; float prevuser=0.0; float prevnice=0.0; float prevsystem=0.0; float previrq=0.0; float prevsoftirq=0.0; float prevsteal=0.0; }; #endif
0152bf89c1d3dde5ca4f6c04eaff46a6a7393128
6aada0781661525baa370e53c341e75ba2d488d7
/DesignPatterns/StructuralPatterns/StructuralPatterns/Glyph.cpp
f7fbd1ba150bb35bc6669ca4ab4c2d50ea5f3b96
[]
no_license
Zerophase/CodeFromBooks
2aaf50e07bce39406ad4e4723545e5f0f45c075f
fef44a217cbb33991c29157aa6f60af0b457315b
refs/heads/master
2021-01-22T13:08:19.788541
2015-01-02T05:04:32
2015-01-02T05:04:32
28,703,442
0
1
null
null
null
null
UTF-8
C++
false
false
556
cpp
Glyph.cpp
#include "Glyph.h" #include "Window.h" #include "GlyphContext.h" #include "Font.h" Glyph::Glyph() { } Glyph::~Glyph() { } void Glyph::Draw(Window *window, GlyphContext &glyphContext) { } void Glyph::SetFont(Font *font, GlyphContext &glyphContext) { } void Glyph::Next(GlyphContext &glyphContext) { } void Glyph::IsDone(GlyphContext &glyphContext) { } Glyph *Glyph::Current(GlyphContext &glyphContext) { return new Glyph; } void Glyph::Insert(Glyph *glyph, GlyphContext &glyphContext) { } void Glyph::Remove(GlyphContext &glyphContext) { }
a1fec92d7493ca6756d8bea5aae2bb02a5419301
88ae8695987ada722184307301e221e1ba3cc2fa
/buildtools/third_party/libc++/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/integral.pass.cpp
161d55cad5868f5ade65266734ae9dd21e383bde
[ "BSD-3-Clause", "NCSA", "MIT", "LLVM-exception", "Apache-2.0" ]
permissive
iridium-browser/iridium-browser
71d9c5ff76e014e6900b825f67389ab0ccd01329
5ee297f53dc7f8e70183031cff62f37b0f19d25f
refs/heads/master
2023-08-03T16:44:16.844552
2023-07-20T15:17:00
2023-07-23T16:09:30
220,016,632
341
40
BSD-3-Clause
2021-08-13T13:54:45
2019-11-06T14:32:31
null
UTF-8
C++
false
false
2,138
cpp
integral.pass.cpp
//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // type_traits // integral #include <type_traits> #include "test_macros.h" template <class T> void test_integral_imp() { static_assert(!std::is_void<T>::value, ""); #if TEST_STD_VER > 11 static_assert(!std::is_null_pointer<T>::value, ""); #endif static_assert( std::is_integral<T>::value, ""); static_assert(!std::is_floating_point<T>::value, ""); static_assert(!std::is_array<T>::value, ""); static_assert(!std::is_pointer<T>::value, ""); static_assert(!std::is_lvalue_reference<T>::value, ""); static_assert(!std::is_rvalue_reference<T>::value, ""); static_assert(!std::is_member_object_pointer<T>::value, ""); static_assert(!std::is_member_function_pointer<T>::value, ""); static_assert(!std::is_enum<T>::value, ""); static_assert(!std::is_union<T>::value, ""); static_assert(!std::is_class<T>::value, ""); static_assert(!std::is_function<T>::value, ""); } template <class T> void test_integral() { test_integral_imp<T>(); test_integral_imp<const T>(); test_integral_imp<volatile T>(); test_integral_imp<const volatile T>(); } struct incomplete_type; int main(int, char**) { test_integral<bool>(); test_integral<char>(); test_integral<signed char>(); test_integral<unsigned char>(); test_integral<wchar_t>(); test_integral<short>(); test_integral<unsigned short>(); test_integral<int>(); test_integral<unsigned int>(); test_integral<long>(); test_integral<unsigned long>(); test_integral<long long>(); test_integral<unsigned long long>(); #ifndef TEST_HAS_NO_INT128 test_integral<__int128_t>(); test_integral<__uint128_t>(); #endif // LWG#2582 static_assert(!std::is_integral<incomplete_type>::value, ""); return 0; }
f60b8ea27c730c33f0c36e608e753218de60a3fb
e1259e991c1560e0cd420dc5605305000c0288e9
/assignment_2/Problem3.cpp
283d093d29295ffa732cc3b0e2259e3bab469cfa
[]
no_license
gauravgupta2299/CSN-212_Assignments
7795a297dce9fbca45eec137a6bc05a66f1d044d
5d38ec3fd143f01af0343bf8166ebadce94d90f0
refs/heads/master
2021-01-13T16:38:11.744088
2017-04-11T16:16:04
2017-04-11T16:16:04
78,884,824
0
0
null
null
null
null
UTF-8
C++
false
false
597
cpp
Problem3.cpp
#include <bits/stdc++.h> using namespace std; int luckyDraw(int arr[],int n){ int best=1;int LIS[n]; int longest=1; for(int i=0;i<n;i++)LIS[i]=1; for(int i=0;i<n;i++){ for(int j=i;j<i+n;j++){ for(int k=i;k<j;k++){ if(arr[k%n]<arr[j%n] && LIS[j%n]<LIS[k%n]+1) LIS[j%n]=LIS[k%n]+1; } longest=max(longest,LIS[j%n]); } best=max(best,longest); for(int i=0;i<n;i++)LIS[i]=1; }return best; } int main(){ int t,n; cin>>t; for(int i=0;i<t;i++){ cin>>n; int * arr=new int[n]; for(int j=0;j<n;j++){ cin>>arr[j]; } cout<<luckyDraw(arr,n)<<endl; } return 0; }
0806449c969c04ea6f0eeb1cf09315d058e336f9
f0645692aa6232007fd778dedfceda00b3fae57d
/Model-Generator/models/atrias/gen/mathematica/opt/src/J_naturalDynamics15.cc
96ba1bab60defb10d3f90793aa52760ce1cb617c
[]
no_license
yukaigong/3D_Marlo_Yukai
a57b753d95b07c3d0640989b9722e01e8f984711
4c4071957ba147829969c7341b77662c36dda8ab
refs/heads/master
2022-10-23T14:21:08.563453
2017-04-12T16:55:14
2017-04-12T16:55:14
null
0
0
null
null
null
null
UTF-8
C++
false
false
205,721
cc
J_naturalDynamics15.cc
/* * Automatically Generated from Mathematica. * Thu 26 Jan 2017 21:36:47 GMT-05:00 */ #include "math2mat.hpp" /* * Sub functions */ static void output1(double *p_output1,const double *var) { double t1; double t2; double t3; double t4; double t5; double t6; double t7; double t8; double t9; double t10; double t11; double t12; double t13; double t14; double t15; double t16; double t17; double t18; double t19; double t20; double t21; double t22; double t23; double t24; double t25; double t26; double t27; double t28; double t29; double t30; double t31; double t32; double t33; double t34; double t35; double t36; double t37; double t38; double t39; double t40; double t41; double t42; double t43; double t44; double t45; double t46; double t47; double t48; double t49; double t50; double t51; double t52; double t53; double t54; double t55; double t56; double t57; double t58; double t59; double t60; double t61; double t62; double t63; double t64; double t65; double t66; double t67; double t68; double t69; double t70; double t71; double t72; double t73; double t74; double t75; double t76; double t77; double t78; double t79; double t80; double t81; double t82; double t83; double t84; double t85; double t86; double t87; double t88; double t89; double t90; double t91; double t92; double t93; double t94; double t95; double t96; double t97; double t98; double t99; double t100; double t101; double t102; double t103; double t104; double t105; double t106; double t107; double t108; double t109; double t110; double t111; double t112; double t113; double t114; double t115; double t116; double t117; double t118; double t119; double t120; double t121; double t122; double t123; double t124; double t125; double t126; double t127; double t128; double t129; double t130; double t131; double t132; double t133; double t134; double t135; double t136; double t137; double t138; double t139; double t140; double t141; double t142; double t143; double t144; double t145; double t146; double t147; double t148; double t149; double t150; double t151; double t152; double t153; double t154; double t155; double t156; double t157; double t158; double t159; double t160; double t161; double t162; double t163; double t164; double t165; double t166; double t167; double t168; double t169; double t170; double t171; double t172; double t173; double t174; double t175; double t176; double t177; double t178; double t179; double t180; double t181; double t182; double t183; double t184; double t185; double t186; double t187; double t188; double t189; double t190; double t191; double t192; double t193; double t194; double t195; double t196; double t197; double t198; double t199; double t200; double t201; double t202; double t203; double t204; double t205; double t206; double t207; double t208; double t209; double t210; double t211; double t212; double t213; double t214; double t215; double t216; double t217; double t218; double t219; double t220; double t221; double t222; double t223; double t224; double t225; double t226; double t227; double t228; double t229; double t230; double t231; double t232; double t233; double t234; double t235; double t236; double t237; double t238; double t239; double t240; double t241; double t242; double t243; double t244; double t245; double t246; double t247; double t248; double t249; double t250; double t251; double t252; double t253; double t254; double t255; double t256; double t257; double t258; double t259; double t260; double t261; double t262; double t263; double t264; double t265; double t266; double t267; double t268; double t269; double t270; double t271; double t272; double t273; double t274; double t275; double t276; double t277; double t278; double t279; double t280; double t281; double t282; double t283; double t284; double t285; double t286; double t287; double t288; double t289; double t290; double t291; double t292; double t293; double t294; double t295; double t296; double t297; double t298; double t299; double t300; double t301; double t302; double t303; double t304; double t305; double t306; double t307; double t308; double t309; double t310; double t311; double t312; double t313; double t314; double t315; double t316; double t317; double t318; double t319; double t320; double t321; double t322; double t323; double t324; double t325; double t326; double t327; double t328; double t329; double t330; double t331; double t332; double t333; double t334; double t335; double t336; double t337; double t338; double t339; double t340; double t341; double t342; double t343; double t344; double t345; double t346; double t347; double t348; double t349; double t350; double t351; double t352; double t353; double t354; double t355; double t356; double t357; double t358; double t359; double t360; double t361; double t362; double t363; double t364; double t365; double t366; double t367; double t368; double t369; double t370; double t371; double t372; double t373; double t374; double t375; double t376; double t377; double t378; double t379; double t380; double t381; double t382; double t383; double t384; double t385; double t386; double t387; double t388; double t389; double t390; double t391; double t392; double t393; double t394; double t395; double t396; double t397; double t398; double t399; double t400; double t401; double t402; double t403; double t404; double t405; double t406; double t407; double t408; double t409; double t410; double t411; double t412; double t413; double t414; double t415; double t416; double t417; double t418; double t419; double t420; double t421; double t422; double t423; double t424; double t425; double t426; double t427; double t428; double t429; double t430; double t431; double t432; double t433; double t434; double t435; double t436; double t437; double t438; double t439; double t440; double t441; double t442; double t443; double t444; double t445; double t446; double t447; double t448; double t449; double t450; double t451; double t452; double t453; double t454; double t455; double t456; double t457; double t458; double t459; double t460; double t461; double t462; double t463; double t464; double t465; double t466; double t467; double t468; double t469; double t470; double t471; double t472; double t473; double t474; double t475; double t476; double t477; double t478; double t479; double t480; double t481; double t482; double t483; double t484; double t485; double t486; double t487; double t488; double t489; double t490; double t491; double t492; double t493; double t494; double t495; double t496; double t497; double t498; double t499; double t500; double t501; double t502; double t503; double t504; double t505; double t506; double t507; double t508; double t509; double t510; double t511; double t512; double t513; double t514; double t515; double t516; double t517; double t518; double t519; double t520; double t521; double t522; double t523; double t524; double t525; double t526; double t527; double t528; double t529; double t530; double t531; double t532; double t533; double t534; double t535; double t536; double t537; double t538; double t539; double t540; double t541; double t542; double t543; double t544; double t545; double t546; double t547; double t548; double t549; double t550; double t551; double t552; double t553; double t554; double t555; double t556; double t557; double t558; double t559; double t560; double t561; double t562; double t563; double t564; double t565; double t566; double t567; double t568; double t569; double t570; double t571; double t572; double t573; double t574; double t575; double t576; double t577; double t578; double t579; double t580; double t581; double t582; double t583; double t584; double t585; double t586; double t587; double t588; double t589; double t590; double t591; double t592; double t593; double t594; double t595; double t596; double t597; double t598; double t599; double t600; double t601; double t602; double t603; double t604; double t605; double t606; double t607; double t608; double t609; double t610; double t611; double t612; double t613; double t614; double t615; double t616; double t617; double t618; double t619; double t620; double t621; double t622; double t623; double t624; double t625; double t626; double t627; double t628; double t629; double t630; double t631; double t632; double t633; double t634; double t635; double t636; double t637; double t638; double t639; double t640; double t641; double t642; double t643; double t644; double t645; double t646; double t647; double t648; double t649; double t650; double t651; double t652; double t653; double t654; double t655; double t656; double t657; double t658; double t659; double t660; double t661; double t662; double t663; double t664; double t665; double t666; double t667; double t668; double t669; double t670; double t671; double t672; double t673; double t674; double t675; double t676; double t677; double t678; double t679; double t680; double t681; double t682; double t683; double t684; double t685; double t686; double t687; double t688; double t689; double t690; double t691; double t692; double t693; double t694; double t695; double t696; double t697; double t698; double t699; double t700; double t701; double t702; double t703; double t704; double t705; double t706; double t707; double t708; double t709; double t710; double t711; double t712; double t713; double t714; double t715; double t716; double t717; double t718; double t719; double t720; double t721; double t722; double t723; double t724; double t725; double t726; double t727; double t728; double t729; double t730; double t731; double t732; double t733; double t734; double t735; double t736; double t737; double t738; double t739; double t740; double t741; double t742; double t743; double t744; double t745; double t746; double t747; double t748; double t749; double t750; double t751; double t752; double t753; double t754; double t755; double t756; double t757; double t758; double t759; double t760; double t761; double t762; double t763; double t764; double t765; double t766; double t767; double t768; double t769; double t770; double t771; double t772; double t773; double t774; double t775; double t776; double t777; double t778; double t779; double t780; double t781; double t782; double t783; double t784; double t785; double t786; double t787; double t788; double t789; double t790; double t791; double t792; double t793; double t794; double t795; double t796; double t797; double t798; double t799; double t800; double t801; double t802; double t803; double t804; double t805; double t806; double t807; double t808; double t809; double t810; double t811; double t812; double t813; double t814; double t815; double t816; double t817; double t818; double t819; double t820; double t821; double t822; double t823; double t824; double t825; double t826; double t827; double t828; double t829; double t830; double t831; double t832; double t833; double t834; double t835; double t836; double t837; double t838; double t839; double t840; double t841; double t842; double t843; double t844; double t845; double t846; double t847; double t848; double t849; double t850; double t851; double t852; double t853; double t854; double t855; double t856; double t857; double t858; double t859; double t860; double t861; double t862; double t863; double t864; double t865; double t866; double t867; double t868; double t869; double t870; double t871; double t872; double t873; double t874; double t875; double t876; double t877; double t878; double t879; double t880; double t881; double t882; double t883; double t884; double t885; double t886; double t887; double t888; double t889; double t890; double t891; double t892; double t893; double t894; double t895; double t896; double t897; double t898; double t899; double t900; double t901; double t902; double t903; double t904; double t905; double t906; double t907; double t908; double t909; double t910; double t911; double t912; double t913; double t914; double t915; double t916; double t917; double t918; double t919; double t920; double t921; double t922; double t923; double t924; double t925; double t926; double t927; double t928; double t929; double t930; double t931; double t932; double t933; double t934; double t935; double t936; double t937; double t938; double t939; double t940; double t941; double t942; double t943; double t944; double t945; double t946; double t947; double t948; double t949; double t950; double t951; double t952; double t953; double t954; double t955; double t956; double t957; double t958; double t959; double t960; double t961; double t962; double t963; double t964; double t965; double t966; double t967; double t968; double t969; double t970; double t971; double t972; double t973; double t974; double t975; double t976; double t977; double t978; double t979; double t980; double t981; double t982; double t983; double t984; double t985; double t986; double t987; double t988; double t989; double t990; double t991; double t992; double t993; double t994; double t995; double t996; double t997; double t998; double t999; double t1000; double t1001; double t1002; double t1003; double t1004; double t1005; double t1006; double t1007; double t1008; double t1009; double t1010; double t1011; double t1012; double t1013; double t1014; double t1015; double t1016; double t1017; double t1018; double t1019; double t1020; double t1021; double t1022; double t1023; double t1024; double t1025; double t1026; double t1027; double t1028; double t1029; double t1030; double t1031; double t1032; double t1033; double t1034; double t1035; double t1036; double t1037; double t1038; double t1039; double t1040; double t1041; double t1042; double t1043; double t1044; double t1045; double t1046; double t1047; double t1048; double t1049; double t1050; double t1051; double t1052; double t1053; double t1054; double t1055; double t1056; double t1057; double t1058; double t1059; double t1060; double t1061; double t1062; double t1063; double t1064; double t1065; double t1066; double t1067; double t1068; double t1069; double t1070; double t1071; double t1072; double t1073; double t1074; double t1075; double t1076; double t1077; double t1078; double t1079; double t1080; double t1081; double t1082; double t1083; double t1084; double t1085; double t1086; double t1087; double t1088; double t1089; double t1090; double t1091; double t1092; double t1093; double t1094; double t1095; double t1096; double t1097; double t1098; double t1099; double t1100; double t1101; double t1102; double t1103; double t1104; double t1105; double t1106; double t1107; double t1108; double t1109; double t1110; double t1111; double t1112; double t1113; double t1114; double t1115; double t1116; double t1117; double t1118; double t1119; double t1120; double t1121; double t1122; double t1123; double t1124; double t1125; double t1126; double t1127; double t1128; double t1129; double t1130; double t1131; double t1132; double t1133; double t1134; double t1135; double t1136; double t1137; double t1138; double t1139; double t1140; double t1141; double t1142; double t1143; double t1144; double t1145; double t1146; double t1147; double t1148; double t1149; double t1150; double t1151; double t1152; double t1153; double t1154; double t1155; double t1156; double t1157; double t1158; double t1159; double t1160; double t1161; double t1162; double t1163; double t1164; double t1165; double t1166; double t1167; double t1168; double t1169; double t1170; double t1171; double t1172; double t1173; double t1174; double t1175; double t1176; double t1177; double t1178; double t1179; double t1180; double t1181; double t1182; double t1183; double t1184; double t1185; double t1186; double t1187; double t1188; double t1189; double t1190; double t1191; double t1192; double t1193; double t1194; double t1195; double t1196; double t1197; double t1198; double t1199; double t1200; double t1201; double t1202; double t1203; double t1204; double t1205; double t1206; double t1207; double t1208; double t1209; double t1210; double t1211; double t1212; double t1213; double t1214; double t1215; double t1216; double t1217; double t1218; double t1219; double t1220; double t1221; double t1222; double t1223; double t1224; double t1225; double t1226; double t1227; double t1228; double t1229; double t1230; double t1231; double t1232; double t1233; double t1234; double t1235; double t1236; double t1237; double t1238; double t1239; double t1240; double t1241; double t1242; double t1243; double t1244; double t1245; double t1246; double t1247; double t1248; double t1249; double t1250; double t1251; double t1252; double t1253; double t1254; double t1255; double t1256; double t1257; double t1258; double t1259; double t1260; double t1261; double t1262; double t1263; double t1264; double t1265; double t1266; double t1267; double t1268; double t1269; double t1270; double t1271; double t1272; double t1273; double t1274; double t1275; double t1276; double t1277; double t1278; double t1279; double t1280; double t1281; double t1282; double t1283; double t1284; double t1285; double t1286; double t1287; double t1288; double t1289; double t1290; double t1291; double t1292; double t1293; double t1294; double t1295; double t1296; double t1297; double t1298; double t1299; double t1300; double t1301; double t1302; double t1303; double t1304; double t1305; double t1306; double t1307; double t1308; double t1309; double t1310; double t1311; double t1312; double t1313; double t1314; double t1315; double t1316; double t1317; double t1318; double t1319; double t1320; double t1321; double t1322; double t1323; double t1324; double t1325; double t1326; double t1327; double t1328; double t1329; double t1330; double t1331; double t1332; double t1333; double t1334; double t1335; double t1336; double t1337; double t1338; double t1339; double t1340; double t1341; double t1342; double t1343; double t1344; double t1345; double t1346; double t1347; double t1348; double t1349; double t1350; double t1351; double t1352; double t1353; double t1354; double t1355; double t1356; double t1357; double t1358; double t1359; double t1360; double t1361; double t1362; double t1363; double t1364; double t1365; double t1366; double t1367; double t1368; double t1369; double t1370; double t1371; double t1372; double t1373; double t1374; double t1375; double t1376; double t1377; double t1378; double t1379; double t1380; double t1381; double t1382; double t1383; double t1384; double t1385; double t1386; double t1387; double t1388; double t1389; double t1390; double t1391; double t1392; double t1393; double t1394; double t1395; double t1396; double t1397; double t1398; double t1399; double t1400; double t1401; double t1402; double t1403; double t1404; double t1405; double t1406; double t1407; double t1408; double t1409; double t1410; double t1411; double t1412; double t1413; double t1414; double t1415; double t1416; double t1417; double t1418; double t1419; double t1420; double t1421; double t1422; double t1423; double t1424; double t1425; double t1426; double t1427; double t1428; double t1429; double t1430; double t1431; double t1432; double t1433; double t1434; double t1435; double t1436; double t1437; double t1438; double t1439; double t1440; double t1441; double t1442; double t1443; double t1444; double t1445; double t1446; double t1447; double t1448; double t1449; double t1450; double t1451; double t1452; double t1453; double t1454; double t1455; double t1456; double t1457; double t1458; double t1459; double t1460; double t1461; double t1462; double t1463; double t1464; double t1465; double t1466; double t1467; double t1468; double t1469; double t1470; double t1471; double t1472; double t1473; double t1474; double t1475; double t1476; double t1477; double t1478; double t1479; double t1480; double t1481; double t1482; double t1483; double t1484; double t1485; double t1486; double t1487; double t1488; double t1489; double t1490; double t1491; double t1492; double t1493; double t1494; double t1495; double t1496; double t1497; double t1498; double t1499; double t1500; double t1501; double t1502; double t1503; double t1504; double t1505; double t1506; double t1507; double t1508; double t1509; double t1510; double t1511; double t1512; double t1513; double t1514; double t1515; double t1516; double t1517; double t1518; double t1519; double t1520; double t1521; double t1522; double t1523; double t1524; double t1525; double t1526; double t1527; double t1528; double t1529; double t1530; double t1531; double t1532; double t1533; double t1534; double t1535; double t1536; double t1537; double t1538; double t1539; double t1540; double t1541; double t1542; double t1543; double t1544; double t1545; double t1546; double t1547; double t1548; double t1549; double t1550; double t1551; double t1552; double t1553; double t1554; double t1555; double t1556; double t1557; double t1558; double t1559; double t1560; double t1561; double t1562; double t1563; double t1564; double t1565; double t1566; double t1567; double t1568; double t1569; double t1570; double t1571; double t1572; double t1573; double t1574; double t1575; double t1576; double t1577; double t1578; double t1579; double t1580; double t1581; double t1582; double t1583; double t1584; double t1585; double t1586; double t1587; double t1588; double t1589; double t1590; double t1591; double t1592; double t1593; double t1594; double t1595; double t1596; double t1597; double t1598; double t1599; double t1600; double t1601; double t1602; double t1603; double t1604; double t1605; double t1606; double t1607; double t1608; double t1609; double t1610; double t1611; double t1612; double t1613; double t1614; double t1615; double t1616; double t1617; double t1618; double t1619; double t1620; double t1621; double t1622; double t1623; double t1624; double t1625; double t1626; double t1627; double t1628; double t1629; double t1630; double t1631; double t1632; double t1633; double t1634; double t1635; double t1636; double t1637; double t1638; double t1639; double t1640; double t1641; double t1642; double t1643; double t1644; double t1645; double t1646; double t1647; double t1648; double t1649; double t1650; double t1651; double t1652; double t1653; double t1654; double t1655; double t1656; double t1657; double t1658; double t1659; double t1660; double t1661; double t1662; double t1663; double t1664; double t1665; double t1666; double t1667; double t1668; double t1669; double t1670; double t1671; double t1672; double t1673; double t1674; double t1675; double t1676; double t1677; double t1678; double t1679; double t1680; double t1681; double t1682; double t1683; double t1684; double t1685; double t1686; double t1687; double t1688; double t1689; double t1690; double t1691; double t1692; double t1693; double t1694; double t1695; double t1696; double t1697; double t1698; double t1699; double t1700; double t1701; double t1702; double t1703; double t1704; double t1705; double t1706; double t1707; double t1708; double t1709; double t1710; double t1711; double t1712; double t1713; double t1714; double t1715; double t1716; double t1717; double t1718; double t1719; double t1720; double t1721; double t1722; double t1723; double t1724; double t1725; double t1726; double t1727; double t1728; double t1729; double t1730; double t1731; double t1732; double t1733; double t1734; double t1735; double t1736; double t1737; double t1738; double t1739; double t1740; double t1741; double t1742; double t1743; double t1744; double t1745; double t1746; double t1747; double t1748; double t1749; double t1750; double t1751; double t1752; double t1753; double t1754; double t1755; double t1756; double t1757; double t1758; double t1759; double t1760; double t1761; double t1762; double t1763; double t1764; double t1765; double t1766; double t1767; double t1768; double t1769; double t1770; double t1771; double t1772; double t1773; double t1774; double t1775; double t1776; double t1777; double t1778; double t1779; double t1780; double t1781; double t1782; double t1783; double t1784; double t1785; double t1786; double t1787; double t1788; double t1789; double t1790; double t1791; double t1792; double t1793; double t1794; double t1795; double t1796; double t1797; double t1798; double t1799; double t1800; double t1801; double t1802; double t1803; double t1804; double t1805; double t1806; double t1807; double t1808; double t1809; double t1810; double t1811; double t1812; double t1813; double t1814; double t1815; double t1816; double t1817; double t1818; double t1819; double t1820; double t1821; double t1822; double t1823; double t1824; double t1825; double t1826; double t1827; double t1828; double t1829; double t1830; double t1831; double t1832; double t1833; double t1834; double t1835; double t1836; double t1837; double t1838; double t1839; double t1840; double t1841; double t1842; double t1843; double t1844; double t1845; double t1846; double t1847; double t1848; double t1849; double t1850; double t1851; double t1852; double t1853; double t1854; double t1855; double t1856; double t1857; double t1858; double t1859; double t1860; double t1861; double t1862; double t1863; double t1864; double t1865; double t1866; double t1867; double t1868; double t1869; double t1870; double t1871; double t1872; double t1873; double t1874; double t1875; double t1876; double t1877; double t1878; double t1879; double t1880; double t1881; double t1882; double t1883; double t1884; double t1885; double t1886; double t1887; double t1888; double t1889; double t1890; double t1891; double t1892; double t1893; double t1894; double t1895; double t1896; double t1897; double t1898; double t1899; double t1900; double t1901; double t1902; double t1903; double t1904; double t1905; double t1906; double t1907; double t1908; double t1909; double t1910; double t1911; double t1912; double t1913; double t1914; double t1915; double t1916; double t1917; double t1918; double t1919; double t1920; double t1921; double t1922; double t1923; double t1924; double t1925; double t1926; double t1927; double t1928; double t1929; double t1930; double t1931; double t1932; double t1933; double t1934; double t1935; double t1936; double t1937; double t1938; double t1939; double t1940; double t1941; double t1942; double t1943; double t1944; double t1945; double t1946; double t1947; double t1948; double t1949; double t1950; double t1951; double t1952; double t1953; double t1954; double t1955; double t1956; double t1957; double t1958; double t1959; double t1960; double t1961; double t1962; double t1963; double t1964; double t1965; double t1966; double t1967; double t1968; double t1969; double t1970; double t1971; double t1972; double t1973; double t1974; double t1975; double t1976; double t1977; double t1978; double t1979; double t1980; double t1981; double t1982; double t1983; double t1984; double t1985; double t1986; double t1987; double t1988; double t1989; double t1990; double t1991; double t1992; double t1993; double t1994; double t1995; double t1996; double t1997; double t1998; double t1999; double t2000; double t2001; double t2002; double t2003; double t2004; double t2005; double t2006; double t2007; double t2008; double t2009; double t2010; double t2011; double t2012; double t2013; double t2014; double t2015; double t2016; double t2017; double t2018; double t2019; double t2020; double t2021; double t2022; double t2023; double t2024; double t2025; double t2026; double t2027; double t2028; double t2029; double t2030; double t2031; double t2032; double t2033; double t2034; double t2035; double t2036; double t2037; double t2038; double t2039; double t2040; double t2041; double t2042; double t2043; double t2044; double t2045; double t2046; double t2047; double t2048; double t2049; double t2050; double t2051; double t2052; double t2053; double t2054; double t2055; double t2056; double t2057; double t2058; double t2059; double t2060; double t2061; double t2062; double t2063; double t2064; double t2065; double t2066; double t2067; double t2068; double t2069; double t2070; double t2071; double t2072; double t2073; double t2074; double t2075; double t2076; double t2077; double t2078; double t2079; double t2080; double t2081; double t2082; double t2083; double t2084; double t2085; double t2086; double t2087; double t2088; double t2089; double t2090; double t2091; double t2092; double t2093; double t2094; double t2095; double t2096; double t2097; double t2098; double t2099; double t2100; double t2101; double t2102; double t2103; double t2104; double t2105; double t2106; double t2107; double t2108; double t2109; double t2110; double t2111; double t2112; double t2113; double t2114; double t2115; double t2116; double t2117; double t2118; double t2119; double t2120; double t2121; double t2122; double t2123; double t2124; double t2125; double t2126; double t2127; double t2128; double t2129; double t2130; double t2131; double t2132; double t2133; double t2134; double t2135; double t2136; double t2137; double t2138; double t2139; double t2140; double t2141; double t2142; double t2143; double t2144; double t2145; double t2146; double t2147; double t2148; double t2149; double t2150; double t2151; double t2152; double t2153; double t2154; double t2155; double t2156; double t2157; double t2158; double t2159; double t2160; double t2161; double t2162; double t2163; double t2164; double t2165; double t2166; double t2167; double t2168; double t2169; double t2170; double t2171; double t2172; double t2173; double t2174; double t2175; double t2176; double t2177; double t2178; double t2179; double t2180; double t2181; double t2182; double t2183; double t2184; double t2185; double t2186; double t2187; double t2188; double t2189; double t2190; double t2191; double t2192; double t2193; double t2194; double t2195; double t2196; double t2197; double t2198; double t2199; double t2200; double t2201; double t2202; double t2203; double t2204; double t2205; double t2206; double t2207; double t2208; double t2209; double t2210; double t2211; double t2212; double t2213; double t2214; double t2215; double t2216; double t2217; double t2218; double t2219; double t2220; double t2221; double t2222; double t2223; double t2224; double t2225; double t2226; double t2227; double t2228; double t2229; double t2230; double t2231; double t2232; double t2233; double t2234; double t2235; double t2236; double t2237; double t2238; double t2239; double t2240; double t2241; double t2242; double t2243; double t2244; double t2245; double t2246; double t2247; double t2248; double t2249; double t2250; double t2251; double t2252; double t2253; double t2254; double t2255; double t2256; double t2257; double t2258; double t2259; double t2260; double t2261; double t2262; double t2263; double t2264; double t2265; double t2266; double t2267; double t2268; double t2269; double t2270; double t2271; double t2272; double t2273; double t2274; double t2275; double t2276; double t2277; double t2278; double t2279; double t2280; double t2281; double t2282; double t2283; double t2284; double t2285; double t2286; double t2287; double t2288; double t2289; double t2290; double t2291; double t2292; double t2293; double t2294; double t2295; double t2296; double t2297; double t2298; double t2299; double t2300; double t2301; double t2302; double t2303; double t2304; double t2305; double t2306; double t2307; double t2308; double t2309; double t2310; double t2311; double t2312; double t2313; double t2314; double t2315; double t2316; double t2317; double t2318; double t2319; double t2320; double t2321; double t2322; double t2323; double t2324; double t2325; double t2326; double t2327; double t2328; double t2329; double t2330; double t2331; double t2332; double t2333; double t2334; double t2335; double t2336; double t2337; double t2338; double t2339; double t2340; double t2341; double t2342; double t2343; double t2344; double t2345; double t2346; double t2347; double t2348; double t2349; double t2350; double t2351; double t2352; double t2353; double t2354; double t2355; double t2356; double t2357; double t2358; double t2359; double t2360; double t2361; double t2362; double t2363; double t2364; double t2365; double t2366; double t2367; double t2368; double t2369; double t2370; double t2371; double t2372; double t2373; double t2374; double t2375; double t2376; double t2377; double t2378; double t2379; double t2380; double t2381; double t2382; double t2383; double t2384; double t2385; double t2386; double t2387; double t2388; double t2389; double t2390; double t2391; double t2392; double t2393; double t2394; double t2395; double t2396; double t2397; double t2398; double t2399; double t2400; double t2401; double t2402; double t2403; double t2404; double t2405; double t2406; double t2407; double t2408; double t2409; double t2410; double t2411; double t2412; double t2413; double t2414; double t2415; double t2416; double t2417; double t2418; double t2419; double t2420; double t2421; double t2422; double t2423; double t2424; double t2425; double t2426; double t2427; double t2428; double t2429; double t2430; double t2431; double t2432; double t2433; double t2434; double t2435; double t2436; double t2437; double t2438; double t2439; double t2440; double t2441; double t2442; double t2443; double t2444; double t2445; double t2446; double t2447; double t2448; double t2449; double t2450; double t2451; double t2452; double t2453; double t2454; double t2455; double t2456; double t2457; double t2458; double t2459; double t2460; double t2461; double t2462; double t2463; double t2464; double t2465; double t2466; double t2467; double t2468; double t2469; double t2470; double t2471; double t2472; double t2473; double t2474; double t2475; double t2476; double t2477; double t2478; double t2479; double t2480; double t2481; double t2482; double t2483; double t2484; double t2485; double t2486; double t2487; double t2488; double t2489; double t2490; double t2491; double t2492; double t2493; double t2494; double t2495; double t2496; double t2497; double t2498; double t2499; double t2500; double t2501; double t2502; double t2503; double t2504; double t2505; double t2506; double t2507; double t2508; double t2509; double t2510; double t2511; double t2512; double t2513; double t2514; double t2515; double t2516; double t2517; double t2518; double t2519; double t2520; double t2521; double t2522; double t2523; double t2524; double t2525; double t2526; double t2527; double t2528; double t2529; double t2530; double t2531; double t2532; double t2533; double t2534; double t2535; double t2536; double t2537; double t2538; double t2539; double t2540; double t2541; double t2542; double t2543; double t2544; double t2545; double t2546; double t2547; double t2548; double t2549; double t2550; double t2551; double t2552; double t2553; double t2554; double t2555; double t2556; double t2557; double t2558; double t2559; double t2560; double t2561; double t2562; double t2563; double t2564; double t2565; double t2566; double t2567; double t2568; double t2569; double t2570; double t2571; double t2572; double t2573; double t2574; double t2575; double t2576; double t2577; double t2578; double t2579; double t2580; double t2581; double t2582; double t2583; double t2584; double t2585; double t2586; double t2587; double t2588; double t2589; double t2590; double t2591; double t2592; double t2593; double t2594; double t2595; double t2596; double t2597; double t2598; double t2599; double t2600; double t2601; double t2602; double t2603; double t2604; double t2605; double t2606; double t2607; double t2608; double t2609; double t2610; double t2611; double t2612; double t2613; double t2614; double t2615; double t2616; double t2617; double t2618; double t2619; double t2620; double t2621; double t2622; double t2623; double t2624; double t2625; double t2626; double t2627; double t2628; double t2629; double t2630; double t2631; double t2632; double t2633; double t2634; double t2635; double t2636; double t2637; double t2638; double t2639; double t2640; double t2641; double t2642; double t2643; double t2644; double t2645; double t2646; double t2647; double t2648; double t2649; double t2650; double t2651; double t2652; double t2653; double t2654; double t2655; double t2656; double t2657; double t2658; double t2659; double t2660; double t2661; double t2662; double t2663; double t2664; double t2665; double t2666; double t2667; double t2668; double t2669; double t2670; double t2671; double t2672; double t2673; double t2674; double t2675; double t2676; double t2677; double t2678; double t2679; double t2680; double t2681; double t2682; double t2683; double t2684; double t2685; double t2686; double t2687; double t2688; double t2689; double t2690; double t2691; double t2692; double t2693; double t2694; double t2695; double t2696; double t2697; double t2698; double t2699; double t2700; double t2701; double t2702; double t2703; double t2704; double t2705; double t2706; double t2707; double t2708; double t2709; double t2710; double t2711; double t2712; double t2713; double t2714; double t2715; double t2716; double t2717; double t2718; double t2719; double t2720; double t2721; double t2722; double t2723; double t2724; double t2725; double t2726; double t2727; double t2728; double t2729; double t2730; double t2731; double t2732; double t2733; double t2734; double t2735; double t2736; double t2737; double t2738; double t2739; double t2740; double t2741; double t2742; double t2743; double t2744; double t2745; double t2746; double t2747; double t2748; double t2749; double t2750; double t2751; double t2752; double t2753; double t2754; double t2755; double t2756; double t2757; double t2758; double t2759; double t2760; double t2761; double t2762; double t2763; double t2764; double t2765; double t2766; double t2767; double t2768; double t2769; double t2770; double t2771; double t2772; double t2773; double t2774; double t2775; double t2776; double t2777; double t2778; double t2779; double t2780; double t2781; double t2782; double t2783; double t2784; double t2785; double t2786; double t2787; double t2788; double t2789; double t2790; double t2791; double t2792; double t2793; double t2794; double t2795; double t2796; double t2797; double t2798; double t2799; double t2800; double t2801; double t2802; double t2803; double t2804; double t2805; double t2806; double t2807; double t2808; double t2809; double t2810; double t2811; double t2812; double t2813; double t2814; double t2815; double t2816; double t2817; double t2818; double t2819; double t2820; double t2821; double t2822; double t2823; double t2824; double t2825; double t2826; double t2827; double t2828; double t2829; double t2830; double t2831; double t2832; double t2833; double t2834; double t2835; double t2836; double t2837; double t2838; double t2839; double t2840; double t2841; double t2842; double t2843; double t2844; double t2845; double t2846; double t2847; double t2848; double t2849; double t2850; double t2851; double t2852; double t2853; double t2854; double t2855; double t2856; double t2857; double t2858; double t2859; double t2860; double t2861; double t2862; double t2863; double t2864; double t2865; double t2866; double t2867; double t2868; double t2869; double t2870; double t2871; double t2872; double t2873; double t2874; double t2875; double t2876; double t2877; double t2878; double t2879; double t2880; double t2881; double t2882; double t2883; double t2884; double t2885; double t2886; double t2887; double t2888; double t2889; double t2890; double t2891; double t2892; double t2893; double t2894; double t2895; double t2896; double t2897; double t2898; double t2899; double t2900; double t2901; double t2902; double t2903; double t2904; double t2905; double t2906; double t2907; double t2908; double t2909; double t2910; double t2911; double t2912; double t2913; double t2914; double t2915; double t2916; double t2917; double t2918; double t2919; double t2920; double t2921; double t2922; double t2923; double t2924; double t2925; double t2926; double t2927; double t2928; double t2929; double t2930; double t2931; double t2932; double t2933; double t2934; double t2935; double t2936; double t2937; double t2938; double t2939; double t2940; double t2941; double t2942; double t2943; double t2944; double t2945; double t2946; double t2947; double t2948; double t2949; double t2950; double t2951; double t2952; double t2953; double t2954; double t2955; double t2956; double t2957; double t2958; double t2959; double t2960; double t2961; double t2962; double t2963; double t2964; double t2965; double t2966; double t2967; double t2968; double t2969; double t2970; double t2971; double t2972; double t2973; double t2974; double t2975; double t2976; double t2977; double t2978; double t2979; double t2980; double t2981; double t2982; double t2983; double t2984; double t2985; double t2986; double t2987; double t2988; double t2989; double t2990; double t2991; double t2992; double t2993; double t2994; double t2995; double t2996; double t2997; double t2998; double t2999; double t3000; double t3001; double t3002; double t3003; double t3004; double t3005; double t3006; double t3007; double t3008; double t3009; double t3010; double t3011; double t3012; double t3013; double t3014; double t3015; double t3016; double t3017; double t3018; double t3019; double t3020; double t3021; double t3022; double t3023; double t3024; double t3025; double t3026; double t3027; double t3028; double t3029; double t3030; double t3031; double t3032; double t3033; double t3034; double t3035; double t3036; double t3037; double t3038; double t3039; double t3040; double t3041; double t3042; double t3043; double t3044; double t3045; double t3046; double t3047; double t3048; double t3049; double t3050; double t3051; double t3052; double t3053; double t3054; double t3055; double t3056; double t3057; double t3058; double t3059; double t3060; double t3061; double t3062; double t3063; double t3064; double t3065; double t3066; double t3067; double t3068; double t3069; double t3070; double t3071; double t3072; double t3073; double t3074; double t3075; double t3076; double t3077; double t3078; double t3079; double t3080; double t3081; double t3082; double t3083; double t3084; double t3085; double t3086; double t3087; double t3088; double t3089; double t3090; double t3091; double t3092; double t3093; double t3094; double t3095; double t3096; double t3097; double t3098; double t3099; double t3100; double t3101; double t3102; double t3103; double t3104; double t3105; double t3106; double t3107; double t3108; double t3109; double t3110; double t3111; double t3112; double t3113; double t3114; double t3115; double t3116; double t3117; double t3118; double t3119; double t3120; double t3121; double t3122; double t3123; double t3124; double t3125; double t3126; double t3127; double t3128; double t3129; double t3130; double t3131; double t3132; double t3133; double t3134; double t3135; double t3136; double t3137; double t3138; double t3139; double t3140; double t3141; double t3142; double t3143; double t3144; double t3145; double t3146; double t3147; double t3148; double t3149; double t3150; double t3151; double t3152; double t3153; double t3154; double t3155; double t3156; double t3157; double t3158; double t3159; double t3160; double t3161; double t3162; double t3163; double t3164; double t3165; double t3166; double t3167; double t3168; double t3169; double t3170; double t3171; double t3172; double t3173; double t3174; double t3175; double t3176; double t3177; double t3178; double t3179; double t3180; double t3181; double t3182; double t3183; double t3184; double t3185; double t3186; double t3187; double t3188; double t3189; double t3190; double t3191; double t3192; double t3193; double t3194; double t3195; double t3196; double t3197; double t3198; double t3199; double t3200; double t3201; double t3202; double t3203; double t3204; double t3205; double t3206; double t3207; double t3208; double t3209; double t3210; double t3211; double t3212; double t3213; double t3214; double t3215; double t3216; double t3217; double t3218; double t3219; double t3220; double t3221; double t3222; double t3223; double t3224; double t3225; double t3226; double t3227; double t3228; double t3229; double t3230; double t3231; double t3232; double t3233; double t3234; double t3235; double t3236; double t3237; double t3238; double t3239; double t3240; double t3241; double t3242; double t3243; double t3244; double t3245; double t3246; double t3247; double t3248; double t3249; double t3250; double t3251; double t3252; double t3253; double t3254; double t3255; double t3256; double t3257; double t3258; double t3259; double t3260; double t3261; double t3262; double t3263; double t3264; double t3265; double t3266; double t3267; double t3268; double t3269; double t3270; double t3271; double t3272; double t3273; double t3274; double t3275; double t3276; double t3277; double t3278; double t3279; double t3280; double t3281; double t3282; double t3283; double t3284; double t3285; double t3286; double t3287; double t3288; double t3289; double t3290; double t3291; double t3292; double t3293; double t3294; double t3295; double t3296; double t3297; double t3298; double t3299; double t3300; double t3301; double t3302; double t3303; double t3304; double t3305; double t3306; double t3307; double t3308; double t3309; double t3310; double t3311; double t3312; double t3313; double t3314; double t3315; double t3316; double t3317; double t3318; double t3319; double t3320; double t3321; double t3322; double t3323; double t3324; double t3325; double t3326; double t3327; double t3328; double t3329; double t3330; double t3331; double t3332; double t3333; double t3334; double t3335; double t3336; double t3337; double t3338; double t3339; double t3340; double t3341; double t3342; double t3343; double t3344; double t3345; double t3346; double t3347; double t3348; double t3349; double t3350; double t3351; double t3352; double t3353; double t3354; double t3355; double t3356; double t3357; double t3358; double t3359; double t3360; double t3361; double t3362; double t3363; double t3364; double t3365; double t3366; double t3367; double t3368; double t3369; double t3370; double t3371; double t3372; double t3373; double t3374; double t3375; double t3376; double t3377; double t3378; double t3379; double t3380; double t3381; double t3382; double t3383; double t3384; double t3385; double t3386; double t3387; double t3388; double t3389; double t3390; double t3391; double t3392; double t3393; double t3394; double t3395; double t3396; double t3397; double t3398; double t3399; double t3400; double t3401; double t3402; double t3403; double t3404; double t3405; double t3406; double t3407; double t3408; double t3409; double t3410; double t3411; double t3412; double t3413; double t3414; double t3415; double t3416; double t3417; double t3418; double t3419; double t3420; double t3421; double t3422; double t3423; double t3424; double t3425; double t3426; double t3427; double t3428; double t3429; double t3430; double t3431; double t3432; double t3433; double t3434; double t3435; double t3436; double t3437; double t3438; double t3439; double t3440; double t3441; double t3442; double t3443; double t3444; double t3445; double t3446; double t3447; double t3448; double t3449; double t3450; double t3451; double t3452; double t3453; double t3454; double t3455; double t3456; double t3457; double t3458; double t3459; double t3460; double t3461; double t3462; double t3463; double t3464; double t3465; double t3466; double t3467; double t3468; double t3469; double t3470; double t3471; double t3472; double t3473; double t3474; double t3475; double t3476; double t3477; double t3478; double t3479; double t3480; double t3481; double t3482; double t3483; double t3484; double t3485; double t3486; double t3487; double t3488; double t3489; double t3490; double t3491; double t3492; double t3493; double t3494; double t3495; double t3496; double t3497; double t3498; double t3499; double t3500; double t3501; double t3502; double t3503; double t3504; double t3505; double t3506; double t3507; double t3508; double t3509; double t3510; double t3511; double t3512; double t3513; double t3514; double t3515; double t3516; double t3517; double t3518; double t3519; double t3520; double t3521; double t3522; double t3523; double t3524; double t3525; double t3526; double t3527; double t3528; double t3529; double t3530; double t3531; double t3532; double t3533; double t3534; double t3535; double t3536; double t3537; double t3538; double t3539; double t3540; double t3541; double t3542; double t3543; double t3544; double t3545; double t3546; double t3547; double t3548; double t3549; double t3550; double t3551; double t3552; double t3553; double t3554; double t3555; double t3556; double t3557; double t3558; double t3559; double t3560; double t3561; double t3562; double t3563; double t3564; double t3565; double t3566; double t3567; double t3568; double t3569; double t3570; double t3571; double t3572; double t3573; double t3574; double t3575; double t3576; double t3577; double t3578; double t3579; double t3580; double t3581; double t3582; double t3583; double t3584; double t3585; double t3586; double t3587; double t3588; double t3589; double t3590; double t3591; double t3592; double t3593; double t3594; double t3595; double t3596; double t3597; double t3598; double t3599; double t3600; double t3601; double t3602; double t3603; double t3604; double t3605; double t3606; double t3607; double t3608; double t3609; double t3610; double t3611; double t3612; double t3613; double t3614; double t3615; double t3616; double t3617; double t3618; double t3619; double t3620; double t3621; double t3622; double t3623; double t3624; double t3625; double t3626; double t3627; double t3628; double t3629; double t3630; double t3631; double t3632; double t3633; double t3634; double t3635; double t3636; double t3637; double t3638; double t3639; double t3640; double t3641; double t3642; double t3643; double t3644; double t3645; double t3646; double t3647; double t3648; double t3649; double t3650; double t3651; double t3652; double t3653; double t3654; double t3655; double t3656; double t3657; double t3658; double t3659; double t3660; double t3661; double t3662; double t3663; double t3664; double t3665; double t3666; double t3667; double t3668; double t3669; double t3670; double t3671; double t3672; double t3673; double t3674; double t3675; double t3676; double t3677; double t3678; double t3679; double t3680; double t3681; double t3682; double t3683; double t3684; double t3685; double t3686; double t3687; double t3688; double t3689; double t3690; double t3691; double t3692; double t3693; double t3694; double t3695; double t3696; double t3697; double t3698; double t3699; double t3700; double t3701; double t3702; double t3703; double t3704; double t3705; double t3706; double t3707; double t3708; double t3709; double t3710; double t3711; double t3712; double t3713; double t3714; double t3715; double t3716; double t3717; double t3718; double t3719; double t3720; double t3721; double t3722; double t3723; double t3724; double t3725; double t3726; double t3727; double t3728; double t3729; double t3730; double t3731; double t3732; double t3733; double t3734; double t3735; double t3736; double t3737; double t3738; double t3739; double t3740; double t3741; double t3742; double t3743; double t3744; double t3745; double t3746; double t3747; double t3748; double t3749; double t3750; double t3751; double t3752; double t3753; double t3754; double t3755; double t3756; double t3757; double t3758; double t3759; double t3760; double t3761; double t3762; double t3763; double t3764; double t3765; double t3766; double t3767; double t3768; double t3769; double t3770; double t3771; double t3772; double t3773; double t3774; double t3775; double t3776; double t3777; double t3778; double t3779; double t3780; double t3781; double t3782; double t3783; double t3784; double t3785; double t3786; double t3787; double t3788; double t3789; double t3790; double t3791; double t3792; double t3793; double t3794; double t3795; double t3796; double t3797; double t3798; double t3799; double t3800; double t3801; double t3802; double t3803; double t3804; double t3805; double t3806; double t3807; double t3808; double t3809; double t3810; double t3811; double t3812; double t3813; double t3814; double t3815; double t3816; double t3817; double t3818; double t3819; double t3820; double t3821; double t3822; double t3823; double t3824; double t3825; double t3826; double t3827; double t3828; double t3829; double t3830; double t3831; double t3832; double t3833; double t3834; double t3835; double t3836; double t3837; double t3838; double t3839; double t3840; double t3841; double t3842; double t3843; double t3844; double t3845; double t3846; double t3847; double t3848; double t3849; double t3850; double t3851; double t3852; double t3853; double t3854; double t3855; double t3856; double t3857; double t3858; double t3859; double t3860; double t3861; double t3862; double t3863; double t3864; double t3865; double t3866; double t3867; double t3868; double t3869; double t3870; double t3871; double t3872; double t3873; double t3874; double t3875; double t3876; double t3877; double t3878; double t3879; double t3880; double t3881; double t3882; double t3883; double t3884; double t3885; double t3886; double t3887; double t3888; double t3889; double t3890; double t3891; double t3892; double t3893; double t3894; double t3895; double t3896; double t3897; double t3898; double t3899; double t3900; double t3901; double t3902; double t3903; double t3904; double t3905; double t3906; double t3907; double t3908; double t3909; double t3910; double t3911; double t3912; double t3913; double t3914; double t3915; double t3916; double t3917; double t3918; double t3919; double t3920; double t3921; double t3922; double t3923; double t3924; double t3925; double t3926; double t3927; double t3928; double t3929; double t3930; double t3931; double t3932; double t3933; double t3934; double t3935; double t3936; double t3937; double t3938; double t3939; double t3940; double t3941; double t3942; double t3943; double t3944; double t3945; double t3946; double t3947; double t3948; double t3949; double t3950; double t3951; double t3952; double t3953; double t3954; double t3955; double t3956; double t3957; double t3958; double t3959; double t3960; double t3961; double t3962; double t3963; double t3964; double t3965; double t3966; double t3967; double t3968; double t3969; double t3970; double t3971; double t3972; double t3973; double t3974; double t3975; double t3976; double t3977; double t3978; double t3979; double t3980; double t3981; double t3982; double t3983; double t3984; double t3985; double t3986; double t3987; double t3988; double t3989; double t3990; double t3991; double t3992; double t3993; double t3994; double t3995; double t3996; double t3997; double t3998; double t3999; double t4000; double t4001; double t4002; double t4003; double t4004; double t4005; double t4006; double t4007; double t4008; double t4009; double t4010; double t4011; double t4012; double t4013; double t4014; double t4015; double t4016; double t4017; double t4018; double t4019; double t4020; double t4021; double t4022; double t4023; double t4024; double t4025; double t4026; double t4027; double t4028; double t4029; double t4030; double t4031; double t4032; double t4033; double t4034; double t4035; double t4036; double t4037; double t4038; double t4039; double t4040; double t4041; double t4042; double t4043; double t4044; double t4045; double t4046; double t4047; double t4048; double t4049; double t4050; double t4051; double t4052; double t4053; double t4054; double t4055; double t4056; double t4057; double t4058; double t4059; double t4060; double t4061; t1 = var[3]; t2 = var[5]; t3 = var[12]; t4 = var[4]; t5 = Sin(t1); t6 = var[11]; t7 = Cos(t2); t8 = Sin(t4); t9 = Cos(t1); t10 = Sin(t2); t11 = var[14]; t12 = Cos(t3); t13 = t9*t7; t14 = -1.*t5*t8*t10; t15 = t13 + t14; t16 = Sin(t3); t17 = Cos(t6); t18 = Cos(t4); t19 = -1.*t17*t18*t5; t20 = Sin(t6); t21 = t7*t5*t8; t22 = t9*t10; t23 = t21 + t22; t24 = t20*t23; t25 = t19 + t24; t26 = Sin(t11); t27 = -1.*t16*t15; t28 = t12*t25; t29 = t27 + t28; t30 = Cos(t11); t31 = t12*t15; t32 = t16*t25; t33 = t31 + t32; t34 = t12*t26; t35 = t30*t16; t36 = t34 + t35; t37 = t30*t12; t38 = -1.*t26*t16; t39 = t37 + t38; t40 = -1.*t12*t26; t41 = -1.*t30*t16; t42 = t40 + t41; t43 = t7*t42; t44 = t39*t20*t10; t45 = t43 + t44; t46 = -1.*t5*t45; t47 = t17*t18*t39; t48 = t7*t39*t20; t49 = -1.*t42*t10; t50 = t48 + t49; t51 = -1.*t8*t50; t52 = t47 + t51; t53 = -1.*t9*t52; t54 = t46 + t53; t55 = t7*t36*t20; t56 = -1.*t39*t10; t57 = t55 + t56; t58 = t17*t39*t8; t59 = t18*t50; t60 = t58 + t59; t61 = -1.*t30*t12; t62 = t26*t16; t63 = t61 + t62; t64 = t7*t42*t20; t65 = -1.*t63*t10; t66 = t64 + t65; t67 = t17*t36*t8; t68 = t18*t57; t69 = t67 + t68; t70 = t17*t42*t8; t71 = t18*t66; t72 = t70 + t71; t73 = t9*t45; t74 = -1.*t5*t52; t75 = t73 + t74; t76 = t7*t39; t77 = t36*t20*t10; t78 = t76 + t77; t79 = t17*t18*t36; t80 = -1.*t8*t57; t81 = t79 + t80; t82 = t7*t63; t83 = t42*t20*t10; t84 = t82 + t83; t85 = t17*t18*t42; t86 = -1.*t8*t66; t87 = t85 + t86; t88 = -1.*t30; t89 = 1. + t88; t90 = 0.4*t89; t91 = 0.5137*t30; t92 = 0.0014*t26; t93 = t90 + t91 + t92; t94 = -0.1137*t30; t95 = -0.0014*t26; t96 = t94 + t95; t97 = -1.*t5*t78; t98 = -1.*t9*t81; t99 = t97 + t98; t100 = -1.*t5*t84; t101 = -1.*t9*t87; t102 = t100 + t101; t103 = 0.0014*t30; t104 = -0.1137*t26; t105 = t103 + t104; t106 = t93*t26; t107 = var[17]; t108 = t30*t96; t109 = t30*t93; t110 = t108 + t109; t111 = -1.*t30*t93; t112 = t105*t26; t113 = t111 + t112; t114 = t96*t26; t115 = t114 + t106; t116 = t9*t78; t117 = -1.*t5*t81; t118 = t116 + t117; t119 = t9*t84; t120 = -1.*t5*t87; t121 = t119 + t120; t122 = t30*t105; t123 = t122 + t106; t124 = var[18]; t125 = t12*t105; t126 = -1.*t93*t16; t127 = t125 + t126; t128 = t12*t93; t129 = t105*t16; t130 = t128 + t129; t131 = t12*t96; t132 = -1.*t105*t16; t133 = t131 + t132; t134 = t96*t16; t135 = t125 + t134; t136 = -1.*t36*t135; t137 = -1.*t42*t127; t138 = -1.*t133*t39; t139 = -1.*t130*t39; t140 = t136 + t137 + t138 + t139; t141 = t42*t140; t142 = t42*t127; t143 = t130*t39; t144 = t142 + t143; t145 = t42*t144; t146 = -1.*t36*t130; t147 = -1.*t127*t39; t148 = t146 + t147; t149 = t63*t148; t150 = t42*t133; t151 = t42*t130; t152 = t135*t39; t153 = t127*t63; t154 = t150 + t151 + t152 + t153; t155 = t39*t154; t156 = t141 + t145 + t149 + t155; t157 = -1.*t18*t20; t158 = -1.*t17*t7*t8; t159 = t157 + t158; t160 = -1.*t18*t36*t20; t161 = -1.*t17*t7*t36*t8; t162 = t160 + t161; t163 = -1.*t18*t39*t20; t164 = -1.*t17*t7*t39*t8; t165 = t163 + t164; t166 = -0.1831*t17; t167 = t130*t20; t168 = t166 + t167; t169 = t17*t130; t170 = 0.1831*t20; t171 = t169 + t170; t172 = t7*t168; t173 = -1.*t127*t10; t174 = t172 + t173; t175 = t17*t18*t7; t176 = -1.*t20*t8; t177 = t175 + t176; t178 = t7*t127; t179 = t168*t10; t180 = t178 + t179; t181 = t171*t8; t182 = t18*t174; t183 = t181 + t182; t184 = t18*t171; t185 = -1.*t8*t174; t186 = t184 + t185; t187 = t7*t135*t20; t188 = -1.*t133*t10; t189 = t187 + t188; t190 = t7*t133; t191 = t135*t20*t10; t192 = t190 + t191; t193 = t17*t135*t8; t194 = t18*t189; t195 = t193 + t194; t196 = t17*t18*t135; t197 = -1.*t8*t189; t198 = t196 + t197; t199 = -1.*t17*t10*t180; t200 = -1.*t177*t183; t201 = -1.*t159*t186; t202 = t199 + t200 + t201; t203 = t17*t10*t180; t204 = t177*t183; t205 = t159*t186; t206 = t203 + t204 + t205; t207 = -1.*t9*t159; t208 = -1.*t17*t5*t10; t209 = t207 + t208; t210 = t45*t180; t211 = t60*t183; t212 = t52*t186; t213 = -1.*t45*t180; t214 = -1.*t60*t183; t215 = -1.*t52*t186; t216 = t60*t206; t217 = t213 + t214 + t215; t218 = t177*t217; t219 = t216 + t218; t220 = -1.*t17*t10*t192; t221 = -1.*t177*t195; t222 = -1.*t159*t198; t223 = t220 + t221 + t222; t224 = t69*t223; t225 = t60*t202; t226 = t78*t192; t227 = t195*t69; t228 = t198*t81; t229 = t226 + t210 + t211 + t212 + t227 + t228; t230 = t177*t229; t231 = t224 + t225 + t230; t232 = t69*t202; t233 = t78*t180; t234 = t183*t69; t235 = t186*t81; t236 = t233 + t234 + t235; t237 = t177*t236; t238 = t232 + t237; t239 = t17*t10*t192; t240 = t177*t195; t241 = t159*t198; t242 = t239 + t240 + t241; t243 = t60*t242; t244 = t72*t206; t245 = -1.*t192*t45; t246 = -1.*t84*t180; t247 = -1.*t60*t195; t248 = -1.*t52*t198; t249 = -1.*t183*t72; t250 = -1.*t186*t87; t251 = t245 + t246 + t247 + t248 + t249 + t250; t252 = t177*t251; t253 = t243 + t244 + t252; t254 = -1.*t5*t159; t255 = t17*t9*t10; t256 = t254 + t255; t257 = t210 + t211 + t212; t258 = t60*t257; t259 = -1.*t78*t192; t260 = -1.*t195*t69; t261 = -1.*t198*t81; t262 = t259 + t213 + t214 + t215 + t260 + t261; t263 = t60*t262; t264 = -1.*t78*t180; t265 = -1.*t183*t69; t266 = -1.*t186*t81; t267 = t264 + t265 + t266; t268 = t72*t267; t269 = t192*t45; t270 = t84*t180; t271 = t60*t195; t272 = t52*t198; t273 = t183*t72; t274 = t186*t87; t275 = t269 + t270 + t271 + t272 + t273 + t274; t276 = t69*t275; t277 = t258 + t263 + t268 + t276; t278 = -1.*t171*t20; t279 = t17*t7*t174; t280 = t278 + t279 + t203; t281 = Power(t17,2); t282 = -1.*t17*t39*t171; t283 = -1.*t50*t174; t284 = t171*t20; t285 = -1.*t17*t7*t174; t286 = t284 + t285 + t199; t287 = t17*t39*t171; t288 = t50*t174; t289 = -1.*t17*t39*t8; t290 = -1.*t18*t50; t291 = t289 + t290; t292 = -1.*t17*t36*t8; t293 = -1.*t18*t57; t294 = t292 + t293; t295 = -1.*t17*t135*t20; t296 = t17*t7*t189; t297 = t295 + t296 + t239; t298 = t45*t297; t299 = t84*t280; t300 = -1.*t281*t135*t39; t301 = -1.*t17*t42*t171; t302 = -1.*t50*t189; t303 = -1.*t174*t66; t304 = t300 + t301 + t302 + t303 + t245 + t246; t305 = t17*t10*t304; t306 = t298 + t299 + t305; t307 = t78*t286; t308 = t17*t36*t171; t309 = t174*t57; t310 = t308 + t309 + t233; t311 = t17*t10*t310; t312 = t307 + t311; t313 = t45*t280; t314 = t282 + t283 + t213; t315 = t17*t10*t314; t316 = t313 + t315; t317 = t281*t135*t39; t318 = t17*t42*t171; t319 = t50*t189; t320 = t174*t66; t321 = t317 + t318 + t319 + t320 + t269 + t270; t322 = t78*t321; t323 = -1.*t17*t36*t171; t324 = -1.*t174*t57; t325 = t323 + t324 + t264; t326 = t84*t325; t327 = -1.*t281*t36*t135; t328 = -1.*t189*t57; t329 = t327 + t282 + t283 + t328 + t259 + t213; t330 = t45*t329; t331 = t287 + t288 + t210; t332 = t45*t331; t333 = t322 + t326 + t330 + t332; t334 = t17*t135*t20; t335 = -1.*t17*t7*t189; t336 = t334 + t335 + t220; t337 = t78*t336; t338 = t45*t286; t339 = t281*t36*t135; t340 = t189*t57; t341 = t339 + t287 + t288 + t340 + t226 + t210; t342 = t17*t10*t341; t343 = t337 + t338 + t342; t344 = Power(t20,2); t345 = -1.*t39*t20*t168; t346 = t39*t20*t168; t347 = t17*t168; t348 = t278 + t347; t349 = -1.*t17*t168; t350 = t284 + t349; t351 = t135*t39*t344; t352 = t42*t20*t168; t353 = t150 + t317 + t153 + t318 + t351 + t352; t354 = t17*t36*t353; t355 = -1.*t36*t20*t168; t356 = t147 + t323 + t355; t357 = t17*t42*t356; t358 = -1.*t36*t135*t344; t359 = t327 + t137 + t138 + t282 + t358 + t345; t360 = t17*t39*t359; t361 = t142 + t287 + t346; t362 = t17*t39*t361; t363 = t354 + t357 + t360 + t362; t364 = -1.*t7*t39; t365 = -1.*t36*t20*t10; t366 = t364 + t365; t367 = -1.*t7*t42; t368 = -1.*t39*t20*t10; t369 = t367 + t368; t370 = t17*t39*t348; t371 = t137 + t282 + t345; t372 = -1.*t20*t371; t373 = t370 + t372; t374 = t17*t39*t350; t375 = t133*t39; t376 = t36*t135*t344; t377 = t339 + t142 + t375 + t287 + t376 + t346; t378 = -1.*t20*t377; t379 = t374 + t378; t380 = t17*t42*t348; t381 = -1.*t42*t133; t382 = -1.*t127*t63; t383 = -1.*t135*t39*t344; t384 = -1.*t42*t20*t168; t385 = t381 + t300 + t382 + t301 + t383 + t384; t386 = -1.*t20*t385; t387 = t380 + t386; t388 = t17*t36*t350; t389 = t127*t39; t390 = t36*t20*t168; t391 = t389 + t308 + t390; t392 = -1.*t20*t391; t393 = t388 + t392; t394 = -0.646*t69*t54; t395 = -0.646*t72*t54; t396 = -0.646*t60*t99; t397 = -0.646*t60*t102; t398 = t394 + t395 + t396 + t397; t399 = var[16]; t400 = t5*t45; t401 = t9*t52; t402 = t400 + t401; t403 = -0.0734502*t54; t404 = -0.646*t110*t54; t405 = -0.646*t113*t54; t406 = -0.646*t115*t99; t407 = 0.0009044*t102; t408 = -0.646*t123*t102; t409 = t403 + t404 + t405 + t406 + t407 + t408; t410 = var[28]; t411 = -0.646*t156*t209; t412 = -1.*t9*t162; t413 = -1.*t17*t36*t5*t10; t414 = t412 + t413; t415 = -0.0734502*t414; t416 = -1.*t9*t165; t417 = -1.*t17*t39*t5*t10; t418 = t416 + t417; t419 = 0.0009044*t418; t420 = 0.1182826*t63*t99; t421 = -0.1182826*t39*t102; t422 = t411 + t415 + t419 + t420 + t421; t423 = var[27]; t424 = -1.*t9*t45; t425 = t5*t52; t426 = t424 + t425; t427 = 0.0009044*t426; t428 = -1.*t9*t78; t429 = t5*t81; t430 = t428 + t429; t431 = -0.0734502*t430; t432 = -0.646*t54*t219; t433 = -0.646*t54*t231; t434 = -0.646*t102*t238; t435 = -0.646*t99*t253; t436 = -0.646*t209*t277; t437 = t427 + t431 + t432 + t433 + t434 + t435 + t436; t438 = var[19]; t439 = -0.0009044*t9*t291; t440 = 0.0734502*t9*t294; t441 = -0.646*t99*t306; t442 = -0.646*t102*t312; t443 = -0.646*t54*t316; t444 = -0.646*t209*t333; t445 = -0.646*t54*t343; t446 = t439 + t440 + t441 + t442 + t443 + t444 + t445; t447 = var[20]; t448 = -0.646*t363*t209; t449 = -1.*t5*t57; t450 = t9*t8*t366; t451 = t449 + t450; t452 = -0.0734502*t451; t453 = -1.*t5*t50; t454 = t9*t8*t369; t455 = t453 + t454; t456 = 0.0009044*t455; t457 = -0.646*t373*t54; t458 = -0.646*t379*t54; t459 = -0.646*t387*t99; t460 = -0.646*t393*t102; t461 = t448 + t452 + t456 + t457 + t458 + t459 + t460; t462 = var[21]; t463 = -0.646*t69*t75; t464 = -0.646*t72*t75; t465 = -0.646*t60*t118; t466 = -0.646*t60*t121; t467 = t463 + t464 + t465 + t466; t468 = -0.646*t402*t99; t469 = t5*t78; t470 = t9*t81; t471 = t469 + t470; t472 = -0.646*t54*t471; t473 = -1.292*t75*t118; t474 = -0.646*t402*t102; t475 = t5*t84; t476 = t9*t87; t477 = t475 + t476; t478 = -0.646*t54*t477; t479 = -1.292*t75*t121; t480 = t468 + t472 + t473 + t474 + t478 + t479; t481 = -0.0734502*t75; t482 = -0.646*t110*t75; t483 = -0.646*t113*t75; t484 = -0.646*t115*t118; t485 = 0.0009044*t121; t486 = -0.646*t123*t121; t487 = t481 + t482 + t483 + t484 + t485 + t486; t488 = -0.646*t156*t256; t489 = -1.*t5*t162; t490 = t17*t9*t36*t10; t491 = t489 + t490; t492 = -0.0734502*t491; t493 = -1.*t5*t165; t494 = t17*t9*t39*t10; t495 = t493 + t494; t496 = 0.0009044*t495; t497 = 0.1182826*t63*t118; t498 = -0.1182826*t39*t121; t499 = t488 + t492 + t496 + t497 + t498; t500 = 0.0009044*t54; t501 = -0.0734502*t99; t502 = -0.646*t75*t219; t503 = -0.646*t75*t231; t504 = -0.646*t121*t238; t505 = -0.646*t118*t253; t506 = -0.646*t256*t277; t507 = t500 + t501 + t502 + t503 + t504 + t505 + t506; t508 = -0.0009044*t5*t291; t509 = 0.0734502*t5*t294; t510 = -0.646*t118*t306; t511 = -0.646*t121*t312; t512 = -0.646*t75*t316; t513 = -0.646*t256*t333; t514 = -0.646*t75*t343; t515 = t508 + t509 + t510 + t511 + t512 + t513 + t514; t516 = -0.646*t363*t256; t517 = t9*t57; t518 = t5*t8*t366; t519 = t517 + t518; t520 = -0.0734502*t519; t521 = t9*t50; t522 = t5*t8*t369; t523 = t521 + t522; t524 = 0.0009044*t523; t525 = -0.646*t373*t75; t526 = -0.646*t379*t75; t527 = -0.646*t387*t118; t528 = -0.646*t393*t121; t529 = t516 + t520 + t524 + t525 + t526 + t527 + t528; t530 = -1.*t9*t18*t7*t20; t531 = -1.*t17*t9*t8; t532 = t530 + t531; t533 = t16*t532; t534 = t12*t9*t18*t10; t535 = t533 + t534; t536 = t12*t532; t537 = -1.*t9*t18*t16*t10; t538 = t536 + t537; t539 = -1.*t17*t42*t8; t540 = -1.*t18*t66; t541 = t539 + t540; t542 = -1.*t171*t8; t543 = -1.*t18*t174; t544 = t542 + t543; t545 = -1.*t17*t18*t7; t546 = t20*t8; t547 = t545 + t546; t548 = -1.*t17*t135*t8; t549 = -1.*t18*t189; t550 = t548 + t549; t551 = -1.*t12*t93; t552 = t551 + t132; t553 = t7*t127*t20; t554 = -1.*t552*t10; t555 = t553 + t554; t556 = t17*t127*t8; t557 = t18*t555; t558 = t556 + t557; t559 = t17*t18*t127; t560 = -1.*t8*t555; t561 = t559 + t560; t562 = t52*t202; t563 = -1.*t159*t544; t564 = -1.*t159*t183; t565 = -1.*t177*t186; t566 = -1.*t547*t186; t567 = t563 + t564 + t565 + t566; t568 = t60*t567; t569 = t52*t544; t570 = t52*t183; t571 = t291*t186; t572 = t60*t186; t573 = -1.*t17*t127*t8; t574 = -1.*t18*t555; t575 = t573 + t574; t576 = t7*t552; t577 = t127*t20*t10; t578 = t576 + t577; t579 = t159*t544; t580 = t159*t183; t581 = t177*t186; t582 = t547*t186; t583 = t579 + t580 + t581 + t582; t584 = t87*t206; t585 = t72*t583; t586 = -1.*t186*t541; t587 = -1.*t186*t72; t588 = -1.*t544*t87; t589 = -1.*t183*t87; t590 = -1.*t17*t18*t7*t36; t591 = t36*t20*t8; t592 = t590 + t591; t593 = -1.*t17*t18*t7*t39; t594 = t39*t20*t8; t595 = t593 + t594; t596 = 0.0001*t36; t597 = t52*t206; t598 = t60*t583; t599 = -1.*t52*t544; t600 = -1.*t52*t183; t601 = -1.*t291*t186; t602 = -1.*t60*t186; t603 = t599 + t600 + t601 + t602; t604 = t177*t603; t605 = t159*t217; t606 = t597 + t598 + t604 + t605; t607 = 0.1831*t17; t608 = -1.*t130*t20; t609 = t607 + t608; t610 = t18*t609; t611 = -1.*t7*t171*t8; t612 = t610 + t611; t613 = -1.*t17*t18; t614 = t7*t20*t8; t615 = t613 + t614; t616 = t18*t7*t171; t617 = t609*t8; t618 = t616 + t617; t619 = t17*t18*t7*t39; t620 = -1.*t39*t20*t8; t621 = t619 + t620; t622 = -1.*t18*t7*t20; t623 = -1.*t17*t8; t624 = t622 + t623; t625 = -1.*t18*t7*t171; t626 = -1.*t609*t8; t627 = t625 + t626; t628 = t81*t223; t629 = -1.*t159*t550; t630 = -1.*t159*t195; t631 = -1.*t177*t198; t632 = -1.*t547*t198; t633 = t629 + t630 + t631 + t632; t634 = t69*t633; t635 = t198*t294; t636 = t198*t69; t637 = t550*t81; t638 = t195*t81; t639 = t569 + t570 + t571 + t572 + t635 + t636 + t637 + t638; t640 = t177*t639; t641 = t159*t229; t642 = t628 + t634 + t562 + t568 + t640 + t641; t643 = t81*t202; t644 = t69*t567; t645 = t186*t294; t646 = t186*t69; t647 = t544*t81; t648 = t183*t81; t649 = t645 + t646 + t647 + t648; t650 = t177*t649; t651 = t159*t236; t652 = t643 + t644 + t650 + t651; t653 = t18*t7*t20; t654 = t17*t8; t655 = t653 + t654; t656 = Power(t10,2); t657 = t17*t18*t7*t36; t658 = -1.*t36*t20*t8; t659 = t657 + t658; t660 = t52*t242; t661 = t159*t550; t662 = t159*t195; t663 = t177*t198; t664 = t547*t198; t665 = t661 + t662 + t663 + t664; t666 = t60*t665; t667 = -1.*t52*t550; t668 = -1.*t52*t195; t669 = -1.*t291*t198; t670 = -1.*t60*t198; t671 = t667 + t668 + t669 + t670 + t586 + t587 + t588 + t589; t672 = t177*t671; t673 = t159*t251; t674 = t660 + t666 + t584 + t585 + t672 + t673; t675 = t569 + t570 + t571 + t572; t676 = -1.*t186*t294; t677 = -1.*t186*t69; t678 = -1.*t544*t81; t679 = -1.*t183*t81; t680 = t676 + t677 + t678 + t679; t681 = -1.*t17*t18*t39; t682 = t8*t50; t683 = t681 + t682; t684 = -1.*t17*t18*t36; t685 = t8*t57; t686 = t684 + t685; t687 = 0.0001*t369; t688 = -1.*t18*t171; t689 = t8*t174; t690 = t688 + t689; t691 = t69*t675; t692 = t81*t257; t693 = t60*t680; t694 = t52*t267; t695 = t691 + t692 + t693 + t694; t696 = t18*t20; t697 = t17*t7*t8; t698 = t696 + t697; t699 = t60*t675; t700 = t52*t257; t701 = -1.*t198*t294; t702 = -1.*t198*t69; t703 = -1.*t550*t81; t704 = -1.*t195*t81; t705 = t599 + t600 + t601 + t602 + t701 + t702 + t703 + t704; t706 = t60*t705; t707 = t52*t262; t708 = t72*t680; t709 = t87*t267; t710 = t52*t550; t711 = t52*t195; t712 = t291*t198; t713 = t60*t198; t714 = t186*t541; t715 = t186*t72; t716 = t544*t87; t717 = t183*t87; t718 = t710 + t711 + t712 + t713 + t714 + t715 + t716 + t717; t719 = t69*t718; t720 = t81*t275; t721 = t699 + t700 + t706 + t707 + t708 + t709 + t719 + t720; t722 = -0.0001*t17*t39; t723 = -1.*t7*t127; t724 = -1.*t168*t10; t725 = t723 + t724; t726 = -0.0734502*t9*t291; t727 = -0.646*t9*t110*t291; t728 = -0.646*t9*t113*t291; t729 = -0.646*t9*t115*t294; t730 = 0.0009044*t9*t541; t731 = -0.646*t9*t123*t541; t732 = t726 + t727 + t728 + t729 + t730 + t731; t733 = -0.646*t9*t156*t547; t734 = -0.0734502*t9*t592; t735 = 0.0009044*t9*t595; t736 = 0.1182826*t9*t63*t294; t737 = -0.1182826*t9*t39*t541; t738 = t733 + t734 + t735 + t736 + t737; t739 = 0.0009044*t9*t683; t740 = -0.0734502*t9*t686; t741 = -0.646*t9*t294*t306; t742 = -0.646*t9*t541*t312; t743 = -0.646*t9*t291*t316; t744 = -0.646*t9*t547*t333; t745 = -0.646*t9*t291*t343; t746 = t739 + t740 + t741 + t742 + t743 + t744 + t745; t747 = -0.646*t9*t363*t547; t748 = 0.0734502*t9*t18*t366; t749 = -0.0009044*t9*t18*t369; t750 = -0.646*t9*t373*t291; t751 = -0.646*t9*t379*t291; t752 = -0.646*t9*t387*t294; t753 = -0.646*t9*t393*t541; t754 = t747 + t748 + t749 + t750 + t751 + t752 + t753; t755 = 0.646*t5*t294*t402; t756 = 0.646*t5*t541*t402; t757 = -0.646*t9*t294*t75; t758 = -0.646*t9*t541*t75; t759 = 0.646*t5*t291*t471; t760 = -0.646*t9*t291*t118; t761 = 0.646*t5*t291*t477; t762 = -0.646*t9*t291*t121; t763 = t755 + t756 + t757 + t758 + t759 + t760 + t761 + t762; t764 = 0.0734502*t5*t291; t765 = 0.646*t110*t5*t291; t766 = 0.646*t113*t5*t291; t767 = 0.646*t115*t5*t294; t768 = -0.0009044*t5*t541; t769 = 0.646*t123*t5*t541; t770 = t764 + t765 + t766 + t767 + t768 + t769; t771 = 0.646*t156*t5*t547; t772 = 0.0734502*t5*t592; t773 = -0.0009044*t5*t595; t774 = -0.1182826*t63*t5*t294; t775 = 0.1182826*t39*t5*t541; t776 = t771 + t772 + t773 + t774 + t775; t777 = -0.0009044*t5*t683; t778 = 0.0734502*t5*t686; t779 = 0.646*t5*t294*t306; t780 = 0.646*t5*t541*t312; t781 = 0.646*t5*t291*t316; t782 = 0.646*t5*t547*t333; t783 = 0.646*t5*t291*t343; t784 = t777 + t778 + t779 + t780 + t781 + t782 + t783; t785 = 0.646*t363*t5*t547; t786 = -0.0734502*t18*t5*t366; t787 = 0.0009044*t18*t5*t369; t788 = 0.646*t373*t5*t291; t789 = 0.646*t379*t5*t291; t790 = 0.646*t387*t5*t294; t791 = 0.646*t393*t5*t541; t792 = t785 + t786 + t787 + t788 + t789 + t790 + t791; t793 = 0.646*t5*t60*t294; t794 = 0.646*t5*t291*t69; t795 = 0.646*t5*t60*t541; t796 = 0.646*t5*t291*t72; t797 = -0.646*t81*t75; t798 = -0.646*t87*t75; t799 = -0.646*t52*t118; t800 = -0.646*t52*t121; t801 = t793 + t794 + t795 + t796 + t797 + t798 + t799 + t800; t802 = -0.646*t9*t60*t294; t803 = -0.646*t9*t291*t69; t804 = -0.646*t9*t60*t541; t805 = -0.646*t9*t291*t72; t806 = -0.646*t81*t402; t807 = -0.646*t87*t402; t808 = -0.646*t52*t471; t809 = -0.646*t52*t477; t810 = t802 + t803 + t804 + t805 + t806 + t807 + t808 + t809; t811 = -0.0734502*t52; t812 = -0.646*t110*t52; t813 = -0.646*t113*t52; t814 = -0.646*t115*t81; t815 = 0.0009044*t87; t816 = -0.646*t123*t87; t817 = t811 + t812 + t813 + t814 + t815 + t816; t818 = -0.646*t156*t159; t819 = -0.0734502*t162; t820 = 0.0009044*t165; t821 = 0.1182826*t63*t81; t822 = -0.1182826*t39*t87; t823 = t818 + t819 + t820 + t821 + t822; t824 = 0.0009044*t291; t825 = -0.0734502*t294; t826 = -0.646*t81*t306; t827 = -0.646*t87*t312; t828 = -0.646*t52*t316; t829 = -0.646*t159*t333; t830 = -0.646*t52*t343; t831 = t824 + t825 + t826 + t827 + t828 + t829 + t830; t832 = -0.646*t363*t159; t833 = 0.0734502*t8*t366; t834 = -0.0009044*t8*t369; t835 = -0.646*t373*t52; t836 = -0.646*t379*t52; t837 = -0.646*t387*t81; t838 = -0.646*t393*t87; t839 = t832 + t833 + t834 + t835 + t836 + t837 + t838; t840 = -0.646*t60*t606; t841 = -0.646*t52*t219; t842 = -0.646*t60*t642; t843 = -0.646*t52*t231; t844 = -0.646*t72*t652; t845 = -0.646*t87*t238; t846 = -0.646*t69*t674; t847 = -0.646*t81*t253; t848 = -0.646*t159*t277; t849 = -0.646*t177*t721; t850 = t840 + t841 + t842 + t843 + t844 + t845 + t846 + t847 + t848 + t849; t851 = -0.646*t75*t606; t852 = 0.646*t5*t291*t219; t853 = -0.646*t75*t642; t854 = 0.646*t5*t291*t231; t855 = -0.646*t121*t652; t856 = 0.646*t5*t541*t238; t857 = -0.646*t118*t674; t858 = 0.646*t5*t294*t253; t859 = 0.646*t5*t547*t277; t860 = -0.646*t256*t721; t861 = t439 + t440 + t851 + t852 + t853 + t854 + t855 + t856 + t857 + t858 + t859 + t860; t862 = -0.646*t402*t606; t863 = -0.646*t9*t291*t219; t864 = -0.646*t402*t642; t865 = -0.646*t9*t291*t231; t866 = -0.646*t477*t652; t867 = -0.646*t9*t541*t238; t868 = -0.646*t471*t674; t869 = -0.646*t9*t294*t253; t870 = -0.646*t9*t547*t277; t871 = t9*t159; t872 = t17*t5*t10; t873 = t871 + t872; t874 = -0.646*t873*t721; t875 = t508 + t509 + t862 + t863 + t864 + t865 + t866 + t867 + t868 + t869 + t870 + t874; t876 = -0.646*t115*t606; t877 = -0.646*t123*t642; t878 = -1.*t17*t10*t578; t879 = -1.*t177*t558; t880 = -1.*t159*t561; t881 = t878 + t879 + t880; t882 = t81*t881; t883 = -1.*t159*t575; t884 = -1.*t159*t558; t885 = -1.*t177*t561; t886 = -1.*t547*t561; t887 = t883 + t884 + t885 + t886; t888 = t69*t887; t889 = t561*t294; t890 = t561*t69; t891 = t575*t81; t892 = t558*t81; t893 = t569 + t570 + t571 + t572 + t889 + t890 + t891 + t892; t894 = t177*t893; t895 = t78*t578; t896 = t558*t69; t897 = t561*t81; t898 = t895 + t210 + t211 + t212 + t896 + t897; t899 = t159*t898; t900 = t882 + t888 + t562 + t568 + t894 + t899; t901 = 0.0009044*t900; t902 = -0.646*t110*t652; t903 = -0.646*t113*t674; t904 = t17*t10*t578; t905 = t177*t558; t906 = t159*t561; t907 = t904 + t905 + t906; t908 = t52*t907; t909 = t159*t575; t910 = t159*t558; t911 = t177*t561; t912 = t547*t561; t913 = t909 + t910 + t911 + t912; t914 = t60*t913; t915 = -1.*t52*t575; t916 = -1.*t52*t558; t917 = -1.*t291*t561; t918 = -1.*t60*t561; t919 = t915 + t916 + t917 + t918 + t586 + t587 + t588 + t589; t920 = t177*t919; t921 = -1.*t578*t45; t922 = -1.*t60*t558; t923 = -1.*t52*t561; t924 = t921 + t246 + t922 + t923 + t249 + t250; t925 = t159*t924; t926 = t908 + t914 + t584 + t585 + t920 + t925; t927 = -0.0734502*t926; t928 = t876 + t877 + t901 + t902 + t903 + t927; t929 = 0.0176*t615; t930 = 0.0001*t683; t931 = 0.1182826*t63*t606; t932 = t612*t177; t933 = t612*t547; t934 = t159*t627; t935 = t159*t618; t936 = t615*t544; t937 = t615*t183; t938 = t624*t186; t939 = t655*t186; t940 = t932 + t933 + t934 + t935 + t936 + t937 + t938 + t939; t941 = t60*t940; t942 = t165*t206; t943 = -1.*t171*t10*t45; t944 = -1.*t17*t39*t10*t180; t945 = -1.*t618*t60; t946 = -1.*t612*t52; t947 = -1.*t621*t183; t948 = -1.*t165*t186; t949 = t943 + t944 + t945 + t946 + t947 + t948; t950 = t159*t949; t951 = t621*t583; t952 = t159*t612; t953 = t177*t618; t954 = t17*t171*t656; t955 = -1.*t20*t10*t180; t956 = t624*t183; t957 = t615*t186; t958 = t952 + t953 + t954 + t955 + t956 + t957; t959 = t52*t958; t960 = -1.*t612*t291; t961 = -1.*t612*t60; t962 = -1.*t627*t52; t963 = -1.*t618*t52; t964 = -1.*t165*t544; t965 = -1.*t165*t183; t966 = -1.*t621*t186; t967 = -1.*t595*t186; t968 = t960 + t961 + t962 + t963 + t964 + t965 + t966 + t967; t969 = t177*t968; t970 = t624*t603; t971 = t615*t217; t972 = t941 + t942 + t950 + t951 + t959 + t969 + t970 + t971; t973 = -0.0734502*t972; t974 = -0.1182826*t39*t642; t975 = -0.646*t156*t695; t976 = -0.1182826*t42*t652; t977 = -1.*t612*t177; t978 = -1.*t612*t547; t979 = -1.*t159*t627; t980 = -1.*t159*t618; t981 = -1.*t615*t544; t982 = -1.*t615*t183; t983 = -1.*t624*t186; t984 = -1.*t655*t186; t985 = t977 + t978 + t979 + t980 + t981 + t982 + t983 + t984; t986 = t69*t985; t987 = t162*t202; t988 = t659*t567; t989 = -1.*t159*t612; t990 = -1.*t177*t618; t991 = -1.*t17*t171*t656; t992 = t20*t10*t180; t993 = -1.*t624*t183; t994 = -1.*t615*t186; t995 = t989 + t990 + t991 + t992 + t993 + t994; t996 = t81*t995; t997 = t171*t10*t78; t998 = t17*t36*t10*t180; t999 = t659*t183; t1000 = t162*t186; t1001 = t618*t69; t1002 = t612*t81; t1003 = t997 + t998 + t999 + t1000 + t1001 + t1002; t1004 = t159*t1003; t1005 = t162*t544; t1006 = t162*t183; t1007 = t659*t186; t1008 = t592*t186; t1009 = t612*t294; t1010 = t612*t69; t1011 = t627*t81; t1012 = t618*t81; t1013 = t1005 + t1006 + t1007 + t1008 + t1009 + t1010 + t1011 + t1012; t1014 = t177*t1013; t1015 = t624*t649; t1016 = t615*t236; t1017 = t986 + t987 + t988 + t996 + t1004 + t1014 + t1015 + t1016; t1018 = 0.0009044*t1017; t1019 = 0.1182826*t42*t674; t1020 = t39*t144; t1021 = t42*t148; t1022 = t1020 + t1021; t1023 = -0.646*t1022*t721; t1024 = 0.0179*t81; t1025 = t930 + t1024; t1026 = 0.0005*t52; t1027 = 0.0001*t686; t1028 = t1026 + t1027; t1029 = 0.0001*t291; t1030 = 0.0005*t87; t1031 = t930 + t1030; t1032 = 0.0179*t52; t1033 = -1.*t17*t18*t42; t1034 = t8*t66; t1035 = t1033 + t1034; t1036 = 0.0001*t1035; t1037 = t1032 + t1036; t1038 = 0.0176*t547; t1039 = -0.646*t306*t606; t1040 = t291*t206; t1041 = 2.*t52*t583; t1042 = 2.*t159*t603; t1043 = t547*t217; t1044 = t177*t544; t1045 = 2.*t547*t544; t1046 = t547*t183; t1047 = 2.*t159*t186; t1048 = t698*t186; t1049 = t159*t690; t1050 = t1044 + t1045 + t1046 + t1047 + t1048 + t1049; t1051 = t60*t1050; t1052 = -2.*t291*t544; t1053 = -1.*t60*t544; t1054 = -1.*t291*t183; t1055 = -2.*t52*t186; t1056 = -1.*t683*t186; t1057 = -1.*t52*t690; t1058 = t1052 + t1053 + t1054 + t1055 + t1056 + t1057; t1059 = t177*t1058; t1060 = t1040 + t1041 + t1042 + t1043 + t1051 + t1059; t1061 = -0.0734502*t1060; t1062 = -0.646*t312*t642; t1063 = -0.646*t333*t695; t1064 = -0.646*t343*t652; t1065 = t294*t202; t1066 = 2.*t81*t567; t1067 = -1.*t177*t544; t1068 = -2.*t547*t544; t1069 = -1.*t547*t183; t1070 = -2.*t159*t186; t1071 = -1.*t698*t186; t1072 = -1.*t159*t690; t1073 = t1067 + t1068 + t1069 + t1070 + t1071 + t1072; t1074 = t69*t1073; t1075 = 2.*t159*t649; t1076 = t547*t236; t1077 = 2.*t544*t294; t1078 = t183*t294; t1079 = t544*t69; t1080 = 2.*t186*t81; t1081 = t690*t81; t1082 = t186*t686; t1083 = t1077 + t1078 + t1079 + t1080 + t1081 + t1082; t1084 = t177*t1083; t1085 = t1065 + t1066 + t1074 + t1075 + t1076 + t1084; t1086 = 0.0009044*t1085; t1087 = -0.646*t316*t674; t1088 = t45*t325; t1089 = t78*t331; t1090 = t1088 + t1089; t1091 = -0.646*t1090*t721; t1092 = 0.0176*t17*t8*t10; t1093 = -0.646*t387*t606; t1094 = -1.*t8*t177*t725; t1095 = -1.*t8*t547*t725; t1096 = t17*t8*t10*t544; t1097 = t17*t8*t10*t183; t1098 = t1094 + t1095 + t1096 + t1097; t1099 = t60*t1098; t1100 = t8*t725*t291; t1101 = t8*t725*t60; t1102 = t8*t369*t544; t1103 = t8*t369*t183; t1104 = t1100 + t1101 + t1102 + t1103; t1105 = t177*t1104; t1106 = -1.*t8*t369*t206; t1107 = t18*t369*t583; t1108 = t17*t10*t174; t1109 = -1.*t8*t159*t725; t1110 = t18*t177*t725; t1111 = t17*t7*t180; t1112 = -1.*t17*t18*t10*t183; t1113 = t17*t8*t10*t186; t1114 = t1108 + t1109 + t1110 + t1111 + t1112 + t1113; t1115 = t52*t1114; t1116 = -1.*t174*t45; t1117 = -1.*t50*t180; t1118 = -1.*t18*t725*t60; t1119 = t8*t725*t52; t1120 = -1.*t18*t369*t183; t1121 = t8*t369*t186; t1122 = t1116 + t1117 + t1118 + t1119 + t1120 + t1121; t1123 = t159*t1122; t1124 = -1.*t17*t18*t10*t603; t1125 = t17*t8*t10*t217; t1126 = t1099 + t1105 + t1106 + t1107 + t1115 + t1123 + t1124 + t1125; t1127 = -0.0734502*t1126; t1128 = -0.646*t393*t642; t1129 = -0.646*t363*t695; t1130 = -0.646*t379*t652; t1131 = t8*t177*t725; t1132 = t8*t547*t725; t1133 = -1.*t17*t8*t10*t544; t1134 = -1.*t17*t8*t10*t183; t1135 = t1131 + t1132 + t1133 + t1134; t1136 = t69*t1135; t1137 = -1.*t8*t366*t202; t1138 = t18*t366*t567; t1139 = -1.*t17*t10*t174; t1140 = t8*t159*t725; t1141 = -1.*t18*t177*t725; t1142 = -1.*t17*t7*t180; t1143 = t17*t18*t10*t183; t1144 = -1.*t17*t8*t10*t186; t1145 = t1139 + t1140 + t1141 + t1142 + t1143 + t1144; t1146 = t81*t1145; t1147 = -1.*t8*t366*t544; t1148 = -1.*t8*t366*t183; t1149 = -1.*t8*t725*t294; t1150 = -1.*t8*t725*t69; t1151 = t1147 + t1148 + t1149 + t1150; t1152 = t177*t1151; t1153 = t174*t78; t1154 = t57*t180; t1155 = t18*t366*t183; t1156 = -1.*t8*t366*t186; t1157 = t18*t725*t69; t1158 = -1.*t8*t725*t81; t1159 = t1153 + t1154 + t1155 + t1156 + t1157 + t1158; t1160 = t159*t1159; t1161 = -1.*t17*t18*t10*t649; t1162 = t17*t8*t10*t236; t1163 = t1136 + t1137 + t1138 + t1146 + t1152 + t1160 + t1161 + t1162; t1164 = 0.0009044*t1163; t1165 = -0.646*t373*t674; t1166 = t17*t39*t356; t1167 = t17*t36*t361; t1168 = t1166 + t1167; t1169 = -0.646*t1168*t721; t1170 = var[33]; t1171 = var[34]; t1172 = t9*t7*t8; t1173 = -1.*t5*t10; t1174 = t1172 + t1173; t1175 = t7*t5; t1176 = t9*t8*t10; t1177 = t1175 + t1176; t1178 = -1.*t16*t1174; t1179 = t12*t20*t1177; t1180 = t1178 + t1179; t1181 = t12*t1174; t1182 = t16*t20*t1177; t1183 = t1181 + t1182; t1184 = -1.*t7*t63; t1185 = -1.*t42*t20*t10; t1186 = t1184 + t1185; t1187 = 0.0005*t42; t1188 = 0.0001*t63; t1189 = t1187 + t1188; t1190 = 0.0179*t42; t1191 = 0.0001*t39; t1192 = t1190 + t1191; t1193 = 0.0179*t39; t1194 = t596 + t1193; t1195 = 0.0005*t63; t1196 = t596 + t1195; t1197 = -1.*t7*t133; t1198 = -1.*t135*t20*t10; t1199 = t1197 + t1198; t1200 = t174*t45; t1201 = t50*t180; t1202 = t18*t725*t60; t1203 = -1.*t8*t725*t52; t1204 = t18*t369*t183; t1205 = -1.*t8*t369*t186; t1206 = t1200 + t1201 + t1202 + t1203 + t1204 + t1205; t1207 = -1.*t174*t78; t1208 = -1.*t57*t180; t1209 = -1.*t18*t366*t183; t1210 = t8*t366*t186; t1211 = -1.*t18*t725*t69; t1212 = t8*t725*t81; t1213 = t1207 + t1208 + t1209 + t1210 + t1211 + t1212; t1214 = t17*t7*t192; t1215 = -1.*t174*t84; t1216 = -1.*t50*t192; t1217 = -1.*t189*t45; t1218 = -1.*t66*t180; t1219 = -1.*t17*t7*t725; t1220 = t1219 + t1142; t1221 = t7*t171*t78; t1222 = t17*t7*t36*t180; t1223 = t7*t20*t180; t1224 = t174*t366; t1225 = t57*t725; t1226 = t1224 + t1153 + t1225 + t1154; t1227 = t17*t7*t725; t1228 = t1227 + t1111; t1229 = -1.*t7*t171*t45; t1230 = -1.*t17*t7*t39*t180; t1231 = -1.*t7*t20*t180; t1232 = Power(t7,2); t1233 = -1.*t174*t369; t1234 = -1.*t50*t725; t1235 = t1233 + t1116 + t1234 + t1117; t1236 = -1.*t189*t78; t1237 = -1.*t57*t192; t1238 = t174*t84; t1239 = t50*t192; t1240 = t189*t45; t1241 = t66*t180; t1242 = t174*t369; t1243 = t50*t725; t1244 = t1242 + t1200 + t1243 + t1201; t1245 = -1.*t174*t366; t1246 = -1.*t57*t725; t1247 = t1245 + t1207 + t1246 + t1208; t1248 = -1.*t17*t7*t192; t1249 = t189*t78; t1250 = t57*t192; t1251 = t9*t66; t1252 = t5*t8*t1186; t1253 = t1251 + t1252; t1254 = t5*t66; t1255 = -1.*t9*t8*t1186; t1256 = t1254 + t1255; t1257 = t5*t57; t1258 = -1.*t9*t8*t366; t1259 = t1257 + t1258; t1260 = t5*t50; t1261 = -1.*t9*t8*t369; t1262 = t1260 + t1261; t1263 = t18*t369*t206; t1264 = t60*t1114; t1265 = t177*t1122; t1266 = -1.*t17*t18*t10*t217; t1267 = t1263 + t1264 + t1265 + t1266; t1268 = t18*t366*t223; t1269 = -1.*t17*t10*t189; t1270 = t8*t159*t1199; t1271 = -1.*t18*t177*t1199; t1272 = t17*t18*t10*t195; t1273 = -1.*t17*t8*t10*t198; t1274 = t1269 + t1270 + t1271 + t1248 + t1272 + t1273; t1275 = t69*t1274; t1276 = t18*t369*t202; t1277 = t60*t1145; t1278 = t18*t366*t195; t1279 = -1.*t8*t366*t198; t1280 = t18*t1199*t69; t1281 = -1.*t8*t1199*t81; t1282 = t1249 + t1250 + t1200 + t1201 + t1202 + t1203 + t1278 + t1279 + t1204 + t1205 + t1280 + t1281; t1283 = t177*t1282; t1284 = -1.*t17*t18*t10*t229; t1285 = t1268 + t1275 + t1276 + t1277 + t1283 + t1284; t1286 = -1.*t7*t552; t1287 = -1.*t127*t20*t10; t1288 = t1286 + t1287; t1289 = t18*t366*t202; t1290 = t69*t1145; t1291 = t177*t1159; t1292 = -1.*t17*t18*t10*t236; t1293 = t1289 + t1290 + t1291 + t1292; t1294 = t18*t369*t242; t1295 = t17*t10*t189; t1296 = -1.*t8*t159*t1199; t1297 = t18*t177*t1199; t1298 = -1.*t17*t18*t10*t195; t1299 = t17*t8*t10*t198; t1300 = t1295 + t1296 + t1297 + t1214 + t1298 + t1299; t1301 = t60*t1300; t1302 = t18*t1186*t206; t1303 = t72*t1114; t1304 = -1.*t18*t1199*t60; t1305 = t8*t1199*t52; t1306 = -1.*t18*t369*t195; t1307 = t8*t369*t198; t1308 = -1.*t18*t1186*t183; t1309 = t8*t1186*t186; t1310 = -1.*t18*t725*t72; t1311 = t8*t725*t87; t1312 = t1215 + t1216 + t1217 + t1218 + t1304 + t1305 + t1306 + t1307 + t1308 + t1309 + t1310 + t1311; t1313 = t177*t1312; t1314 = -1.*t17*t18*t10*t251; t1315 = t1294 + t1301 + t1302 + t1303 + t1313 + t1314; t1316 = t17*t7*t1199; t1317 = t1316 + t1214; t1318 = t45*t1317; t1319 = t50*t297; t1320 = t84*t1228; t1321 = t66*t280; t1322 = -1.*t174*t1186; t1323 = -1.*t50*t1199; t1324 = -1.*t189*t369; t1325 = -1.*t66*t725; t1326 = t1322 + t1215 + t1323 + t1216 + t1324 + t1217 + t1325 + t1218; t1327 = t17*t10*t1326; t1328 = t17*t7*t304; t1329 = t1318 + t1319 + t1320 + t1321 + t1327 + t1328; t1330 = t17*t7*t578; t1331 = -1.*t50*t578; t1332 = -1.*t555*t45; t1333 = t78*t1220; t1334 = t57*t286; t1335 = t17*t10*t1226; t1336 = t17*t7*t310; t1337 = t1333 + t1334 + t1335 + t1336; t1338 = t45*t1228; t1339 = t50*t280; t1340 = t17*t10*t1235; t1341 = t17*t7*t314; t1342 = t1338 + t1339 + t1340 + t1341; t1343 = -1.*t17*t7*t1199; t1344 = t1343 + t1248; t1345 = t78*t1344; t1346 = t57*t336; t1347 = t45*t1220; t1348 = t50*t286; t1349 = t189*t366; t1350 = t57*t1199; t1351 = t1349 + t1249 + t1350 + t1250 + t1242 + t1200 + t1243 + t1201; t1352 = t17*t10*t1351; t1353 = t17*t7*t341; t1354 = t1345 + t1346 + t1347 + t1348 + t1352 + t1353; t1355 = -1.*t17*t7*t578; t1356 = t555*t78; t1357 = t57*t578; t1358 = t17*t9*t7; t1359 = -1.*t17*t5*t8*t10; t1360 = t1358 + t1359; t1361 = -1.*t7*t36*t20; t1362 = t39*t10; t1363 = t1361 + t1362; t1364 = -1.*t7*t39*t20; t1365 = t42*t10; t1366 = t1364 + t1365; t1367 = t17*t7*t5; t1368 = t17*t9*t8*t10; t1369 = t1367 + t1368; t1370 = -0.0001*t17*t36; t1371 = 0.0005*t17*t39; t1372 = t1370 + t1371; t1373 = -0.0001*t17*t42; t1374 = 0.0179*t17*t39; t1375 = t1373 + t1374; t1376 = 0.0005*t17*t42; t1377 = t1376 + t722; t1378 = 0.0179*t17*t36; t1379 = t1378 + t722; t1380 = -1.*t7*t168; t1381 = t127*t10; t1382 = t1380 + t1381; t1383 = Power(t18,2); t1384 = Power(t8,2); t1385 = t69*t1206; t1386 = t18*t366*t257; t1387 = t60*t1213; t1388 = t18*t369*t267; t1389 = t1385 + t1386 + t1387 + t1388; t1390 = t60*t1206; t1391 = t18*t369*t257; t1392 = -1.*t18*t366*t195; t1393 = t8*t366*t198; t1394 = -1.*t18*t1199*t69; t1395 = t8*t1199*t81; t1396 = t1236 + t1237 + t1116 + t1117 + t1118 + t1119 + t1392 + t1393 + t1120 + t1121 + t1394 + t1395; t1397 = t60*t1396; t1398 = t72*t1213; t1399 = t18*t369*t262; t1400 = t18*t1186*t267; t1401 = t18*t1199*t60; t1402 = -1.*t8*t1199*t52; t1403 = t18*t369*t195; t1404 = -1.*t8*t369*t198; t1405 = t18*t1186*t183; t1406 = -1.*t8*t1186*t186; t1407 = t18*t725*t72; t1408 = -1.*t8*t725*t87; t1409 = t1238 + t1239 + t1240 + t1241 + t1401 + t1402 + t1403 + t1404 + t1405 + t1406 + t1407 + t1408; t1410 = t69*t1409; t1411 = t18*t366*t275; t1412 = t1390 + t1391 + t1397 + t1398 + t1399 + t1400 + t1410 + t1411; t1413 = t17*t10*t725; t1414 = 2.*t174*t57; t1415 = t78*t725; t1416 = t366*t180; t1417 = -1.*t17*t10*t725; t1418 = -2.*t50*t174; t1419 = -1.*t45*t725; t1420 = -1.*t369*t180; t1421 = -1.*t189*t366; t1422 = -1.*t57*t1199; t1423 = t1421 + t1236 + t1422 + t1237 + t1233 + t1116 + t1234 + t1117; t1424 = t45*t1423; t1425 = t45*t1244; t1426 = t84*t1247; t1427 = t174*t1186; t1428 = t50*t1199; t1429 = t189*t369; t1430 = t66*t725; t1431 = t1427 + t1238 + t1428 + t1239 + t1429 + t1240 + t1430 + t1241; t1432 = t78*t1431; t1433 = t57*t321; t1434 = t66*t325; t1435 = t50*t329; t1436 = t50*t331; t1437 = t1424 + t1425 + t1426 + t1432 + t1433 + t1434 + t1435 + t1436; t1438 = t78*t1244; t1439 = t45*t1247; t1440 = t50*t325; t1441 = t57*t331; t1442 = t1438 + t1439 + t1440 + t1441; t1443 = 0.0009044*t18*t1186; t1444 = -0.646*t18*t123*t1186; t1445 = -0.646*t18*t115*t366; t1446 = -0.0734502*t18*t369; t1447 = -0.646*t18*t110*t369; t1448 = -0.646*t18*t113*t369; t1449 = t1443 + t1444 + t1445 + t1446 + t1447 + t1448; t1450 = 0.0734502*t17*t18*t36*t10; t1451 = -0.0009044*t17*t18*t39*t10; t1452 = 0.646*t17*t18*t156*t10; t1453 = -0.1182826*t18*t39*t1186; t1454 = 0.1182826*t18*t63*t366; t1455 = t1450 + t1451 + t1452 + t1453 + t1454; t1456 = 0.646*t17*t18*t363*t10; t1457 = 0.0009044*t18*t1366; t1458 = -0.0734502*t18*t1363; t1459 = -0.646*t18*t393*t1186; t1460 = -0.646*t18*t387*t366; t1461 = -0.646*t18*t373*t369; t1462 = -0.646*t18*t379*t369; t1463 = t1456 + t1457 + t1458 + t1459 + t1460 + t1461 + t1462; t1464 = -0.646*t60*t1256; t1465 = -0.646*t60*t1259; t1466 = -0.646*t69*t1262; t1467 = -0.646*t72*t1262; t1468 = -0.646*t18*t1186*t402; t1469 = -0.646*t18*t366*t402; t1470 = -0.646*t18*t369*t471; t1471 = -0.646*t18*t369*t477; t1472 = t1464 + t1465 + t1466 + t1467 + t1468 + t1469 + t1470 + t1471; t1473 = 0.0009044*t1256; t1474 = -0.646*t123*t1256; t1475 = -0.646*t115*t1259; t1476 = -0.0734502*t1262; t1477 = -0.646*t110*t1262; t1478 = -0.646*t113*t1262; t1479 = t1473 + t1474 + t1475 + t1476 + t1477 + t1478; t1480 = -0.646*t156*t1369; t1481 = t17*t7*t36*t5; t1482 = t17*t9*t36*t8*t10; t1483 = t1481 + t1482; t1484 = -0.0734502*t1483; t1485 = t17*t7*t39*t5; t1486 = t17*t9*t39*t8*t10; t1487 = t1485 + t1486; t1488 = 0.0009044*t1487; t1489 = -0.1182826*t39*t1256; t1490 = 0.1182826*t63*t1259; t1491 = t1480 + t1484 + t1488 + t1489 + t1490; t1492 = -0.646*t363*t1369; t1493 = -0.646*t393*t1256; t1494 = -1.*t9*t8*t1363; t1495 = t5*t366; t1496 = t1494 + t1495; t1497 = -0.0734502*t1496; t1498 = -0.646*t387*t1259; t1499 = -1.*t9*t8*t1366; t1500 = t5*t369; t1501 = t1499 + t1500; t1502 = 0.0009044*t1501; t1503 = -0.646*t373*t1262; t1504 = -0.646*t379*t1262; t1505 = t1492 + t1493 + t1497 + t1498 + t1502 + t1503 + t1504; t1506 = -0.646*t60*t1253; t1507 = -0.646*t60*t519; t1508 = -0.646*t69*t523; t1509 = -0.646*t72*t523; t1510 = -0.646*t18*t1186*t75; t1511 = -0.646*t18*t366*t75; t1512 = -0.646*t18*t369*t118; t1513 = -0.646*t18*t369*t121; t1514 = t1506 + t1507 + t1508 + t1509 + t1510 + t1511 + t1512 + t1513; t1515 = -0.646*t1253*t402; t1516 = -0.646*t519*t402; t1517 = -0.646*t1256*t75; t1518 = -0.646*t1259*t75; t1519 = -0.646*t523*t471; t1520 = -0.646*t1262*t118; t1521 = -0.646*t523*t477; t1522 = -0.646*t1262*t121; t1523 = t1515 + t1516 + t1517 + t1518 + t1519 + t1520 + t1521 + t1522; t1524 = 0.0009044*t1253; t1525 = -0.646*t123*t1253; t1526 = -0.646*t115*t519; t1527 = -0.0734502*t523; t1528 = -0.646*t110*t523; t1529 = -0.646*t113*t523; t1530 = t1524 + t1525 + t1526 + t1527 + t1528 + t1529; t1531 = -0.646*t156*t1360; t1532 = t17*t9*t7*t36; t1533 = -1.*t17*t36*t5*t8*t10; t1534 = t1532 + t1533; t1535 = -0.0734502*t1534; t1536 = t17*t9*t7*t39; t1537 = -1.*t17*t39*t5*t8*t10; t1538 = t1536 + t1537; t1539 = 0.0009044*t1538; t1540 = -0.1182826*t39*t1253; t1541 = 0.1182826*t63*t519; t1542 = t1531 + t1535 + t1539 + t1540 + t1541; t1543 = -0.646*t363*t1360; t1544 = -0.646*t393*t1253; t1545 = t5*t8*t1363; t1546 = t9*t366; t1547 = t1545 + t1546; t1548 = -0.0734502*t1547; t1549 = -0.646*t387*t519; t1550 = t5*t8*t1366; t1551 = t9*t369; t1552 = t1550 + t1551; t1553 = 0.0009044*t1552; t1554 = -0.646*t373*t523; t1555 = -0.646*t379*t523; t1556 = t1543 + t1544 + t1548 + t1549 + t1553 + t1554 + t1555; t1557 = -0.646*t69*t1329; t1558 = -0.646*t18*t366*t306; t1559 = -0.646*t72*t1337; t1560 = -0.646*t18*t1186*t312; t1561 = -0.646*t60*t1342; t1562 = -0.646*t18*t369*t316; t1563 = -0.646*t177*t1437; t1564 = 0.646*t17*t18*t10*t333; t1565 = -0.646*t60*t1354; t1566 = -0.646*t18*t369*t343; t1567 = t833 + t834 + t1557 + t1558 + t1559 + t1560 + t1561 + t1562 + t1563 + t1564 + t1565 + t1566; t1568 = -0.646*t118*t1329; t1569 = -0.646*t519*t306; t1570 = -0.646*t121*t1337; t1571 = -0.646*t1253*t312; t1572 = -0.646*t75*t1342; t1573 = -0.646*t523*t316; t1574 = -0.646*t256*t1437; t1575 = -0.646*t1360*t333; t1576 = -0.646*t75*t1354; t1577 = -0.646*t523*t343; t1578 = t786 + t787 + t1568 + t1569 + t1570 + t1571 + t1572 + t1573 + t1574 + t1575 + t1576 + t1577; t1579 = -0.646*t471*t1329; t1580 = -0.646*t1259*t306; t1581 = -0.646*t477*t1337; t1582 = -0.646*t1256*t312; t1583 = -0.646*t402*t1342; t1584 = -0.646*t1262*t316; t1585 = -0.646*t873*t1437; t1586 = -0.646*t1369*t333; t1587 = -0.646*t402*t1354; t1588 = -0.646*t1262*t343; t1589 = t748 + t749 + t1579 + t1580 + t1581 + t1582 + t1583 + t1584 + t1585 + t1586 + t1587 + t1588; t1590 = -0.646*t113*t1329; t1591 = t17*t7*t1288; t1592 = t1591 + t1330; t1593 = t45*t1592; t1594 = -1.*t17*t127*t20; t1595 = t17*t7*t555; t1596 = t1594 + t1595 + t904; t1597 = t50*t1596; t1598 = -1.*t50*t1288; t1599 = -1.*t555*t369; t1600 = t1322 + t1215 + t1598 + t1331 + t1599 + t1332 + t1325 + t1218; t1601 = t17*t10*t1600; t1602 = -1.*t281*t127*t39; t1603 = -1.*t50*t555; t1604 = t1602 + t301 + t1603 + t303 + t921 + t246; t1605 = t17*t7*t1604; t1606 = t1593 + t1597 + t1320 + t1321 + t1601 + t1605; t1607 = -0.0734502*t1606; t1608 = -0.646*t110*t1337; t1609 = -0.646*t115*t1342; t1610 = -0.646*t123*t1354; t1611 = -1.*t17*t7*t1288; t1612 = t1611 + t1355; t1613 = t78*t1612; t1614 = t17*t127*t20; t1615 = -1.*t17*t7*t555; t1616 = t1614 + t1615 + t878; t1617 = t57*t1616; t1618 = t555*t366; t1619 = t57*t1288; t1620 = t1618 + t1356 + t1619 + t1357 + t1242 + t1200 + t1243 + t1201; t1621 = t17*t10*t1620; t1622 = t281*t36*t127; t1623 = t555*t57; t1624 = t1622 + t287 + t288 + t1623 + t895 + t210; t1625 = t17*t7*t1624; t1626 = t1613 + t1617 + t1347 + t1348 + t1621 + t1625; t1627 = 0.0009044*t1626; t1628 = t1590 + t1607 + t1608 + t1609 + t1610 + t1627; t1629 = -0.0176*t7*t20; t1630 = 0.0001*t1366; t1631 = 0.1182826*t42*t1329; t1632 = -0.1182826*t42*t1337; t1633 = t17*t36*t10*t1220; t1634 = t7*t171*t366; t1635 = t17*t7*t36*t725; t1636 = t1634 + t1221 + t1635 + t1222; t1637 = t17*t10*t1636; t1638 = t7*t20*t725; t1639 = t1638 + t1223; t1640 = t78*t1639; t1641 = t17*t7*t36*t286; t1642 = -1.*t36*t171*t20; t1643 = t17*t36*t609; t1644 = t17*t7*t36*t174; t1645 = t7*t171*t57; t1646 = t1642 + t1643 + t1644 + t1645 + t997 + t998; t1647 = t17*t7*t1646; t1648 = t17*t171; t1649 = -1.*t17*t1232*t171; t1650 = t20*t609; t1651 = t7*t20*t174; t1652 = t1648 + t1649 + t1650 + t991 + t1651 + t992; t1653 = t57*t1652; t1654 = -1.*t20*t10*t1226; t1655 = -1.*t7*t20*t310; t1656 = t1633 + t1637 + t1640 + t1641 + t1647 + t1653 + t1654 + t1655; t1657 = 0.0009044*t1656; t1658 = 0.1182826*t63*t1342; t1659 = t17*t39*t10*t1228; t1660 = -1.*t7*t171*t369; t1661 = -1.*t17*t7*t39*t725; t1662 = t1660 + t1229 + t1661 + t1230; t1663 = t17*t10*t1662; t1664 = -1.*t7*t20*t725; t1665 = t1664 + t1231; t1666 = t45*t1665; t1667 = t17*t7*t39*t280; t1668 = t39*t171*t20; t1669 = -1.*t17*t39*t609; t1670 = -1.*t7*t171*t50; t1671 = -1.*t17*t7*t39*t174; t1672 = t1668 + t1669 + t1670 + t1671 + t943 + t944; t1673 = t17*t7*t1672; t1674 = -1.*t17*t171; t1675 = t17*t1232*t171; t1676 = -1.*t20*t609; t1677 = -1.*t7*t20*t174; t1678 = t1674 + t1675 + t1676 + t954 + t1677 + t955; t1679 = t50*t1678; t1680 = -1.*t20*t10*t1235; t1681 = -1.*t7*t20*t314; t1682 = t1659 + t1663 + t1666 + t1667 + t1673 + t1679 + t1680 + t1681; t1683 = -0.0734502*t1682; t1684 = -0.646*t1022*t1437; t1685 = -0.646*t156*t1442; t1686 = -0.1182826*t39*t1354; t1687 = 0.0179*t57; t1688 = t1630 + t1687; t1689 = 0.0005*t66; t1690 = t1630 + t1689; t1691 = 0.0005*t50; t1692 = 0.0001*t1363; t1693 = t1691 + t1692; t1694 = 0.0179*t50; t1695 = -1.*t7*t42*t20; t1696 = t63*t10; t1697 = t1695 + t1696; t1698 = 0.0001*t1697; t1699 = t1694 + t1698; t1700 = 0.0005*t84; t1701 = t1700 + t687; t1702 = 0.0179*t78; t1703 = t1702 + t687; t1704 = 0.0001*t366; t1705 = 0.0005*t45; t1706 = t1704 + t1705; t1707 = 0.0001*t1186; t1708 = 0.0179*t45; t1709 = t1707 + t1708; t1710 = t69*t257; t1711 = t60*t267; t1712 = t1710 + t1711; t1713 = -0.0176*t17*t10; t1714 = -0.646*t373*t1329; t1715 = -0.646*t379*t1337; t1716 = 2.*t57*t1220; t1717 = t366*t286; t1718 = -1.*t17*t7*t1382; t1719 = t285 + t1718 + t1413 + t203; t1720 = t78*t1719; t1721 = 2.*t17*t7*t1226; t1722 = t1382*t57; t1723 = t174*t1363; t1724 = 2.*t366*t725; t1725 = t1414 + t1722 + t1723 + t1724 + t1415 + t1416; t1726 = t17*t10*t1725; t1727 = -1.*t17*t10*t310; t1728 = t1716 + t1717 + t1720 + t1721 + t1726 + t1727; t1729 = 0.0009044*t1728; t1730 = -0.646*t387*t1342; t1731 = 2.*t50*t1228; t1732 = t17*t7*t1382; t1733 = t279 + t1732 + t1417 + t199; t1734 = t45*t1733; t1735 = t369*t280; t1736 = 2.*t17*t7*t1235; t1737 = -1.*t1366*t174; t1738 = -1.*t50*t1382; t1739 = -2.*t369*t725; t1740 = t1418 + t1737 + t1738 + t1739 + t1419 + t1420; t1741 = t17*t10*t1740; t1742 = -1.*t17*t10*t314; t1743 = t1731 + t1734 + t1735 + t1736 + t1741 + t1742; t1744 = -0.0734502*t1743; t1745 = -0.646*t1168*t1437; t1746 = -0.646*t363*t1442; t1747 = -0.646*t393*t1354; t1748 = -0.646*t18*t369*t219; t1749 = -0.646*t60*t1267; t1750 = -0.646*t18*t369*t231; t1751 = -0.646*t60*t1285; t1752 = -0.646*t18*t1186*t238; t1753 = -0.646*t72*t1293; t1754 = -0.646*t18*t366*t253; t1755 = -0.646*t69*t1315; t1756 = -0.646*t177*t1412; t1757 = 0.646*t17*t18*t10*t277; t1758 = t1748 + t1749 + t1750 + t1751 + t1752 + t1753 + t1754 + t1755 + t1756 + t1757; t1759 = -0.646*t523*t219; t1760 = -0.646*t75*t1267; t1761 = -0.646*t523*t231; t1762 = -0.646*t75*t1285; t1763 = -0.646*t1253*t238; t1764 = -0.646*t121*t1293; t1765 = -0.646*t519*t253; t1766 = -0.646*t118*t1315; t1767 = -0.646*t256*t1412; t1768 = -0.646*t1360*t277; t1769 = t452 + t456 + t1759 + t1760 + t1761 + t1762 + t1763 + t1764 + t1765 + t1766 + t1767 + t1768; t1770 = -0.646*t1262*t219; t1771 = -0.646*t402*t1267; t1772 = -0.646*t1262*t231; t1773 = -0.646*t402*t1285; t1774 = -0.646*t1256*t238; t1775 = -0.646*t477*t1293; t1776 = -0.646*t1259*t253; t1777 = -0.646*t471*t1315; t1778 = -0.646*t873*t1412; t1779 = -0.646*t1369*t277; t1780 = t520 + t524 + t1770 + t1771 + t1772 + t1773 + t1774 + t1775 + t1776 + t1777 + t1778 + t1779; t1781 = -0.646*t115*t1267; t1782 = -0.646*t123*t1285; t1783 = t18*t366*t881; t1784 = -1.*t17*t10*t555; t1785 = t8*t159*t1288; t1786 = -1.*t18*t177*t1288; t1787 = t17*t18*t10*t558; t1788 = -1.*t17*t8*t10*t561; t1789 = t1784 + t1785 + t1786 + t1355 + t1787 + t1788; t1790 = t69*t1789; t1791 = t18*t366*t558; t1792 = -1.*t8*t366*t561; t1793 = t18*t1288*t69; t1794 = -1.*t8*t1288*t81; t1795 = t1356 + t1357 + t1200 + t1201 + t1202 + t1203 + t1791 + t1792 + t1204 + t1205 + t1793 + t1794; t1796 = t177*t1795; t1797 = -1.*t17*t18*t10*t898; t1798 = t1783 + t1790 + t1276 + t1277 + t1796 + t1797; t1799 = 0.0009044*t1798; t1800 = -0.646*t110*t1293; t1801 = -0.646*t113*t1315; t1802 = t18*t369*t907; t1803 = t17*t10*t555; t1804 = -1.*t8*t159*t1288; t1805 = t18*t177*t1288; t1806 = -1.*t17*t18*t10*t558; t1807 = t17*t8*t10*t561; t1808 = t1803 + t1804 + t1805 + t1330 + t1806 + t1807; t1809 = t60*t1808; t1810 = -1.*t18*t1288*t60; t1811 = t8*t1288*t52; t1812 = -1.*t18*t369*t558; t1813 = t8*t369*t561; t1814 = t1215 + t1331 + t1332 + t1218 + t1810 + t1811 + t1812 + t1813 + t1308 + t1309 + t1310 + t1311; t1815 = t177*t1814; t1816 = -1.*t17*t18*t10*t924; t1817 = t1802 + t1809 + t1302 + t1303 + t1815 + t1816; t1818 = -0.0734502*t1817; t1819 = t1781 + t1782 + t1799 + t1800 + t1801 + t1818; t1820 = 0.0176*t18*t20*t10; t1821 = -0.0001*t18*t369; t1822 = 0.1182826*t63*t1267; t1823 = -1.*t17*t18*t39*t10*t206; t1824 = -1.*t17*t18*t10*t949; t1825 = t18*t369*t958; t1826 = t621*t1114; t1827 = -1.*t171*t10*t50; t1828 = -1.*t17*t39*t10*t174; t1829 = t8*t612*t369; t1830 = -1.*t18*t618*t369; t1831 = t8*t165*t725; t1832 = -1.*t18*t621*t725; t1833 = t18*t171*t10*t60; t1834 = -1.*t171*t8*t10*t52; t1835 = t17*t18*t39*t10*t183; t1836 = -1.*t17*t39*t8*t10*t186; t1837 = t1827 + t1828 + t1829 + t1830 + t1229 + t1831 + t1832 + t1230 + t1833 + t1834 + t1835 + t1836; t1838 = t177*t1837; t1839 = 2.*t17*t7*t171*t10; t1840 = t171*t8*t159*t10; t1841 = t17*t8*t612*t10; t1842 = -1.*t18*t171*t177*t10; t1843 = -1.*t17*t18*t618*t10; t1844 = -1.*t20*t10*t174; t1845 = t18*t624*t725; t1846 = -1.*t8*t615*t725; t1847 = t18*t20*t10*t183; t1848 = -1.*t20*t8*t10*t186; t1849 = t1839 + t1840 + t1841 + t1842 + t1843 + t1844 + t1845 + t1846 + t1231 + t1847 + t1848; t1850 = t60*t1849; t1851 = t624*t1122; t1852 = t18*t20*t10*t217; t1853 = t1823 + t1824 + t1825 + t1826 + t1838 + t1850 + t1851 + t1852; t1854 = -0.0734502*t1853; t1855 = -0.1182826*t39*t1285; t1856 = -0.646*t156*t1389; t1857 = -0.1182826*t42*t1293; t1858 = -1.*t17*t18*t36*t10*t202; t1859 = t18*t366*t995; t1860 = t659*t1145; t1861 = -2.*t17*t7*t171*t10; t1862 = -1.*t171*t8*t159*t10; t1863 = -1.*t17*t8*t612*t10; t1864 = t18*t171*t177*t10; t1865 = t17*t18*t618*t10; t1866 = t20*t10*t174; t1867 = -1.*t18*t624*t725; t1868 = t8*t615*t725; t1869 = -1.*t18*t20*t10*t183; t1870 = t20*t8*t10*t186; t1871 = t1861 + t1862 + t1863 + t1864 + t1865 + t1866 + t1867 + t1868 + t1223 + t1869 + t1870; t1872 = t69*t1871; t1873 = -1.*t17*t18*t10*t1003; t1874 = t17*t36*t10*t174; t1875 = t171*t10*t57; t1876 = -1.*t8*t612*t366; t1877 = t18*t618*t366; t1878 = -1.*t8*t162*t725; t1879 = t18*t659*t725; t1880 = -1.*t17*t18*t36*t10*t183; t1881 = t17*t36*t8*t10*t186; t1882 = -1.*t18*t171*t10*t69; t1883 = t171*t8*t10*t81; t1884 = t1874 + t1875 + t1876 + t1877 + t1221 + t1878 + t1879 + t1222 + t1880 + t1881 + t1882 + t1883; t1885 = t177*t1884; t1886 = t624*t1159; t1887 = t18*t20*t10*t236; t1888 = t1858 + t1859 + t1860 + t1872 + t1873 + t1885 + t1886 + t1887; t1889 = 0.0009044*t1888; t1890 = 0.1182826*t42*t1315; t1891 = -0.646*t1022*t1412; t1892 = 0.0005*t18*t1186; t1893 = t1892 + t1821; t1894 = 0.0179*t18*t366; t1895 = t1894 + t1821; t1896 = -0.0001*t18*t366; t1897 = 0.0005*t18*t369; t1898 = t1896 + t1897; t1899 = -0.0001*t18*t1186; t1900 = 0.0179*t18*t369; t1901 = t1899 + t1900; t1902 = 0.0005*t60; t1903 = 0.0001*t294; t1904 = t1902 + t1903; t1905 = 0.0179*t69; t1906 = t1029 + t1905; t1907 = 0.0179*t60; t1908 = 0.0001*t541; t1909 = t1907 + t1908; t1910 = 0.0005*t72; t1911 = t1029 + t1910; t1912 = -0.646*t1329*t219; t1913 = -0.646*t306*t1267; t1914 = -0.646*t1337*t231; t1915 = -0.646*t312*t1285; t1916 = -0.646*t333*t1389; t1917 = -0.646*t1437*t1712; t1918 = -0.646*t1354*t238; t1919 = -0.646*t343*t1293; t1920 = -0.646*t1342*t253; t1921 = -0.646*t316*t1315; t1922 = -0.646*t1090*t1412; t1923 = -0.646*t1442*t277; t1924 = -0.0176*t17*t18*t7; t1925 = 2.*t17*t7*t174; t1926 = -1.*t8*t159*t1382; t1927 = t18*t177*t1382; t1928 = -2.*t17*t1383*t10*t725; t1929 = -2.*t17*t1384*t10*t725; t1930 = -1.*t17*t18*t7*t183; t1931 = t17*t7*t8*t186; t1932 = t1925 + t1926 + t1927 + t1413 + t1928 + t1929 + t199 + t1930 + t1931; t1933 = t60*t1932; t1934 = t18*t1366*t206; t1935 = 2.*t18*t369*t1114; t1936 = -2.*t1383*t369*t725; t1937 = -2.*t1384*t369*t725; t1938 = -1.*t18*t1382*t60; t1939 = t8*t1382*t52; t1940 = -1.*t18*t1366*t183; t1941 = t8*t1366*t186; t1942 = t1418 + t1936 + t1937 + t1419 + t1420 + t1938 + t1939 + t1940 + t1941; t1943 = t177*t1942; t1944 = -2.*t17*t18*t10*t1122; t1945 = -1.*t17*t18*t7*t217; t1946 = t1933 + t1934 + t1935 + t1943 + t1944 + t1945; t1947 = -0.0734502*t1946; t1948 = -0.646*t387*t1267; t1949 = -0.646*t393*t1285; t1950 = -0.646*t363*t1389; t1951 = -2.*t17*t7*t174; t1952 = t8*t159*t1382; t1953 = -1.*t18*t177*t1382; t1954 = 2.*t17*t1383*t10*t725; t1955 = 2.*t17*t1384*t10*t725; t1956 = t17*t18*t7*t183; t1957 = -1.*t17*t7*t8*t186; t1958 = t1951 + t1952 + t1953 + t1417 + t1954 + t1955 + t203 + t1956 + t1957; t1959 = t69*t1958; t1960 = t18*t1363*t202; t1961 = 2.*t18*t366*t1145; t1962 = 2.*t1383*t366*t725; t1963 = 2.*t1384*t366*t725; t1964 = t18*t1363*t183; t1965 = -1.*t8*t1363*t186; t1966 = t18*t1382*t69; t1967 = -1.*t8*t1382*t81; t1968 = t1414 + t1962 + t1963 + t1415 + t1416 + t1964 + t1965 + t1966 + t1967; t1969 = t177*t1968; t1970 = -2.*t17*t18*t10*t1159; t1971 = -1.*t17*t18*t7*t236; t1972 = t1959 + t1960 + t1961 + t1969 + t1970 + t1971; t1973 = 0.0009044*t1972; t1974 = -0.646*t379*t1293; t1975 = -0.646*t373*t1315; t1976 = -0.646*t1168*t1412; t1977 = var[32]; t1978 = var[35]; t1979 = -1.*t9*t18*t20; t1980 = -1.*t9*t7*t8; t1981 = t5*t10; t1982 = t1980 + t1981; t1983 = t17*t1982; t1984 = t1979 + t1983; t1985 = -1.*t17*t39*t168; t1986 = t1669 + t1985; t1987 = t17*t39*t609; t1988 = t17*t39*t168; t1989 = t1987 + t1988; t1990 = -1.*t20*t168; t1991 = t1676 + t1990; t1992 = t20*t168; t1993 = t1650 + t1992; t1994 = t17*t42*t609; t1995 = t17*t42*t168; t1996 = t1994 + t1995; t1997 = t17*t36*t1996; t1998 = -1.*t17*t36*t609; t1999 = -1.*t17*t36*t168; t2000 = t1998 + t1999; t2001 = t17*t42*t2000; t2002 = t17*t39*t1986; t2003 = t17*t39*t1989; t2004 = -1.*t36*t20*t353; t2005 = -1.*t42*t20*t356; t2006 = -1.*t39*t20*t359; t2007 = -1.*t39*t20*t361; t2008 = t1997 + t2001 + t2002 + t2003 + t2004 + t2005 + t2006 + t2007; t2009 = -1.*t39*t20*t348; t2010 = -1.*t20*t1986; t2011 = t17*t39*t1991; t2012 = -1.*t17*t371; t2013 = t2009 + t2010 + t2011 + t2012; t2014 = -1.*t39*t20*t350; t2015 = -1.*t20*t1989; t2016 = t17*t39*t1993; t2017 = -1.*t17*t377; t2018 = t2014 + t2015 + t2016 + t2017; t2019 = -1.*t42*t20*t348; t2020 = -1.*t17*t42*t609; t2021 = -1.*t17*t42*t168; t2022 = t2020 + t2021; t2023 = -1.*t20*t2022; t2024 = t17*t42*t1991; t2025 = -1.*t17*t385; t2026 = t2019 + t2023 + t2024 + t2025; t2027 = -1.*t36*t20*t350; t2028 = t17*t36*t168; t2029 = t1643 + t2028; t2030 = -1.*t20*t2029; t2031 = t17*t36*t1993; t2032 = -1.*t17*t391; t2033 = t2027 + t2030 + t2031 + t2032; t2034 = -1.*t18*t42*t20; t2035 = -1.*t17*t7*t42*t8; t2036 = t2034 + t2035; t2037 = t9*t165; t2038 = t17*t39*t5*t10; t2039 = t2037 + t2038; t2040 = 0.0001*t39*t20; t2041 = -1.*t17*t130; t2042 = -0.1831*t20; t2043 = t2041 + t2042; t2044 = t17*t18*t7*t42; t2045 = -1.*t42*t20*t8; t2046 = t2044 + t2045; t2047 = -0.0005*t42*t20; t2048 = t2047 + t2040; t2049 = -0.0179*t36*t20; t2050 = t2049 + t2040; t2051 = 0.0001*t42*t20; t2052 = -0.0179*t39*t20; t2053 = t2051 + t2052; t2054 = 0.0001*t36*t20; t2055 = -0.0005*t39*t20; t2056 = t2054 + t2055; t2057 = t17*t18*t7*t135; t2058 = -1.*t135*t20*t8; t2059 = t2057 + t2058; t2060 = -1.*t18*t135*t20; t2061 = -1.*t17*t7*t135*t8; t2062 = t2060 + t2061; t2063 = t171*t10*t45; t2064 = t17*t39*t10*t180; t2065 = t618*t60; t2066 = t612*t52; t2067 = t621*t183; t2068 = t165*t186; t2069 = t2063 + t2064 + t2065 + t2066 + t2067 + t2068; t2070 = -1.*t171*t10*t78; t2071 = -1.*t17*t36*t10*t180; t2072 = -1.*t659*t183; t2073 = -1.*t162*t186; t2074 = -1.*t618*t69; t2075 = -1.*t612*t81; t2076 = t2070 + t2071 + t2072 + t2073 + t2074 + t2075; t2077 = t17*t39*t2000; t2078 = t17*t36*t1989; t2079 = -1.*t39*t20*t356; t2080 = -1.*t36*t20*t361; t2081 = t2077 + t2078 + t2079 + t2080; t2082 = t281*t135*t656; t2083 = -1.*t20*t10*t192; t2084 = -1.*t171*t10*t84; t2085 = -1.*t17*t39*t10*t192; t2086 = -1.*t17*t135*t10*t45; t2087 = -1.*t17*t42*t10*t180; t2088 = t171*t10*t84; t2089 = t17*t39*t10*t192; t2090 = t17*t135*t10*t45; t2091 = t17*t42*t10*t180; t2092 = t36*t171*t20; t2093 = -1.*t17*t7*t36*t174; t2094 = -1.*t7*t171*t57; t2095 = t2092 + t1998 + t2093 + t2094 + t2070 + t2071; t2096 = -1.*t17*t135*t10*t78; t2097 = -1.*t17*t36*t10*t192; t2098 = -1.*t39*t171*t20; t2099 = t7*t171*t50; t2100 = t17*t7*t39*t174; t2101 = t2098 + t1987 + t2099 + t2100 + t2063 + t2064; t2102 = -1.*t281*t135*t656; t2103 = t20*t10*t192; t2104 = t17*t135*t10*t78; t2105 = t17*t36*t10*t192; t2106 = -1.*t5*t2036; t2107 = t17*t9*t42*t10; t2108 = t2106 + t2107; t2109 = t9*t2036; t2110 = t17*t42*t5*t10; t2111 = t2109 + t2110; t2112 = t9*t162; t2113 = t17*t36*t5*t10; t2114 = t2112 + t2113; t2115 = t621*t206; t2116 = t177*t949; t2117 = t60*t958; t2118 = t624*t217; t2119 = t2115 + t2116 + t2117 + t2118; t2120 = t659*t223; t2121 = -1.*t159*t2062; t2122 = -1.*t177*t2059; t2123 = -1.*t624*t195; t2124 = -1.*t615*t198; t2125 = t2121 + t2122 + t2102 + t2103 + t2123 + t2124; t2126 = t69*t2125; t2127 = t621*t202; t2128 = t60*t995; t2129 = t659*t195; t2130 = t162*t198; t2131 = t2059*t69; t2132 = t2062*t81; t2133 = t2104 + t2105 + t2063 + t2064 + t2065 + t2066 + t2129 + t2130 + t2067 + t2068 + t2131 + t2132; t2134 = t177*t2133; t2135 = t624*t229; t2136 = t2120 + t2126 + t2127 + t2128 + t2134 + t2135; t2137 = t17*t18*t7*t127; t2138 = -1.*t127*t20*t8; t2139 = t2137 + t2138; t2140 = -1.*t18*t127*t20; t2141 = -1.*t17*t7*t127*t8; t2142 = t2140 + t2141; t2143 = t659*t202; t2144 = t69*t995; t2145 = t177*t1003; t2146 = t624*t236; t2147 = t2143 + t2144 + t2145 + t2146; t2148 = t621*t242; t2149 = t159*t2062; t2150 = t177*t2059; t2151 = t624*t195; t2152 = t615*t198; t2153 = t2149 + t2150 + t2082 + t2083 + t2151 + t2152; t2154 = t60*t2153; t2155 = t2046*t206; t2156 = t72*t958; t2157 = -1.*t2059*t60; t2158 = -1.*t2062*t52; t2159 = -1.*t621*t195; t2160 = -1.*t165*t198; t2161 = -1.*t2046*t183; t2162 = -1.*t2036*t186; t2163 = -1.*t618*t72; t2164 = -1.*t612*t87; t2165 = t2084 + t2085 + t2086 + t2087 + t2157 + t2158 + t2159 + t2160 + t2161 + t2162 + t2163 + t2164; t2166 = t177*t2165; t2167 = t624*t251; t2168 = t2148 + t2154 + t2155 + t2156 + t2166 + t2167; t2169 = t17*t39*t10*t297; t2170 = -1.*t281*t135; t2171 = t281*t1232*t135; t2172 = t135*t344; t2173 = -1.*t7*t20*t189; t2174 = t2170 + t2171 + t2172 + t2082 + t2173 + t2083; t2175 = t45*t2174; t2176 = t17*t42*t10*t280; t2177 = 2.*t17*t135*t39*t20; t2178 = t42*t171*t20; t2179 = -1.*t17*t7*t135*t50; t2180 = -1.*t17*t7*t39*t189; t2181 = -1.*t17*t7*t42*t174; t2182 = -1.*t7*t171*t66; t2183 = t2177 + t2178 + t2020 + t2179 + t2180 + t2181 + t2182 + t2084 + t2085 + t2086 + t2087; t2184 = t17*t10*t2183; t2185 = t84*t1678; t2186 = -1.*t20*t10*t304; t2187 = t2169 + t2175 + t2176 + t2184 + t2185 + t2186; t2188 = t281*t127*t656; t2189 = -1.*t20*t10*t578; t2190 = -1.*t17*t39*t10*t578; t2191 = -1.*t17*t127*t10*t45; t2192 = t17*t36*t10*t286; t2193 = t17*t10*t1646; t2194 = t78*t1652; t2195 = -1.*t20*t10*t310; t2196 = t2192 + t2193 + t2194 + t2195; t2197 = t17*t39*t10*t280; t2198 = t17*t10*t1672; t2199 = t45*t1678; t2200 = -1.*t20*t10*t314; t2201 = t2197 + t2198 + t2199 + t2200; t2202 = t17*t36*t10*t336; t2203 = t281*t135; t2204 = -1.*t281*t1232*t135; t2205 = -1.*t135*t344; t2206 = t7*t20*t189; t2207 = t2203 + t2204 + t2205 + t2102 + t2206 + t2103; t2208 = t78*t2207; t2209 = t17*t39*t10*t286; t2210 = -2.*t17*t36*t135*t20; t2211 = t17*t7*t36*t189; t2212 = t17*t7*t135*t57; t2213 = t2210 + t2098 + t1987 + t2099 + t2211 + t2100 + t2212 + t2104 + t2105 + t2063 + t2064; t2214 = t17*t10*t2213; t2215 = t45*t1652; t2216 = -1.*t20*t10*t341; t2217 = t2202 + t2208 + t2209 + t2214 + t2215 + t2216; t2218 = -1.*t281*t127*t656; t2219 = t20*t10*t578; t2220 = t17*t127*t10*t78; t2221 = t17*t36*t10*t578; t2222 = -0.646*t113*t2026; t2223 = -1.*t42*t552; t2224 = -1.*t127*t39*t344; t2225 = t2223 + t1602 + t382 + t301 + t2224 + t384; t2226 = -1.*t17*t2225; t2227 = t2019 + t2023 + t2024 + t2226; t2228 = -0.0734502*t2227; t2229 = -0.646*t110*t2033; t2230 = -0.646*t115*t2013; t2231 = -0.646*t123*t2018; t2232 = t552*t39; t2233 = t36*t127*t344; t2234 = t142 + t1622 + t2232 + t287 + t2233 + t346; t2235 = -1.*t17*t2234; t2236 = t2014 + t2015 + t2016 + t2235; t2237 = 0.0009044*t2236; t2238 = t2222 + t2228 + t2229 + t2230 + t2231 + t2237; t2239 = -1.*t5*t615; t2240 = -1.*t9*t20*t10; t2241 = t2239 + t2240; t2242 = t9*t615; t2243 = -1.*t20*t5*t10; t2244 = t2242 + t2243; t2245 = t7*t36*t20*t8; t2246 = t684 + t2245; t2247 = t7*t39*t20*t8; t2248 = t681 + t2247; t2249 = -1.*t18*t7*t39*t20; t2250 = t2249 + t289; t2251 = t18*t7*t609; t2252 = t2043*t8; t2253 = t2251 + t2252; t2254 = t18*t2043; t2255 = -1.*t7*t609*t8; t2256 = t2254 + t2255; t2257 = t69*t2069; t2258 = t659*t257; t2259 = t60*t2076; t2260 = t621*t267; t2261 = t2257 + t2258 + t2259 + t2260; t2262 = -1.*t18*t7*t36*t20; t2263 = t2262 + t292; t2264 = t60*t2069; t2265 = t621*t257; t2266 = -1.*t659*t195; t2267 = -1.*t162*t198; t2268 = -1.*t2059*t69; t2269 = -1.*t2062*t81; t2270 = t2096 + t2097 + t943 + t944 + t945 + t946 + t2266 + t2267 + t947 + t948 + t2268 + t2269; t2271 = t60*t2270; t2272 = t72*t2076; t2273 = t621*t262; t2274 = t2046*t267; t2275 = t2059*t60; t2276 = t2062*t52; t2277 = t621*t195; t2278 = t165*t198; t2279 = t2046*t183; t2280 = t2036*t186; t2281 = t618*t72; t2282 = t612*t87; t2283 = t2088 + t2089 + t2090 + t2091 + t2275 + t2276 + t2277 + t2278 + t2279 + t2280 + t2281 + t2282; t2284 = t69*t2283; t2285 = t659*t275; t2286 = t2264 + t2265 + t2271 + t2272 + t2273 + t2274 + t2284 + t2285; t2287 = t2043*t20; t2288 = 2.*t171*t20*t656; t2289 = -1.*t17*t609*t656; t2290 = t17*t36*t2043; t2291 = 2.*t17*t36*t171*t656; t2292 = t609*t10*t78; t2293 = -1.*t36*t20*t10*t180; t2294 = -1.*t2043*t20; t2295 = -2.*t171*t20*t656; t2296 = t17*t609*t656; t2297 = -1.*t17*t39*t2043; t2298 = -2.*t17*t39*t171*t656; t2299 = -1.*t609*t10*t45; t2300 = t39*t20*t10*t180; t2301 = t45*t2095; t2302 = t78*t2101; t2303 = t17*t39*t10*t325; t2304 = t17*t36*t10*t331; t2305 = t2301 + t2302 + t2303 + t2304; t2306 = -2.*t17*t135*t39*t20; t2307 = -1.*t42*t171*t20; t2308 = t17*t7*t135*t50; t2309 = t17*t7*t39*t189; t2310 = t17*t7*t42*t174; t2311 = t7*t171*t66; t2312 = t2306 + t2307 + t1994 + t2308 + t2309 + t2310 + t2311 + t2088 + t2089 + t2090 + t2091; t2313 = t78*t2312; t2314 = t84*t2095; t2315 = 2.*t17*t36*t135*t20; t2316 = -1.*t17*t7*t36*t189; t2317 = -1.*t17*t7*t135*t57; t2318 = t2315 + t1668 + t1669 + t1670 + t2316 + t1671 + t2317 + t2096 + t2097 + t943 + t944; t2319 = t45*t2318; t2320 = t45*t2101; t2321 = t17*t36*t10*t321; t2322 = t17*t42*t10*t325; t2323 = t17*t39*t10*t329; t2324 = t17*t39*t10*t331; t2325 = t2313 + t2314 + t2319 + t2320 + t2321 + t2322 + t2323 + t2324; t2326 = 0.0176*t20; t2327 = 0.1182826*t42*t2026; t2328 = -0.1182826*t42*t2033; t2329 = -1.*t17*t36*t350; t2330 = t17*t609; t2331 = t2287 + t284 + t2330 + t347; t2332 = t17*t36*t2331; t2333 = -2.*t17*t2029; t2334 = -2.*t36*t20*t1993; t2335 = -1.*t36*t20*t609; t2336 = t2290 + t308 + t2335 + t355; t2337 = -1.*t20*t2336; t2338 = t20*t391; t2339 = t2329 + t2332 + t2333 + t2334 + t2337 + t2338; t2340 = 0.0009044*t2339; t2341 = 0.1182826*t63*t2013; t2342 = -0.646*t156*t2081; t2343 = -0.646*t1022*t2008; t2344 = -0.1182826*t39*t2018; t2345 = -1.*t17*t609; t2346 = t2294 + t278 + t2345 + t349; t2347 = t17*t39*t2346; t2348 = -1.*t17*t39*t348; t2349 = -2.*t17*t1986; t2350 = -2.*t39*t20*t1991; t2351 = t20*t371; t2352 = t39*t20*t609; t2353 = t2297 + t282 + t2352 + t346; t2354 = -1.*t20*t2353; t2355 = t2347 + t2348 + t2349 + t2350 + t2351 + t2354; t2356 = -0.0734502*t2355; t2357 = 0.0009044*t2046; t2358 = -0.646*t123*t2046; t2359 = -0.646*t115*t659; t2360 = -0.0734502*t621; t2361 = -0.646*t110*t621; t2362 = -0.646*t113*t621; t2363 = t2357 + t2358 + t2359 + t2360 + t2361 + t2362; t2364 = -0.646*t156*t624; t2365 = -0.0734502*t2263; t2366 = 0.0009044*t2250; t2367 = -0.1182826*t39*t2046; t2368 = 0.1182826*t63*t659; t2369 = t2364 + t2365 + t2366 + t2367 + t2368; t2370 = -0.646*t363*t624; t2371 = -0.646*t2008*t177; t2372 = -0.646*t393*t2046; t2373 = -0.646*t387*t659; t2374 = -0.646*t373*t621; t2375 = -0.646*t379*t621; t2376 = -0.646*t2013*t60; t2377 = -0.646*t2018*t60; t2378 = -0.646*t2026*t69; t2379 = -0.646*t2033*t72; t2380 = t2370 + t2371 + t2372 + t2373 + t2374 + t2375 + t1450 + t1451 + t2376 + t2377 + t2378 + t2379; t2381 = -0.646*t2111*t60; t2382 = -0.646*t2114*t60; t2383 = -0.646*t2039*t69; t2384 = -0.646*t2039*t72; t2385 = -0.646*t2046*t402; t2386 = -0.646*t659*t402; t2387 = -0.646*t621*t471; t2388 = -0.646*t621*t477; t2389 = t2381 + t2382 + t2383 + t2384 + t2385 + t2386 + t2387 + t2388; t2390 = 0.0009044*t2111; t2391 = -0.646*t123*t2111; t2392 = -0.646*t115*t2114; t2393 = -0.0734502*t2039; t2394 = -0.646*t110*t2039; t2395 = -0.646*t113*t2039; t2396 = t2390 + t2391 + t2392 + t2393 + t2394 + t2395; t2397 = -0.1182826*t39*t2111; t2398 = 0.1182826*t63*t2114; t2399 = -0.646*t156*t2244; t2400 = t9*t2246; t2401 = -1.*t36*t20*t5*t10; t2402 = t2400 + t2401; t2403 = -0.0734502*t2402; t2404 = t9*t2248; t2405 = -1.*t39*t20*t5*t10; t2406 = t2404 + t2405; t2407 = 0.0009044*t2406; t2408 = t2397 + t2398 + t2399 + t2403 + t2407; t2409 = -0.646*t2008*t873; t2410 = -0.646*t393*t2111; t2411 = -0.646*t387*t2114; t2412 = -0.646*t373*t2039; t2413 = -0.646*t379*t2039; t2414 = -0.646*t363*t2244; t2415 = -0.646*t2013*t402; t2416 = -0.646*t2018*t402; t2417 = -0.646*t2026*t471; t2418 = -0.646*t2033*t477; t2419 = t2409 + t2410 + t2411 + t2412 + t2413 + t2414 + t1484 + t1488 + t2415 + t2416 + t2417 + t2418; t2420 = -0.646*t2108*t60; t2421 = -0.646*t491*t60; t2422 = -0.646*t495*t69; t2423 = -0.646*t495*t72; t2424 = -0.646*t2046*t75; t2425 = -0.646*t659*t75; t2426 = -0.646*t621*t118; t2427 = -0.646*t621*t121; t2428 = t2420 + t2421 + t2422 + t2423 + t2424 + t2425 + t2426 + t2427; t2429 = -0.646*t2108*t402; t2430 = -0.646*t491*t402; t2431 = -0.646*t2111*t75; t2432 = -0.646*t2114*t75; t2433 = -0.646*t495*t471; t2434 = -0.646*t2039*t118; t2435 = -0.646*t495*t477; t2436 = -0.646*t2039*t121; t2437 = t2429 + t2430 + t2431 + t2432 + t2433 + t2434 + t2435 + t2436; t2438 = 0.0009044*t2108; t2439 = -0.646*t123*t2108; t2440 = -0.646*t115*t491; t2441 = -0.0734502*t495; t2442 = -0.646*t110*t495; t2443 = -0.646*t113*t495; t2444 = t2438 + t2439 + t2440 + t2441 + t2442 + t2443; t2445 = -0.1182826*t39*t2108; t2446 = 0.1182826*t63*t491; t2447 = -0.646*t156*t2241; t2448 = -1.*t5*t2246; t2449 = -1.*t9*t36*t20*t10; t2450 = t2448 + t2449; t2451 = -0.0734502*t2450; t2452 = -1.*t5*t2248; t2453 = -1.*t9*t39*t20*t10; t2454 = t2452 + t2453; t2455 = 0.0009044*t2454; t2456 = t2445 + t2446 + t2447 + t2451 + t2455; t2457 = -0.646*t2008*t256; t2458 = -0.646*t393*t2108; t2459 = -0.646*t387*t491; t2460 = -0.646*t373*t495; t2461 = -0.646*t379*t495; t2462 = -0.646*t363*t2241; t2463 = -0.646*t2013*t75; t2464 = -0.646*t2018*t75; t2465 = -0.646*t2026*t118; t2466 = -0.646*t2033*t121; t2467 = t2457 + t2458 + t2459 + t2460 + t2461 + t2462 + t1535 + t1539 + t2463 + t2464 + t2465 + t2466; t2468 = -0.646*t659*t306; t2469 = -0.646*t69*t2187; t2470 = -0.646*t2046*t312; t2471 = -0.646*t72*t2196; t2472 = -0.646*t621*t316; t2473 = -0.646*t60*t2201; t2474 = -0.646*t177*t2325; t2475 = -0.646*t624*t333; t2476 = -0.646*t621*t343; t2477 = -0.646*t60*t2217; t2478 = t819 + t820 + t2468 + t2469 + t2470 + t2471 + t2472 + t2473 + t2474 + t2475 + t2476 + t2477; t2479 = -0.646*t491*t306; t2480 = -0.646*t118*t2187; t2481 = -0.646*t2108*t312; t2482 = -0.646*t121*t2196; t2483 = -0.646*t495*t316; t2484 = -0.646*t75*t2201; t2485 = -0.646*t256*t2325; t2486 = -0.646*t2241*t333; t2487 = -0.646*t495*t343; t2488 = -0.646*t75*t2217; t2489 = t772 + t773 + t2479 + t2480 + t2481 + t2482 + t2483 + t2484 + t2485 + t2486 + t2487 + t2488; t2490 = -0.646*t2114*t306; t2491 = -0.646*t471*t2187; t2492 = -0.646*t2111*t312; t2493 = -0.646*t477*t2196; t2494 = -0.646*t2039*t316; t2495 = -0.646*t402*t2201; t2496 = -0.646*t873*t2325; t2497 = -0.646*t2244*t333; t2498 = -0.646*t2039*t343; t2499 = -0.646*t402*t2217; t2500 = t734 + t735 + t2490 + t2491 + t2492 + t2493 + t2494 + t2495 + t2496 + t2497 + t2498 + t2499; t2501 = -0.646*t113*t2187; t2502 = t17*t39*t10*t1596; t2503 = -1.*t281*t127; t2504 = t281*t1232*t127; t2505 = t127*t344; t2506 = -1.*t7*t20*t555; t2507 = t2503 + t2504 + t2505 + t2188 + t2506 + t2189; t2508 = t45*t2507; t2509 = 2.*t17*t127*t39*t20; t2510 = -1.*t17*t7*t127*t50; t2511 = -1.*t17*t7*t39*t555; t2512 = t2509 + t2178 + t2020 + t2510 + t2511 + t2181 + t2182 + t2084 + t2190 + t2191 + t2087; t2513 = t17*t10*t2512; t2514 = -1.*t20*t10*t1604; t2515 = t2502 + t2508 + t2176 + t2513 + t2185 + t2514; t2516 = -0.0734502*t2515; t2517 = -0.646*t110*t2196; t2518 = -0.646*t115*t2201; t2519 = -0.646*t123*t2217; t2520 = t17*t36*t10*t1616; t2521 = t281*t127; t2522 = -1.*t281*t1232*t127; t2523 = -1.*t127*t344; t2524 = t7*t20*t555; t2525 = t2521 + t2522 + t2523 + t2218 + t2524 + t2219; t2526 = t78*t2525; t2527 = -2.*t17*t36*t127*t20; t2528 = t17*t7*t36*t555; t2529 = t17*t7*t127*t57; t2530 = t2527 + t2098 + t1987 + t2099 + t2528 + t2100 + t2529 + t2220 + t2221 + t2063 + t2064; t2531 = t17*t10*t2530; t2532 = -1.*t20*t10*t1624; t2533 = t2520 + t2526 + t2209 + t2531 + t2215 + t2532; t2534 = 0.0009044*t2533; t2535 = t2501 + t2516 + t2517 + t2518 + t2519 + t2534; t2536 = -0.0001*t17*t39*t10; t2537 = 0.1182826*t42*t2187; t2538 = -1.*t36*t20*t10*t286; t2539 = 2.*t1232*t171*t20; t2540 = 2.*t17*t609; t2541 = -1.*t17*t1232*t609; t2542 = t2287 + t278 + t2539 + t2540 + t2541 + t2288 + t2289 + t279 + t203; t2543 = t78*t2542; t2544 = -2.*t20*t10*t1646; t2545 = 2.*t17*t36*t10*t1652; t2546 = 2.*t17*t1232*t36*t171; t2547 = -2.*t36*t20*t609; t2548 = -1.*t7*t36*t20*t174; t2549 = t7*t609*t57; t2550 = t2290 + t323 + t2546 + t2547 + t2291 + t2548 + t2549 + t2292 + t2293; t2551 = t17*t10*t2550; t2552 = t2538 + t2543 + t2544 + t2545 + t2551 + t1727; t2553 = 0.0009044*t2552; t2554 = -0.1182826*t42*t2196; t2555 = -2.*t1232*t171*t20; t2556 = -2.*t17*t609; t2557 = t17*t1232*t609; t2558 = t2294 + t284 + t2555 + t2556 + t2557 + t2295 + t2296 + t285 + t199; t2559 = t45*t2558; t2560 = -1.*t39*t20*t10*t280; t2561 = -2.*t20*t10*t1672; t2562 = 2.*t17*t39*t10*t1678; t2563 = -2.*t17*t1232*t39*t171; t2564 = 2.*t39*t20*t609; t2565 = -1.*t7*t609*t50; t2566 = t7*t39*t20*t174; t2567 = t2297 + t287 + t2563 + t2564 + t2298 + t2565 + t2566 + t2299 + t2300; t2568 = t17*t10*t2567; t2569 = t2559 + t2560 + t2561 + t2562 + t2568 + t1742; t2570 = -0.0734502*t2569; t2571 = 0.1182826*t63*t2201; t2572 = -0.646*t156*t2305; t2573 = -0.646*t1022*t2325; t2574 = -0.1182826*t39*t2217; t2575 = 0.0005*t17*t42*t10; t2576 = t2575 + t2536; t2577 = 0.0179*t17*t36*t10; t2578 = t2577 + t2536; t2579 = -0.0001*t17*t42*t10; t2580 = 0.0179*t17*t39*t10; t2581 = t2579 + t2580; t2582 = -0.0001*t17*t36*t10; t2583 = 0.0005*t17*t39*t10; t2584 = t2582 + t2583; t2585 = -0.646*t2013*t306; t2586 = -0.646*t373*t2187; t2587 = -0.646*t2018*t312; t2588 = -0.646*t379*t2196; t2589 = -0.646*t2026*t316; t2590 = -0.646*t387*t2201; t2591 = -0.646*t363*t2305; t2592 = -0.646*t1168*t2325; t2593 = -0.646*t2008*t1090; t2594 = -0.646*t2081*t333; t2595 = -0.646*t2033*t343; t2596 = -0.646*t393*t2217; t2597 = -0.646*t60*t2119; t2598 = -0.646*t621*t219; t2599 = -0.646*t60*t2136; t2600 = -0.646*t621*t231; t2601 = -0.646*t72*t2147; t2602 = -0.646*t2046*t238; t2603 = -0.646*t69*t2168; t2604 = -0.646*t659*t253; t2605 = -0.646*t177*t2286; t2606 = -0.646*t624*t277; t2607 = t2597 + t2598 + t2599 + t2600 + t2601 + t2602 + t2603 + t2604 + t2605 + t2606; t2608 = -0.646*t75*t2119; t2609 = -0.646*t495*t219; t2610 = -0.646*t75*t2136; t2611 = -0.646*t495*t231; t2612 = -0.646*t121*t2147; t2613 = -0.646*t2108*t238; t2614 = -0.646*t118*t2168; t2615 = -0.646*t491*t253; t2616 = -0.646*t256*t2286; t2617 = -0.646*t2241*t277; t2618 = t415 + t419 + t2608 + t2609 + t2610 + t2611 + t2612 + t2613 + t2614 + t2615 + t2616 + t2617; t2619 = -0.646*t402*t2119; t2620 = -0.646*t2039*t219; t2621 = -0.646*t402*t2136; t2622 = -0.646*t2039*t231; t2623 = -0.646*t477*t2147; t2624 = -0.646*t2111*t238; t2625 = -0.646*t471*t2168; t2626 = -0.646*t2114*t253; t2627 = -0.646*t873*t2286; t2628 = -0.646*t2244*t277; t2629 = t492 + t496 + t2619 + t2620 + t2621 + t2622 + t2623 + t2624 + t2625 + t2626 + t2627 + t2628; t2630 = -0.646*t115*t2119; t2631 = -0.646*t123*t2136; t2632 = t659*t881; t2633 = -1.*t159*t2142; t2634 = -1.*t177*t2139; t2635 = -1.*t624*t558; t2636 = -1.*t615*t561; t2637 = t2633 + t2634 + t2218 + t2219 + t2635 + t2636; t2638 = t69*t2637; t2639 = t659*t558; t2640 = t162*t561; t2641 = t2139*t69; t2642 = t2142*t81; t2643 = t2220 + t2221 + t2063 + t2064 + t2065 + t2066 + t2639 + t2640 + t2067 + t2068 + t2641 + t2642; t2644 = t177*t2643; t2645 = t624*t898; t2646 = t2632 + t2638 + t2127 + t2128 + t2644 + t2645; t2647 = 0.0009044*t2646; t2648 = -0.646*t110*t2147; t2649 = -0.646*t113*t2168; t2650 = t621*t907; t2651 = t159*t2142; t2652 = t177*t2139; t2653 = t624*t558; t2654 = t615*t561; t2655 = t2651 + t2652 + t2188 + t2189 + t2653 + t2654; t2656 = t60*t2655; t2657 = -1.*t2139*t60; t2658 = -1.*t2142*t52; t2659 = -1.*t621*t558; t2660 = -1.*t165*t561; t2661 = t2084 + t2190 + t2191 + t2087 + t2657 + t2658 + t2659 + t2660 + t2161 + t2162 + t2163 + t2164; t2662 = t177*t2661; t2663 = t624*t924; t2664 = t2650 + t2656 + t2155 + t2156 + t2662 + t2663; t2665 = -0.0734502*t2664; t2666 = t2630 + t2631 + t2647 + t2648 + t2649 + t2665; t2667 = 0.0001*t595; t2668 = 0.1182826*t63*t2119; t2669 = t2250*t206; t2670 = t2253*t177; t2671 = 2.*t612*t615; t2672 = 2.*t624*t618; t2673 = t159*t2256; t2674 = t2670 + t2671 + t2672 + t2673 + t2295 + t2296 + t199 + t1046 + t1048; t2675 = t60*t2674; t2676 = 2.*t624*t949; t2677 = 2.*t621*t958; t2678 = -2.*t165*t612; t2679 = -2.*t621*t618; t2680 = -1.*t2253*t60; t2681 = -1.*t2256*t52; t2682 = -1.*t2250*t183; t2683 = -1.*t2248*t186; t2684 = t2678 + t2679 + t2298 + t2299 + t2300 + t2680 + t2681 + t2682 + t2683; t2685 = t177*t2684; t2686 = t2669 + t2675 + t2676 + t2677 + t2685 + t1043; t2687 = -0.0734502*t2686; t2688 = -0.1182826*t39*t2136; t2689 = -0.646*t156*t2261; t2690 = -0.1182826*t42*t2147; t2691 = t2263*t202; t2692 = -1.*t2253*t177; t2693 = -2.*t612*t615; t2694 = -2.*t624*t618; t2695 = -1.*t159*t2256; t2696 = t2692 + t2693 + t2694 + t2695 + t2288 + t2289 + t203 + t1069 + t1071; t2697 = t69*t2696; t2698 = 2.*t659*t995; t2699 = 2.*t624*t1003; t2700 = 2.*t162*t612; t2701 = 2.*t659*t618; t2702 = t2263*t183; t2703 = t2246*t186; t2704 = t2253*t69; t2705 = t2256*t81; t2706 = t2700 + t2701 + t2291 + t2292 + t2293 + t2702 + t2703 + t2704 + t2705; t2707 = t177*t2706; t2708 = t2691 + t2697 + t2698 + t2699 + t2707 + t1076; t2709 = 0.0009044*t2708; t2710 = 0.1182826*t42*t2168; t2711 = -0.646*t1022*t2286; t2712 = 0.0005*t2046; t2713 = t2712 + t2667; t2714 = 0.0179*t659; t2715 = t2714 + t2667; t2716 = -1.*t17*t18*t7*t42; t2717 = t42*t20*t8; t2718 = t2716 + t2717; t2719 = 0.0001*t2718; t2720 = 0.0179*t621; t2721 = t2719 + t2720; t2722 = 0.0001*t592; t2723 = 0.0005*t621; t2724 = t2722 + t2723; t2725 = -0.646*t306*t2119; t2726 = -0.646*t2187*t219; t2727 = -0.646*t312*t2136; t2728 = -0.646*t2196*t231; t2729 = -0.646*t333*t2261; t2730 = -0.646*t2325*t1712; t2731 = -0.646*t343*t2147; t2732 = -0.646*t2217*t238; t2733 = -0.646*t316*t2168; t2734 = -0.646*t2201*t253; t2735 = -0.646*t1090*t2286; t2736 = -0.646*t2305*t277; t2737 = -0.646*t387*t2119; t2738 = -0.646*t2026*t219; t2739 = -0.646*t393*t2136; t2740 = -0.646*t2033*t231; t2741 = -0.646*t363*t2261; t2742 = -0.646*t2008*t1712; t2743 = -0.646*t379*t2147; t2744 = -0.646*t2018*t238; t2745 = -0.646*t373*t2168; t2746 = -0.646*t2013*t253; t2747 = -0.646*t1168*t2286; t2748 = -0.646*t2081*t277; t2749 = var[36]; t2750 = t17*t9*t18; t2751 = t20*t1982; t2752 = t2750 + t2751; t2753 = -1.*t16*t1177; t2754 = t12*t2752; t2755 = t2753 + t2754; t2756 = -1.*t12*t1177; t2757 = -1.*t16*t2752; t2758 = t2756 + t2757; t2759 = t17*t63*t8; t2760 = t7*t63*t20; t2761 = -1.*t36*t10; t2762 = t2760 + t2761; t2763 = t18*t2762; t2764 = t2759 + t2763; t2765 = t7*t36; t2766 = t63*t20*t10; t2767 = t2765 + t2766; t2768 = t9*t2767; t2769 = t17*t18*t63; t2770 = -1.*t8*t2762; t2771 = t2769 + t2770; t2772 = -1.*t5*t2771; t2773 = t2768 + t2772; t2774 = t5*t2767; t2775 = t9*t2771; t2776 = t2774 + t2775; t2777 = -1.*t12*t105; t2778 = t93*t16; t2779 = t2777 + t2778; t2780 = t7*t552*t20; t2781 = -1.*t2779*t10; t2782 = t2780 + t2781; t2783 = t7*t2779; t2784 = t552*t20*t10; t2785 = t2783 + t2784; t2786 = t17*t552*t8; t2787 = t18*t2782; t2788 = t2786 + t2787; t2789 = t17*t18*t552; t2790 = -1.*t8*t2782; t2791 = t2789 + t2790; t2792 = -1.*t96*t16; t2793 = t2777 + t2792; t2794 = t7*t133*t20; t2795 = -1.*t2793*t10; t2796 = t2794 + t2795; t2797 = t2764*t206; t2798 = t7*t2793; t2799 = t133*t20*t10; t2800 = t2798 + t2799; t2801 = -1.*t2767*t180; t2802 = t17*t133*t8; t2803 = t18*t2796; t2804 = t2802 + t2803; t2805 = t17*t18*t133; t2806 = -1.*t8*t2796; t2807 = t2805 + t2806; t2808 = -1.*t2764*t183; t2809 = -1.*t2771*t186; t2810 = t72*t202; t2811 = -1.*t17*t10*t2800; t2812 = t78*t2800; t2813 = t578*t45; t2814 = -1.*t17*t10*t2785; t2815 = t84*t286; t2816 = t78*t2785; t2817 = 2.*t578*t45; t2818 = t17*t10*t2800; t2819 = -1.*t84*t192; t2820 = -1.*t84*t578; t2821 = -1.*t2800*t45; t2822 = t17*t10*t2785; t2823 = t2767*t280; t2824 = -1.*t17*t63*t171; t2825 = -1.*t2762*t174; t2826 = -2.*t84*t578; t2827 = -1.*t2785*t45; t2828 = t281*t36*t133; t2829 = t281*t127*t39; t2830 = t17*t42*t350; t2831 = t281*t36*t552; t2832 = 2.*t281*t127*t39; t2833 = -1.*t281*t42*t135; t2834 = -1.*t281*t42*t127; t2835 = -1.*t281*t133*t39; t2836 = t17*t63*t348; t2837 = -2.*t281*t42*t127; t2838 = -1.*t36*t127; t2839 = -1.*t281*t552*t39; t2840 = -1.*t63*t20*t168; t2841 = t42*t552; t2842 = t63*t140; t2843 = -1.*t552*t39; t2844 = t137 + t2838 + t2843 + t139; t2845 = t63*t2844; t2846 = t63*t144; t2847 = t36*t148; t2848 = t42*t2793; t2849 = t42*t135; t2850 = t36*t127; t2851 = t133*t63; t2852 = t552*t63; t2853 = t130*t63; t2854 = t2848 + t2849 + t142 + t2850 + t375 + t2851 + t2852 + t2853; t2855 = t39*t2854; t2856 = -1.*t36*t133; t2857 = -1.*t42*t130; t2858 = -1.*t2793*t39; t2859 = -1.*t135*t39; t2860 = t381 + t2856 + t2223 + t2857 + t2858 + t2859 + t147 + t382; t2861 = t42*t2860; t2862 = t42*t154; t2863 = t2841 + t151 + t389 + t153; t2864 = t42*t2863; t2865 = t2842 + t2845 + t2846 + t2847 + t2855 + t2861 + t2862 + t2864; t2866 = -0.1182826*t110*t42; t2867 = 0.01344873162*t36; t2868 = 0.1182826*t113*t36; t2869 = 0.00016559564*t63; t2870 = -0.1182826*t123*t63; t2871 = 0.1182826*t115*t63; t2872 = t2866 + t2867 + t2868 + t2869 + t2870 + t2871; t2873 = 0.0005*t36; t2874 = t2873 + t1191; t2875 = 0.0001*t42; t2876 = 0.0179*t63; t2877 = t2875 + t2876; t2878 = t69*t881; t2879 = t177*t898; t2880 = t2878 + t225 + t2879; t2881 = t72*t242; t2882 = t72*t907; t2883 = t177*t2804; t2884 = t159*t2807; t2885 = t2818 + t2883 + t2884; t2886 = t60*t2885; t2887 = -1.*t60*t2804; t2888 = -1.*t52*t2807; t2889 = -1.*t195*t72; t2890 = -1.*t558*t72; t2891 = -1.*t198*t87; t2892 = -1.*t561*t87; t2893 = t2819 + t2820 + t2821 + t2801 + t2887 + t2888 + t2808 + t2809 + t2889 + t2890 + t2891 + t2892; t2894 = t177*t2893; t2895 = t2881 + t2882 + t2886 + t2797 + t2894; t2896 = t60*t907; t2897 = t177*t924; t2898 = t2896 + t244 + t2897; t2899 = t42*t2844; t2900 = t39*t2863; t2901 = t2899 + t145 + t149 + t2900; t2902 = t60*t558; t2903 = t52*t561; t2904 = -1.*t78*t578; t2905 = -1.*t558*t69; t2906 = -1.*t561*t81; t2907 = t2904 + t213 + t214 + t215 + t2905 + t2906; t2908 = t2813 + t270 + t2902 + t2903 + t273 + t274; t2909 = t60*t223; t2910 = t60*t881; t2911 = -1.*t177*t2804; t2912 = -1.*t159*t2807; t2913 = t2811 + t2911 + t2912; t2914 = t69*t2913; t2915 = t2804*t69; t2916 = t2807*t81; t2917 = t2812 + t269 + t2813 + t270 + t271 + t272 + t2902 + t2903 + t2915 + t2916 + t273 + t274; t2918 = t177*t2917; t2919 = t2909 + t2910 + t2914 + t2810 + t2918; t2920 = t45*t1596; t2921 = t17*t10*t1604; t2922 = t2920 + t299 + t2921; t2923 = t17*t133*t20; t2924 = -1.*t17*t7*t2796; t2925 = t2923 + t2924 + t2811; t2926 = t78*t2925; t2927 = t45*t336; t2928 = t45*t1616; t2929 = t50*t555; t2930 = t2796*t57; t2931 = t2828 + t317 + t2829 + t318 + t319 + t2929 + t2930 + t320 + t2812 + t269 + t2813 + t270; t2932 = t17*t10*t2931; t2933 = t2926 + t2927 + t2928 + t2815 + t2932; t2934 = t78*t1616; t2935 = t17*t10*t1624; t2936 = t2934 + t338 + t2935; t2937 = -1.*t17*t133*t20; t2938 = t17*t7*t2796; t2939 = t2937 + t2938 + t2818; t2940 = t45*t2939; t2941 = t84*t297; t2942 = t84*t1596; t2943 = -1.*t50*t2796; t2944 = -1.*t189*t66; t2945 = -1.*t555*t66; t2946 = t2833 + t2834 + t2835 + t2824 + t2943 + t2825 + t2944 + t2945 + t2819 + t2820 + t2821 + t2801; t2947 = t17*t10*t2946; t2948 = t2940 + t2941 + t2942 + t2823 + t2947; t2949 = -1.*t78*t2800; t2950 = t2829 + t318 + t2929 + t320 + t2813 + t270; t2951 = -1.*t281*t36*t127; t2952 = -1.*t555*t57; t2953 = t2951 + t282 + t283 + t2952 + t2904 + t213; t2954 = t84*t192; t2955 = t84*t578; t2956 = t2800*t45; t2957 = t2767*t180; t2958 = -1.*t20*t2225; t2959 = t380 + t2958; t2960 = t2793*t39; t2961 = t36*t133*t344; t2962 = t127*t39*t344; t2963 = t150 + t2828 + t2841 + t2960 + t317 + t2829 + t153 + t318 + t2961 + t351 + t2962 + t352; t2964 = -1.*t20*t2963; t2965 = t2830 + t2964; t2966 = -1.*t20*t2234; t2967 = t374 + t2966; t2968 = -1.*t42*t2793; t2969 = -1.*t133*t63; t2970 = -1.*t552*t63; t2971 = -1.*t42*t135*t344; t2972 = -1.*t42*t127*t344; t2973 = -1.*t133*t39*t344; t2974 = t2968 + t2833 + t2834 + t2838 + t2835 + t2969 + t2970 + t2824 + t2971 + t2972 + t2973 + t2840; t2975 = -1.*t20*t2974; t2976 = t2836 + t2975; t2977 = -1.*t281*t36*t133; t2978 = t2841 + t2829 + t153 + t318 + t2962 + t352; t2979 = -1.*t36*t127*t344; t2980 = t137 + t2951 + t2843 + t282 + t2979 + t345; t2981 = t281*t42*t135; t2982 = t281*t42*t127; t2983 = t281*t133*t39; t2984 = t17*t63*t171; t2985 = -1.*t36*t133*t344; t2986 = t381 + t2977 + t2223 + t2858 + t300 + t1602 + t382 + t301 + t2985 + t383 + t2224 + t384; t2987 = t17*t39*t2986; t2988 = t17*t39*t353; t2989 = t17*t39*t2978; t2990 = t17*t63*t356; t2991 = t17*t42*t359; t2992 = t17*t42*t2980; t2993 = t17*t42*t361; t2994 = t42*t135*t344; t2995 = t42*t127*t344; t2996 = t133*t39*t344; t2997 = t63*t20*t168; t2998 = t2848 + t2981 + t2982 + t2850 + t2983 + t2851 + t2852 + t2984 + t2994 + t2995 + t2996 + t2997; t2999 = t17*t36*t2998; t3000 = t2987 + t2988 + t2989 + t2990 + t2991 + t2992 + t2993 + t2999; t3001 = -0.646*t115*t2959; t3002 = -0.646*t123*t2965; t3003 = 2.*t42*t552; t3004 = t2779*t39; t3005 = t36*t552*t344; t3006 = 2.*t127*t39*t344; t3007 = t3003 + t2831 + t2832 + t3004 + t153 + t318 + t3005 + t3006 + t352; t3008 = -1.*t20*t3007; t3009 = t2830 + t3008; t3010 = 0.0009044*t3009; t3011 = -0.646*t110*t2967; t3012 = -0.646*t113*t2976; t3013 = -1.*t42*t2779; t3014 = -2.*t552*t63; t3015 = -2.*t42*t127*t344; t3016 = -1.*t552*t39*t344; t3017 = t2837 + t2838 + t3013 + t2839 + t3014 + t2824 + t3015 + t3016 + t2840; t3018 = -1.*t20*t3017; t3019 = t2836 + t3018; t3020 = -0.0734502*t3019; t3021 = t3001 + t3002 + t3010 + t3011 + t3012 + t3020; t3022 = 0.1182826*t63*t387; t3023 = 0.1182826*t63*t2959; t3024 = -0.1182826*t39*t2965; t3025 = -0.1182826*t63*t393; t3026 = 0.1182826*t36*t373; t3027 = -0.646*t2865*t1168; t3028 = -0.646*t2901*t363; t3029 = t17*t36*t2978; t3030 = t17*t39*t2980; t3031 = t3029 + t357 + t3030 + t362; t3032 = -0.646*t156*t3031; t3033 = -0.1182826*t42*t379; t3034 = -0.1182826*t42*t2967; t3035 = 0.1182826*t42*t2976; t3036 = -0.646*t1022*t3000; t3037 = 0.0005*t17*t63; t3038 = t1373 + t3037; t3039 = 0.0179*t17*t42; t3040 = -0.0001*t17*t63; t3041 = t3039 + t3040; t3042 = t72*t257; t3043 = t72*t262; t3044 = t72*t2907; t3045 = t2764*t267; t3046 = t60*t2804; t3047 = t52*t2807; t3048 = t2764*t183; t3049 = t2771*t186; t3050 = t195*t72; t3051 = t558*t72; t3052 = t198*t87; t3053 = t561*t87; t3054 = t2954 + t2955 + t2956 + t2957 + t3046 + t3047 + t3048 + t3049 + t3050 + t3051 + t3052 + t3053; t3055 = t69*t3054; t3056 = -1.*t2804*t69; t3057 = -1.*t2807*t81; t3058 = t2949 + t245 + t921 + t246 + t247 + t248 + t922 + t923 + t3056 + t3057 + t249 + t250; t3059 = t60*t3058; t3060 = t60*t275; t3061 = t60*t2908; t3062 = t3042 + t3043 + t3044 + t3045 + t3055 + t3059 + t3060 + t3061; t3063 = t60*t2907; t3064 = t69*t2908; t3065 = t258 + t3063 + t268 + t3064; t3066 = t78*t2950; t3067 = t45*t2953; t3068 = t3066 + t326 + t3067 + t332; t3069 = -1.*t2796*t57; t3070 = t2977 + t300 + t1602 + t301 + t302 + t1603 + t3069 + t303 + t2949 + t245 + t921 + t246; t3071 = t45*t3070; t3072 = t45*t321; t3073 = t45*t2950; t3074 = t2767*t325; t3075 = t84*t329; t3076 = t84*t2953; t3077 = t84*t331; t3078 = t50*t2796; t3079 = t2762*t174; t3080 = t189*t66; t3081 = t555*t66; t3082 = t2981 + t2982 + t2983 + t2984 + t3078 + t3079 + t3080 + t3081 + t2954 + t2955 + t2956 + t2957; t3083 = t78*t3082; t3084 = t3071 + t3072 + t3073 + t3074 + t3075 + t3076 + t3077 + t3083; t3085 = -0.646*t115*t60; t3086 = 0.0009044*t2764; t3087 = -0.646*t123*t2764; t3088 = -0.0734502*t72; t3089 = -0.646*t110*t72; t3090 = -0.646*t113*t72; t3091 = t3085 + t3086 + t3087 + t3088 + t3089 + t3090; t3092 = -0.646*t2865*t177; t3093 = 0.1182826*t63*t60; t3094 = -0.1182826*t39*t2764; t3095 = 0.1182826*t36*t69; t3096 = -0.1182826*t42*t72; t3097 = t3092 + t2357 + t2360 + t3093 + t3094 + t3095 + t3096; t3098 = -0.646*t3000*t177; t3099 = -0.646*t387*t60; t3100 = -0.646*t2959*t60; t3101 = -0.646*t2965*t60; t3102 = -0.646*t393*t2764; t3103 = -0.646*t2976*t69; t3104 = -0.646*t373*t72; t3105 = -0.646*t379*t72; t3106 = -0.646*t2967*t72; t3107 = t3098 + t1443 + t1446 + t3099 + t3100 + t3101 + t3102 + t3103 + t3104 + t3105 + t3106; t3108 = -1.292*t60*t402; t3109 = -0.646*t2764*t402; t3110 = -0.646*t60*t2776; t3111 = -0.646*t72*t471; t3112 = -0.646*t69*t477; t3113 = -1.292*t72*t477; t3114 = t3108 + t3109 + t3110 + t3111 + t3112 + t3113; t3115 = -0.646*t115*t402; t3116 = 0.0009044*t2776; t3117 = -0.646*t123*t2776; t3118 = -0.0734502*t477; t3119 = -0.646*t110*t477; t3120 = -0.646*t113*t477; t3121 = t3115 + t3116 + t3117 + t3118 + t3119 + t3120; t3122 = -0.646*t2865*t873; t3123 = 0.1182826*t63*t402; t3124 = -0.1182826*t39*t2776; t3125 = 0.1182826*t36*t471; t3126 = -0.1182826*t42*t477; t3127 = t3122 + t2390 + t2393 + t3123 + t3124 + t3125 + t3126; t3128 = -0.646*t3000*t873; t3129 = -0.646*t387*t402; t3130 = -0.646*t2959*t402; t3131 = -0.646*t2965*t402; t3132 = -0.646*t393*t2776; t3133 = -0.646*t2976*t471; t3134 = -0.646*t373*t477; t3135 = -0.646*t379*t477; t3136 = -0.646*t2967*t477; t3137 = t3128 + t1473 + t1476 + t3129 + t3130 + t3131 + t3132 + t3133 + t3134 + t3135 + t3136; t3138 = -1.292*t60*t75; t3139 = -0.646*t2764*t75; t3140 = -0.646*t60*t2773; t3141 = -0.646*t72*t118; t3142 = -0.646*t69*t121; t3143 = -1.292*t72*t121; t3144 = t3138 + t3139 + t3140 + t3141 + t3142 + t3143; t3145 = -1.292*t402*t75; t3146 = -0.646*t75*t2776; t3147 = -0.646*t402*t2773; t3148 = -0.646*t118*t477; t3149 = -0.646*t471*t121; t3150 = -1.292*t477*t121; t3151 = t3145 + t3146 + t3147 + t3148 + t3149 + t3150; t3152 = -0.646*t115*t75; t3153 = 0.0009044*t2773; t3154 = -0.646*t123*t2773; t3155 = -0.0734502*t121; t3156 = -0.646*t110*t121; t3157 = -0.646*t113*t121; t3158 = t3152 + t3153 + t3154 + t3155 + t3156 + t3157; t3159 = -0.646*t2865*t256; t3160 = 0.1182826*t63*t75; t3161 = -0.1182826*t39*t2773; t3162 = 0.1182826*t36*t118; t3163 = -0.1182826*t42*t121; t3164 = t3159 + t2438 + t2441 + t3160 + t3161 + t3162 + t3163; t3165 = -0.646*t3000*t256; t3166 = -0.646*t387*t75; t3167 = -0.646*t2959*t75; t3168 = -0.646*t2965*t75; t3169 = -0.646*t393*t2773; t3170 = -0.646*t2976*t118; t3171 = -0.646*t373*t121; t3172 = -0.646*t379*t121; t3173 = -0.646*t2967*t121; t3174 = t3165 + t1524 + t1527 + t3166 + t3167 + t3168 + t3169 + t3170 + t3171 + t3172 + t3173; t3175 = -0.646*t60*t306; t3176 = -0.646*t60*t2922; t3177 = -0.646*t60*t2933; t3178 = -0.646*t2764*t312; t3179 = -0.646*t72*t316; t3180 = -0.646*t72*t343; t3181 = -0.646*t72*t2936; t3182 = -0.646*t69*t2948; t3183 = -0.646*t177*t3084; t3184 = t811 + t815 + t3175 + t3176 + t3177 + t3178 + t3179 + t3180 + t3181 + t3182 + t3183; t3185 = -0.646*t75*t306; t3186 = -0.646*t75*t2922; t3187 = -0.646*t75*t2933; t3188 = -0.646*t2773*t312; t3189 = -0.646*t121*t316; t3190 = -0.646*t121*t343; t3191 = -0.646*t121*t2936; t3192 = -0.646*t118*t2948; t3193 = -0.646*t256*t3084; t3194 = t764 + t768 + t3185 + t3186 + t3187 + t3188 + t3189 + t3190 + t3191 + t3192 + t3193; t3195 = -0.646*t402*t306; t3196 = -0.646*t402*t2922; t3197 = -0.646*t402*t2933; t3198 = -0.646*t2776*t312; t3199 = -0.646*t477*t316; t3200 = -0.646*t477*t343; t3201 = -0.646*t477*t2936; t3202 = -0.646*t471*t2948; t3203 = -0.646*t873*t3084; t3204 = t726 + t730 + t3195 + t3196 + t3197 + t3198 + t3199 + t3200 + t3201 + t3202 + t3203; t3205 = -0.646*t115*t2922; t3206 = -0.646*t123*t2933; t3207 = t17*t552*t20; t3208 = -1.*t17*t7*t2782; t3209 = t3207 + t3208 + t2814; t3210 = t78*t3209; t3211 = 2.*t45*t1616; t3212 = 2.*t50*t555; t3213 = t2782*t57; t3214 = t2831 + t2832 + t318 + t3212 + t3213 + t320 + t2816 + t2817 + t270; t3215 = t17*t10*t3214; t3216 = t3210 + t3211 + t2815 + t3215; t3217 = 0.0009044*t3216; t3218 = -0.646*t110*t2936; t3219 = -0.646*t113*t2948; t3220 = -1.*t17*t552*t20; t3221 = t17*t7*t2782; t3222 = t3220 + t3221 + t2822; t3223 = t45*t3222; t3224 = 2.*t84*t1596; t3225 = -1.*t50*t2782; t3226 = -2.*t555*t66; t3227 = t2837 + t2839 + t2824 + t2825 + t3225 + t3226 + t2826 + t2827 + t2801; t3228 = t17*t10*t3227; t3229 = t3223 + t3224 + t2823 + t3228; t3230 = -0.0734502*t3229; t3231 = t3205 + t3206 + t3217 + t3218 + t3219 + t3230; t3232 = 0.1182826*t63*t306; t3233 = 0.1182826*t63*t2922; t3234 = -0.1182826*t39*t2933; t3235 = -0.1182826*t63*t312; t3236 = 0.1182826*t36*t316; t3237 = -0.646*t2865*t1090; t3238 = -0.646*t2901*t333; t3239 = -0.646*t156*t3068; t3240 = -0.1182826*t42*t343; t3241 = -0.1182826*t42*t2936; t3242 = 0.1182826*t42*t2948; t3243 = -0.646*t1022*t3084; t3244 = 0.0179*t84; t3245 = -1.*t7*t36; t3246 = -1.*t63*t20*t10; t3247 = t3245 + t3246; t3248 = 0.0001*t3247; t3249 = t3244 + t3248; t3250 = 0.0005*t2767; t3251 = t1707 + t3250; t3252 = -0.646*t2959*t306; t3253 = -0.646*t387*t2922; t3254 = -0.646*t393*t2933; t3255 = -0.646*t2965*t312; t3256 = -0.646*t2976*t316; t3257 = -0.646*t3000*t1090; t3258 = -0.646*t3031*t333; t3259 = -0.646*t363*t3068; t3260 = -0.646*t2967*t343; t3261 = -0.646*t379*t2936; t3262 = -0.646*t373*t2948; t3263 = -0.646*t1168*t3084; t3264 = -0.646*t72*t219; t3265 = -0.646*t72*t231; t3266 = -0.646*t72*t2880; t3267 = -0.646*t2764*t238; t3268 = -0.646*t69*t2895; t3269 = -0.646*t60*t253; t3270 = -0.646*t60*t2898; t3271 = -0.646*t177*t3062; t3272 = -0.646*t60*t2919; t3273 = t3264 + t3265 + t3266 + t3267 + t3268 + t3269 + t3270 + t3271 + t3272; t3274 = -0.646*t121*t219; t3275 = -0.646*t121*t231; t3276 = -0.646*t121*t2880; t3277 = -0.646*t2773*t238; t3278 = -0.646*t118*t2895; t3279 = -0.646*t75*t253; t3280 = -0.646*t75*t2898; t3281 = -0.646*t256*t3062; t3282 = -0.646*t75*t2919; t3283 = t403 + t407 + t3274 + t3275 + t3276 + t3277 + t3278 + t3279 + t3280 + t3281 + t3282; t3284 = -0.646*t477*t219; t3285 = -0.646*t477*t231; t3286 = -0.646*t477*t2880; t3287 = -0.646*t2776*t238; t3288 = -0.646*t471*t2895; t3289 = -0.646*t402*t253; t3290 = -0.646*t402*t2898; t3291 = -0.646*t873*t3062; t3292 = -0.646*t402*t2919; t3293 = t481 + t485 + t3284 + t3285 + t3286 + t3287 + t3288 + t3289 + t3290 + t3291 + t3292; t3294 = -0.646*t110*t2880; t3295 = 2.*t72*t907; t3296 = t177*t2788; t3297 = t159*t2791; t3298 = t2822 + t3296 + t3297; t3299 = t60*t3298; t3300 = -1.*t60*t2788; t3301 = -1.*t52*t2791; t3302 = -2.*t558*t72; t3303 = -2.*t561*t87; t3304 = t2826 + t2827 + t2801 + t2808 + t2809 + t3300 + t3301 + t3302 + t3303; t3305 = t177*t3304; t3306 = t3295 + t2797 + t3299 + t3305; t3307 = -0.0734502*t3306; t3308 = -0.646*t113*t2895; t3309 = -0.646*t115*t2898; t3310 = -0.646*t123*t2919; t3311 = 2.*t60*t881; t3312 = -1.*t177*t2788; t3313 = -1.*t159*t2791; t3314 = t2814 + t3312 + t3313; t3315 = t69*t3314; t3316 = 2.*t60*t558; t3317 = 2.*t52*t561; t3318 = t2788*t69; t3319 = t2791*t81; t3320 = t2816 + t2817 + t270 + t3316 + t3317 + t3318 + t3319 + t273 + t274; t3321 = t177*t3320; t3322 = t3311 + t2810 + t3315 + t3321; t3323 = 0.0009044*t3322; t3324 = t3294 + t3307 + t3308 + t3309 + t3310 + t3323; t3325 = 0.1182826*t36*t219; t3326 = -0.1182826*t42*t231; t3327 = -0.1182826*t42*t2880; t3328 = -0.646*t2865*t1712; t3329 = -0.1182826*t63*t238; t3330 = 0.1182826*t42*t2895; t3331 = 0.1182826*t63*t253; t3332 = 0.1182826*t63*t2898; t3333 = -0.646*t2901*t277; t3334 = -0.646*t1022*t3062; t3335 = -0.646*t156*t3065; t3336 = -0.1182826*t39*t2919; t3337 = 0.0005*t2764; t3338 = t3337 + t1908; t3339 = -1.*t17*t63*t8; t3340 = -1.*t18*t2762; t3341 = t3339 + t3340; t3342 = 0.0001*t3341; t3343 = 0.0179*t72; t3344 = t3342 + t3343; t3345 = -0.646*t2948*t219; t3346 = -0.646*t2936*t231; t3347 = -0.646*t343*t2880; t3348 = -0.646*t3084*t1712; t3349 = -0.646*t2933*t238; t3350 = -0.646*t316*t2895; t3351 = -0.646*t2922*t253; t3352 = -0.646*t306*t2898; t3353 = -0.646*t3068*t277; t3354 = -0.646*t1090*t3062; t3355 = -0.646*t333*t3065; t3356 = -0.646*t312*t2919; t3357 = -0.646*t2976*t219; t3358 = -0.646*t2967*t231; t3359 = -0.646*t379*t2880; t3360 = -0.646*t3000*t1712; t3361 = -0.646*t2965*t238; t3362 = -0.646*t373*t2895; t3363 = -0.646*t2959*t253; t3364 = -0.646*t387*t2898; t3365 = -0.646*t3031*t277; t3366 = -0.646*t1168*t3062; t3367 = -0.646*t363*t3065; t3368 = -0.646*t393*t2919; t3369 = var[37]; t3370 = 0.4*t30*t2755; t3371 = -1.*t26*t2755; t3372 = t12*t1177; t3373 = t16*t2752; t3374 = t3372 + t3373; t3375 = -1.*t30*t2755; t3376 = -0.0014*t30; t3377 = 0.1137*t26; t3378 = t3376 + t3377; t3379 = t30*t3378; t3380 = -1.*t96*t26; t3381 = -1.*t93*t26; t3382 = t122 + t3379 + t3380 + t3381; t3383 = t3378*t26; t3384 = t108 + t109 + t112 + t3383; t3385 = t3378*t16; t3386 = t131 + t3385; t3387 = t12*t3378; t3388 = t3387 + t2792; t3389 = t7*t3386*t20; t3390 = -1.*t3388*t10; t3391 = t3389 + t3390; t3392 = t7*t3388; t3393 = t3386*t20*t10; t3394 = t3392 + t3393; t3395 = t17*t3386*t8; t3396 = t18*t3391; t3397 = t3395 + t3396; t3398 = t17*t18*t3386; t3399 = -1.*t8*t3391; t3400 = t3398 + t3399; t3401 = -1.*t17*t10*t3394; t3402 = t78*t3394; t3403 = 2.*t192*t45; t3404 = t17*t10*t3394; t3405 = -2.*t84*t192; t3406 = -1.*t3394*t45; t3407 = t281*t36*t3386; t3408 = 2.*t281*t135*t39; t3409 = -2.*t281*t42*t135; t3410 = -1.*t281*t3386*t39; t3411 = 2.*t63*t140; t3412 = t42*t3388; t3413 = 2.*t42*t135; t3414 = t3386*t39; t3415 = 2.*t133*t63; t3416 = t3412 + t3413 + t2850 + t3414 + t3415 + t2853; t3417 = t39*t3416; t3418 = -2.*t42*t133; t3419 = -1.*t36*t3386; t3420 = -1.*t3388*t39; t3421 = -2.*t135*t39; t3422 = t3418 + t2857 + t3419 + t3420 + t3421 + t382; t3423 = t42*t3422; t3424 = 2.*t42*t154; t3425 = t3411 + t2846 + t2847 + t3417 + t3423 + t3424; t3426 = -0.2365652*t110*t42; t3427 = 0.1182826*t3384*t42; t3428 = -0.1182826*t3382*t39; t3429 = 0.2365652*t115*t63; t3430 = t3426 + t3427 + t2867 + t2868 + t3428 + t2869 + t2870 + t3429; t3431 = Power(t42,2); t3432 = -0.04331508812*t3431; t3433 = -0.04331508812*t42*t36; t3434 = -0.04331508812*t39*t63; t3435 = Power(t63,2); t3436 = -0.04331508812*t3435; t3437 = -2.*t42*t1192; t3438 = -1.*t42*t2874; t3439 = -1.*t63*t1194; t3440 = -1.*t36*t1189; t3441 = -2.*t63*t1196; t3442 = -1.*t39*t2877; t3443 = -2.*t1192*t60; t3444 = -1.*t2874*t60; t3445 = -1.*t1189*t2764; t3446 = -1.*t2877*t69; t3447 = -1.*t1194*t72; t3448 = -2.*t1196*t72; t3449 = 2.*t72*t242; t3450 = t177*t3397; t3451 = t159*t3400; t3452 = t3404 + t3450 + t3451; t3453 = t60*t3452; t3454 = -1.*t60*t3397; t3455 = -1.*t52*t3400; t3456 = -2.*t195*t72; t3457 = -2.*t198*t87; t3458 = t3405 + t3406 + t2801 + t3454 + t3455 + t2808 + t2809 + t3456 + t3457; t3459 = t177*t3458; t3460 = t3449 + t3453 + t2797 + t3459; t3461 = 2.*t60*t223; t3462 = -1.*t177*t3397; t3463 = -1.*t159*t3400; t3464 = t3401 + t3462 + t3463; t3465 = t69*t3464; t3466 = 2.*t60*t195; t3467 = 2.*t52*t198; t3468 = t3397*t69; t3469 = t3400*t81; t3470 = t3402 + t3403 + t270 + t3466 + t3467 + t3468 + t3469 + t273 + t274; t3471 = t177*t3470; t3472 = t3461 + t3465 + t2810 + t3471; t3473 = -1.*t1194*t84; t3474 = -2.*t1196*t84; t3475 = -1.*t2877*t78; t3476 = -2.*t1192*t45; t3477 = -1.*t2874*t45; t3478 = -1.*t1189*t2767; t3479 = 2.*t45*t336; t3480 = t17*t3386*t20; t3481 = -1.*t17*t7*t3391; t3482 = t3480 + t3481 + t3401; t3483 = t78*t3482; t3484 = 2.*t50*t189; t3485 = t3391*t57; t3486 = t3407 + t3408 + t318 + t3484 + t3485 + t320 + t3402 + t3403 + t270; t3487 = t17*t10*t3486; t3488 = t3479 + t3483 + t2815 + t3487; t3489 = 2.*t84*t297; t3490 = -1.*t17*t3386*t20; t3491 = t17*t7*t3391; t3492 = t3490 + t3491 + t3404; t3493 = t45*t3492; t3494 = -1.*t50*t3391; t3495 = -2.*t189*t66; t3496 = t3409 + t3410 + t2824 + t3494 + t2825 + t3495 + t3405 + t3406 + t2801; t3497 = t17*t10*t3496; t3498 = t3489 + t3493 + t2823 + t3497; t3499 = -1.*t78*t3394; t3500 = -2.*t192*t45; t3501 = 2.*t84*t192; t3502 = t3394*t45; t3503 = -2.*t17*t39*t1192; t3504 = -1.*t17*t39*t2874; t3505 = -1.*t17*t42*t1194; t3506 = -1.*t17*t63*t1189; t3507 = -2.*t17*t42*t1196; t3508 = -1.*t17*t36*t2877; t3509 = 2.*t42*t133; t3510 = t3388*t39; t3511 = t36*t3386*t344; t3512 = 2.*t135*t39*t344; t3513 = t3509 + t3407 + t3510 + t3408 + t153 + t318 + t3511 + t3512 + t352; t3514 = -1.*t20*t3513; t3515 = t2830 + t3514; t3516 = -1.*t42*t3388; t3517 = -2.*t133*t63; t3518 = -2.*t42*t135*t344; t3519 = -1.*t3386*t39*t344; t3520 = t3516 + t3409 + t2838 + t3410 + t3517 + t2824 + t3518 + t3519 + t2840; t3521 = -1.*t20*t3520; t3522 = t2836 + t3521; t3523 = -1.*t281*t36*t3386; t3524 = -2.*t281*t135*t39; t3525 = 2.*t281*t42*t135; t3526 = t281*t3386*t39; t3527 = -1.*t36*t3386*t344; t3528 = -2.*t135*t39*t344; t3529 = t3418 + t3523 + t3420 + t3524 + t382 + t301 + t3527 + t3528 + t384; t3530 = t17*t39*t3529; t3531 = 2.*t17*t39*t353; t3532 = 2.*t17*t42*t359; t3533 = 2.*t42*t135*t344; t3534 = t3386*t39*t344; t3535 = t3412 + t3525 + t2850 + t3526 + t3415 + t2984 + t3533 + t3534 + t2997; t3536 = t17*t36*t3535; t3537 = t3530 + t3531 + t2990 + t3532 + t2993 + t3536; t3538 = -1.292*t115*t387; t3539 = -0.646*t123*t3515; t3540 = 0.0009044*t2965; t3541 = -0.646*t3382*t393; t3542 = -0.646*t3384*t373; t3543 = -1.292*t110*t379; t3544 = -0.0734502*t2976; t3545 = -0.646*t113*t3522; t3546 = t3538 + t3539 + t3540 + t3541 + t3542 + t3543 + t3544 + t3545; t3547 = -2.*t63*t1377; t3548 = -1.*t63*t1379; t3549 = -1.*t36*t1372; t3550 = -2.*t42*t1375; t3551 = -1.*t39*t3041; t3552 = -1.*t42*t3038; t3553 = -0.0734502*t2026; t3554 = 0.2365652*t63*t387; t3555 = -0.1182826*t39*t3515; t3556 = -0.646*t3425*t1168; t3557 = -1.292*t156*t363; t3558 = 0.0009044*t2018; t3559 = -0.2365652*t42*t379; t3560 = 0.1182826*t42*t3522; t3561 = -0.646*t1022*t3537; t3562 = -2.*t1375*t60; t3563 = -1.*t3038*t60; t3564 = -1.*t1372*t2764; t3565 = -1.*t3041*t69; t3566 = -2.*t1377*t72; t3567 = -1.*t1379*t72; t3568 = 2.*t72*t262; t3569 = t60*t3397; t3570 = t52*t3400; t3571 = 2.*t195*t72; t3572 = 2.*t198*t87; t3573 = t3501 + t3502 + t2957 + t3569 + t3570 + t3048 + t3049 + t3571 + t3572; t3574 = t69*t3573; t3575 = -2.*t60*t195; t3576 = -2.*t52*t198; t3577 = -1.*t3397*t69; t3578 = -1.*t3400*t81; t3579 = t3499 + t3500 + t246 + t3575 + t3576 + t3577 + t3578 + t249 + t250; t3580 = t60*t3579; t3581 = 2.*t60*t275; t3582 = t3042 + t3568 + t3045 + t3574 + t3580 + t3581; t3583 = -2.*t1377*t84; t3584 = -1.*t1379*t84; t3585 = -1.*t3041*t78; t3586 = -2.*t1375*t45; t3587 = -1.*t3038*t45; t3588 = -1.*t1372*t2767; t3589 = -2.*t50*t189; t3590 = -1.*t3391*t57; t3591 = t3523 + t3524 + t301 + t3589 + t3590 + t303 + t3499 + t3500 + t246; t3592 = t45*t3591; t3593 = 2.*t45*t321; t3594 = 2.*t84*t329; t3595 = t50*t3391; t3596 = 2.*t189*t66; t3597 = t3525 + t3526 + t2984 + t3595 + t3079 + t3596 + t3501 + t3502 + t2957; t3598 = t78*t3597; t3599 = t3592 + t3593 + t3074 + t3594 + t3077 + t3598; t3600 = -2.*t17*t42*t1377; t3601 = -1.*t17*t42*t1379; t3602 = -1.*t17*t63*t1372; t3603 = -2.*t17*t39*t1375; t3604 = -1.*t17*t36*t3041; t3605 = -1.*t17*t39*t3038; t3606 = Power(t60,2); t3607 = -1.292*t3606; t3608 = -1.292*t60*t2764; t3609 = -1.292*t69*t72; t3610 = Power(t72,2); t3611 = -1.292*t3610; t3612 = t3607 + t3608 + t3609 + t3611; t3613 = 0.5*t3612*t399; t3614 = 0.5*t3144*t107; t3615 = 0.5*t3114*t124; t3616 = -0.646*t3382*t60; t3617 = -1.292*t115*t60; t3618 = -0.646*t3384*t69; t3619 = -1.292*t110*t72; t3620 = t3616 + t3617 + t3086 + t3087 + t3618 + t3088 + t3619 + t3090; t3621 = -0.646*t3425*t177; t3622 = t3621 + t2357 + t2360 + t3093 + t3094 + t3095 + t3096; t3623 = -0.646*t3537*t177; t3624 = -1.292*t387*t60; t3625 = -0.646*t3515*t60; t3626 = -0.646*t3522*t69; t3627 = -1.292*t379*t72; t3628 = t3623 + t1443 + t1446 + t3624 + t3625 + t3102 + t3626 + t3104 + t3627; t3629 = 0.5*t3114*t399; t3630 = 0.5*t3151*t107; t3631 = Power(t402,2); t3632 = -1.292*t3631; t3633 = -1.292*t402*t2776; t3634 = -1.292*t471*t477; t3635 = Power(t477,2); t3636 = -1.292*t3635; t3637 = t3632 + t3633 + t3634 + t3636; t3638 = 0.5*t3637*t124; t3639 = -0.646*t3382*t402; t3640 = -1.292*t115*t402; t3641 = -0.646*t3384*t471; t3642 = -1.292*t110*t477; t3643 = t3639 + t3640 + t3116 + t3117 + t3641 + t3118 + t3642 + t3120; t3644 = -0.646*t3425*t873; t3645 = t3644 + t2390 + t2393 + t3123 + t3124 + t3125 + t3126; t3646 = -0.646*t3537*t873; t3647 = -1.292*t387*t402; t3648 = -0.646*t3515*t402; t3649 = -0.646*t3522*t471; t3650 = -1.292*t379*t477; t3651 = t3646 + t1473 + t1476 + t3647 + t3648 + t3132 + t3649 + t3134 + t3650; t3652 = 0.5*t3144*t399; t3653 = Power(t75,2); t3654 = -1.292*t3653; t3655 = -1.292*t75*t2773; t3656 = -1.292*t118*t121; t3657 = Power(t121,2); t3658 = -1.292*t3657; t3659 = t3654 + t3655 + t3656 + t3658; t3660 = 0.5*t3659*t107; t3661 = 0.5*t3151*t124; t3662 = -0.646*t3382*t75; t3663 = -1.292*t115*t75; t3664 = -0.646*t3384*t118; t3665 = -1.292*t110*t121; t3666 = t3662 + t3663 + t3153 + t3154 + t3664 + t3155 + t3665 + t3157; t3667 = -0.646*t3425*t256; t3668 = t3667 + t2438 + t2441 + t3160 + t3161 + t3162 + t3163; t3669 = -0.646*t3537*t256; t3670 = -1.292*t387*t75; t3671 = -0.646*t3515*t75; t3672 = -0.646*t3522*t118; t3673 = -1.292*t379*t121; t3674 = t3669 + t1524 + t1527 + t3670 + t3671 + t3169 + t3672 + t3171 + t3673; t3675 = -1.292*t60*t306; t3676 = -0.646*t60*t3488; t3677 = -1.292*t72*t343; t3678 = -0.646*t69*t3498; t3679 = -0.646*t177*t3599; t3680 = t811 + t815 + t3675 + t3676 + t3178 + t3179 + t3677 + t3678 + t3679; t3681 = -1.292*t75*t306; t3682 = -0.646*t75*t3488; t3683 = -1.292*t121*t343; t3684 = -0.646*t118*t3498; t3685 = -0.646*t256*t3599; t3686 = t764 + t768 + t3681 + t3682 + t3188 + t3189 + t3683 + t3684 + t3685; t3687 = -1.292*t402*t306; t3688 = -0.646*t402*t3488; t3689 = -1.292*t477*t343; t3690 = -0.646*t471*t3498; t3691 = -0.646*t873*t3599; t3692 = t726 + t730 + t3687 + t3688 + t3198 + t3199 + t3689 + t3690 + t3691; t3693 = -1.292*t115*t306; t3694 = -0.646*t123*t3488; t3695 = 0.0009044*t2933; t3696 = -0.646*t3382*t312; t3697 = -0.646*t3384*t316; t3698 = -1.292*t110*t343; t3699 = -0.0734502*t2948; t3700 = -0.646*t113*t3498; t3701 = t3693 + t3694 + t3695 + t3696 + t3697 + t3698 + t3699 + t3700; t3702 = -2.*t63*t1701; t3703 = -1.*t63*t1703; t3704 = -1.*t36*t1706; t3705 = -2.*t42*t1709; t3706 = -1.*t39*t3249; t3707 = -1.*t42*t3251; t3708 = 0.2365652*t63*t306; t3709 = -0.0734502*t2187; t3710 = -0.1182826*t39*t3488; t3711 = -0.646*t3425*t1090; t3712 = -1.292*t156*t333; t3713 = -0.2365652*t42*t343; t3714 = 0.0009044*t2217; t3715 = 0.1182826*t42*t3498; t3716 = -0.646*t1022*t3599; t3717 = -2.*t72*t1701; t3718 = -1.*t72*t1703; t3719 = -1.*t2764*t1706; t3720 = -2.*t60*t1709; t3721 = -1.*t69*t3249; t3722 = -1.*t60*t3251; t3723 = -2.*t84*t1701; t3724 = -1.*t84*t1703; t3725 = -1.*t2767*t1706; t3726 = -2.*t45*t1709; t3727 = -1.*t78*t3249; t3728 = -1.*t45*t3251; t3729 = -2.*t17*t42*t1701; t3730 = -1.*t17*t42*t1703; t3731 = -1.*t17*t63*t1706; t3732 = -2.*t17*t39*t1709; t3733 = -1.*t17*t36*t3249; t3734 = -1.*t17*t39*t3251; t3735 = -0.0734502*t1329; t3736 = -1.292*t387*t306; t3737 = -0.646*t393*t3488; t3738 = -0.646*t3515*t312; t3739 = -0.646*t3522*t316; t3740 = -0.646*t3537*t1090; t3741 = -1.292*t363*t333; t3742 = 0.0009044*t1354; t3743 = -1.292*t379*t343; t3744 = -0.646*t373*t3498; t3745 = -0.646*t1168*t3599; t3746 = -1.292*t72*t231; t3747 = -0.646*t69*t3460; t3748 = -1.292*t60*t253; t3749 = -0.646*t177*t3582; t3750 = -0.646*t60*t3472; t3751 = t3264 + t3746 + t3267 + t3747 + t3748 + t3749 + t3750; t3752 = -1.292*t121*t231; t3753 = -0.646*t118*t3460; t3754 = -1.292*t75*t253; t3755 = -0.646*t256*t3582; t3756 = -0.646*t75*t3472; t3757 = t403 + t407 + t3274 + t3752 + t3277 + t3753 + t3754 + t3755 + t3756; t3758 = -1.292*t477*t231; t3759 = -0.646*t471*t3460; t3760 = -1.292*t402*t253; t3761 = -0.646*t873*t3582; t3762 = -0.646*t402*t3472; t3763 = t481 + t485 + t3284 + t3758 + t3287 + t3759 + t3760 + t3761 + t3762; t3764 = -0.646*t3384*t219; t3765 = -1.292*t110*t231; t3766 = -0.646*t3382*t238; t3767 = -0.646*t113*t3460; t3768 = -0.0734502*t2895; t3769 = -1.292*t115*t253; t3770 = 0.0009044*t2919; t3771 = -0.646*t123*t3472; t3772 = t3764 + t3765 + t3766 + t3767 + t3768 + t3769 + t3770 + t3771; t3773 = -1.*t36*t1904; t3774 = -1.*t63*t1906; t3775 = -2.*t42*t1909; t3776 = -1.*t42*t3338; t3777 = -2.*t63*t1911; t3778 = -1.*t39*t3344; t3779 = 0.0009044*t2136; t3780 = -0.2365652*t42*t231; t3781 = -0.646*t3425*t1712; t3782 = 0.1182826*t42*t3460; t3783 = -0.0734502*t2168; t3784 = 0.2365652*t63*t253; t3785 = -0.646*t1022*t3582; t3786 = -1.292*t156*t277; t3787 = -0.1182826*t39*t3472; t3788 = -1.*t2764*t1904; t3789 = -1.*t72*t1906; t3790 = -2.*t60*t1909; t3791 = -1.*t60*t3338; t3792 = -2.*t72*t1911; t3793 = -1.*t69*t3344; t3794 = -1.*t2767*t1904; t3795 = -1.*t84*t1906; t3796 = -2.*t45*t1909; t3797 = -1.*t45*t3338; t3798 = -2.*t84*t1911; t3799 = -1.*t78*t3344; t3800 = -0.646*t3498*t219; t3801 = 0.0009044*t642; t3802 = -1.292*t343*t231; t3803 = -0.646*t3599*t1712; t3804 = -0.646*t3488*t238; t3805 = -0.646*t316*t3460; t3806 = -0.0734502*t674; t3807 = -1.292*t306*t253; t3808 = -0.646*t1090*t3582; t3809 = -1.292*t333*t277; t3810 = -0.646*t312*t3472; t3811 = -1.*t17*t63*t1904; t3812 = -1.*t17*t42*t1906; t3813 = -2.*t17*t39*t1909; t3814 = -1.*t17*t39*t3338; t3815 = -2.*t17*t42*t1911; t3816 = -1.*t17*t36*t3344; t3817 = -0.646*t3522*t219; t3818 = -1.292*t379*t231; t3819 = 0.0009044*t1285; t3820 = -0.646*t3537*t1712; t3821 = -0.646*t3515*t238; t3822 = -0.646*t373*t3460; t3823 = -1.292*t387*t253; t3824 = -0.0734502*t1315; t3825 = -0.646*t1168*t3582; t3826 = -1.292*t363*t277; t3827 = -0.646*t393*t3472; t3828 = -0.0734502*t60; t3829 = 0.0009044*t72; t3830 = t3828 + t3829; t3831 = t3830*t1977; t3832 = t481 + t485; t3833 = t3832*t1170; t3834 = -0.0734502*t402; t3835 = 0.0009044*t477; t3836 = t3834 + t3835; t3837 = t3836*t1171; t3838 = 0.00016559564*t42; t3839 = 0.01344873162*t63; t3840 = t3838 + t3839; t3841 = var[43]; t3842 = t3840*t3841; t3843 = -0.0734502*t659; t3844 = 0.0009044*t621; t3845 = 0.0009044*t52; t3846 = -0.0734502*t81; t3847 = -0.0734502*t18*t366; t3848 = 0.0009044*t18*t369; t3849 = -0.646*t69*t402; t3850 = -0.646*t72*t402; t3851 = -0.646*t60*t471; t3852 = -0.646*t60*t477; t3853 = t3849 + t3850 + t3851 + t3852; t3854 = -0.646*t75*t471; t3855 = -0.646*t402*t118; t3856 = -0.646*t75*t477; t3857 = -0.646*t402*t121; t3858 = t3854 + t3855 + t3856 + t3857; t3859 = -0.0734502*t2114; t3860 = 0.0009044*t2039; t3861 = 0.0009044*t75; t3862 = -0.0734502*t118; t3863 = 0.0009044*t9*t291; t3864 = -0.0734502*t9*t294; t3865 = -0.0734502*t1259; t3866 = 0.0009044*t1262; t3867 = -0.646*t60*t219; t3868 = -0.646*t60*t231; t3869 = -0.646*t72*t238; t3870 = -0.646*t69*t253; t3871 = -0.646*t177*t277; t3872 = t3867 + t3868 + t3869 + t3870 + t3871; t3873 = -0.646*t402*t219; t3874 = -0.646*t402*t231; t3875 = -0.646*t477*t238; t3876 = -0.646*t471*t253; t3877 = -0.646*t873*t277; t3878 = t3861 + t3862 + t3873 + t3874 + t3875 + t3876 + t3877; t3879 = 0.0009044*t2880; t3880 = -0.0734502*t2898; t3881 = 0.0176*t624; t3882 = -0.0734502*t2119; t3883 = 0.0009044*t2147; t3884 = 0.1182826*t63*t219; t3885 = -0.1182826*t39*t231; t3886 = -0.646*t156*t1712; t3887 = -0.1182826*t42*t238; t3888 = 0.1182826*t42*t253; t3889 = -0.646*t1022*t277; t3890 = 0.0176*t159; t3891 = -0.0734502*t606; t3892 = 0.0009044*t652; t3893 = -0.646*t306*t219; t3894 = -0.646*t312*t231; t3895 = -0.646*t333*t1712; t3896 = -0.646*t343*t238; t3897 = -0.646*t316*t253; t3898 = -0.646*t1090*t277; t3899 = -0.0176*t17*t18*t10; t3900 = -0.0734502*t1267; t3901 = 0.0009044*t1293; t3902 = -0.646*t387*t219; t3903 = -0.646*t393*t231; t3904 = -0.646*t363*t1712; t3905 = -0.646*t379*t238; t3906 = -0.646*t373*t253; t3907 = -0.646*t1168*t277; t3908 = -0.646*t69*t306; t3909 = -0.646*t72*t312; t3910 = -0.646*t60*t316; t3911 = -0.646*t177*t333; t3912 = -0.646*t60*t343; t3913 = t3845 + t3846 + t3908 + t3909 + t3910 + t3911 + t3912; t3914 = -0.646*t471*t306; t3915 = -0.646*t477*t312; t3916 = -0.646*t402*t316; t3917 = -0.646*t873*t333; t3918 = -0.646*t402*t343; t3919 = t3863 + t3864 + t3914 + t3915 + t3916 + t3917 + t3918; t3920 = -0.0734502*t2922; t3921 = 0.0009044*t2936; t3922 = -0.0176*t20*t10; t3923 = 0.0009044*t2196; t3924 = -0.0734502*t2201; t3925 = 0.1182826*t42*t306; t3926 = -0.1182826*t42*t312; t3927 = 0.1182826*t63*t316; t3928 = -0.646*t156*t1090; t3929 = -0.646*t1022*t333; t3930 = -0.1182826*t39*t343; t3931 = -1.*t60*t1701; t3932 = -1.*t60*t1703; t3933 = -1.*t72*t1706; t3934 = -1.*t69*t1709; t3935 = t3890 + t3931 + t3932 + t3933 + t3934 + t3891 + t3893 + t3894 + t3895 + t3892 + t3896 + t3897 + t3898; t3936 = -1.*t84*t1904; t3937 = -1.*t45*t1906; t3938 = -1.*t78*t1909; t3939 = -1.*t45*t1911; t3940 = t3890 + t3936 + t3937 + t3938 + t3939 + t3891 + t3893 + t3894 + t3895 + t3892 + t3896 + t3897 + t3898; t3941 = 0.0176*t17*t7; t3942 = 0.0009044*t1337; t3943 = -0.0734502*t1342; t3944 = -0.646*t373*t306; t3945 = -0.646*t379*t312; t3946 = -0.646*t387*t316; t3947 = -0.646*t363*t1090; t3948 = -0.646*t1168*t333; t3949 = -0.646*t393*t343; t3950 = -0.646*t363*t177; t3951 = -0.646*t373*t60; t3952 = -0.646*t379*t60; t3953 = -0.646*t387*t69; t3954 = -0.646*t393*t72; t3955 = t3950 + t3847 + t3848 + t3951 + t3952 + t3953 + t3954; t3956 = -0.646*t363*t873; t3957 = -0.646*t373*t402; t3958 = -0.646*t379*t402; t3959 = -0.646*t387*t471; t3960 = -0.646*t393*t477; t3961 = t3956 + t3865 + t3866 + t3957 + t3958 + t3959 + t3960; t3962 = -0.0734502*t2959; t3963 = 0.0009044*t2967; t3964 = -0.0176*t17; t3965 = 0.0009044*t2033; t3966 = -0.0734502*t2013; t3967 = 0.1182826*t42*t387; t3968 = -0.1182826*t42*t393; t3969 = 0.1182826*t63*t373; t3970 = -0.646*t156*t1168; t3971 = -0.646*t1022*t363; t3972 = -0.1182826*t39*t379; t3973 = -1.*t1377*t60; t3974 = -1.*t1379*t60; t3975 = -1.*t1375*t69; t3976 = -1.*t1372*t72; t3977 = t3899 + t3973 + t3974 + t3975 + t3976 + t3902 + t3900 + t3903 + t3904 + t3905 + t3901 + t3906 + t3907; t3978 = -1.*t17*t42*t1904; t3979 = -1.*t17*t39*t1906; t3980 = -1.*t17*t36*t1909; t3981 = -1.*t17*t39*t1911; t3982 = t3899 + t3978 + t3979 + t3980 + t3981 + t3902 + t3900 + t3903 + t3904 + t3905 + t3901 + t3906 + t3907; t3983 = -1.*t1372*t84; t3984 = -1.*t1375*t78; t3985 = -1.*t1377*t45; t3986 = -1.*t1379*t45; t3987 = t3941 + t3983 + t3984 + t3985 + t3986 + t3944 + t3942 + t3945 + t3943 + t3946 + t3947 + t3948 + t3949; t3988 = -1.*t17*t39*t1701; t3989 = -1.*t17*t39*t1703; t3990 = -1.*t17*t42*t1706; t3991 = -1.*t17*t36*t1709; t3992 = t3941 + t3988 + t3989 + t3990 + t3991 + t3944 + t3942 + t3945 + t3943 + t3946 + t3947 + t3948 + t3949; t3993 = -0.646*t156*t177; t3994 = 0.1182826*t63*t69; t3995 = -0.1182826*t39*t72; t3996 = t3993 + t3843 + t3844 + t3994 + t3995; t3997 = -0.646*t156*t873; t3998 = 0.1182826*t63*t471; t3999 = -0.1182826*t39*t477; t4000 = t3997 + t3859 + t3860 + t3998 + t3999; t4001 = -1.*t1194*t60; t4002 = -1.*t1196*t60; t4003 = -1.*t1192*t69; t4004 = -1.*t1189*t72; t4005 = t3881 + t4001 + t4002 + t4003 + t4004 + t3882 + t3884 + t3885 + t3886 + t3883 + t3887 + t3888 + t3889; t4006 = -1.*t63*t1904; t4007 = -1.*t42*t1906; t4008 = -1.*t39*t1909; t4009 = -1.*t42*t1911; t4010 = t3881 + t4006 + t4007 + t4008 + t4009 + t3882 + t3884 + t3885 + t3886 + t3883 + t3887 + t3888 + t3889; t4011 = -1.*t1189*t84; t4012 = -1.*t1192*t78; t4013 = -1.*t1194*t45; t4014 = -1.*t1196*t45; t4015 = t3922 + t4011 + t4012 + t4013 + t4014 + t3925 + t3926 + t3923 + t3927 + t3924 + t3928 + t3929 + t3930; t4016 = -1.*t42*t1701; t4017 = -1.*t42*t1703; t4018 = -1.*t63*t1706; t4019 = -1.*t39*t1709; t4020 = t3922 + t4016 + t4017 + t4018 + t4019 + t3925 + t3926 + t3923 + t3927 + t3924 + t3928 + t3929 + t3930; t4021 = -1.*t42*t1377; t4022 = -1.*t42*t1379; t4023 = -1.*t63*t1372; t4024 = -1.*t39*t1375; t4025 = t3964 + t4021 + t4022 + t4023 + t4024 + t3967 + t3965 + t3968 + t3966 + t3969 + t3970 + t3971 + t3972; t4026 = -1.*t17*t36*t1192; t4027 = -1.*t17*t39*t1194; t4028 = -1.*t17*t42*t1189; t4029 = -1.*t17*t39*t1196; t4030 = t3964 + t4026 + t4027 + t4028 + t4029 + t3967 + t3965 + t3968 + t3966 + t3969 + t3970 + t3971 + t3972; t4031 = -0.646*t110*t60; t4032 = -0.646*t113*t60; t4033 = -0.646*t115*t69; t4034 = -0.646*t123*t72; t4035 = t3828 + t4031 + t4032 + t4033 + t3829 + t4034; t4036 = -0.646*t110*t402; t4037 = -0.646*t113*t402; t4038 = -0.646*t115*t471; t4039 = -0.646*t123*t477; t4040 = t3834 + t4036 + t4037 + t4038 + t3835 + t4039; t4041 = -0.1182826*t123*t42; t4042 = 0.1182826*t115*t42; t4043 = -0.1182826*t110*t39; t4044 = 0.1182826*t113*t63; t4045 = t3838 + t4041 + t4042 + t4043 + t3839 + t4044; t4046 = -0.646*t115*t219; t4047 = -0.646*t123*t231; t4048 = -0.646*t110*t238; t4049 = -0.646*t113*t253; t4050 = t4046 + t4047 + t3879 + t4048 + t4049 + t3880; t4051 = -0.646*t113*t306; t4052 = -0.646*t110*t312; t4053 = -0.646*t115*t316; t4054 = -0.646*t123*t343; t4055 = t4051 + t3920 + t4052 + t4053 + t4054 + t3921; t4056 = -0.646*t113*t387; t4057 = -0.646*t110*t393; t4058 = -0.646*t115*t373; t4059 = -0.646*t123*t379; t4060 = t4056 + t3962 + t4057 + t4058 + t4059 + t3963; t4061 = t3861 + t3862; p_output1[0]=6.337260000000001*(0.4*t26*t29 + 0.4*t30*t33 + 0.0014*(t29*t30 - 1.*t26*t33) + 0.5137*(-1.*t26*t29 - 1.*t30*t33)) + t1171*t4061 + t399*(0.5*t107*t398 + 0.5*t124*t467) + t410*(0.5*t107*t409 + 0.5*t124*t487) + t423*(0.5*t107*t422 + 0.5*t124*t499) + t1170*(t500 + t501) + t438*(0.5*t107*t437 + 0.5*t124*t507) + t447*(0.5*t107*t446 + 0.5*t124*t515) + t462*(0.5*t107*t461 + 0.5*t124*t529) + t124*(0.5*t399*t467 + 0.5*t107*t480 + 0.5*t410*t487 + 0.5*t423*t499 + 0.5*t438*t507 + 0.5*t447*t515 + 0.5*t462*t529 + 0.5*t124*(-1.292*t118*t402 - 1.292*t121*t402 - 1.292*t471*t75 - 1.292*t477*t75)) + t107*(0.5*t398*t399 + 0.5*t409*t410 + 0.5*t422*t423 + 0.5*t437*t438 + 0.5*t446*t447 + 0.5*t461*t462 + 0.5*t124*t480 + 0.5*t107*(-1.292*t118*t54 - 1.292*t121*t54 - 1.292*t102*t75 - 1.292*t75*t99)); p_output1[1]=t1977*(t3845 + t3846) + t1171*(t3863 + t3864) + t1978*(t3890 + t3891 + t3892) + t1170*(t508 + t509) + 6.337260000000001*(0.4*t30*t535 + 0.4*t26*t538 + 0.5137*(-1.*t30*t535 - 1.*t26*t538) + 0.0014*(-1.*t26*t535 + t30*t538)) + t107*(0.5*t107*(1.292*t118*t291*t5 + 1.292*t121*t291*t5 + 1.292*t294*t5*t75 + 1.292*t5*t541*t75) + 0.5*t124*t763 + 0.5*t410*t770 + 0.5*t423*t776 + 0.5*t447*t784 + 0.5*t462*t792 + 0.5*t399*t801 + 0.5*t438*t861) + t462*(0.5*t124*t754 + 0.5*t107*t792 + 0.5*t399*t839 + 0.5*t438*(t1092 + t1093 + t1127 + t1128 + t1129 + t1130 + t1164 + t1165 + t1169 - 1.*t1377*t52 - 1.*t1379*t52 - 1.*t1375*t81 - 1.*t1372*t87)) + t447*(0.5*t124*t746 + 0.5*t107*t784 + 0.5*t399*t831 + 0.5*t438*(t1038 + t1039 + t1061 + t1062 + t1063 + t1064 + t1086 + t1087 + t1091 - 1.*t1701*t52 - 1.*t1703*t52 - 1.*t1709*t81 - 1.*t1706*t87)) + t399*(0.5*t107*t801 + 0.5*t124*t810 + 0.5*t410*t817 + 0.5*t423*t823 + 0.5*t447*t831 + 0.5*t462*t839 + 0.5*t438*t850 + 0.5*t399*(-1.292*t52*t69 - 1.292*t52*t72 - 1.292*t60*t81 - 1.292*t60*t87)) + t124*(0.5*t410*t732 + 0.5*t423*t738 + 0.5*t447*t746 + 0.5*t462*t754 + 0.5*t107*t763 + 0.5*t399*t810 + 0.5*t438*t875 + 0.5*t124*(-1.292*t294*t402*t9 - 1.292*t291*t471*t9 - 1.292*t291*t477*t9 - 1.292*t402*t541*t9)) + t410*(0.5*t124*t732 + 0.5*t107*t770 + 0.5*t399*t817 + 0.5*t438*t928) + t438*(0.5*(t1092 + t1093 + t1127 + t1128 + t1129 + t1130 + t1164 + t1165 + t1169 - 1.*t1037*t17*t36 - 1.*t1025*t17*t39 - 1.*t1031*t17*t39 - 1.*t1028*t17*t42)*t462 + 0.5*t447*(t1038 + t1039 + t1061 + t1062 + t1063 + t1064 + t1086 + t1087 + t1091 - 1.*t1025*t45 - 1.*t1031*t45 - 1.*t1037*t78 - 1.*t1028*t84) + 0.5*t399*t850 + 0.5*t107*t861 + 0.5*t438*(-1.*t1906*t52 - 1.*t1911*t52 - 1.*t1025*t60 - 1.*t1031*t60 - 1.292*t253*t606 - 1.292*t238*t642 - 1.292*t231*t652 - 1.292*t219*t674 - 1.*t1037*t69 - 1.292*t277*t695 - 1.*t1028*t72 - 1.292*t1712*t721 - 1.*t1909*t81 - 1.*t1904*t87) + 0.5*t124*t875 + 0.5*t410*t928 + 0.5*t423*(t1018 + t1019 + t1023 - 1.*t1037*t39 - 1.*t1025*t42 - 1.*t1031*t42 - 1.*t1028*t63 + t929 + t931 + t973 + t974 + t975 + t976)) + t423*(0.5*t124*t738 + 0.5*t107*t776 + 0.5*t399*t823 + 0.5*t438*(t1018 + t1019 + t1023 - 1.*t1194*t52 - 1.*t1196*t52 - 1.*t1192*t81 - 1.*t1189*t87 + t929 + t931 + t973 + t974 + t975 + t976)); p_output1[2]=6.337260000000001*(0.4*t1180*t26 + 0.4*t1183*t30 + 0.0014*(-1.*t1183*t26 + t1180*t30) + 0.5137*(-1.*t1180*t26 - 1.*t1183*t30)) + t1977*(t3847 + t3848) + t1171*(t3865 + t3866) + t1978*(t3899 + t3900 + t3901) + t2749*(t3941 + t3942 + t3943) + t410*(0.5*t124*t1479 + 0.5*t107*t1530 + 0.5*t1449*t399 + 0.5*t1819*t438 + 0.5*t1628*t447) + t124*(0.5*t107*t1523 + 0.5*t1472*t399 + 0.5*t1479*t410 + 0.5*t1491*t423 + 0.5*t1780*t438 + 0.5*t1589*t447 + 0.5*t1505*t462 + 0.5*t124*(-1.292*t1256*t402 - 1.292*t1259*t402 - 1.292*t1262*t471 - 1.292*t1262*t477)) + t1170*(t520 + t524) + t423*(0.5*t124*t1491 + 0.5*t107*t1542 + 0.5*t1455*t399 + 0.5*(-1.*t1186*t1189*t18 + t1820 + t1822 + t1854 + t1855 + t1856 + t1857 + t1889 + t1890 + t1891 - 1.*t1192*t18*t366 - 1.*t1194*t18*t369 - 1.*t1196*t18*t369)*t438 + 0.5*t447*(t1629 + t1631 + t1632 + t1657 + t1658 + t1683 + t1684 + t1685 + t1686 - 1.*t1194*t50 - 1.*t1196*t50 - 1.*t1192*t57 - 1.*t1189*t66)) + t462*(0.5*t124*t1505 + 0.5*t107*t1556 + 0.5*t1463*t399 + 0.5*(-1.*t1186*t1372*t18 + t1924 + t1947 + t1948 + t1949 + t1950 + t1973 + t1974 + t1975 + t1976 - 1.*t1375*t18*t366 - 1.*t1377*t18*t369 - 1.*t1379*t18*t369)*t438 + 0.5*t447*(t1713 + t1714 + t1715 + t1729 + t1730 + t1744 + t1745 + t1746 + t1747 - 1.*t1377*t50 - 1.*t1379*t50 - 1.*t1375*t57 - 1.*t1372*t66)) + t399*(0.5*t124*t1472 + 0.5*t107*t1514 + 0.5*t1449*t410 + 0.5*t1455*t423 + 0.5*t1758*t438 + 0.5*t1567*t447 + 0.5*t1463*t462 + 0.5*t399*(-1.292*t1186*t18*t60 - 1.292*t18*t366*t60 - 1.292*t18*t369*t69 - 1.292*t18*t369*t72)) + t107*(0.5*t124*t1523 + 0.5*t1514*t399 + 0.5*t1530*t410 + 0.5*t1542*t423 + 0.5*t1769*t438 + 0.5*t1578*t447 + 0.5*t1556*t462 + 0.5*t107*(-1.292*t118*t523 - 1.292*t121*t523 - 1.292*t1253*t75 - 1.292*t519*t75)) + t447*(0.5*t107*t1578 + 0.5*t124*t1589 + 0.5*t1567*t399 + 0.5*t1628*t410 + 0.5*(t1713 + t1714 + t1715 + t1729 + t1730 + t1744 + t1745 + t1746 + t1747 - 1.*t1699*t17*t36 - 1.*t1688*t17*t39 - 1.*t1690*t17*t39 - 1.*t1693*t17*t42)*t462 + 0.5*t423*(t1629 + t1631 + t1632 + t1657 + t1658 + t1683 + t1684 + t1685 + t1686 - 1.*t1699*t39 - 1.*t1688*t42 - 1.*t1690*t42 - 1.*t1693*t63) + 0.5*t438*(t1092 + t1127 + t1164 - 1.*t1186*t1706*t18 + t1912 + t1913 + t1914 + t1915 + t1916 + t1917 + t1918 + t1919 + t1920 + t1921 + t1922 + t1923 - 1.*t1709*t18*t366 - 1.*t1701*t18*t369 - 1.*t1703*t18*t369 - 1.*t1688*t60 - 1.*t1690*t60 - 1.*t1699*t69 - 1.*t1693*t72) + 0.5*t447*(-1.292*t1090*t1437 - 1.292*t1342*t306 - 1.292*t1354*t312 - 1.292*t1329*t316 - 1.292*t1442*t333 - 1.292*t1337*t343 - 1.*t1688*t45 - 1.*t1690*t45 - 1.*t1701*t50 - 1.*t1703*t50 - 1.*t1709*t57 - 1.*t1706*t66 - 1.*t1699*t78 - 1.*t1693*t84)) + t438*(0.5*t107*t1769 + 0.5*t124*t1780 + 0.5*t1758*t399 + 0.5*t1819*t410 + 0.5*(t1924 + t1947 + t1948 + t1949 + t1950 + t1973 + t1974 + t1975 + t1976 - 1.*t17*t1901*t36 - 1.*t17*t1893*t39 - 1.*t17*t1895*t39 - 1.*t17*t1898*t42)*t462 + 0.5*t423*(t1820 + t1822 + t1854 + t1855 + t1856 + t1857 + t1889 + t1890 + t1891 - 1.*t1901*t39 - 1.*t1893*t42 - 1.*t1895*t42 - 1.*t1898*t63) + 0.5*t438*(-1.292*t1412*t1712 - 1.*t1186*t18*t1904 - 1.292*t1315*t219 - 1.292*t1293*t231 - 1.292*t1285*t238 - 1.292*t1267*t253 - 1.292*t1389*t277 - 1.*t18*t1909*t366 - 1.*t18*t1906*t369 - 1.*t18*t1911*t369 - 1.*t1893*t60 - 1.*t1895*t60 - 1.*t1901*t69 - 1.*t1898*t72) + 0.5*t447*(t1092 + t1127 + t1164 + t1912 + t1913 + t1914 + t1915 + t1916 + t1917 + t1918 + t1919 + t1920 + t1921 + t1922 + t1923 - 1.*t1893*t45 - 1.*t1895*t45 - 1.*t1906*t50 - 1.*t1911*t50 - 1.*t1909*t57 - 1.*t1904*t66 - 1.*t1901*t78 - 1.*t1898*t84)); p_output1[3]=6.337260000000001*(0.4*t12*t1984*t26 + 0.4*t16*t1984*t30 + 0.0014*(-1.*t16*t1984*t26 + t12*t1984*t30) + 0.5137*(-1.*t12*t1984*t26 - 1.*t16*t1984*t30)) + t1977*(t3843 + t3844) + t1171*(t3859 + t3860) + t1978*(t3881 + t3882 + t3883) + t2749*(t3922 + t3923 + t3924) + t3369*(t3964 + t3965 + t3966) + t410*(0.5*t124*t2396 + 0.5*t107*t2444 + 0.5*t2363*t399 + 0.5*t2666*t438 + 0.5*t2535*t447 + 0.5*t2238*t462) + t124*(0.5*t107*t2437 + 0.5*t2389*t399 + 0.5*t2396*t410 + 0.5*t2408*t423 + 0.5*t2629*t438 + 0.5*t2500*t447 + 0.5*t2419*t462 + 0.5*t124*(-1.292*t2111*t402 - 1.292*t2114*t402 - 1.292*t2039*t471 - 1.292*t2039*t477)) + t1170*(t492 + t496) + t423*(0.5*t124*t2408 + 0.5*t107*t2456 + 0.5*t2369*t399 + 0.5*(t1713 + t2537 + t2553 + t2554 + t2570 + t2571 + t2572 + t2573 + t2574 - 1.*t10*t1192*t17*t36 - 1.*t10*t1194*t17*t39 - 1.*t10*t1196*t17*t39 - 1.*t10*t1189*t17*t42)*t447 + 0.5*(t2326 + t2327 + t2328 + t2340 + t2341 + t2342 + t2343 + t2344 + t2356 + t1192*t20*t36 + t1194*t20*t39 + t1196*t20*t39 + t1189*t20*t42)*t462 + 0.5*t438*(t1038 - 1.*t1189*t2046 + t2668 + t2687 + t2688 + t2689 + t2690 + t2709 + t2710 + t2711 - 1.*t1194*t621 - 1.*t1196*t621 - 1.*t1192*t659)) + t399*(0.5*t124*t2389 + 0.5*t107*t2428 + 0.5*t2363*t410 + 0.5*t2369*t423 + 0.5*t2607*t438 + 0.5*t2478*t447 + 0.5*t2380*t462 + 0.5*t399*(-1.292*t2046*t60 - 1.292*t60*t659 - 1.292*t621*t69 - 1.292*t621*t72)) + t107*(0.5*t124*t2437 + 0.5*t2428*t399 + 0.5*t2444*t410 + 0.5*t2456*t423 + 0.5*t2618*t438 + 0.5*t2489*t447 + 0.5*t2467*t462 + 0.5*t107*(-1.292*t118*t495 - 1.292*t121*t495 - 1.292*t2108*t75 - 1.292*t491*t75)) + t462*(0.5*t124*t2419 + 0.5*t107*t2467 + 0.5*t2380*t399 + 0.5*t2238*t410 + 0.5*(-1.292*t1168*t2008 + t1375*t20*t36 - 1.*t17*t2053*t36 - 1.292*t2081*t363 - 1.292*t2026*t373 - 1.292*t2033*t379 - 1.292*t2013*t387 + t1377*t20*t39 + t1379*t20*t39 - 1.*t17*t2048*t39 - 1.*t17*t2050*t39 - 1.292*t2018*t393 + t1372*t20*t42 - 1.*t17*t2056*t42)*t462 + 0.5*t423*(t2326 + t2327 + t2328 + t2340 + t2341 + t2342 + t2343 + t2344 + t2356 - 1.*t2053*t39 - 1.*t2048*t42 - 1.*t2050*t42 - 1.*t2056*t63) + 0.5*t438*(t1820 + t1854 + t1889 - 1.*t1372*t2046 + t2737 + t2738 + t2739 + t2740 + t2741 + t2742 + t2743 + t2744 + t2745 + t2746 + t2747 + t2748 - 1.*t2048*t60 - 1.*t2050*t60 - 1.*t1377*t621 - 1.*t1379*t621 - 1.*t1375*t659 - 1.*t2053*t69 - 1.*t2056*t72) + 0.5*t447*(t1629 + t1657 + t1683 + t2585 + t2586 + t2587 + t2588 + t2589 + t2590 + t2591 + t2592 + t2593 + t2594 + t2595 + t2596 - 1.*t10*t1375*t17*t36 - 1.*t10*t1377*t17*t39 - 1.*t10*t1379*t17*t39 - 1.*t10*t1372*t17*t42 - 1.*t2048*t45 - 1.*t2050*t45 - 1.*t2053*t78 - 1.*t2056*t84)) + t447*(0.5*t107*t2489 + 0.5*t124*t2500 + 0.5*t2478*t399 + 0.5*t2535*t410 + 0.5*(t1629 + t1657 + t1683 + t2585 + t2586 + t2587 + t2588 + t2589 + t2590 + t2591 + t2592 + t2593 + t2594 + t2595 + t2596 + t1709*t20*t36 - 1.*t17*t2581*t36 + t1701*t20*t39 + t1703*t20*t39 - 1.*t17*t2576*t39 - 1.*t17*t2578*t39 + t1706*t20*t42 - 1.*t17*t2584*t42)*t462 + 0.5*t423*(t1713 + t2537 + t2553 + t2554 + t2570 + t2571 + t2572 + t2573 + t2574 - 1.*t2581*t39 - 1.*t2576*t42 - 1.*t2578*t42 - 1.*t2584*t63) + 0.5*t447*(-1.292*t1090*t2325 - 1.292*t2201*t306 - 1.292*t2217*t312 - 1.292*t2187*t316 - 1.292*t2305*t333 - 1.292*t2196*t343 - 1.*t10*t17*t1709*t36 - 1.*t10*t17*t1701*t39 - 1.*t10*t17*t1703*t39 - 1.*t10*t17*t1706*t42 - 1.*t2576*t45 - 1.*t2578*t45 - 1.*t2581*t78 - 1.*t2584*t84) + 0.5*t438*(t1018 - 1.*t1706*t2046 + t2725 + t2726 + t2727 + t2728 + t2729 + t2730 + t2731 + t2732 + t2733 + t2734 + t2735 + t2736 - 1.*t2576*t60 - 1.*t2578*t60 - 1.*t1701*t621 - 1.*t1703*t621 - 1.*t1709*t659 - 1.*t2581*t69 - 1.*t2584*t72 + t929 + t973)) + t438*(0.5*t107*t2618 + 0.5*t124*t2629 + 0.5*t2607*t399 + 0.5*t2666*t410 + 0.5*(t1820 + t1854 + t1889 + t2737 + t2738 + t2739 + t2740 + t2741 + t2742 + t2743 + t2744 + t2745 + t2746 + t2747 + t2748 + t1909*t20*t36 - 1.*t17*t2721*t36 + t1906*t20*t39 + t1911*t20*t39 - 1.*t17*t2713*t39 - 1.*t17*t2715*t39 + t1904*t20*t42 - 1.*t17*t2724*t42)*t462 + 0.5*t423*(t1038 + t2668 + t2687 + t2688 + t2689 + t2690 + t2709 + t2710 + t2711 - 1.*t2721*t39 - 1.*t2713*t42 - 1.*t2715*t42 - 1.*t2724*t63) + 0.5*t438*(-1.*t1904*t2046 - 1.292*t2168*t219 - 1.292*t1712*t2286 - 1.292*t2147*t231 - 1.292*t2136*t238 - 1.292*t2119*t253 - 1.292*t2261*t277 - 1.*t2713*t60 - 1.*t2715*t60 - 1.*t1906*t621 - 1.*t1911*t621 - 1.*t1909*t659 - 1.*t2721*t69 - 1.*t2724*t72) + 0.5*t447*(t1018 + t2725 + t2726 + t2727 + t2728 + t2729 + t2730 + t2731 + t2732 + t2733 + t2734 + t2735 + t2736 - 1.*t10*t17*t1909*t36 - 1.*t10*t17*t1906*t39 - 1.*t10*t17*t1911*t39 - 1.*t10*t17*t1904*t42 - 1.*t2713*t45 - 1.*t2715*t45 - 1.*t2721*t78 - 1.*t2724*t84 + t929 + t973)); p_output1[4]=6.337260000000001*(0.4*t26*t2758 + t3370 + 0.0014*(t2758*t30 + t3371) + 0.5137*(-1.*t26*t2758 + t3375)) + t3831 + t3833 + t3837 + t3842 + t1978*(t3879 + t3880) + t2749*(t3920 + t3921) + t3369*(t3962 + t3963) + t410*(0.5*t124*t3121 + 0.5*t107*t3158 + 0.5*t3091*t399 + 0.5*t2872*t423 + 0.5*t3324*t438 + 0.5*t3231*t447 + 0.5*t3021*t462) + t399*(t3613 + t3614 + t3615 + 0.5*t3091*t410 + 0.5*t3097*t423 + 0.5*t3273*t438 + 0.5*t3184*t447 + 0.5*t3107*t462) + t124*(t3629 + t3630 + t3638 + 0.5*t3121*t410 + 0.5*t3127*t423 + 0.5*t3293*t438 + 0.5*t3204*t447 + 0.5*t3137*t462) + t107*(t3652 + t3660 + t3661 + 0.5*t3158*t410 + 0.5*t3164*t423 + 0.5*t3283*t438 + 0.5*t3194*t447 + 0.5*t3174*t462) + t423*(0.5*t124*t3127 + 0.5*t107*t3164 + 0.5*t3097*t399 + 0.5*t2872*t410 + 0.5*(-1.292*t1022*t2865 - 1.292*t156*t2901 + t3432 + t3433 + t3434 + t3436 + t3437 + t3438 + t3439 + t3440 + t3441 + t3442)*t423 + 0.5*(t2647 + t2665 + t3325 + t3326 + t3327 + t3328 + t3329 + t3330 + t3331 + t3332 + t3333 + t3334 + t3335 + t3336 + t3443 + t3444 + t3445 + t3446 + t3447 + t3448)*t438 + 0.5*(t2516 + t2534 + t3232 + t3233 + t3234 + t3235 + t3236 + t3237 + t3238 + t3239 + t3240 + t3241 + t3242 + t3243 + t3473 + t3474 + t3475 + t3476 + t3477 + t3478)*t447 + 0.5*(t2228 + t2237 + t3022 + t3023 + t3024 + t3025 + t3026 + t3027 + t3028 + t3032 + t3033 + t3034 + t3035 + t3036 + t3503 + t3504 + t3505 + t3506 + t3507 + t3508)*t462) + t462*(0.5*t124*t3137 + 0.5*t107*t3174 + 0.5*t3107*t399 + 0.5*t3021*t410 + 0.5*(t2228 + t2237 + t3022 + t3023 + t3024 + t3025 + t3026 + t3027 + t3028 + t3032 + t3033 + t3034 + t3035 + t3036 + t3547 + t3548 + t3549 + t3550 + t3551 + t3552)*t423 + 0.5*(t1799 + t1818 + t3357 + t3358 + t3359 + t3360 + t3361 + t3362 + t3363 + t3364 + t3365 + t3366 + t3367 + t3368 + t3562 + t3563 + t3564 + t3565 + t3566 + t3567)*t438 + 0.5*(t1607 + t1627 + t3252 + t3253 + t3254 + t3255 + t3256 + t3257 + t3258 + t3259 + t3260 + t3261 + t3262 + t3263 + t3583 + t3584 + t3585 + t3586 + t3587 + t3588)*t447 + 0.5*(-1.292*t1168*t3000 + t3600 + t3601 + t3602 + t3603 + t3604 + t3605 - 1.292*t3031*t363 - 1.292*t2976*t373 - 1.292*t2967*t379 - 1.292*t2959*t387 - 1.292*t2965*t393)*t462) + t447*(0.5*t107*t3194 + 0.5*t124*t3204 + 0.5*t3184*t399 + 0.5*t3231*t410 + 0.5*(t2516 + t2534 + t3232 + t3233 + t3234 + t3235 + t3236 + t3237 + t3238 + t3239 + t3240 + t3241 + t3242 + t3243 + t3702 + t3703 + t3704 + t3705 + t3706 + t3707)*t423 + 0.5*(-1.292*t2922*t306 - 1.292*t1090*t3084 - 1.292*t2933*t312 - 1.292*t2948*t316 - 1.292*t3068*t333 - 1.292*t2936*t343 + t3723 + t3724 + t3725 + t3726 + t3727 + t3728)*t447 + 0.5*(t1607 + t1627 + t3252 + t3253 + t3254 + t3255 + t3256 + t3257 + t3258 + t3259 + t3260 + t3261 + t3262 + t3263 + t3729 + t3730 + t3731 + t3732 + t3733 + t3734)*t462 + 0.5*t438*(t3345 + t3346 + t3347 + t3348 + t3349 + t3350 + t3351 + t3352 + t3353 + t3354 + t3355 + t3356 + t3717 + t3718 + t3719 + t3720 + t3721 + t3722 + t901 + t927)) + t438*(0.5*t107*t3283 + 0.5*t124*t3293 + 0.5*t3273*t399 + 0.5*t3324*t410 + 0.5*(t2647 + t2665 + t3325 + t3326 + t3327 + t3328 + t3329 + t3330 + t3331 + t3332 + t3333 + t3334 + t3335 + t3336 + t3773 + t3774 + t3775 + t3776 + t3777 + t3778)*t423 + 0.5*(-1.292*t231*t2880 - 1.292*t219*t2895 - 1.292*t253*t2898 - 1.292*t238*t2919 - 1.292*t1712*t3062 - 1.292*t277*t3065 + t3788 + t3789 + t3790 + t3791 + t3792 + t3793)*t438 + 0.5*(t1799 + t1818 + t3357 + t3358 + t3359 + t3360 + t3361 + t3362 + t3363 + t3364 + t3365 + t3366 + t3367 + t3368 + t3811 + t3812 + t3813 + t3814 + t3815 + t3816)*t462 + 0.5*t447*(t3345 + t3346 + t3347 + t3348 + t3349 + t3350 + t3351 + t3352 + t3353 + t3354 + t3355 + t3356 + t3794 + t3795 + t3796 + t3797 + t3798 + t3799 + t901 + t927)); p_output1[5]=t1978*(0.0009044*t231 - 0.0734502*t253) + 6.337260000000001*(t3370 - 0.4*t26*t3374 + 0.0014*(t3371 - 1.*t30*t3374) + 0.5137*(t26*t3374 + t3375)) + t2749*(-0.0734502*t306 + 0.0009044*t343) + t3831 + t3833 + t3837 + t3842 + t3369*(0.0009044*t379 - 0.0734502*t387) + t410*(0.5*t124*t3643 + 0.5*t107*t3666 + 0.5*t3620*t399 + 0.5*(-1.292*Power(t110,2) - 1.292*Power(t115,2) - 1.292*t123*t3382 - 1.292*t113*t3384)*t410 + 0.5*t3430*t423 + 0.5*t3772*t438 + 0.5*t3701*t447 + 0.5*t3546*t462) + t423*(0.5*t124*t3645 + 0.5*t107*t3668 + 0.5*t3622*t399 + 0.5*t3430*t410 + 0.5*(-1.292*Power(t156,2) - 1.292*t1022*t3425 + t3432 + t3433 + t3434 + t3436 + t3437 + t3438 + t3439 + t3440 + t3441 + t3442)*t423 + 0.5*(t3325 + t3329 + t3443 + t3444 + t3445 + t3446 + t3447 + t3448 + t3779 + t3780 + t3781 + t3782 + t3783 + t3784 + t3785 + t3786 + t3787)*t438 + 0.5*(t3235 + t3236 + t3473 + t3474 + t3475 + t3476 + t3477 + t3478 + t3708 + t3709 + t3710 + t3711 + t3712 + t3713 + t3714 + t3715 + t3716)*t447 + 0.5*(t3025 + t3026 + t3503 + t3504 + t3505 + t3506 + t3507 + t3508 + t3553 + t3554 + t3555 + t3556 + t3557 + t3558 + t3559 + t3560 + t3561)*t462) + t399*(t3613 + t3614 + t3615 + 0.5*t3620*t410 + 0.5*t3622*t423 + 0.5*t3751*t438 + 0.5*t3680*t447 + 0.5*t3628*t462) + t124*(t3629 + t3630 + t3638 + 0.5*t3643*t410 + 0.5*t3645*t423 + 0.5*t3763*t438 + 0.5*t3692*t447 + 0.5*t3651*t462) + t107*(t3652 + t3660 + t3661 + 0.5*t3666*t410 + 0.5*t3668*t423 + 0.5*t3757*t438 + 0.5*t3686*t447 + 0.5*t3674*t462) + t447*(0.5*t107*t3686 + 0.5*t124*t3692 + 0.5*t3680*t399 + 0.5*t3701*t410 + 0.5*(t3235 + t3236 + t3702 + t3703 + t3704 + t3705 + t3706 + t3707 + t3708 + t3709 + t3710 + t3711 + t3712 + t3713 + t3714 + t3715 + t3716)*t423 + 0.5*(t3717 + t3718 + t3719 + t3720 + t3721 + t3722 + t3800 + t3801 + t3802 + t3803 + t3804 + t3805 + t3806 + t3807 + t3808 + t3809 + t3810)*t438 + 0.5*(-1.292*Power(t306,2) - 1.292*Power(t333,2) - 1.292*Power(t343,2) - 1.292*t312*t3488 - 1.292*t316*t3498 - 1.292*t1090*t3599 + t3723 + t3724 + t3725 + t3726 + t3727 + t3728)*t447 + 0.5*(t3729 + t3730 + t3731 + t3732 + t3733 + t3734 + t3735 + t3736 + t3737 + t3738 + t3739 + t3740 + t3741 + t3742 + t3743 + t3744 + t3745)*t462) + t438*(0.5*t107*t3757 + 0.5*t124*t3763 + 0.5*t3751*t399 + 0.5*t3772*t410 + 0.5*(t3325 + t3329 + t3773 + t3774 + t3775 + t3776 + t3777 + t3778 + t3779 + t3780 + t3781 + t3782 + t3783 + t3784 + t3785 + t3786 + t3787)*t423 + 0.5*(-1.292*Power(t231,2) - 1.292*Power(t253,2) - 1.292*Power(t277,2) - 1.292*t219*t3460 - 1.292*t238*t3472 - 1.292*t1712*t3582 + t3788 + t3789 + t3790 + t3791 + t3792 + t3793)*t438 + 0.5*(t3794 + t3795 + t3796 + t3797 + t3798 + t3799 + t3800 + t3801 + t3802 + t3803 + t3804 + t3805 + t3806 + t3807 + t3808 + t3809 + t3810)*t447 + 0.5*(t3811 + t3812 + t3813 + t3814 + t3815 + t3816 + t3817 + t3818 + t3819 + t3820 + t3821 + t3822 + t3823 + t3824 + t3825 + t3826 + t3827)*t462) + t462*(0.5*t124*t3651 + 0.5*t107*t3674 + 0.5*t3628*t399 + 0.5*t3546*t410 + 0.5*(t3025 + t3026 + t3547 + t3548 + t3549 + t3550 + t3551 + t3552 + t3553 + t3554 + t3555 + t3556 + t3557 + t3558 + t3559 + t3560 + t3561)*t423 + 0.5*(t3562 + t3563 + t3564 + t3565 + t3566 + t3567 + t3817 + t3818 + t3819 + t3820 + t3821 + t3822 + t3823 + t3824 + t3825 + t3826 + t3827)*t438 + 0.5*(t3583 + t3584 + t3585 + t3586 + t3587 + t3588 + t3735 + t3736 + t3737 + t3738 + t3739 + t3740 + t3741 + t3742 + t3743 + t3744 + t3745)*t447 + 0.5*(-1.292*t1168*t3537 + t3600 + t3601 + t3602 + t3603 + t3604 + t3605 - 1.292*Power(t363,2) - 1.292*t3522*t373 - 1.292*Power(t379,2) - 1.292*Power(t387,2) - 1.292*t3515*t393)*t462) + (0.0009044*t110 - 0.0734502*t115)*var[44]; p_output1[6]=t124*t3853 + t4035*t410 + t3996*t423 + t3872*t438 + t3913*t447 + t3955*t462 + t107*t467 + t399*(-1.292*t60*t69 - 1.292*t60*t72); p_output1[7]=t124*t3858 + t399*t467 + t107*(t473 + t479) + t410*t487 + t423*t499 + t438*t507 + t447*t515 + t462*t529; p_output1[8]=t107*t3858 + t3853*t399 + t4040*t410 + t4000*t423 + t3878*t438 + t3919*t447 + t3961*t462 + t124*(-1.292*t402*t471 - 1.292*t402*t477); p_output1[9]=t124*t3878 + t3872*t399 + t4050*t410 + 0.5*t4005*t423 + 0.5*t4010*t423 + 0.5*t3935*t447 + 0.5*t3940*t447 + 0.5*t3977*t462 + 0.5*t3982*t462 + t107*t507 + t438*(-1.292*t231*t238 - 1.292*t219*t253 - 1.292*t1712*t277 - 1.*t1906*t60 - 1.*t1911*t60 - 1.*t1909*t69 - 1.*t1904*t72); p_output1[10]=t124*t3919 + t3913*t399 + t4055*t410 + 0.5*t4015*t423 + 0.5*t4020*t423 + 0.5*t3935*t438 + 0.5*t3940*t438 + 0.5*t3987*t462 + 0.5*t3992*t462 + t107*t515 + t447*(-1.292*t306*t316 - 1.292*t1090*t333 - 1.292*t312*t343 - 1.*t1701*t45 - 1.*t1703*t45 - 1.*t1709*t78 - 1.*t1706*t84); p_output1[11]=t124*t3961 + t3955*t399 + t4060*t410 + 0.5*t4025*t423 + 0.5*t4030*t423 + 0.5*t3977*t438 + 0.5*t3982*t438 + 0.5*t3987*t447 + 0.5*t3992*t447 + (-1.*t1375*t17*t36 - 1.292*t1168*t363 - 1.292*t373*t387 - 1.*t1377*t17*t39 - 1.*t1379*t17*t39 - 1.292*t379*t393 - 1.*t1372*t17*t42)*t462 + t107*t529; p_output1[12]=t399*t3996 + t124*t4000 + t4045*t410 + 0.5*t4005*t438 + 0.5*t4010*t438 + 0.5*t4015*t447 + 0.5*t4020*t447 + 0.5*t4025*t462 + 0.5*t4030*t462 + t107*t499 + t423*(-1.292*t1022*t156 - 1.*t1192*t39 - 1.*t1194*t42 - 1.*t1196*t42 - 0.04331508812*t39*t42 - 1.*t1189*t63 - 0.04331508812*t42*t63); p_output1[13]=t399*t4035 + t124*t4040 + (-1.292*t113*t115 - 1.292*t110*t123)*t410 + t4045*t423 + t4050*t438 + t4055*t447 + t4060*t462 + t107*t487; p_output1[14]=0.0009044*t60 - 0.0734502*t69; p_output1[15]=t4061; p_output1[16]=0.0009044*t402 - 0.0734502*t471; p_output1[17]=0.0176*t177 - 0.0734502*t219 + 0.0009044*t238; p_output1[18]=0.0176*t10*t17 + 0.0009044*t312 - 0.0734502*t316; p_output1[19]=-0.0176*t20 - 0.0734502*t373 + 0.0009044*t393; p_output1[20]=0.00016559564*t39 + 0.01344873162*t42; p_output1[21]=0.0176 - 0.0734502*t113 + 0.0009044*t123; p_output1[22]=0.0259525539; } #ifdef MATLAB_MEX_FILE #include "mex.h" #include "matrix.h" /* * Main function */ void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) { size_t mrows, ncols; double *var; double *p_output1; /* Check for proper number of arguments. */ if( nrhs != 1) { mexErrMsgIdAndTxt("MATLAB:MShaped:invalidNumInputs", "One input(s) required (var)."); } else if( nlhs > 1) { mexErrMsgIdAndTxt("MATLAB:MShaped:maxlhs", "Too many output arguments."); } /* The input must be a noncomplex double vector or scaler. */ mrows = mxGetM(prhs[0]); ncols = mxGetN(prhs[0]); if( !mxIsDouble(prhs[0]) || mxIsComplex(prhs[0]) || ( !(mrows == 54 && ncols == 1) && !(mrows == 1 && ncols == 54))) { mexErrMsgIdAndTxt( "MATLAB:MShaped:inputNotRealVector", "var is wrong."); } /* Assign pointers to each input. */ var = mxGetPr(prhs[0]); /* Create matrices for return arguments. */ plhs[0] = mxCreateDoubleMatrix((mwSize) 23, (mwSize) 1, mxREAL); p_output1 = mxGetPr(plhs[0]); /* Call the calculation subroutine. */ output1(p_output1,var); } #else // MATLAB_MEX_FILE #include "J_naturalDynamics15.hh" namespace symbolic_expression { namespace basic { void J_naturalDynamics15_raw(double *p_output1, const double *var) { // Call Subroutines output1(p_output1, var); } } } #endif // MATLAB_MEX_FILE
2fdd8ae7f68ab95ee098a6c544eed902ec4347a8
21b674ece2a632e2a06df2aea54aba06a8bde100
/DynamicProgramming/problemaTriunghiTraseu.cpp
911dd09539655d3e3f435f02a74f5c84fc9fbedf
[]
no_license
alexxozo/Algorithms
1be17f824cb3923340ee86723f82a5b14b375eb3
65579bde1858a9cd09a9906777161a6a9184e9e0
refs/heads/master
2020-03-18T17:28:18.906248
2019-01-16T19:16:49
2019-01-16T19:16:49
135,031,130
1
0
null
null
null
null
UTF-8
C++
false
false
2,235
cpp
problemaTriunghiTraseu.cpp
/* * Se consider˘a un triunghi de numere naturale nenule t cu n linii. S˘a se determine cea mai mare sum˘a pe care o putem forma dac˘a ne deplas˘am ˆın triunghi ¸si adun˘am numerele din celulele de pe traseu, regulile de deplasare fiind urm˘atoarele: Pornim de la num˘arul de pe prima linie; Din celula (i,j) putem merge doar ˆın (i+1,j) sau (i+1,j+1). Traseul se opre¸ste pe oricare dintre celulele ultimei linii. 1 3 2 7 6 9 0 5 8 4 */ #include <iostream> #include <vector> #include <climits> #include <fstream> using namespace std; void calculTraseuMaxim(vector<vector<int>> triunghi) { vector<vector<int>> sumaMaximaPePozitia(triunghi.size()); for (int j = 0; j < triunghi.size(); ++j) { sumaMaximaPePozitia[j].resize(triunghi.size()); } for (int l = 0; l < triunghi.size(); ++l) { for (int i = 0; i < triunghi.size(); ++i) { sumaMaximaPePozitia[l][i] = triunghi[l][i]; } } //sumaMaximaPePozitia[0][0] = triunghi[0][0]; for (int i = 1; i < triunghi.size(); ++i) { for (int j = 0; j < i + 1; ++j) { //int maxim = sumaMaximaPePozitia[i][j]; if (j == i) sumaMaximaPePozitia[i][j] += sumaMaximaPePozitia[i-1][j-1]; else if (j == 0) sumaMaximaPePozitia[i][j] += sumaMaximaPePozitia[i-1][j]; else sumaMaximaPePozitia[i][j] += max(sumaMaximaPePozitia[i-1][j-1], sumaMaximaPePozitia[i-1][j]); } } // pentru a afisa traseul gasim maximul de pe ultima linie si mergem in sus si in stanga-sus pe maxim ditnre ele for (int k = 0; k < triunghi.size(); ++k) { for (int i = 0; i < k + 1; ++i) { //cout<<triunghi[k][i]<<' '; cout<<sumaMaximaPePozitia[k][i]<<' '; } cout<<'\n'; } } int main() { fstream f ("E:\\FACULTATE\\SEM1\\TAP\\listaProbleme\\PD\\triunghiData.txt"); vector<vector<int>> v(4); for (int i = 0; i < 4; ++i) { v[i].resize(4); } for (int i = 0; i < 4; ++i) { for (int j = 0; j < 4; ++j) { f >> v[i][j]; } } calculTraseuMaxim(v); }
176956744efb4a1073bda416f3f55930c3180302
6b40e9dccf2edc767c44df3acd9b626fcd586b4d
/NT/shell/cpls/desknt5/install2.cpp
a6a0a1b9de6c4b1221bea040e3167df397c17613
[]
no_license
jjzhang166/WinNT5_src_20201004
712894fcf94fb82c49e5cd09d719da00740e0436
b2db264153b80fbb91ef5fc9f57b387e223dbfc2
refs/heads/Win2K3
2023-08-12T01:31:59.670176
2021-10-14T15:14:37
2021-10-14T15:14:37
586,134,273
1
0
null
2023-01-07T03:47:45
2023-01-07T03:47:44
null
UTF-8
C++
false
false
110,717
cpp
install2.cpp
/*++ Copyright (c) 1997-1999 Microsoft Corporation Module Name: install2.cpp Abstract: This file implements the display class installer. Environment: WIN32 User Mode --*/ #include <initguid.h> #include "precomp.h" #pragma hdrstop #include <devguid.h> // // Defines // #define INSETUP 1 #define INSETUP_UPGRADE 2 #define SZ_UPGRADE_DESCRIPTION TEXT("_RealDescription") #define SZ_UPGRADE_MFG TEXT("_RealMfg") #define SZ_DEFAULT_DESCRIPTION TEXT("Video Display Adapter") #define SZ_DEFAULT_MFG TEXT("Microsoft") #define SZ_LEGACY_UPGRADE TEXT("_LegacyUpgradeDevice") #define SZ_ROOT_LEGACY TEXT("ROOT\\LEGACY_") #define SZ_ROOT TEXT("ROOT\\") #define SZ_BINARY_LEN 32 #define ByteCountOf(x) ((x) * sizeof(TCHAR)) // // Data types // typedef struct _DEVDATA { SP_DEVINFO_DATA did; TCHAR szBinary[SZ_BINARY_LEN]; TCHAR szService[SZ_BINARY_LEN]; } DEVDATA, *PDEVDATA; // // Forward declarations // BOOL CDECL DeskLogError( LogSeverity Severity, UINT MsgId, ... ); DWORD DeskGetSetupFlags( VOID ); BOOL DeskIsLegacyDevNodeByPath( const PTCHAR szRegPath ); BOOL DeskIsLegacyDevNodeByDevInfo( PSP_DEVINFO_DATA pDid ); BOOL DeskIsRootDevNodeByDevInfo( PSP_DEVINFO_DATA pDid ); BOOL DeskGetDevNodePath( IN PSP_DEVINFO_DATA pDid, IN OUT PTCHAR szPath, IN LONG len ); VOID DeskSetServiceStartType( LPTSTR ServiceName, DWORD dwStartType ); DWORD DeskInstallService( IN HDEVINFO hDevInfo, IN PSP_DEVINFO_DATA pDeviceInfoData OPTIONAL, IN LPTSTR pServiceName ); DWORD DeskInstallServiceExtensions( IN HWND hwnd, IN HDEVINFO hDevInfo, IN PSP_DEVINFO_DATA pDeviceInfoData, IN PSP_DRVINFO_DATA DriverInfoData, IN PSP_DRVINFO_DETAIL_DATA DriverInfoDetailData, IN LPTSTR pServiceName ); VOID DeskMarkUpNewDevNode( IN HDEVINFO hDevInfo, IN PSP_DEVINFO_DATA pDeviceInfoData ); VOID DeskNukeDevNode( LPTSTR szService, HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDeviceInfoData ); PTCHAR DeskFindMatchingId( PTCHAR DeviceId, PTCHAR IdList ); UINT DeskDisableLegacyDeviceNodes( VOID ); VOID DeskDisableServices( ); DWORD DeskPerformDatabaseUpgrade( HINF hInf, PINFCONTEXT pInfContext, BOOL bUpgrade, PTCHAR szDriverListSection, BOOL* pbForceDeleteAppletExt ); DWORD DeskCheckDatabase( IN HDEVINFO hDevInfo, IN PSP_DEVINFO_DATA pDeviceInfoData, BOOL* pbDeleteAppletExt ); VOID DeskGetUpgradeDeviceStrings( PTCHAR Description, PTCHAR MfgName, PTCHAR ProviderName ); DWORD OnAllowInstall( IN HDEVINFO hDevInfo, IN PSP_DEVINFO_DATA pDeviceInfoData ); DWORD OnSelectBestCompatDrv( IN HDEVINFO hDevInfo, IN PSP_DEVINFO_DATA pDeviceInfoData ); DWORD OnSelectDevice( IN HDEVINFO hDevInfo, IN PSP_DEVINFO_DATA pDeviceInfoData OPTIONAL ); DWORD OnInstallDevice( IN HDEVINFO hDevInfo, IN PSP_DEVINFO_DATA pDeviceInfoData ); BOOL DeskGetVideoDeviceKey( IN HDEVINFO hDevInfo, IN PSP_DEVINFO_DATA pDeviceInfoData, IN LPTSTR pServiceName, IN DWORD DeviceX, OUT HKEY* phkDevice ); BOOL DeskIsServiceDisableable( PTCHAR szService ); VOID DeskDeleteAppletExtensions( IN HDEVINFO hDevInfo, IN PSP_DEVINFO_DATA pDeviceInfoData ); VOID DeskAEDelete( PTCHAR szDeleteFrom, PTCHAR mszExtensionsToRemove ); VOID DeskAEMove( HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDeviceInfoData, HKEY hkMoveFrom, PAPPEXT pAppExtBefore, PAPPEXT pAppExtAfter ); // // Display class installer // DWORD DisplayClassInstaller( IN DI_FUNCTION InstallFunction, IN HDEVINFO hDevInfo, IN PSP_DEVINFO_DATA pDeviceInfoData OPTIONAL ) /*++ Routine Description: This routine acts as the class installer for Display devices. Arguments: InstallFunction - Specifies the device installer function code indicating the action being performed. DeviceInfoSet - Supplies a handle to the device information set being acted upon by this install action. pDeviceInfoData - Optionally, supplies the address of a device information element being acted upon by this install action. Return Value: If this function successfully completed the requested action, the return value is NO_ERROR. If the default behavior is to be performed for the requested action, the return value is ERROR_DI_DO_DEFAULT. If an error occurred while attempting to perform the requested action, a Win32 error code is returned. --*/ { DWORD retVal = ERROR_DI_DO_DEFAULT; BOOL bHandled = TRUE; TCHAR szDevNode[LINE_LEN]; DeskOpenLog(); switch(InstallFunction) { case DIF_SELECTDEVICE : retVal = OnSelectDevice(hDevInfo, pDeviceInfoData); break; case DIF_SELECTBESTCOMPATDRV : retVal = OnSelectBestCompatDrv(hDevInfo, pDeviceInfoData); break; case DIF_ALLOW_INSTALL : retVal = OnAllowInstall(hDevInfo, pDeviceInfoData); break; case DIF_INSTALLDEVICE : retVal = OnInstallDevice(hDevInfo, pDeviceInfoData); break; default: bHandled = FALSE; break; } if (bHandled && (pDeviceInfoData != NULL) && (DeskGetDevNodePath(pDeviceInfoData, szDevNode, LINE_LEN-1))) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_125, retVal, InstallFunction, szDevNode); } else { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_057, retVal, InstallFunction); } DeskCloseLog(); // // If we did not exit from the routine by handling the call, // tell the setup code to handle everything the default way. // return retVal; } /* void StrClearHighBits(LPTSTR pszString, DWORD cchSize) { // This string can not have any high bits set } */ // Monitor class installer DWORD MonitorClassInstaller( IN DI_FUNCTION InstallFunction, IN HDEVINFO hDevInfo, IN PSP_DEVINFO_DATA pDeviceInfoData OPTIONAL ) /*++ Routine Description: This routine acts as the class installer for Display devices. Arguments: InstallFunction - Specifies the device installer function code indicating the action being performed. DeviceInfoSet - Supplies a handle to the device information set being acted upon by this install action. pDeviceInfoData - Optionally, supplies the address of a device information element being acted upon by this install action. Return Value: If this function successfully completed the requested action, the return value is NO_ERROR. If the default behavior is to be performed for the requested action, the return value is ERROR_DI_DO_DEFAULT. If an error occurred while attempting to perform the requested action, a Win32 error code is returned. --*/ { return ERROR_DI_DO_DEFAULT; } // // Handler functions // DWORD OnAllowInstall( IN HDEVINFO hDevInfo, IN PSP_DEVINFO_DATA pDeviceInfoData ) { SP_DRVINFO_DATA DriverInfoData; SP_DRVINFO_DETAIL_DATA DriverInfoDetailData; DWORD cbOutputSize; HINF hInf = INVALID_HANDLE_VALUE; TCHAR ActualInfSection[LINE_LEN]; INFCONTEXT InfContext; ULONG DevStatus = 0, DevProblem = 0; CONFIGRET Result; DWORD dwRet = ERROR_DI_DO_DEFAULT; ASSERT (pDeviceInfoData != NULL); // // Do not allow install if the device is to be removed. // Result = CM_Get_DevNode_Status(&DevStatus, &DevProblem, pDeviceInfoData->DevInst, 0); if ((Result == CR_SUCCESS) && ((DevStatus & DN_WILL_BE_REMOVED) != 0)) { // // Message Box? // DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_099); dwRet = ERROR_DI_DONT_INSTALL; goto Fallout; } // // Check for a Win95 Driver // DriverInfoData.cbSize = sizeof(SP_DRVINFO_DATA); if (!SetupDiGetSelectedDriver(hDevInfo, pDeviceInfoData, &DriverInfoData)) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_126, TEXT("OnAllowInstall: SetupDiGetSelectedDriver"), GetLastError()); goto Fallout; } DriverInfoDetailData.cbSize = sizeof(SP_DRVINFO_DETAIL_DATA); if (!(SetupDiGetDriverInfoDetail(hDevInfo, pDeviceInfoData, &DriverInfoData, &DriverInfoDetailData, DriverInfoDetailData.cbSize, &cbOutputSize)) && (GetLastError() != ERROR_INSUFFICIENT_BUFFER)) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_126, TEXT("OnAllowInstall: SetupDiGetDriverInfoDetail"), GetLastError()); goto Fallout; } // // Open the INF that installs this driver node, so we can 'pre-run' the // AddService/DelService entries in its install service install section. // hInf = SetupOpenInfFile(DriverInfoDetailData.InfFileName, NULL, INF_STYLE_WIN4, NULL); if (hInf == INVALID_HANDLE_VALUE) { // // For some reason we couldn't open the INF--this should never happen. // DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_127, TEXT("OnAllowInstall: SetupOpenInfFile")); goto Fallout; } // // Now find the actual (potentially OS/platform-specific) install section name. // if (!SetupDiGetActualSectionToInstall(hInf, DriverInfoDetailData.SectionName, ActualInfSection, ARRAYSIZE(ActualInfSection), NULL, NULL)) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_126, TEXT("OnAllowInstall: SetupDiGetActualSectionToInstall"), GetLastError()); goto Fallout; } // // Append a ".Services" to get the service install section name. // StringCchCat(ActualInfSection, ARRAYSIZE(ActualInfSection), TEXT(".Services")); // // See if the section exists. // if (!SetupFindFirstLine(hInf, ActualInfSection, NULL, &InfContext)) { // // Message Box? // DeskLogError(LogSevError, IDS_SETUPLOG_MSG_041, DriverInfoDetailData.InfFileName); dwRet = ERROR_NON_WINDOWS_NT_DRIVER; } Fallout: if (hInf != INVALID_HANDLE_VALUE) { SetupCloseInfFile(hInf); } return dwRet; } VOID DeskModifyDriverRank( IN HDEVINFO hDevInfo, IN PSP_DEVINFO_DATA pDeviceInfoData ) { // // Regardless of whether a driver is properly signed or not // we don't want any W2K drivers to be choosen by default. We have // simply found to many w2k drivers that don't work well on // windows XP. So instead lets treat all drivers signed or not // as unsigned if they were released before we started signing // windows xp drivers. [We have to do this because some w2k // drivers were incorrectly signed as winxp (5.x) drivers] // ULONG i=0; SP_DRVINFO_DATA_V2 DrvInfoData; SP_DRVINSTALL_PARAMS DrvInstallParams; SYSTEMTIME SystemTime; DrvInfoData.cbSize = sizeof(SP_DRVINFO_DATA_V2); while (SetupDiEnumDriverInfo(hDevInfo, pDeviceInfoData, SPDIT_COMPATDRIVER, i++, &DrvInfoData)) { if (FileTimeToSystemTime(&DrvInfoData.DriverDate, &SystemTime)) { if (((SystemTime.wYear < 2001) || ((SystemTime.wYear == 2001) && (SystemTime.wMonth < 6)))) { // // If this was created before Jun. 2001 then we want to make it a // worse match than our in the box driver. We'll do this by // treating it as unsigned. // ZeroMemory(&DrvInstallParams, sizeof(SP_DRVINSTALL_PARAMS)); DrvInstallParams.cbSize = sizeof(SP_DRVINSTALL_PARAMS); if (SetupDiGetDriverInstallParams(hDevInfo, pDeviceInfoData, &DrvInfoData, &DrvInstallParams)) { DrvInstallParams.Rank |= DRIVER_UNTRUSTED_RANK; SetupDiSetDriverInstallParams(hDevInfo, pDeviceInfoData, &DrvInfoData, &DrvInstallParams); } } } } } DWORD OnSelectBestCompatDrv( IN HDEVINFO hDevInfo, IN PSP_DEVINFO_DATA pDeviceInfoData ) { SP_DEVINSTALL_PARAMS DevInstParam; SP_DRVINFO_DATA DrvInfoData; PTCHAR szDesc = NULL, szMfg = NULL; HKEY hKey; DWORD dwFailed; BOOL bDummy = FALSE; DWORD dwLegacyUpgrade = 1; DWORD dwRet = ERROR_DI_DO_DEFAULT; DeskModifyDriverRank(hDevInfo, pDeviceInfoData); if (DeskIsLegacyDevNodeByDevInfo(pDeviceInfoData)) { // // Always allow root devices in select // goto Fallout; } // // Check the database to see if this is an approved driver. // We need the test only during an upgrade. // if (((DeskGetSetupFlags() & INSETUP_UPGRADE) == 0) || (DeskCheckDatabase(hDevInfo, pDeviceInfoData, &bDummy) == ERROR_SUCCESS)) { // // It is, no other work is necessary // goto Fallout; } // // This particular vid card is not allowed to run with drivers out // of the box. Note this event in the reg and save off other values. // Also, install a fake device onto the devnode so that the user doesn't // get PnP popus upon first (real) boot // DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_046); if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, SZ_UPDATE_SETTINGS, 0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS) { // // Save off the fact that upgrade was not allowed (used in migrated // display settings in the display OC // dwFailed = 1; RegSetValueEx(hKey, SZ_UPGRADE_FAILED_ALLOW_INSTALL, 0, REG_DWORD, (PBYTE) &dwFailed, sizeof(DWORD)); RegCloseKey(hKey); } // // Grab the description of the device so we can give it to the devnode // after a succesfull install of the fake devnode // ZeroMemory(&DrvInfoData, sizeof(DrvInfoData)); DrvInfoData.cbSize = sizeof(DrvInfoData); if (SetupDiEnumDriverInfo(hDevInfo, pDeviceInfoData, SPDIT_COMPATDRIVER, 0, &DrvInfoData)) { if (lstrlen(DrvInfoData.Description)) { szDesc = DrvInfoData.Description; } if (lstrlen(DrvInfoData.MfgName)) { szMfg = DrvInfoData.MfgName; } } else { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_047); } if (!szDesc) { szDesc = SZ_DEFAULT_DESCRIPTION; } if (!szMfg) { szMfg = SZ_DEFAULT_MFG; } // // Save the description of the device under the device registry key // if ((hKey = SetupDiCreateDevRegKey(hDevInfo, pDeviceInfoData, DICS_FLAG_GLOBAL, 0, DIREG_DEV, NULL, NULL)) != INVALID_HANDLE_VALUE) { RegSetValueEx(hKey, SZ_UPGRADE_DESCRIPTION, 0, REG_SZ, (PBYTE) szDesc, ByteCountOf(lstrlen(szDesc) + 1)); RegSetValueEx(hKey, SZ_UPGRADE_MFG, 0, REG_SZ, (PBYTE) szMfg, ByteCountOf(lstrlen(szMfg) + 1)); RegSetValueEx(hKey, SZ_LEGACY_UPGRADE, 0, REG_DWORD, (PBYTE)&dwLegacyUpgrade, sizeof(DWORD)); RegCloseKey(hKey); } else { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_048); } // // Make sure there isn't already a class driver list built for this // device information element // if (!SetupDiDestroyDriverInfoList(hDevInfo, pDeviceInfoData, SPDIT_CLASSDRIVER)) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_127, TEXT("OnSelectBestCompatDrv: SetupDiDestroyDriverInfoList")); } // // Build a class driver list off of display.inf. // DevInstParam.cbSize = sizeof(SP_DEVINSTALL_PARAMS); if (!SetupDiGetDeviceInstallParams(hDevInfo, pDeviceInfoData, &DevInstParam)) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_126, TEXT("OnSelectBestCompatDrv: SetupDiGetDeviceInstallParams"), GetLastError()); goto Fallout; } DevInstParam.Flags |= DI_ENUMSINGLEINF; StringCchCopy(DevInstParam.DriverPath, ARRAYSIZE(DevInstParam.DriverPath), TEXT("display.inf")); if (!SetupDiSetDeviceInstallParams(hDevInfo, pDeviceInfoData, &DevInstParam)) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_126, TEXT("OnSelectBestCompatDrv: SetupDiSetDeviceInstallParams"), GetLastError()); goto Fallout; } if (!SetupDiBuildDriverInfoList(hDevInfo, pDeviceInfoData, SPDIT_CLASSDRIVER)) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_126, TEXT("OnSelectBestCompatDrv: SetupDiBuildDriverInfoList"), GetLastError()); goto Fallout; } // // Now select the fake node. // All strings here match the inf fake device entry section. // If the INF is modified in any way WRT to these strings, // these to be changed as well // ZeroMemory(&DrvInfoData, sizeof(SP_DRVINFO_DATA)); DrvInfoData.cbSize = sizeof(SP_DRVINFO_DATA); DrvInfoData.DriverType = SPDIT_CLASSDRIVER; DeskGetUpgradeDeviceStrings(DrvInfoData.Description, DrvInfoData.MfgName, DrvInfoData.ProviderName); if (!SetupDiSetSelectedDriver(hDevInfo, pDeviceInfoData, &DrvInfoData)) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_126, TEXT("OnSelectBestCompatDrv: SetupDiSetSelectedDriver"), GetLastError()); goto Fallout; } dwRet = NO_ERROR; Fallout: return dwRet; } DWORD OnSelectDevice( IN HDEVINFO hDevInfo, IN PSP_DEVINFO_DATA pDeviceInfoData OPTIONAL ) { DWORD retVal = ERROR_DI_DO_DEFAULT; DWORD index = 0, reqSize = 0, curSize = 0; PSP_DRVINFO_DETAIL_DATA pDrvInfoDetailData = NULL; SP_DRVINFO_DATA DrvInfoData; SP_DRVINSTALL_PARAMS DrvInstallParams; // // Build the list of drivers // if (!SetupDiBuildDriverInfoList(hDevInfo, pDeviceInfoData, SPDIT_CLASSDRIVER)) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_126, TEXT("OnSelectDevice: SetupDiBuildDriverInfoList"), GetLastError()); goto Fallout; } ZeroMemory(&DrvInfoData, sizeof(SP_DRVINFO_DATA)); DrvInfoData.cbSize = sizeof(SP_DRVINFO_DATA); while (SetupDiEnumDriverInfo(hDevInfo, pDeviceInfoData, SPDIT_CLASSDRIVER, index, &DrvInfoData)) { // // Get the required size // reqSize = 0; SetupDiGetDriverInfoDetail(hDevInfo, pDeviceInfoData, &DrvInfoData, NULL, 0, &reqSize); if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_126, TEXT("OnSelectDevice: SetupDiGetDriverInfoDetail"), GetLastError()); goto Fallout; } // // Allocate memory, if needed // if ((reqSize > curSize) || (pDrvInfoDetailData == NULL)) { curSize = reqSize; if (pDrvInfoDetailData != NULL) { LocalFree(pDrvInfoDetailData); } pDrvInfoDetailData = (PSP_DRVINFO_DETAIL_DATA)LocalAlloc(LPTR, curSize); if (pDrvInfoDetailData == NULL) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_127, TEXT("OnSelectDevice: LocalAlloc")); goto Fallout; } } else { ZeroMemory(pDrvInfoDetailData, reqSize); } // // Get the driver detail info // pDrvInfoDetailData->cbSize = sizeof(SP_DRVINFO_DETAIL_DATA); if (!SetupDiGetDriverInfoDetail(hDevInfo, pDeviceInfoData, &DrvInfoData, pDrvInfoDetailData, reqSize, NULL)) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_126, TEXT("OnSelectDevice: SetupDiGetDriverInfoDetail"), GetLastError()); goto Fallout; } if (lstrcmpi(pDrvInfoDetailData->HardwareID, TEXT("LEGACY_UPGRADE_ID")) == 0) { // // Mark the legacy upgrade drv. info as "bad" so that it is // not shown when the user is prompted to select the driver // ZeroMemory(&DrvInstallParams, sizeof(SP_DRVINSTALL_PARAMS)); DrvInstallParams.cbSize = sizeof(SP_DRVINSTALL_PARAMS); if (SetupDiGetDriverInstallParams(hDevInfo, pDeviceInfoData, &DrvInfoData, &DrvInstallParams)) { DrvInstallParams.Flags |= DNF_BAD_DRIVER; SetupDiSetDriverInstallParams(hDevInfo, pDeviceInfoData, &DrvInfoData, &DrvInstallParams); } } // // Get the next driver info // ZeroMemory(&DrvInfoData, sizeof(SP_DRVINFO_DATA)); DrvInfoData.cbSize = sizeof(SP_DRVINFO_DATA); ++index; } Fallout: if (pDrvInfoDetailData) { LocalFree(pDrvInfoDetailData); } return retVal; } DWORD OnInstallDevice( IN HDEVINFO hDevInfo, IN PSP_DEVINFO_DATA pDeviceInfoData ) { DWORD retVal = ERROR_DI_DO_DEFAULT; DWORD dwLegacyUpgrade, dwSize; DISPLAY_DEVICE displayDevice; TCHAR szBuffer[LINE_LEN]; PTCHAR szHardwareIds = NULL; BOOL bDisableLegacyDevices = TRUE; ULONG len = 0; HKEY hkDevKey; // // Disable legacy devices if pDeviceInfoData is not: // - a root device or // - legacy upgrade device // if (DeskIsRootDevNodeByDevInfo(pDeviceInfoData)) { // // Root device // bDisableLegacyDevices = FALSE; } else { // // Is this the legacy upgrade device? // hkDevKey = SetupDiOpenDevRegKey(hDevInfo, pDeviceInfoData, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_ALL_ACCESS); if (hkDevKey != INVALID_HANDLE_VALUE) { dwSize = sizeof(DWORD); if (RegQueryValueEx(hkDevKey, SZ_LEGACY_UPGRADE, 0, NULL, (PBYTE)&dwLegacyUpgrade, &dwSize) == ERROR_SUCCESS) { if (dwLegacyUpgrade == 1) { // // Legacy upgrade device // bDisableLegacyDevices = FALSE; } RegDeleteValue(hkDevKey, SZ_LEGACY_UPGRADE); } RegCloseKey(hkDevKey); } } if (bDisableLegacyDevices) { if ((DeskGetSetupFlags() & INSETUP_UPGRADE) != 0) { // // Delete legacy applet extensions // DeskDeleteAppletExtensions(hDevInfo, pDeviceInfoData); } // // Disable legacy devices // DeskDisableLegacyDeviceNodes(); } retVal = DeskInstallService(hDevInfo, pDeviceInfoData, szBuffer); if ((retVal == ERROR_NO_DRIVER_SELECTED) && (DeskGetSetupFlags() & INSETUP_UPGRADE) && DeskIsLegacyDevNodeByDevInfo(pDeviceInfoData)) { // // If this is a legacy device and no driver is selected, // let the default handler install a NULL driver. // retVal = ERROR_DI_DO_DEFAULT; } // // Calling EnumDisplayDevices will rescan the devices, and if a // new device is detected, we will disable and reenable the main // device. This reset of the display device will clear up any // mess caused by installing a new driver // displayDevice.cb = sizeof(DISPLAY_DEVICE); EnumDisplayDevices(NULL, 0, &displayDevice, 0); return retVal; } // // Logging function // BOOL CDECL DeskLogError( LogSeverity Severity, UINT MsgId, ... ) /*++ Outputs a message to the setup log. Prepends "desk.cpl " to the strings and appends the correct newline chars (\r\n) --*/ { int cch; TCHAR ach[1024+40]; // Largest path plus extra TCHAR szMsg[1024]; // MsgId va_list vArgs; static int setupState = 0; if (setupState == 0) { if (DeskGetSetupFlags() & (INSETUP | INSETUP_UPGRADE)) { setupState = 1; } else { setupState = 2; } } if (setupState == 1) { *szMsg = 0; if (LoadString(hInstance, MsgId, szMsg, ARRAYSIZE(szMsg))) { *ach = 0; LoadString(hInstance, IDS_SETUPLOG_MSG_000, ach, ARRAYSIZE(ach)); cch = lstrlen(ach); va_start(vArgs, MsgId); StringCchVPrintf(&ach[cch], ARRAYSIZE(ach) - cch, szMsg, vArgs); StringCchCat(ach, ARRAYSIZE(ach), TEXT("\r\n")); va_end(vArgs); return SetupLogError(ach, Severity); } else { return FALSE; } } else { va_start(vArgs, MsgId); va_end(vArgs); return TRUE; } } // // Service Controller stuff // VOID DeskSetServiceStartType( LPTSTR ServiceName, DWORD dwStartType ) { SC_HANDLE SCMHandle; SC_HANDLE ServiceHandle; ULONG Attempts; SC_LOCK SCLock = NULL; ULONG ServiceConfigSize = 0; LPQUERY_SERVICE_CONFIG ServiceConfig; // // Open the service controller // Open the service // Change the service. // if (SCMHandle = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS)) { if (ServiceHandle = OpenService(SCMHandle, ServiceName, SERVICE_ALL_ACCESS)) { QueryServiceConfig(ServiceHandle, NULL, 0, &ServiceConfigSize); ASSERT(GetLastError() == ERROR_INSUFFICIENT_BUFFER); if (ServiceConfig = (LPQUERY_SERVICE_CONFIG) LocalAlloc(LPTR, ServiceConfigSize)) { if (QueryServiceConfig(ServiceHandle, ServiceConfig, ServiceConfigSize, &ServiceConfigSize)) { // // Attempt to acquite the database lock. // for (Attempts = 20; ((SCLock = LockServiceDatabase(SCMHandle)) == NULL) && Attempts; Attempts--) { // // Lock SC database locked // Sleep(500); } // // Change the service to demand start // if (!ChangeServiceConfig(ServiceHandle, SERVICE_NO_CHANGE, dwStartType, SERVICE_NO_CHANGE, NULL, NULL, NULL, NULL, NULL, NULL, NULL)) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_126, TEXT("DeskSetServiceStartType: ChangeServiceConfig"), GetLastError()); } if (SCLock) { UnlockServiceDatabase(SCLock); } } else { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_126, TEXT("DeskSetServiceStartType: QueryServiceConfig"), GetLastError()); } LocalFree(ServiceConfig); } else { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_127, TEXT("DeskSetServiceStartType: LocalAlloc")); } CloseServiceHandle(ServiceHandle); } else { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_126, TEXT("DeskSetServiceStartType: OpenService"), GetLastError()); } CloseServiceHandle(SCMHandle); } else { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_126, TEXT("DeskSetServiceStartType: OpenSCManager"), GetLastError()); } } // // Service Installation // DWORD DeskInstallServiceExtensions( IN HWND hwnd, IN HDEVINFO hDevInfo, IN PSP_DEVINFO_DATA pDeviceInfoData, IN PSP_DRVINFO_DATA DriverInfoData, IN PSP_DRVINFO_DETAIL_DATA DriverInfoDetailData, IN LPTSTR pServiceName ) { DWORD retVal = NO_ERROR; HINF InfFileHandle; INFCONTEXT tmpContext; TCHAR szSoftwareSection[LINE_LEN]; INT maxmem; INT numDev; #ifndef _WIN64 SP_DEVINSTALL_PARAMS DeviceInstallParams; #endif TCHAR keyName[LINE_LEN]; DWORD disposition; HKEY hkey; // // Open the inf so we can run the sections in the inf, more or less manually. // InfFileHandle = SetupOpenInfFile(DriverInfoDetailData->InfFileName, NULL, INF_STYLE_WIN4, NULL); if (InfFileHandle == INVALID_HANDLE_VALUE) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_127, TEXT("DeskInstallServiceExtensions: SetupOpenInfFile")); return ERROR_INVALID_PARAMETER; } // // Get any interesting configuration data for the inf file. // maxmem = 8; numDev = 1; StringCchPrintf(szSoftwareSection, ARRAYSIZE(szSoftwareSection), TEXT("%ws.GeneralConfigData"), DriverInfoDetailData->SectionName); if (SetupFindFirstLine(InfFileHandle, szSoftwareSection, TEXT("MaximumNumberOfDevices"), &tmpContext)) { SetupGetIntField(&tmpContext, 1, &numDev); } if (SetupFindFirstLine(InfFileHandle, szSoftwareSection, TEXT("MaximumDeviceMemoryConfiguration"), &tmpContext)) { SetupGetIntField(&tmpContext, 1, &maxmem); } // // Create the <Service> key. // StringCchPrintf(keyName, ARRAYSIZE(keyName), TEXT("System\\CurrentControlSet\\Services\\%ws"), pServiceName); RegCreateKeyEx(HKEY_LOCAL_MACHINE, keyName, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE, NULL, &hkey, &disposition); #ifndef _WIN64 // // Increase the number of system PTEs if we have cards that will need // more than 10 MB of PTE mapping space. This only needs to be done for // 32-bit NT as virtual address space is limited. On 64-bit NT there is // always enough PTE mapping address space so don't do anything as you're // likely to get it wrong. // if ((maxmem = maxmem * numDev) > 10) { // // On x86, 1K PTEs support 4 MB. // Then add 50% for other devices this type of machine may have. // NOTE - in the future, we may want to be smarter and try // to merge with whatever someone else put in there. // maxmem = maxmem * 0x400 * 3/2 + 0x3000; if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, TEXT("System\\CurrentControlSet\\Control\\Session Manager\\Memory Management"), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE, NULL, &hkey, &disposition) == ERROR_SUCCESS) { // // Check if we already set maxmem in the registry. // DWORD data; DWORD cb = sizeof(data); if ((RegQueryValueEx(hkey, TEXT("SystemPages"), NULL, NULL, (LPBYTE)(&data), &cb) != ERROR_SUCCESS) || (data < (DWORD) maxmem)) { // // Set the new value // RegSetValueEx(hkey, TEXT("SystemPages"), 0, REG_DWORD, (LPBYTE) &maxmem, sizeof(DWORD)); // // Tell the system we must reboot before running this driver // in case the system has less than 128M. // MEMORYSTATUSEX MemStatus; SYSTEM_INFO SystemInfo; GetSystemInfo(&SystemInfo); MemStatus.dwLength = sizeof(MemStatus); if ((SystemInfo.dwPageSize == 0) || (!GlobalMemoryStatusEx(&MemStatus)) || ((MemStatus.ullTotalPhys / SystemInfo.dwPageSize) <= 0x7F00)) { ZeroMemory(&DeviceInstallParams, sizeof(DeviceInstallParams)); DeviceInstallParams.cbSize = sizeof(DeviceInstallParams); if (SetupDiGetDeviceInstallParams(hDevInfo, pDeviceInfoData, &DeviceInstallParams)) { DeviceInstallParams.Flags |= DI_NEEDREBOOT; if (!SetupDiSetDeviceInstallParams(hDevInfo, pDeviceInfoData, &DeviceInstallParams)) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_126, TEXT("DeskInstallServiceExtensions: SetupDiSetDeviceInstallParams"), GetLastError()); } } else { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_126, TEXT("DeskInstallServiceExtensions: SetupDiGetDeviceInstallParams"), GetLastError()); } } } RegCloseKey(hkey); } } #endif // // We may have to do this for multiple adapters at this point. // So loop throught the number of devices, which has 1 as the default value. // For dual view, videoprt.sys will create [GUID]\000X entries as needed // and will copy all the entries from the "Settings" key to [GUID]\000X. // DWORD dwSoftwareSettings = 1; DWORD dwDeviceX = 0; do { if (dwSoftwareSettings == 1) { // // Install everything under the old video device key: // HKLM\System\CCS\Services\[SrvName]\DeviceX // numDev--; if (numDev == 0) dwSoftwareSettings++; // // For all drivers, install the information under DeviceX // We do this for legacy purposes since many drivers rely on // information written to this key. // StringCchPrintf(keyName, ARRAYSIZE(keyName), TEXT("System\\CurrentControlSet\\Services\\%ws\\Device%d"), pServiceName, numDev); if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, keyName, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE, NULL, &hkey, &disposition) != ERROR_SUCCESS) { hkey = (HKEY) INVALID_HANDLE_VALUE; } } else if (dwSoftwareSettings == 2) { // // Install everything under the new video device key: // HKLM\System\CCS\Control\Video\[GUID]\000X // if (DeskGetVideoDeviceKey(hDevInfo, pDeviceInfoData, pServiceName, dwDeviceX, &hkey)) { dwDeviceX++; } else { hkey = (HKEY) INVALID_HANDLE_VALUE; dwSoftwareSettings++; } } else if (dwSoftwareSettings == 3) { dwSoftwareSettings++; // // Install everything under the driver (aka software) key: // HKLM\System\CCS\Control\Class\[Display class]\000X\Settings // hkey = (HKEY) INVALID_HANDLE_VALUE; HKEY hKeyDriver = SetupDiOpenDevRegKey(hDevInfo, pDeviceInfoData, DICS_FLAG_GLOBAL, 0, DIREG_DRV, KEY_ALL_ACCESS); if (hKeyDriver != INVALID_HANDLE_VALUE) { // // Delete the old settings and applet extensions before // installing the new driver // SHDeleteKey(hKeyDriver, TEXT("Settings")); SHDeleteKey(hKeyDriver, TEXT("Display")); // // Create/open the settings key // if (RegCreateKeyEx(hKeyDriver, TEXT("Settings"), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL) != ERROR_SUCCESS) { hkey = (HKEY)INVALID_HANDLE_VALUE; } RegCloseKey(hKeyDriver); } } if (hkey != INVALID_HANDLE_VALUE) { // // Delete the CapabilityOverride key. // RegDeleteValue(hkey, TEXT("CapabilityOverride")); StringCchPrintf(szSoftwareSection, ARRAYSIZE(szSoftwareSection), TEXT("%ws.SoftwareSettings"), DriverInfoDetailData->SectionName); if (!SetupInstallFromInfSection(hwnd, InfFileHandle, szSoftwareSection, SPINST_REGISTRY, hkey, NULL, 0, NULL, NULL, NULL, NULL)) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_126, TEXT("DeskInstallServiceExtensions: SetupInstallFromInfSection"), GetLastError()); RegCloseKey(hkey); return ERROR_INVALID_PARAMETER; } // // Write the description of the device // RegSetValueEx(hkey, TEXT("Device Description"), 0, REG_SZ, (LPBYTE) DriverInfoDetailData->DrvDescription, ByteCountOf(lstrlen(DriverInfoDetailData->DrvDescription) + 1)); // // If this is a server sku, then lets default to all accelerations // being disabled. // OSVERSIONINFOEX osvi; ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); if (GetVersionEx((OSVERSIONINFO *) &osvi)) { if (osvi.wProductType == VER_NT_SERVER) { // // Check to see if the registry value for // Accleration.Level already exists. // ULONG Status; Status = RegQueryValueEx(hkey, TEXT("Acceleration.Level"), 0, NULL, NULL, NULL); if (Status == ERROR_FILE_NOT_FOUND) { // // the key doesn't exist already, so lets // create it. If it was already in existance, // we'll just leave the current setting. // DWORD AccelLevel = 4; // // Set acceleration level to "minimal". // RegSetValueEx(hkey, TEXT("Acceleration.Level"), 0, REG_DWORD, (PBYTE)&AccelLevel, sizeof(DWORD)); } } } RegCloseKey(hkey); } } while (dwSoftwareSettings <= 3); // // Optionally run the OpenGl section in the inf. // Ignore any errors at this point since this is an optional entry. // if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\OpenGLDrivers"), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE, NULL, &hkey, &disposition) == ERROR_SUCCESS) { StringCchPrintf(szSoftwareSection, ARRAYSIZE(szSoftwareSection), TEXT("%ws.OpenGLSoftwareSettings"), DriverInfoDetailData->SectionName); SetupInstallFromInfSection(hwnd, InfFileHandle, szSoftwareSection, SPINST_REGISTRY, hkey, NULL, 0, NULL, NULL, NULL, NULL); RegCloseKey(hkey); } SetupCloseInfFile(InfFileHandle); return retVal; } DWORD DeskInstallService( IN HDEVINFO hDevInfo, IN PSP_DEVINFO_DATA pDeviceInfoData OPTIONAL, IN LPTSTR pServiceName ) { SP_DEVINSTALL_PARAMS DeviceInstallParams; SP_DRVINFO_DATA DriverInfoData; SP_DRVINFO_DETAIL_DATA DriverInfoDetailData; DWORD cbOutputSize; HINF hInf = INVALID_HANDLE_VALUE; TCHAR ActualInfSection[LINE_LEN]; INFCONTEXT infContext; DWORD status = NO_ERROR; PAPPEXT pAppExtDisplayBefore = NULL, pAppExtDisplayAfter = NULL; PAPPEXT pAppExtDeviceBefore = NULL, pAppExtDeviceAfter = NULL; HKEY hkDisplay = 0, hkDevice = 0; // // Get the params so we can get the window handle. // DeviceInstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS); SetupDiGetDeviceInstallParams(hDevInfo, pDeviceInfoData, &DeviceInstallParams); // // Retrieve information about the driver node selected for this device. // DriverInfoData.cbSize = sizeof(SP_DRVINFO_DATA); if (!SetupDiGetSelectedDriver(hDevInfo, pDeviceInfoData, &DriverInfoData)) { status = GetLastError(); DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_126, TEXT("DeskInstallService: SetupDiGetSelectedDriver"), status); goto Fallout; } DriverInfoDetailData.cbSize = sizeof(SP_DRVINFO_DETAIL_DATA); if (!(SetupDiGetDriverInfoDetail(hDevInfo, pDeviceInfoData, &DriverInfoData, &DriverInfoDetailData, DriverInfoDetailData.cbSize, &cbOutputSize)) && (GetLastError() != ERROR_INSUFFICIENT_BUFFER)) { status = GetLastError(); DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_126, TEXT("DeskInstallService: SetupDiGetDriverInfoDetail"), status); goto Fallout; } // // Open the INF that installs this driver node, so we can 'pre-run' the // AddService/DelService entries in its install service install section. // hInf = SetupOpenInfFile(DriverInfoDetailData.InfFileName, NULL, INF_STYLE_WIN4, NULL); if (hInf == INVALID_HANDLE_VALUE) { // // For some reason we couldn't open the INF--this should never happen. // status = ERROR_INVALID_HANDLE; DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_127, TEXT("DeskInstallService: SetupOpenInfFile")); goto Fallout; } // // Now find the actual (potentially OS/platform-specific) install section name. // if (!SetupDiGetActualSectionToInstall(hInf, DriverInfoDetailData.SectionName, ActualInfSection, sizeof(ActualInfSection) / sizeof(TCHAR), NULL, NULL)) { status = GetLastError(); DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_126, TEXT("DeskInstallService: SetupDiGetActualSectionToInstall"), status); goto Fallout; } // // Append a ".Services" to get the service install section name. // StringCchCat(ActualInfSection, ARRAYSIZE(ActualInfSection), TEXT(".Services")); // // Now run the service modification entries in this section... // if (!SetupInstallServicesFromInfSection(hInf, ActualInfSection, 0)) { status = GetLastError(); DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_126, TEXT("DeskInstallService: SetupInstallServicesFromInfSection"), status); goto Fallout; } // // Get the service Name if needed (detection) // if (SetupFindFirstLine(hInf, ActualInfSection, TEXT("AddService"), &infContext)) { SetupGetStringField(&infContext, 1, pServiceName, LINE_LEN, NULL); } // // Get a snapshot of the applet extensions installed under generic // Device and Display keys // if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, REGSTR_PATH_CONTROLSFOLDER_DISPLAY_SHEX_PROPSHEET, 0, KEY_ALL_ACCESS, &hkDisplay) == ERROR_SUCCESS) { DeskAESnapshot(hkDisplay, &pAppExtDisplayBefore); } else { hkDisplay = 0; } if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, REGSTR_PATH_CONTROLSFOLDER_DEVICE_SHEX_PROPSHEET, 0, KEY_ALL_ACCESS, &hkDevice) == ERROR_SUCCESS) { DeskAESnapshot(hkDevice, &pAppExtDeviceBefore); } else { hkDevice = 0; } // // Now that the basic install has been performed (without starting the // device), write the extra data to the registry. // status = DeskInstallServiceExtensions(DeviceInstallParams.hwndParent, hDevInfo, pDeviceInfoData, &DriverInfoData, &DriverInfoDetailData, pServiceName); if (status != NO_ERROR) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_126, TEXT("DeskInstallService: DeskInstallServiceExtensions"), status); goto Fallout; } // // Do the full device install // If some of the flags (like paged pool) needed to be changed, // let's ask for a reboot right now. // Otherwise, we can actually try to start the device at this point. // if (!SetupDiInstallDevice(hDevInfo, pDeviceInfoData)) { // // Remove the device !?? // status = GetLastError(); DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_126, TEXT("DeskInstallService: SetupDiInstallDevice"), status); goto Fallout; } // // Get a snapshot of the applet extensions after the device was installed // Move the new added extensions under the driver key // if (hkDisplay != 0) { DeskAESnapshot(hkDisplay, &pAppExtDisplayAfter); DeskAEMove(hDevInfo, pDeviceInfoData, hkDisplay, pAppExtDisplayBefore, pAppExtDisplayAfter); DeskAECleanup(pAppExtDisplayBefore); DeskAECleanup(pAppExtDisplayAfter); } if (hkDevice != 0) { DeskAESnapshot(hkDevice, &pAppExtDeviceAfter); DeskAEMove(hDevInfo, pDeviceInfoData, hkDevice, pAppExtDeviceBefore, pAppExtDeviceAfter); DeskAECleanup(pAppExtDeviceBefore); DeskAECleanup(pAppExtDeviceAfter); } // // For a PnP Device which will never do detection, we want to mark // the device as DemandStart. // DeskSetServiceStartType(pServiceName, SERVICE_DEMAND_START); // // Make sure the device description and mfg are the original values // and not the marked up ones we might have made during select bext // compat drv // DeskMarkUpNewDevNode(hDevInfo, pDeviceInfoData); status = NO_ERROR; Fallout: if (hInf != INVALID_HANDLE_VALUE) { SetupCloseInfFile(hInf); } if (hkDisplay != 0) { RegCloseKey(hkDisplay); } if (hkDevice != 0) { RegCloseKey(hkDevice); } return status; } VOID DeskMarkUpNewDevNode( IN HDEVINFO hDevInfo, IN PSP_DEVINFO_DATA pDeviceInfoData ) { HKEY hKey; PTCHAR szProperty; DWORD dwSize; // // Make sure the device desc is "good". // if (DeskIsLegacyDevNodeByDevInfo(pDeviceInfoData)) { // // Don't do this to legacy devnode. // return; } // // Open the device registry key. // The real manufacturer and description were stored here // by the handler of DIF_SELECTBESTCOMPATDRV // hKey = SetupDiCreateDevRegKey(hDevInfo, pDeviceInfoData, DICS_FLAG_GLOBAL, 0, DIREG_DEV, NULL, NULL); if (hKey == INVALID_HANDLE_VALUE) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_126, TEXT("DeskMarkUpNewDevNode: SetupDiCreateDevRegKey"), GetLastError()); return; } // // Set Description // dwSize = 0; if (RegQueryValueEx(hKey, SZ_UPGRADE_DESCRIPTION, 0, NULL, NULL, &dwSize) != ERROR_SUCCESS) { goto Fallout; } ASSERT(dwSize != 0); dwSize *= sizeof(TCHAR); szProperty = (PTCHAR) LocalAlloc(LPTR, dwSize); if ((szProperty != NULL) && (RegQueryValueEx(hKey, SZ_UPGRADE_DESCRIPTION, 0, NULL, (PBYTE) szProperty, &dwSize) == ERROR_SUCCESS)) { SetupDiSetDeviceRegistryProperty(hDevInfo, pDeviceInfoData, SPDRP_DEVICEDESC, (PBYTE) szProperty, ByteCountOf(lstrlen(szProperty)+1)); RegDeleteValue(hKey, SZ_UPGRADE_DESCRIPTION); DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_004, szProperty); } LocalFree(szProperty); szProperty = NULL; // // Set Manufacturer // dwSize = 0; if (RegQueryValueEx(hKey, SZ_UPGRADE_MFG, 0, NULL, NULL, &dwSize) != ERROR_SUCCESS) { goto Fallout; } ASSERT(dwSize != 0); dwSize *= sizeof(TCHAR); szProperty = (PTCHAR) LocalAlloc(LPTR, dwSize); if ((szProperty != NULL) && (RegQueryValueEx(hKey, SZ_UPGRADE_MFG, 0, NULL, (PBYTE) szProperty, &dwSize) == ERROR_SUCCESS)) { SetupDiSetDeviceRegistryProperty(hDevInfo, pDeviceInfoData, SPDRP_MFG, (PBYTE) szProperty, ByteCountOf(lstrlen(szProperty)+1)); RegDeleteValue(hKey, SZ_UPGRADE_MFG); DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_006, szProperty); } LocalFree(szProperty); szProperty = NULL; Fallout: RegCloseKey(hKey); } // // Helper functions // BOOL DeskIsLegacyDevNodeByPath( const PTCHAR szRegPath ) { return (_tcsncicmp(SZ_ROOT_LEGACY, szRegPath, _tcslen(SZ_ROOT_LEGACY)) == 0); } BOOL DeskIsLegacyDevNodeByDevInfo( PSP_DEVINFO_DATA pDevInfoData ) { TCHAR szBuf[LINE_LEN]; return (DeskGetDevNodePath(pDevInfoData, szBuf, LINE_LEN - 1) && DeskIsLegacyDevNodeByPath(szBuf)); } BOOL DeskIsRootDevNodeByDevInfo( PSP_DEVINFO_DATA pDevInfoData ) { TCHAR szBuf[LINE_LEN]; return (DeskGetDevNodePath(pDevInfoData, szBuf, LINE_LEN - 1) && (_tcsncicmp(SZ_ROOT, szBuf, _tcslen(SZ_ROOT)) == 0)); } BOOL DeskGetDevNodePath( PSP_DEVINFO_DATA pDid, PTCHAR szPath, LONG len ) { return (CR_SUCCESS == CM_Get_Device_ID(pDid->DevInst, szPath, len, 0)); } VOID DeskNukeDevNode( LPTSTR szService, HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDeviceInfoData ) { SP_REMOVEDEVICE_PARAMS rdParams; TCHAR szPath[LINE_LEN]; // Disable the service if (szService) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_008, szService); DeskSetServiceStartType(szService, SERVICE_DISABLED); } else { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_009); } // Remove the devnode if (DeskGetDevNodePath(pDeviceInfoData, szPath, LINE_LEN)) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_010, szPath); } ZeroMemory(&rdParams, sizeof(SP_REMOVEDEVICE_PARAMS)); rdParams.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER); rdParams.ClassInstallHeader.InstallFunction = DIF_REMOVE; rdParams.Scope = DI_REMOVEDEVICE_GLOBAL; if (SetupDiSetClassInstallParams(hDevInfo, pDeviceInfoData, &rdParams.ClassInstallHeader, sizeof(SP_REMOVEDEVICE_PARAMS))) { if (!SetupDiCallClassInstaller(DIF_REMOVE, hDevInfo, pDeviceInfoData)) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_011, GetLastError()); } } else { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_012, GetLastError()); } } PTCHAR DeskFindMatchingId( PTCHAR DeviceId, PTCHAR IdList // a multi sz ) { PTCHAR currentId; if (!IdList) { return NULL; } for (currentId = IdList; *currentId; ) { if (lstrcmpi(currentId, DeviceId) == 0) { // // We have a match // return currentId; } else { // // Get to the next string in the multi sz // while (*currentId) { currentId++; } // // Jump past the null // currentId++; } } return NULL; } UINT DeskDisableLegacyDeviceNodes( VOID ) { DWORD index = 0, dwSize; UINT count = 0; HDEVINFO hDevInfo; SP_DEVINFO_DATA did; TCHAR szRegProperty[256]; PTCHAR szService; // // Let's find all the video drivers that are installed in the system // hDevInfo = SetupDiGetClassDevs((LPGUID) &GUID_DEVCLASS_DISPLAY, NULL, NULL, 0); if (hDevInfo == INVALID_HANDLE_VALUE) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_126, TEXT("DeskDisableLegacyDeviceNodes: SetupDiGetClassDevs"), GetLastError()); goto Fallout; } ZeroMemory(&did, sizeof(SP_DEVINFO_DATA)); did.cbSize = sizeof(SP_DEVINFO_DATA); while (SetupDiEnumDeviceInfo(hDevInfo, index, &did)) { // If we have a root legacy device, then don't install any new // devnode (until we get better at this). if (CR_SUCCESS == CM_Get_Device_ID(did.DevInst, szRegProperty, ARRAYSIZE(szRegProperty), 0)) { if (DeskIsLegacyDevNodeByPath(szRegProperty)) { // We have a legacy DevNode, lets disable its service and // remove its devnode szService = NULL; dwSize = sizeof(szRegProperty); if (CM_Get_DevNode_Registry_Property(did.DevInst, CM_DRP_SERVICE, NULL, szRegProperty, &dwSize, 0) == CR_SUCCESS) { // Make sure we don't disable vga or VgaSave if (!DeskIsServiceDisableable(szRegProperty)) { goto NextDevice; } szService = szRegProperty; } DeskNukeDevNode(szService, hDevInfo, &did); count++; } } NextDevice: ZeroMemory(&did, sizeof(SP_DEVINFO_DATA)); did.cbSize = sizeof(SP_DEVINFO_DATA); index++; } DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_013, count, index); SetupDiDestroyDeviceInfoList(hDevInfo); Fallout: if ((DeskGetSetupFlags() & INSETUP_UPGRADE) != 0) { DeskDisableServices(); } return count; } VOID DeskDisableServices( ) { HKEY hKey = 0; PTCHAR mszBuffer = NULL, szService = NULL; DWORD cbSize = 0; // // Retrieve the services we want to disable from the registry // if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, SZ_UPDATE_SETTINGS, 0, KEY_ALL_ACCESS, &hKey) != ERROR_SUCCESS) { hKey = 0; goto Fallout; } // // Get the size // if (RegQueryValueEx(hKey, SZ_SERVICES_TO_DISABLE, 0, NULL, NULL, &cbSize) != ERROR_SUCCESS) { goto Fallout; } // // Allocate the memory // mszBuffer = (PTCHAR)LocalAlloc(LPTR, cbSize); if (mszBuffer == NULL) { goto Fallout; } // // Get the services // if (RegQueryValueEx(hKey, SZ_SERVICES_TO_DISABLE, 0, NULL, (BYTE*)mszBuffer, &cbSize) != ERROR_SUCCESS) { goto Fallout; } // // Scan through all the services // szService = mszBuffer; while (*szService != TEXT('\0')) { // // Make sure this service is not vga // if (DeskIsServiceDisableable(szService)) { // // Disable the service // DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_008, szService); DeskSetServiceStartType(szService, SERVICE_DISABLED); } // // Go to next service // while (*szService != TEXT('\0')) { szService++; } szService++; } Fallout: if (mszBuffer != NULL) { LocalFree(mszBuffer); } if (hKey != 0) { // // Delete the SERVICES_TO_DISABLE value // RegDeleteValue(hKey, SZ_SERVICES_TO_DISABLE); // // Close the key // RegCloseKey(hKey); } } DWORD DeskPerformDatabaseUpgrade( HINF hInf, PINFCONTEXT pInfContext, BOOL bUpgrade, PTCHAR szDriverListSection, BOOL* pbDeleteAppletExt ) /*-- Remarks: This function is called once the ID of the device in question matches an ID contained in the upgrade database. We then compare the state of the system with what is contained in the database. The following algorithm is followed. If szDriverListSection is NULL or cannot be found, then bUpgrade is used If szDriverListSection is not NUL, then following table is used bUpgrade match found in DL return value TRUE no upgrade TRUE yes no upgrade FALSE no no upgrade FALSE yes upgrade essentially, a match in the DL negates bUpgrade ++*/ { HKEY hKey; DWORD dwRet = ERROR_SUCCESS, dwSize; INFCONTEXT driverListContext; TCHAR szService[32], szProperty[128]; TCHAR szRegPath[128]; HDEVINFO hDevInfo = INVALID_HANDLE_VALUE; PDEVDATA rgDevData = NULL; PSP_DEVINFO_DATA pDid; UINT iData, numData, maxData = 5, iEnum; BOOL foundMatch = FALSE; INT DeleteAppletExt = 0; UNREFERENCED_PARAMETER(pInfContext); // If no Driver list is given, life is quite simple: // just disable all legacy drivers and succeed if (!szDriverListSection) { ASSERT (pbDeleteAppletExt == NULL); DeskLogError(LogSevInformation, (bUpgrade ? IDS_SETUPLOG_MSG_014 : IDS_SETUPLOG_MSG_015)); return bUpgrade ? ERROR_SUCCESS : ERROR_DI_DONT_INSTALL; } // By default, do not disable applet extensions ASSERT (pbDeleteAppletExt != NULL); *pbDeleteAppletExt = FALSE; // Find the specified section in the inf DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_016, szDriverListSection); if (!SetupFindFirstLine(hInf, szDriverListSection, NULL, &driverListContext)) { // The section listed in the database doesn't exist! // Behave as though it wasn't there DeskLogError(LogSevInformation, (bUpgrade ? IDS_SETUPLOG_MSG_017 : IDS_SETUPLOG_MSG_018)); return bUpgrade ? ERROR_SUCCESS : ERROR_DI_DONT_INSTALL; } // Get all the video devices in the system hDevInfo = SetupDiGetClassDevs((LPGUID) &GUID_DEVCLASS_DISPLAY, NULL, NULL, 0); if (hDevInfo == INVALID_HANDLE_VALUE) { // If no display devices are found, treat this as the case where // no match was made DeskLogError(LogSevInformation, (bUpgrade ? IDS_SETUPLOG_MSG_019 : IDS_SETUPLOG_MSG_020)); return bUpgrade ? ERROR_SUCCESS : ERROR_DI_DONT_INSTALL; } rgDevData = (PDEVDATA) LocalAlloc(LPTR, maxData * sizeof(DEVDATA)); if (!rgDevData) { SetupDiDestroyDeviceInfoList(hDevInfo); return bUpgrade ? ERROR_SUCCESS : ERROR_DI_DONT_INSTALL; } iEnum = numData = 0; do { pDid = &rgDevData[numData].did; pDid->cbSize = sizeof(SP_DEVINFO_DATA); if (!SetupDiEnumDeviceInfo(hDevInfo, ++iEnum, pDid)) { break; } // If it isn't a legacy devnode, then ignore it if (CM_Get_Device_ID(pDid->DevInst, szProperty, ARRAYSIZE(szProperty), 0) == CR_SUCCESS && !DeskIsLegacyDevNodeByPath(szProperty)) { continue; } // Initially grab the service name dwSize = SZ_BINARY_LEN; if (CM_Get_DevNode_Registry_Property(pDid->DevInst, CM_DRP_SERVICE, NULL, rgDevData[numData].szService, &dwSize, 0) != CR_SUCCESS) { // couldn't get the service, ignore this device continue; } StringCchPrintf(szRegPath, ARRAYSIZE(szRegPath), TEXT("System\\CurrentControlSet\\Services\\%s"), rgDevData[numData].szService); // Try to grab the real binary name of the service if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, szRegPath, 0, KEY_READ, &hKey) == ERROR_SUCCESS) { // Parse the device map and open the registry. dwSize = ARRAYSIZE(szProperty); if (RegQueryValueEx(hKey, TEXT("ImagePath"), NULL, NULL, (LPBYTE) szProperty, &dwSize) == ERROR_SUCCESS) { // The is a binary, extract the name, which will be of the form // ...\driver.sys LPTSTR pszDriver, pszDriverEnd; pszDriver = szProperty; pszDriverEnd = szProperty + lstrlen(szProperty); while(pszDriverEnd != pszDriver && *pszDriverEnd != TEXT('.')) { pszDriverEnd--; } *pszDriverEnd = UNICODE_NULL; while(pszDriverEnd != pszDriver && *pszDriverEnd != TEXT('\\')) { pszDriverEnd--; } pszDriverEnd++; // // If pszDriver and pszDriverEnd are different, we now // have the driver name. // if (pszDriverEnd > pszDriver && lstrlen(pszDriverEnd) < SZ_BINARY_LEN) { StringCchCopy(rgDevData[numData].szBinary, ARRAYSIZE(rgDevData[numData].szBinary), pszDriverEnd); } } RegCloseKey(hKey); } else { // // no service at all, consider it bogus // continue; } if (++numData == maxData) { DEVDATA *tmp; UINT oldMax = maxData; maxData <<= 1; // // Alloc twice as many, copy them over, zero out the new memory // and free the old list // tmp = (PDEVDATA) LocalAlloc(LPTR, maxData * sizeof(DEVDATA)); memcpy(tmp, rgDevData, oldMax * sizeof(DEVDATA)); ZeroMemory(tmp + oldMax, sizeof(DEVDATA) * oldMax); LocalFree(rgDevData); rgDevData = tmp; } } while (1); DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_021, numData); // // Assume that no matches have been made // dwRet = (bUpgrade ? ERROR_SUCCESS : ERROR_DI_DONT_INSTALL); if (numData != 0) { // // There are legacy devices to check against... // do { LPTSTR szValue; memset(szService, 0, sizeof(szService)); dwSize = sizeof(szService) / sizeof(TCHAR); if ((SetupGetFieldCount(&driverListContext) < 1) || !SetupGetStringField(&driverListContext, 1, szService, dwSize, &dwSize)) { continue; } if (szService[0] == TEXT('\0')) { continue; } for (iData = 0; iData < numData; iData++) { if (rgDevData[iData].szBinary[0] != TEXT('\0')) { szValue = rgDevData[iData].szBinary; } else { szValue = rgDevData[iData].szService; } if (lstrcmpi(szService, szValue) == 0) { DeskLogError(LogSevInformation, (bUpgrade ? IDS_SETUPLOG_MSG_022 : IDS_SETUPLOG_MSG_023)); dwRet = (bUpgrade ? ERROR_DI_DONT_INSTALL : ERROR_SUCCESS); foundMatch = TRUE; // // In case we fail upgrade, do we want to disable applet // extensions? // if ((dwRet == ERROR_DI_DONT_INSTALL) && (SetupGetFieldCount(&driverListContext) >= 2) && SetupGetIntField(&driverListContext, 2, &DeleteAppletExt)) { *pbDeleteAppletExt = (DeleteAppletExt != 0); } break; } } } while (SetupFindNextLine(&driverListContext, &driverListContext)); } SetupDiDestroyDeviceInfoList(hDevInfo); LocalFree(rgDevData); if (!foundMatch) { DeskLogError(LogSevInformation, (bUpgrade ? IDS_SETUPLOG_MSG_024 : IDS_SETUPLOG_MSG_025), szDriverListSection); } return dwRet; } DWORD DeskCheckDatabase( IN HDEVINFO hDevInfo, IN PSP_DEVINFO_DATA pDeviceInfoData, BOOL* pbDeleteAppletExt ) { DWORD dwRet = ERROR_SUCCESS, dwSize, dwValue; HINF hInf; HKEY hKeyUpdate; INFCONTEXT infContext; BOOL foundMatch = FALSE; TCHAR szDatabaseId[200]; TCHAR szDriverListSection[100]; PTCHAR szHardwareIds = NULL, szCompatIds = NULL; CONFIGRET cr; ULONG len; PTCHAR szMatchedId = NULL; int upgrade = FALSE; BOOL IsNTUpgrade = FALSE; TCHAR szDatabaseInf[] = TEXT("display.inf"); TCHAR szDatabaseSection[] = TEXT("VideoUpgradeDatabase"); ASSERT (pDeviceInfoData != NULL); ASSERT (pbDeleteAppletExt != NULL); ASSERT ((DeskGetSetupFlags() & INSETUP_UPGRADE) != 0); *pbDeleteAppletExt = FALSE; // // All of the following values were placed here by our winnt32 migration dll // Find out what version of windows we are upgrading from // if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, SZ_UPDATE_SETTINGS, 0, KEY_READ, &hKeyUpdate) == ERROR_SUCCESS) { dwSize = sizeof(DWORD); if ((RegQueryValueEx(hKeyUpdate, SZ_UPGRADE_FROM_PLATFORM, NULL, NULL, (PBYTE) &dwValue, &dwSize) == ERROR_SUCCESS) && (dwValue == VER_PLATFORM_WIN32_NT)) { IsNTUpgrade = TRUE; } RegCloseKey(hKeyUpdate); } if (!IsNTUpgrade) { return ERROR_SUCCESS; } // // Get the hardware ID // len = 0; cr = CM_Get_DevNode_Registry_Property(pDeviceInfoData->DevInst, CM_DRP_HARDWAREID, NULL, NULL, &len, 0); if (cr == CR_BUFFER_SMALL) { szHardwareIds = (PTCHAR) LocalAlloc(LPTR, len * sizeof(TCHAR)); if (szHardwareIds) { CM_Get_DevNode_Registry_Property(pDeviceInfoData->DevInst, CM_DRP_HARDWAREID, NULL, szHardwareIds, &len, 0); if (DeskFindMatchingId(TEXT("LEGACY_UPGRADE_ID"), szHardwareIds)) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_031); LocalFree(szHardwareIds); return ERROR_SUCCESS; } } } // // Get the compatible ID // len = 0; cr = CM_Get_DevNode_Registry_Property(pDeviceInfoData->DevInst, CM_DRP_COMPATIBLEIDS, NULL, NULL, &len, 0); if (cr == CR_BUFFER_SMALL) { szCompatIds = (PTCHAR) LocalAlloc(LPTR, len * sizeof(TCHAR)); if (szCompatIds) { CM_Get_DevNode_Registry_Property(pDeviceInfoData->DevInst, CM_DRP_COMPATIBLEIDS, NULL, szCompatIds, &len, 0); } } if (!szHardwareIds && !szCompatIds) { // No IDs to look up! Assume success. DeskLogError(LogSevWarning, IDS_SETUPLOG_MSG_032); return ERROR_SUCCESS; } hInf = SetupOpenInfFile(szDatabaseInf, NULL, INF_STYLE_WIN4, NULL); if (hInf == INVALID_HANDLE_VALUE) { // Couldn't open the inf. This shouldn't happen. // Use default upgrade logic DeskLogError(LogSevWarning, IDS_SETUPLOG_MSG_033); return ERROR_SUCCESS; } if (!SetupFindFirstLine(hInf, szDatabaseSection, NULL, &infContext)) { // Couldn't find the section or there are no entries in it. // Use default upgrade logic DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_034, szDatabaseSection); } else { do { dwSize = ARRAYSIZE(szDatabaseId); if (!SetupGetStringField(&infContext, 0, szDatabaseId, dwSize, &dwSize)) { continue; } szMatchedId = DeskFindMatchingId(szDatabaseId, szHardwareIds); if (!szMatchedId) { szMatchedId = DeskFindMatchingId(szDatabaseId, szCompatIds); } if (szMatchedId) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_035, szMatchedId); // Do something here and then get out of the loop SetupGetIntField(&infContext, 1, &upgrade); if (SetupGetFieldCount(&infContext) >= 2) { dwSize = ARRAYSIZE(szDriverListSection); SetupGetStringField(&infContext, 2, szDriverListSection, dwSize, &dwSize); dwRet = DeskPerformDatabaseUpgrade(hInf, &infContext, upgrade, szDriverListSection, pbDeleteAppletExt); } else { dwRet = DeskPerformDatabaseUpgrade(hInf, &infContext, upgrade, NULL, NULL); } break; } } while (SetupFindNextLine(&infContext, &infContext)); } if (szHardwareIds) { LocalFree(szHardwareIds); } if (szCompatIds) { LocalFree(szCompatIds); } if (hInf != INVALID_HANDLE_VALUE) { SetupCloseInfFile(hInf); } if (dwRet == ERROR_SUCCESS) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_039); } else { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_040); } return dwRet; } VOID DeskGetUpgradeDeviceStrings( PTCHAR Description, PTCHAR MfgName, PTCHAR ProviderName ) { TCHAR szDisplay[] = TEXT("display.inf"); TCHAR szDeviceStrings[] = TEXT("SystemUpgradeDeviceStrings"); TCHAR szValue[LINE_LEN]; HINF hInf; INFCONTEXT infContext; DWORD dwSize; hInf = SetupOpenInfFile(szDisplay, NULL, INF_STYLE_WIN4, NULL); if (hInf == INVALID_HANDLE_VALUE) { goto GetStringsError; } if (!SetupFindFirstLine(hInf, szDeviceStrings, NULL, &infContext)) goto GetStringsError; do { dwSize = ARRAYSIZE(szValue); if (!SetupGetStringField(&infContext, 0, szValue, dwSize, &dwSize)) { continue; } dwSize = LINE_LEN; if (lstrcmp(szValue, TEXT("Mfg")) ==0) { SetupGetStringField(&infContext, 1, MfgName, dwSize, &dwSize); } else if (lstrcmp(szValue, TEXT("Provider")) == 0) { SetupGetStringField(&infContext, 1, ProviderName, dwSize, &dwSize); } else if (lstrcmp(szValue, TEXT("Description")) == 0) { SetupGetStringField(&infContext, 1, Description, dwSize, &dwSize); } } while (SetupFindNextLine(&infContext, &infContext)); SetupCloseInfFile(hInf); return; GetStringsError: if (hInf != INVALID_HANDLE_VALUE) { SetupCloseInfFile(hInf); } StringCchCopy(Description, ARRAYSIZE(Description), TEXT("Video Upgrade Device")); StringCchCopy(MfgName, ARRAYSIZE(MfgName), TEXT("(Standard display types)")); StringCchCopy(ProviderName, ARRAYSIZE(ProviderName), TEXT("Microsoft")); } DWORD DeskGetSetupFlags( VOID ) { HKEY hkey; DWORD retval = 0; TCHAR data[256]; DWORD cb; LPTSTR regstring; hkey = NULL; if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("System\\Setup"), 0, KEY_READ | KEY_WRITE, &hkey) == ERROR_SUCCESS) { cb = 256; if (RegQueryValueEx(hkey, TEXT("SystemSetupInProgress"), NULL, NULL, (LPBYTE)(data), &cb) == ERROR_SUCCESS) { retval |= *((LPDWORD)(data)) ? INSETUP : 0; regstring = TEXT("System\\Video_Setup"); } else { regstring = TEXT("System\\Video_NO_Setup"); } cb = 256; if (RegQueryValueEx(hkey, TEXT("UpgradeInProgress"), NULL, NULL, (LPBYTE)(data), &cb) == ERROR_SUCCESS) { retval |= *((LPDWORD)(data)) ? INSETUP_UPGRADE : 0; regstring = TEXT("System\\Video_Setup_Upgrade"); } else { regstring = TEXT("System\\Video_Setup_Clean"); } if (hkey) { RegCloseKey(hkey); } } return retval; } BOOL DeskGetVideoDeviceKey( IN HDEVINFO hDevInfo, IN PSP_DEVINFO_DATA pDeviceInfoData, IN LPTSTR pServiceName, IN DWORD DeviceX, OUT HKEY* phkDevice ) { BOOL retVal = FALSE; HKEY hkPnP = (HKEY)INVALID_HANDLE_VALUE; HKEY hkCommonSubkey = (HKEY)INVALID_HANDLE_VALUE; GUID DeviceKeyGUID; LPWSTR pwstrGUID= NULL; LPTSTR ptstrGUID= NULL; LPTSTR pBuffer = NULL; DWORD dwSize, len; // // Open the PnP key // hkPnP = SetupDiCreateDevRegKey(hDevInfo, pDeviceInfoData, DICS_FLAG_GLOBAL, 0, DIREG_DEV, NULL, NULL); if (hkPnP == INVALID_HANDLE_VALUE) { // // Videoprt.sys handles the legacy device case. // goto Fallout; } // // Try to get the GUID from the PnP key // dwSize = 0; if (RegQueryValueEx(hkPnP, SZ_GUID, 0, NULL, NULL, &dwSize) == ERROR_SUCCESS) { // // The GUID is there so use it. // len = lstrlen(SZ_VIDEO_DEVICES); DWORD cbBuffer = dwSize + (len + 6) * sizeof(TCHAR); pBuffer = (LPTSTR)LocalAlloc(LPTR, cbBuffer); if (pBuffer == NULL) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_128, TEXT("LocalAlloc")); goto Fallout; } StringCbCopy(pBuffer, cbBuffer, SZ_VIDEO_DEVICES); if (RegQueryValueEx(hkPnP, SZ_GUID, 0, NULL, (PBYTE)(pBuffer + len), &dwSize) != ERROR_SUCCESS) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_128, TEXT("RegQueryValueEx")); goto Fallout; } DWORD cchGUID = lstrlen(pBuffer); StringCbPrintf(pBuffer + cchGUID, cbBuffer - (cchGUID * sizeof(TCHAR)), TEXT("\\%04d"), DeviceX); if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, pBuffer, 0, KEY_ALL_ACCESS, phkDevice) != ERROR_SUCCESS) { if (DeviceX == 0) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_128, TEXT("RegOpenKeyEx")); } goto Fallout; } retVal = TRUE; } else { if (DeviceX > 0) { // // For dual-view, the class installer handles only the primary view. // Secondary views are handled by videoprt.sys // goto Fallout; } // // The GUID is not there so create a new one. // if (CoCreateGuid(&DeviceKeyGUID) != S_OK) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_128, TEXT("CoCreateGuid")); goto Fallout; } if (StringFromIID(DeviceKeyGUID, &pwstrGUID) != S_OK) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_128, TEXT("StringFromIID")); pwstrGUID = NULL; goto Fallout; } // // Convert the string if necessary // #ifdef UNICODE ptstrGUID = pwstrGUID; #else SIZE_T cch = wcslen(pwstrGUID) + 1; ptstrGUID = LocalAlloc(LPTR, cch); if (ptstrGUID == NULL) goto Fallout; WideCharToMultiByte(CP_ACP, 0, pwstrGUID, -1, ptstrGUID, cch, NULL, NULL); #endif // // Upcase the string // CharUpper(ptstrGUID); // // Allocate the memory // len = max((lstrlen(SZ_VIDEO_DEVICES) + lstrlen(ptstrGUID) + max(6, lstrlen(SZ_COMMON_SUBKEY) + 1)), (lstrlen(SZ_SERVICES_PATH) + lstrlen(pServiceName) + lstrlen(SZ_COMMON_SUBKEY) + 1)); pBuffer = (LPTSTR)LocalAlloc(LPTR, len * sizeof(TCHAR)); if (pBuffer == NULL) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_128, TEXT("LocalAlloc")); goto Fallout; } // // Save the service name // StringCchPrintf(pBuffer, len, TEXT("%s%s%s"), SZ_VIDEO_DEVICES, ptstrGUID, SZ_COMMON_SUBKEY); if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, pBuffer, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE, NULL, &hkCommonSubkey, NULL) != ERROR_SUCCESS) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_128, TEXT("RegCreateKeyEx")); hkCommonSubkey = (HKEY)INVALID_HANDLE_VALUE; goto Fallout; } if (RegSetValueEx(hkCommonSubkey, SZ_SERVICE, 0, REG_SZ, (LPBYTE)pServiceName, (lstrlen(pServiceName) + 1) * sizeof(TCHAR)) != ERROR_SUCCESS) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_128, TEXT("RegSetValueEx")); goto Fallout; } RegCloseKey(hkCommonSubkey); hkCommonSubkey = (HKEY)INVALID_HANDLE_VALUE; StringCchPrintf(pBuffer, len, TEXT("%s%s%s"), SZ_SERVICES_PATH, pServiceName, SZ_COMMON_SUBKEY); if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, pBuffer, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE, NULL, &hkCommonSubkey, NULL) != ERROR_SUCCESS) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_128, TEXT("RegCreateKeyEx")); hkCommonSubkey = (HKEY)INVALID_HANDLE_VALUE; goto Fallout; } if (RegSetValueEx(hkCommonSubkey, SZ_SERVICE, 0, REG_SZ, (LPBYTE)pServiceName, (lstrlen(pServiceName) + 1) * sizeof(TCHAR)) != ERROR_SUCCESS) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_128, TEXT("RegSetValueEx")); goto Fallout; } // // Build the new registry key // StringCchPrintf(pBuffer, len, TEXT("%s%s\\0000"), SZ_VIDEO_DEVICES, ptstrGUID); // // Create the key // if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, pBuffer, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE, NULL, phkDevice, NULL) != ERROR_SUCCESS) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_128, TEXT("RegCreateKeyEx")); goto Fallout; } // // Store the GUID under the PnP key // if (RegSetValueEx(hkPnP, SZ_GUID, 0, REG_SZ, (LPBYTE)ptstrGUID, (lstrlen(ptstrGUID) + 1) * sizeof(TCHAR)) != ERROR_SUCCESS) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_128, TEXT("RegSetValueEx")); RegCloseKey(*phkDevice); *phkDevice = (HKEY)INVALID_HANDLE_VALUE; goto Fallout; } retVal = TRUE; } Fallout: // // Clean-up // if (hkCommonSubkey != INVALID_HANDLE_VALUE) { RegCloseKey(hkCommonSubkey); } if (pBuffer != NULL) { LocalFree(pBuffer); } #ifndef UNICODE if (ptstrGUID != NULL) { LocalFree(ptstrGUID); } #endif if (pwstrGUID != NULL) { CoTaskMemFree(pwstrGUID); } if (hkPnP != INVALID_HANDLE_VALUE) { RegCloseKey(hkPnP); } return retVal; } // DeskGetVideoDeviceKey BOOL DeskIsServiceDisableable( PTCHAR szService ) { return ((lstrcmp(szService, TEXT("vga")) != 0) && (lstrcmp(szService, TEXT("VgaSave")) != 0)); } VOID DeskDeleteAppletExtensions( IN HDEVINFO hDevInfo, IN PSP_DEVINFO_DATA pDeviceInfoData ) { PTCHAR mszBuffer = NULL; HKEY hKeyUpdate; DWORD dwSize, dwPlatform = VER_PLATFORM_WIN32_NT, dwMajorVer = 5; BOOL bDeleteAppletExt = FALSE; DWORD cbSize = 0; // // Open the upgrade registry key // if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, SZ_UPDATE_SETTINGS, 0, KEY_READ, &hKeyUpdate) != ERROR_SUCCESS) { // // No big deal // return; } // // Retrieve the applet extensions we want to delete from the registry // Get the size first. // if (RegQueryValueEx(hKeyUpdate, SZ_APPEXT_TO_DELETE, 0, NULL, NULL, &cbSize) != ERROR_SUCCESS) { goto Fallout; } // // Allocate the memory // mszBuffer = (PTCHAR)LocalAlloc(LPTR, cbSize); if (mszBuffer == NULL) { goto Fallout; } // // Get the extensions // if ((RegQueryValueEx(hKeyUpdate, SZ_APPEXT_TO_DELETE, 0, NULL, (BYTE*)mszBuffer, &cbSize) != ERROR_SUCCESS) || (*mszBuffer == TEXT('\0'))) { goto Fallout; } // // Read the OS version we are upgrading from from the registry // dwSize = sizeof(DWORD); RegQueryValueEx(hKeyUpdate, SZ_UPGRADE_FROM_PLATFORM, NULL, NULL, (PBYTE) &dwPlatform, &dwSize); dwSize = sizeof(DWORD); RegQueryValueEx(hKeyUpdate, SZ_UPGRADE_FROM_MAJOR_VERSION, NULL, NULL, (PBYTE) &dwMajorVer, &dwSize); // // Don't do anything for Win3x or Win9x // if (dwPlatform != VER_PLATFORM_WIN32_NT) { goto Fallout; } if ((dwMajorVer < 5) && (DeskCheckDatabase(hDevInfo, pDeviceInfoData, &bDeleteAppletExt) != ERROR_SUCCESS) && (!bDeleteAppletExt)) { goto Fallout; } DeskAEDelete(REGSTR_PATH_CONTROLSFOLDER_DISPLAY_SHEX_PROPSHEET, mszBuffer); Fallout: RegCloseKey(hKeyUpdate); if (mszBuffer != NULL) { LocalFree(mszBuffer); } } VOID DeskAEDelete( PTCHAR szDeleteFrom, PTCHAR mszExtensionsToRemove ) { TCHAR szKeyName[MAX_PATH]; HKEY hkDeleteFrom, hkExt; DWORD cSubKeys = 0, cbSize = 0; TCHAR szDefaultValue[MAX_PATH]; PTCHAR szValue; if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, szDeleteFrom, 0, KEY_ALL_ACCESS, &hkDeleteFrom) == ERROR_SUCCESS) { if (RegQueryInfoKey(hkDeleteFrom, NULL, NULL, NULL, &cSubKeys, NULL, NULL, NULL, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { while (cSubKeys--) { if (RegEnumKey(hkDeleteFrom, cSubKeys, szKeyName, ARRAYSIZE(szKeyName)) == ERROR_SUCCESS) { int iComp = -1; if (RegOpenKeyEx(hkDeleteFrom, szKeyName, 0, KEY_READ, &hkExt) == ERROR_SUCCESS) { cbSize = sizeof(szDefaultValue); if ((RegQueryValueEx(hkExt, NULL, 0, NULL, (PBYTE)szDefaultValue, &cbSize) == ERROR_SUCCESS) && (szDefaultValue[0] != TEXT('\0'))) { szValue = mszExtensionsToRemove; while (*szValue != TEXT('\0')) { iComp = lstrcmpi(szDefaultValue, szValue); if (iComp <= 0) { break; } while (*szValue != TEXT('\0')) szValue++; szValue++; } } RegCloseKey(hkExt); } if (iComp == 0) { if (SHDeleteKey(hkDeleteFrom, szKeyName) == ERROR_SUCCESS) { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_098, szKeyName); } else { DeskLogError(LogSevInformation, IDS_SETUPLOG_MSG_097); } } } } } RegCloseKey(hkDeleteFrom); } } VOID DeskAEMove( HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDeviceInfoData, HKEY hkMoveFrom, PAPPEXT pAppExtBefore, PAPPEXT pAppExtAfter ) { HKEY hkDrvKey = (HKEY)INVALID_HANDLE_VALUE; HKEY hkMoveTo = 0, hkMovedKey; PAPPEXT pAppExtMove = NULL; hkDrvKey = SetupDiOpenDevRegKey(hDevInfo, pDeviceInfoData, DICS_FLAG_GLOBAL, 0, DIREG_DRV, KEY_ALL_ACCESS); if (hkDrvKey == INVALID_HANDLE_VALUE) { goto Fallout; } while (pAppExtAfter != NULL) { BOOL bMove = FALSE; pAppExtMove = pAppExtAfter; if (pAppExtBefore != NULL) { int iComp = lstrcmpi(pAppExtBefore->szDefaultValue, pAppExtAfter->szDefaultValue); if (iComp < 0) { pAppExtBefore = pAppExtBefore->pNext; } else if (iComp == 0) { pAppExtBefore = pAppExtBefore->pNext; pAppExtAfter = pAppExtAfter->pNext; } else { bMove = TRUE; pAppExtAfter = pAppExtAfter->pNext; } } else { bMove = TRUE; pAppExtAfter = pAppExtAfter->pNext; } if (bMove) { SHDeleteKey(hkMoveFrom, pAppExtMove->szKeyName); if (hkMoveTo == 0) { if (RegCreateKeyEx(hkDrvKey, TEXT("Display\\") STRREG_SHEX_PROPSHEET, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkMoveTo, NULL) != ERROR_SUCCESS) { hkMoveTo = 0; goto Fallout; } } if (RegCreateKeyEx(hkMoveTo, pAppExtMove->szKeyName, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkMovedKey, NULL) == ERROR_SUCCESS) { RegSetValueEx(hkMovedKey, NULL, 0, REG_SZ, (PBYTE)(pAppExtMove->szDefaultValue), (lstrlen(pAppExtMove->szDefaultValue) + 1) * sizeof(TCHAR)); // // Make sure we check for duplicate applet extension when // the advanced page is opened for the first time // DWORD CheckForDuplicates = 1; RegSetValueEx(hkDrvKey, TEXT("DeskCheckForDuplicates"), 0, REG_DWORD, (LPBYTE)&CheckForDuplicates, sizeof(DWORD)); RegCloseKey(hkMovedKey); } } } Fallout: if (hkMoveTo != 0) { RegCloseKey(hkMoveTo); } if (hkDrvKey != INVALID_HANDLE_VALUE) { RegCloseKey(hkDrvKey); } }
323c9fdf4388c094a92cd36b407714c4ad4fa874
9881dbe0e997a4ff2d21c5c7bd75447f9ff75d92
/Scientific_Visualization/codes/writeNetCDF.cpp
6e4e63bafa13b5eda2534f5d0fac667f55e1cc0c
[]
no_license
kvan1231/westgrid_workshop_2019
da1e58f83896ee52d658df6175fc5a02ee3f68e5
bf0f9c5990aa0c26e94fc104eea696bc793e6200
refs/heads/main
2023-08-02T14:30:14.089449
2021-09-16T22:56:32
2021-09-16T22:56:32
407,331,417
1
0
null
null
null
null
UTF-8
C++
false
false
1,317
cpp
writeNetCDF.cpp
#include <iostream> #include <netcdf> #include <fstream> #include <math.h> using namespace std; using namespace netCDF; using namespace netCDF::exceptions; /* this program writes data in NetCDF */ #define nx 100 #define ny nx #define nz nx #define NC_ERR 2 float data[nx][ny][nz]; // neeed contiguous storage for NetCDF, so no dynamic allocation; allocate in global heap int main() { int ncid, x_dimid, y_dimid, z_dimid; int dimids[3], retval, i, j, k; float x, y, z, r, r0 = 0.4; for (i = 0; i < nx; i++) { if (nx > 100 && i%100 == 0) cout << i << endl; x = ((float)i+0.5)/(float)nx; for (j = 0; j < ny; j++) { y = ((float)j+0.5)/(float)ny; for (k = 0; k < nz; k++) { z = ((float)k+0.5)/(float)nz; r = sqrt(pow(x-0.5,2)+pow(y-0.5,2)); data[i][j][k] = exp(-sqrt(pow(z-0.5,2)+pow(r-r0,2))); } } } try { NcFile fileHandle("volume.nc", NcFile::replace); NcDim xDim = fileHandle.addDim("x", nx); NcDim yDim = fileHandle.addDim("y", ny); NcDim zDim = fileHandle.addDim("z", nz); vector<NcDim> dims; dims.push_back(xDim); dims.push_back(yDim); dims.push_back(zDim); NcVar varID = fileHandle.addVar("density", ncFloat, dims); varID.putVar(data); return 0; } catch(NcException& e) { e.what(); return NC_ERR; } }
f7a289e5fb6a85092fd4d7a40844b10f2285d8e5
eb7c3395b5edc43f1333cd13db1272a5124532b6
/deptran/executor.h
a9cfa15f4f674e3ab0714fc8c0850d04dd01a029
[]
no_license
lolo-pop/dast
6febd59ed5efe6fa2f8c227cd874e0512cc31f84
3a3dcb5225e0690bcd874be1d9d7f80f168735c1
refs/heads/master
2023-03-19T20:08:32.370128
2021-03-16T14:40:40
2021-03-16T14:40:40
null
0
0
null
null
null
null
UTF-8
C++
false
false
806
h
executor.h
#pragma once #include "__dep__.h" #include "constants.h" namespace rococo { class TxnRegistry; class Scheduler; class DTxn; class SimpleCommand; class TxnCommand; class Executor { public: Recorder* recorder_ = nullptr; TxnRegistry* txn_reg_ = nullptr; mdb::Txn *mdb_txn_ = nullptr; Scheduler* sched_ = nullptr; DTxn* dtxn_ = nullptr; TxnCommand* txn_cmd_ = nullptr; cmdid_t cmd_id_ = 0; int phase_ = -1; Executor() = delete; Executor(txnid_t txn_id, Scheduler* sched); virtual void Execute(const SimpleCommand &cmd, rrr::i32 *res, map<int32_t, Value> &output); virtual void Execute(const vector<SimpleCommand>& cmd, TxnOutput* output) ; virtual ~Executor(); mdb::Txn* mdb_txn(); }; } // namespace rococo
238ea592569e7c7ebe5c5e24c75bc936e5cc6ab4
fffd991af9e271317935d05fbebd4d0886c2146f
/PracticasED/Practica3/include/list.cpp
74a2644fd51caf077d3a2c0c12114aef4d2980e5
[]
no_license
jocaro97/ED
e541f65d285df15cb81055f208031c8068eb4bff
169a9a7fcc9903e3ee348b946602250025de9520
refs/heads/master
2022-07-18T06:07:47.250179
2020-05-18T21:12:04
2020-05-18T21:12:04
265,046,448
0
0
null
null
null
null
UTF-8
C++
false
false
1,303
cpp
list.cpp
template<class T> List<T>::List(){ ultima = cab = new Celda; cab->siguiente = 0;; } template<class T> List<T>::List(const List& l){ ultima = cab = new Celda; Celda *cel = l.cab->sig; while (cel->siguiente != 0) { ultima->siguiente = new Celda; ultima = ultima->siguiente; cel = cel->siguiente; ultima->elemento = cel->elemento; } ultima->siguiente = 0; } template<class T> List<T>::~List(){ Celda *cel; while (cab != 0) { cel = cab; cab = cab->siguiente; delete cel; } } template<class T> List<T>& List<T>::operator=(const List& l){ List aux(l); Celda cab_aux = cab; cab = aux.cab; aux.cab = cab_aux; Celda ultima_aux = ultima; ultima = l.ultima; l.ultima = ultima_aux; return *this; } template<class T> bool List<T>::vacia()const{ return (cab->siguiente == 0); } template<class T> void List<T>::pushback(T elem){ Celda *cel = new Celda; cel->elemento = elem; cel->siguiente = 0; ultima->siguiente = cel; ultima = cel; } template<class T> void List<T>::popback(){ Celda *cel = cab; while (cel->siguiente != ultima) { cel = cel->siguiente; } delete ultima; cel->siguiente = 0; ultima = cel; } template<class T> T& List<T>::getLast(){ return ultima->elemento; } template<class T> const T& List<T>::getLast()const{ return ultima->elemento; }
8c7a35a2009d95688a0a1b3912416abb9a117c03
c7200aedadf32afa77c6f009f86cd51b12b18362
/vivos/vivos/mmdc_game_state.h
8d6b90b89c79e5aedf5671dfc8d693a0e5ef54e0
[ "Apache-2.0" ]
permissive
Billy2600/vivos
5c42786db487de3ed8d3180370f4c20cc14133e6
fee0a16f0892f8f585258d41d73530dd1a230226
refs/heads/master
2016-09-06T04:52:41.056518
2015-01-28T22:37:12
2015-01-28T22:37:12
22,890,804
0
0
null
null
null
null
UTF-8
C++
false
false
1,740
h
mmdc_game_state.h
/* ============================================================ GameState Super class for all the states in the game Classes derived from this one should have St before their name ===========================================================*/ #pragma once #include <SFML/Graphics.hpp> #include <queue> #include <vector> #include "mmdc_data_types.h" #include "mmdc_act_player.h" class mmdcGameState { protected: // Change state variables states_t changeTo; // State we want to change to bool change; // Change state flag bool pause; // Pause logic std::vector < std::shared_ptr<mmdcActor> > actors; // Actor list public: // Constructor mmdcGameState() { change = false; pause = false; } // Get change flag bool GetChange() const { return change; } // Get state we want to change to states_t GetChangeTo() const { return changeTo; } // Get pause state bool GetPause() const { return pause; } // Set pause void SetPause(bool pause) { this->pause = pause; } // START // Everything you need to do before you get going // Must be passed input queue virtual void Start() = 0; // UPDATE // For game logic; Run every frame // dt stands for Delta Time // Recieves input from the Input class virtual void Update(int dt, inputs_t inputs) = 0; // DRAW // For drawing things out to the screen; Runs every frame after update // Returns array of drawable objects for the Render class to use virtual std::vector<drawable_t> Draw() const = 0; // STOP // Runs after you change game state or close the program virtual void Stop() = 0; // TRY MOVE // Actor broadcasts where it'd like to move, this function checks if its a valid move // and if it is, moves it. bool TryMove(int index, float x, float y); };
4e23e4cd64ef12191a6ae151762609ea51d5c6b3
45364deefe009a0df9e745a4dd4b680dcedea42b
/SDK/FSD_Options_Scalability_Overall_functions.cpp
97f3a46112e3537b0d85efffaa9899e0817693e9
[]
no_license
RussellJerome/DeepRockGalacticSDK
5ae9b59c7324f2a97035f28545f92773526ed99e
f13d9d8879a645c3de89ad7dc6756f4a7a94607e
refs/heads/master
2022-11-26T17:55:08.185666
2020-07-26T21:39:30
2020-07-26T21:39:30
277,796,048
0
0
null
null
null
null
UTF-8
C++
false
false
3,248
cpp
FSD_Options_Scalability_Overall_functions.cpp
// DeepRockGalactic SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "FSD_Options_Scalability_Overall_parameters.hpp" namespace SDK { //--------------------------------------------------------------------------- //Functions //--------------------------------------------------------------------------- // Function Options_Scalability_Overall.Options_Scalability_Overall_C.Construct // (BlueprintCosmetic, Event, Public, BlueprintEvent) void UOptions_Scalability_Overall_C::Construct() { static auto fn = UObject::FindObject<UFunction>("Function Options_Scalability_Overall.Options_Scalability_Overall_C.Construct"); UOptions_Scalability_Overall_C_Construct_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function Options_Scalability_Overall.Options_Scalability_Overall_C.UINeedsUpdate // (BlueprintCallable, BlueprintEvent) void UOptions_Scalability_Overall_C::UINeedsUpdate() { static auto fn = UObject::FindObject<UFunction>("Function Options_Scalability_Overall.Options_Scalability_Overall_C.UINeedsUpdate"); UOptions_Scalability_Overall_C_UINeedsUpdate_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function Options_Scalability_Overall.Options_Scalability_Overall_C.BndEvt__Basic_OptionSwitcher_K2Node_ComponentBoundEvent_1_OnSelectionChanged__DelegateSignature // (BlueprintEvent) // Parameters: // struct FText* Value (BlueprintVisible, BlueprintReadOnly, Parm) // int* Index (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData) void UOptions_Scalability_Overall_C::BndEvt__Basic_OptionSwitcher_K2Node_ComponentBoundEvent_1_OnSelectionChanged__DelegateSignature(struct FText* Value, int* Index) { static auto fn = UObject::FindObject<UFunction>("Function Options_Scalability_Overall.Options_Scalability_Overall_C.BndEvt__Basic_OptionSwitcher_K2Node_ComponentBoundEvent_1_OnSelectionChanged__DelegateSignature"); UOptions_Scalability_Overall_C_BndEvt__Basic_OptionSwitcher_K2Node_ComponentBoundEvent_1_OnSelectionChanged__DelegateSignature_Params params; params.Value = Value; params.Index = Index; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function Options_Scalability_Overall.Options_Scalability_Overall_C.ExecuteUbergraph_Options_Scalability_Overall // (Final, HasDefaults) // Parameters: // int* EntryPoint (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData) void UOptions_Scalability_Overall_C::ExecuteUbergraph_Options_Scalability_Overall(int* EntryPoint) { static auto fn = UObject::FindObject<UFunction>("Function Options_Scalability_Overall.Options_Scalability_Overall_C.ExecuteUbergraph_Options_Scalability_Overall"); UOptions_Scalability_Overall_C_ExecuteUbergraph_Options_Scalability_Overall_Params params; params.EntryPoint = EntryPoint; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } } #ifdef _MSC_VER #pragma pack(pop) #endif
daad44a6f1be6d8f506b3295c018b5622fbb7690
d446ed18144ac191377c2a5e0585fb61317b96c2
/src/eepp/ui/css/stylesheetpropertiesparser.cpp
78255891d288012fec2d46e2b73620042fc9ea85
[ "MIT" ]
permissive
thyrdmc/eepp
6f8ee84f048efaf1b3aca931ea612e61136e15c4
93b72b1bcab794a43706658e7978c5e852c3b65a
refs/heads/master
2023-06-25T11:18:16.371330
2019-05-22T04:26:41
2019-05-22T04:26:41
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,774
cpp
stylesheetpropertiesparser.cpp
#include <eepp/ui/css/stylesheetpropertiesparser.hpp> #include <eepp/math/rect.hpp> #include <eepp/scene/nodeattribute.hpp> using namespace EE::UI; using namespace EE::Scene; namespace EE { namespace UI { namespace CSS { StyleSheetPropertiesParser::StyleSheetPropertiesParser(){} StyleSheetPropertiesParser::StyleSheetPropertiesParser( const std::string& propsstr ) { std::vector<std::string> props = String::split( propsstr, ';' ); if ( !props.empty() ) { parse( propsstr ); } } const StyleSheetProperties & StyleSheetPropertiesParser::getProperties() const { return mProperties; }; void StyleSheetPropertiesParser::parse( std::string propsstr ) { ReadState rs = ReadingPropertyName; mPrevRs = rs; std::size_t pos = 0; std::string buffer; while ( pos < propsstr.size() ) { switch (rs) { case ReadingPropertyName: { pos = readPropertyName(rs, pos, buffer, propsstr); break; } case ReadingPropertyValue: { pos = readPropertyValue(rs, pos, buffer, propsstr); break; } case ReadingComment: { pos = readComment(rs, pos, buffer, propsstr); } default: break; } } } int StyleSheetPropertiesParser::readPropertyName(StyleSheetPropertiesParser::ReadState & rs, std::size_t pos, std::string & buffer, const std::string& str) { mPrevRs = rs; buffer.clear(); while ( pos < str.size() ) { if ( str[pos] == '/' && str.size() > pos + 1 && str[pos+1] == '*' ) { rs = ReadingComment; return pos; } if ( str[pos] == ':' ) { rs = ReadingPropertyValue; return pos + 1; } if ( str[pos] != '\n' && str[pos] != '\t' ) buffer += str[pos]; pos++; } return pos; } int StyleSheetPropertiesParser::readPropertyValue(StyleSheetPropertiesParser::ReadState & rs, std::size_t pos, std::string & buffer, const std::string& str) { std::string propName( buffer ); buffer.clear(); mPrevRs = rs; while ( pos < str.size() ) { if ( str[pos] == '/' && str.size() > pos + 1 && str[pos+1] == '*' ) { rs = ReadingComment; return pos; } if ( buffer.size() == 4 && buffer.substr(0,4) == "url(" ) { rs = ReadingValueUrl; pos = readValueUrl( rs, pos, buffer, str ); } if ( str[pos] == ';' ) { rs = ReadingPropertyName; addProperty( propName, buffer ); return pos + 1; } if ( str[pos] != '\n' && str[pos] != '\t' ) buffer += str[pos]; pos++; if ( pos == str.size() ) { rs = ReadingPropertyName; addProperty( propName, buffer ); return pos + 1; } } return pos; } int StyleSheetPropertiesParser::readComment(StyleSheetPropertiesParser::ReadState & rs, std::size_t pos, std::string & buffer, const std::string & str) { buffer.clear(); while ( pos < str.size() ) { if ( str[pos] == '*' && str.size() > pos + 1 && str[pos+1] == '/' ) { rs = mPrevRs; return pos + 2; } buffer += str[pos]; pos++; } return pos; } int StyleSheetPropertiesParser::readValueUrl(StyleSheetPropertiesParser::ReadState & rs, std::size_t pos, std::string & buffer, const std::string& str) { bool quoted = false; while ( pos < str.size() ) { if ( !quoted && str[pos] == '"' ) { buffer += str[pos]; quoted = true; } else if ( !quoted ) { if ( str[pos] != '\n' && str[pos] != '\t' ) buffer += str[pos]; if ( str[pos] == ')' ) { rs = ReadingPropertyValue; return pos + 1; } } else { buffer += str[pos]; if ( quoted && str[pos] == '"' ) { quoted = false; } } pos++; } return pos; } void StyleSheetPropertiesParser::addProperty( const std::string& name, std::string value ) { if ( name == "padding" ) { value = String::toLower( String::trim( value ) ); Rectf rect( NodeAttribute( name, value ).asRectf() ); mProperties[ "paddingleft" ] = StyleSheetProperty( "paddingleft", String::toStr( rect.Left ) ); mProperties[ "paddingright" ] = StyleSheetProperty( "paddingright", String::toStr( rect.Right ) ); mProperties[ "paddingtop" ] = StyleSheetProperty( "paddingtop", String::toStr( rect.Top ) ); mProperties[ "paddingbottom" ] = StyleSheetProperty( "paddingbottom", String::toStr( rect.Bottom ) ); } else if ( name == "layout_margin" ) { value = String::toLower( String::trim( value ) ); Rect rect( NodeAttribute( name, value ).asRect() ); mProperties[ "layout_marginleft" ] = StyleSheetProperty( "layout_marginleft", String::toStr( rect.Left ) ); mProperties[ "layout_marginright" ] = StyleSheetProperty( "layout_marginright", String::toStr( rect.Right ) ); mProperties[ "layout_margintop" ] = StyleSheetProperty( "layout_margintop", String::toStr( rect.Top ) ); mProperties[ "layout_marginbottom" ] = StyleSheetProperty( "layout_marginbottom", String::toStr( rect.Bottom ) ); } else { mProperties[ name ] = StyleSheetProperty( name, value ); } } }}}
84cdd7738b66817e6830b5dbb7e3157d7f51c917
b6c8b3833e1d78c8502abe4a5b36270665ba7fa2
/dnapage.h
ab504ffc1c235c85be4096f8697b82a4beead862
[]
no_license
sje397/QtBugs
9407728be82eaca50ca53ff172637a87f4b1761b
5481b49e4c1836bd4b4ad857737b32546223def8
refs/heads/master
2020-05-09T19:10:27.042561
2013-01-15T14:43:46
2013-01-15T14:43:46
951,034
1
0
null
null
null
null
UTF-8
C++
false
false
343
h
dnapage.h
#ifndef DNAPAGE_H #define DNAPAGE_H #include <QWidget> #include "ui_dnapage.h" #include "bug.h" class DNAPage : public QWidget { Q_OBJECT public: DNAPage(QWidget *parent = 0); ~DNAPage(); void setBug(Bug *b); public slots: void updateInfo(); private: Ui::DNAPageClass ui; Bug *bug; }; #endif // DNAPAGE_H
d885ccbb8cb2d43fc4152ae05cf6ea31dd8d9b9b
5d2a8af9709af1b6e3db40eace44cdfea59df208
/frameworks/runtime-src/Classes/2dengine/GUIIMEDelegate.cpp
8b7ae7914e56dc44283d6c85eec56da6d7358712
[]
no_license
tatfook/ParaCraftMobile
a714a2566fa5c83f675472fc5d6df440b27aafa1
072b53957d2a83808ee10fc99e746257e83a4d9a
refs/heads/master
2021-01-20T08:57:16.049744
2017-07-03T03:49:12
2017-07-03T03:49:12
90,208,741
6
3
null
null
null
null
UTF-8
C++
false
false
2,599
cpp
GUIIMEDelegate.cpp
//---------------------------------------------------------------------- // Class: IME delegate // Authors: LiXizhi // Company: ParaEngine // Date: 2014.9.24 // desc: //----------------------------------------------------------------------- #include "ParaEngine.h" #include "GUIIMEDelegate.h" #ifdef PARAENGINE_MOBILE #include "platform/OpenGLWrapper.h" USING_NS_CC; using namespace ParaEngine; namespace ParaEngine { /* this is just a proxy class to wrapper around the cocos' IMEDelegate, without needing the main header file to include or depends on the cocos' IME related header files. */ class CIMEDelegateProxy : public IMEDelegate { public: friend class GUIIMEDelegate; CIMEDelegateProxy(GUIIMEDelegate* pProxyTarget) :m_pProxyTarget(pProxyTarget){}; virtual void insertText(const char * text, size_t len) { m_pProxyTarget->insertText(text, len); } virtual void deleteBackward() { m_pProxyTarget->deleteBackward(); } virtual const std::string& getContentText() { return m_pProxyTarget->getContentText(); } virtual bool canAttachWithIME() { return m_pProxyTarget->canAttachWithIME(); } virtual void didAttachWithIME() { return m_pProxyTarget->didAttachWithIME(); } virtual bool canDetachWithIME() { return m_pProxyTarget->canDetachWithIME(); } virtual void didDetachWithIME() { return m_pProxyTarget->didDetachWithIME(); } protected: GUIIMEDelegate* m_pProxyTarget; }; } ParaEngine::GUIIMEDelegate::GUIIMEDelegate() :m_delegate(new CIMEDelegateProxy(this)) { } ParaEngine::GUIIMEDelegate::~GUIIMEDelegate() { } CIMEDelegateProxy* ParaEngine::GUIIMEDelegate::GetIMEDelegateProxy() { return m_delegate.get(); } bool ParaEngine::GUIIMEDelegate::attachWithIME() { bool ret = m_delegate->attachWithIME(); if (ret) { // open keyboard GLView * pGlView = Director::getInstance()->getOpenGLView(); if (pGlView) { pGlView->setIMEKeyboardState(true); } } return ret; } bool ParaEngine::GUIIMEDelegate::detachWithIME() { bool ret = m_delegate->detachWithIME(); if (ret) { // close keyboard GLView * glView = Director::getInstance()->getOpenGLView(); if (glView) { glView->setIMEKeyboardState(false); } } return ret; } #else ParaEngine::GUIIMEDelegate::GUIIMEDelegate() { } bool ParaEngine::GUIIMEDelegate::attachWithIME() { return false; } bool ParaEngine::GUIIMEDelegate::detachWithIME() { return false; } ParaEngine::GUIIMEDelegate::~GUIIMEDelegate() { } ParaEngine::CIMEDelegateProxy* ParaEngine::GUIIMEDelegate::GetIMEDelegateProxy() { return NULL; } #endif
81063b6f61d2343ae98245b32219e7603bc7b1af
05bafc0664d80406b4aa624db3ccd7f66b804d35
/SWITCH.CPP
50828d05c1c077363ea62fd729dbff85e5b61140
[]
no_license
iannielsenCode/Highschool-Work-C-
2181df76deb9ef361240eb768cc284640e14218a
9dc1cd7363afc9d65cefbcd3b287b94cd7f6369e
refs/heads/master
2020-03-30T05:11:22.580656
2018-09-28T19:32:46
2018-09-28T19:32:46
150,785,683
0
0
null
null
null
null
UTF-8
C++
false
false
1,977
cpp
SWITCH.CPP
//Student: Ian Nielsen //File Name: SWITCH.CPP //Last Updated: February 28th 2011 //I, Ian Nielsen, only got help from Mr.Miskin while working on this program. #include<iostream> using namespace std; int main() { int distance, cost; char choice; cout << "This program will calcualte the toll for a distance traveled.\n"; do { cout << "Enter the distance between 0 and 999:"; cin >> distance; if((distance > 0) && (distance < 100)) //If the distance is from 0 to 99, cost equals 1. { cost = 1; } if((distance >= 100) && (distance < 300)) //If distance is from 100 to 299, cost equals 2. { cost = 2; } if((distance >= 300) && (distance < 600)) //If distance is from 300 to 599, cost equals 3. { cost = 3; } if((distance >=600) && (distance < 1000)) //If distance is from 600 to 999, cost equal 4. { cost = 4; } if((distance < 0) || (distance >= 1000)) //If distance is not between 0 and 999, cost equals 5. { cost = 5; } switch(cost) { case 1: cout << "The toll is 5.00.\n"; break; case 2: cout << "The toll is 8.00.\n"; break; case 3: cout << "The toll is 10.00.\n"; break; case 4: cout << "The toll is 12.00.\n"; break; default: cout << "The distance is out of range.\n"; break; } cout << "Do you want to do this again?(y or n):"; cin >> choice; }while((choice == 'y') || (choice == 'Y')); //As long as the user enters yes, the program will repeat. system("pause"); return 0; }
bc63e09a4334d4f44892137749b53146598ae7e6
e34c3d5df4cd5cff945c4b59881ee3f2bb11ad23
/testing/DatabaseTest.h
bed456cda1b80f9ce9982dbff115aed5c86821fb
[]
no_license
crc34/MCMC
e64bebde0d3c857fd003d5dff429b2c31c45255c
13a45513968145523f8c900eed605266e96ce675
refs/heads/master
2021-05-04T11:22:25.474512
2018-12-25T15:01:46
2018-12-25T15:01:46
36,090,913
0
0
null
null
null
null
UTF-8
C++
false
false
1,241
h
DatabaseTest.h
#pragma once #include "gmock/gmock.h" #include <DatabaseConnector.h> #include <MCMCDatabaseConnector.h> class DatabaseTest { public: const std::string hostName = "localhost"; const std::string userName = "user"; const std::string userPassword = "password"; const std::string database = "tmp"; const std::string runName = "firstRun"; const std::vector<std::string> clearDatabaseQuery = {"delete from samples;", "delete from run;"}; const std::string insertQuery = "insert into samples values(NULL, 1, -3.44, 3.5);"; const std::string selectQuery = "select count(*) from samples where Theta=3.5;"; std::shared_ptr<DatabaseConnector> dbConnection; std::shared_ptr<MCMCDatabaseConnector> mcmcConnection; void clearDatabase() { for (auto query : clearDatabaseQuery) { dbConnection.get()->execute(query); } } void SetUp() { dbConnection.reset( new DatabaseConnector( hostName, userName, userPassword, database)); mcmcConnection.reset( new MCMCDatabaseConnector( hostName, userName, userPassword, database)); clearDatabase(); } };
41d9d627b12846cefa94e97a16272ff52bbaeab1
108dae91ce3009c0fa235735e3459d72de7a7a60
/dir.cpp
4ebc79163647da1f2fa11ecc390a456b4cd395ea
[]
no_license
kmailll/invaders
5b75028bc23d31f13f809e9f0439b9294adeb767
8fa6e0c18dfcffd33296cdb584c1efeb5f995cef
refs/heads/master
2016-09-02T05:54:24.658679
2009-01-26T21:52:48
2009-01-26T21:52:48
109,286
1
0
null
null
null
null
UTF-8
C++
false
false
502
cpp
dir.cpp
/* * File: dir.cpp * Author: kamil * * Created on December 15, 2008, 2:07 PM */ #include "dir.h" Logger Dir::logger; std::string Dir::dirIDToDirMap[8]; void Dir:: init() { dirIDToDirMap[1] = std::string("n"); dirIDToDirMap[5] = std::string("s"); dirIDToDirMap[3] = std::string("e"); dirIDToDirMap[7] = std::string("w"); dirIDToDirMap[2] = std::string("ne"); dirIDToDirMap[0] = std::string("nw"); dirIDToDirMap[4] = std::string("se"); dirIDToDirMap[6] = std::string("sw"); }
092bfc668b01e7ec9cad022f86d93c25575de2b7
aeef01da43d7aeeef4aae880862bce805c48a8ee
/Problems/Problems/leetcode-Odd Even Linked List.cpp
bfe9f102cde9c561d1400e5a345c47db6d79c848
[]
no_license
gdjinjiahao/Problems
732424fa6b6566d41b1fc7b806b02777ff1f4934
5a49fee3934b41ba2331c44782e04f574e00ff9b
refs/heads/master
2021-01-02T08:17:39.129154
2018-02-09T03:59:11
2018-02-09T03:59:11
98,986,587
0
0
null
null
null
null
GB18030
C++
false
false
1,133
cpp
leetcode-Odd Even Linked List.cpp
/* 题意:给定一个链表,将索引号为奇数的放在一起且相对位置不变,将索引编号为偶数的放在后边,相对顺序不变,要求以O(1)的空间复杂度和O(n)的时间复杂度。 分析:将原链表拆成两个链表,最后合并即可,但注意边界情况。 */ #include <cstdlib> struct ListNode { int val; ListNode *next; ListNode(int x) : val(x), next(NULL) {} }; class Solution { public: ListNode* oddEvenList(ListNode* head) { ListNode* l1 = NULL; ListNode* l2 = NULL; ListNode* cur1 = NULL; ListNode* cur2 = NULL; ListNode* pos = head; int i = 1; while (pos != NULL) { ListNode* next = pos->next; if (i & 1) { if (cur1 == NULL) { cur1 = l1 = pos; cur1->next = NULL; } else { pos->next = NULL; cur1->next = pos; cur1 = pos; } } else { if (cur2 == NULL) { cur2 = l2 = pos; pos->next = NULL; } else { pos->next = cur2->next; cur2->next = pos; cur2 = pos; } } pos = next; i++; } if (l1 == NULL) return NULL; cur1->next = l2; return l1; } };
bb810d0a49115e8f74f14b961d1cfc0fef6bc120
b0b82f8b8298d887082047e517ec224f61d10d4d
/1. Деревья поиска/10 #849/[OK]181572.cpp
fc055f9d3899486e640aabc7721a15f85e8ea17b
[ "Unlicense" ]
permissive
godnoTA/acm.bsu.by
156f300bbbb7159e4bd77bd3cf620a994dd0dc05
3b9494a36bfb381e6748f7172ac2173e7418147f
refs/heads/master
2023-04-06T03:50:22.547181
2022-10-12T22:12:31
2022-10-12T22:12:31
125,252,573
32
45
Unlicense
2023-03-18T23:54:18
2018-03-14T17:53:52
Java
UTF-8
C++
false
false
6,850
cpp
[OK]181572.cpp
#include <iostream> #include <memory> #include <cstdio> #include <vector> #include <cmath> template <typename T, typename... Args> std::unique_ptr<T> make_unique(Args&&... args) { return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); } class BST { public: struct Node { int data; long long height = 0; long long leaves_cnt = 1; long long a = 0; long long b = 0; std::unique_ptr<Node> left; std::unique_ptr<Node> right; Node *parent = nullptr; Node() {}; Node(int val) : data(val) {}; Node* l_get() { return (this->left).get(); } Node* r_get() { return (this->right).get(); } }; BST() {} void insert(int val) { insert_(std::move(root_), val, nullptr); } long long get_MSL() { postOrder_travers(root_.get()); cntNumOfDiffPath(root_.get()); cntPathThroughParent(root_.get()); removeMaxPath(root_.get()); return MSL; } void traversal() { preOrder(root_.get()); } private: void preOrder(Node *curNode) { if (curNode == nullptr) { return; } std::cout << curNode->data << "\n"; preOrder(curNode->l_get()); preOrder(curNode->r_get()); } void insert_(std::unique_ptr<Node>&& curNode, int val, Node* p) { if (curNode == nullptr) { curNode = make_unique<Node>(val); curNode->parent = p; return; } if (curNode.get()->data > val) { insert_(std::move(curNode.get()->left), val, curNode.get()); } else if (curNode.get()->data < val) { insert_(std::move(curNode.get()->right), val, curNode.get()); } } Node* find_min(Node* curNode) { if (curNode->left == nullptr) { return curNode; } return find_min(curNode->l_get()); } void remove_(Node* curNode) { if (curNode->left != nullptr && curNode->right != nullptr) { Node* minNode = find_min(curNode->r_get()); Node* min_parent = minNode->parent; curNode->data = minNode->data; if (minNode->r_get() != nullptr) { minNode->r_get()->parent = min_parent; } if (min_parent->l_get() == minNode) { min_parent->left = std::move(minNode->right); } else { min_parent->right = std::move(minNode->right); } } else { std::unique_ptr<Node> ptr = std::move((curNode->left != nullptr) ? curNode->left : curNode->right); if (curNode->parent == nullptr) { root_ = std::move(ptr); } else { if (ptr != nullptr) { ptr.get()->parent = curNode->parent; } if ((curNode->parent->left).get() == curNode) { curNode->parent->left = std::move(ptr); } else { curNode->parent->right = std::move(ptr); } } } } void removeMaxPath(Node *curNode) { if (curNode == nullptr) { return; } removeMaxPath(curNode->l_get()); removeMaxPath(curNode->r_get()); if (curNode->a + curNode->b == maxNumOfPath) { remove_(curNode); } } long long cntChildUpPath(Node* node, long long num_of_up_path) { if (node == nullptr) { return -1; } node->a = num_of_up_path; return node->height; } void cntPathThroughParent(Node* curNode) { if (curNode == nullptr) { return; } long long left_height = cntChildUpPath(curNode->l_get(), curNode->b); long long right_height = cntChildUpPath(curNode->r_get(), curNode->b); Node* highest_child = (left_height > right_height) ? curNode->l_get() : curNode->r_get(); if (highest_child != nullptr) { if (left_height == right_height) { curNode->l_get()->a += curNode->a * curNode->l_get()->leaves_cnt / curNode->leaves_cnt; curNode->r_get()->a += curNode->a * curNode->r_get()->leaves_cnt / curNode->leaves_cnt; } else { highest_child->a += curNode->a; } } maxNumOfPath = std::max(maxNumOfPath, curNode->a + curNode->b); cntPathThroughParent(curNode->l_get()); cntPathThroughParent(curNode->r_get()); } std::pair<long long, long long> getHeightAndLeaves(Node* node) { return (node == nullptr) ? std::make_pair(-1ll, -1ll) : std::make_pair(node->height, node->leaves_cnt); } void cntNumOfDiffPath(Node* curNode) { if (curNode == nullptr) { return; } cntNumOfDiffPath(curNode->l_get()); cntNumOfDiffPath(curNode->r_get()); std::pair<long long, long long> left = getHeightAndLeaves(curNode->l_get()); std::pair<long long, long long> right = getHeightAndLeaves(curNode->r_get()); if (left.first + right.first + 2 == MSL) { curNode->b = std::max(left.second, 1ll) * std::max(1ll, right.second); } } std::pair<long long, long long> postOrder_travers(Node* curNode) { if (curNode == nullptr) { return {-1ll, 1ll}; } std::pair<long long, long long> left = postOrder_travers(curNode->l_get()); std::pair<long long, long long> right = postOrder_travers(curNode->r_get()); if (left.first > right.first) { curNode->height = left.first + 1; curNode->leaves_cnt = left.second; } else { curNode->height = right.first + 1; curNode->leaves_cnt = right.second; if (left.first == right.first && left.first != -1) { curNode->leaves_cnt += left.second; } } MSL = std::max(MSL, left.first + right.first + 2ll); return {curNode->height, curNode->leaves_cnt}; } long long MSL = 0; long long maxNumOfPath = 0; std::unique_ptr<Node> root_ = nullptr; }; int main() { freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); BST bst; long long x; while (!std::cin.eof()) { std::cin >> x; bst.insert(x); } bst.get_MSL(); bst.traversal(); return 0; }
69a6a24b48f437f0ec50cf1b9164e7070926f3de
e1b528018f5ff19b92b7a71768fdebbb3ec8a3b8
/src/api/ctp_trader_api.cpp
02ddbc3bf478ce30d961478f1b20844e472884c6
[]
no_license
riverdarda/ctp_trader
0154133e2cc0bf9d7867a6be35fd732a4a4876d5
f3dd7f96668f1a6fda17e56c9b716c94bd85ff65
refs/heads/master
2020-05-04T07:07:57.252696
2018-12-19T01:26:58
2018-12-19T01:26:58
null
0
0
null
null
null
null
GB18030
C++
false
false
28,533
cpp
ctp_trader_api.cpp
#include "ctp_trader_api.h" #include "CtpTraderHandler.h" #include "ThostFtdcTraderApi.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <event2/util.h> #ifdef __cplusplus extern "C" { #endif #include "trader_msg_struct.h" #include "cmn_util.h" #include "cmn_log.h" static ctp_trader_api_cb* ctp_trader_api_cb_get(); static ctp_trader_api_method* ctp_trader_api_method_get(); static void ctp_trader_on_front_connected(void* arg); static void ctp_trader_on_front_disconnected(void* arg, int nReason); static void ctp_trader_on_rsp_error(void* arg, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ; static void ctp_trader_on_rsp_user_login(void* arg, CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) ; static void ctp_trader_on_rsp_user_logout(void* arg, CThostFtdcUserLogoutField *pRspUserLogout, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); static void ctp_trader_on_rsp_order_insert(void* arg, CThostFtdcInputOrderField *pInputOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); static void ctp_trader_on_rsp_order_action(void* arg, CThostFtdcInputOrderActionField *pOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); static void ctp_trader_on_rtn_trade(void* arg, CThostFtdcTradeField *pTrade); static void ctp_trader_on_rtn_order(void* arg, CThostFtdcOrderField *pOrder); static void ctp_trader_on_err_rtn_order_insert(void* arg, CThostFtdcInputOrderField *pInputOrder, CThostFtdcRspInfoField *pRspInfo); static void ctp_trader_on_err_rtn_order_action(void* arg, CThostFtdcOrderActionField *pOrderAction, CThostFtdcRspInfoField *pRspInfo); static void ctp_trader_on_rsp_qry_user_investor(void* arg, CThostFtdcInvestorField *pRspUserInvestor, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); static void ctp_trader_on_rsp_qry_instrument(void* arg, CThostFtdcInstrumentField *pRspInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); static void ctp_trader_on_rsp_settlement_info_confirm(void* arg, CThostFtdcSettlementInfoConfirmField *pSettlementInfoConfirm, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); static void ctp_trader_on_rsp_qry_trading_account(void* arg, CThostFtdcTradingAccountField *pTradingAccount, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); static void ctp_trader_on_rsp_qry_investor_position(void* arg, CThostFtdcInvestorPositionField *pInvestorPosition, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast); static void ctp_trader_on_rtn_instrument_status(void* arg, CThostFtdcInstrumentStatusField *pInstrumentStatus); static int ctp_trader_api_init(ctp_trader_api* self); static int ctp_trader_api_start(ctp_trader_api* self, char* user_id, char* pwd); static int ctp_trader_api_stop(ctp_trader_api* self); static int ctp_trader_api_order_insert(ctp_trader_api* self, char* inst, char* local_id, char buy_sell, char open_close, double price, int vol); static int ctp_trader_api_order_action(ctp_trader_api* self, char* inst, char* local_id, char* org_local_id, char* exchange_id, char* order_sys_id); static int ctp_trader_api_query_instrument(ctp_trader_api* self); static int ctp_trader_api_query_user_investor(ctp_trader_api* self); static int ctp_trader_api_get_tradingday(ctp_trader_api* self, char* tradingday); static int ctp_trader_api_get_maxuserlocalid(ctp_trader_api* self, char* local_id); static int ctp_trader_api_mng(ctp_trader_api* self, int error_cd, char* error_msg); static int ctp_trader_api_qry_instrument(ctp_trader_api* self, char* instrument, int last, int err_cd); static int ctp_trader_api_qry_settlement_info_confirm(ctp_trader_api* self); static int ctp_trader_api_qry_investor_position(ctp_trader_api* self); #ifdef __cplusplus } #endif ctp_trader_api_cb* ctp_trader_api_cb_get() { static ctp_trader_api_cb ctp_trader_api_cb_st = { ctp_trader_on_front_connected, ctp_trader_on_front_disconnected, ctp_trader_on_rsp_user_login, ctp_trader_on_rsp_user_logout, ctp_trader_on_rsp_error, ctp_trader_on_rsp_order_insert, ctp_trader_on_rsp_order_action, ctp_trader_on_rtn_order, ctp_trader_on_rtn_trade, ctp_trader_on_err_rtn_order_insert, ctp_trader_on_err_rtn_order_action, ctp_trader_on_rsp_qry_user_investor, ctp_trader_on_rsp_qry_instrument, ctp_trader_on_rsp_settlement_info_confirm, ctp_trader_on_rsp_qry_trading_account, ctp_trader_on_rsp_qry_investor_position, ctp_trader_on_rtn_instrument_status }; return &ctp_trader_api_cb_st; } ctp_trader_api_method* ctp_trader_api_method_get() { static ctp_trader_api_method ctp_trader_api_method_st = { ctp_trader_api_start, ctp_trader_api_stop, ctp_trader_api_order_insert, ctp_trader_api_order_action, ctp_trader_api_query_instrument, ctp_trader_api_query_user_investor, ctp_trader_api_get_tradingday, ctp_trader_api_get_maxuserlocalid, ctp_trader_api_qry_settlement_info_confirm, ctp_trader_api_qry_investor_position }; return &ctp_trader_api_method_st; } void ctp_trader_on_front_connected(void* arg) { CMN_DEBUG("Enter!\n"); ctp_trader_api* self = (ctp_trader_api*)arg; CThostFtdcTraderApi* pUserApi = (CThostFtdcTraderApi*)self->pUserApi; CThostFtdcReqUserLoginField reqUserLogin; memset(&reqUserLogin,0,sizeof(CThostFtdcReqUserLoginField)); strcpy(reqUserLogin.BrokerID, self->BrokenId); strcpy(reqUserLogin.UserID, self->UserId); strcpy(reqUserLogin.Password, self->Passwd); strcpy(reqUserLogin.UserProductInfo,"Trader Login"); pUserApi->ReqUserLogin(&reqUserLogin, self->nLocalId++); return; } void ctp_trader_on_front_disconnected(void* arg, int nReason) { CMN_DEBUG("Enter!\n"); ctp_trader_api* self = (ctp_trader_api*)arg; } void ctp_trader_on_rsp_error(void* arg, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { CMN_DEBUG("Enter!\n"); ctp_trader_api* self = (ctp_trader_api*)arg; } void ctp_trader_on_rsp_user_login(void* arg, CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { CMN_DEBUG("Enter!\n"); ctp_trader_api* self = (ctp_trader_api*)arg; CThostFtdcTraderApi* pTrader = (CThostFtdcTraderApi*)self->pUserApi; if(0 != pRspInfo->ErrorID){ // 通知客户端登录失败 ctp_trader_api_mng(self, pRspInfo->ErrorID, pRspInfo->ErrorMsg); CMN_WARN("pRspInfo->ErrorID[%d]\n", pRspInfo->ErrorID); CMN_WARN("pRspInfo->ErrorMsg[%s]\n", pRspInfo->ErrorMsg); return ; } // 获取OrderId CMN_DEBUG("pRspUserLogin->MaxOrderLocalID[%s]\n", pRspUserLogin->MaxOrderRef); strcpy(self->MaxOrderLocalID, pRspUserLogin->MaxOrderRef); CThostFtdcSettlementInfoConfirmField req; memset(&req, 0, sizeof(CThostFtdcSettlementInfoConfirmField)); strcpy(req.BrokerID, self->BrokenId); strcpy(req.InvestorID, self->UserId); strcpy(req.ConfirmDate, pTrader->GetTradingDay()); strcpy(req.ConfirmTime, "09:00:00"); pTrader->ReqSettlementInfoConfirm(&req, self->nLocalId++); } void ctp_trader_on_rsp_user_logout(void* arg, CThostFtdcUserLogoutField *pRspUserLogout, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { CMN_DEBUG("Enter!\n"); ctp_trader_api* self = (ctp_trader_api*)arg; if(0 != pRspInfo->ErrorID){ // 通知客户端登出失败 //TODO return ; } self->bInit = 0; return; } void ctp_trader_on_rsp_order_insert(void* arg, CThostFtdcInputOrderField *pInputOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { CMN_DEBUG("Enter!\n"); ctp_trader_api* self = (ctp_trader_api*)arg; if(pRspInfo != NULL && 0 != pRspInfo->ErrorID){ // 通知客户端报单失败 CMN_WARN("通知客户端报单失败\n"); CMN_WARN("pRspInfo->ErrorID[%d]\n", pRspInfo->ErrorID); CMN_WARN("pRspInfo->ErrorMsg[%s]\n", pRspInfo->ErrorMsg); struct trader_msg_trader_struct_def oMsg; oMsg.type = TRADER_RECV_TRADER_ON_ORDER; oMsg.ErrorCd = 0; strcpy(oMsg.oOrder.UserOrderLocalID, pInputOrder->OrderRef); strcpy(oMsg.oOrder.InstrumentID, pInputOrder->InstrumentID); oMsg.oOrder.Direction = pInputOrder->Direction; oMsg.oOrder.OffsetFlag = pInputOrder->CombOffsetFlag[0]; oMsg.oOrder.LimitPrice = pInputOrder->LimitPrice; oMsg.oOrder.HedgeFlag = pInputOrder->CombHedgeFlag[0]; oMsg.oOrder.VolumeOriginal = pInputOrder->VolumeTotalOriginal; oMsg.oOrder.VolumeTraded = 0; oMsg.oOrder.OrderStatus = '6'; strcpy(oMsg.oOrder.InsertTime, "-"); cmn_util_evbuffer_send(self->fd, (unsigned char*)&oMsg, sizeof(oMsg)); return ; } return; } void ctp_trader_on_rsp_order_action(void* arg, CThostFtdcInputOrderActionField *pOrderAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { CMN_DEBUG("Enter!\n"); ctp_trader_api* self = (ctp_trader_api*)arg; if(pRspInfo != NULL && 0 != pRspInfo->ErrorID){ // 通知客户端撤单提交失败 CMN_WARN("通知客户端撤单失败\n"); CMN_WARN("pRspInfo->ErrorID[%d]\n", pRspInfo->ErrorID); CMN_WARN("pRspInfo->ErrorMsg[%s]\n", pRspInfo->ErrorMsg); return ; } } void ctp_trader_on_rtn_trade(void* arg, CThostFtdcTradeField *pTrade) { CMN_DEBUG("Enter!\n"); ctp_trader_api* self = (ctp_trader_api*)arg; // 通知客户端成交 struct trader_msg_trader_struct_def oMsg; oMsg.type = TRADER_RECV_TRADER_ON_TRADE; oMsg.ErrorCd = 0; strcpy(oMsg.oTrade.InstrumentID, pTrade->InstrumentID); strcpy(oMsg.oTrade.UserOrderLocalID, pTrade->OrderRef); oMsg.oTrade.Direction = pTrade->Direction; oMsg.oTrade.OffsetFlag = pTrade->OffsetFlag; oMsg.oTrade.TradePrice = pTrade->Price; oMsg.oTrade.TradeVolume = pTrade->Volume; strcpy(oMsg.oTrade.TradingDay, pTrade->TradingDay); strcpy(oMsg.oTrade.TradeTime, pTrade->TradeTime); strcpy(oMsg.oTrade.TradeID, pTrade->TradeID); cmn_util_evbuffer_send(self->fd, (unsigned char*)&oMsg, sizeof(oMsg)); } void ctp_trader_on_rtn_order(void* arg, CThostFtdcOrderField *pOrder) { CMN_DEBUG("Enter!\n"); ctp_trader_api* self = (ctp_trader_api*)arg; struct trader_msg_trader_struct_def oMsg; oMsg.type = TRADER_RECV_TRADER_ON_ORDER; oMsg.ErrorCd = 0; strcpy(oMsg.oOrder.ExchangeID, pOrder->ExchangeID); strcpy(oMsg.oOrder.OrderSysID, pOrder->OrderSysID); strcpy(oMsg.oOrder.UserOrderLocalID, pOrder->OrderRef); strcpy(oMsg.oOrder.InstrumentID, pOrder->InstrumentID); oMsg.oOrder.Direction = pOrder->Direction; oMsg.oOrder.OffsetFlag = pOrder->CombOffsetFlag[0]; oMsg.oOrder.HedgeFlag = pOrder->CombHedgeFlag[0]; oMsg.oOrder.LimitPrice = pOrder->LimitPrice; oMsg.oOrder.VolumeOriginal = pOrder->VolumeTotalOriginal; oMsg.oOrder.VolumeTraded = pOrder->VolumeTraded; oMsg.oOrder.OrderStatus = pOrder->OrderStatus; strcpy(oMsg.oOrder.InsertTime, pOrder->InsertTime); cmn_util_evbuffer_send(self->fd, (unsigned char*)&oMsg, sizeof(oMsg)); return ; } void ctp_trader_on_err_rtn_order_insert(void* arg, CThostFtdcInputOrderField *pInputOrder, CThostFtdcRspInfoField *pRspInfo) { CMN_DEBUG("Enter!\n"); ctp_trader_api* self = (ctp_trader_api*)arg; // 通知客户端报单失败 CMN_WARN("通知客户端报单失败\n"); } void ctp_trader_on_err_rtn_order_action(void* arg, CThostFtdcOrderActionField *pOrderAction, CThostFtdcRspInfoField *pRspInfo) { CMN_DEBUG("Enter!\n"); ctp_trader_api* self = (ctp_trader_api*)arg; // 通知客户端撤单失败 CMN_WARN("通知客户端撤单失败\n"); } void ctp_trader_on_rsp_qry_user_investor(void* arg, CThostFtdcInvestorField *pRspUserInvestor, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { CMN_DEBUG("Enter!\n"); ctp_trader_api* self = (ctp_trader_api*)arg; struct trader_msg_trader_struct_def oMsg; oMsg.type = TRADER_RECV_TRADER_ON_QRY_USER_INVESTOR; if(pRspInfo){ oMsg.ErrorCd = -10000 - pRspInfo->ErrorID; strcpy(oMsg.ErrorMsg, pRspInfo->ErrorMsg); }else{ oMsg.ErrorCd = 0; strcpy(oMsg.ErrorMsg, ""); strcpy(self->InvestorID, pRspUserInvestor->InvestorID); } cmn_util_evbuffer_send(self->fd, (unsigned char*)&oMsg, sizeof(oMsg)); return ; } void ctp_trader_on_rsp_qry_instrument(void* arg, CThostFtdcInstrumentField *pRspInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { CMN_DEBUG("Enter!\n"); ctp_trader_api* self = (ctp_trader_api*)arg; char* inst = NULL; int errCd = 0; do{ if (pRspInfo!=NULL&&pRspInfo->ErrorID!=0) { errCd = -104; break; } if (pRspInstrument==NULL) { errCd = -104; break; } CMN_INFO("pRspInstrument->InstrumentID=[%s]\n", pRspInstrument->InstrumentID); CMN_INFO("pRspInstrument->ExchangeID=[%s]\n", pRspInstrument->ExchangeID); CMN_INFO("pRspInstrument->PriceTick=[%lf]\n", pRspInstrument->PriceTick); struct trader_msg_trader_struct_def oMsg; oMsg.type = TRADER_RECV_TRADER_ON_QRY_INSTRUMENT; oMsg.ErrorCd = -10000 - errCd; oMsg.bIsLast = bIsLast; if(!errCd){ oMsg.ErrorCd = 0; strcpy(oMsg.InstrumentID, pRspInstrument->InstrumentID); strcpy(oMsg.ExchangeID, pRspInstrument->ExchangeID); oMsg.PriceTick = pRspInstrument->PriceTick; } cmn_util_evbuffer_send(self->fd, (unsigned char*)&oMsg, sizeof(oMsg)); }while(0); self->bInit = 1; } void ctp_trader_on_rsp_settlement_info_confirm(void* arg, CThostFtdcSettlementInfoConfirmField *pSettlementInfoConfirm, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { CMN_DEBUG("Enter!\n"); ctp_trader_api* self = (ctp_trader_api*)arg; ctp_trader_api_mng(self, pRspInfo->ErrorID, pRspInfo->ErrorMsg); if(0 != pRspInfo->ErrorID){ // 通知客户端登录失败 CMN_WARN("pRspInfo->ErrorID[%d]\n", pRspInfo->ErrorID); CMN_WARN("pRspInfo->ErrorMsg[%s]\n", pRspInfo->ErrorMsg); return ; } self->bConnected = 1; } void ctp_trader_on_rsp_qry_trading_account(void* arg, CThostFtdcTradingAccountField *pTradingAccount, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { return ; } void ctp_trader_on_rsp_qry_investor_position(void* arg, CThostFtdcInvestorPositionField *pInvestorPosition, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { ctp_trader_api* self = (ctp_trader_api*)arg; if(pRspInfo){ CMN_DEBUG("ErrorID[%d]\n", pRspInfo->ErrorID); CMN_DEBUG("ErrorMsg[%s]\n", pRspInfo->ErrorMsg); return; } if(pInvestorPosition){ CMN_DEBUG( "pInvestorPosition->InstrumentID[%s]\n" "pInvestorPosition->BrokerID[%s]\n" "pInvestorPosition->InvestorID[%s]\n" "pInvestorPosition->PosiDirection[%c]\n" "pInvestorPosition->HedgeFlag[%c]\n" "pInvestorPosition->PositionDate[%c]\n" "pInvestorPosition->YdPosition[%d]\n" "pInvestorPosition->Position[%d]\n" "pInvestorPosition->LongFrozen[%d]\n" "pInvestorPosition->ShortFrozen[%d]\n" "pInvestorPosition->LongFrozenAmount[%lf]\n" "pInvestorPosition->ShortFrozenAmount[%lf]\n" "pInvestorPosition->OpenVolume[%d]\n" "pInvestorPosition->CloseVolume[%d]\n" "pInvestorPosition->OpenAmount[%lf]\n" "pInvestorPosition->CloseAmount[%lf]\n" "pInvestorPosition->PositionCost[%lf]\n" "pInvestorPosition->PreMargin[%lf]\n" "pInvestorPosition->UseMargin[%lf]\n" "pInvestorPosition->FrozenMargin[%lf]\n" "pInvestorPosition->FrozenCash[%lf]\n" "pInvestorPosition->FrozenCommission[%lf]\n" "pInvestorPosition->CashIn[%lf]\n" "pInvestorPosition->Commission[%lf]\n" "pInvestorPosition->CloseProfit[%lf]\n" "pInvestorPosition->PositionProfit[%lf]\n" "pInvestorPosition->PreSettlementPrice[%lf]\n" "pInvestorPosition->SettlementPrice[%lf]\n" "pInvestorPosition->TradingDay[%s]\n" "pInvestorPosition->SettlementID[%d]\n" "pInvestorPosition->OpenCost[%lf]\n" "pInvestorPosition->ExchangeMargin[%lf]\n" "pInvestorPosition->CombPosition[%d]\n" "pInvestorPosition->CombLongFrozen[%d]\n" "pInvestorPosition->CombShortFrozen[%d]\n" "pInvestorPosition->CloseProfitByDate[%lf]\n" "pInvestorPosition->CloseProfitByTrade[%lf]\n" "pInvestorPosition->TodayPosition[%d]\n" "pInvestorPosition->MarginRateByMoney[%lf]\n" "pInvestorPosition->MarginRateByVolume[%lf]\n" "pInvestorPosition->StrikeFrozen[%d]\n" "pInvestorPosition->StrikeFrozenAmount[%lf]\n" "pInvestorPosition->AbandonFrozen[%d]\n", pInvestorPosition->InstrumentID, pInvestorPosition->BrokerID, pInvestorPosition->InvestorID, pInvestorPosition->PosiDirection, pInvestorPosition->HedgeFlag, pInvestorPosition->PositionDate, pInvestorPosition->YdPosition, pInvestorPosition->Position, pInvestorPosition->LongFrozen, pInvestorPosition->ShortFrozen, pInvestorPosition->LongFrozenAmount, pInvestorPosition->ShortFrozenAmount, pInvestorPosition->OpenVolume, pInvestorPosition->CloseVolume, pInvestorPosition->OpenAmount, pInvestorPosition->CloseAmount, pInvestorPosition->PositionCost, pInvestorPosition->PreMargin, pInvestorPosition->UseMargin, pInvestorPosition->FrozenMargin, pInvestorPosition->FrozenCash, pInvestorPosition->FrozenCommission, pInvestorPosition->CashIn, pInvestorPosition->Commission, pInvestorPosition->CloseProfit, pInvestorPosition->PositionProfit, pInvestorPosition->PreSettlementPrice, pInvestorPosition->SettlementPrice, pInvestorPosition->TradingDay, pInvestorPosition->SettlementID, pInvestorPosition->OpenCost, pInvestorPosition->ExchangeMargin, pInvestorPosition->CombPosition, pInvestorPosition->CombLongFrozen, pInvestorPosition->CombShortFrozen, pInvestorPosition->CloseProfitByDate, pInvestorPosition->CloseProfitByTrade, pInvestorPosition->TodayPosition, pInvestorPosition->MarginRateByMoney, pInvestorPosition->MarginRateByVolume, pInvestorPosition->StrikeFrozen, pInvestorPosition->StrikeFrozenAmount, pInvestorPosition->AbandonFrozen ); struct trader_msg_trader_struct_def oMsg; oMsg.type = TRADER_RECV_TRADER_ON_QRY_INVESTOR_POSITION; oMsg.ErrorCd = 0; oMsg.bIsLast = bIsLast; strcpy(oMsg.oPosition.InstrumentID, pInvestorPosition->InstrumentID); oMsg.oPosition.PositionDate = pInvestorPosition->PositionDate; oMsg.oPosition.PosiDirection = pInvestorPosition->PosiDirection; oMsg.oPosition.YdPosition = pInvestorPosition->YdPosition; oMsg.oPosition.TodayPosition = pInvestorPosition->TodayPosition; oMsg.oPosition.Position = pInvestorPosition->Position; oMsg.oPosition.LongFrozen = pInvestorPosition->LongFrozen; oMsg.oPosition.ShortFrozen = pInvestorPosition->ShortFrozen; cmn_util_evbuffer_send(self->fd, (unsigned char*)&oMsg, sizeof(oMsg)); } } void ctp_trader_on_rtn_instrument_status(void* arg, CThostFtdcInstrumentStatusField *pInstrumentStatus) { CMN_INFO("\n" "pInstrumentStatus->InstrumentID=[%s]\n" "pInstrumentStatus->InstrumentStatus=[%c]\n" "pInstrumentStatus->TradingSegmentSN=[%d]\n" "pInstrumentStatus->EnterTime=[%s]\n" "pInstrumentStatus->EnterReason=[%c]\n", pInstrumentStatus->InstrumentID, pInstrumentStatus->InstrumentStatus, pInstrumentStatus->TradingSegmentSN, pInstrumentStatus->EnterTime, pInstrumentStatus->EnterReason ); } int ctp_trader_api_init(ctp_trader_api* self) { CMN_DEBUG("Enter!\n"); return 0; } int ctp_trader_api_start(ctp_trader_api* self, char* user_id, char* pwd) { CMN_DEBUG("Enter!\n"); strcpy(self->UserId, user_id); strcpy(self->Passwd, pwd); if(!self->bInit){ CThostFtdcTraderApi* pUserApi = CThostFtdcTraderApi::CreateFtdcTraderApi(); CCtpTraderHandler* pHandler = new CCtpTraderHandler(ctp_trader_api_cb_get(), self); self->pUserApi = (void*)pUserApi; self->pHandler = (void*)pHandler; pUserApi->RegisterFront(self->FrontAddress); pUserApi->SubscribePrivateTopic(THOST_TERT_RESUME); pUserApi->SubscribePublicTopic(THOST_TERT_RESUME); pUserApi->RegisterSpi(pHandler); pUserApi->Init(); self->bInit = 1; }else{ if(!self->bConnected){ CThostFtdcTraderApi* pUserApi = (CThostFtdcTraderApi*)self->pUserApi; CThostFtdcReqUserLoginField reqUserLogin; memset(&reqUserLogin,0,sizeof(CThostFtdcReqUserLoginField)); strcpy(reqUserLogin.BrokerID, self->BrokenId); strcpy(reqUserLogin.UserID, self->UserId); strcpy(reqUserLogin.Password, self->Passwd); strcpy(reqUserLogin.UserProductInfo,"Trader Login"); pUserApi->ReqUserLogin(&reqUserLogin, self->nLocalId++); }else{ ctp_trader_api_mng(self, 0, ""); } } return 0; } int ctp_trader_api_stop(ctp_trader_api* self) { CMN_DEBUG("Enter!\n"); return 0; } int ctp_trader_api_order_insert(ctp_trader_api* self, char* inst, char* local_id, char buy_sell, char open_close, double price, int vol) { CMN_DEBUG("Enter!\n"); CThostFtdcTraderApi* pTrader = (CThostFtdcTraderApi*)self->pUserApi; CThostFtdcInputOrderField req; memset(&req, 0, sizeof(req)); strcpy(req.BrokerID, self->BrokenId); //应用单元代码 strcpy(req.InvestorID, self->InvestorID); //投资者代码 strcpy(req.InstrumentID, inst); //合约代码 strcpy(req.OrderRef, local_id); //报单引用 strcpy(req.UserID, self->UserId); //投资者代码 req.OrderPriceType = THOST_FTDC_OPT_LimitPrice;//价格类型=限价 req.Direction = buy_sell; //买卖方向 req.CombOffsetFlag[0] = open_close; //组合开平标志:开仓 req.CombHedgeFlag[0] = self->HedgeFlag; //组合投机套保标志 req.LimitPrice = price; //价格 req.VolumeTotalOriginal = vol; ///数量 req.TimeCondition = THOST_FTDC_TC_GFD; //有效期类型:当日有效 req.VolumeCondition = THOST_FTDC_VC_AV; //成交量类型:任何数量 req.MinVolume = 1; //最小成交量:1 req.ContingentCondition = THOST_FTDC_CC_Immediately; //触发条件:立即 req.ForceCloseReason = THOST_FTDC_FCC_NotForceClose; //强平原因:非强平 req.IsAutoSuspend = 0; //自动挂起标志:否 req.UserForceClose = 0; //用户强评标志:否 pTrader->ReqOrderInsert(&req, self->nLocalId++); CMN_INFO("\n" "req.BrokerID=[%s]\n" "req.InvestorID=[%s]\n" "req.InstrumentID=[%s]\n" "req.OrderRef=[%s]\n" "req.UserID=[%s]\n" "req.OrderPriceType=[%c]\n" "req.Direction=[%c]\n" "req.CombOffsetFlag=[%c]\n" "req.CombHedgeFlag=[%c]\n" "req.LimitPrice=[%10.2lf]\n" "req.VolumeTotalOriginal=[%d]\n" "req.TimeCondition=[%c]\n" "req.VolumeCondition=[%c]\n" "req.MinVolume=[%d]\n" "req.ForceCloseReason=[%c]\n" "req.IsAutoSuspend=[%d]\n" "req.UserForceClose=[%d]\n", req.BrokerID, req.InvestorID, req.InstrumentID, req.OrderRef, req.UserID, req.OrderPriceType, req.Direction, req.CombOffsetFlag[0], req.CombHedgeFlag[0], req.LimitPrice, req.VolumeTotalOriginal, req.TimeCondition, req.VolumeCondition, req.MinVolume, req.ForceCloseReason, req.IsAutoSuspend, req.UserForceClose); return 0; } int ctp_trader_api_order_action(ctp_trader_api* self, char* inst, char* local_id, char* org_local_id, char* exchange_id, char* order_sys_id) { CMN_DEBUG("Enter!\n"); CThostFtdcTraderApi* pTrader = (CThostFtdcTraderApi*)self->pUserApi; CThostFtdcInputOrderActionField OrderAction; memset(&OrderAction,0,sizeof(CThostFtdcInputOrderActionField)); strcpy(OrderAction.BrokerID, self->BrokenId); //经纪公司代码 strcpy(OrderAction.InvestorID, self->InvestorID); //投资者代码 OrderAction.OrderActionRef = atoi(local_id); //strcpy(req.OrderRef, orderRef); //报单引用 //req.FrontID = frontId; //前置编号 //req.SessionID = sessionId; //会话编号 strcpy(OrderAction.ExchangeID, exchange_id); strcpy(OrderAction.OrderSysID, order_sys_id); OrderAction.ActionFlag = THOST_FTDC_AF_Delete; //操作标志 pTrader->ReqOrderAction(&OrderAction, self->nLocalId++); CMN_INFO("\n" "OrderAction.OrderRef=[%s]\n" "OrderAction.BrokerID=[%s]\n" "OrderAction.InvestorID=[%s]\n" "OrderAction.OrderActionRef=[%d]\n" "OrderAction.ExchangeID=[%s]\n" "OrderAction.OrderSysID=[%s]\n" "OrderAction.ActionFlag=[%c]\n", org_local_id, OrderAction.BrokerID, OrderAction.InvestorID, OrderAction.OrderActionRef, OrderAction.ExchangeID, OrderAction.OrderSysID, OrderAction.ActionFlag); return 0; } int ctp_trader_api_query_instrument(ctp_trader_api* self) { CMN_DEBUG("Enter!\n"); CThostFtdcTraderApi* pTrader = (CThostFtdcTraderApi*)self->pUserApi; // 查询合约列表 CThostFtdcQryInstrumentField QryInstrument; memset(&QryInstrument,0,sizeof(CThostFtdcQryInstrumentField)); //strcpy(QryInstrument.ExchangeID,"SHFE"); pTrader->ReqQryInstrument(&QryInstrument,self->nLocalId++); return 0; } int ctp_trader_api_query_user_investor(ctp_trader_api* self) { CMN_DEBUG("Enter!\n"); CThostFtdcTraderApi* pTrader = (CThostFtdcTraderApi*)self->pUserApi; // 查询投资者编号 CThostFtdcQryInvestorField QryUserInvestor; memset(&QryUserInvestor, 0, sizeof(QryUserInvestor)); pTrader->ReqQryInvestor(&QryUserInvestor, self->nLocalId++); return 0; } int ctp_trader_api_get_tradingday(ctp_trader_api* self, char* tradingday) { CMN_DEBUG("Enter!\n"); CThostFtdcTraderApi* pUserApi = (CThostFtdcTraderApi*)self->pUserApi; strcpy(tradingday, pUserApi->GetTradingDay()); return 0; } int ctp_trader_api_get_maxuserlocalid(ctp_trader_api* self, char* local_id) { CMN_DEBUG("Enter!\n"); strcpy(local_id, self->MaxOrderLocalID); return 0; } int ctp_trader_api_mng(ctp_trader_api* self, int error_cd, char* error_msg) { CMN_DEBUG("Enter!\n"); struct trader_msg_trader_struct_def oMsg; oMsg.type = TRADER_RECV_TRADER_ON_LOGIN; if(error_cd){ oMsg.ErrorCd = -10000 - error_cd; strcpy(oMsg.ErrorMsg, error_msg); }else{ oMsg.ErrorCd = 0; strcpy(oMsg.ErrorMsg, ""); } cmn_util_evbuffer_send(self->fd, (unsigned char*)&oMsg, sizeof(oMsg)); return 0; } int ctp_trader_api_qry_instrument(ctp_trader_api* self, char* instrument, int last, int err_cd) { CMN_DEBUG("Enter!\n"); struct trader_msg_trader_struct_def oMsg; oMsg.type = TRADER_RECV_TRADER_ON_QRY_INSTRUMENT; oMsg.ErrorCd = -10000 - err_cd; oMsg.bIsLast = last; if(!err_cd){ oMsg.ErrorCd = 0; strcpy(oMsg.InstrumentID, instrument); } cmn_util_evbuffer_send(self->fd, (unsigned char*)&oMsg, sizeof(oMsg)); return 0; } int ctp_trader_api_qry_settlement_info_confirm(ctp_trader_api* self) { CMN_DEBUG("Enter!\n"); CThostFtdcTraderApi* pTrader = (CThostFtdcTraderApi*)self->pUserApi; CThostFtdcSettlementInfoConfirmField req; memset(&req, 0, sizeof(CThostFtdcSettlementInfoConfirmField)); strcpy(req.BrokerID, self->BrokenId); strcpy(req.InvestorID, self->UserId); strcpy(req.ConfirmDate, pTrader->GetTradingDay()); strcpy(req.ConfirmTime, "09:00:00"); pTrader->ReqSettlementInfoConfirm(&req, self->nLocalId++); return 0; } int ctp_trader_api_qry_investor_position(ctp_trader_api* self) { CMN_DEBUG("Enter!\n"); CThostFtdcTraderApi* pTrader = (CThostFtdcTraderApi*)self->pUserApi; CThostFtdcQryInvestorPositionField req; memset(&req, 0, sizeof(CThostFtdcQryInvestorPositionField)); strcpy(req.BrokerID, self->BrokenId); strcpy(req.InvestorID, self->UserId); pTrader->ReqQryInvestorPosition(&req, self->nLocalId++); return 0; } ctp_trader_api* ctp_trader_api_new(evutil_socket_t fd) { ctp_trader_api* self = (ctp_trader_api*)malloc(sizeof(ctp_trader_api)); self->fd = fd; self->pUserApi = (void*)NULL; self->pHandler = (void*)NULL; self->bConnected = 0; self->bInit = 0; self->nLocalId = 0; self->pMethod = ctp_trader_api_method_get(); return self; } void ctp_trader_api_free(ctp_trader_api* self) { if(self->bInit){ CThostFtdcTraderApi* pUserApi = (CThostFtdcTraderApi*)self->pUserApi ; CCtpTraderHandler* pHandler = (CCtpTraderHandler*)self->pHandler; pUserApi->Release(); delete pHandler; self->bInit = 0; } if(self){ free(self); } }
0cd751b3187dab6394e1b93fa50d0f0bcc71ede8
f8d76935f342abceff51a90a2844110ac57a4d2e
/solution/srm519_threeteleports.cpp
45054ee24e01e96a9fe8f4d6ec48e6c8ba6e7624
[]
no_license
rick-qiu/topcoder
b36cc5bc571f1cbc7be18fdc863a1800deeb5de1
04adddbdc49e35e10090d33618be90fc8d3b8e7d
refs/heads/master
2021-01-01T05:59:41.264459
2014-05-22T06:14:43
2014-05-22T06:14:43
11,315,215
1
0
null
null
null
null
UTF-8
C++
false
false
95,377
cpp
srm519_threeteleports.cpp
/******************************************************************************* * Automatically generated code for TopCode SRM Problem * Problem URL: http://community.topcoder.com/stat?c=problem_statement&pm=11554 *******************************************************************************/ #include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <ctime> using namespace std; class ThreeTeleports { public: int shortestDistance(int xMe, int yMe, int xHome, int yHome, vector<string> teleports); }; int ThreeTeleports::shortestDistance(int xMe, int yMe, int xHome, int yHome, vector<string> teleports) { int ret; return ret; } int test0() { int xMe = 3; int yMe = 3; int xHome = 4; int yHome = 5; vector<string> teleports = {"1000 1001 1000 1002", "1000 1003 1000 1004", "1000 1005 1000 1006"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 3; if(result == expected) { cout << "Test Case 0: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 0: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test1() { int xMe = 0; int yMe = 0; int xHome = 20; int yHome = 20; vector<string> teleports = {"1 1 18 20", "1000 1003 1000 1004", "1000 1005 1000 1006"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 14; if(result == expected) { cout << "Test Case 1: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 1: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test2() { int xMe = 0; int yMe = 0; int xHome = 20; int yHome = 20; vector<string> teleports = {"1000 1003 1000 1004", "18 20 1 1", "1000 1005 1000 1006"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 14; if(result == expected) { cout << "Test Case 2: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 2: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test3() { int xMe = 10; int yMe = 10; int xHome = 10000; int yHome = 20000; vector<string> teleports = {"1000 1003 1000 1004", "3 3 10004 20002", "1000 1005 1000 1006"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 30; if(result == expected) { cout << "Test Case 3: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 3: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test4() { int xMe = 3; int yMe = 7; int xHome = 10000; int yHome = 30000; vector<string> teleports = {"3 10 5200 4900", "12212 8699 9999 30011", "12200 8701 5203 4845"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 117; if(result == expected) { cout << "Test Case 4: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 4: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test5() { int xMe = 0; int yMe = 0; int xHome = 1000000000; int yHome = 1000000000; vector<string> teleports = {"1 1 2 2", "3 3 4 4", "5 5 6 6"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 2000000000; if(result == expected) { cout << "Test Case 5: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 5: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test6() { int xMe = 0; int yMe = 1000000000; int xHome = 1000000000; int yHome = 0; vector<string> teleports = {"1 1 2 2", "3 3 4 4", "5 5 6 6"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 2000000000; if(result == expected) { cout << "Test Case 6: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 6: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test7() { int xMe = 0; int yMe = 0; int xHome = 1000000000; int yHome = 1000000000; vector<string> teleports = {"0 1 0 999999999", "1 1000000000 999999999 0", "1000000000 1 1000000000 999999999"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 36; if(result == expected) { cout << "Test Case 7: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 7: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test8() { int xMe = 7; int yMe = 2; int xHome = 999999991; int yHome = 4; vector<string> teleports = {"0 1 0 999999999", "1 1000000000 999999999 0", "1000000000 1 1000000000 999999999"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 42; if(result == expected) { cout << "Test Case 8: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 8: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test9() { int xMe = 10; int yMe = 500000000; int xHome = 1000000000; int yHome = 1000000000; vector<string> teleports = {"0 1 0 999999999", "1 1000000000 999999999 0", "1000000000 1 1000000000 999999999"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 500000032; if(result == expected) { cout << "Test Case 9: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 9: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test10() { int xMe = 100000000; int yMe = 500000000; int xHome = 900000000; int yHome = 500000000; vector<string> teleports = {"0 1 0 999999999", "1 1000000000 999999999 0", "1000000000 1 1000000000 999999999"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 800000000; if(result == expected) { cout << "Test Case 10: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 10: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test11() { int xMe = 100000000; int yMe = 100000000; int xHome = 900000000; int yHome = 900000000; vector<string> teleports = {"0 1 0 999999999", "1 1000000000 999999999 0", "1000000000 1 1000000000 999999999"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 400000032; if(result == expected) { cout << "Test Case 11: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 11: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test12() { int xMe = 0; int yMe = 0; int xHome = 1000000000; int yHome = 1000000000; vector<string> teleports = {"10 10 20 20", "30 30 40 40", "50 50 60 60"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1999999970; if(result == expected) { cout << "Test Case 12: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 12: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test13() { int xMe = 630664613; int yMe = 48733225; int xHome = 873984926; int yHome = 111605493; vector<string> teleports = {"496495503 532857995 6389190 205314732", "351146273 99276298 616908938 737305630", "149168564 223552081 896571830 750247780"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 306192581; if(result == expected) { cout << "Test Case 13: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 13: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test14() { int xMe = 50408182; int yMe = 27065196; int xHome = 71243950; int yHome = 211493804; vector<string> teleports = {"460798245 193700180 768780978 110314044", "161021468 381388250 38241460 277796212", "132401597 100164166 555601411 757948526"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 205264376; if(result == expected) { cout << "Test Case 14: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 14: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test15() { int xMe = 712631043; int yMe = 118540020; int xHome = 532788793; int yHome = 140802423; vector<string> teleports = {"260045739 373051551 534047058 967908021", "420942603 167942392 1752658 859937375", "928889958 363876166 948383842 599106823"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 202104653; if(result == expected) { cout << "Test Case 15: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 15: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test16() { int xMe = 546584061; int yMe = 324784219; int xHome = 966183692; int yHome = 999475275; vector<string> teleports = {"661541168 612406094 429392943 370311369", "680615656 677465501 325928495 616181925", "547062176 137391772 718766719 174029970"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 854429983; if(result == expected) { cout << "Test Case 16: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 16: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test17() { int xMe = 866154370; int yMe = 322991744; int xHome = 210516672; int yHome = 546263750; vector<string> teleports = {"96594644 804330222 205018575 615354689", "672041722 224166329 767001599 433866842", "829621741 766952971 35347560 237749511"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 878909704; if(result == expected) { cout << "Test Case 17: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 17: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test18() { int xMe = 813300993; int yMe = 984676869; int xHome = 954874690; int yHome = 294675479; vector<string> teleports = {"547128517 972299039 241873242 209633570", "884270246 526283458 348993624 663818661", "443452221 232587364 147469751 396526508"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 831575087; if(result == expected) { cout << "Test Case 18: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 18: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test19() { int xMe = 824232356; int yMe = 763852653; int xHome = 316650882; int yHome = 317179572; vector<string> teleports = {"666331214 94848296 477923139 276070409", "399770590 652426803 611280619 557969047", "387720696 51570693 580888001 747874855"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 596000856; if(result == expected) { cout << "Test Case 19: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 19: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test20() { int xMe = 272910313; int yMe = 968932248; int xHome = 211109133; int yHome = 454430785; vector<string> teleports = {"276284707 433053339 420117411 756213781", "463896611 622885230 316291167 744006274", "882163211 914764017 201629599 992297292"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 446478595; if(result == expected) { cout << "Test Case 20: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 20: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test21() { int xMe = 333373883; int yMe = 162127112; int xHome = 758288658; int yHome = 535408203; vector<string> teleports = {"301497316 99178126 799699526 915898169", "510380099 847661103 663240458 643662878", "516479190 886338396 630580976 727878106"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 516726397; if(result == expected) { cout << "Test Case 21: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 21: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test22() { int xMe = 513658547; int yMe = 74790663; int xHome = 649497119; int yHome = 4513793; vector<string> teleports = {"897416087 150884582 338400872 733815494", "317208874 536047322 304705529 828936845", "876575 650834011 927727672 614182273"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 206115442; if(result == expected) { cout << "Test Case 22: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 22: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test23() { int xMe = 890781683; int yMe = 725016422; int xHome = 223949611; int yHome = 729365455; vector<string> teleports = {"837010969 527691546 465582551 801723024", "53348214 899908371 238290034 675589157", "378572645 776632317 67054402 300225591"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 565086109; if(result == expected) { cout << "Test Case 23: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 23: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test24() { int xMe = 671841872; int yMe = 266168722; int xHome = 761730781; int yHome = 351958038; vector<string> teleports = {"377298076 821197206 600551083 929681356", "474188466 626805504 181527483 556858312", "123521315 82002428 223621568 656571357"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 175678225; if(result == expected) { cout << "Test Case 24: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 24: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test25() { int xMe = 113609575; int yMe = 199402546; int xHome = 971590229; int yHome = 883308753; vector<string> teleports = {"744525829 50839519 958841937 382679275", "163149158 740144914 392701099 790710178", "472377598 380977537 444595305 723543772"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1227102929; if(result == expected) { cout << "Test Case 25: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 25: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test26() { int xMe = 34745001; int yMe = 812395769; int xHome = 978246999; int yHome = 451840145; vector<string> teleports = {"535143777 712994346 29745647 117880392", "170907737 778817344 196765135 218545545", "851728243 112142809 437824671 175015147"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 920547207; if(result == expected) { cout << "Test Case 26: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 26: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test27() { int xMe = 238531736; int yMe = 490888840; int xHome = 818814410; int yHome = 289729074; vector<string> teleports = {"49633963 630835852 380961180 442790597", "987665175 651154119 683443633 862022026", "165297338 279480238 832064542 526237341"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 534401409; if(result == expected) { cout << "Test Case 27: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 27: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test28() { int xMe = 726193834; int yMe = 757504680; int xHome = 110855185; int yHome = 371980211; vector<string> teleports = {"221032227 914814041 177485617 599940635", "143241481 504287599 116315997 508799197", "467907376 904218420 8586378 467750868"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 603039672; if(result == expected) { cout << "Test Case 28: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 28: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test29() { int xMe = 521929712; int yMe = 318949212; int xHome = 953456006; int yHome = 988385697; vector<string> teleports = {"888889590 491833199 453233527 579263848", "254546297 955685711 462575961 294916199", "467724564 950513093 670863496 432807182"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 786395810; if(result == expected) { cout << "Test Case 29: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 29: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test30() { int xMe = 6346093; int yMe = 433210778; int xHome = 990738508; int yHome = 655051170; vector<string> teleports = {"838325312 552167142 978083117 809531431", "85317813 536122004 81312943 111391313", "452715627 313591789 202784053 331060"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1118071245; if(result == expected) { cout << "Test Case 30: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 30: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test31() { int xMe = 23703008; int yMe = 294481282; int xHome = 879597716; int yHome = 890702265; vector<string> teleports = {"548714867 864135503 299644062 152852762", "744500033 326837995 758408571 796371805", "588539897 957430875 542141665 246273536"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 775019195; if(result == expected) { cout << "Test Case 31: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 31: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test32() { int xMe = 145498650; int yMe = 392127453; int xHome = 106767214; int yHome = 175331073; vector<string> teleports = {"535104496 227065053 131260293 229282354", "799049409 992413071 551610714 493058672", "997181444 979615910 515667313 732225457"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 255527816; if(result == expected) { cout << "Test Case 32: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 32: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test33() { int xMe = 43767499; int yMe = 293613968; int xHome = 923531489; int yHome = 877694217; vector<string> teleports = {"43766240 293262939 422848910 391571754", "423570510 391739114 860143685 364709398", "859696623 365194596 922682678 877070828"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 3645738; if(result == expected) { cout << "Test Case 33: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 33: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test34() { int xMe = 257303836; int yMe = 567013022; int xHome = 559816427; int yHome = 455017415; vector<string> teleports = {"908198683 645993163 102156109 463093409", "559129648 454419496 101580415 463430281", "907886971 646772770 256344090 566821070"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 4440311; if(result == expected) { cout << "Test Case 34: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 34: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test35() { int xMe = 251747174; int yMe = 214945386; int xHome = 915592983; int yHome = 47527; vector<string> teleports = {"46330587 376224822 343332664 837421511", "342600537 838350568 916109879 795241", "46508754 375623483 252326212 214982438"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 4321420; if(result == expected) { cout << "Test Case 35: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 35: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test36() { int xMe = 730373425; int yMe = 894753427; int xHome = 242867242; int yHome = 580292800; vector<string> teleports = {"731370559 894260538 172085400 979696883", "363158 916339097 172202330 980134715", "1092044 916434891 242013485 579549409"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 4466643; if(result == expected) { cout << "Test Case 36: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 36: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test37() { int xMe = 44431990; int yMe = 149823130; int xHome = 366572829; int yHome = 342647922; vector<string> teleports = {"256908645 198313227 709862831 854534743", "710540444 855250605 44064139 150465583", "257583322 198383935 366941723 343167644"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 4037810; if(result == expected) { cout << "Test Case 37: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 37: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test38() { int xMe = 26554310; int yMe = 445514835; int xHome = 921490406; int yHome = 189666250; vector<string> teleports = {"232701270 702993783 27114202 445183655", "232197206 703689877 867358576 813207569", "922407358 189531062 866873232 813512913"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 3934088; if(result == expected) { cout << "Test Case 38: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 38: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test39() { int xMe = 806025998; int yMe = 977572157; int xHome = 137475848; int yHome = 518499417; vector<string> teleports = {"300541907 750846639 261777803 20498007", "806086410 977277507 299630466 751837744", "137470494 518212575 260805942 20756966"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 3780654; if(result == expected) { cout << "Test Case 39: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 39: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test40() { int xMe = 172221514; int yMe = 635197135; int xHome = 513983821; int yHome = 30256221; vector<string> teleports = {"228570717 762145365 171563344 635477977", "514432142 30864120 246132856 854567327", "229215795 762882261 246873370 855236210"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 4786633; if(result == expected) { cout << "Test Case 40: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 40: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test41() { int xMe = 484243167; int yMe = 568782388; int xHome = 635773238; int yHome = 553089901; vector<string> teleports = {"433961062 561211307 731058277 471001013", "635422730 552873347 433722128 562168089", "484182728 569260814 730742352 471974824"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 3591409; if(result == expected) { cout << "Test Case 41: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 41: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test42() { int xMe = 888440684; int yMe = 918829226; int xHome = 463020864; int yHome = 489848629; vector<string> teleports = {"888499837 917836841 37096754 270276299", "36615580 270408718 204642168 268085611", "462714380 489547658 203676351 267919738"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 3404306; if(result == expected) { cout << "Test Case 42: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 42: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test43() { int xMe = 847805538; int yMe = 349559051; int xHome = 718319133; int yHome = 781723914; vector<string> teleports = {"848735459 349913415 875148587 836885115", "853355015 139284922 717935849 781696273", "853922317 139254496 875553612 836359458"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 3223650; if(result == expected) { cout << "Test Case 43: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 43: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test44() { int xMe = 972542529; int yMe = 533951492; int xHome = 404979554; int yHome = 524765571; vector<string> teleports = {"54197249 420779627 658459747 295997579", "404840511 524223595 657614524 296528492", "972648462 534303792 54861802 421546927"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 3947271; if(result == expected) { cout << "Test Case 44: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 44: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test45() { int xMe = 922397295; int yMe = 120406410; int xHome = 946248138; int yHome = 902180543; vector<string> teleports = {"968688738 508615169 947154032 901341020", "922035635 119733598 505998745 436520840", "506560174 436417638 968296341 508660983"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 3882761; if(result == expected) { cout << "Test Case 45: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 45: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test46() { int xMe = 140442590; int yMe = 423955552; int xHome = 381051282; int yHome = 739157713; vector<string> teleports = {"817785273 844831633 807923175 758265776", "807505937 757728853 141318993 424271395", "380472740 740100286 817007921 845037669"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 4650940; if(result == expected) { cout << "Test Case 46: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 46: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test47() { int xMe = 265812178; int yMe = 546280252; int xHome = 199699268; int yHome = 797385816; vector<string> teleports = {"767300196 303589461 200493762 796484481", "185452201 185667426 766498232 304308185", "265722902 547031623 185297155 185986578"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 4531392; if(result == expected) { cout << "Test Case 47: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 47: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test48() { int xMe = 632841087; int yMe = 294160314; int xHome = 329243573; int yHome = 743769717; vector<string> teleports = {"743660503 752676070 376957534 447358131", "743084539 753638725 633770263 293932260", "377237876 448284125 329013656 743251417"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 4650432; if(result == expected) { cout << "Test Case 48: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 48: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test49() { int xMe = 361636101; int yMe = 203058830; int xHome = 434802682; int yHome = 881001269; vector<string> teleports = {"221381092 261647733 360887805 202979837", "434024867 880063690 562486609 644340562", "561595250 645213325 221678001 260880078"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 5371399; if(result == expected) { cout << "Test Case 49: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 49: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test50() { int xMe = 9649579; int yMe = 460291009; int xHome = 5078017; int yHome = 414501854; vector<string> teleports = {"3726072 525772909 891715551 699525377", "3963892 526707921 10367369 459902547", "892241242 698944467 5573758 414937410"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 4317012; if(result == expected) { cout << "Test Case 50: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 50: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test51() { int xMe = 760370766; int yMe = 313775395; int xHome = 436426943; int yHome = 133380682; vector<string> teleports = {"760509378 314607049 981117324 144817332", "342167113 210421618 981616998 145710117", "342799252 210073412 435501254 133316968"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 4332503; if(result == expected) { cout << "Test Case 51: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 51: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test52() { int xMe = 415423343; int yMe = 524068936; int xHome = 871257497; int yHome = 510345517; vector<string> teleports = {"166734363 756275100 483158338 186218485", "165862224 755668983 415920710 523303262", "871082452 509851953 482192307 186533833"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 4691315; if(result == expected) { cout << "Test Case 52: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 52: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test53() { int xMe = 408709545; int yMe = 19818312; int xHome = 907384075; int yHome = 935316792; vector<string> teleports = {"908013745 936128408 408766869 19792665", "907700932 935589088 408222639 20044607", "906906269 935720441 408683231 19615732"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1110359; if(result == expected) { cout << "Test Case 53: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 53: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test54() { int xMe = 678896388; int yMe = 272811031; int xHome = 974078426; int yHome = 686078654; vector<string> teleports = {"975017215 685758903 678906491 272803813", "974676866 685915435 678572249 273284657", "974247459 686825470 679414142 272893204"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1275871; if(result == expected) { cout << "Test Case 54: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 54: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test55() { int xMe = 834690520; int yMe = 940005356; int xHome = 958288744; int yHome = 8948665; vector<string> teleports = {"957592754 8653203 835460756 939933504", "834998702 940724437 959022890 9627275", "835227301 940899508 958130690 9331917"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1833550; if(result == expected) { cout << "Test Case 55: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 55: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test56() { int xMe = 860336881; int yMe = 6062489; int xHome = 565263345; int yHome = 621528510; vector<string> teleports = {"859658631 6004615 565888255 620711850", "859926272 6954049 564361902 621511067", "564631673 621041364 859899536 6038574"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1580088; if(result == expected) { cout << "Test Case 56: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 56: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test57() { int xMe = 553455458; int yMe = 915427850; int xHome = 12558279; int yHome = 382265250; vector<string> teleports = {"553123299 914597814 12313069 382684524", "554028822 915928902 12858951 382663825", "554322441 915834138 13368240 381912317"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1773673; if(result == expected) { cout << "Test Case 57: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 57: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test58() { int xMe = 883668557; int yMe = 648159861; int xHome = 725143100; int yHome = 363296639; vector<string> teleports = {"725987322 363002914 884256666 649095099", "883913159 648543784 726045820 362936145", "883509057 647192604 725410094 364060451"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1891749; if(result == expected) { cout << "Test Case 58: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 58: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test59() { int xMe = 57410944; int yMe = 767040452; int xHome = 442440953; int yHome = 202788472; vector<string> teleports = {"443351874 203641790 57320885 766384843", "443434206 201903966 57988518 766691811", "442668676 203163481 57393912 766065785"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1594441; if(result == expected) { cout << "Test Case 59: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 59: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test60() { int xMe = 655895284; int yMe = 670602750; int xHome = 15785618; int yHome = 752456236; vector<string> teleports = {"15098545 751733030 656876365 670352215", "655132632 671281532 16702367 751800318", "15940240 752817614 655841285 671117169"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1084428; if(result == expected) { cout << "Test Case 60: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 60: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test61() { int xMe = 216564110; int yMe = 232397552; int xHome = 663275024; int yHome = 217633078; vector<string> teleports = {"663089563 218618259 217423090 231502831", "662994348 216866075 217342483 232800025", "663471159 218550458 216318662 232136976"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1619549; if(result == expected) { cout << "Test Case 61: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 61: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test62() { int xMe = 310401578; int yMe = 851184245; int xHome = 945105322; int yHome = 826414352; vector<string> teleports = {"945634105 826112125 311004685 851742792", "945712756 826876436 310586196 851789967", "309518520 851821934 945666020 826366500"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1859868; if(result == expected) { cout << "Test Case 62: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 62: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test63() { int xMe = 140529534; int yMe = 778518573; int xHome = 421124743; int yHome = 902221938; vector<string> teleports = {"420464081 901986466 140769925 778200802", "140123764 779311194 421946918 901656305", "140146583 779165308 420195493 902719178"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1454306; if(result == expected) { cout << "Test Case 63: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 63: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test64() { int xMe = 172612040; int yMe = 218257441; int xHome = 479447071; int yHome = 954584480; vector<string> teleports = {"480081384 954546952 172350045 218221178", "172512847 217555053 478775303 954659375", "479248236 955087303 172067841 217534668"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 970109; if(result == expected) { cout << "Test Case 64: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 64: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test65() { int xMe = 365148679; int yMe = 516462508; int xHome = 262445444; int yHome = 854069332; vector<string> teleports = {"364595394 516628551 262378156 855055435", "261529527 853236558 364819650 517347108", "262578930 853982244 364790325 515590378"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1451068; if(result == expected) { cout << "Test Case 65: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 65: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test66() { int xMe = 943571916; int yMe = 789588185; int xHome = 27475276; int yHome = 191482273; vector<string> teleports = {"942855606 790455407 27002990 192178557", "944484156 788843306 27199778 191479818", "27414378 190509090 944204209 790480792"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1935082; if(result == expected) { cout << "Test Case 66: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 66: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test67() { int xMe = 884679002; int yMe = 526275681; int xHome = 344998300; int yHome = 877963230; vector<string> teleports = {"885093350 525281944 345752526 877149167", "885476268 526368121 345867073 877065320", "345135154 878342657 885153968 525573813"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1693125; if(result == expected) { cout << "Test Case 67: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 67: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test68() { int xMe = 260633944; int yMe = 764469353; int xHome = 447834027; int yHome = 260101624; vector<string> teleports = {"260203725 763952424 447979553 260939680", "447953426 260140251 259770878 765372207", "261133629 764276065 447343759 260069695"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1215180; if(result == expected) { cout << "Test Case 68: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 68: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test69() { int xMe = 456105671; int yMe = 672341185; int xHome = 160456638; int yHome = 1542670; vector<string> teleports = {"159578348 1057696 455535149 673275958", "159905957 1767193 455115669 672513105", "457055197 671916146 159521177 1975481"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1937136; if(result == expected) { cout << "Test Case 69: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 69: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test70() { int xMe = 219563023; int yMe = 657800264; int xHome = 161354481; int yHome = 990960963; vector<string> teleports = {"219715046 658052159 160433557 991306084", "220274019 658476931 162228969 991207664", "162001360 991472930 219295899 657259520"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1669973; if(result == expected) { cout << "Test Case 70: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 70: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test71() { int xMe = 871816760; int yMe = 773474856; int xHome = 69431425; int yHome = 582201089; vector<string> teleports = {"68549041 582125418 872374087 772811290", "871091348 773871328 69888587 582681865", "871654744 773597092 70073195 583080619"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1805562; if(result == expected) { cout << "Test Case 71: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 71: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test72() { int xMe = 723552702; int yMe = 446044757; int xHome = 506632797; int yHome = 212654751; vector<string> teleports = {"722647315 445855628 506673455 211929595", "506032528 213289618 723983513 446994815", "507242513 213198187 724300993 446713353"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1860340; if(result == expected) { cout << "Test Case 72: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 72: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test73() { int xMe = 643729313; int yMe = 579469950; int xHome = 458675469; int yHome = 564240749; vector<string> teleports = {"643737194 579541992 292324374 575773962", "459114022 564318234 644488528 579128105", "458680424 564330752 292270286 575795554"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 250581; if(result == expected) { cout << "Test Case 73: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 73: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test74() { int xMe = 645480437; int yMe = 30976971; int xHome = 642491624; int yHome = 813956858; vector<string> teleports = {"440826652 674992349 645464695 30940501", "645813109 31197660 641501668 813884275", "642411071 814042803 440923466 674932455"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 375438; if(result == expected) { cout << "Test Case 74: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 74: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test75() { int xMe = 194908615; int yMe = 399537617; int xHome = 480772206; int yHome = 679952356; vector<string> teleports = {"710432895 532260636 480829253 679992698", "481347899 680307272 194314622 400188243", "194846489 399496469 710359037 532324233"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 338138; if(result == expected) { cout << "Test Case 75: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 75: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test76() { int xMe = 188203740; int yMe = 894001326; int xHome = 611862458; int yHome = 112072569; vector<string> teleports = {"187601640 893974686 612735834 111346634", "664716824 754351240 188237572 893968702", "611876923 112140395 664649713 754308748"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 258370; if(result == expected) { cout << "Test Case 76: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 76: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test77() { int xMe = 410334001; int yMe = 976686045; int xHome = 548006854; int yHome = 959698717; vector<string> teleports = {"409398287 976182602 547051880 959444509", "548651986 959251373 992348428 235453981", "993330733 235549593 411032437 977655203"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 2648349; if(result == expected) { cout << "Test Case 77: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 77: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test78() { int xMe = 108123087; int yMe = 218083574; int xHome = 952167030; int yHome = 281512065; vector<string> teleports = {"951647202 281079347 108031518 217793901", "851133055 344629831 108157750 218105234", "851093848 344571693 952140430 281593011"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 261234; if(result == expected) { cout << "Test Case 78: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 78: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test79() { int xMe = 640961680; int yMe = 9800688; int xHome = 547936182; int yHome = 125596476; vector<string> teleports = {"227584670 160515679 640974387 9769446", "640832367 9130963 546963385 126242387", "547879147 125609937 227603148 160465892"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 182730; if(result == expected) { cout << "Test Case 79: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 79: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test80() { int xMe = 743695770; int yMe = 736162224; int xHome = 791258070; int yHome = 134616547; vector<string> teleports = {"744652576 735580925 784725497 815048519", "790697228 133837596 743821409 735970918", "791412760 134665885 785065310 814300896"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1656748; if(result == expected) { cout << "Test Case 80: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 80: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test81() { int xMe = 80301858; int yMe = 826413595; int xHome = 409044578; int yHome = 289436766; vector<string> teleports = {"603571157 421362949 409089649 289364578", "408329576 289469617 80677380 826459196", "79635990 826855332 604350031 422092195"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1168986; if(result == expected) { cout << "Test Case 81: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 81: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test82() { int xMe = 402997626; int yMe = 974866052; int xHome = 410601023; int yHome = 976666447; vector<string> teleports = {"257874349 353667986 410599639 976626671", "410841963 977392295 402106060 974643252", "257774403 353733269 403086520 974928667"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 357918; if(result == expected) { cout << "Test Case 82: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 82: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test83() { int xMe = 163273342; int yMe = 152247602; int xHome = 436640006; int yHome = 52351390; vector<string> teleports = {"163225303 152774985 436300752 52576578", "436635464 52427408 629247185 684839214", "629296406 684872457 163182903 152291382"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 297263; if(result == expected) { cout << "Test Case 83: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 83: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test84() { int xMe = 267117142; int yMe = 660278827; int xHome = 988066327; int yHome = 971801584; vector<string> teleports = {"184548180 47599697 267162850 660365634", "988302068 970995435 266454704 659766440", "184525595 47533464 988123241 971750794"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 329057; if(result == expected) { cout << "Test Case 84: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 84: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test85() { int xMe = 105265889; int yMe = 372130284; int xHome = 295586799; int yHome = 278164339; vector<string> teleports = {"295373298 277524134 104716469 371718656", "743404192 163670744 105294517 372069038", "743412272 163740330 295540550 278193405"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 242875; if(result == expected) { cout << "Test Case 85: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 85: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test86() { int xMe = 450438763; int yMe = 543262536; int xHome = 907778177; int yHome = 341091975; vector<string> teleports = {"907166811 341265177 451308981 543540165", "907586189 341089958 489844366 784580910", "489297290 784717296 450764017 543771023"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1711228; if(result == expected) { cout << "Test Case 86: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 86: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test87() { int xMe = 727930453; int yMe = 792916213; int xHome = 535371809; int yHome = 496301091; vector<string> teleports = {"534398597 496319596 382099332 257994564", "535915505 496371603 727996727 792323561", "728106404 793394649 382376820 257969280"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1273144; if(result == expected) { cout << "Test Case 87: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 87: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test88() { int xMe = 797762822; int yMe = 105049316; int xHome = 501338537; int yHome = 963127925; vector<string> teleports = {"502122596 962253685 107133342 852206971", "798054002 105980808 107903206 852919413", "500949508 962401626 797693327 104888829"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1345320; if(result == expected) { cout << "Test Case 88: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 88: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test89() { int xMe = 479701668; int yMe = 55648194; int xHome = 790815034; int yHome = 931331108; vector<string> teleports = {"480103474 55315516 791765669 931354967", "790106620 931658623 864533988 536949875", "479157797 55937404 865123715 536354907"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1708988; if(result == expected) { cout << "Test Case 89: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 89: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test90() { int xMe = 558494097; int yMe = 471878520; int xHome = 747970147; int yHome = 137526654; vector<string> teleports = {"747031025 137237805 699409969 431028574", "558554643 471217710 698729696 430541959", "748894468 136601188 559119718 471786887"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 2567051; if(result == expected) { cout << "Test Case 90: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 90: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test91() { int xMe = 499739134; int yMe = 998104108; int xHome = 103065617; int yHome = 36342563; vector<string> teleports = {"907475399 854269762 499663207 998158032", "907535851 854229365 103144343 36366227", "102387995 35913426 498742368 997641357"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 333110; if(result == expected) { cout << "Test Case 91: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 91: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test92() { int xMe = 301113766; int yMe = 787205896; int xHome = 391837360; int yHome = 214797774; vector<string> teleports = {"391903320 214716644 604288997 590754091", "301571157 786718547 391789985 215403869", "301144315 787258921 604376632 590674984"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 397426; if(result == expected) { cout << "Test Case 92: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 92: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test93() { int xMe = 1; int yMe = 1; int xHome = 1000; int yHome = 1000; vector<string> teleports = {"0 1 1 0", "2 1 1 2", "3 3 4 4"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1998; if(result == expected) { cout << "Test Case 93: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 93: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test94() { int xMe = 0; int yMe = 0; int xHome = 1000000000; int yHome = 1000000000; vector<string> teleports = {"0 1 0 999999999", "1 1000000000 999999999 0", "1000000000 1 1000000000 999999999"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 36; if(result == expected) { cout << "Test Case 94: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 94: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test95() { int xMe = 0; int yMe = 0; int xHome = 100000000; int yHome = 100000000; vector<string> teleports = {"999999999 999999999 555555555 555555555", "5 6 1 1", "444444444 444444444 555555556 555555556"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 200000000; if(result == expected) { cout << "Test Case 95: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 95: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test96() { int xMe = 0; int yMe = 0; int xHome = 999999993; int yHome = 999999993; vector<string> teleports = {"999999970 999999970 999999995 999999995", "999999996 999999996 999999997 999999997", "999999998 999999998 999999999 999999999"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1999999954; if(result == expected) { cout << "Test Case 96: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 96: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test97() { int xMe = 0; int yMe = 0; int xHome = 10000; int yHome = 10000; vector<string> teleports = {"1 1 50 50", "52 52 8000 8000", "7700 7700 9999 9999"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 638; if(result == expected) { cout << "Test Case 97: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 97: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test98() { int xMe = 0; int yMe = 0; int xHome = 1000000000; int yHome = 1000000000; vector<string> teleports = {"1 1 2 2", "3 3 4 4", "5 5 6 6"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 2000000000; if(result == expected) { cout << "Test Case 98: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 98: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test99() { int xMe = 0; int yMe = 0; int xHome = 1000000000; int yHome = 1000000000; vector<string> teleports = {"1 1 2 2", "6 6 3 3", "4 4 5 5"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 2000000000; if(result == expected) { cout << "Test Case 99: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 99: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test100() { int xMe = 0; int yMe = 0; int xHome = 1000000000; int yHome = 1000000000; vector<string> teleports = {"999999999 999999998 999999998 999999999", "999999997 99999998 999999996 999999998", "999999999 999999996 999999997 1000000000"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1100000011; if(result == expected) { cout << "Test Case 100: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 100: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test101() { int xMe = 3; int yMe = 3; int xHome = 199999999; int yHome = 123123123; vector<string> teleports = {"1 2 2 3", "1000 1000 230000 200000", "300 300 3333333 3333333"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 316457060; if(result == expected) { cout << "Test Case 101: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 101: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test102() { int xMe = 0; int yMe = 0; int xHome = 1000000000; int yHome = 1000000000; vector<string> teleports = {"0 999999998 0 999999999", "1 1000000000 999999999 0", "1000000000 999999998 1000000000 999999999"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 2000000000; if(result == expected) { cout << "Test Case 102: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 102: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test103() { int xMe = 0; int yMe = 0; int xHome = 20; int yHome = 20; vector<string> teleports = {"1000 1003 1000 1004", "18 20 1 1", "1000 1005 1000 1006"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 14; if(result == expected) { cout << "Test Case 103: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 103: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test104() { int xMe = 3; int yMe = 7; int xHome = 10000; int yHome = 30000; vector<string> teleports = {"3 10 5200 4900", "12212 8699 9999 30011", "12200 8701 5203 4845"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 117; if(result == expected) { cout << "Test Case 104: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 104: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test105() { int xMe = 1000000000; int yMe = 1000000000; int xHome = 1; int yHome = 999; vector<string> teleports = {"100000 1004 99998 1001", "99999 1002 3 997", "2 998 1 99"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1999899013; if(result == expected) { cout << "Test Case 105: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 105: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test106() { int xMe = 0; int yMe = 0; int xHome = 1000000000; int yHome = 1000000000; vector<string> teleports = {"999999999 1000000000 1000000000 999999999", "999999998 1000000000 1000000000 999999998", "999999999 999999999 1 1"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 14; if(result == expected) { cout << "Test Case 106: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 106: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int test107() { int xMe = 1000000000; int yMe = 1000000000; int xHome = 1; int yHome = 990; vector<string> teleports = {"100000 1004 99998 1001", "99999 1002 3 997", "2 998 1 99"}; ThreeTeleports* pObj = new ThreeTeleports(); clock_t start = clock(); int result = pObj->shortestDistance(xMe, yMe, xHome, yHome, teleports); clock_t end = clock(); delete pObj; int expected = 1999899018; if(result == expected) { cout << "Test Case 107: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 107: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } } int main(int argc, char* argv[]) { int passed = 0; int failed = 0; test0() == 0 ? ++passed : ++failed; test1() == 0 ? ++passed : ++failed; test2() == 0 ? ++passed : ++failed; test3() == 0 ? ++passed : ++failed; test4() == 0 ? ++passed : ++failed; test5() == 0 ? ++passed : ++failed; test6() == 0 ? ++passed : ++failed; test7() == 0 ? ++passed : ++failed; test8() == 0 ? ++passed : ++failed; test9() == 0 ? ++passed : ++failed; test10() == 0 ? ++passed : ++failed; test11() == 0 ? ++passed : ++failed; test12() == 0 ? ++passed : ++failed; test13() == 0 ? ++passed : ++failed; test14() == 0 ? ++passed : ++failed; test15() == 0 ? ++passed : ++failed; test16() == 0 ? ++passed : ++failed; test17() == 0 ? ++passed : ++failed; test18() == 0 ? ++passed : ++failed; test19() == 0 ? ++passed : ++failed; test20() == 0 ? ++passed : ++failed; test21() == 0 ? ++passed : ++failed; test22() == 0 ? ++passed : ++failed; test23() == 0 ? ++passed : ++failed; test24() == 0 ? ++passed : ++failed; test25() == 0 ? ++passed : ++failed; test26() == 0 ? ++passed : ++failed; test27() == 0 ? ++passed : ++failed; test28() == 0 ? ++passed : ++failed; test29() == 0 ? ++passed : ++failed; test30() == 0 ? ++passed : ++failed; test31() == 0 ? ++passed : ++failed; test32() == 0 ? ++passed : ++failed; test33() == 0 ? ++passed : ++failed; test34() == 0 ? ++passed : ++failed; test35() == 0 ? ++passed : ++failed; test36() == 0 ? ++passed : ++failed; test37() == 0 ? ++passed : ++failed; test38() == 0 ? ++passed : ++failed; test39() == 0 ? ++passed : ++failed; test40() == 0 ? ++passed : ++failed; test41() == 0 ? ++passed : ++failed; test42() == 0 ? ++passed : ++failed; test43() == 0 ? ++passed : ++failed; test44() == 0 ? ++passed : ++failed; test45() == 0 ? ++passed : ++failed; test46() == 0 ? ++passed : ++failed; test47() == 0 ? ++passed : ++failed; test48() == 0 ? ++passed : ++failed; test49() == 0 ? ++passed : ++failed; test50() == 0 ? ++passed : ++failed; test51() == 0 ? ++passed : ++failed; test52() == 0 ? ++passed : ++failed; test53() == 0 ? ++passed : ++failed; test54() == 0 ? ++passed : ++failed; test55() == 0 ? ++passed : ++failed; test56() == 0 ? ++passed : ++failed; test57() == 0 ? ++passed : ++failed; test58() == 0 ? ++passed : ++failed; test59() == 0 ? ++passed : ++failed; test60() == 0 ? ++passed : ++failed; test61() == 0 ? ++passed : ++failed; test62() == 0 ? ++passed : ++failed; test63() == 0 ? ++passed : ++failed; test64() == 0 ? ++passed : ++failed; test65() == 0 ? ++passed : ++failed; test66() == 0 ? ++passed : ++failed; test67() == 0 ? ++passed : ++failed; test68() == 0 ? ++passed : ++failed; test69() == 0 ? ++passed : ++failed; test70() == 0 ? ++passed : ++failed; test71() == 0 ? ++passed : ++failed; test72() == 0 ? ++passed : ++failed; test73() == 0 ? ++passed : ++failed; test74() == 0 ? ++passed : ++failed; test75() == 0 ? ++passed : ++failed; test76() == 0 ? ++passed : ++failed; test77() == 0 ? ++passed : ++failed; test78() == 0 ? ++passed : ++failed; test79() == 0 ? ++passed : ++failed; test80() == 0 ? ++passed : ++failed; test81() == 0 ? ++passed : ++failed; test82() == 0 ? ++passed : ++failed; test83() == 0 ? ++passed : ++failed; test84() == 0 ? ++passed : ++failed; test85() == 0 ? ++passed : ++failed; test86() == 0 ? ++passed : ++failed; test87() == 0 ? ++passed : ++failed; test88() == 0 ? ++passed : ++failed; test89() == 0 ? ++passed : ++failed; test90() == 0 ? ++passed : ++failed; test91() == 0 ? ++passed : ++failed; test92() == 0 ? ++passed : ++failed; test93() == 0 ? ++passed : ++failed; test94() == 0 ? ++passed : ++failed; test95() == 0 ? ++passed : ++failed; test96() == 0 ? ++passed : ++failed; test97() == 0 ? ++passed : ++failed; test98() == 0 ? ++passed : ++failed; test99() == 0 ? ++passed : ++failed; test100() == 0 ? ++passed : ++failed; test101() == 0 ? ++passed : ++failed; test102() == 0 ? ++passed : ++failed; test103() == 0 ? ++passed : ++failed; test104() == 0 ? ++passed : ++failed; test105() == 0 ? ++passed : ++failed; test106() == 0 ? ++passed : ++failed; test107() == 0 ? ++passed : ++failed; cout << "Total Test Case: " << passed + failed << "; Passed: " << passed << "; Failed: " << failed << endl; return failed == 0 ? 0 : 1; } /******************************************************************************* * Top Submission URL: * http://community.topcoder.com/stat?c=problem_solution&cr=22906600&rd=14544&pm=11554 ******************************************************************************** #include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <ctime> using namespace std; class ThreeTeleports { public: int shortestDistance(int, int, int, int, vector <string>); }; int ThreeTeleports::shortestDistance(int xM, int yM, int xH, int yH, vector <string> tel) { int link[110][110],xyt[55][4],x[110],y[110],l=tel.size(); for (int i=0;i<tel.size();i++){ int xx=0,yy=0; for (int j=0;j<tel[i].size();j++){ if (tel[i][j]==' ') { xyt[i][yy++]=xx; xx=0; } else xx=xx*10+tel[i][j]-'0'; if (j==tel[i].size()-1) xyt[i][yy++]=xx; } } x[0]=xM; y[0]=yM; int gs=1; memset(link,-1,sizeof(link)); for (int i=0;i<l;i++){ x[gs]=xyt[i][0]; y[gs++]=xyt[i][1]; x[gs]=xyt[i][2]; y[gs++]=xyt[i][3]; link[gs-2][gs-1]=link[gs-1][gs-2]=10; } x[gs]=xH; y[gs++]=yH; for (int i=0;i<gs;i++) for (int j=0;j<gs;j++) if (link[i][j]==-1 || (abs(x[i]-x[j])+abs(y[i]-y[j])<link[i][j])) link[i][j]=link[j][i]=abs(x[i]-x[j])+abs(y[i]-y[j]); for (int k=0;k<gs;k++) for (int i=0;i<gs;i++) if (i!=k && link[i][k]!=-1) for (int j=0;j<gs;j++) if (j!=k && j!=i && link[k][j]!=-1) if (link[i][k]<link[i][j]-link[k][j] || link[i][j]==-1) link[i][j]=link[i][k]+link[k][j]; return link[0][gs-1]; } ******************************************************************************** *******************************************************************************/
b4f570fb9c60d192812f2666f23f7aee2c18f39d
83bed2d9488a76e5f0c07e34cc697bc29b5a5401
/Codeforces/166A.RankList.cpp
e2796de480215d8e89fafa92da1917c62b091351
[]
no_license
akshayrajp/Competitive-Programming
0d246e84ab342bbff27d432fcaeff171f5d4d911
b83385ec686f17cfd042febac395d93030586ff1
refs/heads/master
2023-04-06T11:48:39.580392
2023-03-25T16:59:53
2023-03-25T16:59:53
220,184,179
1
0
null
null
null
null
UTF-8
C++
false
false
830
cpp
166A.RankList.cpp
#include <iostream> #include <utility> #include <algorithm> #include <iterator> #include <vector> using namespace std; bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) { return (a.second < b.second); } int main() { int n, k, i, j, t, y; cin >> n >> k; t = k; vector<pair<int, int>> ranks; for (i = 0; i < n; i++) { cin >> t >> y; ranks.push_back(make_pair(t, y)); } sort(ranks.begin(), ranks.end(), greater<int>()); i = 0; while (1) { if (k == 0) break; if (ranks[i].first == ranks[i + 1].first) { k--; while (ranks[i].first == ranks[i + 1].first) i++; } else i++, k--; } return 0; }
4703a7eb4ad6e94d3add627dfc25fa94da2ec36d
6a559427d678f1f9bbc3750fabae694824aaee62
/findTheRunningMedian.cpp
1fc5f40cc29eebbf21afecb703c3cd4beeddcadc
[]
no_license
debroygit/HackerRank
b9b08129935355dadbad14e2f545bbb8bdb39612
630180bdd5e1ec6b3f52de97af20c0d7e7a1e737
refs/heads/master
2020-12-02T10:14:43.423709
2017-07-09T20:16:53
2017-07-09T20:16:53
96,704,553
0
0
null
null
null
null
UTF-8
C++
false
false
798
cpp
findTheRunningMedian.cpp
#include <cmath> #include <vector> #include <list> #include <iostream> #include <algorithm> #include <iomanip> using namespace std; bool compare ( int &first, int &second) { return first < second; } int main(){ int n; double input; cin >> n; vector<double> arr; vector<double> out; cout << endl; for(int a_i = 0;a_i < n;a_i++){ cin >> input; arr.push_back(input); sort (arr.begin(), arr.end()); int index = arr.size(); index--; if ( index%2 == 0 ) out.push_back (arr[index/2]); else out.push_back ((arr[index/2] + arr[index/2+1])/2); } for (std::vector<double>::iterator it=out.begin(); it!=out.end(); ++it) cout << fixed << setprecision(1) << *it << '\n'; return 0; }
7a0246d3dfd7fb10c9c625dcf2234bdbcb4ad734
8330fedb09a7d1c2f8e72ea61e088208eb2d1152
/Source/Ilum/Loader/ResourceCache.hpp
a54c281e0851539708e0fcfa53527e932f819aa7
[ "MIT" ]
permissive
LavenSun/IlumEngine
1057e2c23e205566ec225b61161810fd37dc4216
94841e56af3c5214f04e7a94cb7369f4935c5788
refs/heads/main
2023-09-03T05:59:03.173546
2021-11-20T05:57:25
2021-11-20T05:57:25
430,141,501
1
0
MIT
2021-11-20T15:39:03
2021-11-20T15:39:02
null
UTF-8
C++
false
false
1,816
hpp
ResourceCache.hpp
#pragma once #include "Graphics/Image/Image.hpp" #include "Graphics/Model/Model.hpp" #include "Graphics/Shader/Shader.hpp" #include "Graphics/Shader/ShaderReflection.hpp" namespace Ilum { class ResourceCache { public: ResourceCache() = default; ~ResourceCache() = default; ImageReference loadImage(const std::string &filepath); void loadImageAsync(const std::string &filepath); void removeImage(const std::string &filepath); bool hasImage(const std::string &filepath) const; const std::unordered_map<std::string, size_t> &getImages(); void updateImageReferences(); const std::vector<ImageReference> &getImageReferences() const; uint32_t imageID(const std::string &filepath); void clearImages(); ModelReference loadModel(const std::string &name); void loadModelAsync(const std::string &filepath); void removeModel(const std::string &filepath); bool hasModel(const std::string &filepath); const std::unordered_map<std::string, size_t> &getModels(); void clearModels(); void clear(); void flush(); private: // Cache image std::vector<Image> m_image_cache; std::unordered_map<std::string, size_t> m_image_map; std::vector<std::string> m_deprecated_image; std::unordered_set<std::string> m_new_image; std::vector<ImageReference> m_image_references; std::unordered_map<std::string, std::future<Image>> m_image_futures; // Cache model std::vector<Model> m_model_cache; std::unordered_map<std::string, size_t> m_model_map; std::vector<std::string> m_deprecated_model; std::unordered_set<std::string> m_new_model; std::unordered_map<std::string, std::future<Model>> m_model_futures; std::mutex m_image_mutex; std::mutex m_model_mutex; }; } // namespace Ilum
da0311b1be023b89ee4d572a03ed64ad4ed942a2
043679db67cbea9537f215ff468b96621194b51f
/OOInteraction/src/string_components/BinaryOperatorStringComponents.cpp
f7932266cd581edf06d4f3fa7c2d9c0fa6f8d31e
[ "BSD-3-Clause" ]
permissive
teeberg/Envision
bd0e4a9f0a5848defdede5d12838855e57e2a1e2
964b58e7af0eae204b4d49118756b716daccadbf
refs/heads/master
2021-01-17T06:26:24.646555
2013-04-05T09:07:04
2013-04-05T09:07:04
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,912
cpp
BinaryOperatorStringComponents.cpp
/*********************************************************************************************************************** ** ** Copyright (c) 2011, 2013 ETH Zurich ** 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 ETH Zurich 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 "string_components/BinaryOperatorStringComponents.h" #include "OOModel/src/expressions/BinaryOperation.h" namespace OOInteraction { BinaryOperatorStringComponents::BinaryOperatorStringComponents(OOModel::BinaryOperation* e ) : exp_(e) { } QStringList BinaryOperatorStringComponents::components() { QStringList result; if (!exp_) return result; // First comes the prefix. Currently there is no binary operator that has a prefix. result << QString() << stringForNode(exp_->left()); switch(exp_->op()) { case OOModel::BinaryOperation::TIMES: result << "*"; break; case OOModel::BinaryOperation::DIVIDE: result << "/"; break; case OOModel::BinaryOperation::REMAINDER: result << "%"; break; case OOModel::BinaryOperation::PLUS: result << "+"; break; case OOModel::BinaryOperation::MINUS: result << "-"; break; case OOModel::BinaryOperation::LEFT_SHIFT: result << "<<"; break; case OOModel::BinaryOperation::RIGHT_SHIFT_SIGNED: result << ">>"; break; case OOModel::BinaryOperation::RIGHT_SHIFT_UNSIGNED: result << ">>>"; break; case OOModel::BinaryOperation::LESS: result << "<"; break; case OOModel::BinaryOperation::GREATER: result << ">"; break; case OOModel::BinaryOperation::LESS_EQUALS: result << "<="; break; case OOModel::BinaryOperation::GREATER_EQUALS: result << ">="; break; case OOModel::BinaryOperation::EQUALS: result << "=="; break; case OOModel::BinaryOperation::NOT_EQUALS: result << "!="; break; case OOModel::BinaryOperation::XOR: result << "^"; break; case OOModel::BinaryOperation::AND: result << "&"; break; case OOModel::BinaryOperation::OR: result << "|"; break; case OOModel::BinaryOperation::CONDITIONAL_AND: result << "&&"; break; case OOModel::BinaryOperation::CONDITIONAL_OR: result << "||"; break; case OOModel::BinaryOperation::ARRAY_INDEX: result << "["; break; default: result << QString(); break; } result << stringForNode(exp_->right()); result << (exp_->op() == OOModel::BinaryOperation::ARRAY_INDEX ? "]" : QString()); // Postfix return result; } } /* namespace OOInteraction */
56993b665e2e4251f3c0e103b857e31f3402a4fd
ef6e90a0c9b2bbfc6a936c34b759bde8f534cf41
/performance.h
747915f61f29efdd66742204d9296ab94d73bb18
[]
no_license
ouayngk/first-level
1269db7daecedf01fc192a86e0b6cd416587076b
060e121e90248d65d8603155e7fd780f839ab212
refs/heads/master
2020-06-14T01:37:20.849009
2019-07-02T11:56:00
2019-07-02T11:56:00
194,852,294
0
0
null
null
null
null
UTF-8
C++
false
false
419
h
performance.h
//measure the embedded system performance #include "stdint.h" class perf_counter { public: uint64_t tot, cnt, calls; perf_counter() : tot(0), cnt(0), calls(0) {}; inline void reset() { tot = cnt = calls = 0; } inline void start() { cnt = sds_clock_counter(); calls++; }; inline void stop() { tot += (sds_clock_counter() - cnt); }; inline uint64_t avg_cpu_cycles() { return ((tot + (calls >> 1)) / calls); }; };
97c80b5431ea5b3acc4193970abd4612753c8291
673bfa5c8ce5046f340b8adc3176a5981b4acbe4
/c_DERS/dosya işlemleri/dosya/dosya_sıkıştırma/Untitled1.cpp
a36c17452d01461e44e103407ab813bbbb5ad6d5
[]
no_license
ysfkymz/my-c-codes
20f207862327647568733f928931c66088995521
80b13a8f3aa1e0cc18f1bff5a472305f8d142ed5
refs/heads/master
2020-06-03T14:10:18.966307
2019-06-12T15:35:05
2019-06-12T15:35:05
191,598,755
0
0
null
null
null
null
UTF-8
C++
false
false
490
cpp
Untitled1.cpp
#include<stdio.h> #include<conio.h> main(){ FILE *d1,*d2; int a,i=0; char b=0; d1=fopen("oku.txt","r"); d2=fopen("yaz.txt","w"); while(!feof(d1)) { if(i==10) break; fscanf(d1,"%d",&a); b=(b<<2)|a; i++; if(i%4==0){ fprintf(d2,"%c",b); b=0; } } fclose(d1); fclose(d2); getch(); return 0;}
9ea716bea14959970a958aefd6640e5d7039cc75
f6f5c158fbb65753ad8f50d62a98717b0a743f91
/Foo.hpp
2df8b74d6bafae055dc165a72267e99a918315fe
[]
no_license
Metalhead33-Foundation/FooTestModule
3a535e1e0d3a1d225092c9daf376f536e5161a81
7f98a1b74f9b4b1bc2da8f8c66fb629abbbb08e8
refs/heads/master
2021-07-04T07:19:42.366119
2017-09-17T07:27:14
2017-09-17T07:27:14
104,661,684
0
0
null
null
null
null
UTF-8
C++
false
false
360
hpp
Foo.hpp
#ifndef FOO_HPP #define FOO_HPP #include <ExtensionFramework.hpp> class Foo : public ExtensionFramework { public: virtual void getReady(); Foo(); static int bar(lua_State* L); static int HelloWorld(lua_State* L); static int HelloName(lua_State* L); static int ShowMeYourAddress(lua_State* L); }; extern "C" { Foo* CREATE_MODULE(); } #endif // FOO_HPP
b274520fb672f761f05b34dfefb0b322c7764335
a490aef66f0711c90799d0d2cd914dd0f316b0d5
/模板/快速排序.cpp
8ca9b70bf5fd10cfdf6fe82e01e5b0fd5f179ad9
[]
no_license
Lhw-686/Study
6d1e5ca54e2828d26d5d77812ccbfbe01ac78993
c350b34199bfc96efce2f61e848006fe7f2a2413
refs/heads/master
2023-07-09T01:42:03.505042
2021-08-28T13:34:05
2021-08-28T13:34:05
400,669,603
1
0
null
null
null
null
GB18030
C++
false
false
523
cpp
快速排序.cpp
#include<stdlib.h> void quickSort(int s[], int l, int r){ if(l >= r) return; //随机选取一个数作为参照 swap(s[l + rand() % (r - l + 1)], s[r]); //i为小于参照的边界,j为大于参照的边界,x为参照 int i = l - 1, j = r + 1, x = s[r], cur = l; while(cur < j){ if(s[cur] < x) swap(s[cur++], s[++i]); //左边界+1,cur+1 else if(s[cur] > x) swap(s[--j], s[cur]);//右边界-1,cur不变 else cur++; } quickSort(s, l, i), quickSort(s, j, r); }
2e5d89b7357d27e3382f1681571218dcf5aed423
2acb29b38f8d20bfee548db125906591ed7e378c
/test2/Kine.h
d8e11ece0f286b69444fdd79eaf50d8b79782fc0
[]
no_license
Solitarily/Delta_Controller
86629163cc805aa81b8ad8b42f7d7d41326eb8a5
2a79ec2e4de6621b667ad449e51094ee4993faaf
refs/heads/master
2020-03-14T15:05:14.526052
2016-08-27T14:24:40
2016-08-27T14:24:40
null
0
0
null
null
null
null
GB18030
C++
false
false
2,227
h
Kine.h
#pragma once #include "Robot.h" /////////////////////////////////////////////////////////// /////////Kine window //位姿矩阵 struct MtxKine { public: double R11; double R12; double R13; double R21; double R22; double R23; double R31; double R32; double R33; double X; double Y; double Z; }; //TCP矩阵 struct MtxTcp { double K1; double K2; double K3; double M1; double M2; double M3; double N1; double N2; double N3; double u1; double u2; double u3; }; /************************************************************************ * 运动学基类 ************************************************************************/ class Kine:public CEdit { //Construction public: Kine(); //Attributes protected: //inverse kinematics helper functions,calculates angle theta1 for YZ-pane bool calcAngleYZ(float x0, float y0, float z0, double *theta); public: //Operations public: //Implementation public: void Robot_IncreTransTool(IN double* currpos, IN double* increpos, OUT double* outpos); void Mtx_Multiply(MtxKine* input, MtxKine* middle, MtxKine* output, int inv); void Trans_PosToMtx(double* pos, MtxKine* output, int inv); void Trans_MtxToPos(MtxKine* input, double* outpos); /************************************************************************ * 函数:IKine() * 功能:逆解 * * 输入:double* gdCPos - 位姿数组,(x,y,x) * 输出:double* gdJPos - 关节角数组 * 返回:int - 0成功,其他错误 ************************************************************************/ int IKine(IN double gdCPos[3],OUT double gdJPos[3]); /************************************************************************ * 函数:FKine() * 功能:正解 * * 输入:double* gdJPos - 关节转角 (三个转角) * 输出:double* gdJPos - 正解位姿,(x,y,z) * 返回:int - 0成功,其他错误 ************************************************************************/ int FKine(IN double gdJPos[3],OUT double gdCPos[6]); virtual ~Kine(); };
fcf3236ca964e2ec17062f2332c7a9ef88650f33
b22588340d7925b614a735bbbde1b351ad657ffc
/athena/ForwardDetectors/ForwardSimulation/ForwardRegion_EventCnv/ForwardRegion_EventTPCnv/src/components/SimulationHitTPCnv_load.cxx
1c975e468a7032fca079b95a2e579c8d7e6ba132
[]
no_license
rushioda/PIXELVALID_athena
90befe12042c1249cbb3655dde1428bb9b9a42ce
22df23187ef85e9c3120122c8375ea0e7d8ea440
refs/heads/master
2020-12-14T22:01:15.365949
2020-01-19T03:59:35
2020-01-19T03:59:35
234,836,993
1
0
null
null
null
null
UTF-8
C++
false
false
91
cxx
SimulationHitTPCnv_load.cxx
#include "GaudiKernel/LoadFactoryEntries.h" LOAD_FACTORY_ENTRIES(ForwardRegion_EventTPCnv)
d3fad7d712308d749eac01655504d5a6eb530d48
e9b7eb09a0d3bbd2994033d22825da8f6ca9e559
/FYP/IMU/MPU6050/GY85/MagCal/MagCal.ino
7f1af7b43e56623827acf7600b0707b0e0a46e8c
[]
no_license
aidansmyth95/Undergraduate-Final-Year-Project---Sensor-Fusion
b82a4cc76047253d9f0cf94706164d0076e6b16d
3c23d85487cfecab6489f45b26dfb49ff237fb75
refs/heads/master
2021-06-13T12:12:34.506053
2017-04-03T17:57:42
2017-04-03T17:57:42
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,174
ino
MagCal.ino
#include "Wire.h" #include "Kalman.h" #include "GY_85.h" #include "I2Cdev.h" double magMin[3], magMax[3]; GY_85 GY85; int16_t ax, ay, az, gx, gy, gz, m[3]; void setup() { Wire.begin(); Serial.begin(9600); GY85.init(); for (int i = 0; i < 3; i++) { magMin[i] = 10000000; magMax[i] = -10000000; } Serial.println("Magnetometer calibration starting..."); } void loop() { boolean changed = false; m[0] = GY85.compass_x( GY85.readFromCompass() ); m[1] = GY85.compass_y( GY85.readFromCompass() ); m[2] = GY85.compass_z( GY85.readFromCompass() ); for (int i = 0; i < 3; i++) { if (m[i] < magMin[i]) { magMin[i] = m[i]; changed = true; } if (m[i] > magMax[i]) { magMax[i] = m[i]; changed = true; } } if (changed) { Serial.println("-------"); Serial.print("minX: "); Serial.print(magMin[0]); Serial.print(" maxX: "); Serial.println(magMax[0]); Serial.print("minY: "); Serial.print(magMin[1]); Serial.print(" maxY: "); Serial.println(magMax[1]); Serial.print("minZ: "); Serial.print(magMin[2]); Serial.print(" maxZ: "); Serial.println(magMax[2]); } }
0ef42267de2f3230d5395a22dd70abd10c5a17ea
fb59dcedeb1aae73e92afebeb6cb2e51b13d5c22
/middleware/src/app/Setting/SettingModule.h
49fccbb5abb6a01d2ff4da950d7683570a8d98cb
[]
no_license
qrsforever/yxstb
a04a7c7c814b7a5647f9528603bd0c5859406631
78bbbae07aa7513adc66d6f18ab04cd7c3ea30d5
refs/heads/master
2020-06-18T20:13:38.214225
2019-07-11T16:40:14
2019-07-11T16:40:14
196,431,357
0
1
null
2020-03-08T00:54:09
2019-07-11T16:38:29
C
UTF-8
C++
false
false
384
h
SettingModule.h
#ifndef _SettingModule_H_ #define _SettingModule_H_ #ifdef __cplusplus namespace Hippo { class SettingModule { public: SettingModule(); virtual ~SettingModule(); virtual int settingModuleRegister() = 0; SettingModule* m_next; }; } // namespace Hippo #endif //__cplusplus extern "C" void settingModuleResgister(); #endif // _SettingModule_H_
5365a02825249fdb2acd27cc306ad3c49fc0cda5
24680792208f6f37bcbfe181e2493c3295b3b6ec
/toH265/EncodeJob.cpp
e071e236645277d300c610851088176e1fd1b8a4
[ "MIT" ]
permissive
ambiesoft/toH265
ccdb2721526609f72212b48f68a32cf84e9d45bd
8c9822fdeb93500637dad15d4e1d6760d46ebc98
refs/heads/master
2023-05-26T12:02:17.209107
2023-05-19T16:00:10
2023-05-19T16:00:10
181,141,404
0
0
null
null
null
null
UTF-8
C++
false
false
6,227
cpp
EncodeJob.cpp
#include "stdafx.h" #include "EncodeTask.h" #include "ListViewItemData.h" using namespace System::Text; using namespace System::IO; namespace Ambiesoft { namespace toH265 { using namespace System::Collections::Generic; using namespace System::Windows::Forms; void EncodeJob::init(bool bReEncode, String^ addiopbi, String^ addiopai, array<System::Windows::Forms::ListViewItem^>^ items, array<String^>^ inputMovies, String^ outputtingMovie, AVCodec^ outputVideoCodec, AVCodec^ outputAudioCodec, bool isSameSize, System::Drawing::Size maxSize, AVDuration^ totalInputDuration, double totalInputFPS, double partPercent, bool bMoveFinishedInputMovies) { this->ReEncode = bReEncode; this->AdditionalOptionsBeforeInput = addiopbi; this->AdditionalOptionsAfterInput = addiopai; this->items_ = items; this->inputMovies_ = inputMovies; this->OutputtingMovie = outputtingMovie; this->OutputVideoCodec = outputVideoCodec; this->OutputAudioCodec = outputAudioCodec; this->IsSameSize = isSameSize; this->MaxSize = maxSize; this->totalInputDuration_ = totalInputDuration; this->totalInputFPS_ = totalInputFPS; this->partPercent_ = partPercent; for each (System::Windows::Forms::ListViewItem ^ item in items_) { item->ImageKey = IMAGEKEY_NORMAL; this->inputVideoCodec_ = FormMain::GetVCodecFromLvi(item); this->inputAudioCodec_ = FormMain::GetACodecFromLvi(item); } bMoveFinishedInputMovies_ = bMoveFinishedInputMovies; } void EncodeJob::CreateTempFile() { DASSERT(String::IsNullOrEmpty(tempFile_)); tempFile_ = Path::GetTempFileName(); } void EncodeJob::DeleteTempFile() { if (String::IsNullOrEmpty(tempFile_)) return; try { String^ all = File::ReadAllText(tempFile_); if (all == report_) { File::Delete(tempFile_); tempFile_ = nullptr; } } catch(Exception^) { } } String^ EncodeJob::GetArg(String^% report) { String^ arg; StringBuilder sbReportFile; StringBuilder sbFileText; DASSERT(InputMovies->Length != 0); if (InputMovies->Length == 1) { DASSERT(!String::IsNullOrEmpty(OutputtingMovie)); arg = String::Format(L"-y {4} -i \"{0}\" {5} -max_muxing_queue_size 9999 -c copy -c:v {1} -c:a {2} \"{3}\"", InputMovies[0], OutputVideoCodec->ToFFMpegString(), OutputAudioCodec->ToFFMpegString(), OutputtingMovie, AdditionalOptionsBeforeInput, AdditionalOptionsAfterInput); } else { if (!ReEncode) { CreateTempFile(); sbReportFile.AppendLine(tempFile_); StreamWriter sw(tempFile_, false, gcnew UTF8Encoding(false)); for each (String ^ file in InputMovies) { String^ line = String::Format("file '{0}'", file); sbReportFile.AppendLine(line); sw.WriteLine(line); sbFileText.AppendLine(line); } sbReportFile.AppendLine(); arg = String::Format("-y -safe 0 -f concat {2} -i \"{0}\" {3} -max_muxing_queue_size 9999 -c copy \"{1}\"", tempFile_, OutputtingMovie, AdditionalOptionsBeforeInput, AdditionalOptionsAfterInput); } else { /* -filter_complex "[0:v:0] [0:a:0] [1:v:0] [1:a:0] [2:v:0] [2:a:0] [3:v:0] [3:a:0] concat=n=4:v=1:a=1 [v] [a]" -map "[v]" -map "[a]" "Y:\Share\3333.mkv" */ /* -i 480.mp4 -i 640.mp4 -filter_complex \ "[0:v]scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:(ow-iw)/2:(oh-ih)/2[v0]; \ [v0][0:a][1:v][1:a]concat=n=2:v=1:a=1[v][a]" \ -map "[v]" -map "[a]" -c:v libx264 -c:a aac -movflags +faststart output.mp4 Your ffmpeg is old: you should really consider updating to a build from the current git master branch. The ea */ StringBuilder sb; sb.Append("-y "); sb.Append(AdditionalOptionsBeforeInput + " "); for each (String ^ f in InputMovies) { sb.AppendFormat("-i \"{0}\" ", f); } sb.Append(AdditionalOptionsAfterInput + " "); sb.Append("-max_muxing_queue_size 9999 "); sb.Append("-filter_complex \""); if (IsSameSize) // IsSameSizeVideos()) { for (int i = 0; i < InputMovies->Length; ++i) { sb.AppendFormat("[{0}:v:0]", i); sb.AppendFormat("[{0}:a:0]", i); } sb.AppendFormat("concat=n={0}:v=1:a=1[v][a]", InputMovies->Length); } else { System::Drawing::Size size = MaxSize; // GetMaxVideoSize(); for (int i = 0; i < InputMovies->Length; ++i) { sb.AppendFormat("[{0}:v:0]", i); sb.AppendFormat("scale={1}:{2}:force_original_aspect_ratio=decrease,pad={1}:{2}:(ow-iw)/2:(oh-ih)/2[v{0}];", i, size.Width, size.Height); } for (int i = 0; i < InputMovies->Length; ++i) { sb.AppendFormat("[v{0}][{0}:a:0]", i); } sb.AppendFormat("concat=n={0}:v=1:a=1[v][a]", InputMovies->Length); } sb.Append("\" "); sb.Append("-map \"[v]\" -map \"[a]\" "); sb.AppendFormat("-c:v {0} -c:a {1} \"{2}\"", OutputVideoCodec->ToFFMpegString(), OutputAudioCodec->ToFFMpegString(), OutputtingMovie); arg = sb.ToString(); } } report = sbReportFile.ToString(); report_ = sbFileText.ToString(); return arg; } void EncodeJob::SetStarted() { for each (ListViewItem ^ item in items_) { item->ImageKey = IMAGEKEY_ENCODING; ListViewItemData::Get(item)->OutputtingFile = this->OutputtingMovie; ListViewItemData::Get(item)->OutputtedFile = nullptr; item->EnsureVisible(); } } void EncodeJob::SetEnded(int retval) { ended_ = true; retval_ = retval; finishData_ = DateTime::Now; DeleteTempFile(); for each (ListViewItem ^ item in items_) { item->ImageKey = retval==0 ? IMAGEKEY_DONE : IMAGEKEY_NORMAL; ListViewItemData::Get(item)->OutputtedFile = this->OutputtedMovie; } } void EncodeJob::Cancel() { DASSERT(!IsEnded); for each (ListViewItem ^ item in items_) item->ImageKey = IMAGEKEY_NORMAL; } } }
94d544a6daed195c882057c5c05a557b38e2f9be
64a41423f567fe8973f57e26910cf1bb2f41b540
/uva/uva00644_Immediate_Decodability/cpp/tests-uva.cpp
194d957f39b5282c2498dbc7eabf336d378d7e48
[]
no_license
lfmunoz/competitive_programming
1d16b64d4b90214a0745da1460420361a7771f52
cf6a90c780b422f4b4c0bdcaa7e9a1bcb4f50ad5
refs/heads/master
2023-01-24T18:15:01.234165
2020-11-23T02:43:19
2020-11-23T02:43:19
283,283,319
0
0
null
null
null
null
UTF-8
C++
false
false
436
cpp
tests-uva.cpp
#include "../../../_lib/cpp/catch.hpp" #include "main.cpp" TEST_CASE( "clean string", "[uva]" ) { REQUIRE( isPrefix("0001", "00") == true); REQUIRE( isPrefix("0001", "01") == false); REQUIRE( isPrefix("0001", "1") == false); REQUIRE( isPrefix("0001", "10") == false); REQUIRE( isPrefix("0001", "0000") == false); REQUIRE( isPrefix("10", "0010") == false); REQUIRE( isPrefix("0010", "10") == false); }
1bd3dd920a2e37914003176c884144059f749b9e
bae76888e633874c1278a43bb5773aae8201c44d
/CPSeis/spws_home/include/vaplots/va_iso_gui.hh
58d90273a0c7e62dc32a8aff99fc9d195f371aa2
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
Chen-Zhihui/SeismicPackage
a242f9324c92d03383b06f068c9d2f64a47c5c3f
255d2311bdbbacad2cb19aa3b91ceb84a733a194
refs/heads/master
2020-08-16T05:28:19.283337
2016-11-25T02:24:14
2016-11-25T02:24:14
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,675
hh
va_iso_gui.hh
/*<license> ------------------------------------------------------------------------------- Copyright (c) 2007 ConocoPhillips Company 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. ------------------------------------------------------------------------------- </license>*/ //========================= COPYRIGHT NOTICE ================================ //==== CONFIDENTIAL AND PROPRIETARY INFORMATION OF CONOCO INC. ======== //==== PROTECTED BY THE COPYRIGHT LAW AS AN UNPUBLISHED WORK ======== //======================== COPYRIGHT NOTICE ================================= //========================================================================== //==================== GUI for iso velocity plots ==================== //==================== Michael L. Sherrill 09/97 ==================== //========================================================================== #ifndef VA_ISO_GUI_H #define VA_ISO_GUI_H #include "sl/sl_form_pop.hh" class SLTextBox; class SLRadioBox; class SLTogBox; class VaIsoPlot; class SeisCbar; class SeisPlot; class SeisCtype; class VfDataset; class VaIsoPlotter; class ContourGui; class VaIsoGui : public SLFPopSep { public: VaIsoGui( Widget p, char *name, HelpCtx hctx, VaIsoPlot *plot); ~VaIsoGui(); virtual void seisPlotChanged(); virtual void manage(); virtual Widget make(Widget p = NULL); void updateParams(Boolean update_file_limits = True); void setParameters(); void assignIsoPlotter(VaIsoPlotter *plotter){_iso_plotter = plotter;} void setColorOptions(Boolean turn_on); void setDontPlotYet(Boolean dont_plot_yet); int doMovie() {return _do_movie;} float firstFrame() {return _first_panel;} long totalFrames() {return _total_panels;} float skipFrames() {return _skip_panels;} int getPlotType() {return _plot_type;} int getPlottedVelType() {return _plotted_vel_type;} int getLineType() {return _line_type;} int gradeVertical() {return _grad_ver;} int gradeHorizontal() {return _grad_hor;} int underlay() {return _underlay;} float getTmin() {return _tmin;} float getTmax() {return _tmax;} float getY1() {return _y1;} float getY2() {return _y2;} float getX1() {return _x1;} float getX2() {return _x2;} float getXbin() {return _xbin;} float getYbin() {return _ybin;} float getTime() {return _time;} float getHeight() {return _pheight;} long getNumberYlines() {return _number_y_lines;} long *getVelRequestList() {return _vel_request_list;} long *getVelYlinesList() {return _vel_ylines_list;} float getTimeOfFrame(long i) {return _time_of_frame[i];} long getFunctionsInFrame(long i){return _functions_in_frame[i];} Boolean changePlot(float x1, float x2, float y1, float y2, Boolean refresh_only = False); enum {PWIDTH, PHEIGHT, X1, X2, Y1, Y2, TMIN, TMAX, VMIN, VMAX, X_ANNO, PRIMARY_TIMING, SECONDARY_TIMING, GRADEH, GRADEV, XBIN, YBIN, TIME, DO_MOVIE, UNDERLAY, FIRST_PANEL, SKIP_PANELS, TOTAL_PANELS}; protected: virtual void reloadSystemDefaults(Boolean do_method =True); virtual void DoAction(); virtual Boolean ValidInput(); void setToFileDefaults(); Boolean reconcileParameters(); void setMovieParameters(int ident); Boolean findFirstMoviePanel(); VaIsoPlotter *_iso_plotter; Widget _plotlab; Widget _rangelab; Widget _vellab; Widget _linelab; SLTextBox *_params; SLRadioBox *_ptypebox; SLTogBox *_grade; SLRadioBox *_linebox; SLTextBox *_binbox; SLTogBox *_movie_tog; SLTextBox *_movie_box; ContourGui *_contour_gui; float _pwidth; float _pheight; float _x1; float _x2; float _y1; float _y2; float _tmin; float _tmax; float _vmin; float _vmax; float _ybin; float _xbin; float _time; int _x_annotation_increment; float _primary_timing; float _secondary_timing; float _orig_vmin; float _orig_vmax; float _oldtval; float _olddval; float _oldy; float _oldx; float _oldt; float _user_vmin; float _user_vmax; long _grad_hor; long _grad_ver; long _underlay; Boolean _first_time; Boolean _was_time; Boolean _was_depth; Boolean _user_visited; Boolean _data_initialized; Boolean _dont_plot_yet; long _do_movie; float _first_panel; float _skip_panels; long _total_panels; int _plot_type; int _plotted_vel_type; int _line_type; long _number_y_lines; long *_vel_request_list; long *_vel_ylines_list; long *_functions_in_frame; float *_time_of_frame; //do these with notify complex later? static void plotTypeAction( void *data, long which ); static void lineAction ( void *data, long which ); static void binFocusAction( void *data, long which ); static void binLosingFocusAction ( void *data, long which ); static void paramFocusAction( void *data, long which ); static void paramLosingFocusAction ( void *data, long which ); Boolean notifyComplex(SLDelay *obj, int ident); private: VaIsoPlot *_plot; SeisPlot *_sp; SeisCbar *_colorbar; SeisCtype *_color_control; VfDataset *_vfd; }; #endif
a1fa2fef9c54572f063b003d481cfb84dd971580
ad8ecdec00c3cad400ddae7787811ba7a3b65a6e
/Hajo.cpp
6d37286c05a51d849b5416f973b26a0e59810ef1
[]
no_license
pappgr/bead_3
354ec7a40ee1725c5279cbb4770da8e1e3b55bf6
6fd4fdd1f3703dcdfcebdec71940dfccd98802a6
refs/heads/master
2020-03-17T05:18:33.601372
2018-05-14T05:50:22
2018-05-14T05:50:22
133,310,878
0
0
null
null
null
null
UTF-8
C++
false
false
505
cpp
Hajo.cpp
#include "Hajo.h" #include "iostream" using namespace genv; Hajo::Hajo(int x, int y, int r, int g, int b, int db):Widget(x,y){ } Hajo::~Hajo(){ } int Hajo::xmeret() { return pxmeret; } int Hajo::ymeret() { return pymeret; } void Hajo::rajzol(){ for (int i=0; i<db; i++) { gout << move_to(x()+(xmeret()*i),y()+(ymeret()*i)) << color(r,g,b) << box(xmeret(),ymeret()); gout << move_to(x()+2+(xmeret()*i),y()+2+(ymeret()*i)) << color(0,0,0) << box(xmeret()-4,ymeret()-4); } }
2d98d1c3615beb933a9de5530b77c0ba031cea18
a9ba883ccdd929e9bc748727aac8da706b6a526f
/Assignment_Smart_Pointers/Assignment_Smart_Pointers/StringBufferOP.cpp
bf79564fa70e65b86621e0bd8e19ebb4cf41ac23
[]
no_license
zaheersm/AP_labs
e75fdebaae8dabb10379b3a2268d3fd485972ecf
04a751b2203c172fa882da6e19f596bd98f4da16
refs/heads/master
2021-05-31T22:22:03.653752
2016-05-20T06:52:42
2016-05-20T06:52:42
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,590
cpp
StringBufferOP.cpp
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ #include <cstdlib> #include <iostream> #include "StringBufferOP.h" using namespace std; StringBufferOP::StringBufferOP() { _length = -1; _strbuf = NULL; _bufsize = -1; _isOwner = true; } StringBufferOP::~StringBufferOP() { if (_strbuf != NULL && _isOwner) { //cout << "Deleting strbuf " << &_strbuf; delete [] _strbuf; } } StringBufferOP::StringBufferOP(const StringBufferOP& that) { if (this != &that) { this->_isOwner = that._isOwner; this->_strbuf = that._strbuf; this->_bufsize = that._bufsize; this->_length = that._length; that.release_ownership(); } } StringBufferOP::StringBufferOP(char * strbuf, int size) { this->_strbuf = strbuf; this->_bufsize = size; this->_length = 0; this->_isOwner = true; } char StringBufferOP::charAt(int index) const { if (index >= 0 && index < _length) { return _strbuf[index]; } throw 'e'; } int StringBufferOP::length() const { return _length; } void StringBufferOP::reserve(int size) { if (_strbuf != NULL) { // If this object was the owner of previously held strbuf, release if (_isOwner) delete [] _strbuf; } _strbuf = new char[size]; _length = 0; _bufsize = size; // Since reserve allocates a fresh strbuf, this object should be the owner _isOwner = true; } void StringBufferOP::append(char c) { if (_length < _bufsize) { _strbuf[_length] = c; _length++; return; } throw 'e'; } StringBufferOP& StringBufferOP::operator=(const StringBufferOP& that) { if (this != &that) { // If this and that don't already point to the same strbuf if (this->_strbuf != that._strbuf) { /* Releasing previously hold strbuf for this if its the owner Since this will becoming the owner of new strbuf */ if (this->_isOwner && this->_strbuf != NULL) { delete [] this->_strbuf; } } this->_isOwner = that._isOwner; this->_strbuf = that._strbuf; this->_bufsize = that._bufsize; this->_length = that._length; that.release_ownership(); } return *this; } void StringBufferOP::print () { for (int i = 0; i < this->length(); i++) { cout << this->charAt(i); } cout << "\n"; }
76a25fad77dfec34ba349a6cff30697f2d4a1a67
9c079c10fb9f90ff15181b3bdd50ea0435fbc0cd
/Codeforces/946A.cpp
f10aa75b7004fc626aa61f598a8d7a9cd0f96969
[]
no_license
shihab122/Competitive-Programming
73d5bd89a97f28c8358796367277c9234caaa9a4
37b94d267fa03edf02110fd930fb9d80fbbe6552
refs/heads/master
2023-04-02T20:57:50.685625
2023-03-25T09:47:13
2023-03-25T09:47:13
148,019,792
0
0
null
null
null
null
UTF-8
C++
false
false
295
cpp
946A.cpp
#include<bits/stdc++.h> using namespace std; int main(){ int n,b=0,c=0; scanf("%d",&n); for(int i=0;i<n;i++){ int a; scanf("%d",&a); if(a<0) c+=a; else b+=a; } //cout<<b<<" "<<c<<endl; int x=b+abs(c); cout<<x<<endl; return 0; }
828b91727d1eb3e88846a93815ee33da92c20ee0
c742de2bad918ccf3618e365f911cb82a2ee897d
/src/Chunk.cpp
aac1d07a4757afc42c74348ff807dac3646e5f8c
[]
no_license
ferasboulala/wav-riff
2dde37ee06471f1b2aefa8f37b42779e0229814b
ed27f99113b82c22925992daaeba4ebe9bdef6fb
refs/heads/master
2020-03-22T22:07:03.155657
2018-07-18T15:03:12
2018-07-18T15:03:12
140,733,862
3
1
null
null
null
null
UTF-8
C++
false
false
2,908
cpp
Chunk.cpp
#include "Chunk.hpp" #include "WavData.hpp" #include <assert.h> #define MAX_CHUNK_SIZE 0xffffffff Chunk::Chunk(const std::string &name) : size_(0), actualSize_(0), undefined_(false), variableSize_(false) { assert(name.size() == 4); name_ = name; } Chunk::Chunk(const std::string &name, const std::vector<Field> &fields) : Chunk(name) { for (auto it = fields.begin(); it != fields.end(); it++) { addField(*it); } } Chunk::~Chunk(void) {} void Chunk::addField(const struct Field f) { if (isVariable()) throw std::string("Last field is variable. Cannot add anymore fields."); std::shared_ptr<Field> f_p = std::make_shared<Field>(f); fields_.push_back(f_p); fieldMap_[f.name] = f_p; long overflow = size_; assert(overflow + f.nBytes < MAX_CHUNK_SIZE - 4 - 4); size_ += (f.nBytes); if (f.nBytes == 0) makeVariable(); } std::shared_ptr<Chunk::Field> Chunk::getField(const std::string &fieldName) { return fieldMap_[fieldName]; } std::vector<std::shared_ptr<Chunk::Field>> Chunk::getAllFields(void) const { return fields_; } std::string Chunk::getChunkName(void) const { return name_; } bool Chunk::checkSize(const unsigned int size) const { return (size == size_); } void Chunk::print(void) const { std::cout << *this; } std::ostream &operator<<(std::ostream &os, const Chunk &ck) { if (ck.getChunkName() == "data") return os; os << "---------- " << ck.getChunkName() << " chunk ----------\n"; auto fields = ck.getAllFields(); for (auto it = fields.begin(); it != fields.end(); it++) { os << (*it)->name << " : "; switch ((*it)->type) { case F_BYTE_ARRAY: { for (int i = 0; i < (*it)->val.size(); i++) { os << WavData::toType<unsigned int>(std::string(&((*it)->val[i]), 1)) << '-'; } break; } case F_INT: { os << WavData::toType<int>((*it)->val); break; } case F_UINT: { os << WavData::toType<unsigned int>((*it)->val); break; } case F_FLOAT: { os << WavData::toType<float>((*it)->val); break; } case F_SHORT: { os << WavData::toType<short>((*it)->val); break; } default: { os << (*it)->val; } } os << '\n'; } return os; } void Chunk::resetChunk(void) { actualSize_ = 0; for (auto it = fields_.begin(); it != fields_.end(); it++) { (*it)->val = std::string(""); } if (variableSize_) { fields_[fields_.size() - 1]->nBytes = 0; } } unsigned int Chunk::getSize(void) const { return size_; } unsigned int Chunk::getActualSize(void) const { return actualSize_; } bool Chunk::isUndefined(void) const { return undefined_; } void Chunk::makeUndefined(void) { undefined_ = true; } bool Chunk::isVariable(void) const { return variableSize_; } void Chunk::makeVariable(void) { variableSize_ = true; } void Chunk::addToActualSize(const unsigned int size) { actualSize_ += size; }
072777934c7559a88468d34d8418350058b16d52
7bf043a834dc8811e6d7f889617c07a1e9f22c70
/chapter6/code/code6_51.h
fd62100dad12967f2fb5b1aaad0512941429b7a8
[]
no_license
bug-code/Cpp_primer
90a3133a33e33baa27e163800803b537887e4322
6b39b346ef896f47ec746984c7f55a3536e83cd2
refs/heads/master
2023-05-14T11:58:21.733526
2021-06-10T03:14:38
2021-06-10T03:14:38
357,915,126
0
0
null
null
null
null
UTF-8
C++
false
false
474
h
code6_51.h
#ifndef CODE6_51_H #define CODE6_51_H #include <iostream> void f(){ #ifndef NODEBUG std::cerr<<"The function is:"<<1<<std::endl; #endif }; void f(int ){ #ifndef NODEBUG std::cerr<<"The function is:"<<2<<std::endl; #endif }; void f(int ,int ){ #ifndef NODEBUG std::cerr<<"The function is:"<<3<<std::endl; #endif }; void f(double ,double =3.14){ #ifndef NODEBUG std::cerr<<"The function is:"<<4<<std::endl; #endif }; #endif
daeb5b0a48e5b26b78c941e6cb8b60c5cd0c1048
0e846c2b93a09aa83064d8ad1a574f03184984af
/chapter10_Sorting_and_Searching/rankFromStream.cpp
d611d2a09707430a0bd3d55a24070a949996c829
[]
no_license
ihsuy/CTCI
dcb49a2db03a70f9b3ba6fa7d54a1078c576db2d
b791e7325da3d3d9e8c1dabc33fee2068c5af850
refs/heads/master
2021-07-05T06:50:04.894758
2020-09-01T04:48:49
2020-09-01T04:48:49
174,632,606
1
0
null
null
null
null
UTF-8
C++
false
false
5,384
cpp
rankFromStream.cpp
#include <math.h> #include <algorithm> #include <bitset> #include <chrono> #include <iostream> #include <list> #include <map> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> typedef long long ll; inline int two(int n) { return 1 << n; } inline int test(int n, int b) { return (n >> b) & 1; } inline void set_bit(int& n, int b) { n |= two(b); } inline void unset_bit(int& n, int b) { n &= ~two(b); } inline int last_bit(int n) { return n & (-n); } inline int ones(int n) { int res = 0; while (n && ++res) n -= n & (-n); return res; } template <typename T> inline void inspect(T& t) { typename T::iterator i1 = t.begin(), i2 = t.end(); while (i1 != i2) { std::cout << (*i1) << ' '; i1++; } std::cout << '\n'; } ///////////////////////////////////////////////////////////// using namespace std; /* Rank from Stream: Imagine you are reading in a stream of integers. Periodically, you wish to be able to look up the rank of a number x (the number of values less than or equal to x). Implement the data structures and algorithms to support these operations.That is, implement the method track (in t x), which is called when each number is generated, and the method getRankOfNumber(int x), which returns the number of values less than or equal to X (not including x itself). */ struct rankNode { int key; int rank; rankNode* left; rankNode* right; rankNode* parent; rankNode(const int& k, rankNode* p) : key(k), rank(0), left(nullptr), right(nullptr), parent(p) {} }; struct streamRanker { private: void updateAll(rankNode* root) { // increment rank of every node in the // tree with root "root" if (root == nullptr) { return; } updateAll(root->left); root->rank++; updateAll(root->right); } void updateRight(rankNode* n) { // increment all rank of node that has key // larger than n->key while (n->parent != nullptr) { if (n->parent != nullptr and n->parent->left == n) { n = n->parent; n->rank++; updateAll(n->right); } else if (n->parent != nullptr) { n = n->parent; } } } void updateRank(rankNode* n, const bool& isLeftNode) { // handle rank updating // seperately with respect to // the relationship between n and its parent if (isLeftNode) { // if n is a left child to its parent // n replace its parent's rank in the tree // then increment rank for every node larger than n n->rank = n->parent->rank; updateRight(n); } else { // if n is a right child to its parent // it will certainly get on more rank than its parent // and its also necessary to increment rank for all nodes // that have larger keys n->rank = n->parent->rank + 1; updateRight(n); } } rankNode* root; // use a unordered_map to track nodes and find their rank // in O(1) time unordered_map<int, rankNode*> ranks; public: streamRanker() : root(nullptr) {} const rankNode* getRoot() const { // return root node so i can traverse and inspect its content return root; } int getRankOfNumber(const int& n) { if (ranks.count(n) == 0) { return -1; } return ranks[n]->rank; } void track(const int& val) { // create a bst if (root == nullptr) { root = new rankNode(val, nullptr); } else { rankNode* temp = root; while (temp != nullptr) { if (val >= temp->key) { if (temp->right == nullptr) { temp->right = new rankNode(val, temp); updateRank(temp->right, false); ranks[val] = temp->right; break; } else { temp = temp->right; } } else { if (temp->left == nullptr) { temp->left = new rankNode(val, temp); updateRank(temp->left, true); ranks[val] = temp->left; break; } else { temp = temp->left; } } } } } }; void inorderTraverse(const rankNode* root) { // inspection if (root == nullptr) { return; } inorderTraverse(root->left); cout << "key: " << root->key << " rank:" << root->rank << '\n'; inorderTraverse(root->right); } int main() { vector<int> v{5, 1, 4, 4, 5, 9, 7, 13, 3, 1, 4, 4, 5, 9, 7, 13, 3}; streamRanker sr; for (int i = 0; i < v.size(); ++i) { sr.track(v[i]); } inorderTraverse(sr.getRoot()); for (int i = 0; i < v.size(); ++i) { cout << "getrank: " << sr.getRankOfNumber(v[i]) << '\n'; } return 0; }
835dd1186130574da22f8d1df6790b44a082c07c
ba1e1e47a37b8e5c2f9597b496e27cf242f4ae15
/字符串字符循环右移.cpp
b5d26ff0dbfe4cf953452fe96b074aa464efc686
[]
no_license
LoveLei0427/Test
8e742f04c0544cb23b1699142009500c8a83c8c6
39c40ba012500c320f252cd8b8bc56de6060ae5b
refs/heads/master
2020-03-18T03:53:02.705584
2019-06-11T06:46:30
2019-06-11T06:46:30
134,260,690
0
0
null
null
null
null
WINDOWS-1252
C++
false
false
231
cpp
字符串字符循环右移.cpp
//strcpyÓöµ½'\0'Í£Ö¹ void Loop(char* str,int step) { int n = strlen(str) - step; char res[256]; strcpy(res,str + n); strcpy(res + step,str); *(res + strlen(str)) = '\0'; strcpy(str,res); }
0ede70a0773b37b3d317cfeff9a6c4d75a677341
c7d98beb689410cbba2c712a01c25863f267b5dc
/src/normal_mean_prior.cpp
9be5985d239b83795008f805cb4f20e81725c7c2
[]
no_license
ml4ai/hamlet_experiment_py2
2b8d5b21e9c3c62bc17409da4971869aaf13f705
2d49f797d0ee0baa0447e0965468e7c15e796bb7
refs/heads/master
2021-03-27T11:41:43.494446
2017-11-06T14:31:18
2017-11-06T14:31:18
61,496,702
0
1
null
null
null
null
UTF-8
C++
false
false
5,134
cpp
normal_mean_prior.cpp
/* $Id: normal_mean_prior.cpp 21443 2017-06-28 18:13:50Z chuang $ */ /*! * @file normal_mean_prior.cpp * * @author Colin Dawson */ #include "util.h" #include "normal_mean_prior.h" #include "mean_emission_model.h" #include <boost/make_shared.hpp> Mean_prior_ptr Normal_mean_prior_params::make_module() const { return boost::make_shared<Normal_mean_prior>(this); } Normal_mean_prior::Normal_mean_prior(const Params* const hyperparameters) : Base_class(hyperparameters), prior_precision_(hyperparameters->prior_precision) {} void Normal_mean_prior::initialize_resources() { Base_class::initialize_resources(); } void Normal_mean_prior::initialize_params() { kjb::Matrix prior_covariance = kjb::create_diagonal_matrix(K(), 1.0 / prior_precision_); kjb::Vector prior_mean((int) K(), 0.0); kjb::MV_normal_distribution r_X(prior_mean, prior_covariance); for(size_t j = 0; j < J(); ++j) { X_.set_row(j, kjb::sample(r_X)); } } void Normal_mean_prior::input_previous_results(const std::string& input_path, const std::string& name) { PMWP(verbose_ > 0, "Inputting information from itreation %s for normal mean prior...\n", (name.c_str())); //std::cerr << "Inputting information from iteration " << name << " for normal mean prior..." << std::endl; PM(verbose_ > 0, "Inputting information for mean matrix X_...\n"); //std::cerr << "Inputting information for mean matrix X_..." << std::endl; X_ = Mean_matrix((input_path + "X/" + name + ".txt").c_str()); PM(verbose_ > 0, "done.\n"); //std::cerr << "done." << std::endl; } void Normal_mean_prior::generate_data(const std::string&) { initialize_params(); PMWP(verbose_ > 0, " Writing means to file %smeans.txt\n", (write_path.c_str())); //std::cerr << " Writing means to file " << write_path + "means.txt" << std::endl; X_.write((write_path + "means.txt").c_str()); } void Normal_mean_prior::update_params() { PM(verbose_ > 0, " Updating means X...\n"); //std::cerr << " Updating means X..."; const Noisy_data_matrix_list& Y = noisy_data(); Scale_vector h(noise_parameters()); Mean_vector posterior_mean((int) K(), 0.0); Scale_vector posterior_precision((int) K(), 1.0 / prior_precision_); for (size_t j = 0; j < J(); ++j) { size_t n_j = 0; Mean_vector ysum_j = Mean_vector((int) K(), 0.0); for (size_t i = 0; i < NF(); ++i) { kjb::Index_range rows(partition_map(i,j)); size_t n_ij = rows.size(); if (n_ij > 0) { n_j = n_j + n_ij; kjb::Const_matrix_view Yi_j = Y.at(i)(rows, kjb::Index_range::ALL); ysum_j = ysum_j + kjb::sum_matrix_rows(Yi_j); } } if (n_j > 0) { Mean_vector ybar_j = ysum_j / n_j; posterior_precision = n_j * h + prior_precision_; posterior_mean = n_j * ybar_j.ew_multiply(h).ew_divide(posterior_precision); } for(size_t k = 0; k < K(); ++k) { Normal_dist r_x_jk(posterior_mean(k), 1.0 / posterior_precision(k)); X_(j,k) = kjb::sample(r_x_jk); } } PM(verbose_ > 0, "done.\n"); //std::cerr << "done." << std::endl; } /* void Normal_mean_prior::update_params() { std::cerr << " Updating means X..."; const Noisy_data_matrix& Y = noisy_data(); // std::cerr << " Y is size " << Y.get_num_rows() // << " x " << Y.get_num_cols() << std::endl; // std::cerr << " H is size " << noise_parameters().get_num_rows() // << " x " << noise_parameters().get_num_cols() << std::endl; Scale_vector h(noise_parameters()); // std::cerr << " h is size " << h.size() << std::endl; Mean_vector posterior_mean((int) K(), 0.0); Scale_vector posterior_precision((int) K(), 1.0 / prior_precision_); for(size_t j = 0; j < J(); ++j) { kjb::Index_range rows(partition_map(j)); size_t n_j = rows.size(); if(n_j > 0) { kjb::Const_matrix_view Y_j = Y(rows, kjb::Index_range::ALL); Mean_vector ybar_j = kjb::sum_matrix_rows(Y_j) / n_j; posterior_precision = n_j * h + prior_precision_; posterior_mean = n_j * ybar_j.ew_multiply(h).ew_divide(posterior_precision); } for(size_t k = 0; k < K(); ++k) { Normal_dist r_x_jk(posterior_mean(k), 1.0 / posterior_precision(k)); X_(j,k) = kjb::sample(r_x_jk); } } std::cerr << "done." << std::endl; } */ void Normal_mean_prior::set_up_results_log() const { create_directory_if_nonexistent(write_path + "X"); } void Normal_mean_prior::write_state_to_file(const std::string& name) const { PMWP(verbose_ > 0, " Writing means to file %s/X/%s.txt\n", (write_path.c_str())(name.c_str())); //std::cerr << " Writing means to file " << write_path // << "/X/" << name << ".txt" << std::endl; X_.write((write_path + "X/" + name + ".txt").c_str()); }
3944429c0373de07743606fd0c9df2fdf76fda5c
34231cb6ffbdce49ea37bb0f66bfa1a7513e51dd
/CGame.h
2acbc068f3a6ab336ed2c79d851e895f157cdd0e
[]
no_license
Storaz/B_CPP_HERRMANNFlorian_SDL
fe907f2848a7ba6e8272d9f297740fdb11b9f92c
2ef21baa1140e26cad5383f91e52d69821119a38
refs/heads/master
2020-04-07T10:42:06.018927
2018-11-22T09:27:58
2018-11-22T09:27:58
158,296,991
0
0
null
null
null
null
UTF-8
C++
false
false
54
h
CGame.h
#pragma once class Game { public: void Play(); };
59407f069cbe4e79c473024e21626797b69cfca4
003d8fea3077ede86e4785411424a5acf622252f
/test/txpl/vm/eval_binary_gt_test.cpp
2e9650716a9e6cf929616e8f54102b98655465bf
[ "BSL-1.0" ]
permissive
ptomulik/txpl
c43f961f160dcdee968fc214b5196b934a4ca514
109b5847abe0d46c598ada46f411f98ebe8dc4c8
refs/heads/master
2021-06-20T02:01:54.072229
2015-05-19T07:14:38
2015-05-19T07:14:38
31,542,106
0
0
null
null
null
null
UTF-8
C++
false
false
26,477
cpp
eval_binary_gt_test.cpp
// Copyright (C) 2015, Pawel Tomulik <ptomulik@meil.pw.edu.pl> // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #define BOOST_TEST_MODULE test_txpl_vm_eval_binary_neq #include <txpl/test_config.hpp> #include <boost/test/unit_test.hpp> #ifndef TXPL_TEST_SKIP_VM_EVAL_BINARY_GT #include <txpl/vm/eval_binary_op.hpp> #include <txpl/vm/basic_types.hpp> #include <txpl/vm/value.hpp> #include <boost/variant/apply_visitor.hpp> #include <boost/variant/get.hpp> #include <type_traits> using namespace txpl::vm; typedef basic_types<>::char_type char_type; typedef basic_types<>::int_type int_type; typedef basic_types<>::bool_type bool_type; typedef basic_types<>::real_type real_type; typedef basic_types<>::string_type string_type; typedef basic_types<>::regex_type regex_type; typedef basic_types<>::blank_type blank_type; typedef array<value<> > array_type; typedef object<value<> > object_type; BOOST_AUTO_TEST_CASE(char__gt__char) { value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = char_type{'\0'}; const value<> v2 = char_type{'\0'}; r = blank_type(); BOOST_CHECK(boost::apply_visitor(op, v1, v2)); bool_type x = bool_type{true}; BOOST_CHECK_NO_THROW(x = boost::get<bool_type>(r)); BOOST_CHECK(x == (char_type{'\0'} > char_type{'\0'})); } } BOOST_AUTO_TEST_CASE(char__gt__int) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = char_type{'\0'}; const value<> v2 = int_type{0}; r = blank_type(); BOOST_CHECK(boost::apply_visitor(op, v1, v2)); bool_type x = bool_type{true}; BOOST_CHECK_NO_THROW(x = boost::get<bool_type>(r)); BOOST_CHECK(x == (char_type{'\0'} > int_type{0})); } } BOOST_AUTO_TEST_CASE(char__gt__bool) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = char_type{'\0'}; const value<> v2 = bool_type{false}; r = blank_type(); BOOST_CHECK(boost::apply_visitor(op, v1, v2)); bool_type x = bool_type{true}; BOOST_CHECK_NO_THROW(x = boost::get<bool_type>(r)); BOOST_CHECK(x == (char_type{'\0'} > bool_type{false})); } } BOOST_AUTO_TEST_CASE(char__gt__real) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = char_type{'\0'}; const value<> v2 = real_type{0.0}; r = blank_type(); BOOST_CHECK(boost::apply_visitor(op, v1, v2)); bool_type x = bool_type{true}; BOOST_CHECK_NO_THROW(x = boost::get<bool_type>(r)); BOOST_CHECK(x == (char_type{'\0'} > real_type{0.0})); } } BOOST_AUTO_TEST_CASE(char__gt__string) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = char_type{'a'}; const value<> v2 = string_type(); r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(char__gt__regex) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = char_type{'a'}; const value<> v2 = regex_type(); r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(char__gt__array) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = char_type{'a'}; const value<> v2 = array_type(); r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(char__gt__object) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = char_type{'a'}; const value<> v2 = object_type(); r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(int__gt__char) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = int_type{0}; const value<> v2 = char_type{'\0'}; r = blank_type(); BOOST_CHECK(boost::apply_visitor(op, v1, v2)); bool_type x = bool_type{true}; BOOST_CHECK_NO_THROW(x = boost::get<bool_type>(r)); BOOST_CHECK(x == (int_type{0} > char_type{'\0'})); } } BOOST_AUTO_TEST_CASE(int__gt__int) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = int_type{0}; const value<> v2 = int_type{0}; r = blank_type(); BOOST_CHECK(boost::apply_visitor(op, v1, v2)); bool_type x = bool_type{true}; BOOST_CHECK_NO_THROW(x = boost::get<bool_type>(r)); BOOST_CHECK(x == (int_type{0} > int_type{0})); } } BOOST_AUTO_TEST_CASE(int__gt__bool) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = int_type{0}; const value<> v2 = bool_type{false}; r = blank_type(); BOOST_CHECK(boost::apply_visitor(op, v1, v2)); bool_type x = bool_type{true}; BOOST_CHECK_NO_THROW(x = boost::get<bool_type>(r)); BOOST_CHECK(x == (int_type{0} > bool_type{false})); } } BOOST_AUTO_TEST_CASE(int__gt__real) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = int_type{0}; const value<> v2 = real_type{0.0}; r = blank_type(); BOOST_CHECK(boost::apply_visitor(op, v1, v2)); bool_type x = bool_type{true}; BOOST_CHECK_NO_THROW(x = boost::get<bool_type>(r)); BOOST_CHECK(x == (int_type{0} > real_type{0.0})); } } BOOST_AUTO_TEST_CASE(int__gt__string) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = int_type{0}; const value<> v2 = string_type(); r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(int__gt__regex) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = int_type{0}; const value<> v2 = regex_type(); r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(int__gt__array) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = int_type{0}; const value<> v2 = array_type(); r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(int__gt__object) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = int_type{0}; const value<> v2 = object_type(); r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(bool__gt__char) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = bool_type{false}; const value<> v2 = char_type{'\0'}; r = blank_type(); BOOST_CHECK(boost::apply_visitor(op, v1, v2)); bool_type x = bool_type{true}; BOOST_CHECK_NO_THROW(x = boost::get<bool_type>(r)); BOOST_CHECK(x == (char_type{false} > bool_type{'\0'})); } } BOOST_AUTO_TEST_CASE(bool__gt__int) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = bool_type{false}; const value<> v2 = int_type{0}; r = blank_type(); BOOST_CHECK(boost::apply_visitor(op, v1, v2)); bool_type x = bool_type{true}; BOOST_CHECK_NO_THROW(x = boost::get<bool_type>(r)); BOOST_CHECK(x == (bool_type{false} > int_type{0})); } } BOOST_AUTO_TEST_CASE(bool__gt__bool) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = bool_type{false}; const value<> v2 = bool_type{false}; r = blank_type(); BOOST_CHECK(boost::apply_visitor(op, v1, v2)); bool_type x = bool_type{true}; BOOST_CHECK_NO_THROW(x = boost::get<bool_type>(r)); BOOST_CHECK(x == (bool_type{false} > bool_type{false})); } { const value<> v1 = bool_type{false}; const value<> v2 = bool_type{true}; r = blank_type(); BOOST_CHECK(boost::apply_visitor(op, v1, v2)); bool_type x = bool_type{false}; BOOST_CHECK_NO_THROW(x = boost::get<bool_type>(r)); BOOST_CHECK(x == (bool_type{false} > bool_type{true})); } { const value<> v1 = bool_type{true}; const value<> v2 = bool_type{false}; r = blank_type(); BOOST_CHECK(boost::apply_visitor(op, v1, v2)); bool_type x = bool_type{false}; BOOST_CHECK_NO_THROW(x = boost::get<bool_type>(r)); BOOST_CHECK(x == (bool_type{true} > bool_type{false})); } { const value<> v1 = bool_type{true}; const value<> v2 = bool_type{true}; r = blank_type(); BOOST_CHECK(boost::apply_visitor(op, v1, v2)); bool_type x = bool_type{false}; BOOST_CHECK_NO_THROW(x = boost::get<bool_type>(r)); BOOST_CHECK(x == (bool_type{true} > bool_type{true})); } } BOOST_AUTO_TEST_CASE(bool__gt__real) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = bool_type{false}; const value<> v2 = real_type{0.0}; r = blank_type(); BOOST_CHECK(boost::apply_visitor(op, v1, v2)); bool_type x = bool_type{true}; BOOST_CHECK_NO_THROW(x = boost::get<bool_type>(r)); BOOST_CHECK(x == (bool_type{false} > bool_type{0.0})); } } BOOST_AUTO_TEST_CASE(bool__gt__string) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = bool_type{false}; const value<> v2 = string_type(); r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(bool__gt__regex) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = bool_type{false}; const value<> v2 = regex_type(); r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(bool__gt__array) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = bool_type{false}; const value<> v2 = array_type(); r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(bool__gt__object) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = bool_type{false}; const value<> v2 = object_type(); r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(real__gt__char) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = real_type{0.0}; const value<> v2 = char_type{'\0'}; r = blank_type(); BOOST_CHECK(boost::apply_visitor(op, v1, v2)); bool_type x = bool_type{true}; BOOST_CHECK_NO_THROW(x = boost::get<bool_type>(r)); BOOST_CHECK(x == (real_type{0.0} > char_type{'\0'})); } } BOOST_AUTO_TEST_CASE(real__gt__int) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = real_type{0.0}; const value<> v2 = int_type{0}; r = blank_type(); BOOST_CHECK(boost::apply_visitor(op, v1, v2)); bool_type x = bool_type{true}; BOOST_CHECK_NO_THROW(x = boost::get<bool_type>(r)); BOOST_CHECK(x == (real_type{0.0} > int_type{0})); } } BOOST_AUTO_TEST_CASE(real__gt__bool) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = real_type{0.0}; const value<> v2 = bool_type{false}; r = blank_type(); BOOST_CHECK(boost::apply_visitor(op, v1, v2)); bool_type x = bool_type{true}; BOOST_CHECK_NO_THROW(x = boost::get<bool_type>(r)); BOOST_CHECK(x == (real_type{0.0} > bool_type{false})); } } BOOST_AUTO_TEST_CASE(real__gt__real) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = real_type{0.0}; const value<> v2 = real_type{0.0}; r = blank_type(); BOOST_CHECK(boost::apply_visitor(op, v1, v2)); bool_type x = bool_type{true}; BOOST_CHECK_NO_THROW(x = boost::get<bool_type>(r)); BOOST_CHECK(x == (real_type{0.0} > real_type{0.0})); } } BOOST_AUTO_TEST_CASE(real__gt__string) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = real_type{0.0}; const value<> v2 = string_type(); r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(real__gt__regex) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = real_type{0.0}; const value<> v2 = regex_type(); r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(real__gt__array) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = real_type{0.0}; const value<> v2 = array_type(); r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(real__gt__object) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = real_type{0.0}; const value<> v2 = object_type(); r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(string__gt__char) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = string_type(); const value<> v2 = char_type{'\0'}; r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(string__gt__int) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = string_type(); const value<> v2 = int_type{0}; r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(string__gt__bool) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = string_type(); const value<> v2 = bool_type{false}; r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(string__gt__real) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = string_type(); const value<> v2 = real_type{0.0}; r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(string__gt__string) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = string_type("asd"); const value<> v2 = string_type("asd"); r = blank_type(); BOOST_CHECK(boost::apply_visitor(op, v1, v2)); bool_type x = bool_type{false}; BOOST_CHECK_NO_THROW(x = boost::get<bool_type>(r)); BOOST_CHECK(x == (string_type("asd") > string_type("asd"))); } { const value<> v1 = string_type("asd"); const value<> v2 = string_type("qwe"); r = blank_type(); BOOST_CHECK(boost::apply_visitor(op, v1, v2)); bool_type x = bool_type{false}; BOOST_CHECK_NO_THROW(x = boost::get<bool_type>(r)); BOOST_CHECK(x == (string_type("asd") > string_type("qwe"))); } } BOOST_AUTO_TEST_CASE(string__gt__regex) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = string_type(); const value<> v2 = regex_type(); r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(string__gt__array) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = string_type(); const value<> v2 = array_type(); r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(string__gt__object) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = string_type(); const value<> v2 = object_type(); r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(regex__gt__char) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = regex_type(); const value<> v2 = char_type{'\0'}; r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(regex__gt__int) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = regex_type(); const value<> v2 = int_type{0}; r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(regex__gt__bool) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = regex_type(); const value<> v2 = bool_type{false}; r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(regex__gt__real) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = regex_type(); const value<> v2 = real_type{0.0}; r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(regex__gt__string) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = regex_type(); const value<> v2 = string_type(); r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(regex__gt__regex) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = regex_type(); const value<> v2 = regex_type(); r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(regex__gt__array) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = regex_type(); const value<> v2 = array_type(); r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(regex__gt__object) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = regex_type(); const value<> v2 = object_type(); r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(array__gt__char) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = array_type(); const value<> v2 = char_type{'\0'}; r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(array__gt__int) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = array_type(); const value<> v2 = int_type{0}; r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(array__gt__bool) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = array_type(); const value<> v2 = bool_type{false}; r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(array__gt__real) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = array_type(); const value<> v2 = real_type{0.0}; r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(array__gt__string) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = array_type(); const value<> v2 = string_type(); r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(array__gt__regex) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = array_type(); const value<> v2 = regex_type(); r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(array__gt__array) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = array_type(); const value<> v2 = array_type(); r = blank_type(); BOOST_CHECK(boost::apply_visitor(op, v1, v2)); array_type x; BOOST_CHECK_NO_THROW(x = boost::get<array_type>(r)); BOOST_CHECK_EQUAL(x.size(), 0); } { array_type a1(3); array_type a2(3); a1[0] = a2[0] = char_type{'a'}; a1[1] = real_type{10.0}; a2[1] = int_type{100}; a1[2] = int_type{321}; a2[2] = real_type{.123}; const value<> v1 = a1; const value<> v2 = a2; r = blank_type(); BOOST_CHECK(boost::apply_visitor(op, v1, v2)); array_type x; BOOST_CHECK_NO_THROW(x = boost::get<array_type>(r)); BOOST_CHECK_EQUAL(x.size(), 3); BOOST_CHECK(!boost::get<bool_type>(x[0])); BOOST_CHECK(!boost::get<bool_type>(x[1])); BOOST_CHECK(boost::get<bool_type>(x[2])); } { array_type a1(3); array_type a2(2); a2[0] = a1[0] = char_type{'a'}; a2[1] = a1[1] = int_type{100}; a1[2] = real_type{.123}; const value<> v1 = a1; const value<> v2 = a2; r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(array__gt__object) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = array_type(); const value<> v2 = object_type(); r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(object__gt__char) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = object_type(); const value<> v2 = char_type{'\0'}; r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(object__gt__int) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = object_type(); const value<> v2 = int_type{0}; r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(object__gt__bool) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = object_type(); const value<> v2 = bool_type{false}; r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(object__gt__real) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = object_type(); const value<> v2 = real_type{0.0}; r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(object__gt__string) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = object_type(); const value<> v2 = string_type(); r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(object__gt__regex) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = object_type(); const value<> v2 = regex_type(); r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(object__gt__array) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = object_type(); const value<> v2 = array_type(); r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } BOOST_AUTO_TEST_CASE(object__gt__object) { using namespace txpl::vm; value<> r; auto op = eval_binary_op<op_t::gt_>(r); { const value<> v1 = object_type(); const value<> v2 = object_type(); r = blank_type(); BOOST_CHECK(!boost::apply_visitor(op, v1, v2)); BOOST_CHECK_NO_THROW(boost::get<blank_type>(r)); } } #else BOOST_AUTO_TEST_CASE(dummy) { BOOST_CHECK(true); } #endif
667fddf7cc264711d1e582747c8010e0da94cd37
55d2d0d5309b2a0502e0d95fac08bdb272085ee1
/week5/courses/5_a.cpp
0d2832113dd769cc48bdfbd0c6571349b9569f92
[]
no_license
AssemAbdirashova/Algorithm
b8571d26800590256308a61c77b0427b958588cb
4285d4a27449836e7b36952847774217ca7e61f2
refs/heads/master
2023-04-13T19:26:22.644803
2023-04-04T10:40:05
2023-04-04T10:40:05
279,627,693
0
0
null
null
null
null
UTF-8
C++
false
false
576
cpp
5_a.cpp
#include <iostream> #include <stack> #include <vector> using namespace std; int main(){ string s; cin >> s; int n; cin >> n; vector<bool> v; vector<string> v1; for(int i = 0; i< n;i++){ int a, b, c, d; cin >> a >> b >> c >> d; if(s.substr(a-1, b-a+1) == s.substr(c-1, d-c+1) ){ v.push_back(true); }else{ v.push_back(false); } } for(int i = 0; i< n;i++){ if(v[i] == true){ cout << "Yes" << endl; }else cout << "No" << endl; } return 0; }
6083bcb4920387dc8f3d270c54e4b56e37352563
b20b01a33fd3baa9b3bc76a795ede307a8c2ca8a
/src/dp/f.cpp
934ab5f3fc624fa717e7e09fc9c5a062a9abad7f
[]
no_license
kmzn128/atcoder_cpp
3479f4f25929ce60001ce762bf056d2bb23c90ad
7aab230776a0e06a02f2f33df38ba92c05024efa
refs/heads/master
2020-08-27T23:32:09.741027
2020-02-27T00:05:03
2020-02-27T00:05:03
217,520,785
0
0
null
null
null
null
UTF-8
C++
false
false
615
cpp
f.cpp
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define REP2(i, a, b) for (int i = (a); i < (int)(b); i++) typedef vector<string> VS; typedef vector<VS> VVS; string Main(string &s, string &t) { int ss = s.size(); int st = t.size(); VVS dp(st+1, VS(ss+1, )); REP(i, n) { REP(j, W+1) { dp[i+1][j] = (j < w[i]) ? dp[i][j] : max(dp[i][j], dp[i][j-w[i]] + v[i]); } } return dp[n][W]; } int main(void) { string s, t; cin >> s; cin >> t; cout << Main(s, t) << endl; return 0; }
e91258b1a68466ba1431071fe2f8e46c88562483
10b859659f73ea3a41b62dad507273902a4d7daf
/Homework03/Task2_Sever/Task2Sever.cpp
06b3dcc07af183ff3843628452437e92e58f9c73
[]
no_license
thangnx97/network-programing
8be61fd95693a50b331c4b94ef911c60dde86c2b
af2d50d50274190b221ad06194e1a08cb7bebaf9
refs/heads/master
2020-05-07T10:20:18.974615
2019-04-09T17:21:21
2019-04-09T17:21:21
180,414,129
0
0
null
null
null
null
UTF-8
C++
false
false
5,354
cpp
Task2Sever.cpp
#include <stdio.h> #include <stdlib.h> #include <string.h> /* Define _WINSOCK_DEPRECATED_NO_WARNINGS to use some function that not safe in VS2015 */ #define _WINSOCK_DEPRECATED_NO_WARNINGS #include <ws2tcpip.h> #include <winsock2.h> #include "myfileopt.h" #include "mynetopt.h" #define BUFF_SIZE 10240 //10Kb #define FILE_PATCH_SIZE 512 #define FILE_NAME_SIZE 256 #define FILE_EXIST_ON_SEVER -3 #define TRANSFER_SUCCESS 0 #define FILE_READ_FAIL -4 #define FILE_WRITE_FAIL -5 #define DISCONNECT -10 #pragma comment(lib, "Ws2_32.lib") /* Function check arguments Return 0 if all arguments correct Else retun 1 */ int checkArgs(int argc, char ** argv, int *port) { //Check argument count. This program argv = 2 if (argc != 2) { printf("Arguments not found\n"); system("pause"); return 1; } //Check argument value *port = isPortNum(argv[1]); if (*port == -1) { printf("Port input not found\n"); system("pausse"); return 1; } return 0; } /* Receive file name and file size from client Return 0 if sucess Return SOCKET_ERROR if error transfer Return FILE_EXIST_ON_SEVER if file existed on sever */ int receiveHeader(SOCKET connSock, char* fileName, _int64 *fileSize) { int ret; char buff[256]; //Receive file name ret = recvExt(connSock, fileName, FILE_NAME_SIZE); if (ret == 1 & fileName[0] == DISCONNECT) return SOCKET_ERROR; if (ret == SOCKET_ERROR) return SOCKET_ERROR; fileName[ret] = '\0'; printf("Receiver file name: %s\n", fileName); //Receiver file size ret = recvExt(connSock, (char*)fileSize, sizeof(_int64)); if (ret == SOCKET_ERROR) return SOCKET_ERROR; printf("Receiver file size: %lld byte\n", *fileSize); //Check file exist if (fileExist(fileName) == FILE_EXISTED) { strcpy_s(buff, 256, "Error: file existed on sever"); ret = sendExt(connSock, buff, strlen(buff)); if (ret == SOCKET_ERROR) return SOCKET_ERROR; return FILE_EXIST_ON_SEVER; } else { strcpy_s(buff, 256, "OK"); ret = sendExt(connSock, buff, strlen(buff)); if (ret == SOCKET_ERROR) return SOCKET_ERROR; } return 0; } /* Function receive file from client Return TRANSFER_SUCCESS if transfer success Return TRANS_INTERUP if transfer interup error Return FILE_WRITE_FAIL if can not write file on sever */ int recvData(SOCKET connSock, char * fileName, char * buff, int buffSize, _int64 fileSize) { _int64 nLeft = fileSize; int ret; int payload; FILE *pFile; fopen_s(&pFile, fileName, "wb"); if (pFile == NULL) return FILE_WRITE_FAIL; while (nLeft>0) { //Receive data from client ret = recvExt(connSock, buff, buffSize); if (ret == SOCKET_ERROR) { return SOCKET_ERROR; fclose(pFile); } payload = ret; //Write buffer to file ret = fwrite(buff, payload, 1, pFile); // nLeft -= payload; //Send to sever strcpy_s(buff, buffSize, "OK"); ret = sendExt(connSock, buff, strlen(buff)); if (ret == SOCKET_ERROR) { fclose(pFile); return SOCKET_ERROR; } } //Transfer succes fclose(pFile); return TRANSFER_SUCCESS; } int main(int argc, char ** argv) { //Check arguments int port; if (checkArgs(argc, argv, &port) == 1) return 1; //Terminated program /* Init winsock Use version 2.2 */ WSAData wsaData; int ret; ret = WSAStartup( MAKEWORD(2, 2), &wsaData ); if (ret != 0) { printf("Canot init winsock!"); system("pause"); return 1; } //Init socket SOCKET sever = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (sever == SOCKET_ERROR) { printf("Error code: %d", WSAGetLastError()); system("pause"); return 1; } //Init sever address usse INADDR_ANY argument... sockaddr_in severAddr; severAddr.sin_family = AF_INET; severAddr.sin_addr.s_addr = htonl(ADDR_ANY); severAddr.sin_port = htons(port); //Bind address to socket ret = bind(sever, (const sockaddr*)&severAddr, sizeof(severAddr)); if (ret != 0) { printf("Can not bind address!\n"); system("pause"); return 1; } printf("Sever started at [%s:%u]\n", inet_ntoa(severAddr.sin_addr), ntohs(severAddr.sin_port)); //Init to transfer sockaddr_in clientAddr; char buff[BUFF_SIZE]; char fileName[FILE_NAME_SIZE]; _int64 fileSize; _int64 nLeft; int clientAddrLen = sizeof(clientAddr); int finishConn; SOCKET connSock; //Listen to connection if (listen(sever, 10)) { printf("Listen error!\n"); return 1; } //Infinite lopp while (1) { //Accept connSock = accept(sever, (sockaddr*)&clientAddr, &clientAddrLen); printf("Connected to [%s:%u]\n", inet_ntoa(clientAddr.sin_addr), ntohs(clientAddr.sin_port)); finishConn = 0; while (finishConn ==0) { //Receiver file name ret = receiveHeader(connSock, fileName, &fileSize); if (ret == 0) { //Start transfer printf("Transfering...\n"); ret = recvData(connSock, fileName, buff, BUFF_SIZE, fileSize); if (ret == SOCKET_ERROR) finishConn = 1; else if (ret == FILE_WRITE_FAIL) { printf("Error: sever write file error\n"); remove(fileName); } else if (ret == TRANSFER_SUCCESS) { printf("Transfer success\n"); } } else { if (ret == SOCKET_ERROR) finishConn = 1; if (ret == FILE_EXIST_ON_SEVER) printf("File exist on sever\n"); } } printf("Disconnected to client\n"); shutdown(connSock, SD_SEND); closesocket(connSock); } //End of ussing socket sever closesocket(sever); //End of ussing winsock WSACleanup(); return 0; }
956d61b20bee7be18a00571fc94d826713e582e8
09ddd2df75bce4df9e413d3c8fdfddb7c69032b4
/src/LSVG/LDOMDocumentSVGFiltersImpl.cpp
55da078485f0eb07e8d5858a0781c4134e70e0dc
[]
no_license
sigurdle/FirstProject2
be22e4824da8cd2cb5047762478050a04a4ac63b
dee78c62a1b95e55fcdf3bf2a9bc79c69705bf94
refs/heads/master
2021-01-16T18:45:41.042140
2020-08-18T16:57:13
2020-08-18T16:57:13
3,554,336
6
5
null
null
null
null
UTF-8
C++
false
false
5,744
cpp
LDOMDocumentSVGFiltersImpl.cpp
#include "stdafx.h" #include "LSVG2.h" #include "SVGImplementation.h" #include "SVGFilterElement.h" #include "SVGFEBlendElement.h" #include "SVGFEGaussianBlurElement.h" #include "SVGFECompositeElement.h" #include "SVGFEFloodElement.h" #include "SVGFEOffsetElement.h" #include "SVGFESpecularLightingElement.h" #include "SVGFEDiffuseLightingElement.h" #include "SVGFEDistantLightElement.h" #include "SVGFEPointLightElement.h" #include "SVGFESpotLightElement.h" #include "SVGFETileElement.h" #include "SVGFETurbulenceElement.h" #include "SVGFEDisplacementMapElement.h" #include "SVGFEMorphologyElement.h" #include "SVGFEColorMatrixElement.h" #include "SVGFEConvolveMatrixElement.h" #include "SVGFEImageElement.h" #include "SVGFEComponentTransferElement.h" #include "SVGFEFuncAElement.h" #include "SVGFEFuncRElement.h" #include "SVGFEFuncGElement.h" #include "SVGFEFuncBElement.h" #include "SVGFEMergeElement.h" #include "SVGFEMergeNodeElement.h" namespace System { namespace Web { Element* SVGImplementation::createSVGElementFilters(StringIn localName, StringIn qualifiedName, NamedNodeMap* attributes) { Element* newElement = NULL; // Filter if (localName == L"filter") { SVGFilterElement* pElement = new SVGFilterElement(attributes); newElement = pElement; } #if 0 // feElement(s) else if (!wcscmp(localName, L"feBlend")) { CComObject<CLSVGFEBlendElement>* pElement; CComObject<CLSVGFEBlendElement>::CreateInstance(&pElement); if (pElement) { newElement = pElement; } } #endif else if (localName == L"feGaussianBlur") { SVGFEGaussianBlurElement* pElement = new SVGFEGaussianBlurElement(attributes); newElement = pElement; } else if (localName == L"feOffset") { SVGFEOffsetElement* pElement = new SVGFEOffsetElement(attributes); newElement = pElement; } else if (localName == L"feComposite") { SVGFECompositeElement* pElement = new SVGFECompositeElement(attributes); newElement = pElement; } else if (localName == L"feFlood") { SVGFEFloodElement* pElement = new SVGFEFloodElement(attributes); newElement = pElement; } else if (localName == L"feSpecularLighting") { SVGFESpecularLightingElement* pElement = new SVGFESpecularLightingElement(attributes); newElement = pElement; } else if (localName == L"feDiffuseLighting") { SVGFEDiffuseLightingElement* pElement = new SVGFEDiffuseLightingElement(attributes); newElement = pElement; } else if (localName == L"feDistantLight") { SVGFEDistantLightElement* pElement = new SVGFEDistantLightElement(attributes); newElement = pElement; } else if (localName == L"fePointLight") { SVGFEPointLightElement* pElement = new SVGFEPointLightElement(attributes); newElement = pElement; } else if (localName == L"feSpotLight") { SVGFESpotLightElement* pElement = new SVGFESpotLightElement(attributes); newElement = pElement; } #if 0 else if (!wcscmp(localName, L"feTurbulence")) { CComObject<CLSVGFETurbulenceElement>* pElement; CComObject<CLSVGFETurbulenceElement>::CreateInstance(&pElement); if (pElement) { newElement = pElement; } } else if (!wcscmp(localName, L"feDisplacementMap")) { CComObject<CLSVGFEDisplacementMapElement>* pElement; CComObject<CLSVGFEDisplacementMapElement>::CreateInstance(&pElement); if (pElement) { newElement = pElement; } } else if (!wcscmp(localName, L"feMorphology")) { CComObject<CLSVGFEMorphologyElement>* pElement; CComObject<CLSVGFEMorphologyElement>::CreateInstance(&pElement); if (pElement) { newElement = pElement; } } #endif else if (localName == L"feColorMatrix") { SVGFEColorMatrixElement* pElement = new SVGFEColorMatrixElement(attributes); newElement = pElement; } #if 0 else if (!wcscmp(localName, L"feConvolveMatrix")) { CComObject<CLSVGFEConvolveMatrixElement>* pElement; CComObject<CLSVGFEConvolveMatrixElement>::CreateInstance(&pElement); if (pElement) { newElement = pElement; } } else if (!wcscmp(localName, L"feImage")) { CComObject<CLSVGFEImageElement>* pElement; CComObject<CLSVGFEImageElement>::CreateInstance(&pElement); if (pElement) { newElement = pElement; } } else if (!wcscmp(localName, L"feTile")) { CComObject<CLSVGFETileElement>* pElement; CComObject<CLSVGFETileElement>::CreateInstance(&pElement); if (pElement) { newElement = pElement; } } // Component transfer filter else if (!wcscmp(localName, L"feComponentTransfer")) { CComObject<CLSVGFEComponentTransferElement>* pElement; CComObject<CLSVGFEComponentTransferElement>::CreateInstance(&pElement); if (pElement) { newElement = pElement; } } else if (!wcscmp(localName, L"feFuncA")) { CComObject<CLSVGFEFuncAElement>* pElement; CComObject<CLSVGFEFuncAElement>::CreateInstance(&pElement); if (pElement) { newElement = pElement; } } else if (!wcscmp(localName, L"feFuncR")) { CComObject<CLSVGFEFuncRElement>* pElement; CComObject<CLSVGFEFuncRElement>::CreateInstance(&pElement); if (pElement) { newElement = pElement; } } else if (!wcscmp(localName, L"feFuncG")) { CComObject<CLSVGFEFuncGElement>* pElement; CComObject<CLSVGFEFuncGElement>::CreateInstance(&pElement); if (pElement) { newElement = pElement; } } else if (!wcscmp(localName, L"feFuncB")) { CComObject<CLSVGFEFuncBElement>* pElement; CComObject<CLSVGFEFuncBElement>::CreateInstance(&pElement); if (pElement) { newElement = pElement; } } #endif else if (localName == L"feMerge") { SVGFEMergeElement* pElement = new SVGFEMergeElement(attributes); newElement = pElement; } else if (localName == L"feMergeNode") { SVGFEMergeNodeElement* pElement = new SVGFEMergeNodeElement(attributes); newElement = pElement; } return newElement; } } // Web }
71103017ff5fa1814addc62cc275e700f533e8d6
00f1cfc73ba05f72373fbdfd303f6f34dd3a533e
/JLJutil.m/src/ReentrantLock.cpp
5d53179d39cac6e6b9df1025e84c12a9373382b4
[]
no_license
weltermann17/just-like-java
07c7f6164d636688f9d09cdc8421e51d84fdb25f
6517f1c1015e0b17a023b1b475fcc2f3eed9bade
refs/heads/master
2020-06-06T08:32:13.367694
2014-07-01T21:19:06
2014-07-01T21:19:06
21,002,059
4
0
null
null
null
null
UTF-8
C++
false
false
4,058
cpp
ReentrantLock.cpp
// ReentrantLock.cpp //******************************************************************** #ifndef ReentrantLock_cpp #define ReentrantLock_cpp //******************************************************************** #include <jlj/util/concurrent/locks/ReentrantLock.h> //******************************************************************** #include <jlj/lang/Class.h> #include <jlj/lang/StringBuffer.h> using jlj::lang::StringBuffer; //******************************************************************** NAMESPACE_BEGIN(jlj) NAMESPACE_BEGIN(util) NAMESPACE_BEGIN(concurrent) NAMESPACE_BEGIN(locks) //******************************************************************** ReentrantLockI::~ReentrantLockI() {} //******************************************************************** ReentrantLockI::ReentrantLockI() : timedsemaphore(1) , owner(0) , holds(0) , acquired(0) {} //******************************************************************** void ReentrantLockI::lockInterruptibly() throw (InterruptedException, UnsupportedOperationException) { throw UnsupportedOperationException(L"ReentrantLockI::lockInterruptibly()"); } //******************************************************************** void ReentrantLockI::unlock() throw (IllegalMonitorStateException) { if (!pt::pthrequal(owner)) { throw IllegalMonitorStateException(L"ReentrantLockI::unlock() : thread is not owner"); } else { if (0 == pt::pdecrement(&holds)) { owner = 0; if (1 == pt::pexchange(&acquired, 0)) { timedsemaphore.signal(); } else { throw IllegalMonitorStateException(L"ReentrantLockI::unlock() : not locked"); } } } } //******************************************************************** bool ReentrantLockI::tryLock() { return tryLock(0); } //******************************************************************** bool ReentrantLockI::tryLock(int milliseconds) throw (InterruptedException, UnsupportedOperationException) { if (0 > milliseconds) return false; if (pt::pthrequal(owner)) { pt::pincrement(&holds); return true; } else { bool ok = timedsemaphore.wait(milliseconds); if (ok) { pt::pexchange(&acquired, 1); owner = pt::pthrself(); pt::pexchange(&holds, 1); } return ok; } } //******************************************************************** void ReentrantLockI::lock() { if (pt::pthrequal(owner)) { pt::pincrement(&holds); } else { timedsemaphore.wait(); pt::pexchange(&acquired, 1); owner = pt::pthrself(); pt::pexchange(&holds, 1); } } //******************************************************************** int ReentrantLockI::getHoldCount() const { int localholds = 0; pt::pexchange(&localholds, holds); return localholds; } //******************************************************************** bool ReentrantLockI::isHeldByCurrentThread() const { return pt::pthrequal(owner); } //******************************************************************** bool ReentrantLockI::isLocked() const { int localacquired = 0; pt::pexchange(&localacquired, acquired); return 0 < localacquired; } //******************************************************************** String ReentrantLockI::toString() const { StringBuffer result; result->append(L"<"); result->append(getClass()->toString()); result->append(L" locked=\""); result->append(isLocked() ? L"true" : L"false"); result->append(L"\" holders=\""); result->append(getHoldCount()); result->append(L"\" isheldbycurrentthread=\""); result->append(isHeldByCurrentThread() ? L"true" : L"false"); result->append(L"\" />"); return String(result); } //******************************************************************** NAMESPACE_END(locks) NAMESPACE_END(concurrent) NAMESPACE_END(util) NAMESPACE_END(jlj) //******************************************************************** #endif // eof
ee020338f480f78f06cbd4bff22019afd3fb5a04
0012cc471c9f138530597371280e6e7ae62b987c
/2개이하로다른비트.cc
36d22977bca42372acd4bae9c70d3ec99fdcf428
[]
no_license
hanbin9775/Programmers_Algorithm
a64c93622b6afe566799511d783ae7266853b698
81d27b179a82ef18878f5cc3cdb954c6eabfd59c
refs/heads/master
2022-03-22T00:37:05.532863
2022-03-01T09:27:35
2022-03-01T09:27:35
212,008,366
0
0
null
null
null
null
UTF-8
C++
false
false
684
cc
2개이하로다른비트.cc
#include <string> #include <vector> #include <cmath> using namespace std; int findLast0(long long num) { int cnt = 1; while (num > 0) { if (num % 2 == 1) { cnt++; num /= 2; } else { break; } } return cnt; } vector<long long> solution(vector<long long> numbers) { vector<long long> answer; for (int i = 0; i < numbers.size(); i++) { long long num = numbers[i]; int last0 = findLast0(num); if (last0 < 2) answer.push_back(num + 1); else answer.push_back(num + pow(2, last0 - 2)); } return answer; }
739750708f5f25676dc9a95d651e3585b9c9abdd
03c3ca4bf21422db928dd2736cb05b71e1875a29
/src/response/Response.cpp
7fb809fd13b43b205159e06b409278ba986c8f98
[]
no_license
Croco-byte/ft_webserv
6780301d892c2e02f3b550cd34cd894b486d8ae4
dab7463b6b8ba3d86f81feab47c2a5bd70bd998e
refs/heads/master
2023-06-05T03:20:32.875790
2021-06-25T14:54:54
2021-06-25T14:54:54
380,270,118
1
1
null
null
null
null
UTF-8
C++
false
false
2,063
cpp
Response.cpp
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* Response.cpp :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: user42 <user42@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/05/27 17:58:32 by user42 #+# #+# */ /* Updated: 2021/06/07 13:41:49 by user42 ### ########.fr */ /* */ /* ************************************************************************** */ #include "response/Response.hpp" Response::Response() : _protocol("HTTP/1.1"), _status(200) { this->setHeader("Date", Utils::get_current_time()); this->setHeader("Server", "Webserv/1.0 (Ubuntu)"); this->setHeader("Content-Length", "0"); } Response::~Response() {} void Response::setStatus(int status) { _status = status; } void Response::setHeader(std::string const & name, std::string const & value) { _headers[name] = value; } void Response::setBody(std::string const & text) { _body = text; } int Response::getStatus() const { return (_status); } std::string Response::build(std::map<int, std::string> const & errors) { std::string status_line; std::string headers; std::string response; status_line = _protocol + " " + Utils::to_string(_status) + " " + (errors.find(_status))->second + ENDL; for (DoubleString::iterator it = _headers.begin(); it != _headers.end(); it++) { if (!it->second.empty()) headers.append(it->first + ": " + it->second + ENDL); } response = status_line; response.append(headers); response.append(ENDL); response.append(_body); return (response); } std::string Response::getBody() const { return (_body); }
83f8d56e694321a78a973bc1b4020fb46b01662e
ea852cbf3ea88f163bdd06f060ad195f7e86a1a0
/src/llltableget.cpp
a2da70627fd505a51531e7eadd534c7bc2d898fb
[ "MIT" ]
permissive
gligneul/Lua-Low-Level
0063a701f80b577746142e6bc676d15750ea6967
1579b46e28d9ca16b70b9e9f3c11b389734eca00
refs/heads/master
2020-04-05T18:50:21.275492
2017-06-08T04:20:35
2017-06-08T04:20:35
42,790,724
14
1
null
null
null
null
UTF-8
C++
false
false
5,275
cpp
llltableget.cpp
/* ** LLL - Lua Low Level ** September, 2015 ** Author: Gabriel de Quadros Ligneul ** Copyright Notice for LLL: see lllcore.h ** ** llltableget.cpp */ #include "lllcompilerstate.h" #include "lllruntime.h" #include "llltableget.h" #include "lllvalue.h" extern "C" { #include "lprefix.h" #include "llimits.h" #include "lobject.h" #include "lstate.h" #include "ltm.h" } namespace lll { TableGet::TableGet(CompilerState& cs, Stack& stack, Value& table, Value& key, Register& dest) : Opcode(cs, stack), table_(table), key_(key), dest_(dest), tablevalue_(nullptr), switchtag_(cs_.CreateSubBlock("switchtag")), getint_(cs_.CreateSubBlock("getint", switchtag_)), getshrstr_(cs_.CreateSubBlock("getshrstr", getint_)), getlngstr_(cs_.CreateSubBlock("getlngstr", getshrstr_)), getany_(cs_.CreateSubBlock("getany", getlngstr_)), saveresult_(cs_.CreateSubBlock("saveresult", getany_)), searchtm_(cs_.CreateSubBlock("searchtm", saveresult_)), finishget_(cs_.CreateSubBlock("finshget", searchtm_)) { } void TableGet::Compile() { CheckTable(); SwithTag(); PerformGet(); SearchForTM(); SaveResult(); FinishGet(); } void TableGet::CheckTable() { cs_.B_.SetInsertPoint(entry_); cs_.B_.CreateCondBr(table_.HasTag(ctb(LUA_TTABLE)), switchtag_, finishget_); auto ttvalue = static_cast<llvm::PointerType*>(cs_.rt_.GetType("TValue")); auto nulltvalue = llvm::ConstantPointerNull::get(ttvalue); tms_.push_back({nulltvalue, entry_}); } void TableGet::SwithTag() { #if 1 cs_.B_.SetInsertPoint(switchtag_); tablevalue_ = table_.GetTable(); auto s = cs_.B_.CreateSwitch(key_.GetTag(), getany_, 4); auto AddCase = [&](int v, llvm::BasicBlock* block) { s->addCase(static_cast<llvm::ConstantInt*>(cs_.MakeInt(v)), block); }; AddCase(LUA_TNUMINT, getint_); AddCase(ctb(LUA_TSHRSTR), getshrstr_); AddCase(ctb(LUA_TLNGSTR), getlngstr_); AddCase(LUA_TNIL, searchtm_); #else cs_.B_.SetInsertPoint(switchtag_); tablevalue_ = table_.GetTable(); cs_.B_.CreateBr(getany_); #endif } void TableGet::PerformGet() { PerformGetCase(getint_, &Value::GetInteger, "int"); PerformGetCase(getshrstr_, &Value::GetTString, "shortstr"); PerformGetCase(getlngstr_, &Value::GetTString, "str"); PerformGetCase(getany_, &Value::GetTValue, ""); } void TableGet::SearchForTM() { auto checkflags = cs_.CreateSubBlock("checkflags", searchtm_); auto callgettm = cs_.CreateSubBlock("callgettm", checkflags); auto tmnotfound = cs_.CreateSubBlock("tmnotfound", callgettm); // Has metatable? cs_.B_.SetInsertPoint(searchtm_); auto tablet = cs_.rt_.GetType("Table"); auto metatable = cs_.LoadField(tablevalue_, tablet, offsetof(Table, metatable), "metatable"); auto ismtnull = cs_.B_.CreateIsNull(metatable, "is.mt.null"); cs_.B_.CreateCondBr(ismtnull, tmnotfound, checkflags); // Has tagged method? cs_.B_.SetInsertPoint(checkflags); auto flags = cs_.LoadField(metatable, cs_.rt_.MakeIntT(sizeof(int)), offsetof(Table, flags), "metatableflags"); auto flagenable = cs_.B_.CreateAnd(flags, cs_.MakeInt(1u << TM_INDEX)); auto hastm = cs_.B_.CreateICmpEQ(flagenable, cs_.MakeInt(0), "has.tm"); cs_.B_.CreateCondBr(hastm, callgettm, tmnotfound); // Call luaT_gettm cs_.B_.SetInsertPoint(callgettm); auto tstringt = cs_.rt_.GetType("TString"); auto tmname = cs_.InjectPointer(tstringt, G(cs_.L_)->tmname[TM_INDEX]); auto args = {metatable, cs_.MakeInt(TM_INDEX), tmname}; auto tm = cs_.CreateCall("luaT_gettm", args, "tm"); auto istmnull = cs_.B_.CreateIsNull(tm, "is.tm.null"); cs_.B_.CreateCondBr(istmnull, tmnotfound, finishget_); tms_.push_back({tm, callgettm}); // Tagged method not found, result is nil cs_.B_.SetInsertPoint(tmnotfound); cs_.SetField(dest_.GetTValue(), cs_.MakeInt(LUA_TNIL), offsetof(TValue, tt_), "desttag"); cs_.B_.CreateBr(exit_); } void TableGet::SaveResult() { cs_.B_.SetInsertPoint(saveresult_); auto ttvalue = cs_.rt_.GetType("TValue"); RTRegister result(cs_, CreatePHI(ttvalue, results_, "resultphi")); dest_.Assign(result); cs_.B_.CreateBr(exit_); } void TableGet::FinishGet() { cs_.B_.SetInsertPoint(finishget_); auto ttvalue = cs_.rt_.GetType("TValue"); auto tmphi = CreatePHI(ttvalue, tms_, "tmphi"); auto args = { cs_.values_.state, table_.GetTValue(), key_.GetTValue(), dest_.GetTValue(), tmphi }; cs_.CreateCall("luaV_finishget", args); stack_.Update(); cs_.B_.CreateBr(exit_); } void TableGet::PerformGetCase(llvm::BasicBlock* block, GetMethod getmethod, const char* suffix) { cs_.B_.SetInsertPoint(block); auto tableget = std::string("luaH_get") + suffix; auto args = {tablevalue_, (key_.*getmethod)()}; auto result = cs_.CreateCall(tableget, args, "result"); auto tag = cs_.LoadField(result, cs_.rt_.MakeIntT(sizeof(int)), offsetof(TValue, tt_), "result.tag"); auto isnil = cs_.B_.CreateICmpEQ(tag, cs_.MakeInt(LUA_TNIL)); cs_.B_.CreateCondBr(isnil, searchtm_, saveresult_); results_.push_back({result, block}); } }
4df1ead15375dde75fbfab36ae642a79b3fc81af
bec5d52c5185d032b2b81eccd008aa8e4e045790
/lwip/src/apps/snmp/snmp_netconn.c
70f8bfc057cdec9aecd8a806b2a1cd3b12590da0
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
shadowsocks/badvpn
2993b0da7c59870f0a550a842cabe3312761d541
40a0e5010aa4adb6d3ca1d1418dfde345c50107d
refs/heads/shadowsocks-android
2021-12-08T06:17:04.546977
2021-08-23T04:05:27
2021-08-23T04:05:27
45,686,048
166
154
NOASSERTION
2021-08-23T04:05:28
2015-11-06T14:18:20
C
UTF-8
C++
false
false
3,508
c
snmp_netconn.c
/** * @file * SNMP netconn frontend. */ /* * Copyright (c) 2001-2004 Swedish Institute of Computer Science. * 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. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. * * Author: Dirk Ziegelmeier <dziegel@gmx.de> */ #include "lwip/apps/snmp_opts.h" #if LWIP_SNMP && SNMP_USE_NETCONN #include <string.h> #include "lwip/api.h" #include "lwip/ip.h" #include "lwip/udp.h" #include "snmp_msg.h" #include "lwip/sys.h" #include "lwip/prot/iana.h" /** SNMP netconn API worker thread */ static void snmp_netconn_thread(void *arg) { struct netconn *conn; struct netbuf *buf; err_t err; LWIP_UNUSED_ARG(arg); /* Bind to SNMP port with default IP address */ #if LWIP_IPV6 conn = netconn_new(NETCONN_UDP_IPV6); netconn_bind(conn, IP6_ADDR_ANY, LWIP_IANA_PORT_SNMP); #else /* LWIP_IPV6 */ conn = netconn_new(NETCONN_UDP); netconn_bind(conn, IP4_ADDR_ANY, LWIP_IANA_PORT_SNMP); #endif /* LWIP_IPV6 */ LWIP_ERROR("snmp_netconn: invalid conn", (conn != NULL), return;); snmp_traps_handle = conn; do { err = netconn_recv(conn, &buf); if (err == ERR_OK) { snmp_receive(conn, buf->p, &buf->addr, buf->port); } if (buf != NULL) { netbuf_delete(buf); } } while (1); } err_t snmp_sendto(void *handle, struct pbuf *p, const ip_addr_t *dst, u16_t port) { err_t result; struct netbuf buf; memset(&buf, 0, sizeof(buf)); buf.p = p; result = netconn_sendto((struct netconn *)handle, &buf, dst, port); return result; } u8_t snmp_get_local_ip_for_dst(void *handle, const ip_addr_t *dst, ip_addr_t *result) { struct netconn *conn = (struct netconn *)handle; struct netif *dst_if; const ip_addr_t *dst_ip; LWIP_UNUSED_ARG(conn); /* unused in case of IPV4 only configuration */ ip_route_get_local_ip(&conn->pcb.udp->local_ip, dst, dst_if, dst_ip); if ((dst_if != NULL) && (dst_ip != NULL)) { ip_addr_copy(*result, *dst_ip); return 1; } else { return 0; } } /** * Starts SNMP Agent. */ void snmp_init(void) { sys_thread_new("snmp_netconn", snmp_netconn_thread, NULL, SNMP_STACK_SIZE, SNMP_THREAD_PRIO); } #endif /* LWIP_SNMP && SNMP_USE_NETCONN */
bee66d336e7da07d719b0d59dad6383497485761
9a75053ab744f4ef273aad57a7b4e6597fa52687
/Projects/Arkanoid/Shader.cpp
7d1a66253a6fb9d846ceb2a5a7c25b8fddcdbc56
[]
no_license
billautd/workspaceCPP
02c7fe881b16c74d2bba3b4873309e37037902f2
1a9f2bd74f842694f2564f17dbe8385fac9f61ea
refs/heads/master
2023-07-29T14:25:35.664678
2021-09-22T11:51:12
2021-09-22T11:51:12
286,848,451
0
0
null
null
null
null
UTF-8
C++
false
false
2,361
cpp
Shader.cpp
#include "Shader.h" #include <iostream> const std::string VERTEX_TYPE{ "VERTEX" }; const std::string FRAGMENT_TYPE{ "FRAGMENT" }; const std::string GEOMETRY_TYPE{ "GEOMETRY" }; const std::string PROGRAM_TYPE{ "PROGRAM" }; const Shader& Shader::Use() const { glUseProgram(id); return *this; } void Shader::Compile(const char* vertexSource, const char* fragmentSouce, const char* geometrySource) { GLuint sVertex{}; GLuint sFragment{}; GLuint sGeometry{}; //Vertex shader sVertex = glCreateShader(GL_VERTEX_SHADER); glShaderSource(sVertex, 1, &vertexSource, nullptr); glCompileShader(sVertex); CheckCompileErrors(sVertex, VERTEX_TYPE); //Fragment shader sFragment = glCreateShader(GL_FRAGMENT_SHADER); glShaderSource(sFragment, 1, &fragmentSouce, nullptr); glCompileShader(sFragment); CheckCompileErrors(sFragment, FRAGMENT_TYPE); //Geometry shader if (geometrySource != nullptr) { sGeometry = glCreateShader(GL_GEOMETRY_SHADER); glShaderSource(sGeometry, 1, &geometrySource, nullptr); glCompileShader(sGeometry); CheckCompileErrors(sGeometry, GEOMETRY_TYPE); } //Shader program id = glCreateProgram(); glAttachShader(id, sVertex); glAttachShader(id, sFragment); if (geometrySource != nullptr) glAttachShader(id, sGeometry); glLinkProgram(id); CheckCompileErrors(id, PROGRAM_TYPE); //Delete shaders as they're linked into our program now and are no longer necessary glDeleteShader(sVertex); glDeleteShader(sFragment); if(geometrySource != nullptr) glDeleteShader(sGeometry); } void Shader::CheckCompileErrors(const GLuint object, const std::string type) const { int success{ 0 }; char infoLog[1024]; if (type != PROGRAM_TYPE) { glGetShaderiv(object, GL_COMPILE_STATUS, &success); if (!success) { glGetShaderInfoLog(object, 1024, nullptr, infoLog); std::cout << "| ERROR::SHADER: Compile-time error: Type: " << type << "\n" << infoLog << "\n -- --------------------------------------------------- -- " << std::endl; } } else { glGetProgramiv(object, GL_LINK_STATUS, &success); if (!success) { glGetProgramInfoLog(object, 1024, nullptr, infoLog); glGetProgramInfoLog(object, 1024, NULL, infoLog); std::cout << "| ERROR::Shader: Link-time error: Type: " << type << "\n" << infoLog << "\n -- --------------------------------------------------- -- " << std::endl; } } }
df06c7282baba807ab0cdbcfa2438fb18e6da06b
51bd093a3a4546661da966b4ebfb2f3d10d8a9c8
/overrideselect.cpp
3febc7ac946d8fa2cbdcd3a369b32f2d06be00f4
[]
no_license
brandon-t-nguyen/EM_Scheduler_QT
26f1bb00a141964243bceb3730adc7b78ea107da
62bb71e59baf59b70eea6ae8b686168eda5c2075
refs/heads/master
2021-05-29T12:09:40.182327
2015-08-17T01:43:02
2015-08-17T01:43:02
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,428
cpp
overrideselect.cpp
#include "overrideselect.h" #include "ui_overrideselect.h" #include <QString> #include <QMessageBox> OverrideSelect::OverrideSelect(QWidget *parent) : QDialog(parent), ui(new Ui::OverrideSelect) { ui->setupUi(this); } OverrideSelect::~OverrideSelect() { delete ui; } void OverrideSelect::init(Scheduler *attachSchedule, Shift *attachShift, Student *attachStudent, Scheduler::AssignReturn type, bool* attachSuccess) { schedule = attachSchedule; shift = attachShift; student = attachStudent; success = attachSuccess; QString typeString; switch(type) { case Scheduler::SUCCESS: this->close(); break; case Scheduler::CONSEC: typeString = "Student will have too many consecutive shifts!"; break; case Scheduler::MINTIME: typeString = "Student has a shift within 8 hours of this shift!"; break; case Scheduler::OVERLAP: this->close(); break; case Scheduler::OVERMAX: typeString = "Student has the maximum number of assignable shifts!"; break; case Scheduler::ISNULL: this->close(); break; } ui->labelError->setText(typeString); } void OverrideSelect::on_buttonBox_accepted() { if(schedule->assign(shift,student,true,true) != Scheduler::SUCCESS) { QMessageBox::critical(this,tr("Error"),tr("Failed to assign.")); } *success= true; }
58d2a9dd2d4e809eb5ad55fee00ea1a5c4bec1bf
d79894796fcd98a43f67011a644c6042078ebbb8
/ExternalDependencies/DebugEngine/Profiling/AutoProfile.cpp
f3742c72ca6ed847be95a1560c72115f837a2674
[]
no_license
TheJoshuaSalazar/3DRenderer
17c9af9799a2cc5a97c2ea6fb29359289d876121
13f1eab39529fdb1759c4cb42cee9c6071528952
refs/heads/master
2021-01-22T09:57:49.883560
2014-07-29T04:10:57
2014-07-29T04:10:57
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,193
cpp
AutoProfile.cpp
#include <stdio.h> #include "AutoProfile.h" int Profilers::curretFrame = 0; float Profilers::Samples[MAX_FRAMES][MAX_CATEGORIES]; AutoProfile AutoProfile::AutoProfilerInstance; AutoProfile& AutoProfile::getProfilerInstance() { return AutoProfilerInstance; } AutoProfile::AutoProfile() {} AutoProfile::AutoProfile(int number) { name = number; clock.initialize(); clock.start(); } AutoProfile::~AutoProfile() { clock.stop(); Profilers::AddSample(name, clock.timeElapsedLastFrame()); } void Profilers::AddSample(int num,float value) { if(curretFrame < MAX_FRAMES) { Profilers::Samples[curretFrame][num] = value; if(num >= MAX_CATEGORIES - 1) { curretFrame++; } } } void Profilers::CSV(const char* file) { FILE *GameFile = NULL; fopen_s(&GameFile, file, "w"); if(GameFile != NULL) { for(int i = 0; i <MAX_CATEGORIES; i++) { if(i==0) fprintf(GameFile,"Collision,",i); if(i==1) fprintf(GameFile,"Draw,",i); } fprintf(GameFile,"\n "); for(int i = 0; i<MAX_FRAMES; i++) { for(int j = 0; j<MAX_CATEGORIES; j++) { fprintf(GameFile,"%f, ", Profilers::Samples[i][j]); } fprintf(GameFile,"\n "); } fclose(GameFile); } }
2cee50a83396c4ef16825df6343273e812f75adc
ca7ddc020a032bbc1b2e7b2d47e35d4159fcf33b
/tree/TRIE_tree/Hackerrank_Contacts.cpp
8e9a11e0cfb9c3e947b91b1d2e6f37f5902b8b3e
[]
no_license
atique7465/Data_Structure_in_detail
dd31b719ba481025ad5a245ba1dc75d28b79332d
003e90e7e696e19fa8818d1204dc15f30773e22b
refs/heads/master
2022-10-12T03:08:33.345115
2022-10-10T18:45:36
2022-10-10T18:45:36
186,146,286
2
1
null
null
null
null
UTF-8
C++
false
false
2,586
cpp
Hackerrank_Contacts.cpp
/// solution 01: using trie data structure. #include<bits/stdc++.h> #define ll long long int using namespace std; struct node { ll fullword; node *next[26+1]; node() { fullword = 0; for(ll i=0; i<26; i++) next[i] = NULL; } }; class trie { private: node *root; public: trie(){root = new node;} ~trie(){Delete(root);} void Delete(node *cur) { for(int i=0; i<26; i++) { if(cur->next[i] != NULL) Delete(cur->next[i]); } delete(cur); } void Insert(string s){add(root,s,0);} void add(node *cur, string s, ll i) { if(i > s.size()) return; ll id = s[i] - 'a'; if(cur->next[id] == NULL) { cur->next[id] = new node; add(cur->next[id], s, i+1); } else add(cur->next[id], s, i+1); cur->fullword++; } ll Search(string s) { node *cur = root; ll ln = s.size(); for(ll i=0; i<ln; i++) { ll id = s[i] - 'a'; if(cur->next[id]==NULL) return 0; cur = cur->next[id]; } return cur->fullword; } }; int main() { ll n; trie T; string a,b; scanf("%lld",&n); while(n--) { cin>>a>>b; if(a == "add") T.Insert(b); else printf("%lld\n",T.Search(b)); } return 0; } ///solution 02: using map. /* /// got tle #include<bits/stdc++.h> #define ll long long int #define rep0(i,n) for(i=0; i<(ll)n; i++) #define rep1(i,n) for(i=1; i<=(ll)n; i++) #define pb(x) push_back(x) #define mem(x,y) memset(x,y,sizeof(x)) #define pii pair<ll,ll> #define pdd pair<double,double> #define ff first #define ss second #define mp make_pair #define pi 3.1415926535897932384626433832795 using namespace std; map<string,ll>m; ll i,j; void add(string s) { ll ln=s.size(); string p; for(j=0; j<ln; j++) { p+=s[j]; if(!m.count(p)) m[p]=1; else m[p]++; } } ll freq(string s) { if(!m.count(s)) return 0; else return m[s]; } int main() { ll n; scanf("%lld",&n); string o,s; while(n--) { cin>>o>>s; if(o=="add") add(s); else { printf("%lld\n",freq(s)); } } return 0; } */
8b8dbf9a22ba6e3447f96950d053a568acbbd42d
ddb07bc35f34da37b02fa5639c571795673090c4
/src/main.cc
b3d4e94125e41b65cfbb33b868833bde16ed4cff
[]
no_license
jogloran/asobitomo
aa83267c70aad8388574b9cf2da770a791141049
19168d7c86f49523c94681ec6170c7889d2b2ad1
refs/heads/master
2021-05-01T10:15:17.041064
2018-02-16T06:10:11
2018-02-16T06:10:23
121,106,369
0
0
null
null
null
null
UTF-8
C++
false
false
847
cc
main.cc
#include <iostream> #include <iomanip> #include <fstream> #include "types.h" #include "cpu.h" using namespace std; int main() { CPU cpu("Tetris.gb"); copy(cpu.mmu.rom.begin(), cpu.mmu.rom.end(), cpu.mmu.mem.begin()); // cpu.mmu.mem[0xff44] = 0x90; while (!cpu.halted && cpu.pc != 0x100) { cpu.step(); } // // // int i = 0; // while (i++ < 1500000) { // cpu.step(); // } std::ofstream out("vram"); copy(cpu.mmu.mem.begin() + 0x8000, cpu.mmu.mem.begin() + 0x9000, ostream_iterator<unsigned int>(out, " ")); out.close(); out.open("oam"); copy(cpu.mmu.mem.begin() + 0xfe00, cpu.mmu.mem.begin() + 0xfea0, ostream_iterator<unsigned int>(out, " ")); out.close(); out.open("btt"); copy(cpu.mmu.mem.begin() + 0x9800, cpu.mmu.mem.begin() + 0x9c00, ostream_iterator<unsigned int>(out, " ")); out.close(); }
b8a90ac9f6139bf92d32c161499f93dba0da234e
cb428b16d983666b7e77f2e451cd0071c3f48f99
/Robocup/Scene.h
d6f40cc620ea5e8be32b7e6ddb82e6a36a131b84
[]
no_license
artulec88/Robocup
f62e9dd2451a7d9adb3b111160cda03bc3dcd18e
20df8902281f6d59aa25e6788a56462f5953b2ba
refs/heads/master
2021-03-12T20:13:09.406335
2013-11-17T04:10:10
2013-11-17T04:10:10
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,371
h
Scene.h
//#pragma once //#include <iostream> //#include <string> // //#include "Controls.h" //#include "Color.h" // //class Scene //{ //public: // Scene(std::string windowTitle, int windowWidth = 1024, int windowHeight = 768); // ~Scene(void); // //public: // static void KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods); //public: // void SetClearColor(const Color& color); // void LoadShaders(std::string vertexShaderPath, std::string fragmentShaderPath); // void DrawFrame(); // // void Start(); //public: // void SetProgramID(GLuint programID) { _programID = programID; }; // GLuint GetProgramID() const { return _programID; }; // // void SetMatrixID(GLuint matrixID) { _matrixID = matrixID; }; // GLuint GetMatrixID() const { return _matrixID; }; // // float GetFoV() const { return _fov; }; // float GetAspect() const { return _aspect; }; // float GetZNear() const { return _zNear; }; // float GetZFar() const { return _zFar; }; //protected: // int _windowWidth; // int _windowHeight; // std::string _windowTitle; // // GLFWwindow* _window; // GLuint _programID; // GLuint _matrixID; // // Inputs::Controls* _controls; // // float _fov; // TODO: Think where fov, aspect, zNear and zFar should be put // float _aspect; // float _zNear; // float _zFar; // // GLuint _vertexArrayID; // GLuint _cubeVertexBuffer; // GLuint _cubeColorBuffer; //}; //
501f29b2c7d98b99276580ebbc82cf6719960de5
60dfb27511fd463c1664f411b537735c59a1eb83
/ws04_inlab/Passenger.cpp
cbc1609655a3bba21511d8e27e3ea7b32f7300ef
[]
no_license
hrvali/SenecaCPA-OOP244
8b4461454044b79408a9ff4b2133edcfb86bc314
3065c602d4de3f63e1df51a56e03435cee858290
refs/heads/master
2022-01-16T07:37:11.643211
2019-05-27T05:21:04
2019-05-27T05:21:04
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,450
cpp
Passenger.cpp
#include <iostream> #include <cstring> #include "Passenger.h" using namespace std; // TODO: add file header comments here // TODO: add your headers here // TODO: continue your namespace here namespace sict { Passenger::Passenger() { *passenger_name = '\0'; *destination = '\0'; } Passenger::Passenger(const char *passName, const char *dest) { int flag = 1; if (passName != '\0' && passName != nullptr) { if ((dest != '\0') && dest != nullptr) { strncpy(passenger_name, passName, 32); strncpy(destination, dest, 32); flag = 0; } } // Invalid data so object is set to safe empty state if (flag) { *passenger_name = '\0'; *destination = '\0'; } } bool Passenger::isEmpty() const { bool empty = true; if (*passenger_name != '\0' && passenger_name != nullptr) { if (*destination != '\0' && destination != nullptr) { empty = false; } } return empty; } void Passenger::display() const { if (!isEmpty()) { cout << passenger_name << " - " << destination << endl; } else { cout << "No passenger!" << endl; } return; } }
dfbf034c59b23d98da1c43509f3f24f63baf08d3
30c2631ed046d7662476b94fb7f5286c47377f60
/examples/cpp/queries/group_by/src/main.cpp
a07e3c89fb4d458e34edb0ee30097bd3f2b73b51
[ "MIT" ]
permissive
SanderMertens/flecs
a840093340f0d1eb2bd30ec1585296f81f2aab39
41fb856c4e1162f44b59d7881ef508d64d56bf10
refs/heads/master
2023-08-24T16:21:41.790084
2023-08-24T08:38:57
2023-08-24T08:49:52
146,155,284
4,731
456
MIT
2023-09-05T16:01:58
2018-08-26T05:53:05
C
UTF-8
C++
false
false
3,534
cpp
main.cpp
#include <group_by.h> #include <iostream> // Group by is a feature of cached queries that allows applications to assign a // group id to each matched table. Tables that are assigned the same group id // are stored together in "groups". This ensures that when a query is iterated, // tables that share a group are iterated together. // // Groups in the cache are ordered by group id, which ensures that tables with // lower ids are iterated before table with higher ids. This is the same // mechanism that is used by the cascade feature, which groups tables by depth // in a relationship hierarchy. // // This makes groups a more efficient, though less granular mechanism for // ordering entities. Order is maintained at the group level, which means that // once a group is created, tables can get added and removed to the group // with is an O(1) operation. // // Groups can also be used as an efficient filtering mechanism. See the // set_group example for more details. struct Position { double x, y; }; // Dummy tag to put entities in different tables struct Tag { }; // Create a relationship to use for for the group_by function. Tables will // be assigned the relationship target as group id struct Group { }; // Targets for the relationship, which will be used as group ids. struct First { }; struct Second { }; struct Third { }; int main() { flecs::world ecs; // Register components in order so that id for First is lower than Third ecs.component<First>(); ecs.component<Second>(); ecs.component<Third>(); // Grouped query flecs::query<Position> q = ecs.query_builder<Position>() .group_by<Group>() .build(); // Create entities in 6 different tables with 3 group ids ecs.entity().add<Group, Third>() .set<Position>({1, 1}); ecs.entity().add<Group, Second>() .set<Position>({2, 2}); ecs.entity().add<Group, First>() .set<Position>({3, 3}); ecs.entity().add<Group, Third>() .set<Position>({4, 4}) .add<Tag>(); ecs.entity().add<Group, Second>() .set<Position>({5, 5}) .add<Tag>(); ecs.entity().add<Group, First>() .set<Position>({6, 6}) .add<Tag>(); // The query cache now looks like this: // - group First: // - table [Position, (Group, First)] // - table [Postion, Tag, (Group, First)] // // - group Second: // - table [Position, (Group, Second)] // - table [Postion, Tag, (Group, Second)] // // - group Third: // - table [Position, (Group, Third)] // - table [Postion, Tag, (Group, Third)] // q.iter([&](flecs::iter& it, Position *p) { flecs::entity group = ecs.entity(it.group_id()); std::cout << " - group " << group.path() << ": table [" << it.table().str() << "]\n"; for (auto i : it) { std::cout << " {" << p[i].x << ", " << p[i].y << "}\n"; } std::cout << "\n"; }); // Output: // - group ::First: table [Position, (Group,First)] // {3, 3} // // - group ::First: table [Position, Tag, (Group,First)] // {6, 6} // // - group ::Second: table [Position, (Group,Second)] // {2, 2} // // - group ::Second: table [Position, Tag, (Group,Second)] // {5, 5} // // - group ::Third: table [Position, (Group,Third)] // {1, 1} // // - group ::Third: table [Position, Tag, (Group,Third)] // {4, 4} }
cc545d5f08e6121e5ede6658c19748f1515e7367
83d68569c42ef1aa08b60f66ed0558c4439fdbbf
/2017-07-24-practice/C.cpp
a458f510046d49284bcaa21cd1504b4960525e73
[ "MIT" ]
permissive
tangjz/Three-Investigators
c4d91da24a9038e4e96f0af01e13974458415d2f
49c72dc4c7674db46b8076c0264f7b157d362f8e
refs/heads/master
2022-05-11T19:13:35.845309
2022-04-02T18:19:16
2022-04-02T18:19:47
127,548,373
4
2
null
null
null
null
UTF-8
C++
false
false
765
cpp
C.cpp
#include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #include <bitset> using namespace std; const int ALPHA = 10; const int NMAX = 1100, LMAX = 5001000; int N; char str[LMAX]; bitset<NMAX> mask[ALPHA], cur; int main() { int i, j, x, cnt; char tmp; while(scanf("%d", &N) != EOF) { cur.reset(); for(i = 0;i < N;i += 1) mask[i].reset(); for(i = 0;i < N;i += 1) { scanf("%d", &cnt); for(j = 0;j < cnt;j += 1) { scanf("%d", &x); mask[x].set(i); } } scanf("%s", str); for(i = 0;str[i];i += 1) { cur = ((cur<<1).set(0)) & mask[str[i] - '0']; if(cur.test(N - 1)) { tmp = str[i + 1]; str[i + 1] = '\0'; printf("%s\n", str + i - N + 1); str[i + 1] = tmp; } } } exit(0); }
0760839d583bddab94b78b3ab090a66ece8ecad5
d2c59879cbaa8f657da7124594607293a9ea2761
/rtsp_fd_fr/modules/inference/fdfr/include/mark_face_attr_sink.hpp
10a6c167bbbeb923445a4852a1133c4090d2eb84
[]
no_license
freewind2016/bm1880-ai-demo-program
9032cb2845a79b3bfebf270f8771ea6ee3f1e102
d1634e5c314e346a1229c4df96efe9c37401cdd7
refs/heads/master
2022-06-01T02:39:57.883696
2020-03-20T01:56:43
2020-03-20T01:56:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
600
hpp
mark_face_attr_sink.hpp
#pragma once #include "mark_face_sink.hpp" template <typename ResultType> class MarkFaceAttrSink : public MarkFaceSink<ResultType> { public: MarkFaceAttrSink(std::shared_ptr<DataSink<image_t>> &&sink) : MarkFaceSink<ResultType>(std::move(sink)) {} bool put(image_t &&frame, ResultType &&result) override; }; void mark_attr(image_t &image, fr_result_t &face); template <typename ResultType> bool MarkFaceAttrSink<ResultType>::put(image_t &&frame, ResultType &&result) { for (auto &face : result) { mark_attr(frame, face); } return this->sink_->put(std::move(frame)); }
414e4f7ab170867490c0f4bbf5806d0858e4c075
babe7014a4f8e5a24a055fbd35d8eedc75e14bd2
/C++/9375.cpp
151f1c34fea639559286cddda29ad70b1fd7b8d5
[]
no_license
HaeKang/algorithm_study
35235082727de80ed8b37bce83eba9253ec171cc
ba407dff6353c74c0fad7f7ab6e852009545a6c8
refs/heads/master
2023-09-01T20:08:42.203164
2023-09-01T14:12:28
2023-09-01T14:12:28
247,705,869
2
0
null
null
null
null
UTF-8
C++
false
false
619
cpp
9375.cpp
#include <iostream> #include <map> #include <string> using namespace std; int t, n, ans; string s1, s2; map<string, int> m; map<string, int>::iterator it; int main() { ios_base::sync_with_stdio(true); cin.tie(nullptr); cin >> t; while (t--) { n = 0; ans = 1; m.clear(); cin >> n; for (int i = 0; i < n; i++) { s1.clear(); s2.clear(); cin >> s1 >> s2; if (m.find(s2) != m.end()) { m[s2]++; } else { m.insert({s2,1}); } } for (it = m.begin(); it != m.end(); it++) { int cnt = it->second; ans *= (cnt + 1); } cout << ans - 1 << '\n'; } return 0; }
e6ac6e17f6742ef9deff6ae4784f6e103e542ad5
6b84794b2b0aa23a2d2c3c5f1437001d103213ae
/Problems & Contents/URI/2-Ad-Hoc/1532-ArremessoDeBolas.cpp
8f09463b4b54c6beeeed1a6d36ae66920cc8d160
[]
no_license
mtreviso/university
2406d3782759a75ef00af4da8e4e1ed99cfb89d8
164dbfc13d6dddb3bdbb04957c4702d0e0885402
refs/heads/master
2021-01-09T08:14:21.551497
2016-06-09T23:19:01
2016-06-09T23:19:01
16,703,296
0
2
null
null
null
null
UTF-8
C++
false
false
655
cpp
1532-ArremessoDeBolas.cpp
#include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <vector> using namespace std; bool verificar(int n, int v){ int i, vezes, total; for(int j=1; j<=v; j++){ i = 1; vezes = total = j; while(i <= vezes and vezes >= 0){ if(total == n) return true; total += vezes; if(i == vezes-1){ i = -1; vezes--; } i++; } } return false; } int main(){ int n, v; while(scanf("%d %d", &n, &v) and n > 0){ if(n <= v) printf("possivel\n"); else{ if(verificar(n, v)) printf("possivel\n"); else printf("impossivel\n"); } } return 0; }
6a558700036c3f2d69c6bcecee61b83a8b428fbe
eff9ac543ab58b2cc8c5658dab72b424830cc3c5
/CAPTURE_MANAGER.h
cb88b3116dc82593f9d0bb16489901bf43deb081
[]
no_license
ByungJoonLee/2D_Simulator_BackUp
18b576e9a2c2ce4f525fc1d8f75f45491e5ce568
dc711a6a968ac7580a55f274daa729fb30270ac9
refs/heads/master
2016-09-05T23:09:41.612900
2015-08-23T22:48:58
2015-08-23T22:48:58
38,921,093
1
0
null
null
null
null
UTF-8
C++
false
false
1,208
h
CAPTURE_MANAGER.h
/******************************************************************** CAPTURE_MANAGER.h *********************************************************************/ #pragma once #include <string> class CAPTURE_MANAGER { public: CAPTURE_MANAGER(); ~CAPTURE_MANAGER(); void Initialize(std::string& script_abs_path); void ResetCapture(); void CopyScript(); void AutoCopyScript(); bool IsAutoCaptureImage() { return auto_capture_; } void CaptureImage(int current_frame, int width, int height); bool IsAutoCaptureMovieAtLastFrame() { return auto_video_; } bool IsAutoDeleteImage() { return auto_delete_image_; } void MakeVideo(); void MakeVideoAtLastFrame(); private: int last_frame_; bool auto_run_; bool auto_copy_script_; bool auto_capture_; bool auto_video_; bool auto_delete_image_; bool auto_exit_; std::string output_common_path_; std::string output_image_path_; std::string output_video_path_; std::string output_log_path_; std::string output_script_path_; std::string output_common_file_basename_; std::string output_image_file_basename_; std::string output_video_file_basename_; std::string output_log_file_basename_; std::string output_script_file_basename_; };
d137d0966ede72b125cffe1cedd3a1fc6793c7d5
f3273eddfcc02f02c1326fae7c83bf51a3d2681b
/project.cxx
85fecc57cccee1870446e5bac049622df69ba391
[]
no_license
ashuGupta99/simple-stone-paper-sissor-CLI-game-using-python
889ab478b7597371349a7e8f409004522990c3e9
21b00db9ab007cf408a1e27ff8fb83594be65d55
refs/heads/master
2022-12-20T01:23:28.445499
2020-09-10T01:45:57
2020-09-10T01:45:57
null
0
0
null
null
null
null
UTF-8
C++
false
false
261
cxx
project.cxx
#include <stdio.h> int main(){ int a[10]; int b,ans=0,i; scanf("%d",&b); for(i=0;i<b;i++) { scanf("%d",&a[i]); } for(i=0;i<b;i++){ if((b%2)==0){ ans=(ans + a); } } printf("Answer is %d",ans); return 0; } //new changes //added new features
2ab7a15bd3d8512504d785a645d25550689d8e4f
e1bdbaf1143e5d66ffbfd76ca13b250bc2ac4a5c
/12 completed.cpp
5352a13a47250eda7f91bd6da7bdf9342874fa5c
[]
no_license
kvitron/praktika_cpp
bb57925dd6e257e1a5aa265db47f2e9c7ba05857
696552620e16ea4fce48b1a42bfc53bb128ca8b5
refs/heads/master
2020-04-29T22:49:44.663067
2019-06-03T18:00:39
2019-06-03T18:00:39
176,459,913
0
0
null
null
null
null
WINDOWS-1251
C++
false
false
16,056
cpp
12 completed.cpp
/*Реализовать класс _String, предоставляющий функционал работы со строками.*/ //#include "pch.h" #include <iostream> #include <cstdlib> //для функции перевода из массива символов в число: atoi(), atof() #include <cmath> //для функции отсечения дробной части от числа: trunc() using namespace std; class _String { protected: char *value; int stringLength = -1; public: _String() {//конструктор по умолчанию value = new char[1]; value[0] = 0; stringLength = 0; } _String(char *val) { //из массива char int i = 0; while (val[i] != 0) { //считаем длину i++; } char *str = new char[i + 1]; i = 0; while (val[i] != 0) { str[i] = val[i]; i++; } str[i] = 0; value = str; stringLength = i; } _String(const char *val) { //из константной строки int i = 0; while (val[i] != 0) { //считаем длину i++; } char *str = new char[i + 1]; i = 0; while (val[i] != 0) { str[i] = val[i]; i++; } str[i] = 0; value = str; stringLength = i; } ~_String() { //деструктор delete[] value; } _String(const _String &element) { //из другого объекта _Srting int i = 0; value = new char[element.stringLength + 1]; while (element.value[i] != 0) { //копируем value[i] = element.value[i]; i++; } value[i] = 0; stringLength = element.stringLength; } int length() { //возвращает длину строки return stringLength; } void append(_String str) { //добавляем объект _String int i = 0; while (str.value[i] != 0) { //считаем длину i++; } char *tempstr = new char[stringLength + i + 1]; i = 0; while (value[i] != 0) { //копируем старую строку tempstr[i] = value[i]; i++; } delete[] value; i = 0; while (str.value[i] != 0) { //копируем новую строку tempstr[stringLength + i] = str.value[i]; i++; } value[stringLength + i] = 0; stringLength += i; value = tempstr; } void append(char *str) { //добавляем массив char int i = 0; while (str[i] != 0) { //считаем длину i++; } char *tempstr = new char[stringLength + i + 1]; i = 0; while (value[i] != 0) { //копируем старую строку tempstr[i] = value[i]; i++; } delete[] value; i = 0; while (str[i] != 0) { //копируем новую строку tempstr[stringLength + i] = str[i]; i++; } tempstr[stringLength + i] = 0; stringLength += i; value = tempstr; } void append(char symbol) { //добавляем символ char int i = 0; char *tempstr = new char[stringLength + 1]; while (value[i] != 0) { //копируем старую строку tempstr[i] = value[i]; i++; } delete[] value; tempstr[i] = symbol; tempstr[i + 1] = 0; stringLength += i + 1; value = tempstr; } void append(const char *str) { //добавляем константную строку int i = 0; while (str[i] != 0) { //считаем длину i++; } char *tempstr = new char[stringLength + i + 1]; i = 0; while (value[i] != 0) { //копируем старую строку tempstr[i] = value[i]; i++; } delete[] value; i = 0; while (str[i] != 0) { //копируем новую строку tempstr[stringLength + i] = str[i]; i++; } tempstr[stringLength + i] = 0; stringLength += i; value = tempstr; } void setValue(char *val) { //установить значение массива char delete[] value; int i = 0; while (val[i] != 0) { //считаем длину i++; } value = new char[i + 1]; i = 0; while (val[i] != 0) { //заполняем value[i] = val[i]; i++; } value[i] = 0; stringLength = i; } void setValue(const char *val) { //установить константное значение delete[] value; int i = 0; while (val[i] != 0) { //считаем длину i++; } value = new char[i + 1]; i = 0; while (val[i] != 0) { //заполняем value[i] = val[i]; i++; } value[i] = 0; stringLength = i; } void setValue(int val) { //установить значение переконвертированное из int delete[] value; if (val == 0) { //если 0 value = new char[2]; value[0] = '0'; value[1] = 0; stringLength = 1; } else { //если не 0 int i = 0, j, length = 0, val1 = val; while (val1 != 0) { //считаем количество цифр в числе val1 /= 10; length++; } if (val < 0) { //если число отрицательное value = new char[length + 2]; //оставляем место для знака минус value[0] = '-'; i++; } else { //если число положительное value = new char[length + 1]; } val1 = val; while (val1 != 0) { //записываем число в массив в перевернутом виде value[i] = char(abs(val1 % 10) + 48); val1 /= 10; i++; } if (val < 0) { //при отрицательном числе делаем реверс пропуская знак минус j = 1; value[length + 1] = 0; stringLength = length + 1; //учитывая знак минуса } else { //при положительном числе j = 0; value[length] = 0; stringLength = length; } for (j, i--; j < (length+1) / 2; j++, i--) { //делаем реверс массива swap(value[j], value[i]); } } } void setValue(double val, int precision = 10) { //установить значение переконвертированное из double c точностью 10 знаков после запятой по умолчанию delete[] value; //удаляем старую строку if (val == 0) { //при нуле value = new char[2]; value[0] = '0'; value[1] = 0; stringLength = 1; } else { //val != 0 int lenintpart = 0, intpart = trunc(val), i = 0, j = 0, minus = 0; double floatpart = abs(val - intpart); char *tempstr = new char[100]; if (val < 0) { //учитываем минус при отрицательном числе tempstr[0] = '-'; minus++; i++; j++; } if (intpart == 0) { //нулевая целая часть lenintpart = 1; tempstr[i] = '0'; i++; } else { //целая часть не нулевая while (intpart != 0) { //записываем целую часть в перевернутом виде и считаем количество цифр tempstr[i] = char(abs(intpart % 10) + 48); intpart /= 10; lenintpart++; i++; } for (i--, j; j < (lenintpart + 1 + minus) / 2; j++, i--) { //делаем реверс массива swap(tempstr[j], tempstr[i]); } i = lenintpart + minus; //передвигаемся на ячейку после цифр целой части } if (floatpart != 0) { //есть дробная часть tempstr[i] = '.'; i++; int step = 0; while (floatpart != 0 && step < precision) { //записываем дробную часть j = trunc(floatpart * 10); //первая цифра после точки tempstr[i] = char(j + 48); floatpart = abs((floatpart * 10) - j); //модуль потому, что при ошибках округления может появиться отрицательное число i++; step++; } } tempstr[i] = 0; value = new char[i]; for (j = 0; j < i; j++) { //копируем элементы из временной строки value[j] = tempstr[j]; } value[j] = 0; stringLength = j; delete[] tempstr; } } _String operator = (const _String &element) { //возвращает дублированный объект _String исходного объекта char *str = new char[element.stringLength + 1]; int i = 0; while (element.value[i] != 0) { //копируем строку str[i] = element.value[i]; i++; } str[i] = 0; _String newstring; newstring.value = str; newstring.stringLength = element.stringLength; return newstring; } _String operator + (const _String &right) { //возвращает новый объект _String, полученный в результате конкатенации исходных char *str = new char[stringLength + right.stringLength + 1]; int i = 0, j = 0; while (value[i] != 0) { //копируем первую часть str[i] = value[i]; i++; } while (right.value[j] != 0) { //копируем вторую часть str[i] = right.value[j]; i++; j++; } str[i] = 0; _String newstring; newstring.value = str; newstring.stringLength = stringLength + right.stringLength; return newstring; } int pos(const char *str) { //первое вхождение подстроки. вернет -1 если не найдено if (str[0] == 0) { cout << "Error in _String.pos(): empty input" << endl; return -1; } int i, j = 0, index = 0; for (i = 0; i < stringLength; i++) { //проход по исходной строке if (str[j] == 0) { //искомая подстрока нашлась return index; } if (value[i] == str[j]) { //символы совпадают j++; } else { //символы не совпадают index = i + 1; j = 0; } } if (str[j] == 0) { //искомая подстрока заканчивается там же, где исходная строка return index; } else { //ни одного полного совпадения return -1; } } void remove(int position, int length) { //удалить подстроку из строки if (position < 0 || position >= stringLength) { cout << "Error in _String.remove(): position error" << endl; } else if (length > stringLength) { cout << "Error in _String.remove(): length error" << endl; } else if (position + length > stringLength) { cout << "Error in _String.remove(): position + length > old length" << endl; } else { char *str = new char[stringLength - length]; for (int i = 0; i < position; i++) { //копируем до выреза str[i] = value[i]; } for (int i = position + length; i < stringLength; i++) { //копируем остальное str[i - length] = value[i]; } str[stringLength - length] = 0; delete[] value; value = str; stringLength -= length; } } void insert(int position, const char *source) { //вставка константной подстроки в исходную строку int length = 0, i = 0, j = 0; while (source[length] != 0) { //подсчет длины вставляемой строки length++; } char *str = new char[stringLength + length]; while (i < position) { //копируем до вставки str[i] = value[i]; i++; } while (source[j] != 0) { //копируем вставляемые str[i] = source[j]; i++; j++; } j = position; while (value[j] != 0) {//копируем оставшиеся элементы str[i] = value[j]; i++; j++; } str[i] = 0; delete[] value; value = str; stringLength += length; } void insert(int position, char *source) { //вставка подстроки в исходную строку int length = 0, i = 0, j = 0; while (source[length] != 0) { //подсчет длины вставляемой строки length++; } char *str = new char[stringLength + length]; while (i < position) { //копируем до вставки str[i] = value[i]; i++; } while (source[j] != 0) { //копируем вставляемые str[i] = source[j]; i++; j++; } j = position; while (value[j] != 0) {//копируем оставшиеся элементы str[i] = value[j]; i++; j++; } str[i] = 0; delete[] value; value = str; stringLength += length; } void insert(int position, _String source) { //вставка подстроки из другого объекта _String в строку int i = 0, j = 0; char *str = new char[stringLength + source.stringLength]; while (i < position) { //копируем до вставки str[i] = value[i]; i++; } while (source.value[j] != 0) { //копируем вставляемые str[i] = source.value[j]; i++; j++; } j = position; while (value[j] != 0) {//копируем оставшиеся элементы str[i] = value[j]; i++; j++; } str[i] = 0; delete[] value; value = str; stringLength += source.stringLength; } _String copy(int position, int length) { //возвращает динмическую подстроку char *str = new char[length + 1]; int i, j; //позиции в исходной и новой строке for (i = position, j = 0; j < length; i++, j++) { //копируем str[j] = value[i]; } str[j] = 0; _String newstring; // создаем возвращаемую подстроку newstring.stringLength = j; newstring.value = str; return newstring; } char operator [] (int index) { //возвращает символ с индексом index return value[index]; } int parseInt(int &error) { //конвертация в int. error вернет индекс первого символа, который не относится к числу. иначе -1 int i = 1; if (value[0] != '+' && value[0] != '-' && (value[i] < '0' || value[i] > '9')) { //первый символ не +, не -, не цифра error = 0; return 0; } while (value[i] != 0) { if (value[i] < '0' || value[i] > '9') { //если символ не является цифрой error = i; return 0; } i++; } error = -1; return atoi(value); } float parseFloat(int &error) { //конвертация во float. error вернет индекс первого символа, который не относится к числу. иначе -1 if (value[0] == '+' || value[0] == '-') { //если за знаком сразу идет точка if (value[1] == '.') { error = 1; return 0; } } if (value[0] != '+' && value[0] != '-' && (value[0] < '0' || value[0] > '9')) { //не +, не -, не цифра error = 0; return 0; } int i = 1; bool dot = false; //встречалась ли разделительная точка while (value[i] != 0) { if (value[i] == '.' && dot == false) { //если это первый раз встретившаяся точка dot = true; } else if (value[i] < '0' || value[i] > '9') { //если символ не является цифрой error = i; return 0; } i++; } error = -1; return atof(value); } bool isEqual(char *str) { //сравнение со строкой на одинаковость int i = 0; bool f = true; while (value[i] != 0) { if (value[i] != str[i]) { return false; } i++; } if (str[i] != 0) { // если в str больше элементов, чем в value return false; } return true; } bool isEqual(const char *str) { //сравнение с констнтной строкой на одинаковость int i = 0; bool f = true; while (value[i] != 0) { if (value[i] != str[i]) { return false; } i++; } if (str[i] != 0) { // если в str больше элементов, чем в value return false; } return true; } const char getValue(){ //возвращает значение строку return value; } }; int main() { _String s("aadfadaf"); double val = 0.123456; int p = 5; s.setValue(val,p); cout << s.value << ' ' << s.stringLength << endl; return 0; }
6c743a01403d3df779df866302adf3a1a882dbab
d26a93001382cd60dd9fa4002c25fee289c3e80c
/Leetcode/TRIE/longest_word_in_dictionary/trie.cpp
4bcf768d526f53b97dc51f557330dc86fd1ab161
[]
no_license
veedee2000/Competitive-Programming
cfb0e38d5534252f65eb266c24b19fd6c9f5124b
cebf93a994e10faf02138726435bb11b5b8ff807
refs/heads/master
2021-09-05T08:21:11.344179
2021-08-07T08:57:48
2021-08-07T08:57:48
207,164,471
4
0
null
null
null
null
UTF-8
C++
false
false
1,328
cpp
trie.cpp
class Solution { public: struct Trie{ struct Trie *child[26]; bool end_of_word; }; struct Trie* getnode(void){ struct Trie* node = new Trie; node -> end_of_word = false; for(int i=0;i<26;i++){ node -> child[i] = NULL; } return node; } bool insert(struct Trie* root, string word){ int count = 0; for(int i = 0;i < word.size();i++){ int index = word[i] - 'a'; if(!root -> end_of_word) ++count; if(!root -> child[index]){ root -> child[index] = getnode(); } root = root -> child[index]; } root -> end_of_word = true; if(count == 1) return true; else return false; } string longestWord(vector<string>& words) { int n = words.size(); sort(words.begin(),words.end()); if(n == 1) return words[0]; if(n == 0) return 0; struct Trie* root = getnode(); string ans = ""; for(auto x:words){ bool valid = insert(root, x); if(valid){ if(x.size() > ans.size()){ ans = x; } } } return ans; } };
939417f223e123612942c8fa786639247ca28ab2
254ebe87d7ce06e8a5a616f437f600100dd2d4ba
/corsys-conquest/src/dgate/src/jpegconv.hpp
39596ad59225bc4553db2476e1054b3fd4ea0b9d
[]
no_license
kerrylinux/corsys
00c34a38cad56a451313a2bc7b2ede9e464751d1
62978b3e062ed929d41eadbd13612301d15d273d
refs/heads/master
2023-04-03T23:45:22.298587
2019-09-13T01:04:25
2019-09-13T01:04:25
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,057
hpp
jpegconv.hpp
// // jpegconv.hpp // /* 20120710 bcb Created. 20131111 bcb Changed from #include<> to #include"" for Xcode 20131207 bcb Added JPeg_LS 20151203 bcb Moved some dependent defines from total.cpp to here. 20160203 bcb Fix VS 2015 Libjpeg bool redefine. */ #ifndef jpegconv_hpp #define jpegconv_hpp #ifdef _WIN32 #define boolean bool #endif #include "imagedata.hpp" // dependent defines #ifdef BCB_FIX // Became tired of retyping on different systems. #define FUJI_FIX // Allows decompressing Fuji AC3 jpeg compressed,not encapsulated images. #endif #ifdef HAVE_LIBJPEG #undef NOINTJPEG // Used to make Libjpeg use int as UINT. #ifndef UINT_MAX #define UINT_MAX 0xffffffff #endif #endif #ifdef HAVE_LIBOPENJPEG2 #define HAVE_LIBOPENJPEG #endif #ifdef HAVE_LIBOPENJPEG #define HAVE_J2K #endif #ifdef HAVE_LIBJASPER #ifdef HAVE_LIBOPENJPEG #define HAVE_BOTH_J2KLIBS #else // Only one lib #define HAVE_J2K #endif #endif #ifdef HAVE_LIBJPEG #ifdef _WIN32 #ifndef __RPCNDR_H__ #define __RPCNDR_H__ // don't redifine boolean #include "jpeglib.h" #include "jerror.h" #include "setjmp.h" #undef __RPCNDR_H__ #else // !__RPCNDR_H__ #include "jpeglib.h" #include "jerror.h" #include "setjmp.h" #endif // !__RPCNDR_H__ #else //UNIX #include "jpeglib.h" #include "jerror.h" #include "setjmp.h" #endif //_WIN32 #endif //HAVE_LIBJPEG #ifdef HAVE_LIBJPEG METHODDEF(void) joutput_message (j_common_ptr cinfo); METHODDEF(void) jerror_exit (j_common_ptr cinfo); METHODDEF(void) jdoes_nothing_comp (j_compress_ptr cinfo); METHODDEF(void) jdoes_nothing_decomp (j_decompress_ptr cinfo); METHODDEF(boolean) jreturns_true_comp (j_compress_ptr cinfo); #else// Use jpeg_encoder.cpp UINT32 encode_image (UINT8 *input_ptr, UINT8 *output_ptr, UINT32 quality_factor, UINT32 image_format, UINT32 image_width, UINT32 image_height); #endif BOOL ToJPG(DICOMDataObject* pDDO, char *filename, int size, int append, int level, int window, unsigned int frame); #ifdef HAVE_LIBJPEG BOOL CompressJPEGL(DICOMDataObject* pDDO, int comp = '1', int jpegQuality = 95 ); METHODDEF(boolean) jfill_input_buffer (j_decompress_ptr cinfo); METHODDEF(void) jskip_input_data (j_decompress_ptr cinfo, long num_bytes); BOOL DecompressJPEGL(DICOMDataObject* pDDO); #endif //End HAVE_LIBJEPG #ifdef HAVE_J2K BOOL HaveNoJ2kStream(ImageData *imageDataPtr); #endif #ifdef HAVE_LIBJASPER BOOL CompressJPEG2K(DICOMDataObject* pDDO, int j2kQuality); BOOL DecompressJPEG2K(DICOMDataObject* pDDO); #endif //End LIBJASPER #ifdef HAVE_LIBOPENJPEG void error_callback(const char *msg, void *client_data); void warning_callback(const char *msg, void *client_data); void info_callback(const char *msg, void *client_data); BOOL CompressJPEG2Ko(DICOMDataObject* pDDO, int j2kQuality); BOOL DecompressJPEG2Ko(DICOMDataObject* pDDO); #endif //End LIBOPENJPEG #ifdef HAVE_LIBCHARLS// JPEG LS stuff BOOL CompressJPEGLS(DICOMDataObject* pDDO, int jpegQuality = 0); BOOL DecompressJPEGLS(DICOMDataObject* pDDO); #endif #endif
49db2ea6b485b6d16f629a392a28add15f3c421d
5ef71f37dd27576256bb59676d48f3591b927d3f
/linkedList_44.cpp
48b3a7a791a12144fd8885f8bf207d1737ffcd53
[]
no_license
yashkapoor007/geeksforgeeks
737e80926f489c9de03ab18103af814951326b85
6eb5d685eea556ed4bf191bf2525d0ecb1024e17
refs/heads/master
2018-09-29T19:22:32.802682
2018-06-19T13:52:48
2018-06-19T13:52:48
118,266,201
0
0
null
null
null
null
UTF-8
C++
false
false
1,004
cpp
linkedList_44.cpp
struct node* findIntersection(struct node* head1, struct node* head2) { int *arr1=new int[1001]; int *arr2=new int[1001]; for(int i=0;i<1001;i++) { arr1[i]=0; arr2[i]=0; } node* result=NULL; node* tail=NULL; node* temp1=head1; node* temp2=head2; while(temp1) { arr1[temp1->data]++; temp1=temp1->next; } while(temp2) { arr2[temp2->data]++; temp2=temp2->next; } for(int i=0;i<1001;i++) { int min=arr1[i]>arr2[i]?arr2[i]:arr1[i]; while(min) { node* newnode=(node*)malloc(sizeof(node)); newnode->next=NULL; newnode->data=i; if(result==NULL) { result=newnode; tail=newnode; } else { tail->next=newnode; tail=tail->next; } min--; } } delete []arr1; return result; }
863b136cc1e79a59c65652f8dca6132bff9216f3
4bcc9806152542ab43fc2cf47c499424f200896c
/tensorflow/tsl/platform/default/human_readable_json.cc
1e842230056a8017617ccaa98a5fc41b0681921d
[ "Apache-2.0", "LicenseRef-scancode-generic-cla", "BSD-2-Clause" ]
permissive
tensorflow/tensorflow
906276dbafcc70a941026aa5dc50425ef71ee282
a7f3934a67900720af3d3b15389551483bee50b8
refs/heads/master
2023-08-25T04:24:41.611870
2023-08-25T04:06:24
2023-08-25T04:14:08
45,717,250
208,740
109,943
Apache-2.0
2023-09-14T20:55:50
2015-11-07T01:19:20
C++
UTF-8
C++
false
false
2,575
cc
human_readable_json.cc
/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #include "tensorflow/tsl/platform/human_readable_json.h" #include "tensorflow/tsl/platform/errors.h" #include "tensorflow/tsl/platform/status.h" #include "tensorflow/tsl/platform/strcat.h" namespace tsl { Status ProtoToHumanReadableJson(const protobuf::Message& proto, string* result, bool ignore_accuracy_loss) { result->clear(); protobuf::util::JsonPrintOptions json_options; json_options.preserve_proto_field_names = true; json_options.always_print_primitive_fields = true; auto status = protobuf::util::MessageToJsonString(proto, result, json_options); if (!status.ok()) { // Convert error_msg google::protobuf::StringPiece to // tsl::StringPiece. auto error_msg = status.message(); return errors::Internal( strings::StrCat("Could not convert proto to JSON string: ", StringPiece(error_msg.data(), error_msg.length()))); } return OkStatus(); } Status ProtoToHumanReadableJson(const protobuf::MessageLite& proto, string* result, bool ignore_accuracy_loss) { *result = "[human readable output not available for lite protos]"; return OkStatus(); } Status HumanReadableJsonToProto(const string& str, protobuf::Message* proto) { proto->Clear(); auto status = protobuf::util::JsonStringToMessage(str, proto); if (!status.ok()) { // Convert error_msg google::protobuf::StringPiece to // tsl::StringPiece. auto error_msg = status.message(); return errors::Internal( strings::StrCat("Could not convert JSON string to proto: ", StringPiece(error_msg.data(), error_msg.length()))); } return OkStatus(); } Status HumanReadableJsonToProto(const string& str, protobuf::MessageLite* proto) { return errors::Internal("Cannot parse JSON protos on Android"); } } // namespace tsl